:root {
  --bg:#f4f3ef; --panel:#fff; --ink:#1a1a1a; --muted:#6b6b6b; --line:#dedbd2; --gold:#b48a24; --gold-soft:#f6efdc;
  --danger:#b91c1c; --danger-bg:#fef2f2; --ok:#166534; --ok-bg:#ecfdf5; --info:#1d4ed8; --info-bg:#eff6ff; --warn:#92400e; --warn-bg:#fff7ed;
  --t-grey:#e7e5e4; --t-grey-ink:#44403c; --t-blue:#dbeafe; --t-blue-ink:#1e3a8a; --t-yellow:#fef3c7; --t-yellow-ink:#78350f;
  --t-green:#dcfce7; --t-green-ink:#14532d; --t-red:#fee2e2; --t-red-ink:#7f1d1d; --t-orange:#ffedd5; --t-orange-ink:#7c2d12;
}
* { box-sizing:border-box; }
body { margin:0; font-family: Arial, Helvetica, sans-serif; color:var(--ink); background:var(--bg); font-size:14px; }
a { color:inherit; }
button { border:0; border-radius:8px; padding:10px 14px; font:700 13px Arial, sans-serif; cursor:pointer; }
button:disabled { opacity:.5; cursor:not-allowed; }
.primary { background:#1a1a1a; color:#fff; }
.gold { background:var(--gold); color:#fff; }
.secondary { background:var(--gold-soft); color:#5f470c; }
.ghost { background:#efede7; color:#1a1a1a; }
.danger { background:var(--danger-bg); color:var(--danger); border:1px solid #fecaca; }
.link { background:none; padding:0; color:var(--muted); text-decoration:underline; font-weight:400; }
.muted { color:var(--muted); }
[hidden] { display:none !important; }

.topbar { display:flex; align-items:center; gap:24px; padding:0 20px; height:56px; background:#1a1a1a; color:#fff; position:sticky; top:0; z-index:10; }
.topbar .brand { display:flex; align-items:center; gap:8px; font-weight:700; text-decoration:none; white-space:nowrap; }
.topbar .brand img { width:26px; height:26px; background:#fff; border-radius:6px; padding:2px; }
.topbar nav { display:flex; gap:4px; flex:1; overflow-x:auto; }
.topbar nav a { padding:8px 12px; border-radius:7px; text-decoration:none; color:#d6d3cb; white-space:nowrap; }
.topbar nav a.active, .topbar nav a:hover { background:#333; color:#fff; }
.topbar nav .count { background:var(--gold); color:#fff; border-radius:10px; padding:1px 7px; font-size:11px; margin-left:4px; }
.topbar .who { font-size:12px; color:#d6d3cb; white-space:nowrap; }
.topbar .who .link { color:#d6d3cb; margin-left:8px; }

#view { padding:24px; }
.wrap { max-width:1280px; margin:0 auto; }
h1 { font-size:22px; margin:0 0 4px; }
.sub { color:var(--muted); margin:0 0 18px; }

/* listy */
.toolbar { display:flex; justify-content:space-between; align-items:end; gap:12px; margin-bottom:14px; flex-wrap:wrap; }
.filters { display:flex; gap:8px; flex-wrap:wrap; }
.filters input, .filters select { padding:8px 10px; border:1px solid var(--line); border-radius:8px; font:inherit; background:#fff; }
.table-wrap { background:var(--panel); border:1px solid var(--line); border-radius:12px; overflow:auto; }
table.list { width:100%; border-collapse:collapse; }
table.list th { text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); padding:10px 12px; border-bottom:1px solid var(--line); white-space:nowrap; }
table.list td { padding:11px 12px; border-bottom:1px solid #f0eee8; vertical-align:middle; }
table.list tr:last-child td { border-bottom:0; }
table.list tbody tr { cursor:pointer; }
table.list tbody tr:hover { background:#faf9f6; }
.empty { padding:40px; text-align:center; color:var(--muted); }
.num-col { font-variant-numeric:tabular-nums; white-space:nowrap; }

.pill { display:inline-block; padding:3px 9px; border-radius:999px; font-size:12px; font-weight:700; white-space:nowrap; }
.tone-grey { background:var(--t-grey); color:var(--t-grey-ink); }
.tone-blue { background:var(--t-blue); color:var(--t-blue-ink); }
.tone-yellow { background:var(--t-yellow); color:var(--t-yellow-ink); }
.tone-green { background:var(--t-green); color:var(--t-green-ink); }
.tone-red { background:var(--t-red); color:var(--t-red-ink); }
.alert { display:inline-block; padding:3px 8px; border-radius:6px; font-size:12px; background:var(--t-orange); color:var(--t-orange-ink); font-weight:700; }

/* widok umowy */
.contract { display:grid; grid-template-columns:minmax(360px, 460px) 1fr; gap:0; margin:-24px; min-height:calc(100vh - 56px); }
.side { background:var(--panel); border-right:1px solid var(--line); padding:20px 22px 0; overflow:auto; height:calc(100vh - 56px); position:sticky; top:56px; display:flex; flex-direction:column; }
.side-body { flex:1; }
.preview { padding:24px; overflow:auto; }
.preview-head { max-width:210mm; margin:0 auto 12px; display:flex; justify-content:space-between; gap:16px; align-items:baseline; font-size:12px; color:var(--muted); }
.preview-head > span:first-child { white-space:nowrap; }
.preview-head #fileName { text-align:right; color:var(--ink); }
.c-head { display:flex; justify-content:space-between; align-items:start; gap:8px; margin-bottom:8px; }
.c-head h2 { font-size:16px; margin:0 0 3px; }
.banner { border-radius:9px; padding:10px 12px; font-size:12.5px; line-height:1.45; margin:10px 0; }
.banner.err { background:var(--danger-bg); color:var(--danger); border:1px solid #fecaca; }
.banner.warn { background:var(--warn-bg); color:var(--warn); border:1px solid #fed7aa; }
.banner.info { background:var(--info-bg); color:var(--info); border:1px solid #bfdbfe; }
.banner.ok { background:var(--ok-bg); color:var(--ok); border:1px solid #bbf7d0; }
.banner ul { margin:6px 0 0; padding-left:18px; }
.banner li a { color:inherit; }
.section-title { margin:20px 0 9px; font-size:11px; text-transform:uppercase; letter-spacing:.08em; font-weight:700; color:#57534e; }
.field { margin-bottom:10px; }
.field label { display:block; font-size:12px; font-weight:700; margin:0 0 4px; }
.field input, .field select, .field textarea { width:100%; border:1px solid var(--line); border-radius:8px; padding:9px 10px; font:inherit; font-size:13px; background:#fff; outline:none; }
.field textarea { min-height:60px; resize:vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color:var(--gold); box-shadow:0 0 0 3px rgba(180,138,36,.14); }
.field input:disabled, .field select:disabled, .field textarea:disabled { background:#f7f6f2; color:#3a3a3a; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color:var(--danger); }
.field .ferr { color:var(--danger); font-size:11px; margin-top:3px; }
.field.biz label::after { content:"warunek biznesowy"; font-weight:400; font-size:10px; color:var(--gold); margin-left:6px; text-transform:uppercase; letter-spacing:.04em; }
.hint { font-size:11px; color:var(--muted); margin-top:4px; line-height:1.35; }
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.inline-row { display:grid; grid-template-columns:1fr auto; gap:8px; align-items:end; }
.small-btn { background:#fff; border:1px solid var(--line); padding:9px 10px; font-size:12px; white-space:nowrap; }
.actions { position:sticky; bottom:0; background:#fff; padding:12px 0 16px; border-top:1px solid var(--line); margin-top:14px; display:grid; gap:8px; }
.actions .row { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.status-box { border-radius:8px; padding:8px 10px; font-size:12px; line-height:1.4; margin-top:6px; }

.history { margin-top:6px; border-left:2px solid var(--line); padding-left:12px; }
.history .ev { margin:0 0 12px; font-size:12.5px; }
.history .ev .t { color:var(--muted); font-size:11px; }
.history .ev .chg { margin:4px 0 0; padding:0; list-style:none; font-size:12px; }
.history .ev .chg li { margin:2px 0; }
.history .ev .chg s { color:var(--muted); }
.history .ev .cm { margin-top:4px; background:#f7f6f2; border-radius:6px; padding:6px 8px; font-size:12px; }
.biz-tag { color:var(--gold); font-weight:700; font-size:10px; text-transform:uppercase; }
details.box { border:1px solid var(--line); border-radius:9px; padding:8px 12px; margin:10px 0; background:#fff; }
details.box summary { cursor:pointer; font-weight:700; font-size:13px; }

/* logowanie */
.login { max-width:440px; margin:8vh auto; background:#fff; border:1px solid var(--line); border-radius:14px; padding:28px; }
.login img { width:100%; height:auto; margin-bottom:18px; }

#toast { position:fixed; bottom:20px; left:50%; transform:translateX(-50%); background:#1a1a1a; color:#fff; padding:10px 16px; border-radius:9px; font-size:13px; opacity:0; transition:opacity .2s; pointer-events:none; z-index:50; max-width:90vw; }
#toast.show { opacity:1; }
#toast.err { background:var(--danger); }
dialog { border:0; border-radius:14px; padding:22px; width:min(480px, 92vw); box-shadow:0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background:rgba(0,0,0,.35); }
dialog h3 { margin:0 0 6px; }
dialog textarea { width:100%; border:1px solid var(--line); border-radius:8px; padding:9px; font:inherit; }
.dlg-actions { display:flex; justify-content:end; gap:8px; margin-top:12px; }

@media (max-width: 1100px) {
  .contract { grid-template-columns:1fr; margin:-24px -24px 0; }
  .side { position:relative; height:auto; top:0; border-right:0; border-bottom:1px solid var(--line); }
  .preview { overflow-x:auto; }
}
@media (max-width: 640px) {
  #view { padding:16px; }
  .contract { margin:-16px -16px 0; }
  .topbar { gap:10px; padding:0 12px; }
  .topbar .who #whoName .me-name { display:none; }
  .grid2 { grid-template-columns:1fr; }
}

/* 20.10: uwagi, podpis, integracje */
.note-tag { display:inline-block; background:var(--gold-soft); color:#5f470c; border-radius:6px; padding:0 6px; font-size:10px; font-weight:700; text-transform:uppercase; vertical-align:middle; }
.banner.note { background:var(--gold-soft); border:1px solid #e8d9ad; color:#3d2e07; }
.warn-text { color:var(--warn); }
.signing .steps { list-style:none; margin:8px 0; padding:0; }
.signing .steps li { padding:2px 0; color:var(--muted); }
.signing .steps li.done { color:var(--ink); }
.signing .files { display:flex; gap:14px; flex-wrap:wrap; margin-top:6px; }
.signing .files a { font-weight:700; }
.sim { border:1px dashed var(--line); border-radius:8px; padding:6px 8px; margin-bottom:6px; }
.sim .muted { font-size:11px; margin-bottom:4px; }
.wrap.narrow { max-width:760px; }
.card { background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:16px 18px; margin-bottom:14px; }
.card h3 { margin:0 0 8px; }
.card .row { display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; }
.topbar .brand .ver { font-weight:400; font-size:11px; color:#a8a29e; margin-left:2px; }
.ver-login { font-size:12px; color:var(--muted); margin:-2px 0 10px; }

/* stan integracji w nagłówku */
.topbar .health a { display:flex; gap:6px; text-decoration:none; }
.topbar .health { display:flex; gap:6px; white-space:nowrap; }
.hchip { display:inline-flex; align-items:center; gap:5px; font-size:11px; color:#d6d3cb; background:#2a2a2a; border:1px solid #3a3a3a; border-radius:999px; padding:3px 8px 3px 7px; }
.hchip i { width:8px; height:8px; border-radius:50%; display:inline-block; }
.hchip b { font-weight:700; font-size:10px; }
.h-ok i { background:#22c55e; } .h-ok b { color:#86efac; }
.h-warn i { background:#f59e0b; } .h-warn b { color:#fcd34d; }
.h-err i { background:#ef4444; } .h-err b { color:#fca5a5; } .h-err { border-color:#7f1d1d; }
.h-off i { background:#78716c; }
.topbar .health a:hover .hchip { border-color:#666; color:#fff; }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
@media (max-width: 900px) { .hchip { font-size:0; padding:4px; gap:0; } .hchip i { width:9px; height:9px; } .hchip b { display:none; } }
@media (max-width: 1360px) { .topbar .who #whoName .me-name { display:none; } .topbar { gap:16px; } }
.topbar .brand .brand-text { display:flex; flex-direction:column; line-height:1.1; }
.topbar .brand .ver { font-weight:400; font-size:10px; color:#a8a29e; margin-left:0; letter-spacing:.01em; }

/* wybór wzoru umowy */
.tpl-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:14px; }
.tpl-card { display:flex; flex-direction:column; gap:8px; background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:18px; text-decoration:none; color:var(--ink); transition:border-color .15s, box-shadow .15s; }
.tpl-card:hover, .tpl-card:focus-visible { border-color:var(--gold); box-shadow:0 2px 10px rgba(180,138,36,.15); outline:none; }
.tpl-name { font-weight:700; font-size:16px; }
.tpl-desc { color:var(--muted); font-size:13px; line-height:1.45; flex:1; }
.tpl-go { color:var(--gold); font-weight:700; font-size:13px; }

/* Umowa VIP: podsekcje i tabela progów rabatu rocznego */
.subsection { font-weight:700; font-size:12px; margin:14px 0 8px; color:var(--ink, #222); }
.tier-head, .tier-row { display:grid; grid-template-columns:34px 70px 1fr 1fr 32px; gap:6px; align-items:center; }
.tier-head { font-size:11px; margin-bottom:4px; }
.tier-row { margin-bottom:6px; }
.tier-row .tier-no { text-align:center; font-weight:700; }

/* Konta: avatar, profil, użytkownicy */
.avatar { border-radius:50%; object-fit:cover; display:inline-flex; align-items:center; justify-content:center; flex:none; vertical-align:middle; }
.avatar.ini { background:#d9c79a; color:#1a1a1a; font-weight:700; }
.topbar .who { display:flex; align-items:center; gap:6px; }
.topbar .me-link { display:inline-flex; align-items:center; gap:8px; color:#d6d3cb; text-decoration:none; }
.topbar .me-link:hover .me-name { text-decoration:underline; }
.wrap.narrow { max-width:980px; }
.cards { display:grid; grid-template-columns:repeat(auto-fit, minmax(300px, 1fr)); gap:14px; align-items:start; }
.card { background:#fff; border:1px solid var(--line); border-radius:12px; padding:16px 18px; margin-bottom:14px; }
.card h3 { margin:0 0 12px; font-size:15px; }
.card-head { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.card-head h3 { margin:0; }
.prof-photo { display:flex; align-items:center; gap:14px; margin-bottom:14px; }
.small { font-size:12px; }
.row-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-top:10px; }
.check { display:flex; gap:8px; align-items:center; font-size:12.5px; margin:8px 0; }
.check input { width:auto; }
.role-boxes { display:flex; flex-wrap:wrap; gap:6px 14px; }
.role-boxes label { display:flex; gap:6px; align-items:center; font-weight:400; font-size:13px; margin:0; }
.role-boxes input { width:auto !important; }
.role { display:inline-block; border-radius:10px; padding:2px 8px; font-size:11px; font-weight:700; background:#efede7; margin:1px 0; white-space:nowrap; }
.role.r-ADMIN { background:#1a1a1a; color:#fff; }
.role.r-DS { background:#fde68a; }
.role.r-KA { background:#bfdbfe; }
.role.r-DH { background:#bbf7d0; }
.role.r-VIEWER { background:#e7e5e4; }
.users-list tr.inactive td { opacity:.55; }
.codes { display:grid; grid-template-columns:repeat(2, max-content); gap:4px 18px; margin:8px 0; font-size:14px; }
.qr svg { width:180px; height:180px; display:block; margin:8px 0; background:#fff; }
code.secret { word-break:break-all; }
.steps-list { padding-left:18px; }
.steps-list li { margin-bottom:12px; }
.login .wide { width:100%; }
.login .center, .center { text-align:center; }
.right { text-align:right; }
@media (max-width: 720px) { .topbar .me-name { display:none; } }
.inline-row input { width:100%; border:1px solid var(--line); border-radius:8px; padding:9px 10px; font:inherit; font-size:13px; background:#fff; }
#tfaEn { grid-template-columns:1fr auto; max-width:340px; }
#tfaEn input { letter-spacing:.2em; font-size:16px; }

/* SIGMA — logo (wariant C, 06.11.2026); krój Space Grotesk 500 (OFL) tylko w napisie SIGMA */
@font-face { font-family:"Space Grotesk"; font-style:normal; font-weight:500; font-display:swap; src:url("/assets/fonts/space-grotesk-latin-500-normal.woff2") format("woff2"); }
.sigma-word { font-family:"Space Grotesk", Arial, sans-serif; font-weight:500; letter-spacing:.2em; }
.topbar .brand .sigma-mark { flex:0 0 auto; }
.topbar .brand .sigma-word { font-size:17px; color:#F4EFE3; line-height:1.15; margin-right:-.2em; }
.login .sigma-lockup { display:flex; align-items:center; justify-content:center; gap:14px; margin:4px 0 6px; }
.login .sigma-lockup svg { flex:0 0 auto; }
.login .sigma-lockup .sigma-word { font-size:44px; line-height:1; color:#1C1C1C; margin-right:-.2em; }
.login .sigma-lockup .sigma-tag { margin-top:6px; font-size:11.5px; letter-spacing:.08em; text-transform:uppercase; color:#5B564C; }
.login .ver-login { text-align:center; }
@media (max-width: 420px) { .login .sigma-lockup svg { width:58px; height:58px; } .login .sigma-lockup .sigma-word { font-size:34px; } }
/* administrator ma 8 pozycji menu — ciaśniej na średnich ekranach (11.11.2026) */
@media (max-width: 1400px) { .topbar nav { gap:2px; } .topbar nav a { padding:8px 8px; font-size:14px; } }

/* Prawa strona paska (11.11.2026): użytkownik, rola i „Wyloguj” na górze, pod spodem stan integracji —
   zwalnia miejsce na wszystkie pozycje menu */
.topbar { height:60px; }
.topbar .topright { display:flex; flex-direction:column; align-items:flex-end; justify-content:center; gap:4px; flex:0 0 auto; margin-left:auto; }
.topbar .topright .who { font-size:12px; line-height:1.2; }
.topbar .topright .health { gap:4px; }
.topbar .topright .hchip { font-size:10.5px; padding:1px 7px 1px 6px; }
@media (max-width: 1360px) { .topbar .who #whoName .me-name { display:inline; } }
@media (max-width: 1100px) { .topbar .who #whoName .me-name { display:none; } }
@media (max-width: 900px) { .topbar .topright .hchip { font-size:0; padding:4px; gap:0; } }

/* Moduł Arkusze (13.11.2026) */
.wrap.wide { max-width:none; }
.btn-link { display:inline-flex; align-items:center; padding:8px 12px; border-radius:8px; text-decoration:none; color:inherit; border:1px solid var(--line, #ddd6c6); background:#fff; white-space:nowrap; }
.tabs { display:flex; gap:4px; border-bottom:1px solid var(--line, #ddd6c6); margin:6px 0 12px; overflow-x:auto; }
.tabs a { padding:9px 14px; text-decoration:none; color:#5b564c; border-bottom:2px solid transparent; white-space:nowrap; }
.tabs a.active { color:#1c1c1c; border-bottom-color:var(--gold, #B8892B); font-weight:600; }
.sheet-tools { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:10px; }
.sheet-tools input[type=search] { flex:1 1 240px; min-width:0; }
.sheet-tools select { flex:0 1 220px; }
.sheet-tools .chk { display:inline-flex; align-items:center; gap:6px; font-size:13px; white-space:nowrap; }
.sheet-wrap { overflow:auto; max-height:calc(100vh - 290px); min-height:240px; border:1px solid var(--line, #ddd6c6); border-radius:10px; background:#fff; }
table.sheet { border-collapse:separate; border-spacing:0; font-size:12.5px; width:max-content; min-width:100%; }
table.sheet th, table.sheet td { border-right:1px solid #eee9dd; border-bottom:1px solid #eee9dd; padding:5px 8px; text-align:left; vertical-align:top; max-width:280px; }
table.sheet thead th { position:sticky; top:0; background:#f3efe4; z-index:2; font-weight:600; white-space:nowrap; }
table.sheet .col-l { display:block; font-size:10px; color:#8a8476; font-weight:400; }
table.sheet .rn { position:sticky; left:0; background:#f8f6f0; color:#8a8476; font-weight:400; z-index:1; text-align:right; min-width:34px; }
table.sheet thead .rn { z-index:3; }
table.sheet td.first { position:sticky; left:42px; background:#fff; z-index:1; min-width:200px; font-weight:600; box-shadow:1px 0 0 #e3dccb; }
table.sheet td.ed { cursor:text; }
table.sheet td.ed:hover { outline:2px solid #e4cf9c; outline-offset:-2px; }
table.sheet td.ro { background:#f6f4ef; color:#5b564c; cursor:not-allowed; }
table.sheet td.editing { padding:2px; outline:2px solid var(--gold, #B8892B); outline-offset:-2px; }
table.sheet td.saving { opacity:.5; }
table.sheet .cell-in { width:100%; min-width:140px; font:inherit; padding:4px 6px; border:0; background:#fffdf6; }
@media (max-width: 720px) { table.sheet td.first { position:static; min-width:160px; } .sheet-wrap { max-height:none; } }
.tabs { flex-wrap:wrap; }
.tabs a { padding:7px 12px; }
.tabs.files { border-bottom:none; margin-bottom:0; }
.tabs.files a { border:1px solid var(--line, #ddd6c6); border-radius:999px; padding:5px 14px; font-size:.92em; }
.tabs.files a.active { background:#f3efe4; border-color:var(--gold, #B8892B); }
/* Listy umów (14.11.2026): szersza strona, nazwa klienta w jednej-dwóch linijkach, pozostałe kolumny bez łamania */
.wrap.list-page { max-width:1680px; }
table.list td.client-col { min-width:280px; }
table.list td.num-col, table.list td.nowrap { white-space:nowrap; }
.protocol-form { border-top:1px solid rgba(0,0,0,.08); margin-top:10px; padding-top:6px; }
.protocol-links { display:flex; flex-direction:column; gap:4px; margin-top:6px; }
.protocol-links a { font-weight:600; }

/* reprezentacja łączna — kolejne osoby podpisujące */
.cosigners { margin-top: 4px; }
.cosigner-row { border: 1px solid var(--line); border-left: 3px solid var(--gold, #c9a227); border-radius: 6px; padding: 8px 10px 10px; margin-bottom: 8px; background: #fcfbf7; }
.cosigner-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-size: 12.5px; }
.cosigner-grid { display: grid; grid-template-columns: 120px 1fr 1fr; gap: 6px; }
.cosigner-grid .cs-email { grid-column: 1 / -1; }
#signerFirstNo { font-size: 12.5px; margin: 0 0 6px; }
@media (max-width: 560px) { .cosigner-grid { grid-template-columns: 1fr 1fr; } .cosigner-grid .cs-gender { grid-column: 1 / -1; } }
.ghost.danger-text { color:var(--danger); }
.topbar .brand .ver.ver-test { background:#c2410c; color:#fff; border-radius:4px; padding:1px 6px; font-weight:600; }
