:root {
  --paper: #f4f3ec; --white: #fffef9; --ink: #202f2a; --muted: #65716a; --line: #dcded4;
  --green: #304f3e; --green-ink: #fff; --lime: #d4e494; --soft: #e8eddf;
  --warn: #8a5a00; --warn-bg: #f5ecd6; --danger: #8b2f2f; --danger-bg: #f5e1df; --ok: #2f6f4f;
  --arena: #b4532a; --radius: 16px; --shadow: 0 10px 34px #223a2814; --tap: 52px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--paper); font-synthesis: none; -webkit-text-size-adjust: 100%;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #151c19; --white: #1d2723; --ink: #eef1ea; --muted: #a2afa7; --line: #2f3d37; --soft: #26332d;
    --green: #8fbf9f; --green-ink: #0f1713; --lime: #3d5a38; --warn: #f0c36a; --warn-bg: #3b3115; --danger: #f2a09a; --danger-bg: #3d1f1d; --ok: #8fd0a6; --shadow: none; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); }
body { min-height: 100vh; line-height: 1.45; padding: env(safe-area-inset-top) 0 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; letter-spacing: -.02em; line-height: 1.15; }
h2 { font-size: 20px; letter-spacing: -.01em; }
h3 { font-size: 16px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green); }
.boot { padding: 40px 20px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hidden, [hidden] { display: none !important; }

/* układ */
.shell { max-width: 980px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 8px; position: sticky; top: 0; z-index: 5; background: var(--paper); }
.topbar .brand { font-size: 13px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.bell { position: relative; width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--white); font-size: 20px; }
.bell b { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 12px; line-height: 20px; }
.page-head { padding: 8px 0 16px; display: grid; gap: 6px; }
.page-head p { color: var(--muted); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; background: var(--white); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 24px #00000010; }
.tabbar a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 8px 4px; min-height: 56px; text-decoration: none; color: var(--muted); font-size: 12px; border-radius: 12px; }
.tabbar a span { font-size: 22px; line-height: 1; }
.tabbar a.on { color: var(--green); background: var(--soft); font-weight: 600; }

/* karty i przyciski */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: grid; gap: 10px; margin-bottom: 14px; }
.card.hero { padding: 20px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.big-time { font-size: 38px; font-weight: 650; letter-spacing: -.03em; line-height: 1.1; }
.btn { min-height: var(--tap); padding: 0 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--white); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.stack { display: grid; gap: 12px; }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* formularze */
label.f { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input, select, textarea { width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--white); font-size: 17px; }
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid #598469; outline-offset: 2px; }
input[type=checkbox] { width: 24px; min-height: 24px; height: 24px; }
.check { display: flex; gap: 12px; align-items: center; min-height: 44px; }

/* znaczniki */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--soft); color: var(--ink); }
.badge.arena { background: var(--arena); color: #fff; }
.badge.loc { color: #fff; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.ok { background: var(--soft); color: var(--ok); }
.banner { padding: 14px 16px; border-radius: 14px; background: var(--soft); display: grid; gap: 4px; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.danger { background: var(--danger-bg); color: var(--danger); }
.change { border: 2px solid var(--warn); background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: 16px; display: grid; gap: 6px; margin-bottom: 14px; }
.change h2 { font-size: 15px; letter-spacing: .05em; }
.change .was { text-decoration: line-through; opacity: .8; }
.change .now { font-size: 24px; font-weight: 700; }

/* grafik: lista dni (telefon) */
.daylist { display: grid; gap: 14px; }
.day { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.day.today { border-color: var(--green); box-shadow: 0 0 0 2px var(--green) inset; }
.day-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--soft); font-weight: 600; }
.shift { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 16px; min-height: 60px; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.shift .who { font-weight: 600; }
.shift .hours { font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; white-space: nowrap; }
.shift .meta { color: var(--muted); font-size: 14px; }
.add-line { padding: 10px 16px; border-top: 1px dashed var(--line); }
.loc-dot { display: inline-block; width: 10px; height: 10px; border-radius: 5px; margin-right: 6px; }
.table-only { display: none; }
@media (min-width: 900px) { .list-only { display: none; } .table-only { display: block; } }
.gridtable { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gridtable th, .gridtable td { border: 1px solid var(--line); padding: 8px; vertical-align: top; font-size: 14px; text-align: left; font-weight: 500; }
.gridtable thead th { background: var(--soft); }
.gridtable td.today, .gridtable th.today { background: var(--soft); }
.chip { display: block; width: 100%; text-align: left; background: var(--lime); color: var(--ink); border: 0; border-radius: 10px; padding: 6px 8px; margin-bottom: 4px; font-size: 13px; }
.chip.arena { background: #f1d3c3; }
.chip.off { background: var(--soft); color: var(--muted); }
.chip.plus { background: none; border: 1px dashed var(--line); color: var(--muted); text-align: center; }

/* historia / raporty */
.tbl { width: 100%; border-collapse: collapse; }
.tbl td, .tbl th { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: left; font-size: 15px; vertical-align: top; }
.tbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pos { color: var(--warn); font-weight: 600; } .neg { color: var(--danger); font-weight: 600; } .zero { color: var(--ok); }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.summary div { background: var(--soft); border-radius: 14px; padding: 12px; }
.summary b { display: block; font-size: 22px; letter-spacing: -.02em; }
.progress { position: relative; height: 10px; border-radius: 5px; background: var(--soft); overflow: hidden; }
.progress span { position: absolute; inset: 0 auto 0 0; background: var(--green); }

/* arkusz / okno */
dialog { border: 0; padding: 0; width: min(560px, 100vw); max-height: 92vh; border-radius: 20px 20px 0 0; background: var(--paper); color: var(--ink); box-shadow: 0 -10px 60px #00000040; margin: auto auto 0; }
@media (min-width: 700px) { dialog { border-radius: 20px; margin: auto; } }
dialog::backdrop { background: #0008; }
.sheet { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 14px; overflow: auto; max-height: 92vh; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.seg { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.seg .times { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.confirm { border: 2px solid var(--green); border-radius: var(--radius); padding: 16px; background: var(--white); display: grid; gap: 12px; }
.confirm .seg-line { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.confirm .seg-line:last-of-type { border-bottom: 0; }
.confirm .total { font-size: 22px; font-weight: 700; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); max-width: min(92vw, 520px); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 14px; z-index: 50; box-shadow: var(--shadow); }
.mic { width: var(--tap); padding: 0; font-size: 22px; flex: none; }
.mic.rec { background: var(--danger); color: #fff; border-color: var(--danger); }
.login { max-width: 420px; margin: 0 auto; padding: 14vh 20px 40px; display: grid; gap: 16px; }
.login h1 { font-size: 30px; }

/* druk (karty pracy, raport) */
.print-only { display: none; }
@media print {
  body { background: #fff; color: #000; }
  .topbar, .tabbar, .no-print, .toast { display: none !important; }
  .shell { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-only { display: block; }
  .tbl td, .tbl th { font-size: 12px; }
  dialog { display: none; }
}
