/* MT Kadry – system wizualny. Bez zewnętrznych czcionek i bibliotek (CSP: tylko 'self'). */
:root {
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --bg: #f4f5f9; --surface: #ffffff; --surface-2: #f8f9fc; --border: #e4e7ef; --border-strong: #cfd4e0;
  --text: #141a2b; --text-2: #4a5468; --muted: #7b8499;
  --brand: #4f46e5; --brand-600: #4338ca; --brand-50: #eef0ff; --brand-100: #e0e3ff;
  --green: #12805c; --green-50: #e7f6ef; --red: #c9302c; --red-50: #fdecec; --amber: #b25e09; --amber-50: #fff4e0;
  --blue: #1f6feb; --blue-50: #e8f1ff; --violet: #7c3aed; --violet-50: #f3ecff; --gray-50: #f1f3f7;
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --focus: 0 0 0 3px rgba(79, 70, 229, .35);
  --sidebar-w: 264px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d111b; --surface: #151a27; --surface-2: #1a2030; --border: #262d40; --border-strong: #343c53;
    --text: #e8ebf3; --text-2: #b4bccd; --muted: #8790a6;
    --brand: #818cf8; --brand-600: #a5b4fc; --brand-50: #1f2347; --brand-100: #2a2f5c;
    --green: #4ade9b; --green-50: #12291f; --red: #f87171; --red-50: #2c1517; --amber: #fbbf5b; --amber-50: #2d2210;
    --blue: #7fb0ff; --blue-50: #142238; --violet: #b69bff; --violet-50: #231a3a; --gray-50: #1c2232;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14.5px/1.55 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14.5px; font-weight: 650; }
.sprite { display: none; }
.icon { flex: none; vertical-align: middle; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------- układ ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 14px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 18px; }
.brand-center { justify-content: center; padding-bottom: 22px; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; background: #fff; border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(17, 24, 39, .08); }
.brand-mark img { display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text small { color: var(--muted); font-size: 12px; }
.nav-title { margin: 16px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin: 1px 0; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 520; }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.is-active { background: var(--brand-50); color: var(--brand-600); font-weight: 650; }
.nav-link.is-active .icon { color: var(--brand); }
.nav-link > span { flex: 1; }
.nav-link.is-planned { color: var(--muted); opacity: .7; cursor: not-allowed; }
.nav-link em { font-style: normal; font-size: 10.5px; padding: 1px 7px; border-radius: 99px; background: var(--gray-50); }
.nav-badge { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 11.5px; display: inline-grid; place-items: center; }
.sidebar-foot { margin-top: auto; padding: 14px 10px 0; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--border); }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; height: 64px; padding: 0 28px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top-search { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; color: var(--muted); }
.top-search input { border: 0; background: transparent; padding: 9px 0; width: 100%; font: inherit; color: var(--text); outline: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta small { color: var(--muted); font-size: 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.menu-toggle { display: none; }
.content { padding: 26px 28px 48px; max-width: 1320px; width: 100%; }

/* ---------- nagłówki stron ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--brand); margin-bottom: 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 520; margin-bottom: 10px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- karty ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 18px 20px 0; }
.card-planned { background: repeating-linear-gradient(-45deg, var(--surface), var(--surface) 10px, var(--surface-2) 10px, var(--surface-2) 20px); color: var(--text-2); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 18px; }

/* ---------- kafelki statystyk ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.tile { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); transition: transform .12s ease, box-shadow .12s ease; }
.tile:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.tile-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.tile-value { font-size: 26px; font-weight: 750; line-height: 1.1; }
.tile-label { color: var(--text-2); font-size: 13px; }
.tone-amber { background: var(--amber-50); color: var(--amber); } .tone-blue { background: var(--blue-50); color: var(--blue); }
.tone-red { background: var(--red-50); color: var(--red); } .tone-green { background: var(--green-50); color: var(--green); }
.tone-violet { background: var(--violet-50); color: var(--violet); } .tone-gray { background: var(--gray-50); color: var(--text-2); }

/* ---------- awatary ---------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12.5px; font-weight: 700; color: #fff; flex: none; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; border-radius: 18px; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-indigo { background: #6366f1; } .avatar-teal { background: #0d9488; } .avatar-amber { background: #d97706; }
.avatar-rose { background: #e11d48; } .avatar-sky { background: #0284c7; } .avatar-violet { background: #7c3aed; }
.avatar-emerald { background: #059669; } .avatar-orange { background: #ea580c; }
.person { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 560; }
.person small { display: block; color: var(--muted); font-weight: 400; }

/* ---------- tabele ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
tr.is-alert td { background: var(--red-50); }
tr.is-current td { background: var(--green-50); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); }
.empty .icon { display: block; margin: 0 auto 8px; color: var(--border-strong); }

/* ---------- etykiety ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--gray-50); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-plain::before { display: none; }
.badge-green { background: var(--green-50); color: var(--green); } .badge-red { background: var(--red-50); color: var(--red); }
.badge-amber, .badge-orange { background: var(--amber-50); color: var(--amber); } .badge-blue, .badge-sky { background: var(--blue-50); color: var(--blue); }
.badge-violet { background: var(--violet-50); color: var(--violet); }

/* ---------- przyciski i formularze ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; line-height: 1.2; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, .25); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn-danger:hover { background: var(--red-50); border-color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.link-button { background: none; border: none; padding: 0; color: var(--brand); cursor: pointer; font: inherit; font-weight: 600; }
form.inline { display: inline; }
.form { max-width: 640px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.field { display: flex; flex-direction: column; margin-bottom: 15px; }
.field label { font-weight: 600; margin-bottom: 6px; font-size: 13.5px; }
.field input, .field select, .field textarea, .input { padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 10px; font: inherit; background: var(--surface); color: var(--text); width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
/* Pola wyboru (radio, checkbox) w formularzach: w jednej linii z podpisem, nie na całą szerokość */
.field input[type="radio"], .field input[type="checkbox"] { width: auto; padding: 0; margin: 0; flex: none; accent-color: var(--brand); }
.field div:has(> div > label > input[type="radio"]) { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.field label:has(> input[type="radio"]), .field label:has(> input[type="checkbox"]) { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; min-height: 36px; cursor: pointer; }
.field .help { color: var(--muted); margin-top: 5px; font-size: 12.5px; }
.field .error { color: var(--red); margin-top: 5px; font-size: 12.5px; font-weight: 550; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red); }
.form-errors { background: var(--red-50); color: var(--red); padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 550; }
.form-errors p { margin: 0; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filters .field { margin-bottom: 0; min-width: 170px; }
.decision { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.decision input { padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 9px; font: inherit; background: var(--surface); color: var(--text); min-width: 180px; }

/* ---------- komunikaty ---------- */
.messages { margin-bottom: 18px; display: grid; gap: 8px; }
.msg { margin: 0; padding: 11px 14px; border-radius: 11px; background: var(--blue-50); color: var(--blue); font-weight: 550; border: 1px solid color-mix(in srgb, currentColor 18%, transparent); }
.msg-success { background: var(--green-50); color: var(--green); }
.msg-error { background: var(--red-50); color: var(--red); }
.msg-warning { background: var(--amber-50); color: var(--amber); }
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--amber-50); color: var(--amber); padding: 11px 14px; border-radius: 11px; font-weight: 520; margin-bottom: 14px; }
.notice-info { background: var(--blue-50); color: var(--blue); }

/* ---------- zakładki ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs span { padding: 8px 14px; border-radius: 9px; color: var(--text-2); font-weight: 560; white-space: nowrap; }
.tabs a:hover { background: var(--surface-2); text-decoration: none; }
.tabs a[aria-current="page"] { background: var(--brand-50); color: var(--brand-600); }
.tabs .is-planned { color: var(--muted); opacity: .65; cursor: not-allowed; }
.tabs .is-planned small { font-size: 10.5px; margin-left: 4px; }

/* ---------- profil ---------- */
.profile { display: flex; align-items: center; gap: 18px; }
.profile h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--text-2); margin-top: 6px; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 0; margin: 0; }
.kv dt { color: var(--muted); padding: 10px 0; border-bottom: 1px solid var(--border); }
.kv dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--border); font-weight: 520; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }

/* ---------- salda i paski ---------- */
.balances { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.balance { padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.balance strong { display: block; font-size: 24px; font-weight: 750; }
.balance .label { font-weight: 600; color: var(--text-2); font-size: 13px; }
progress { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border: 0; border-radius: 99px; background: var(--gray-50); overflow: hidden; margin: 8px 0 4px; }
progress::-webkit-progress-bar { background: var(--gray-50); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--brand); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--brand); border-radius: 99px; }
progress.warn::-webkit-progress-value { background: var(--red); } progress.warn::-moz-progress-bar { background: var(--red); }

/* ---------- kalendarz ---------- */
.cal-wrap { overflow-x: auto; }
.cal { border-collapse: separate; border-spacing: 2px; min-width: 100%; }
.cal th, .cal td { padding: 0; border: 0; background: none; text-align: center; }
.cal thead th { font-size: 11px; color: var(--muted); padding: 4px 0; min-width: 30px; text-transform: none; letter-spacing: 0; background: none; }
.cal thead th.wkend, .cal td.wkend { color: var(--muted); }
.cal thead th.today { color: var(--brand); }
.cal th.who { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); font-weight: 560; text-align: left; min-width: 190px; padding-right: 10px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.cal .cell { display: block; height: 30px; border-radius: 7px; background: var(--surface-2); font-size: 10.5px; font-weight: 700; line-height: 30px; }
.cal td.wkend .cell:not([class*="c-"]) { background: repeating-linear-gradient(45deg, var(--gray-50), var(--gray-50) 4px, transparent 4px, transparent 8px); }
.cal td.holiday .cell:not([class*="c-"]) { background: var(--red-50); }
.cal td.today .cell { box-shadow: inset 0 0 0 2px var(--brand); }
.cal tbody tr:hover td { background: none; }
.cell.c-blue { background: #3b82f6; color: #fff; } .cell.c-indigo { background: #6366f1; color: #fff; }
.cell.c-teal { background: #14b8a6; color: #fff; } .cell.c-orange { background: #f97316; color: #fff; }
.cell.c-purple { background: #a855f7; color: #fff; } .cell.c-gray { background: #94a3b8; color: #fff; }
.cell.c-pink { background: #ec4899; color: #fff; } .cell.c-green { background: #22c55e; color: #fff; }
.cell.c-red { background: #ef4444; color: #fff; } .cell.c-slate { background: #64748b; color: #fff; }
.cell.pending { opacity: .5; outline: 2px dashed currentColor; outline-offset: -3px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: 14px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.dot-blue { background: #3b82f6; } .dot-indigo { background: #6366f1; } .dot-teal { background: #14b8a6; }
.dot-orange { background: #f97316; } .dot-purple { background: #a855f7; } .dot-gray { background: #94a3b8; }
.dot-pink { background: #ec4899; } .dot-green { background: #22c55e; } .dot-red { background: #ef4444; } .dot-slate { background: #64748b; }

/* ---------- listy ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .meta { color: var(--muted); font-size: 12.5px; }
pre.json { margin: 0; font-size: 12px; white-space: pre-wrap; max-width: 460px; color: var(--text-2); font-family: ui-monospace, Consolas, monospace; }
details.card summary { cursor: pointer; font-weight: 600; }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 14px; }

/* ---------- ekran logowania ---------- */
.auth-screen { min-height: 100vh; display: grid; place-content: center; padding: 24px; background: radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, .18), transparent 60%), radial-gradient(900px 500px at 110% 110%, rgba(236, 72, 153, .14), transparent 60%), var(--bg); }
.auth-card { width: min(420px, 92vw); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 21px; margin-bottom: 4px; text-align: center; }
.auth-card .lead { text-align: center; color: var(--muted); margin: 0 0 22px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 11px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12px; max-width: 420px; margin: 18px auto 0; }

/* ---------- responsywność ---------- */
@media (max-width: 1080px) { .grid-main, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  .menu-toggle { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 40px; }
  .grid-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .user-meta, .hide-sm { display: none; }
  .kv { grid-template-columns: 1fr; } .kv dt { border-bottom: 0; padding-bottom: 0; }
}
/* Elementy siatki i kolumny nie mogą być szersze niż ekran – szerokie tabele przewijają się w .table-wrap */
.stack > *, .grid > *, .main-col, .content, .card { min-width: 0; }

/* ---------- telefon: dolny pasek, przycisk „+”, większe pola dotykowe ---------- */
.tabbar, .fab { display: none; }
.top-spacer { flex: 1; }
@media (max-width: 860px) {
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 18px rgba(15, 23, 42, .06); }
  .tab-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; min-height: 48px;
    color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; background: none; border: 0; border-radius: 10px; cursor: pointer; font-family: inherit; }
  .tab-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab-item.is-active { color: var(--brand); background: var(--brand-50); }
  .tab-badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; }
  .fab { display: grid; place-items: center; position: fixed; z-index: 41; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border-radius: 50%;
    background: var(--brand); color: #fff; box-shadow: var(--shadow-lg); }
  .has-tabbar .content { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  input, select, textarea { font-size: 16px; } /* iOS nie powiększa strony przy wpisywaniu */
  .btn { min-height: 44px; } .btn-sm { min-height: 40px; }
  .nav-link { min-height: 44px; }
  .top-search { flex: 1; min-width: 0; }
  .page-head { flex-wrap: wrap; gap: 10px; }
  .decision { flex-wrap: wrap; } .decision input { flex: 1 1 100%; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  td, th { white-space: nowrap; }
  .cal th.who { min-width: 0; width: 132px; max-width: 132px; white-space: normal; font-size: 12.5px; line-height: 1.25; }
  .sidebar { padding-bottom: calc(80px + env(safe-area-inset-bottom)); overflow-y: auto; max-height: 100vh; }
}
/* Na wąskim ekranie tabele z klasą .table-stack zamieniają się w karty: każdy wiersz to blok, kolumny z podpisem */
@media (max-width: 600px) {
  .table-wrap:has(> .table-stack) { margin: 0; padding: 0; }
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 10px 16px; border-bottom: 1px solid var(--border); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack td { border: 0; padding: 3px 0; white-space: normal; background: none !important; }
  .table-stack tr.is-alert { background: var(--red-50); }
  .table-stack td.num { text-align: left; }
  .table-stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12.5px; }
}
@media (max-width: 480px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }


/* Konto: logowanie dwuetapowe */
.qr { text-align: center; margin: 12px 0; }
.qr img { background: #fff; padding: 8px; border-radius: 12px; }
code.secret { font-size: 15px; letter-spacing: .04em; word-break: break-all; }
.steps { padding-left: 20px; margin: 8px 0; }
.steps li { margin: 4px 0; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.codes code { display: block; text-align: center; font-size: 16px; padding: 8px; border: 1px dashed var(--border-strong); border-radius: 8px; }

/* Czas pracy */
.worktime td { vertical-align: top; }
.muted-row td { background: var(--surface-2); }
.today-row td { box-shadow: inset 3px 0 0 var(--brand); }

/* Oznaczenie środowiska testowego (staging) */
.env-banner { position: sticky; top: 0; z-index: 100; background: #b45309; color: #fff; text-align: center;
  font-size: 13px; font-weight: 600; padding: 4px 12px; letter-spacing: .02em; }
