/* Mama Ania — jasny beż w dzień, ciepły ciemny w nocy. Font systemowy iPhone'a (SF). */
:root {
  --bg: #F4EFE6; --card: #FFFDF8; --card2: #EDE5D8; --ink: #2B2620; --muted: #6F6457; --line: #E1D6C5;
  --acc: #2F6E62; --acc-soft: #DCEAE4; --acc-ink: #FFFDF8;
  --ok: #3C7D45; --warn: #A95B12; --bad: #B23A2E;
  --okbg: #E3F0E2; --warnbg: #F8E6D2; --badbg: #F6DEDA;
  --bottle: #B0641A;
  --shadow: 0 8px 24px rgba(43, 38, 32, .14);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120E; --card: #211C16; --card2: #2B241C; --ink: #EDE3D3; --muted: #A89A87; --line: #3A2F24;
    --acc: #7FC4B2; --acc-soft: #1F332D; --acc-ink: #15120E;
    --ok: #86C98E; --warn: #E3A566; --bad: #EC8176;
    --okbg: #1F2E20; --warnbg: #3A2A18; --badbg: #3A1E1A; --bottle: #E3A566;
    --shadow: 0 8px 24px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15120E; --card: #211C16; --card2: #2B241C; --ink: #EDE3D3; --muted: #A89A87; --line: #3A2F24;
  --acc: #7FC4B2; --acc-soft: #1F332D; --acc-ink: #15120E;
  --ok: #86C98E; --warn: #E3A566; --bad: #EC8176;
  --okbg: #1F2E20; --warnbg: #3A2A18; --badbg: #3A1E1A; --bottle: #E3A566;
  --shadow: 0 8px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); font-weight: 700; }

#app { display: flex; flex-direction: column; height: 100%; }
.hd {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 8px;
}
.hd h1 { font-size: 22px; margin: 0; font-weight: 800; letter-spacing: -.01em; }
.hd .meta { font-size: 13px; color: var(--muted); }
.hd .icons { display: flex; gap: 6px; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-size: 20px; display: grid; place-items: center; }

main > * { flex-shrink: 0; }
main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.dock { padding: 8px 16px 10px; display: grid; gap: 8px; border-top: 1px solid var(--line); background: var(--bg); }

.tabs {
  display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: var(--bg);
  padding: 6px 4px calc(env(safe-area-inset-bottom, 0px) + 6px);
}
.tabs button { background: none; border: 0; display: grid; justify-items: center; gap: 2px; padding: 6px 0; min-height: 50px; color: var(--muted); font-size: 12px; }
.tabs button .ti { font-size: 20px; line-height: 1; }
.tabs button.on { color: var(--acc); font-weight: 700; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; display: grid; gap: 6px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row.end { align-items: flex-end; }
.sub { font-size: 14px; color: var(--muted); }
.lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.mono, .big, .num { font-variant-numeric: tabular-nums; }
.big { font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.big.xl { font-size: 58px; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); } .acc { color: var(--acc); }
.muted { color: var(--muted); }
h2 { font-size: 18px; margin: 6px 0 0; }

.bar { height: 10px; border-radius: 99px; background: var(--card2); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; background: var(--acc); }
.bar i.b2 { background: var(--bottle); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 15px; padding: 9px 13px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); min-height: 40px; }
.chip.ok { border-color: var(--ok); color: var(--ok); }
.chip.warn { border-color: var(--warn); color: var(--warn); }

.btn { border-radius: 18px; padding: 16px 10px; text-align: center; font-weight: 800; font-size: 18px; background: var(--card); border: 2px solid var(--line); min-height: 56px; }
.btn.hl { border-color: var(--acc); background: var(--acc-soft); color: var(--acc); }
.btn.solid { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.small { padding: 10px 14px; font-size: 15px; min-height: 44px; border-radius: 14px; }
.btn small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.btn.solid small { color: var(--acc-ink); opacity: .85; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.grid3 .btn { font-size: 16px; padding: 12px 6px; }
.full { grid-column: 1 / -1; }
.btn.big-end { padding: 24px 10px; font-size: 21px; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { font-size: 15px; padding: 9px 13px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); min-height: 40px; }
.seg button.on { border-color: var(--acc); background: var(--acc-soft); color: var(--acc); font-weight: 700; }

.list { display: grid; }
.list .item { display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: center; padding: 11px 2px; border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; }
.list .item:last-child { border-bottom: 0; }
.list .t { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; }
.list .who { font-size: 12px; color: var(--muted); text-align: right; }
.dayhd { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding-top: 10px; }

.chk { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 16px; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.chk:last-child { border-bottom: 0; }
.box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--muted); flex: none; display: grid; place-items: center; font-size: 15px; font-weight: 800; }
.box.on { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.box.skip { border-style: dashed; }
.box.late { border-color: var(--warn); }
.chk .t { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); white-space: nowrap; }
.chk .acts { margin-left: auto; display: flex; gap: 6px; }

.faces { display: flex; justify-content: space-between; gap: 6px; }
.faces button { flex: 1; height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card2); font-size: 26px; }
.faces button.on { border-color: var(--acc); outline: 2px solid var(--acc); }
.trend { display: flex; gap: 6px; align-items: flex-end; height: 40px; }
.trend span { flex: 1; border-radius: 5px; background: var(--acc); opacity: .75; min-height: 4px; }
.trend span.none { background: var(--card2); opacity: 1; }

.pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--okbg); color: var(--ok); }
.pill.warn { background: var(--warnbg); color: var(--warn); }
.pill.acc { background: var(--acc-soft); color: var(--acc); }
.pill.muted { background: var(--card2); color: var(--muted); }
.who-b { font-weight: 800; letter-spacing: .02em; }

/* Toast z „Cofnij” */
#toast { position: fixed; left: 12px; right: 12px; top: calc(env(safe-area-inset-top, 0px) + 8px); z-index: 40; pointer-events: none; }
#toast .tst { pointer-events: auto; background: var(--ink); color: var(--bg); border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); font-size: 15px; }
#toast .tst .msg { flex: 1; }
#toast .tst button { background: none; border: 0; color: var(--bg); font-weight: 800; text-decoration: underline; padding: 8px 4px; min-height: 40px; }
#toast .tst button.pillb { text-decoration: none; background: var(--acc); color: var(--acc-ink); border-radius: 12px; padding: 8px 12px; }

/* Arkusz (sheet) */
#sheet .dim { position: fixed; inset: 0; background: rgba(20, 16, 10, .45); z-index: 30; }
#sheet .sh {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; background: var(--card); border-radius: 24px 24px 0 0;
  max-height: 92vh; overflow-y: auto; padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 18px);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; box-shadow: var(--shadow);
}
#sheet .sh > * { min-width: 0; }
#sheet .sh.fullh { top: env(safe-area-inset-top, 0px); max-height: none; border-radius: 20px 20px 0 0; }
#sheet .sh h3 { margin: 0; font-size: 20px; }
.field { display: grid; gap: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); font-size: 17px; min-height: 48px;
}
.field textarea { min-height: 90px; resize: vertical; }
.big-input { font-size: 44px !important; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > * { flex: 1; }
.tog { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; font-size: 16px; }
.tog:last-child { border-bottom: 0; }
.sw { width: 50px; height: 30px; border-radius: 99px; background: var(--card2); position: relative; flex: none; border: 1px solid var(--line); }
.sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .15s; }
.sw.on { background: var(--acc); border-color: var(--acc); }
.sw.on::after { left: 23px; }
.note { font-size: 14px; color: var(--muted); background: var(--card2); border-radius: 12px; padding: 10px 12px; }
.warnbox { font-size: 15px; background: var(--warnbg); color: var(--ink); border-radius: 12px; padding: 12px 14px; }
.warnbox b { color: var(--warn); }
.center { text-align: center; }
table.rep { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.rep th, table.rep td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: right; }
table.rep th:first-child, table.rep td:first-child { text-align: left; }
table.rep th { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.pair { padding: calc(env(safe-area-inset-top, 0px) + 40px) 20px 30px; display: grid; gap: 16px; max-width: 480px; margin: 0 auto; }
.pair h1 { font-size: 32px; margin: 0; }
.offline { font-size: 12px; color: var(--warn); }
@media (prefers-reduced-motion: reduce) { .sw::after { transition: none; } }
