/* Formularze PDF – style aplikacji.
   Kolory domyślne marki (#00A4E1 → #00488A); kolory klienta nadpisują zmienne z :root (app/brand.php). Czcionki lokalne (bez Google Fonts – RODO). */
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/figtree-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/figtree-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/figtree-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+1E00-1E9F, U+20A0-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/figtree-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+FEFF, U+FFFD; }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/figtree-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+1E00-1E9F, U+20A0-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/figtree-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+FEFF, U+FFFD; }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/figtree-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+1E00-1E9F, U+20A0-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/figtree-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/jetbrains-mono-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+1E00-1E9F, U+20A0-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/jetbrains-mono-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02AF, U+1E00-1E9F, U+20A0-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/jetbrains-mono-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+FEFF, U+FFFD; }
@font-face { font-family: 'DejaVu Sans PL'; src: url(../fonts/DejaVuSans-PL.ttf) format('truetype'); font-display: swap; }

:root {
  --brand: #00A4E1;
  --brand-rgb: 0 164 225;      /* kolory marki – nadpisywane z Ustawienia → Wygląd i marka (app/brand.php) */
  --brand2-rgb: 0 140 200;
  --deep-rgb: 0 72 138;
  --brand-mid: #005FA1;
  --brand-deep: #00488A;
  --steel: #848FA8;
  --grad: linear-gradient(135deg, #00A3DB, #00488A);
  --bg: #EDF1F6;
  --surface: #FFFFFF;
  --surface-2: #F5F7FA;
  --ink: #12233A;
  --muted: #5C6A80;
  --line: #D6DEE8;
  --fld: rgb(var(--brand-rgb) / .13);
  --fld-line: rgb(var(--brand2-rgb) / .85);
  --chk: rgba(132, 143, 168, .22);
  --chk-line: #6C7891;
  --sel: #00488A;
  --pressed: #00488A;
  --danger: #B93A32;
  --danger-bg: #FBEDEC;
  --ok: #1D7F52;
  --ok-bg: #E7F5EE;
  --warn: #9A6400;
  --warn-bg: #FFF4DE;
  --info-bg: #E5F5FC;
  --on-brand: #FFFFFF;
  --shadow: 0 1px 2px rgba(18, 35, 58, .08), 0 8px 28px rgba(18, 35, 58, .09);
  --font-ui: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  color-scheme: light;
}
/* Motyw: data-theme na <html> (Ustawienia → Ogólne). light = zawsze jasny (domyślnie), dark = zawsze ciemny,
   auto = jak w systemie (telefon może przełączać wieczorem). */
:root[data-theme="dark"] {
  --brand: #22B3EC; --brand-mid: #3C9BE0; --brand-deep: #5AAEF0; --steel: #9AA4BA;
  --bg: #0B131D; --surface: #121D2B; --surface-2: #172434; --ink: #E3EBF4; --muted: #93A1B5; --line: #24354A;
  --fld: rgba(34, 179, 236, .16); --fld-line: rgba(34, 179, 236, .9); --chk: rgba(154, 164, 186, .22); --chk-line: #A9B3C8;
  --sel: #5AAEF0; --pressed: #1A6FBF; --danger: #F07A70; --danger-bg: #3A1C1C; --ok: #4CC08A; --ok-bg: #12301F;
  --warn: #F2B84B; --warn-bg: #33270F; --info-bg: #0F2A3A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --brand: #22B3EC; --brand-mid: #3C9BE0; --brand-deep: #5AAEF0; --steel: #9AA4BA;
    --bg: #0B131D; --surface: #121D2B; --surface-2: #172434; --ink: #E3EBF4; --muted: #93A1B5; --line: #24354A;
    --fld: rgba(34, 179, 236, .16); --fld-line: rgba(34, 179, 236, .9); --chk: rgba(154, 164, 186, .22); --chk-line: #A9B3C8;
    --sel: #5AAEF0; --pressed: #1A6FBF; --danger: #F07A70; --danger-bg: #3A1C1C; --ok: #4CC08A; --ok-bg: #12301F;
    --warn: #F2B84B; --warn-bg: #33270F; --info-bg: #0F2A3A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font-ui); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-mid); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- nagłówek ---------- */
.brandbar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brandbar .logo { height: var(--logo-h, 40px); max-width: 46vw; width: auto; display: block; flex: none; object-fit: contain; }   /* wielkość: Ustawienia → Wygląd i marka */
.app-id { display: flex; flex-direction: column; gap: 1px; padding-left: 16px; border-left: 1px solid var(--line); min-width: 0; text-decoration: none; color: inherit; }
.app-id b { font-size: 16px; font-weight: 700; letter-spacing: .01em; }
.app-id span { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46ch; }
.brandbar .grow { flex: 1 1 auto; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 600; padding: 7px 12px; border-radius: 8px; font-size: 13.5px; }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a.on { color: var(--brand-deep); background: var(--info-bg); }
.who { display: flex; align-items: center; gap: 10px; padding-left: 12px; border-left: 1px solid var(--line); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.who .nm { font-weight: 600; font-size: 13px; line-height: 1.2; }
.who .nm small { display: block; color: var(--muted); font-weight: 500; font-size: 11.5px; }

/* ---------- przyciski / formularze ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap;
  text-decoration: none; color: var(--ink);
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--on-brand); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand-mid); cursor: pointer; font-weight: 600; font-size: 13px; }
.linkbtn.danger { color: var(--danger); }
.inp, select.inp, textarea.inp {
  height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 0 11px; width: 100%; min-width: 0;
}
textarea.inp { height: auto; padding: 8px 11px; }
.inp:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field small { color: var(--muted); font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }

/* ---------- strona ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-right, 0px)) 60px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 22px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 24px; font-weight: 700; text-wrap: balance; }
.head p { margin: 4px 0 0; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.card > .pad { padding: 20px; }
.card h2 { font-size: 15px; margin: 0 0 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

.alert { padding: 11px 14px; border-radius: 9px; font-size: 13.5px; border: 1px solid transparent; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.error { background: var(--danger-bg); color: var(--danger); }
.alert.info { background: var(--info-bg); color: var(--ink); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }

/* wgrywanie */
.drop {
  border: 2px dashed var(--line); border-radius: 12px; padding: 26px 20px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
  display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--surface);
}
.drop:hover, .drop.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.drop svg { width: 34px; height: 34px; color: var(--brand); }
.drop strong { font-size: 15px; }
.drop input { display: none; }

/* tabela */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.doc-title { font-weight: 600; color: var(--ink); text-decoration: none; display: block; }
a.doc-title:hover { color: var(--brand-mid); }
.doc-sub { color: var(--muted); font-size: 12px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ready { background: var(--ok-bg); color: var(--ok); }
.chip.queued, .chip.processing { background: var(--info-bg); color: var(--brand-mid); }
.chip.processing::before { animation: pulse 1s infinite alternate; }
.chip.error { background: var(--danger-bg); color: var(--danger); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 5px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); margin-left: 6px; vertical-align: 1px; }
.tag.shared { color: var(--brand-mid); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
@keyframes pulse { to { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .chip.processing::before { animation: none; } }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters a { text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); background: var(--surface); }
.filters a.on { background: var(--pressed); border-color: transparent; color: #fff; }
details.more { position: relative; }
details.more summary { list-style: none; cursor: pointer; }
details.more summary::-webkit-details-marker { display: none; }
details.more .menu { position: fixed; right: auto; top: 0; left: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; min-width: 210px; max-width: calc(100vw - 24px); z-index: 60; display: flex; flex-direction: column; }
details.more .menu form, details.more .menu a { display: block; }
details.more .menu button, details.more .menu a { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--ink); text-decoration: none; }
details.more .menu button:hover, details.more .menu a:hover { background: var(--surface-2); }
details.more .menu .danger { color: var(--danger); }

/* logowanie */
.auth { flex: 1 0 auto; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); background: radial-gradient(1200px 500px at 10% -10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 30px; display: flex; flex-direction: column; gap: 18px; }
.auth-card .logo { height: var(--logo-login-h, 64px); max-width: 100%; width: auto; align-self: center; object-fit: contain; }
.auth-card h1 { font-size: 20px; margin: 0; text-align: center; }
.auth-card p.lead { margin: -8px 0 0; color: var(--muted); text-align: center; font-size: 13.5px; }
.auth-card .btn { height: 42px; width: 100%; }
.foot { text-align: center; color: var(--muted); font-size: 12px; }

/* instalator */
.req { display: grid; grid-template-columns: 22px 1fr; gap: 6px 10px; font-size: 13.5px; align-items: start; }
.req .ico { font-weight: 700; }
.req .ok { color: var(--ok); } .req .bad { color: var(--danger); } .req .wrn { color: var(--warn); }

@media (max-width: 760px) {
  .who { border-left: 0; padding-left: 0; }
  .app-id span { max-width: 26ch; }
  .hide-sm { display: none; }
  td, th { padding: 9px 10px; }
}

/* postęp analizy w przeglądarce */
.ana { margin-top: 6px; max-width: 260px; }
.bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .3s; }
.ana-stage { margin-top: 3px; }

/* menu „⋯” ustawiane przez ui.js ponad tabelą */
details.more:not([open]) .menu { display: none; }

/* tabele jako karty na wąskich ekranach – bez poziomego przewijania */
@media (max-width: 760px) {
  .table-wrap { overflow: visible; }
  table.cards, table.cards tbody { display: block; }
  table.cards thead { display: none; }
  table.cards tr { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: center; }
  table.cards tr:last-child { border-bottom: 0; }
  table.cards td { display: block; padding: 0; border: 0; min-width: 0; }
  table.cards td.c-main { grid-column: 1 / -1; }
  table.cards td.c-main .doc-sub { overflow-wrap: anywhere; }
  table.cards td.c-count { text-align: right; color: var(--muted); font-size: 12.5px; }
  table.cards td.c-count::before { content: attr(data-label) ': '; }
  table.cards td.c-actions { grid-column: 1 / -1; }
  table.cards .row-actions { justify-content: flex-start; }
  table.cards td.hide-sm { display: none; }
  .brandbar .nav { order: 3; width: 100%; }
  .who { order: 4; }
}
html, body { overflow-x: hidden; }

/* ustawienia */
.kv { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 10px 18px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.set-form input[type=range] { width: 100%; accent-color: var(--brand-mid); }
.field .check { font-weight: 400; color: var(--ink); font-size: 13.5px; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 10px; } }

/* ---------- kopie zapasowe ---------- */
.bk-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.bk-head h2 { margin: 0; }
.row-actions form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.bk-db { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); white-space: nowrap; cursor: pointer; }

/* pułapka na boty – pole niewidoczne dla ludzi i czytników ekranu */
.hp { position: absolute !important; left: -10000px !important; top: auto; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; clip-path: inset(50%); }

/* ---------- stopka ---------- */
body:not(.editor) { display: flex; flex-direction: column; min-height: 100%; height: auto; }
body:not(.editor) > main { flex: 1 0 auto; width: 100%; }
.site-foot { flex: none; padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); text-align: center; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); background: var(--surface); }
.login-page .site-foot { background: transparent; border-top: 0; }

/* ---------- ustawienia: logowanie ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12.5px; }
.stat.warn b { color: var(--warn); } .stat.bad b { color: var(--danger); }
@media (max-width: 760px) { .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.res { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.res.ok { background: var(--ok-bg); color: var(--ok); }
.res.bad { background: var(--danger-bg); color: var(--danger); }
.res.warn { background: var(--warn-bg); color: var(--warn); }
.res.bot { background: color-mix(in srgb, var(--steel) 22%, transparent); color: var(--ink); }
.filters.sm { margin: 0; gap: 4px; }
.filters.sm a { padding: 4px 10px; font-size: 12.5px; }
table.att td { vertical-align: middle; }
.tag.warn { background: var(--warn-bg); color: var(--warn); text-decoration: none; }

/* ---------- okienka (UI.confirm / prompt / alert) – zamiast systemowych okien przeglądarki ---------- */
html.ui-lock, html.ui-lock body { overflow: hidden; }
.ui-dlg { padding: 0; border: 0; background: transparent; color: var(--ink); max-width: none; max-height: none; width: 100%; height: 100%; margin: 0; inset: 0;
  display: none; place-items: center; overscroll-behavior: contain; }
.ui-dlg[open] { display: grid; }
.ui-dlg::backdrop { background: rgba(10, 22, 38, .46); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: uiFade .16s ease-out; }
.ui-dlg-card { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; margin: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 24px 64px rgba(10, 22, 38, .28), 0 2px 6px rgba(10, 22, 38, .08); padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 14px;
  animation: uiPop .18s cubic-bezier(.2, .9, .3, 1.2); font: 14px/1.5 var(--font-ui); }
.ui-dlg.closing .ui-dlg-card { animation: uiOut .14s ease-in forwards; }
.ui-dlg.closing::backdrop { opacity: 0; transition: opacity .14s; }
.ui-dlg-head { display: flex; align-items: center; gap: 12px; }
.ui-dlg-head h2 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.ui-dlg-icon { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--info-bg); color: var(--brand-mid); }
.ui-dlg-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ui-dlg-icon.danger { background: var(--danger-bg); color: var(--danger); }
.ui-dlg-msg { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.ui-dlg-msg p { margin: 0 0 8px; } .ui-dlg-msg p:last-child { margin-bottom: 0; }
.ui-dlg-msg b { color: var(--ink); }
.ui-dlg-field { display: flex; flex-direction: column; gap: 6px; }
.ui-dlg-field[hidden] { display: none; }
.ui-dlg-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ui-dlg-field .inp { width: 100%; height: 42px; font-size: 16px; }   /* 16px – iOS nie powiększa strony przy pisaniu */
.ui-dlg-err { color: var(--danger); font-size: 12.5px; min-height: 0; }
.ui-dlg-err:empty { display: none; }
.ui-dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.ui-dlg-actions .btn { min-width: 96px; height: 40px; justify-content: center; font-weight: 600; }
.ui-dlg-actions .btn[hidden] { display: none; }
.btn.danger-solid { background: var(--danger); border-color: transparent; color: #fff; }
.btn.danger-solid:hover { filter: brightness(1.08); border-color: transparent; }
@keyframes uiFade { from { opacity: 0; } }
@keyframes uiPop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes uiOut { to { opacity: 0; transform: translateY(6px) scale(.98); } }
/* telefon: panel od dołu, duże przyciski jeden pod drugim */
@media (max-width: 560px) {
  .ui-dlg[open] { place-items: end stretch; }
  .ui-dlg-card { width: 100%; margin: 0; border-radius: 20px 20px 0 0; border-bottom: 0; max-height: calc(100dvh - 24px);
    padding: 12px 18px calc(16px + env(safe-area-inset-bottom, 0px)); animation-name: uiUp; animation-timing-function: cubic-bezier(.2, .8, .3, 1); animation-duration: .24s; }
  .ui-dlg-card::before { content: ''; align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin-bottom: 2px; }
  .ui-dlg.closing .ui-dlg-card { animation: uiDown .16s ease-in forwards; }
  .ui-dlg-actions { flex-direction: column-reverse; gap: 8px; }
  .ui-dlg-actions .btn { width: 100%; height: 48px; font-size: 15px; }
  /* z polem tekstowym – u góry ekranu, żeby klawiatura go nie zasłoniła */
  .ui-dlg.has-input[open] { place-items: start stretch; }
  .ui-dlg.has-input .ui-dlg-card { border-radius: 0 0 20px 20px; border-top: 0; border-bottom: 1px solid var(--line); padding-top: calc(16px + env(safe-area-inset-top, 0px)); animation-name: uiDrop; }
  .ui-dlg.has-input .ui-dlg-card::before { display: none; }
  .ui-dlg.has-input.closing .ui-dlg-card { animation: uiLift .16s ease-in forwards; }
}
@keyframes uiUp { from { transform: translateY(100%); } }
@keyframes uiDown { to { transform: translateY(100%); } }
@keyframes uiDrop { from { transform: translateY(-100%); } }
@keyframes uiLift { to { transform: translateY(-100%); } }
@media (prefers-reduced-motion: reduce) { .ui-dlg-card, .ui-dlg::backdrop { animation: none !important; } }

/* ---------- komunikaty walidacji pól (zamiast „dymków” przeglądarki) ---------- */
.field-err, .field small.field-err, label small.field-err { display: block; color: var(--danger); font-size: 12.5px; font-weight: 500; margin-top: 4px; }
.inp[aria-invalid="true"], input[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent); }

/* ---------- stronicowanie ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 16px 0 0; flex-wrap: wrap; }
.pager .pg { min-width: 36px; height: 36px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; }
.pager a.pg:hover { border-color: var(--brand); color: var(--brand-mid); }
.pager .pg.on { background: var(--pressed); border-color: transparent; color: #fff; }
.pager .pg.off { color: var(--muted); opacity: .45; }
.pager .pg.gap { border: 0; background: none; min-width: 18px; padding: 0; color: var(--muted); }
.pager .pg-nums { display: inline-flex; gap: 6px; }
.pager .pg-mob { display: none; font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 6px; font-variant-numeric: tabular-nums; }
.pager-info { text-align: center; color: var(--muted); font-size: 12.5px; margin: 8px 0 0; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .pager { justify-content: space-between; flex-wrap: nowrap; }
  .pager .pg-nums { display: none; } .pager .pg-mob { display: inline; }
  .pager .pg.prev, .pager .pg.next { flex: 1; max-width: 46%; height: 42px; }
}
.bk-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.menu .menu-n { margin-left: auto; padding-left: 14px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.menu button { display: flex; align-items: center; width: 100%; }
.menu button:disabled { opacity: .45; cursor: default; }

/* ---------- szczegóły dokumentu, opis, komentarze ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.back-link { font-size: 13px; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--brand-mid); }
.doc-h1 { overflow-wrap: anywhere; margin: 4px 0 2px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.doc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.doc-grid .card { margin-bottom: 16px; }
@media (max-width: 900px) { .doc-grid { grid-template-columns: 1fr; } }
.doc-page h2 { display: flex; align-items: center; gap: 8px; }
.count-badge { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }
.desc-form textarea, .c-new textarea, .c-edit textarea { width: 100%; min-height: 84px; resize: vertical; height: auto; padding: 10px 12px; line-height: 1.5; }
.desc-form .btn { margin-top: 8px; }
.counter { display: block; text-align: right; color: var(--muted); font-size: 11.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.desc-text { white-space: normal; overflow-wrap: anywhere; }
.comments { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.comment { display: flex; gap: 12px; align-items: flex-start; }
.comment .avatar { width: 34px; height: 34px; font-size: 12.5px; }
.c-body { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px 12px 12px 12px; padding: 10px 14px; }
.c-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: 13px; }
.c-head time { color: var(--muted); font-size: 12px; }
.c-text { margin-top: 4px; overflow-wrap: anywhere; }
.c-actions { display: flex; gap: 12px; margin-top: 6px; }
.c-actions form { margin: 0; }
.c-actions[hidden], .c-text[hidden] { display: none; }
.c-edit { margin-top: 6px; }
.c-edit-actions, .c-new-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 8px; }
.c-new-actions { justify-content: space-between; flex-wrap: wrap; }
.c-new-actions small { font-size: 12px; }
.c-new { border-top: 1px solid var(--line); padding-top: 14px; }
.kv-tight { grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13px; }
@media (max-width: 560px) { .kv-tight { grid-template-columns: 112px 1fr; gap: 8px 10px; } .kv-tight dd { margin: 0; } }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.timeline li { position: relative; display: flex; flex-direction: column; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.timeline li span { color: var(--muted); font-size: 12px; }
.more-hist summary { cursor: pointer; color: var(--brand-mid); font-size: 13px; margin: 12px 0 8px; }
.tag.cmt { display: inline-flex; align-items: center; gap: 3px; text-decoration: none; color: var(--brand-mid); }
.tag.cmt svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.4; }
.doc-desc { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; max-width: 60ch; overflow-wrap: anywhere; }

/* ---------- układ stron ---------- */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 8px; font-weight: 500; box-shadow: var(--shadow); z-index: 50; max-width: calc(100% - 32px); }
.toast[hidden] { display: none; }
.pg-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; position: sticky; top: 8px; z-index: 5; margin-bottom: 16px; }
.pg-bar-r { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pg-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.pg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; margin-bottom: 96px; }
.pg-card { background: var(--surface); border: 2px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; cursor: grab; user-select: none; -webkit-user-select: none; transition: border-color .12s, box-shadow .12s, transform .12s; touch-action: manipulation; }
.pg-card:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.pg-card.sel { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.pg-card.dragging { opacity: .55; transform: scale(.97); cursor: grabbing; border-style: dashed; }
body.pg-dragging, body.pg-dragging * { cursor: grabbing !important; }
.pg-thumb { position: relative; aspect-ratio: 1 / 1.25; background: var(--surface-2); display: grid; place-items: center; padding: 10px; overflow: hidden; }
.pg-thumb img { max-width: 100%; max-height: 100%; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); background: #fff; transform: rotate(var(--r)) scale(var(--s)); transition: transform .18s ease; pointer-events: none; }
.pg-sel { position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.pg-sel input { width: 16px; height: 16px; margin: 0; cursor: pointer; }
.pg-rot { position: absolute; top: 8px; right: 8px; background: var(--brand-deep); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.pg-src { position: absolute; left: 8px; right: 8px; bottom: 6px; background: rgb(var(--deep-rgb) / .88); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-foot { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 6px 6px 6px 10px; border-top: 1px solid var(--line); }
.pg-no { font-weight: 700; font-variant-numeric: tabular-nums; }
.pg-acts { display: flex; gap: 1px; }
.pg-acts button { width: 28px; height: 28px; border: 0; background: none; border-radius: 6px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pg-acts button:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.pg-acts button.danger:hover:not(:disabled) { color: var(--danger); }
.pg-acts button:disabled { opacity: .3; cursor: default; }
.pg-acts svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pg-save { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); width: min(1100px, calc(100% - 24px)); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; flex-wrap: wrap; box-shadow: 0 10px 30px rgba(10, 22, 38, .18); }
.pg-save.dirty { border-color: var(--brand); }
.pg-save.idle { display: none; }
.pg-save-l { display: flex; flex-direction: column; min-width: 0; }
.pg-save-l span { font-size: 12.5px; }
.pg-save-r { display: flex; gap: 8px; flex-wrap: wrap; }
.pick-dlg .ui-dlg-card { gap: 12px; }
.pick-list { max-height: min(50vh, 420px); overflow: auto; display: flex; flex-direction: column; gap: 4px; margin: 0 -6px; }
.pick-item { text-align: left; background: none; border: 1px solid transparent; border-radius: 8px; padding: 9px 10px; cursor: pointer; display: flex; flex-direction: column; color: var(--ink); font: inherit; }
.pick-item:hover, .pick-item:focus-visible { background: var(--surface-2); border-color: var(--line); }
.pick-item span { color: var(--muted); font-size: 12.5px; }
@media (max-width: 560px) {
  .pg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 150px; }
  .pg-bar { position: static; }
  .pg-save { padding: 10px 12px; gap: 8px; }
  .pg-save-l span { display: none; }
  .pg-bar .btn.sm { padding: 0 8px; }
  .pg-acts button { width: 26px; height: 30px; }
  .pg-save-r { width: 100%; } .pg-save-r .btn { flex: 1; }
}

/* ---------- podpis i parafka ---------- */
.sign-card { width: min(600px, calc(100vw - 32px)); }
.sign-tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.sign-tabs button { flex: 1; border: 0; background: none; padding: 7px 8px; border-radius: 8px; font: 600 13px var(--font-ui); color: var(--muted); cursor: pointer; }
.sign-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.sign-pad { position: relative; border: 1px dashed var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.sign-pad canvas { display: block; width: 100%; touch-action: none; cursor: crosshair; }
.sign-line { position: absolute; left: 24px; right: 24px; bottom: 34px; border-bottom: 1px solid #c9d2de; pointer-events: none; }
.sign-hint { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; color: #9aa6b6; font-size: 12.5px; pointer-events: none; }
.sign-drop { padding: 22px; }
.sign-prev { border: 1px solid var(--line); border-radius: 12px; background: #fff repeating-conic-gradient(#f3f5f8 0 25%, #fff 0 50%) 0 0 / 16px 16px; padding: 10px; display: grid; place-items: center; min-height: 120px; }
.sign-prev canvas { max-width: 100%; max-height: 160px; }
.sign-typed { width: 100%; height: 42px; font-size: 16px; margin-bottom: 8px; }
.sign-opts { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sign-colors { display: flex; gap: 8px; margin-right: auto; }
.sign-colors .sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.sign-colors .sw.on { box-shadow: 0 0 0 2px var(--brand); }
.sign-save { font-size: 13px; }
.sig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.sig-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; align-items: center; background: #fff; }
.sig-item img { max-width: 100%; height: 64px; object-fit: contain; }
.sig-item span { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------ skanowanie aparatem --- */
.scan-cta { display: flex; align-items: center; gap: 14px; margin: 10px 0 0; padding: 13px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: border-color .15s, background .15s; }
.scan-cta:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }
.scan-cta > svg { width: 38px; height: 38px; padding: 8px; border-radius: 10px; background: var(--grad); color: #fff; flex: none; }
.scan-cta span { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.scan-cta small { color: var(--muted); font-size: 12.5px; }
.scan-cta i { font-style: normal; font-size: 24px; color: var(--muted); line-height: 1; }

.scan-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 11px; }
.btn.lg svg { width: 19px; height: 19px; }
.scan-list { padding: 16px; margin-bottom: 96px; }
.scan-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 10px; }
.scan-empty svg { width: 46px; height: 46px; color: var(--steel); margin-bottom: 4px; }
.scan-empty .muted { max-width: 440px; font-size: 13px; }
.scan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.scan-th { display: flex; flex-direction: column; gap: 6px; }
.scan-img { border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); padding: 6px; cursor: pointer; aspect-ratio: 1 / 1.3; display: flex; align-items: center; justify-content: center; transition: border-color .15s, box-shadow .15s; }
.scan-img:hover, .scan-img:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); outline: 0; }
.scan-img img { max-width: 100%; max-height: 100%; box-shadow: 0 1px 4px rgba(0,0,0,.18); background: #fff; }
.scan-th-bar { display: flex; align-items: center; gap: 4px; }
.scan-no { font-weight: 700; font-size: 13px; margin-right: auto; padding-left: 2px; }
.scan-th .ib { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 17px; line-height: 1; cursor: pointer; }
.scan-th .ib:disabled { opacity: .35; cursor: default; }
.scan-th .ib.del { color: var(--danger); }
.scan-save { position: sticky; bottom: 12px; display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; padding: 14px 16px; box-shadow: 0 8px 30px rgba(18,35,58,.16); z-index: 5; }
.scan-save-r { display: flex; align-items: center; gap: 12px; margin-left: auto; }

html.scan-lock, html.scan-lock body { overflow: hidden; overscroll-behavior: none; }
.scan-full { position: fixed; inset: 0; z-index: 900; background: #0b1220; color: #fff; display: flex; flex-direction: column; touch-action: none; user-select: none; -webkit-user-select: none; }
.scan-full[hidden] { display: none; }
/* aparat */
.scan-cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.scan-cam canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scan-cam.flash::after { content: ''; position: absolute; inset: 0; background: #fff; opacity: .85; animation: scanflash .22s ease-out forwards; }
@keyframes scanflash { to { opacity: 0; } }
.cam-top, .cam-bottom { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; z-index: 2; }
.cam-top { top: 0; padding-top: max(14px, env(safe-area-inset-top)); background: linear-gradient(rgba(0,0,0,.55), transparent); }
.cam-bottom { bottom: 0; padding-bottom: max(22px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.cam-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cam-btn svg { width: 20px; height: 20px; }
.cam-btn[aria-pressed="true"] { background: #ffd23f; color: #222; }
.cam-btn[hidden] { visibility: hidden; display: inline-flex; }
.cam-hint { flex: 1; text-align: center; font-size: 14px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.cam-shutter { width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; background: rgba(255,255,255,.25); cursor: pointer; position: relative; flex: none; }
.cam-shutter::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: #fff; transition: transform .1s; }
.cam-shutter:active::after { transform: scale(.88); }
.cam-shutter:disabled { opacity: .4; }
.cam-auto, .cam-count { width: 92px; font-size: 13px; font-weight: 600; }
.cam-auto { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.cam-auto input { width: 18px; height: 18px; accent-color: var(--brand); }
.cam-opts { width: 92px; display: flex; flex-direction: column; gap: 10px; }
.cam-strip-w { width: 92px; display: flex; justify-content: flex-end; }
.cam-strip { position: relative; width: 52px; height: 66px; padding: 0; border: 2px solid #fff; border-radius: 8px; background: #222; cursor: pointer; overflow: visible; }
.cam-strip img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; display: block; }
.cam-strip b { position: absolute; top: -9px; right: -9px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--brand); color: #fff; font-size: 12px; line-height: 22px; text-align: center; }
.cam-strip.pop { animation: strippop .35s ease-out; }
@keyframes strippop { 40% { transform: scale(1.15); } }
.cam-done { height: 40px; padding: 0 16px; border-radius: 20px; border: 0; background: var(--brand); color: #fff; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.cam-hint[data-kind="warn"] { color: #ffd27a; }
.cam-hint[data-kind="good"] { color: #8ef0bf; }
.crop-mag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; opacity: .85; padding: 0 8px; cursor: pointer; }
.crop-mag input { accent-color: var(--brand); }
.crop-h.snap::after { background: #3ad08a; transform: scale(1.3); }
.prev-info { position: absolute; left: 50%; top: max(6px, env(safe-area-inset-top)); transform: translateX(-50%); font-size: 11.5px; opacity: .65; white-space: nowrap; }
.scan-th.warn .scan-img { outline: 2px solid #e5a100; outline-offset: 2px; }
/* kadrowanie */
.crop-top { padding: 14px 16px 6px; padding-top: max(14px, env(safe-area-inset-top)); text-align: center; display: flex; flex-direction: column; gap: 2px; }
.crop-top span { font-size: 12.5px; opacity: .7; }
.crop-stage, .prev-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#cropCanvas { position: absolute; box-shadow: 0 4px 24px rgba(0,0,0,.5); }
#cropSvg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#cropPoly { fill: rgb(var(--brand-rgb) / .16); stroke: rgb(var(--brand-rgb)); stroke-width: 2.5; stroke-linejoin: round; }
.scan-crop.bad #cropPoly { stroke: #ff6b5b; fill: rgba(255,80,60,.14); }
.crop-h { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 0; background: transparent; cursor: grab; touch-action: none; padding: 0; }
.crop-h::after { content: ''; position: absolute; inset: 11px; border-radius: 50%; background: rgb(var(--brand-rgb) / .35); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.5); transition: transform .12s; }
.crop-h.drag::after, .crop-h:focus-visible::after { transform: scale(1.25); background: rgb(var(--brand-rgb) / .6); }
.crop-h:focus-visible { outline: 0; }
#cropLoupe { position: absolute; width: 132px; height: 132px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 6px 22px rgba(0,0,0,.55); pointer-events: none; z-index: 3; }
.crop-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; padding-bottom: max(14px, env(safe-area-inset-bottom)); background: #111a2b; border-top: 1px solid rgba(255,255,255,.08); }
.crop-mid { flex: 1; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.scan-full .btn { min-height: 42px; }
.scan-full .btn:not(.primary) { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.18); }
.scan-full .btn:not(.primary):hover { background: rgba(255,255,255,.15); }
.scan-full .btn.ghost { border-color: transparent; background: transparent; }
.scan-full .btn svg { width: 20px; height: 20px; }
/* podgląd */
.prev-stage { display: flex; align-items: center; justify-content: center; padding: 18px; padding-top: max(18px, env(safe-area-inset-top)); }
#prevCanvas { max-width: 100%; max-height: 100%; box-shadow: 0 4px 24px rgba(0,0,0,.5); background: #fff; }
.prev-busy { position: absolute; inset: auto 0 18px; margin: auto; width: max-content; padding: 8px 14px; border-radius: 20px; background: rgba(0,0,0,.65); font-size: 13px; }
.prev-tools { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 12px 4px; flex-wrap: wrap; background: #111a2b; }
.sfilt { display: inline-flex; background: rgba(255,255,255,.07); border-radius: 10px; padding: 3px; gap: 2px; }
.sfilt button { border: 0; background: transparent; color: rgba(255,255,255,.75); height: 34px; padding: 0 12px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.sfilt button[aria-checked="true"] { background: var(--brand); color: #fff; }
.prev-rot { display: flex; gap: 2px; }
/* nakładki */
.scan-busy { position: fixed; inset: 0; z-index: 1000; background: rgba(11,18,32,.6); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #fff; font-size: 14px; backdrop-filter: blur(2px); }
.scan-busy[hidden] { display: none; }
.scan-busy .spin { width: 38px; height: 38px; border-radius: 50%; border: 4px solid rgba(255,255,255,.25); border-top-color: #fff; animation: scanspin .8s linear infinite; }
@keyframes scanspin { to { transform: rotate(360deg); } }
.scan-toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 1001; background: #12233A; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; max-width: calc(100vw - 32px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.scan-toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 640px) {
  .scan-actions .btn { flex: 1 1 100%; justify-content: center; }
  .scan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .scan-save { flex-direction: column; align-items: stretch; bottom: 8px; }
  .scan-save-r { margin-left: 0; justify-content: space-between; }
  .crop-bar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .crop-bar > .btn { padding: 0 14px; }
  .sfilt button { padding: 0 9px; font-size: 12.5px; }
  .scan-cta small { font-size: 12px; }
}
html.scan-lock .scan-toast { bottom: calc(150px + env(safe-area-inset-bottom)); }

/* ------------------------------------------------------------ udostępnianie osobom --- */
.tag.people { display: inline-flex; align-items: center; gap: 3px; text-decoration: none; color: var(--brand-mid); }
.tag.people svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.tag.perm-edit { color: var(--ok); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.tag.perm-fill { color: var(--brand-mid); }
.badge-new { display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center; margin-left: 4px; vertical-align: 1px; }
.share-all { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.share-all span { display: flex; flex-direction: column; gap: 1px; font-size: 13.5px; min-width: 0; }
.share-all small { font-size: 12px; }
.share-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; }
.share-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.share-list li:last-child { border-bottom: 0; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.sh-who { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13.5px; }
.sh-who b, .sh-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-who small { font-size: 11.5px; }
.inp.sm { height: 32px; font-size: 13px; padding: 0 8px; width: auto; }
.icon-x { width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.icon-x:hover { color: var(--danger); background: var(--danger-bg); }
.share-add { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.share-add .inp { width: 100%; }
.share-add-row { display: flex; gap: 8px; }
.share-add-row select { flex: 1; }
.share-help { margin: 12px 0 0; font-size: 12px; }

/* ------------------------------------------------------------ foldery, etykiety, kosz --- */
.docs-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; align-items: start; }
.docs-side { position: sticky; top: 14px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a, .side-folders a { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 13.5px; font-weight: 500; min-width: 0; }
.side-nav a:hover, .side-folders a:hover { background: var(--surface-2); }
.side-nav a.on, .side-folders a.on { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand-deep); font-weight: 600; }
:root[data-theme="dark"] .side-nav a.on, :root[data-theme="dark"] .side-folders a.on { color: #fff; }
.side-nav svg, .side-folders svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.side-nav a.on svg, .side-folders a.on svg { color: var(--brand-mid); }
.side-nav span, .side-folders span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav em, .side-folders em, .tagchip em { font-style: normal; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.side-trash { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px !important; padding-top: 9px !important; }
.side-more { border-top: 1px solid var(--line); padding-top: 4px; }
.side-more > summary { list-style: none; cursor: pointer; padding: 8px 9px; font-size: 13px; font-weight: 600; color: var(--muted); }
.side-more > summary::-webkit-details-marker { display: none; }
.side-h { display: flex; align-items: center; justify-content: space-between; padding: 10px 9px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.side-add { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 15px; line-height: 1; padding: 0; }
.side-add:hover { border-color: var(--brand); color: var(--brand-mid); }
.side-folders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.side-folders li { position: relative; display: flex; align-items: center; border-radius: 8px; }
.side-folders li a { flex: 1; padding-right: 30px; }
.side-folders li.drop { outline: 2px dashed var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.side-menu { position: absolute; right: 4px; width: 26px; height: 26px; border: 0; background: none; color: var(--muted); border-radius: 6px; cursor: pointer; opacity: .7; font-size: 16px; line-height: 1; padding: 0; }
.side-folders li:hover .side-menu, .side-menu:focus-visible { opacity: 1; }
.side-menu:hover { background: var(--line); color: var(--ink); }
.side-folders li[data-folder]:not([data-folder="none"]) em { margin-right: 6px; }
.folder-tools { display: inline-flex; gap: 6px; align-self: center; }
.side-empty { margin: 2px 9px 6px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.side-tags { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 6px 8px; }
.tagchip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--tc) 45%, var(--line)); background: color-mix(in srgb, var(--tc) 10%, var(--surface)); color: var(--ink); font-size: 12px; font-weight: 600; text-decoration: none; line-height: 18px; white-space: nowrap; }
.tagchip i { width: 8px; height: 8px; border-radius: 50%; background: var(--tc); flex: none; }
.tagchip.on { background: var(--tc); border-color: var(--tc); color: #fff; }
.tagchip.on i { background: #fff; }
.tagchip.on em { color: rgba(255, 255, 255, .85); }
.tagchip.sm { font-size: 11px; line-height: 16px; padding: 1px 7px 1px 5px; margin-left: 6px; vertical-align: 1px; }
.docs-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.docs-head { align-items: center; }
.view-title { margin: 0; font-size: 18px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; overflow-wrap: anywhere; }
.clear-filter { font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: none; }
.clear-filter:hover { color: var(--danger); }
.docs-search { display: flex; gap: 8px; min-width: min(300px, 100%); }
.trash-info { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: 13px; }
.trash-info form { margin: 0; }
.bulk-bar { position: sticky; top: 8px; z-index: 20; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px 8px 14px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: 0 8px 24px rgba(18, 35, 58, .25); }
.bulk-bar[hidden] { display: none; }
.bulk-bar #bulkInfo { font-size: 13px; font-weight: 600; margin-right: auto; }
.bulk-bar .btn { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .2); color: #fff; }
.bulk-bar .btn:hover:not(:disabled) { background: rgba(255, 255, 255, .2); }
.bulk-bar .btn.danger { background: rgba(229, 57, 53, .25); border-color: rgba(229, 57, 53, .5); }
.bulk-bar .btn:disabled { opacity: .45; }
.bulk-bar .bi { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
th.c-sel, td.c-sel { width: 34px; padding-right: 0 !important; }
.c-sel input { width: 17px; height: 17px; accent-color: var(--brand-mid); cursor: pointer; display: block; }
tbody tr.selected { background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
tbody tr[draggable="true"] { cursor: default; }
.dragging-docs .side-folders li { outline: 1px dashed color-mix(in srgb, var(--brand) 50%, transparent); outline-offset: -1px; }
.drag-ghost { position: fixed; top: -100px; left: 0; padding: 6px 12px; border-radius: 8px; background: var(--brand-deep); color: #fff; font-size: 13px; font-weight: 600; }
.in-folder { color: var(--muted); text-decoration: none; white-space: nowrap; }
.in-folder:hover { color: var(--brand-mid); }
.in-folder .fi-ico { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; vertical-align: -1px; margin-right: 2px; }
.pop-menu { position: fixed; z-index: 1100; min-width: 230px; max-width: min(320px, calc(100vw - 16px)); max-height: min(420px, calc(100vh - 24px)); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(18, 35, 58, .22); padding: 6px; animation: uiPop .14s ease-out; }
.pop-menu .pm-title { padding: 6px 10px 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.pop-menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.pm-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; font: 500 13.5px var(--font-ui); color: var(--ink); cursor: pointer; text-align: left; }
.pm-item:hover, .pm-item:focus-visible { background: var(--surface-2); outline: 0; }
.pm-item.danger { color: var(--danger); }
.pm-item .pm-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-item em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.pm-ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.pm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tc); flex: none; }
.pm-check { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line); flex: none; position: relative; background: var(--surface); }
.pm-item[aria-checked="true"] .pm-check { background: var(--brand-mid); border-color: var(--brand-mid); }
.pm-item[aria-checked="true"] .pm-check::after { content: ''; position: absolute; left: 4.5px; top: 1px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.pm-item[aria-checked="mixed"] .pm-check { background: var(--brand-mid); border-color: var(--brand-mid); }
.pm-item[aria-checked="mixed"] .pm-check::after { content: ''; position: absolute; left: 3px; right: 3px; top: 6.5px; height: 2px; background: #fff; }
.pop-menu.sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; max-width: none; width: 100%; max-height: 70vh; border-radius: 18px 18px 0 0; padding: 10px 10px max(14px, env(safe-area-inset-bottom)); animation: uiSheet .2s ease-out; }
.pop-menu.sheet .pm-item { padding: 12px; font-size: 15px; }
@keyframes uiSheet { from { transform: translateY(100%); } to { transform: none; } }
.tagman-dlg .ui-dlg-card { width: min(460px, calc(100vw - 32px)); }
.tm-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }
.tm-row, .tm-new { display: flex; align-items: center; gap: 8px; }
.tm-row .inp, .tm-new .inp { flex: 1; height: 36px; font-size: 14px; min-width: 0; }
.tm-row em { font-style: normal; font-size: 12px; color: var(--muted); width: 26px; text-align: right; }
.tm-color { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; flex: none; }
.tm-color::-webkit-color-swatch-wrapper { padding: 3px; } .tm-color::-webkit-color-swatch { border: 0; border-radius: 5px; }
.tm-new { padding-top: 8px; border-top: 1px dashed var(--line); }
.docs-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; transition: .25s; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; z-index: 1200; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); max-width: calc(100vw - 32px); }
.docs-toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 999px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .docs-side { position: static; padding: 6px; min-width: 0; }
  .side-nav { flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav a { flex: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
  .side-nav a.on { background: var(--pressed); color: #fff; border-color: transparent; }
  .side-nav a.on svg, .side-nav a.on em { color: #fff; }
  .side-nav svg { display: none; }
  .side-nav span { overflow: visible; }
  .side-trash { margin-top: 0; border-top: 1px solid var(--line) !important; padding-top: 6px !important; border-radius: 999px !important; }
  .side-more { border-top: 0; }
  .side-menu { opacity: 1; }
  .side-folders li a { padding-right: 34px; }
  .side-folders li em { margin-right: 4px; }
}
@media (max-width: 720px) {
  table.cards tr { position: relative; }
  table.cards td.c-sel { position: absolute; top: 14px; right: 14px; width: auto; }
  table.cards td.c-main { padding-right: 30px; }
  .docs-search { width: 100%; }
  .bulk-bar { top: 4px; }
  .bulk-bar #bulkInfo { width: 100%; }
}

/* ------------------------------------------------------------ logowanie dwuetapowe --- */
.tfa-steps { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 14px; font-size: 14px; }
.tfa-steps li::marker { font-weight: 700; color: var(--brand-mid); }
.tfa-qr { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
#tfaQr { width: 190px; height: 190px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; flex: none; }
#tfaQr svg { width: 100%; height: 100%; display: block; }
.tfa-secret { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; font-size: 12.5px; min-width: 0; flex: 1; }
.tfa-secret code { font: 600 15px/1.4 var(--font-mono); letter-spacing: .04em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; overflow-wrap: anywhere; }
.tfa-confirm { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.tfa-code { width: 150px; text-align: center; font: 600 22px/1 var(--font-mono) !important; letter-spacing: .2em; height: 46px !important; }
.tfa-card .tfa-code { width: 100%; }
.tfa-links { display: flex; flex-direction: column; gap: 6px; }
.tfa-links a { color: var(--brand-mid); }
.tfa-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tfa-actions form { margin: 0; }
.tfa-codes { border: 2px dashed var(--warn); background: var(--warn-bg); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.tfa-codes p { margin: 0 0 10px; font-size: 13.5px; }
.tfa-codes ol { margin: 0 0 12px; padding: 0 0 0 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; font-size: 16px; }
.tfa-codes-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tfa-admin { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tfa-admin span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.tfa-admin small { font-size: 12.5px; }
.tfa-admin form { margin: 0; }
.tfa-policy { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; width: 100%; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.radio-card input { margin-top: 3px; accent-color: var(--brand-mid); }
.radio-card span { display: flex; flex-direction: column; font-size: 14px; }
.radio-card small { color: var(--muted); font-size: 12.5px; }
@media print {
  body.page-print-codes * { visibility: hidden; }
  .tfa-codes, .tfa-codes * { visibility: visible; }
  .tfa-codes { position: absolute; left: 0; top: 0; width: 100%; border: 0; background: #fff; }
  .tfa-codes-actions { display: none; }
}
.btn.xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; }

/* ------------------------------------------------------------ przetwarzanie wielu dokumentów --- */
.batch-frame { position: fixed; left: -12000px; top: 0; width: 1100px; height: 900px; border: 0; visibility: hidden; pointer-events: none; }
.batch-dlg .ui-dlg-card { width: min(560px, calc(100vw - 32px)); display: flex; flex-direction: column; }
.batch-dlg .ui-dlg-card > * { flex-shrink: 0; }
.batch-dlg .bt-body { flex: 1 1 auto; min-height: 60px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.bt-sec { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bt-sec legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.bt-sec legend .muted { font-weight: 400; }
.bt-sub { margin-left: 26px; font-size: 14px; } .bt-sub.off { opacity: .45; }
.bt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bt-chip { position: relative; cursor: pointer; }
.bt-chip input { position: absolute; opacity: 0; pointer-events: none; }
.bt-chip span { display: inline-block; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; background: var(--surface); user-select: none; }
.bt-chip input:checked + span { background: #1f2933; color: #fff; border-color: #1f2933; }
.bt-chip input:focus-visible + span { outline: 2px solid var(--brand, #00A4E1); outline-offset: 2px; }
.bt-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 10px; font-size: 14px; }
.bt-sec .hint { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.bt-warn { margin: 0; padding: 8px 10px; border-radius: 8px; background: #fff4e5; color: #8a4b00; font-size: 13px; }
.bt-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bt-bar i { display: block; height: 100%; width: 0; background: var(--brand, #00A4E1); transition: width .3s; }
.bt-now { margin: 8px 0; font-size: 14px; } .bt-e { color: #b42318; }
.bt-log { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.bt-log li { display: grid; grid-template-columns: 20px 1fr; column-gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.bt-log li:last-child { border-bottom: 0; }
.bt-log li b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-log li small { grid-column: 2; color: var(--muted); font-size: 12px; } .bt-log li small:empty { display: none; }
.bt-st { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); margin-top: 2px; box-sizing: border-box; }
.bt-log li.now .bt-st { border-color: var(--brand, #00A4E1); border-right-color: transparent; animation: spin .8s linear infinite; }
.bt-log li.ok .bt-st { border: 0; background: #1d7f52 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center/11px no-repeat; }
.bt-log li.warn .bt-st { border: 0; background: #e5a100; }
.bt-log li.err .bt-st { border: 0; background: #d64545; }
.bt-log li.err small { color: #b42318; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) { .bt-row { grid-template-columns: 1fr; gap: 4px; } }
.batch-dlg .seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 10px; background: var(--bg, #f1f3f5); border: 1px solid var(--line); align-self: flex-start; }
.batch-dlg .seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.batch-dlg .seg button[aria-pressed="true"] { background: var(--pressed, #1f2933); color: #fff; font-weight: 600; }
.batch-dlg .seg button:disabled { opacity: .4; cursor: not-allowed; }

/* Wygląd i marka (Ustawienia oraz instalator) */
.brand-form h2.bf-h { margin-top: 28px; }
.bf-lead { margin: -4px 0 14px; font-size: 13px; max-width: 80ch; }
.bf-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.bf-preset { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: 13px; }
.bf-preset i { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--p), var(--d)); flex: none; }
.bf-preset[aria-pressed="true"] { border-color: var(--brand-deep); box-shadow: 0 0 0 2px rgb(var(--deep-rgb) / .25); font-weight: 600; }
.bf-colors { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.bf-color { display: flex; align-items: center; gap: 10px; }
.bf-color input[type=color] { width: 48px; height: 48px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: none; cursor: pointer; }
.bf-color input[type=color]::-webkit-color-swatch-wrapper { padding: 3px; }
.bf-color input[type=color]::-webkit-color-swatch { border: 0; border-radius: 9px; }
.bf-color span { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.bf-color .inp { width: 104px; padding: 5px 8px; text-transform: uppercase; }
.bf-sample { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 12px; font-size: 13px; }
.bf-sample a { color: var(--brand-mid); text-decoration: underline; }
.bf-fld { padding: 3px 10px; background: var(--fld); border: 1px solid var(--fld-line); border-radius: 4px; }
.bf-tab { padding: 4px 12px; border-radius: 999px; background: var(--pressed); color: #fff; font-weight: 600; }
.bf-contrast { margin: 12px 0 0; }
.bf-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; }
.bf-slot { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); min-width: 0; }
.bf-slot.wide { grid-column: 1 / -1; }
.bf-prev { flex: none; width: 150px; height: 96px; border-radius: 10px; display: grid; place-items: center; padding: 10px;
  background: #fff repeating-conic-gradient(#f1f3f6 0 25%, #fff 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line); }
.bf-slot.dark .bf-prev { background: #121D2B repeating-conic-gradient(#172434 0 25%, #121D2B 0 50%) 0 0 / 16px 16px; }
.bf-prev.sq { width: 96px; }
.bf-prev.og { width: 240px; height: 126px; padding: 0; overflow: hidden; }
.bf-prev.og img { width: 100%; height: 100%; object-fit: cover; max-height: none; }
.bf-prev img { max-width: 100%; max-height: 76px; object-fit: contain; }
.bf-prev img[src=""] { display: none; }
.bf-meta { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.bf-meta b { font-size: 14px; }
.bf-meta small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.bf-info { font-size: 12.5px; color: var(--ok); }
.bf-slot.def .bf-info { color: var(--muted); }
.bf-info.bad { color: var(--danger) !important; }
.bf-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.bf-slot.auto .bf-btns .bf-pick { display: none; }
.bf-bg { margin-top: 4px; max-width: 220px; }
.bf-bg .inp { padding: 5px 8px; }
.bf-icons { display: flex; align-items: flex-end; gap: 14px; margin-top: 6px; }
.bf-icons figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.bf-icons img { image-rendering: auto; }
.bf-icons img.ios { border-radius: 13px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.bf-icons img.round { border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
@media (max-width: 560px) {
  .bf-slots { grid-template-columns: 1fr; }
  .bf-slot { flex-direction: column; }
  .bf-prev, .bf-prev.og { width: 100%; }
  .bf-prev.sq { width: 96px; }
}

.bf-sizes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px 22px; margin-bottom: 16px; }
.bf-sizes input[type=range] { width: 100%; }
.bf-login-prev { margin-top: 6px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.bf-login-prev .logo { height: var(--logo-login-h, 64px); max-width: 100%; width: auto; object-fit: contain; }
.bf-login-prev b { font-size: 15px; }
