/* ==========================================================================
   Tablica ogłoszeń IM UJ — site stylesheet
   Matches the oglo4.html reference exactly: Newsreader serif + Ubuntu sans,
   Institutional Blue #2e59a3 + reserved Gold #eec84f, a fixed blue header bar
   with a gold underline, a light-cream "Ważne" seal (accent #7a5a00 on
   #fbf0c9), sharp 3px / 4px corners (no 10px), a plain serif date block, and a
   #162d4c serif footer with a gold top accent. Light + dark. Tokens drive
   everything.
   ========================================================================== */

/* ---- Tokens (light = default) ------------------------------------------- */
:root {
    --bg: #f4f6fa;
    --card: #ffffff;              /* oglo4 --surface */
    --line: #dbe1ec;             /* oglo4 --line */
    --line-strong: #c6cedd;      /* derived, slightly darker line */
    --text: #1a2540;             /* oglo4 --ink */
    --muted: #5a6579;
    --brand: #2e59a3;            /* oglo4 --brand (links + accent) */
    --brand-strong: #26498a;     /* hover */
    --bar: #2e59a3;              /* header bar — fixed in BOTH themes (oglo4) */
    --bar-ink: #ffffff;
    --btn-bg: #2e59a3;           /* primary button */
    --btn-bg-hover: #26498a;
    --btn-fg: #ffffff;           /* oglo4 --brand-ink */
    --gold: #eec84f;
    --accent: #7a5a00;           /* oglo4 --accent (flag text) */
    --accent-bg: #fbf0c9;        /* oglo4 --accent-bg (flag bg) */
    --chip: #e4e9f3;             /* oglo4 --chip */
    --focus: #1d5fd6;            /* oglo4 --focus */
    --ctl: #7b879c;              /* control border */
    --danger: #b91c1c;
    --danger-soft: #fdecec;
    --danger-fg: #b91c1c;
    --ok: #14732e;
    --warn: #9a5b00;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
    --radius: 4px;               /* containers (oglo4) */
    --radius-sm: 3px;            /* small elements: chips, tags, flags, quick links (oglo4) */
    --maxw: 1180px;              /* oglo4 .wrap */
    --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
    --font-sans: "Ubuntu", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---- Tokens (dark) — both the media query and the JS data-theme override --- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0e1524; --card: #16203a; --line: #2a3656; --line-strong: #3a4a6b;
        --text: #e8ecf5; --muted: #9aa6c0;
        --brand: #8fb1ff; --brand-strong: #a9c3ff;
        --btn-bg: #8fb1ff; --btn-bg-hover: #a9c3ff; --btn-fg: #0e1524;
        --gold: #eec84f; --accent: #eec84f; --accent-bg: #3a3115;
        --chip: #223051; --focus: #8fb1ff; --ctl: #7083a8;
        --danger: #f87171; --danger-soft: #3a2323; --danger-fg: #f87171;
        --ok: #4ade80; --warn: #f2b155;
        --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .55);
    }
}
:root[data-theme="dark"] {
    --bg: #0e1524; --card: #16203a; --line: #2a3656; --line-strong: #3a4a6b;
    --text: #e8ecf5; --muted: #9aa6c0;
    --brand: #8fb1ff; --brand-strong: #a9c3ff;
    --btn-bg: #8fb1ff; --btn-bg-hover: #a9c3ff; --btn-fg: #0e1524;
    --gold: #eec84f; --accent: #eec84f; --accent-bg: #3a3115;
    --chip: #223051; --focus: #8fb1ff; --ctl: #7083a8;
    --danger: #f87171; --danger-soft: #3a2323; --danger-fg: #f87171;
    --ok: #4ade80; --warn: #f2b155;
    --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .55);
}
:root[data-theme="light"] {
    --bg: #f4f6fa; --card: #ffffff; --line: #dbe1ec; --line-strong: #c6cedd;
    --text: #1a2540; --muted: #5a6579;
    --brand: #2e59a3; --brand-strong: #26498a;
    --btn-bg: #2e59a3; --btn-bg-hover: #26498a; --btn-fg: #ffffff;
    --gold: #eec84f; --accent: #7a5a00; --accent-bg: #fbf0c9;
    --chip: #e4e9f3; --focus: #1d5fd6; --ctl: #7b879c;
    --danger: #b91c1c; --danger-soft: #fdecec; --danger-fg: #b91c1c;
    --ok: #14732e; --warn: #9a5b00;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
}

/* ---- Reset / base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: .5rem; }

body {
    font: 400 1rem/1.55 var(--font-sans);
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
img, svg { max-width: 100%; height: auto; }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); text-decoration: underline; }

h1, h2, h3, h4 {
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
}
button { font: inherit; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }
.site-main { flex: 1 0 auto; }

/* ---- Accessibility ------------------------------------------------------- */
.sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: .5rem; top: -6rem; z-index: 100;
    background: var(--card); color: var(--text); border: 2px solid var(--focus);
    padding: .7rem 1rem; border-radius: var(--radius); font-weight: 500; text-decoration: none;
    transition: top .15s ease;
}
.skip-link:focus { top: .5rem; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius); }
@supports not selector(:focus-visible) {
    a:focus, button:focus, input:focus, select:focus, textarea:focus, [tabindex]:focus {
        outline: 3px solid var(--focus); outline-offset: 2px;
    }
}

/* ---- Header bar (fixed blue, gold underline) ----------------------------- */
.bar { background: var(--bar); color: var(--bar-ink); }
.bar-inner {
    position: relative; display: flex; align-items: center; justify-content: space-between;
    gap: .2rem 1.5rem; flex-wrap: wrap; min-height: 4rem; padding-top: .5rem; padding-bottom: .5rem;
}
.bar-inner::after {
    content: ""; position: absolute; left: clamp(1rem, 4vw, 2rem); bottom: 0;
    width: min(220px, 40%); height: 3px; background: var(--gold);
}
.brand { display: inline-flex; flex-direction: column; line-height: 1.2; text-decoration: none; color: var(--bar-ink); }
.brand:hover { text-decoration: none; }
.brand-name { font-family: var(--font-sans); font-weight: 500; font-size: clamp(1.05rem, 2.8vw, 1.3rem); color: var(--bar-ink); }
.brand-sub { font-family: var(--font-sans); font-weight: 400; font-size: .8rem; opacity: .85; color: var(--bar-ink); margin-top: .1rem; }

.bar-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.quick { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; }
.quick a {
    font-family: var(--font-sans); font-weight: 700; font-size: .8rem; text-transform: uppercase;
    color: var(--bar-ink); padding: .7rem .75rem; border-radius: var(--radius-sm);
}
.quick a:hover { background: rgba(255, 255, 255, .16); text-decoration: none; color: var(--bar-ink); }

/* Header controls keep working on the blue bar (app-specific, styled to fit) */
.bar-user { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-greeting { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--bar-ink); }
.user-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, .2); color: var(--bar-ink);
    font-weight: 700; font-size: .82rem;
}
.user-name { font-weight: 500; color: var(--bar-ink); }
.theme-toggle {
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, .5); background: transparent; color: var(--bar-ink);
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1;
}
.theme-toggle:hover { background: rgba(255, 255, 255, .16); color: var(--bar-ink); }
.bar .btn { background: transparent; color: var(--bar-ink); border-color: rgba(255, 255, 255, .5); }
.bar .btn:hover { background: rgba(255, 255, 255, .16); border-color: #fff; color: var(--bar-ink); }
.bar .btn-primary { background: #fff; color: var(--brand); border-color: #fff; }
.bar .btn-primary:hover { background: rgba(255, 255, 255, .9); color: var(--brand-strong); }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: .55rem .95rem; border-radius: var(--radius); border: 1px solid transparent;
    font-family: var(--font-sans); font-weight: 500; font-size: .9rem; cursor: pointer;
    line-height: 1.2; text-align: center; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.btn-primary:hover { background: var(--btn-bg-hover); border-color: var(--btn-bg-hover); }
.btn-outline { background: var(--card); color: var(--brand); border-color: var(--brand); }
.btn-outline:hover { background: var(--chip); color: var(--brand-strong); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--chip); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(1.08); }
.btn-sm { padding: .5rem .9rem; font-size: .88rem; min-height: 2.5rem; }
.btn-xs { padding: .3rem .6rem; font-size: .8rem; font-weight: 600; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- Inputs -------------------------------------------------------------- */
input, select, textarea {
    font: inherit; color: var(--text); background: var(--card);
    border: 1px solid var(--ctl); border-radius: var(--radius); padding: .6rem .8rem; width: 100%;
}
input[type="checkbox"], input[type="radio"] { width: auto; }
/* NOTE: no ::placeholder color override. oglo4.html sets none, so its placeholders
   use the browser default (a lighter, neutral gray). Re-adding a `color: var(--muted)`
   placeholder rule makes the search placeholder visibly darker than oglo4 (removed
   2026-10-09 at the user's request to match oglo4 exactly). */
input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--brand); }
.input { width: 100%; }
.input-grow { flex: 1 1 auto; min-width: 160px; }
select {
    appearance: none; padding-right: 30px;
    background-image: linear-gradient(45deg, currentColor 50%, transparent 50%), linear-gradient(135deg, transparent 50%, currentColor 50%);
    background-position: right 16px top 52%, right 11px top 52%;
    background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}

/* ==========================================================================
   BOARD (list view)
   ========================================================================== */
.board { padding: 0 0 3rem; }

/* oglo4: the toolbar is a full-width sticky band (background + bottom border
   span the whole width) with its content inset. Here it sits inside `.container`,
   so we bleed it out to the full width and inset the search/chips with padding —
   otherwise the wider list shows through on the sides when scrolling. */
.toolbar {
    position: sticky; top: 0; z-index: 5;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    margin: 0 calc(-1 * clamp(1rem, 4vw, 2rem)) .5rem;
    padding: .6rem clamp(1rem, 4vw, 2rem) .7rem;
}
.search { position: relative; margin-bottom: .2rem; }
.search input {
    width: 100%; font: inherit; color: var(--text); background: var(--card);
    border: 1px solid var(--ctl); border-radius: var(--radius);
    padding: .75rem 1rem .75rem 2.8rem; min-height: 2.9rem;
}
.search input:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--brand); }
.search-ico { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); width: 1.15rem; height: 1.15rem; color: var(--muted); pointer-events: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.chips { display: flex; gap: .5rem; flex-wrap: wrap; padding: .7rem 0 .1rem; }
.chip {
    flex: none; font-family: var(--font-sans); font-weight: 500; font-size: .88rem;
    color: var(--text); background: var(--chip); border: 1px solid var(--ctl);
    border-radius: var(--radius-sm); padding: .5rem .95rem; min-height: 2.5rem;
    display: inline-flex; align-items: center; cursor: pointer;
}
.chip:hover { background: var(--line); color: var(--text); text-decoration: none; }
.chip.active { background: var(--brand); color: var(--btn-fg); border-color: var(--brand); }
.chip.active:hover { color: var(--btn-fg); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; align-items: start; padding: 1.25rem 0 0; }
/* oglo4: the board list is wider than the navbar — its `.layout` overrides
   the container's L/R padding to 0, so the list bleeds to the full width while
   the navbar/toolbar stay inset. (The detail view keeps the inset width.) */
.board .layout { margin: 0 calc(-1 * clamp(1rem, 4vw, 2rem)); }
.list { min-width: 0; }

.list-meta { font-size: .88rem; color: var(--muted); margin: 0 0 .8rem; }
.list-meta strong { color: var(--text); }
.list-meta .meta-tag { color: var(--brand); font-weight: 600; }

.items { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .75rem; }
.item {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.item:hover { border-color: var(--brand); }
.item.pinned { border-left: 5px solid var(--gold); }
/* The whole row is one clickable link (oglo4 `.head`) */
.head {
    display: grid; grid-template-columns: 3.6rem minmax(0, 1fr); gap: 1rem;
    width: 100%; padding: 1rem 1.1rem; box-sizing: border-box;
    color: inherit; text-decoration: none; cursor: pointer;
}
.head:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
/* On hover only the title underlines (oglo4) — cancel the global `a:hover`
   underline that would otherwise underline the whole clickable row. */
.head:hover { text-decoration: none; }
.head:hover .title { text-decoration: underline; text-underline-offset: 3px; }

/* Date block — plain, no box (oglo4) */
.date {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; line-height: 1; color: var(--muted); background: transparent; padding: 0; border-radius: 0;
}
.date:hover { text-decoration: none; }
.date b { display: block; font-family: var(--font-serif); font-size: 1.9rem; line-height: 1; font-weight: 600; color: var(--text); }
.date span { display: block; margin-top: .3rem; font-size: .78rem; color: var(--muted); }
/* legacy .d/.m/.y spans (kept for the pre-existing markup) */
.date .d { display: block; font-family: var(--font-serif); font-size: 1.9rem; line-height: 1; font-weight: 600; color: var(--text); }
.date .m, .date .y { display: inline; font-size: .78rem; color: var(--muted); }
.date .m { margin-top: .3rem; }

.item-body { min-width: 0; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-bottom: .3rem; font-size: .8rem; color: var(--muted); }
.flag {
    display: inline-flex; align-items: center; background: var(--accent-bg); color: var(--accent);
    padding: .12rem .55rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .8rem;
}
.tag {
    display: inline-flex; align-items: center; background: var(--chip); color: var(--text);
    padding: .12rem .55rem; border-radius: var(--radius-sm); font-weight: 500; font-size: .8rem;
}
.attach-foot {
    display: inline-flex; align-items: center; gap: .45rem;
    margin-top: .8rem; padding-top: .7rem; border-top: 1px solid var(--line);
    color: var(--muted); font-size: .82rem; font-weight: 500; white-space: nowrap;
}
.attach-foot .att-ico { flex: none; color: var(--muted); }

.title { font-family: var(--font-serif); font-weight: 600; font-size: 1.15rem; line-height: 1.3; margin: 0; color: var(--text); }
.excerpt { margin: .35rem 0 0; color: var(--muted); font-size: .93rem;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.item-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: .7rem; font-size: .85rem; color: var(--muted); }
.item-foot .attach { color: var(--brand); font-weight: 500; }
.item-foot .author { color: var(--muted); }

/* ---- Sidebar ------------------------------------------------------------- */
/* The sidebar sticks below the full-width sticky toolbar (search + kategorie,
   ~129px tall). `top` must clear that whole band or the "Przydatne" title gets
   tucked under it while the links show. (oglo4's `.side` isn't sticky; this is a
   deliberate app enhancement — keep `top` ≥ the toolbar height + a small gap.) */
.side { position: sticky; top: 140px; display: flex; flex-direction: column; gap: 1rem; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.15rem; margin-bottom: 1rem; }
.panel-title {
    font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600; color: var(--text);
    margin: 0 0 .7rem; letter-spacing: 0; text-transform: none;
}
.side-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .1rem; }
.side-links a { display: block; padding: .5rem .1rem; border-radius: var(--radius-sm); color: var(--text); font-size: .93rem; }
.side-links a:hover { text-decoration: underline; background: transparent; color: var(--text); }
.panel-cta { /* plain panel in oglo4; no gold edge */ }
.panel-text { color: var(--muted); font-size: .93rem; margin-bottom: .8rem; }
.panel .btn { margin-bottom: 0; }

/* ---- Empty state --------------------------------------------------------- */
.empty-state { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 2rem 1.2rem; text-align: center; color: var(--muted); }
.empty-state h2 { font-size: 1.15rem; margin-bottom: .5rem; color: var(--text); }
.empty-state p { margin-bottom: 1rem; }

/* ---- Pager --------------------------------------------------------------- */
.pager { margin-top: 1.4rem; }
.pagination { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; }
.pagination > li { margin: 0; }
.pagination > li > a,
.pagination > li > span {
    display: inline-flex; align-items: center; justify-content: center; min-width: 2.6rem; min-height: 2.6rem;
    padding: 0 .7rem; border-radius: var(--radius); border: 1px solid var(--ctl);
    background: var(--card); color: var(--text); font-family: var(--font-sans); font-weight: 500; font-size: .95rem;
}
.pagination > li > a:hover { border-color: var(--brand); text-decoration: none; color: var(--text); background: var(--card); }
.pagination > li.active > a,
.pagination > li.active > span { background: var(--brand); color: var(--btn-fg); border-color: var(--brand); }
.pagination > li.disabled > a,
.pagination > li.disabled > span { opacity: .4; cursor: default; }
.pagination > li > a { cursor: pointer; }

/* ==========================================================================
   DETAIL (single announcement)
   ========================================================================== */
.detail { padding: 0 0 3rem; }
.back {
    display: inline-flex; align-items: center; gap: .4rem; margin: 1.4rem 0 .6rem; padding: .55rem .1rem;
    text-decoration: none; font-weight: 500; font-size: .93rem; color: var(--brand); min-height: 2.5rem;
}
.back:hover { text-decoration: underline; color: var(--brand); }

.layout-detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; align-items: start; }
.detail .article, .detail .pn { grid-column: 1 / 2; }

.article { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.2rem, 3.5vw, 2.2rem); }
.article.pinned { border-top: 5px solid var(--gold); }

.a-meta { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-bottom: .5rem; font-size: .8rem; color: var(--muted); }
.a-title { font-family: var(--font-serif); font-weight: 600; font-size: clamp(1.6rem, 4.2vw, 2.4rem); line-height: 1.15; letter-spacing: -.01em; margin: .2rem 0 .8rem; color: var(--text); }

.info {
    display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; align-items: center; color: var(--muted); font-size: .9rem;
    padding-bottom: 1.1rem; margin-bottom: 1.3rem; border-bottom: 1px solid var(--line);
}
.info-item { display: inline-flex; align-items: baseline; gap: .3rem; }
.info .d { font-weight: 600; color: var(--text); }
.info .my { text-transform: none; letter-spacing: 0; }
.info strong { color: var(--text); font-weight: 600; }
.info-views { align-items: center; color: var(--muted); }
.info-views svg { flex: none; }

.text { color: var(--text); }
.text p { margin: 0 0 1rem; max-width: 68ch; font-size: 1.04rem; line-height: 1.7; }
.text h1, .text h2, .text h3 { font-family: var(--font-serif); }
.text h2 { font-size: 1.4rem; margin: 1.4rem 0 .6rem; }
.text h3 { font-size: 1.15rem; margin: 1.2rem 0 .5rem; }
.text a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.text a:hover { color: var(--brand-strong); }
.text ul, .text ol { padding-left: 1.4em; margin: 0 0 1rem; }
.text li + li { margin-top: .35em; }
.text blockquote { border-left: 4px solid var(--gold); padding: 2px 0 2px 16px; color: var(--muted); margin: 1rem 0; }
.text img { border-radius: var(--radius); }
.text code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--chip); padding: 1px 5px; border-radius: var(--radius-sm); }

/* ---- Attachments (detail) — bordered buttons (oglo4) --------------------- */
.attach { margin-top: 1.6rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.attach-title { font-family: var(--font-serif); font-size: 1.05rem; font-weight: 600; margin: 0 0 .6rem; color: var(--text); text-transform: none; letter-spacing: 0; }
.attach-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: stretch; gap: .5rem; }
.attach-item { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .6rem .9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); font-size: .93rem; min-height: 2.6rem; }
.attach-item a { display: inline-flex; align-items: center; flex: 0 1 auto; min-width: 0; color: var(--text); font-weight: 500; text-decoration: none; }
.attach-item a:hover { color: var(--brand); }
.attach-item:hover { border-color: var(--brand); }
/* The name takes its natural width (it must NOT grow — growing pushes the
   extension away from it) but can shrink: when it's too long it ellipsises so it
   never overflows, keeping the extension tight after it. attach-name.js upgrades
   that end-ellipsis to a MIDDLE one (start and end kept). The name and extension
   both inherit the link's color (incl. the hover state) so they highlight together. */
.attach-item a .attach-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-ext { flex: none; font-weight: 500; white-space: nowrap; }
.attach-icon { flex: none; font-size: 1rem; margin-right: .5rem; }
.attach-size { flex: none; margin-left: auto; color: var(--muted); font-size: .8rem; white-space: nowrap; }

.a-actions { margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; }
.legacy-note { margin-top: 1rem; font-size: .85rem; color: var(--muted); word-break: break-all; }

/* ---- Prev / next --------------------------------------------------------- */
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1.25rem; }
.pn-link { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1.1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.pn-link:hover { border-color: var(--brand); text-decoration: none; }
.pn-dir { font-size: .8rem; color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
.pn-title { font-family: var(--font-serif); font-size: 1rem; line-height: 1.3; color: var(--text); font-weight: 600; }
.pn-right { text-align: right; align-items: flex-end; }
.pn-spacer { display: block; }

/* ==========================================================================
   FORMS (create / edit + admin)
   ========================================================================== */
.page { padding: 1.6rem 0 3rem; }
.page h1 { font-size: 1.6rem; margin-bottom: .5rem; }
.page-subtitle { color: var(--muted); margin-bottom: 1.4rem; }
.form-page { max-width: 720px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head h1 { margin-bottom: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.form-field { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.form-field-wide { grid-column: 1 / -1; }
/* Announcement create/edit form: full-width, single-column — like the board
   list, not the 720px two-column admin forms. Scoped via the `form-page-wide`
   modifier on this form's container so the admin forms keep their layout. */
.form-page-wide { max-width: none; }
.form-page-wide .form-grid { grid-template-columns: 1fr; }

/* ---- Tagi field: select2-style widget (progressive enhancement) ----------- */
/* Built by web/js/tags.js; with JS off the real <input> below stays and works. */
.tags-enhanced #Announcement_tags { display: none; }
.tags-box { position: relative; }
.tags-widget {
    display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
    background: var(--card); border: 1px solid var(--ctl); border-radius: var(--radius);
    padding: .4rem .5rem; min-height: 2.9rem;
}
.tags-widget:focus-within { border-color: var(--brand); outline: 3px solid var(--focus); outline-offset: 1px; }
.tag-chip {
    display: inline-flex; align-items: center; gap: .3rem;
    background: var(--chip); border: 1px solid var(--ctl); border-radius: var(--radius-sm);
    padding: .15rem .25rem .15rem .5rem; font-size: .9rem; line-height: 1.3;
}
.tag-chip-x {
    border: 0; background: transparent; cursor: pointer; padding: .05rem .3rem;
    font-size: 1.05rem; line-height: 1; color: var(--muted); border-radius: var(--radius-sm);
}
.tag-chip-x:hover, .tag-chip-x:focus { color: var(--danger-fg); background: var(--line); outline: none; }
.tags-type {
    flex: 1 1 5.5rem; min-width: 5.5rem; border: 0; background: transparent;
    font: inherit; color: var(--text); padding: .2rem .1rem;
}
.tags-type:focus { outline: none; }
.tags-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; z-index: 30;
    background: var(--card); border: 1px solid var(--ctl); border-radius: var(--radius);
    box-shadow: 0 8px 22px rgba(16, 24, 40, .14); padding: .3rem;
    display: flex; flex-direction: column; gap: .1rem;
}
.tags-dropdown[hidden] { display: none; }
.tags-dd-item {
    border: 0; background: transparent; text-align: left; cursor: pointer;
    padding: .4rem .55rem; border-radius: var(--radius-sm); font: inherit; color: var(--text);
}
.tags-dd-item:hover, .tags-dd-item:focus { background: var(--chip); outline: none; }
.tags-dd-item.is-create { color: var(--brand); font-weight: 500; }

.form-field label { font-weight: 600; font-size: .93rem; }
.req { color: var(--danger-fg); }
.field-hint { font-size: .85rem; color: var(--muted); }
.field-error { font-size: .88rem; color: var(--danger-fg); font-weight: 600; }
.checkbox-label { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.checkbox-label input { width: 18px; height: 18px; }

.form-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }

/* ---- Error summary ------------------------------------------------------- */
.error-summary { background: var(--danger-soft); border: 1px solid var(--danger); border-left: 5px solid var(--danger); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 1.4rem; }
.error-summary:focus { outline: 3px solid var(--focus); outline-offset: 2px; }
.error-summary-title { font-weight: 700; color: var(--danger-fg); margin-bottom: .5rem; }
.error-summary-list { margin: 0; padding-left: 1.2em; color: var(--text); }
.error-summary-list li + li { margin-top: 3px; }

/* ---- Rich text editor ---------------------------------------------------- */
.richtext { border: 1px solid var(--ctl); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.richtext-toolbar { display: flex; flex-wrap: wrap; gap: 3px; padding: 6px 8px; background: var(--chip); border-bottom: 1px solid var(--line); }
.richtext-toolbar button { border: 1px solid transparent; background: transparent; color: var(--text); cursor: pointer; min-width: 30px; height: 30px; border-radius: var(--radius-sm); padding: 0 8px; font-size: .85rem; }
.richtext-toolbar button:hover { background: var(--card); border-color: var(--line-strong); }
.toolbar-sep { width: 1px; align-self: stretch; background: var(--line-strong); margin: 3px 4px; }
.richtext-editor {
    min-height: 220px; padding: 14px 16px; resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; line-height: 1.6;
}
/* WYSIWYG editing surface — progressive enhancement over .richtext-editor.
   With JS on, richtext.js hides the textarea and shows this live region (which
   also carries .text so the preview matches published content). With JS off the
   toolbar is hidden via <noscript> and the plain textarea is used. */
.richtext-on .richtext-editor { display: none; }
.richtext-editable { min-height: 220px; padding: 14px 16px; outline: none; }
.richtext-editable:focus { box-shadow: inset 0 0 0 2px var(--focus); }
.richtext-editable:empty::before { content: 'Zacznij pisać treść…'; color: var(--muted); }

/* ---- Attachments management (form) -------------------------------------- */
.attachment-manage { margin-top: 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.attachment-manage legend { font-weight: 700; margin-bottom: 12px; }
.attachment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attachment-item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--chip); border-radius: var(--radius); padding: 9px 13px; }
.attachment-item .attachment-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.attachment-item .attachment-size { flex: none; color: var(--muted); font-size: .82rem; }
.attachment-item a { flex: none; font-weight: 500; }
.attachment-delete-form { flex: none; margin: 0; }

/* ---- Auth / error pages -------------------------------------------------- */
.auth-page, .error-page { display: flex; justify-content: center; padding-top: 2.5rem; }
.auth-card, .error-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 32px; width: 100%; max-width: 440px; box-shadow: var(--shadow); }
.auth-card h1, .error-card h1 { font-size: 1.6rem; }
.auth-form { display: flex; flex-direction: column; gap: 1.1rem; }
.auth-form .form-actions { border-top: 0; padding-top: 4px; margin-top: 4px; }
.error-page { text-align: center; }
.error-card { max-width: 520px; text-align: center; }
.error-code { font-family: var(--font-serif); font-size: 4rem; font-weight: 700; color: var(--gold); line-height: 1; margin-bottom: 8px; }
.error-card h1 { margin-bottom: 10px; }
.error-card p { color: var(--muted); margin-bottom: 18px; }

/* ==========================================================================
   ADMIN
   ========================================================================== */
.admin-page h1 { font-size: 1.6rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 30px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 4px; }
a.stat-card:hover { border-color: var(--brand); text-decoration: none; }
.stat-value { font-family: var(--font-serif); font-size: 2rem; font-weight: 700; line-height: 1; color: var(--text); }
.stat-value.stat-ok { color: var(--ok); }
.stat-label { font-size: .85rem; color: var(--muted); }

.admin-shortcuts, .admin-section { margin-top: 30px; }
.admin-shortcuts h2, .admin-section h2 { font-size: 1.15rem; margin-bottom: 14px; }
.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.shortcut-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: block; }
.shortcut-card:hover { border-color: var(--brand); text-decoration: none; }
.shortcut-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.shortcut-card p { color: var(--muted); font-size: .9rem; }

/* ---- Tables -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 18px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 560px; }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table thead th {
    background: var(--chip); color: var(--text); font-weight: 700; font-size: .78rem;
    text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line-strong);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--chip); }
.td-title { font-weight: 600; }
.td-empty { text-align: center; color: var(--muted); padding: 26px; }
.td-actions { white-space: nowrap; }
.th-actions { text-align: right; }
.action-row { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }

/* ---- Filter bar (admin list) -------------------------------------------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filter-bar .input { max-width: 240px; }
.filter-bar .input-grow { max-width: none; }

/* ---- Status badges ------------------------------------------------------- */
.status-badge { display: inline-flex; align-items: center; padding: .12rem .55rem; border-radius: var(--radius-sm); font-size: .8rem; font-weight: 600; letter-spacing: .02em; }
.status-published { background: color-mix(in srgb, var(--ok) 16%, var(--card)); color: var(--ok); }
.status-draft { background: var(--chip); color: var(--muted); }
.status-archived { background: var(--chip); color: var(--text); }
.status-deleted { background: var(--danger-soft); color: var(--danger-fg); }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--radius-sm); font-size: .78rem; font-weight: 600; background: var(--chip); color: var(--muted); }
.badge-legacy { margin-left: 8px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .84rem; color: var(--muted); word-break: break-all; }

/* ---- Flash messages ------------------------------------------------------ */
.flash { border-radius: var(--radius); padding: 13px 18px; margin-bottom: 14px; font-weight: 500; border: 1px solid transparent; }
.flash-success { background: color-mix(in srgb, var(--ok) 13%, var(--card)); border-color: var(--ok); color: var(--text); }
.flash-error, .flash-danger { background: var(--danger-soft); border-color: var(--danger); color: var(--text); }
.flash-warning { background: color-mix(in srgb, var(--warn) 15%, var(--card)); border-color: var(--warn); color: var(--text); }
.flash-info { background: var(--chip); border-color: var(--line-strong); color: var(--text); }
.flash-leave { opacity: 0; transform: translateY(-6px); transition: opacity .35s ease, transform .35s ease; }

/* ---- Breadcrumbs (legacy) ------------------------------------------------ */
.breadcrumbs { display: flex; gap: 8px; align-items: center; margin-bottom: 18px; color: var(--muted); font-size: .9rem; }
.breadcrumbs a { color: var(--brand); }

/* ==========================================================================
   Footer (#162d4c serif, gold top accent — oglo4)
   ========================================================================== */
.foot { background: #162d4c; color: #fff; font-family: var(--font-serif); font-size: .85rem; line-height: 1.4; position: relative; margin-top: auto; }
.foot::before { content: ""; position: absolute; top: 0; left: clamp(1rem, 4vw, 2rem); width: min(120px, 40%); height: 3px; background: var(--gold); }
.foot .container { padding-top: .8rem; padding-bottom: .8rem; }
.foot a { color: inherit; text-decoration: none; display: inline-block; padding: .25rem 0; }
.foot a:hover { text-decoration: underline; text-underline-offset: 3px; }
.f-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 1.2rem; justify-content: flex-start; }
.f-row span, .f-row b, .f-row a { padding: .25rem 0; }
.f-row.sub { color: #9fb0c6; border-top: 1px solid #3d536c; margin-top: .3rem; padding-top: .2rem; }
.f-row b { font: 700 .8rem var(--font-sans); text-transform: uppercase; letter-spacing: .02em; }
/* legacy footer structure (kept styled to the oglo4 look) */
.foot-inner { display: flex; flex-direction: column; gap: .1rem; }
.foot-name { font-family: var(--font-serif); font-size: 1rem; font-weight: 700; line-height: 1.35; margin: 0 0 .3rem; }
.foot-sub, .foot-contact p, .foot-legal { margin: 0; color: #cdd8e6; }
.foot-legal { color: #9fb0c6; border-top: 1px solid #3d536c; margin-top: .3rem; padding-top: .2rem; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
    .layout, .layout-detail { grid-template-columns: 1fr; }
    .side { position: static; flex-direction: row; flex-wrap: wrap; }
    .side .panel { flex: 1 1 240px; margin-bottom: 0; }
}
@media (max-width: 700px) {
    .pn { grid-template-columns: 1fr; }
    .pn-right { text-align: left; align-items: flex-start; }
}
@media (max-width: 600px) {
    .head { grid-template-columns: 1fr; gap: .35rem; }
    .date { text-align: left; flex-direction: row; align-items: baseline; gap: .4rem; }
    .date b, .date .d { font-size: 1.3rem; }
    .date span, .date .m, .date .y { margin: 0; }
    .search .btn { width: 100%; }
    .brand-name { font-size: 1.05rem; }
    .quick { overflow-x: auto; }
}
@media (max-width: 720px) {
    .form-grid { grid-template-columns: 1fr; }
    .article { padding: 22px 20px; }
}

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
    .bar, .toolbar, .side, .back, .pn, .foot, .a-actions, .form-actions,
    .theme-toggle, .bar-user, .quick, .item-foot, .search { display: none !important; }
    body { background: #fff; color: #000; }
    .article, .item { border: 0; box-shadow: none; background: #fff; }
    .article.pinned { border-top: 3px solid #000; }
    a { color: #000; text-decoration: none; }
    .layout, .layout-detail { display: block; }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
