: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: 44px; 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; }

/* przełącznik widoków i miesiąc */
.segmented { display: inline-flex; background: var(--soft); border-radius: 14px; padding: 4px; gap: 4px; width: fit-content; }
.seg-btn { min-height: 44px; padding: 0 18px; border: 0; border-radius: 10px; background: transparent; font-weight: 600; color: var(--muted); }
.seg-btn.on { background: var(--green); color: var(--green-ink); }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 14px 0; }
.mhead { text-align: center; font-size: 12px; color: var(--muted); text-transform: uppercase; padding: 4px 0; }
.mcell { min-height: 74px; display: grid; align-content: start; gap: 2px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); text-align: left; overflow: hidden; }
.mcell.other { opacity: .4; }
.mcell.today { border: 2px solid var(--green); }
.mnum { font-weight: 700; font-size: 14px; }
.mtag { display: inline-block; font-size: 11px; font-weight: 600; background: var(--lime); border-radius: 6px; padding: 1px 5px; width: fit-content; }
.mtag.arena { background: #f1d3c3; } .mtag.off { background: var(--soft); color: var(--muted); }
.mhours { font-size: 11px; color: var(--muted); }
.mchips { display: none; }
@media (min-width: 900px) { .mcell { min-height: 112px; padding: 8px; } .mchips { display: grid; gap: 2px; } .mchip { font-size: 12px; background: var(--soft); border-radius: 6px; padding: 1px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .mchip.off { color: var(--muted); } }

/* arkusz miesiąca jak w Excelu: dni w wierszach, osoby w kolumnach */
/* jeden kontener przewijany w dół i w bok; nagłówek i kolumna dni są przyklejone w jego obrębie */
.sheet-wrap { margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--white); overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; max-height: calc(100vh - var(--topbar-h, 66px) - 84px); max-height: calc(100dvh - var(--topbar-h, 66px) - 84px); position: relative; }
.sheet-table { border-collapse: collapse; width: max-content; min-width: 100%; font-variant-numeric: tabular-nums; }
.sheet-table th, .sheet-table td { border: 1px solid var(--line); padding: 5px 6px; text-align: center; font-size: 13px; font-weight: 500; white-space: nowrap; }
.sheet-table.narrow th, .sheet-table.narrow td { padding: 10px 8px; font-size: 15px; min-width: 92px; }
.sheet-table.wide td, .sheet-table.wide th.sh-sub { min-width: 64px; }
.sheet-table.wide td.sh-h { min-width: 56px; }
.sheet-table .sh-day { text-align: left; background: var(--soft); position: sticky; left: 0; z-index: 1; min-width: 64px; }
/* nagłówek z imionami przyklejony pod górnym paskiem podczas przewijania w dół */
.sheet-table thead th { position: sticky; top: 0; z-index: 3; height: 31px; box-shadow: 0 1px 0 var(--line); }
.sheet-table thead th.sh-sub { top: 31px; z-index: 3; }
.sheet-table thead th.sh-day { z-index: 5; }
.sheet-table tfoot th, .sheet-table tfoot td { position: sticky; bottom: 0; z-index: 2; }
.sheet-table tfoot th:first-child { left: 0; z-index: 4; }
.sheet-table .sh-day a { display: inline-block; min-width: 26px; padding: 6px 4px; font-size: 15px; font-weight: 700; color: inherit; text-decoration: none; }
.sheet-table .sh-wd { color: var(--muted); font-size: 11px; }
.sheet-table .sh-name { font-weight: 700; color: #202f2a; }
.sheet-table .sh-sub { background: var(--soft); font-size: 11px; color: var(--muted); }
.sheet-table .sh-h { color: var(--muted); }
.sheet-table .sh-total { background: var(--soft); font-weight: 700; }
.sheet-table tfoot th { background: var(--soft); text-align: left; }
.sheet-table tr.weekend td, .sheet-table tr.weekend th.sh-day { background: #bfe9bc; }
.sheet-table tr.today td, .sheet-table tr.today th.sh-day { outline: 2px solid var(--green); outline-offset: -2px; }
.sheet-table td.arena { background: #f1d3c3; }
.sheet-table td.off { color: var(--muted); font-style: italic; }
.sheet-table td.clickable { cursor: pointer; }
.sheet-table td.clickable:hover { filter: brightness(.96); }
.pc0 { background: #efd9a8; } .pc1 { background: #e8a9a9; } .pc2 { background: #f3d2c2; } .pc3 { background: #cfc8e6; } .pc4 { background: #a9c9ee; } .pc5 { background: #b9e0b5; }
@media (prefers-color-scheme: dark) { .sheet-table tr.weekend td, .sheet-table tr.weekend th.sh-day { background: #2e5a31; } .sheet-table td.arena { background: #5a3322; } .sheet-table .sh-name { color: #202f2a; } }

.more-opts summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--green); font-weight: 600; }

/* 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; }
}

/* komputer: arkusz grafiku na całą szerokość, strona przewija się zwykłym kółkiem myszy;
   nagłówek z imionami przykleja się pod górnym paskiem (bez wewnętrznego pola przewijania) */
@media (min-width: 900px) {
  .shell.full { max-width: none; padding-left: 28px; padding-right: 28px; }
  .sheet-wrap { overflow: visible; max-height: none; overscroll-behavior: auto; }
  .sheet-table thead th { top: var(--topbar-h, 66px); }
  .sheet-table thead th.sh-sub { top: calc(var(--topbar-h, 66px) + 31px); }
  .sheet-table tfoot th, .sheet-table tfoot td { position: static; }
  .sheet-table.wide td, .sheet-table.wide th.sh-sub { min-width: 56px; }
  .sheet-table.wide { width: 100%; }
}

/* ===== strona logowania (wizytówka) ===== */
.landing { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); background: linear-gradient(135deg, #16231f 0%, #243d33 55%, #2f5a45 100%); color: #fff; }
.land-hero { padding: clamp(28px, 6vw, 84px); display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.land-brand { letter-spacing: .28em; font-size: 13px; color: #d4e494; font-weight: 600; }
.land-hero h1 { font-size: clamp(32px, 5vw, 56px); line-height: 1.04; letter-spacing: -.03em; font-weight: 650; color: #fff; }
.land-sub { font-size: clamp(16px, 1.6vw, 19px); color: #c9d8cd; max-width: 520px; }
.land-feats { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 14px; max-width: 540px; }
.land-feats li { display: flex; gap: 14px; align-items: flex-start; }
.land-feats b { display: block; font-size: 16px; } .land-feats span { color: #aebfb3; font-size: 14px; }
.land-ic { flex: none; width: 44px; height: 44px; border-radius: 14px; background: #ffffff14; border: 1px solid #ffffff22; display: grid; place-items: center; color: #d4e494; }
.land-card { display: grid; place-items: center; padding: 28px; }
.land-form { width: min(420px, 100%); background: var(--paper); color: var(--ink); border-radius: 24px; padding: 30px 26px; display: grid; gap: 14px; box-shadow: 0 30px 80px #00000055; }
.land-form h2 { font-size: 26px; } .land-foot { color: #8fa597; font-size: 12px; margin-top: 18px; text-align: center; }
.land-card { grid-template-rows: auto auto; align-content: center; }
@media (max-width: 860px) { .landing { grid-template-columns: 1fr; } .land-hero { padding: 36px 22px 8px; } .land-feats { display: none; } .land-card { padding: 18px 16px 40px; } }

/* ===== ekran Start ===== */
.dash-hero { position: relative; overflow: hidden; background: linear-gradient(135deg, #1d3128 0%, #2f5a45 100%); color: #fff; border-radius: 22px; padding: 26px 24px; margin: 6px 0 16px; display: flex; justify-content: space-between; align-items: center; }
.dash-hello h1 { color: #fff; font-size: clamp(24px, 3.4vw, 34px); margin: 4px 0 6px; }
.dash-hello p { color: #c9d8cd; }
.eyebrow.on-dark { color: #d4e494; }
.dash-sun { color: #d4e49455; flex: none; margin-left: 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { position: relative; background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 16px 16px 14px; box-shadow: var(--shadow); }
.kpi-ic { position: absolute; top: 14px; right: 14px; color: var(--green); background: var(--soft); width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; }
.kpi-l { font-size: 13px; color: var(--muted); } .kpi-v { font-size: 34px; font-weight: 650; letter-spacing: -.03em; line-height: 1.1; margin: 4px 0 2px; }
.kpi-s { font-size: 13px; color: var(--muted); }
.kpi.warn .kpi-ic { background: var(--warn-bg); color: var(--warn); } .kpi.warn .kpi-v { color: var(--warn); }
.dash-cols { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.who-list { display: grid; gap: 4px; margin-top: 8px; }
.who-row { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); } .who-row:last-child { border-bottom: 0; }
.who-row > div { flex: 1; min-width: 0; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--lime); color: #202f2a; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 8px; }
.ws-day { display: grid; justify-items: center; gap: 4px; padding: 8px 2px; border-radius: 14px; background: var(--soft); text-decoration: none; color: inherit; }
.ws-day.today { outline: 2px solid var(--green); background: var(--white); }
.ws-wd { font-size: 12px; color: var(--muted); text-transform: uppercase; } .ws-n { font-size: 12px; color: var(--muted); }
.ws-bar { width: 22px; height: 54px; background: var(--white); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.ws-bar span { display: block; width: 100%; background: var(--green); border-radius: 8px 8px 0 0; min-height: 2px; }
.attention { border-color: var(--warn); background: var(--warn-bg); }
.section-title { margin: 8px 0 -2px; font-size: 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.tile { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; background: var(--white); border: 1px solid var(--line); text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.tile:hover { transform: translateY(-2px); border-color: var(--green); }
.tile > div { flex: 1; min-width: 0; } .tile b { display: block; } .tile span:not(.tile-ic):not(.tile-go) { font-size: 13px; color: var(--muted); }
.tile-ic { flex: none; width: 46px; height: 46px; border-radius: 14px; background: var(--soft); color: var(--green); display: grid; place-items: center; } .tile-go { color: var(--muted); }
.hero-card { background: linear-gradient(135deg, var(--white), var(--soft)); }

/* --- poprawki po audycie --- */
.period-label { display: inline-block; min-width: 150px; text-align: center; white-space: nowrap; }
input[type=checkbox], input[type=radio] { accent-color: var(--green, #2f6f4f); width: 18px; height: 18px; }
input[type=file] { font: inherit; padding: 10px; border: 1px dashed var(--line); border-radius: 12px; background: var(--white); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; margin-right: 12px; padding: 8px 14px; border: 0; border-radius: 10px; background: var(--green); color: var(--green-ink); cursor: pointer; }
.bell { display: grid; place-items: center; color: var(--ink, #1d2b24); }
.zero { color: var(--muted, #6b7a72); }
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .period-label { min-width: 0; flex: 1; }
}

.shift.arena { background: #f1d3c3; border-color: #e3b9a2; }
@media (prefers-color-scheme: dark) { .shift.arena { background: #5a3322; border-color: #7a4730; } }

a.brand { color: inherit; text-decoration: none; cursor: pointer; }

.top-right { display: flex; align-items: center; gap: 10px; }
