/* SZOP 2 – jeden lekki arkusz zamiast Bootstrapa ×3, glyphicons i Font Awesome z CDN. */

/* ---------- Tokeny ---------- */
:root {
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --bg: #f3f2ef;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --surface-3: #eeece7;
  --line: #e3e0d9;
  --line-strong: #cdc8be;
  --ink: #1c1a17;
  --ink-2: #4e4941;
  --ink-3: #857e73;

  --accent: #b3262e;
  --accent-hover: #981d25;
  --accent-ink: #ffffff;
  --accent-soft: #f6e4e3;

  --ok: #2e7a4d;   --ok-soft: #e2f0e7;
  --warn: #b0731a; --warn-soft: #f9eedb;
  --bad: #c0372c;  --bad-soft: #fae5e2;
  --info: #2d679e; --info-soft: #e3edf7;

  --ao-blue: #3a6db3; --ao-amber: #d19a16; --ao-red: #c0372c;
  --ao-slate: #6b7079; --ao-green: #2f8556; --ao-teal: #12838f; --ao-none: #a39d93;

  --shadow-sm: 0 1px 2px rgba(48, 36, 24, .06), 0 1px 1px rgba(48, 36, 24, .04);
  --shadow-md: 0 10px 28px -12px rgba(48, 36, 24, .28), 0 2px 6px rgba(48, 36, 24, .06);
  --shadow-lg: 0 24px 60px -20px rgba(30, 20, 10, .45);

  --r-lg: 14px; --r: 10px; --r-sm: 7px;
  --topbar-h: 60px;
  --z-top: 20;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131210; --surface: #1c1a17; --surface-2: #211f1b; --surface-3: #2a2723;
    --line: #34302a; --line-strong: #47423a; --ink: #f2efe9; --ink-2: #c7c0b5; --ink-3: #918a7e;
    --accent: #e25a5f; --accent-hover: #ec7277; --accent-ink: #1a0c0c; --accent-soft: #3b1e1f;
    --ok: #5dbb85; --ok-soft: #1c3225; --warn: #e2aa4c; --warn-soft: #382c16;
    --bad: #ef6c60; --bad-soft: #3c1f1b; --info: #6ea8de; --info-soft: #1a2a3a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 12px 30px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131210; --surface: #1c1a17; --surface-2: #211f1b; --surface-3: #2a2723;
  --line: #34302a; --line-strong: #47423a; --ink: #f2efe9; --ink-2: #c7c0b5; --ink-3: #918a7e;
  --accent: #e25a5f; --accent-hover: #ec7277; --accent-ink: #1a0c0c; --accent-soft: #3b1e1f;
  --ok: #5dbb85; --ok-soft: #1c3225; --warn: #e2aa4c; --warn-soft: #382c16;
  --bad: #ef6c60; --bad-soft: #3c1f1b; --info: #6ea8de; --info-soft: #1a2a3a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 12px 30px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---------- Baza ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  font: 400 15px/1.5 var(--font); color: var(--ink);
  background: var(--bg);
  background:
    radial-gradient(1200px 380px at 12% -120px, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -.012em; text-wrap: balance; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .92em; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.sr-only, .sr-only-focusable:not(:focus) {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.i { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75;
     stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }

.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--ink); color: var(--bg);
             padding: 8px 14px; border-radius: var(--r-sm); text-decoration: none; transition: top .2s; }
.skip-link:focus { top: 10px; }

/* Pasek ładowania przy przejściu między stronami (zamiast 3 MB animacji GIF) */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 60; pointer-events: none;
            background: var(--accent); transform: scaleX(0); transform-origin: left; opacity: 0; }
.is-leaving .progress { opacity: 1; transform: scaleX(.85); transition: transform 2.5s cubic-bezier(.1, .7, .2, 1), opacity .2s; }

/* ---------- Przyciski ---------- */
.btn {
  --btn-bg: var(--surface); --btn-ink: var(--ink); --btn-line: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 38px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--btn-line); background: var(--btn-bg); color: var(--btn-ink);
  font-weight: 500; font-size: .92rem; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .18s, border-color .18s, color .18s, transform .08s, box-shadow .18s;
}
.btn:hover { --btn-bg: var(--surface-2); --btn-line: var(--ink-3); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { --btn-bg: var(--accent); --btn-ink: var(--accent-ink); --btn-line: var(--accent); box-shadow: 0 1px 0 rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { --btn-bg: var(--accent-hover); --btn-line: var(--accent-hover); }
.btn-success { --btn-bg: var(--ok); --btn-ink: #fff; --btn-line: var(--ok); }
.btn-success:hover { --btn-bg: color-mix(in srgb, var(--ok) 86%, #000); --btn-line: var(--btn-bg); }
.btn-ghost { --btn-bg: transparent; --btn-line: transparent; --btn-ink: var(--ink-2); }
.btn-ghost:hover { --btn-bg: var(--surface-3); --btn-line: transparent; --btn-ink: var(--ink); }
.btn.is-danger { --btn-ink: var(--bad); }
.btn.is-danger:hover { --btn-bg: var(--bad-soft); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: .85rem; }
.btn-icon { padding: 0; width: 38px; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }
.on-dark { --btn-ink: #e9e4dc; }
.on-dark:hover { --btn-bg: rgba(255,255,255,.1); --btn-ink: #fff; }
.inline-form { display: inline-flex; margin: 0; }

/* ---------- Pasek górny ---------- */
.topbar {
  position: sticky; top: 0; z-index: var(--z-top);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; max-width: 1680px; margin: 0 auto; }
.brand { border: 0; background: none; padding: 4px; margin: 0; cursor: pointer; border-radius: var(--r-sm); display: flex; }
.brand img { height: 34px; width: auto; display: block; }
/* Logo ma ciemny napis – w trybie ciemnym dostaje jasną podkładkę */
:root[data-theme="dark"] .brand img, :root[data-theme="dark"] .login-logo { background: #fff; border-radius: 8px; padding: 3px 7px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand img, :root:not([data-theme="light"]) .login-logo { background: #fff; border-radius: 8px; padding: 3px 7px; }
}
.topbar-title { font-weight: 600; color: var(--ink-2); padding-left: 12px; margin-left: 4px; border-left: 1px solid var(--line);
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.menu-btn .i { width: 1.25em; height: 1.25em; }

.user-menu { margin-left: auto; position: relative; }
.user-menu > summary { list-style: none; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-btn { display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 4px; border-radius: 999px; cursor: pointer;
            border: 1px solid var(--line); background: var(--surface); transition: border-color .18s, background-color .18s; }
.user-btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.user-menu[open] .chev { transform: rotate(180deg); }
.chev { transition: transform .2s; color: var(--ink-3); }
.avatar { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
          background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: .78rem; letter-spacing: .02em; }
.user-name { font-weight: 500; font-size: .92rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 270px; padding: 6px;
            background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-md);
            animation: pop .16s ease-out; }
.dropdown-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: grid; gap: 2px; }
.dropdown-head span { font-size: .82rem; color: var(--ink-3); }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none;
                 border-radius: var(--r-sm); text-align: left; text-decoration: none; cursor: pointer; font-size: .92rem; }
.dropdown-item:hover { background: var(--surface-3); }
.dropdown-item.is-danger { color: var(--bad); }
.theme-row { cursor: default; }
.theme-row:hover { background: none; }
.seg { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 3px 8px; font-size: .78rem; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.is-on { background: var(--ink); color: var(--bg); }

@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ---------- Menu kafelkowe (jak stare menu.php, ale lżejsze) ---------- */
.menu-overlay { border: 0; padding: 0; margin: 0; width: 100%; max-width: none; height: 100%; max-height: none;
                background: transparent; color: #f1ece4; }
.menu-overlay::backdrop { background: rgba(18, 14, 11, .82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.menu-overlay[open] { display: flex; animation: fade .2s ease-out; }
.menu-inner { width: min(1120px, 100%); margin: 0 auto; padding: 24px 16px 40px; overflow-y: auto; }
.menu-head { display: flex; gap: 10px; align-items: center; margin-bottom: 26px; position: sticky; top: 0; }
.menu-search { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 46px; border-radius: 12px;
               background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); }
.menu-search:focus-within { border-color: rgba(255, 255, 255, .4); background: rgba(255, 255, 255, .12); }
.menu-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: #fff; font-size: 1rem; }
.menu-search input::placeholder { color: rgba(255, 255, 255, .55); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 10px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 10px 14px;
        border-radius: var(--r-lg); text-decoration: none; text-align: center; color: #e9e4dc;
        border: 1px solid transparent; transition: background-color .18s, border-color .18s, transform .18s; }
.tile img { width: 56px; height: 56px; object-fit: cover; border-radius: 50%; background: #fff;
            box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .6); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.tile:hover, .tile:focus-visible { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .12); color: #fff; }
.tile:hover img { transform: translateY(-3px) scale(1.04); }
.tile.is-active { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .25); }
.tile-title { font-size: .9rem; font-weight: 500; line-height: 1.25; }
.tile-tag { display: inline-flex; align-items: center; gap: 4px; font-size: .68rem; letter-spacing: .02em; color: rgba(255, 255, 255, .5); }
.tile-tag .i { width: .95em; height: .95em; }
.menu-empty { text-align: center; color: rgba(255, 255, 255, .6); margin-top: 30px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- Okna dialogowe ---------- */
.modal { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; width: min(460px, calc(100% - 32px));
         background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(20, 15, 10, .45); }
.modal[open] { animation: pop .18s ease-out; }
.modal-head, .modal-foot { display: flex; align-items: center; gap: 10px; padding: 14px 18px; }
.modal-head { border-bottom: 1px solid var(--line); justify-content: space-between; }
.modal-head h2 { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.modal-body { padding: 18px; }
.modal-foot { border-top: 1px solid var(--line); justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ---------- Układ strony ---------- */
.page { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 22px 16px 48px; }
.page-wide { max-width: 1680px; }
.page-narrow { max-width: 880px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 20px; margin-bottom: 18px; }
.page-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-title img { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: var(--surface); box-shadow: var(--shadow-sm); }
.page-meta { margin-top: 4px; color: var(--ink-3); font-size: .88rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin: -6px 0 14px; color: var(--ink-3); text-decoration: none; font-size: .9rem; }
.back-link:hover { color: var(--ink); }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.section-head h2 { display: flex; align-items: center; gap: 8px; }
.section-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.stack { display: grid; gap: 12px; }
.site-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 14px 16px 18px;
             max-width: 1680px; width: 100%; margin: 0 auto; color: var(--ink-3); font-size: .78rem; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.panel > * { min-width: 0; }
.panel { padding: 20px; }
.panel.widget, .panel.panel-flush { padding: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.panel-title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: .98rem; text-decoration: none; min-width: 0; }
a.panel-title:hover { color: var(--accent); }
.panel-title img { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; background: #fff; flex: none; }
.count { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 6px;
         background: var(--surface-3); color: var(--ink-2); font: 500 .78rem/1 var(--mono); }
.count-ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- Komunikaty ---------- */
.flashes { display: grid; gap: 8px; margin-bottom: 16px; }
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px 11px 14px; border-radius: var(--r);
         border: 1px solid transparent; font-size: .93rem; margin-bottom: 12px; }
.flashes .alert { margin: 0; }
.alert > .i { margin-top: 2px; }
.alert > span { flex: 1; }
.alert-success { background: var(--ok-soft); color: var(--ink); color: color-mix(in srgb, var(--ok) 75%, var(--ink)); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-error   { background: var(--bad-soft); color: var(--ink); color: color-mix(in srgb, var(--bad) 75%, var(--ink)); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert-warn    { background: var(--warn-soft); color: var(--ink); color: color-mix(in srgb, var(--warn) 65%, var(--ink)); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert-close { border: 0; background: none; padding: 2px; cursor: pointer; opacity: .6; border-radius: 6px; color: inherit; }
.alert-close:hover { opacity: 1; }
.alert-details { display: block; padding: 0; }
.alert-details > summary { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; list-style: none; }
.alert-details > summary::-webkit-details-marker { display: none; }
.helmet-list { list-style: none; margin: 0; padding: 4px 14px 12px 42px; columns: 3 260px; column-gap: 24px; }
.helmet-list li { break-inside: avoid; display: flex; gap: 8px; align-items: baseline; padding: 3px 0; }
.helmet-list a { font-weight: 500; }
.helmet-list .mono { margin-left: auto; }

/* ---------- Formularze ---------- */
.input {
  width: 100%; min-height: 38px; padding: 7px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input:hover { border-color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.input[readonly] { background: var(--surface-2); color: var(--ink-2); }
textarea.input { resize: vertical; line-height: 1.5; }
select.input { padding-right: 30px; }
.input-sm { min-height: 32px; padding: 4px 9px; font-size: .88rem; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .i { position: absolute; left: 11px; color: var(--ink-3); pointer-events: none; }
.input-icon > .input { padding-left: 36px; }
.field { display: grid; gap: 5px; align-content: start; border: 0; margin: 0; padding: 0; min-width: 0; }
.field-label { font-size: .8rem; font-weight: 500; color: var(--ink-2); padding: 0; }
.field-error { color: var(--bad); font-size: .82rem; }
.field-inline { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-2); }
.field-inline .input { width: auto; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 22px; min-height: 38px; align-items: center; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid > * { grid-column: span 12; }
.form-grid > .span-2 { grid-column: span 2; } .form-grid > .span-3 { grid-column: span 3; }
.form-grid > .span-4 { grid-column: span 4; } .form-grid > .span-6 { grid-column: span 6; }
.form-grid > .span-8 { grid-column: span 8; }
.form-grid > .span-5 { grid-column: span 5; } .form-grid > .span-7 { grid-column: span 7; }
.form-grid > .span-9 { grid-column: span 9; } .form-grid > .span-10 { grid-column: span 10; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.form-panel.narrow { max-width: 820px; }
@media (max-width: 760px) { .form-grid > [class*="span-"] { grid-column: span 12; } }

/* ---------- Pulpit: obsada ---------- */
.presence { margin-bottom: 22px; }
.presence .section-head h2 .mono { font-weight: 500; color: var(--ink-3); font-size: .95rem; }
.brigades { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.brigade { --ao: var(--ao-none); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
           box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column; }
.brigade header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 10px 12px 8px;
                  border-top: 4px solid var(--ao); background: var(--surface-2); background: color-mix(in srgb, var(--ao) 9%, var(--surface)); }
.brigade header strong { font-size: .93rem; }
.brigade-ao { font: 600 .74rem/1 var(--mono); color: var(--ao); letter-spacing: .04em; }
.brigade ul { list-style: none; margin: 0; padding: 6px; }
.ao-blue { --ao: var(--ao-blue); } .ao-amber { --ao: var(--ao-amber); } .ao-red { --ao: var(--ao-red); }
.ao-slate { --ao: var(--ao-slate); } .ao-green { --ao: var(--ao-green); } .ao-teal { --ao: var(--ao-teal); }
.person-chip { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 6px; border: 0; background: none;
               border-radius: 6px; text-align: left; font-size: .88rem; cursor: pointer; }
.person-chip:hover { background: var(--surface-3); }
.shift { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 5px; flex: none;
         background: var(--ink); color: var(--bg); font: 600 .7rem/1 var(--mono); }
.pop { position: absolute; z-index: 30; min-width: 200px; max-width: 280px; padding: 12px 14px; border-radius: var(--r);
       background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-md); font-size: .88rem; animation: pop .14s ease-out; }
.pop strong { display: block; }
.pop .muted { display: block; margin: 2px 0 8px; }
.pop a { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 500; font-family: var(--mono); }

/* ---------- Pulpit: listy (układ jak w starym index.php: 3/3/2/2/2) ---------- */
.widgets { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; align-items: start; }
.widget { grid-column: span 12; display: flex; flex-direction: column; max-height: 560px; }
@media (min-width: 760px)  { .w-3 { grid-column: span 6; } .w-2 { grid-column: span 4; } }
@media (min-width: 1280px) { .w-3 { grid-column: span 3; } .w-2 { grid-column: span 2; } }
.wlist { list-style: none; margin: 0; padding: 6px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.wlist-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm);
              text-decoration: none; font-size: .88rem; line-height: 1.35; border-left: 3px solid transparent; transition: background-color .15s; }
a.wlist-item:hover { background: var(--surface-3); }
.wlist-item + .wlist-item, .wlist li + li { margin-top: 1px; }
.wlist-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.wlist-text .muted { font-size: .8rem; }
.state-bad { border-left-color: var(--bad); }
.state-warn { border-left-color: var(--warn); }
.state-bad .date-tag { color: var(--bad); }
.date-tag { font-size: .8rem; color: var(--ink-3); white-space: nowrap; }
.is-past { color: var(--ink-3); }
.is-static { cursor: default; }
.planned-flag { width: 12px; height: 12px; border-radius: 3px; flex: none; background: var(--ok); outline: 2px solid var(--bad); animation: blink 1.6s steps(2, jump-none) infinite; }
.empty-inline { padding: 18px 16px; color: var(--ink-3); font-size: .9rem; }

/* ---------- Rejestr zdarzeń ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px; margin-bottom: 14px;
           background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.filter-search { flex: 1 1 280px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip > span { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 8px; cursor: pointer;
               border: 1px solid var(--line-strong); font-size: .85rem; color: var(--ink-2); transition: all .15s; user-select: none; }
.chip:hover > span { border-color: var(--ink-3); color: var(--ink); }
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; background: var(--ink-3); }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); } .dot-bad { background: var(--bad); }
.dot.is-blinking { animation: blink 1.2s steps(2, jump-none) infinite; box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 25%, transparent); }
@keyframes blink { 50% { opacity: .15; } }

.ev-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.ev-row { display: grid; grid-template-columns: 150px 150px 110px minmax(130px, 1fr) minmax(220px, 2.4fr) 170px; gap: 6px 16px;
          align-items: start; padding: 11px 16px; text-decoration: none; font-size: .9rem; border-top: 1px solid var(--line);
          transition: background-color .12s; }
.ev-row:first-child { border-top: 0; }
a.ev-row:hover { background: var(--surface-2); }
.ev-headrow { font-size: .74rem; font-weight: 600; letter-spacing: .03em; color: var(--ink-3); background: var(--surface-2); padding-block: 8px; }
.ev-date { display: flex; align-items: center; gap: 8px; }
.ev-sub, .ev-type { color: var(--info); font-weight: 500; }
.ev-desc { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ev-who { color: var(--warn); font-size: .84rem; display: grid; }
.ev-who .muted { display: flex; align-items: center; gap: 4px; font-size: .8rem; }
.ev-row.is-unread { background: var(--surface-2); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.ev-row.is-unread .ev-desc { font-weight: 600; }
.ev-row.is-unread .ev-date::before { content: ""; width: 3px; align-self: stretch; margin: -11px 0 -11px -16px; background: var(--accent); }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 6px; font-size: .8rem;
       background: var(--surface-3); color: var(--ink-2); }
.tag-bad { background: var(--bad-soft); color: var(--bad); }
.ev-date .tag { padding: 2px 5px; }
@media (max-width: 1100px) {
  .ev-headrow { display: none; }
  .ev-row { grid-template-columns: 1fr 1fr; }
  .ev-desc { grid-column: 1 / -1; order: 5; }
  .ev-who { grid-column: 1 / -1; order: 6; display: flex; gap: 10px; flex-wrap: wrap; }
  .ev-dev { color: var(--ink-3); }
}

.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 18px; }
.page-link { display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 8px; border-radius: var(--r-sm);
             text-decoration: none; font: 500 .88rem/1 var(--mono); color: var(--ink-2); border: 1px solid transparent; }
a.page-link:hover { background: var(--surface); border-color: var(--line); }
.page-link.is-current { background: var(--ink); color: var(--bg); }
.page-link.is-disabled { opacity: .35; }
.page-gap { display: inline-grid; place-items: center; width: 24px; color: var(--ink-3); }

/* ---------- Zdarzenie ---------- */
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: .8rem; font-weight: 500; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px 22px; margin: 0 0 16px; }
.facts dt { font-size: .76rem; font-weight: 500; color: var(--ink-3); margin-bottom: 3px; }
.facts dd { margin: 0; font-weight: 500; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.prose-block { padding-top: 16px; max-width: 80ch; }
.prose-block h3 { font-size: .78rem; font-weight: 600; color: var(--ink-3); margin-bottom: 5px; letter-spacing: .02em; }

.stages { margin-top: 26px; }
.stages .section-head h2 .count { font-size: .76rem; }
.new-stage { margin-bottom: 14px; border-color: var(--line-strong); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.tab-list { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.tab { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 14px; border: 1px solid transparent; border-bottom: 0;
       border-radius: var(--r) var(--r) 0 0; background: none; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--ink-2); white-space: nowrap; }
.tab:hover { color: var(--ink); background: var(--surface-3); }
.tab.is-active { background: var(--surface); border-color: var(--line); color: var(--ink); position: relative; top: 1px; }
.tab-sub { font-size: .74rem; font-weight: 400; color: var(--ink-3); }
.tab-panel { padding: 20px; border-top-left-radius: 0; }
.tab-panel + .tab-panel { margin-top: 12px; }
.tabs.js-tabs .tab-panel { display: none; margin-top: 0; }
.tabs.js-tabs .tab-panel.is-active { display: block; }
.tabs:not(.js-tabs) .tab-list { display: none; }
.stage-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: 22px; }
@media (max-width: 860px) { .stage-grid { grid-template-columns: 1fr; } }
.stage-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 12px; color: var(--ink-2); font-size: .9rem; }
.stage-meta .btn { margin-left: auto; }
.stage-docs { border-left: 1px solid var(--line); padding-left: 20px; display: grid; gap: 10px; align-content: start; }
@media (max-width: 860px) { .stage-docs { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; } }
.stage-docs h3 { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--ink-2); }
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.doc-list li { display: flex; align-items: center; gap: 4px; }
.doc-list a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: var(--r-sm);
              background: var(--surface-2); border: 1px solid var(--line); text-decoration: none; font-size: .86rem; }
.doc-list a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-list a:hover { border-color: var(--line-strong); }
.attach > summary { list-style: none; width: max-content; }
.attach > summary::-webkit-details-marker { display: none; }
.attach[open] > summary { margin-bottom: 10px; }

/* ---------- Tabele, pasek narzędzi, układ dwukolumnowy (czas pracy, urlopy) ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px; margin-bottom: 14px;
           background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.day-nav { display: flex; align-items: center; gap: 4px; }
.day-nav .input { width: auto; }
.input-year { width: 92px !important; text-align: center; }
.split { display: grid; gap: 14px; align-items: start; }
@media (min-width: 1100px) {
  .split-9-3 { grid-template-columns: minmax(0, 3fr) minmax(240px, 1fr); }
  .split-7-5 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
}
.side-panel h2 { font-size: 1rem; }
.side-panel .muted { margin: 2px 0 12px; }

.table-wrap { overflow-x: auto; }
.scroll-y { max-height: calc(100dvh - 280px); min-height: 240px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; font-weight: 600; letter-spacing: .02em; color: var(--ink-3); padding: 9px 12px;
            background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num, .table td.mono { white-space: nowrap; }
.table .num { text-align: right; }
.wt-table { min-width: 760px; }
.lv-table, .lv-sum { min-width: 560px; }
.table tfoot th { position: static; border-top: 1px solid var(--line-strong); border-bottom: 0; color: var(--ink); }
.table-compact th, .table-compact td { padding: 6px 4px; }
.table-compact th { background: none; position: static; }
.side-panel .table-compact { margin: 0 -4px; width: calc(100% + 8px); }
.row-link { font-weight: 500; text-decoration: none; }
.row-link:hover { color: var(--accent); text-decoration: underline; }
.row-actions { width: 1%; white-space: nowrap; text-align: right; }
.flags-cell { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; min-height: 22px; }
.flag { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 5px;
        background: var(--surface-3); color: var(--ink-2); font: 600 .7rem/1 var(--mono); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.is-neg { color: var(--bad); }
.lv-row.is-long > td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.lv-row.is-long { background: color-mix(in srgb, var(--ok) 6%, transparent); }
.lv-row.is-deleted td { color: var(--ink-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-3) 60%, transparent); }
.lv-row.is-deleted td .tag { text-decoration: none; }
.lv-row.is-selected { background: var(--accent-soft); }
.lv-table td .tag { margin-left: 4px; padding: 1px 6px; font-size: .72rem; }
.legend { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: .78rem; color: var(--ink-3); border-top: 1px solid var(--line); }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; background: color-mix(in srgb, var(--ok) 20%, var(--surface)); box-shadow: inset 3px 0 0 var(--ok); }

.quick-add { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.quick-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; margin-top: 10px; align-items: end; }
.quick-form .field-time { min-width: 0; }
.flag-checks, .quick-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.quick-actions { justify-content: flex-end; }
.flag-check input { position: absolute; opacity: 0; pointer-events: none; }
.flag-check span { display: inline-grid; place-items: center; min-width: 38px; height: 30px; padding: 0 8px; border-radius: 7px; cursor: pointer;
                   border: 1px solid var(--line-strong); font: 600 .78rem/1 var(--mono); color: var(--ink-2); transition: all .15s; }
.flag-check input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.flag-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.allowances { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px 16px; }
.allowances legend { margin-bottom: 6px; }
.allowances .check .flag { min-width: 34px; }
.facts-inline { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }

/* Rozwijane menu z <details> (wydruki, filtr) */
.menu-pop, .filter-pop { position: relative; }
.menu-pop > summary, .filter-pop > summary { list-style: none; }
.menu-pop > summary::-webkit-details-marker, .filter-pop > summary::-webkit-details-marker { display: none; }
.menu-pop[open] .chev { transform: rotate(180deg); }
.menu-pop .dropdown { min-width: 320px; z-index: 15; }
.filter-pop { flex-basis: 100%; }
.filter-pop[open] > summary { margin-bottom: 10px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 14px; align-items: end; }
@media (min-width: 900px) { .filter-pop { flex-basis: auto; } .filter-pop[open] { flex-basis: 100%; } }

/* ---------- Osoby ---------- */
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.ps-table td .flag { margin-left: 6px; }
.ps-table td .tag { padding: 1px 6px; font-size: .72rem; }
.person-form .tab-list { flex-wrap: nowrap; }
.person-public { display: grid; grid-template-columns: 156px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 760px) { .person-public { grid-template-columns: 1fr; } }
.person-photo img, .photo-placeholder { width: 156px; height: 200px; border-radius: var(--r); object-fit: cover; display: block; box-shadow: var(--shadow-sm); }
.photo-placeholder { display: grid; place-items: center; background: var(--surface-3); color: var(--ink-3); font: 600 2.4rem/1 var(--font); letter-spacing: .04em; }
.group-title { font-size: .8rem; font-weight: 600; color: var(--ink-3); letter-spacing: .02em; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.form-grid > .group-title:first-child, .form-grid > h3.group-title:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.sep-groups { margin: 6px 0 0; padding-left: 1.6em; display: grid; gap: 6px; }
.sep-groups li::marker { color: var(--ink-3); font-family: var(--mono); font-size: .8rem; }
.check-top { align-items: flex-start; }
.check-top input { margin-top: 2px; }
.scope-checks { display: grid; gap: 8px; margin-top: 8px; }
.scan-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; margin-bottom: 16px;
            background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--r); }
.scan-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: .88rem; margin-right: auto; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.helmet-note { align-self: end; padding-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); background-color: var(--bg);
                  backdrop-filter: blur(6px); margin: 12px -4px 0; padding: 12px 4px; align-items: center; }
.sticky-actions .muted { margin-right: auto; }
.docs-panel { margin-top: 14px; }
.doc-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.doc-form { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
/* pola w podglądzie karty: czytelne jak tekst, nie jak wyłączony formularz */
:is(.person-form, .view-form):not(.is-editing) .input:disabled { background: transparent; border-color: transparent; padding-left: 0; color: var(--ink); opacity: 1;
                                                 -webkit-text-fill-color: var(--ink); appearance: none; -webkit-appearance: none; }
:is(.person-form, .view-form):not(.is-editing) .input:disabled::-webkit-calendar-picker-indicator { display: none; }
:is(.person-form, .view-form):not(.is-editing) textarea.input:disabled { resize: none; }
:is(.person-form, .view-form):not(.is-editing) .check input:disabled { opacity: 1; }
:is(.person-form, .view-form):not(.is-editing) .field-label { color: var(--ink-3); }
.input:disabled { cursor: default; }

/* ---------- Urządzenia i podstacje ---------- */
.note-dot { display: inline-flex; color: var(--ink-3); margin-left: 6px; }
.dev-table .tag { padding: 1px 7px; font-size: .78rem; }
.timeline { list-style: none; margin: 12px 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); display: grid; gap: 14px; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.tl-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .82rem; margin-bottom: 2px; }
.timeline .pre { font-size: .9rem; }
.side-title { display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.type-code { display: block; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font: .85rem/1.4 var(--mono); white-space: pre-wrap; }
.quick-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.rows-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 18px 0 8px; }
.rows-head:first-child { margin-top: 0; }
.rows-head .group-title { border: 0; padding: 0; margin: 0; }
.rows-table { font-size: .86rem; }
.rows-table td { padding: 5px 6px; }
.rows-table th { padding: 7px 6px; }
.rows-table .input-sm { min-width: 70px; }
.sd-cell { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; min-width: 190px; }
.sd-cell select { width: 92px; }
.sd-cell input { width: 90px; }
.is-hidden-col { display: none !important; }
.view-form:not(.is-editing) .rows-table .input:disabled { padding: 0; min-height: 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 10px; }
.gallery figure { margin: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.gallery img { display: block; width: 100%; height: 140px; object-fit: cover; transition: transform .25s; }
.gallery a:hover img { transform: scale(1.03); }
.gallery figcaption { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; font-size: .8rem; color: var(--ink-2); }
.gallery figcaption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Zwolnienia lekarskie ---------- */
.chip-link { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong);
             font-size: .85rem; color: var(--ink-2); text-decoration: none; transition: all .15s; }
.chip-link:hover { border-color: var(--ink-3); color: var(--ink); }
.chip-link.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.ml-row.is-now > td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.ml-table td .tag { margin-left: 6px; padding: 1px 6px; font-size: .72rem; }

/* ---------- Polecenia pisemne ---------- */
.ord-table tr.is-canceled td:not(:first-child), .ord-table tr.is-canceled .row-link { text-decoration: line-through; color: var(--ink-3); }
.ord-table td .tag { margin-left: 6px; padding: 1px 6px; font-size: .72rem; text-decoration: none; }
.ord-work { max-width: 46ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.is-canceled-form .form-grid { opacity: .7; }

/* ---------- Karty awarii ---------- */
.acc-table td .tag { margin-left: 6px; padding: 1px 6px; font-size: .72rem; }
.acc-place { max-width: 24ch; line-height: 1.3; }
.acc-desc { max-width: 52ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.field-hint { font-size: .78rem; color: var(--ink-3); }
.field-empty { min-height: 38px; display: flex; align-items: center; color: var(--ink-3); }
.field-check .check { min-height: 38px; }

/* ---------- Powiadomienia ---------- */
.notif-table td .tag { margin-left: 6px; padding: 1px 6px; font-size: .72rem; }
.notif-table tr.is-solved .row-link { color: var(--ink-2); }
.notif-table td:nth-child(3), .notif-table td:nth-child(4) { white-space: nowrap; }
.notif-details { max-width: 48ch; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Karta przełączeń ---------- */
.sw-table td .tag { margin-left: 6px; padding: 1px 6px; font-size: .72rem; }
.sw-table tr.is-muted td { color: var(--ink-3); }
.sw-table tr.is-muted .row-link { color: var(--ink-2); }
.sw-table .nowrap, .sw-table td:nth-child(2) .row-link { white-space: nowrap; }
.text-bad { color: var(--bad); }
.page-meta .meta-link { color: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.page-meta .meta-link:hover { color: var(--accent); }

/* ---------- Korespondencja ---------- */
.wr-dir { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; }
.wr-dir .i { width: 16px; height: 16px; }
.wr-dir.is-in { background: var(--ok-soft); color: var(--ok); }
.wr-dir.is-out { background: var(--warn-soft); color: var(--warn); }
.wr-table td:nth-child(2), .wr-table td:nth-child(3) { white-space: nowrap; }
.wr-desc { max-width: 60ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.radio-row .check .i { width: 16px; height: 16px; color: var(--ink-3); }
.field-end { align-content: end; justify-items: start; padding-bottom: 3px; }
.ab-table td:first-child .row-link { font-weight: 600; }

/* ---------- SOOP ---------- */
.lead-note { max-width: 90ch; margin: -6px 0 14px; color: var(--ink-3); font-size: .86rem; line-height: 1.5; }
.soop-table tfoot td { border-top: 1px solid var(--line-strong); border-bottom: 0; }
.soop-missing, .form-panel + .panel { margin-top: 14px; }
.soop-missing .panel-title { margin: 0 0 10px; }
.soop-missing .panel-title .i { color: var(--warn); }
.chip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip-list .chip-link .i { width: 14px; height: 14px; margin-right: 4px; }

/* ---------- Karty IDF ---------- */
.zone-badge { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 6px; border-radius: 6px; font-weight: 700; font-size: .8rem;
  background: var(--line); color: var(--ink-2); }
.zone-badge.zone-b { background: var(--ok-soft); color: var(--ok); }
.zone-badge.zone-c { background: var(--warn-soft); color: var(--warn); }
.zone-badge.zone-d { background: var(--bad-soft); color: var(--bad); }
.idf-table td .tag { margin-left: 4px; padding: 1px 6px; font-size: .72rem; }
.idf-table tr.is-axed td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.idf-table td:nth-child(5) { white-space: nowrap; }
.idf-note { max-width: 24ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Karty SIM ---------- */
.sim-table td:nth-child(3), .sim-table td:nth-child(4) { white-space: nowrap; }
.sim-note { max-width: 32ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Grafiki ---------- */
.sch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.sch-panel .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.sch-panel .panel-title .i { color: var(--accent); }
.sch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sch-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink); text-decoration: none; }
.sch-item:hover { border-color: var(--line-strong); background: var(--surface-2, var(--bg)); }
.sch-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); flex: none; }
.sch-text { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; flex: 1; min-width: 0; }
.sch-text .small { flex-basis: 100%; }
.sch-text .tag { padding: 1px 6px; font-size: .72rem; }
.sch-open { color: var(--ink-3); }
.sch-list li.is-old .sch-item { opacity: .7; }

/* ---------- Artykuły ---------- */
.art-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.art-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md, 12px); color: var(--ink); text-decoration: none; }
.art-item:hover { border-color: var(--line-strong); }
.art-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--surface-3); color: var(--ink-2); flex: none; }
.art-text { display: grid; gap: 3px; min-width: 0; }
.art-text strong { font-size: 1rem; }
.article-body { max-width: 860px; padding: 24px 28px; line-height: 1.65; font-size: 1rem; overflow-wrap: anywhere; }
.article-body > :first-child { margin-top: 0; }
.article-body h1, .article-body h2, .article-body h3, .article-body h4 { line-height: 1.3; margin: 1.4em 0 .5em; font-weight: 600; }
.article-body h1 { font-size: 1.6rem; } .article-body h2 { font-size: 1.35rem; } .article-body h3 { font-size: 1.15rem; } .article-body h4 { font-size: 1rem; }
.article-body img { max-width: 100%; height: auto; }
.article-body table { border-collapse: collapse; max-width: 100%; }
.article-body td, .article-body th { border: 1px solid var(--line-strong); padding: 4px 8px; }
.article-body pre { white-space: pre-wrap; background: var(--surface-2); padding: 10px 12px; border-radius: 8px; }
.article-body blockquote { margin: 1em 0; padding-left: 14px; border-left: 3px solid var(--line-strong); color: var(--ink-2); }
.art-editor { font-family: var(--mono, ui-monospace, monospace); font-size: .88rem; line-height: 1.5; min-height: 360px; }

/* ---------- Informacje budowlane ---------- */
.bi-table td:first-child, .bi-table td:nth-child(2), .bi-table td:last-child { white-space: nowrap; }
.bi-note { max-width: 70ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Inwentarz ---------- */
.inv-table td .tag { margin-left: 6px; padding: 1px 6px; font-size: .72rem; }
.inv-table tr.is-out td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.inv-table tr.is-out .row-link { color: var(--ink-2); }
.inv-table td:nth-child(3), .inv-table td:nth-child(5) { white-space: nowrap; }
.inv-spread { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-width: 420px; }
.inv-spread li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.inv-spread-edit { max-width: 480px; }
.inv-spread-edit td:last-child { width: 110px; }

/* ---------- Protokoły ---------- */
.prot-table td:first-child { white-space: nowrap; }
.prot-side { display: grid; gap: 10px; align-content: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.prot-side legend { padding: 0 6px; border: 0; margin: 0; }
.panel-pad { padding: 14px 16px; }
.panel-pad + .panel-pad { padding-top: 0; }
.prot-add { display: grid; gap: 10px; margin-top: 14px; }
.prot-add select[size] { min-height: 200px; }
#devices { margin-top: 14px; }

/* ---------- SOOP2 – katalog kompetencji ---------- */
.soop2-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.soop2-nav .chip-link { height: 30px; font-size: .82rem; }
.soop2-nav .chip-link.is-mine { border-color: var(--ok); color: var(--ok); }
.soop2-sec { margin-bottom: 16px; scroll-margin-top: 80px; }
.soop2-head { padding: 14px 16px 10px; }
.soop2-head h2 { margin: 0 0 4px; font-size: 1.05rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.soop2-head p { margin: 0; color: var(--ink-2); font-size: .9rem; }
.soop2-head .tag { font-size: .72rem; padding: 1px 8px; }
.soop2-table { table-layout: fixed; min-width: 900px; }
.soop2-table th[scope=row] { font-weight: 600; font-size: .86rem; vertical-align: top; text-align: left; white-space: normal; position: static; }
.soop2-table thead th { white-space: normal; }
.soop2-lvl { text-align: center; }
.soop2-lvl img { display: block; margin: 0 auto 2px; }
.soop2-table td { padding: 0; vertical-align: top; }
.soop2-cell { display: flex; gap: 8px; align-items: flex-start; height: 100%; min-height: 48px; padding: 9px 10px; font-size: .82rem; line-height: 1.4; cursor: pointer; }
.soop2-cell input { margin-top: 2px; accent-color: var(--accent); flex: none; }
.soop2-cell:hover { background: var(--surface-2); }
.soop2-table td:has(input:checked) { background: var(--ok-soft); box-shadow: inset 0 0 0 2px var(--ok); }
.soop2-print-head { display: none; }
@media print {
  .soop2-nav, .soop2-actions { display: none !important; }
  .soop2-print-head { display: flex; gap: 24px; margin-bottom: 8px; font-size: 10pt; }
  .soop2-sec { break-inside: auto; }
  .soop2-table { min-width: 0; font-size: 8pt; }
  .soop2-table tr { break-inside: avoid; }
  .soop2-table td:has(input:checked) { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Informacje (tablica pogotowia) ---------- */
.info-jump { display: none; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.info-note { margin-bottom: 16px; }
.info-note .panel-title { margin: 0 0 8px; }
.info-text { line-height: 1.6; overflow-wrap: anywhere; }
.info-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; align-items: start; }
.info-col { scroll-margin-top: calc(var(--topbar-h, 56px) + 12px); }
.info-col-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.info-col-head p { margin: 2px 0 0; }
.info-progress { height: 4px; margin: 10px 0 12px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.info-progress span { display: block; height: 100%; background: var(--ok); border-radius: inherit; transition: width .3s; }
.info-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.info-filter button { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong);
                      background: none; color: var(--ink-2); font: inherit; font-size: .85rem; cursor: pointer; }
.info-filter button:hover:not(:disabled) { border-color: var(--ink-3); color: var(--ink); }
.info-filter button.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.info-filter button:disabled { opacity: .4; cursor: default; }
.info-tasks { list-style: none; margin: 0; padding: 0; }
.info-task { display: flex; align-items: flex-start; gap: 2px; border-bottom: 1px solid var(--line); }
.info-task:last-child { border-bottom: 0; }
.info-task[hidden] { display: none; }
.info-toggle { flex: 1; min-width: 0; }
.info-check { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 10px 6px; border-radius: var(--r-sm); cursor: pointer; }
.info-check:hover { background: var(--surface-2); }
.info-check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ok); cursor: pointer; }
.info-body { display: grid; gap: 5px; min-width: 0; }
.info-task-text { line-height: 1.45; overflow-wrap: anywhere; }
.info-task.is-done .info-task-text { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.info-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .78rem; color: var(--ink-2); }
.info-who { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.info-who > span { white-space: nowrap; }
.info-who .i { width: 13px; height: 13px; flex: none; }
.info-who-done { color: var(--ok); color: color-mix(in srgb, var(--ok) 80%, var(--ink)); }
.info-shift { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; letter-spacing: .01em; }
.info-shift-i   { background: var(--ao-blue);  color: #fff; }
.info-shift-ii  { background: var(--ao-amber); color: #241a00; }
.info-shift-iii { background: var(--ao-slate); color: #fff; }
.info-del { flex: none; padding-top: 7px; }
.info-empty { display: flex; align-items: center; gap: 6px; margin: 0; padding: 14px 6px; color: var(--ink-3); }
.info-empty[hidden] { display: none; }
.info-done { margin-top: 6px; border-top: 1px solid var(--line); }
.info-done[hidden] { display: none; }
.info-done > summary { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 6px; cursor: pointer; list-style: none; color: var(--ink-2); font-weight: 500; }
.info-done > summary::-webkit-details-marker { display: none; }
.info-done > summary .chev { transition: transform .15s; }
.info-done[open] > summary .chev { transform: rotate(90deg); }
.info-add { display: grid; gap: 8px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.info-add-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.info-shift-pick { display: flex; align-items: center; gap: 6px; }
.info-add-label { font-size: .85rem; color: var(--ink-2); margin-right: 2px; }
.info-shift-pick .chip > span { min-width: 46px; justify-content: center; height: 36px; font-weight: 600; }
.info-add-hint { margin: 0; }
@media (max-width: 899px) {
  .info-jump { display: flex; }
}
@media (max-width: 520px) {
  .info-col { padding-left: 12px; padding-right: 12px; }
  .info-shift-pick { flex: 1; }
  .info-shift-pick .chip { flex: 1; }
  .info-shift-pick .chip > span { width: 100%; }
  .info-add-row .btn { flex: 1 0 100%; justify-content: center; height: 42px; }
}

/* ---------- Ogłoszenia parafialne ---------- */
.pdoc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pdoc-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md, 12px); }
.pdoc-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: var(--bad-soft); color: var(--bad); flex: none; }
.pdoc-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.pdoc-name { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
a.pdoc-name:hover { color: var(--accent); }
.pdoc-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pdoc-item.is-missing { opacity: .75; }
.pdoc-name .tag { margin-left: 6px; padding: 1px 6px; font-size: .72rem; font-weight: 500; }
@media (max-width: 640px) { .pdoc-item { flex-wrap: wrap; } .pdoc-actions { width: 100%; justify-content: flex-start; } }

/* ---------- Tryb tylko do odczytu ---------- */
.ro-banner { position: sticky; top: 0; z-index: 60; padding: 6px 16px; text-align: center; font-size: .85rem; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--warn); }
@media print { .ro-banner { display: none; } }

/* ---------- Diagnostyka ---------- */
.diag-sec { margin-bottom: 14px; }
.diag-table th[scope=row] { width: 34%; text-align: left; font-weight: 600; white-space: normal; position: static; }
.diag-state { width: 1%; white-space: nowrap; }
.diag-table .tag { font-size: .72rem; padding: 1px 8px; }
.diag-table tr.is-bad th { color: var(--bad); }

/* ---------- Panel administratora ---------- */
.alert-info { background: var(--info-soft); color: var(--ink); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.adm-states { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.adm-count { margin-left: 7px; font-family: var(--mono); font-size: .78rem; opacity: .75; }
.adm-table tr.adm-pending > td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.adm-table tr.adm-blocked td:not(:last-child) { color: var(--ink-3); }
.tag.adm-admin { background: var(--accent-soft); color: var(--accent); font-size: .72rem; padding: 1px 6px; }
.adm-note { margin-top: 12px; }
.adm-form .panel-title { margin: 18px 0 10px; }
.adm-form .panel-title:first-of-type { margin-top: 0; }
.adm-levels { display: grid; gap: 6px; }
.adm-level { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; }
.adm-level:hover { border-color: var(--ink-3); }
.adm-level:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.adm-level input { margin-top: 3px; accent-color: var(--accent); }
.adm-level strong { font-family: var(--mono); margin-right: 8px; }
.adm-level small { color: var(--ink-2); font-size: .82rem; }
.adm-level:has(input:disabled) { cursor: default; opacity: .7; }
.adm-level small.adm-level-admin { display: block; margin-top: 3px; }
.adm-level small.adm-level-admin:not(.is-on) { color: var(--ink-3); }
.adm-level small.adm-level-admin.is-on { color: var(--warn); color: color-mix(in srgb, var(--warn) 75%, var(--ink)); font-weight: 500; }
.adm-person { margin-top: 16px; }
.adm-person-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.adm-person-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- Stany puste / błędy ---------- */
.empty-state { text-align: center; padding: 56px 20px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface); }
.empty-state h2 { margin-bottom: 6px; }
.empty-state p { color: var(--ink-3); }
.empty-state p + p { margin-top: 16px; }
.page-error .error-box { max-width: 560px; margin: 12vh auto; padding: 0 20px; }
.page-error .error-list { margin: 0 0 16px; padding-left: 20px; line-height: 1.6; }
.page-error .error-list code { font-size: .9em; }
.page-error h1 { margin-bottom: 10px; }
.page-error p { margin-bottom: 16px; color: var(--ink-2); }
.debug { white-space: pre-wrap; background: var(--surface-3); padding: 12px; border-radius: var(--r-sm); font-size: .82rem; }

/* ---------- Logowanie ---------- */
.page-login { justify-content: center; }
.login-wrap { flex: 1; display: grid; place-items: center; align-content: center; gap: 18px; padding: 32px 16px; }
.login-card { width: min(400px, 100%); display: grid; gap: 16px; padding: 30px 28px; background: var(--surface);
              border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-md); }
.login-logo { width: 220px; height: auto; margin-bottom: 4px; }
.login-card h1 { font-size: 1.45rem; }
.login-card .muted { font-size: .9rem; margin-top: 2px; }
.login-card .alert { margin: 0; }
.login-card .btn-primary { min-height: 44px; margin-top: 4px; font-size: .98rem; }
.login-links { display: grid; gap: 6px; font-size: .86rem; }
.login-links a { color: var(--ink-2); text-decoration: none; }
.login-links a:hover { color: var(--accent); text-decoration: underline; }
.login-foot { max-width: 400px; text-align: center; font-size: .74rem; color: var(--ink-3); }

/* ---------- Małe ekrany ---------- */
@media (max-width: 640px) {
  :root { --topbar-h: 56px; }
  .topbar-inner { padding: 0 10px; gap: 6px; }
  .menu-btn-label, .user-name, .topbar-title { display: none; }
  .brand img { height: 28px; }
  .page { padding: 16px 12px 40px; }
  .page-head { margin-bottom: 14px; }
  .page-actions { width: 100%; }
  h1 { font-size: 1.3rem; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
  .tile { padding: 14px 6px 10px; }
  .tile img { width: 48px; height: 48px; }
  .field-inline { flex: 1 1 140px; }
  .field-inline .input { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .site-foot, .page-actions, .back-link, .filters, .pagination, .menu-overlay, .modal { display: none !important; }
  body { background: #fff; }
}
