:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --ink: #1f2a24;
  --muted: #5d6a62;
  --line: #d9d3c4;
  --accent: #2f7d5b;
  --accent-ink: #ffffff;
  --danger: #b3382c;
  --s1: #f2d98a;
  --s2: #ee9f4a;
  --s3: #d4503f;
  --s3-ink: #ffffff;
  --l1: #8cc59f;
  --l2: #e5c24a;
  --l3: #ee9f4a;
  --l4: #d4503f;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(31 42 36 / 8%), 0 6px 18px rgb(31 42 36 / 7%);
  --serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14201a;
    --surface: #1c2b23;
    --ink: #ece8dc;
    --muted: #a4b2a9;
    --line: #34473c;
    --accent: #5bb88d;
    --accent-ink: #0f1a14;
    --danger: #ef7d70;
    --s1: #8a7a35;
    --s2: #b56d27;
    --s3: #c8493a;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 18px rgb(0 0 0 / 25%);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1rem; margin-bottom: .4rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small-text { font-size: .8rem; }
.error { color: var(--danger); margin: .5rem 0; min-height: 1.2em; }
.notice { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-radius: 10px; padding: .75rem 1rem; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* przyciski i formularze */
.btn {
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: .6rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  transition: transform .12s ease, background-color .12s ease;
}
.btn:hover { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn.big { width: 100%; font-size: 1.1rem; min-height: 52px; box-shadow: var(--shadow); }
.btn.small { padding: .3rem .8rem; min-height: 36px; font-size: .9rem; }
.btn.icon { width: 44px; padding: 0; font-size: 1.4rem; }
.btn.danger { color: var(--danger); }

.row { display: flex; gap: .5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }

form { display: grid; gap: 1rem; }
.field { display: grid; gap: .25rem; font-weight: 600; flex: 1 1 10rem; }
.field small { font-weight: 400; }
input:not([type]), input[type='text'], input[type='email'], input[type='password'], input[type='search'],
input[type='date'], input[type='time'], textarea {
  font: inherit;
  width: 100%;
  padding: .65rem .8rem;
  min-height: 44px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}
input:not([type]), input[type='text'] { font-weight: 400; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
.check input { margin-top: .3rem; width: 1.2rem; height: 1.2rem; flex: none; accent-color: var(--accent); }
fieldset { border: 1.5px solid var(--line); border-radius: var(--radius); padding: .8rem; margin: 0; min-width: 0; }
legend { font-weight: 700; padding: 0 .4rem; }
details.privacy { font-size: .9rem; color: var(--muted); }
details.privacy summary { cursor: pointer; }

/* logowanie */
.auth { max-width: 26rem; margin: 0 auto; padding: 2rem 1rem 3rem; display: grid; gap: 1rem; }
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1.5px solid var(--line); }
.tab { background: none; border: 0; padding: .6rem .8rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1.5px; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* kalendarz */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .75rem 1rem; max-width: 46rem; margin: 0 auto; }
.topbar h1 { font-size: 1.25rem; }
.calendar-page { max-width: 46rem; margin: 0 auto; padding: 0 1rem 7rem; display: grid; gap: 1.5rem; }
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.month-nav h2 { text-transform: capitalize; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cell { aspect-ratio: 1; display: grid; place-items: center; border-radius: 12px; font: inherit; }
.cell.dow { aspect-ratio: auto; color: var(--muted); font-size: .8rem; font-weight: 700; }
.cell.empty { visibility: hidden; }
.day { border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 600; padding: 0; transition: transform .12s ease; }
.day:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.day.s1 { background: var(--s1); border-color: var(--s1); color: #2a2208; }
.day.s2 { background: var(--s2); border-color: var(--s2); color: #2a1706; }
.day.s3 { background: var(--s3); border-color: var(--s3); color: var(--s3-ink); }
.day.ok { background: var(--l1); border-color: var(--l1); color: #12301f; }
.day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.day.sel { outline: 3px solid var(--ink); outline-offset: 1px; }
.legend { font-size: .85rem; margin: .6rem 0 0; }
.dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; vertical-align: -1px; margin-right: .1rem; }
.dot.ok { background: var(--l1); } .dot.s1 { background: var(--s1); } .dot.s2 { background: var(--s2); } .dot.s3 { background: var(--s3); }

.day-panel { display: grid; gap: .75rem; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; display: grid; gap: .6rem; border-left: 5px solid var(--accent); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.chip { border-radius: 999px; padding: .15rem .7rem; font-size: .85rem; font-weight: 600; background: var(--s1); color: #2a2208; }
.chip.ok { background: var(--l1); color: #12301f; }
.chip.s2 { background: var(--s2); color: #2a1706; }
.chip.s3 { background: var(--s3); color: var(--s3-ink); }
.note { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.pollen { border-top: 1px dashed var(--line); padding-top: .7rem; }
.pollen p { margin: .3rem 0; }
.pollen-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.pollen-list li { display: grid; grid-template-columns: 5.5rem 1fr; gap: .1rem .6rem; align-items: center; }
.pollen-list .name { font-weight: 700; grid-row: span 2; }
.pollen-list .val { font-size: .85rem; color: var(--muted); }
.bar { display: block; height: .6rem; border-radius: 99px; background: var(--l1); }
.bar.l1 { width: 25%; background: var(--l1); } .bar.l2 { width: 50%; background: var(--l2); }
.bar.l3 { width: 75%; background: var(--l3); } .bar.l4 { width: 100%; background: var(--l4); }

.hint { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-radius: 10px; padding: .5rem .8rem; font-size: .9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.seasons { display: grid; gap: .6rem; }
.seasons p { margin: 0; }
.season-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.season { display: grid; gap: .25rem; padding: .6rem .8rem; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); }
.season.active { border-left: 5px solid var(--accent); }
.season-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.kind { font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 .5rem; }
.badge { font-size: .75rem; font-weight: 700; background: var(--s2); color: #2a1706; border-radius: 99px; padding: 0 .5rem; }
.strip { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; }
.strip .m { height: .55rem; border-radius: 3px; background: var(--line); }
.strip .m.on { background: var(--l1); }
.strip .m.peak { background: var(--s2); }
.strip .m.now { outline: 2px solid var(--ink); outline-offset: 1px; }
.seasons details { font-size: .9rem; }

.actionbar { position: fixed; inset: auto 0 0 0; padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 40%); }
.actionbar .btn { max-width: 46rem; display: flex; margin: 0 auto; }
.footer { font-size: .8rem; text-align: center; }

.toast { position: fixed; left: 50%; bottom: 6rem; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: .7rem 1.1rem; border-radius: 999px; z-index: 10; max-width: 90vw; }

/* okno dialogowe */
.modal { border: 0; border-radius: var(--radius); background: var(--bg); color: var(--ink); padding: 1.2rem; width: min(34rem, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); box-shadow: 0 20px 60px rgb(0 0 0 / 35%); }
.modal::backdrop { background: rgb(10 20 15 / 55%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.modal > h3 { margin-top: 1rem; }
.place-current { margin: 0 0 .5rem; font-weight: 600; }
.results { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .25rem; }
.result { width: 100%; text-align: left; padding: .6rem .8rem; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; min-height: 44px; }
.result:hover { border-color: var(--accent); }
.symptoms { display: grid; gap: .2rem; }
.symptom-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.symptom-row:last-child { border-bottom: 0; }
.symptom-name { flex: 1; }
.segs { display: flex; gap: 4px; }
.seg { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; }
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg.s1 input:checked + span { background: var(--s1); border-color: var(--s1); color: #2a2208; }
.seg.s2 input:checked + span { background: var(--s2); border-color: var(--s2); color: #2a1706; }
.seg.s3 input:checked + span { background: var(--s3); border-color: var(--s3); color: var(--s3-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 1rem; }

@media (min-width: 600px) {
  .cell { aspect-ratio: 1.3; }
}

@media (max-width: 380px) {
  .pollen-list li { grid-template-columns: 1fr; }
  .pollen-list .name { grid-row: auto; }
  .seg span { width: 2.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
