/* Hapur: designed for every age. Big type, high contrast, every control labelled, 48px touch targets. */

/* ---- tokens ---- */
:root{
  --bg:#f4f5f7;--surface:#fff;--fg:#111418;--muted:#4a515c;--line:#d9dce1;--hover:#eef1f6;
  --accent:#1f45a3;--accent-soft:#e6edfb;--on-accent:#fff;--ok:#0b6b38;--ok-soft:#e3f4ea;--new:#c2410c;--gold:#c99a2e;
  --k-act:#1f45a3;--k-statistic:#6b3fb5;--k-notice:#b45309;--k-dataset:#0f766e;
  --r:14px;--shadow:0 1px 2px rgba(16,24,40,.06),0 1px 3px rgba(16,24,40,.08);
  color-scheme:light;
}
:root[data-theme=dark]{
  --bg:#0d1117;--surface:#161b22;--fg:#f0f3f6;--muted:#b1bac4;--line:#30363d;--hover:#1f2630;
  --accent:#8fb4ff;--accent-soft:#1b2a47;--on-accent:#0a1530;--ok:#56d38a;--ok-soft:#12301f;--new:#ff8a4c;
  --k-act:#8fb4ff;--k-statistic:#c4a3ff;--k-notice:#ffb366;--k-dataset:#5fd4c4;--shadow:none;color-scheme:dark;
}
@media (prefers-color-scheme:dark){:root:not([data-theme=light]){
  --bg:#0d1117;--surface:#161b22;--fg:#f0f3f6;--muted:#b1bac4;--line:#30363d;--hover:#1f2630;
  --accent:#8fb4ff;--accent-soft:#1b2a47;--on-accent:#0a1530;--ok:#56d38a;--ok-soft:#12301f;--new:#ff8a4c;
  --k-act:#8fb4ff;--k-statistic:#c4a3ff;--k-notice:#ffb366;--k-dataset:#5fd4c4;--shadow:none;color-scheme:dark;
}}
html{font-size:17px} html[data-size=large]{font-size:19.5px} html[data-size=xlarge]{font-size:22.5px}

/* ---- base ---- */
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;font:1rem/1.5 system-ui,-apple-system,"Segoe UI",Roboto,"Noto Sans",sans-serif;background:var(--bg);color:var(--fg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}
a{color:var(--accent);text-underline-offset:3px}
h1{font-size:1.6rem;line-height:1.2;margin:8px 0 6px;letter-spacing:-.01em}
h2{font-size:1.1rem;margin:22px 0 8px}
h3{font-size:1rem;margin:20px 0 6px}
.lead{font-size:1.02rem;color:var(--muted);margin:0 0 14px}
.hint{color:var(--muted);font-size:.9rem}
.mono{font-family:ui-monospace,Consolas,monospace;font-size:.78rem;color:var(--muted);overflow-wrap:anywhere}
svg{width:1.25em;height:1.25em;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}
svg .fill{fill:currentColor;stroke:none}
:focus-visible{outline:3px solid var(--accent);outline-offset:2px;border-radius:6px}

button,.btn,select,input,textarea{font:inherit;color:inherit;background:var(--surface);border:1.5px solid var(--line);border-radius:12px;padding:10px 14px;min-height:48px}
button,.btn{cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;gap:8px;font-weight:600}
button:hover,.btn:hover{background:var(--hover)}
button:disabled{opacity:.6;cursor:progress}
select{appearance:none;padding-right:40px;background:var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center/18px}
.primary{background:var(--accent);color:var(--on-accent);border-color:var(--accent)}
.primary:hover{background:var(--accent);filter:brightness(1.1)}
.ghost{background:transparent;border-color:transparent;color:var(--accent)}
.ghost:hover{background:var(--accent-soft)}
.small{min-height:36px;padding:4px 10px;font-size:.9rem}
.big{min-height:56px;font-size:1.05rem}
.wide{width:100%}

/* ---- header + navigation ---- */
.top{position:sticky;top:0;z-index:10;background:var(--surface);border-bottom:1px solid var(--line);padding-top:env(safe-area-inset-top)}
.top-in{max-width:960px;margin:0 auto;display:flex;align-items:center;gap:12px;padding:8px 16px}
.brand{display:flex;gap:10px;align-items:center;text-decoration:none;color:var(--fg);margin-right:auto;min-width:0}
.brand b{display:block;font-size:1.25rem;line-height:1.1}
.fresh{display:flex;align-items:center;gap:6px;color:var(--muted);font-size:.78rem;white-space:nowrap}
.fresh:empty{display:none}
.fresh::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--ok)}
.fresh.stale::before{background:var(--gold)} .fresh.off::before{background:var(--new)}

.tabs{display:flex;gap:2px}
.tabs button{border:0;background:transparent;color:var(--muted);border-radius:12px;padding:8px 12px;font-weight:600;position:relative}
.tabs button:hover{background:var(--hover);color:var(--fg)}
.tabs button[aria-selected=true]{color:var(--accent);background:var(--accent-soft)}
.count{display:inline-block;min-width:22px;text-align:center;background:var(--new);color:#fff;border-radius:999px;padding:0 6px;font-size:.75rem;line-height:22px}

/* phones and tablets: a big labelled bar at the bottom, always within thumb reach */
@media (max-width:820px){
  .tabs{position:fixed;left:0;right:0;bottom:0;z-index:10;background:var(--surface);border-top:1px solid var(--line);padding:6px 4px calc(6px + env(safe-area-inset-bottom));box-shadow:0 -2px 10px rgba(0,0,0,.05)}
  .tabs button{flex:1;flex-direction:column;gap:2px;font-size:.72rem;line-height:1.15;padding:6px 2px;min-height:60px;text-align:center;min-width:0}
  .tabs button[aria-selected=true]{background:transparent}
  .tabs button[aria-selected=true]::before{content:"";position:absolute;top:-6px;left:22%;right:22%;height:3px;border-radius:0 0 3px 3px;background:var(--accent)}
  .tabs svg{width:26px;height:26px}
  .tabs .count{position:absolute;top:2px;left:calc(50% + 8px);font-size:.68rem;min-width:20px;line-height:20px}
  body{padding-bottom:calc(84px + env(safe-area-inset-bottom))}
}

main{max-width:960px;margin:0 auto;padding:16px}
@media (min-width:821px){main{padding:24px 16px}}

/* ---- finder (search + municipality) ---- */
.finder{display:grid;gap:10px;grid-template-columns:1fr}
@media (min-width:640px){.finder{grid-template-columns:1fr 260px;align-items:end}}
.search{display:flex;align-items:center;gap:10px;background:var(--surface);border:1.5px solid var(--line);border-radius:14px;padding:0 14px;min-height:56px;box-shadow:var(--shadow)}
.search:focus-within{outline:3px solid var(--accent);outline-offset:1px}
.search svg{color:var(--muted);width:24px;height:24px}
.search input{border:0;background:none;padding:0;flex:1;min-width:0;outline:none;font-size:1.05rem;min-height:52px}
.field{display:grid;gap:4px;font-size:.85rem;font-weight:600;color:var(--muted)}
.field select{min-height:56px;color:var(--fg);font-size:1rem;font-weight:500;box-shadow:var(--shadow)}
.find{width:100%;margin-bottom:8px}

.chips{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0}
.chips button{border-radius:999px;min-height:44px;padding:6px 16px;font-weight:600;font-size:.95rem}
.chips button .dot{width:10px;height:10px;border-radius:50%;background:var(--kc,var(--muted))}
.chips button[aria-pressed=true]{background:var(--accent);color:var(--on-accent);border-color:var(--accent)}
.chips button[aria-pressed=true] .dot{display:none}
.chips button[aria-pressed=true]::before{content:"✓"}
.chips.places{max-height:280px;overflow:auto;padding:2px}

.status{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:40px;color:var(--muted);font-weight:600;font-size:.95rem}

/* ---- feed ---- */
.feed{display:flex;flex-direction:column;gap:10px;margin-bottom:14px}
.group{font-size:.85rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin:16px 4px 2px}
.group:first-child{margin-top:4px}
.k-act{--kc:var(--k-act)} .k-statistic{--kc:var(--k-statistic)} .k-notice{--kc:var(--k-notice)} .k-dataset{--kc:var(--k-dataset)}

.item{display:flex;align-items:stretch;background:var(--surface);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--shadow);overflow:hidden}
.item:hover{border-color:var(--kc)}
.item-main{flex:1;display:block;text-align:left;border:0;border-radius:0;background:none;padding:14px 16px;font-weight:400;min-width:0}
.item-main:hover{background:var(--hover)}
.tag{display:inline-flex;align-items:center;gap:6px;font-size:.8rem;font-weight:700;color:var(--kc)}
.tag::before{content:"";width:10px;height:10px;border-radius:3px;background:var(--kc)}
.new{display:inline-block;margin-left:8px;background:var(--new);color:#fff;border-radius:6px;padding:0 7px;font-size:.72rem;font-weight:800;vertical-align:1px}
.item .title{display:block;font-size:1.08rem;font-weight:650;line-height:1.35;margin:4px 0 6px;overflow-wrap:anywhere;color:var(--fg)}
.item .sub{display:flex;flex-wrap:wrap;gap:4px 14px;color:var(--muted);font-size:.88rem}
.item .sub .ok{color:var(--ok);font-weight:700}
.star{border:0;border-left:1px solid var(--line);border-radius:0;background:none;width:64px;flex-direction:column;gap:2px;font-size:.7rem;color:var(--muted);font-weight:600;padding:6px 2px}
.star svg{width:26px;height:26px}
.star[aria-pressed=true]{color:var(--gold)}
.star[aria-pressed=true] svg{fill:var(--gold);stroke:var(--gold)}

.empty{text-align:center;color:var(--muted);background:var(--surface);border:1.5px dashed var(--line);border-radius:var(--r);padding:32px 20px;font-size:1rem}
.sk{height:104px;border-radius:var(--r);background:linear-gradient(90deg,var(--surface) 0,var(--hover) 50%,var(--surface) 100%) 0 0/200% 100%;animation:sk 1.2s linear infinite;border:1px solid var(--line)}
@keyframes sk{to{background-position:-200% 0}}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

.trust{display:flex;gap:10px;align-items:flex-start;background:var(--ok-soft);color:var(--fg);border-radius:var(--r);padding:12px 14px;font-size:.92rem;margin:20px 0 8px}
.trust svg{color:var(--ok);width:24px;height:24px}
.trust button{min-height:0;padding:0;border:0;background:none;color:var(--accent);text-decoration:underline;font-weight:600}

/* ---- ask ---- */
.askbox{display:grid;gap:10px}
.askbox textarea{width:100%;font-size:1.05rem;resize:vertical;min-height:110px}
#answer{margin-top:18px}
#answer .ans{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:16px;white-space:pre-wrap}
#answer ol{padding-left:24px} #answer li{margin:10px 0}
#answer .meta{color:var(--muted);font-size:.88rem}

/* ---- settings ---- */
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--shadow);margin:14px 0;overflow:hidden}
.setting{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 16px;padding:14px 16px;border-bottom:1px solid var(--line);font-weight:650}
.setting:last-child{border-bottom:0}
.setting select{min-width:200px}
.seg{display:flex;flex-wrap:wrap;gap:6px}
.seg button{min-height:52px;font-size:.92rem;padding:6px 14px}
.seg button[aria-pressed=true]{background:var(--accent);color:var(--on-accent);border-color:var(--accent)}
.aa{font-weight:800;font-family:Georgia,serif} .s1{font-size:.9rem} .s2{font-size:1.1rem} .s3{font-size:1.35rem}
.row-btn{display:flex;width:100%;justify-content:space-between;border:0;border-bottom:1px solid var(--line);border-radius:0;background:none;padding:14px 16px;min-height:56px;color:var(--fg);font-weight:600;text-decoration:none}
.row-btn:last-child{border-bottom:0}
.row-btn i{font-style:normal;font-size:1.5rem;color:var(--muted);line-height:1}
@media (hover:none){.kbd-only{display:none}}

/* ---- sheets (dialogs): bottom sheet on phones, centred panel on desktop ---- */
dialog{border:0;border-radius:20px;background:var(--surface);color:var(--fg);padding:0;width:min(640px,calc(100% - 24px));max-height:90vh;box-shadow:0 24px 64px rgba(0,0,0,.3)}
dialog::backdrop{background:rgba(10,14,20,.55)}
dialog article{padding:0 20px 24px;max-height:90vh;overflow:auto}
@media (max-width:640px){
  dialog.sheet{width:100%;max-width:100%;margin:auto 0 0;border-radius:20px 20px 0 0;max-height:92vh}
  dialog.sheet article{padding-bottom:calc(24px + env(safe-area-inset-bottom))}
}
.dh{display:flex;align-items:center;justify-content:space-between;gap:10px;position:sticky;top:0;background:var(--surface);padding:14px 20px 12px;margin:0 -20px 14px;border-bottom:1px solid var(--line);z-index:2}
.dh h2{margin:0}
#d-title{font-size:1.35rem;line-height:1.3;margin:6px 0 10px}
.facts{margin:0 0 18px;border:1px solid var(--line);border-radius:var(--r);overflow:hidden}
.facts div{display:grid;grid-template-columns:minmax(110px,35%) 1fr;gap:12px;padding:10px 14px;border-bottom:1px solid var(--line)}
.facts div:last-child{border-bottom:0}
.facts dt{color:var(--muted);font-size:.9rem;font-weight:600}
.facts dd{margin:0;font-weight:600;overflow-wrap:anywhere}
.facts dd.ok{color:var(--ok)}
.actions3{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:10px 0 16px}
#d-save[aria-pressed=true]{color:var(--gold);border-color:var(--gold)}
#d-save[aria-pressed=true] svg{fill:var(--gold)}
.tech summary{cursor:pointer;color:var(--muted);font-weight:600;padding:8px 0}
/* about */
.rules{list-style:none;padding:0;margin:0 0 8px;display:grid;gap:10px}
.rules li{display:flex;gap:12px;align-items:flex-start;line-height:1.45}
.ico{display:grid;place-items:center;width:36px;height:36px;border-radius:10px;background:var(--accent-soft);color:var(--accent);flex:none}
.ico svg{width:20px;height:20px}
.auths{display:grid;gap:10px}
.auth{border:1px solid var(--line);border-radius:var(--r);padding:14px}
.auth-h{display:flex;gap:12px;align-items:center}
.auth-h b{display:block;line-height:1.3}
.auth-h .hint{margin-top:2px;font-size:.85rem}
.badge{display:grid;place-items:center;min-width:48px;height:48px;padding:0 6px;border-radius:12px;background:var(--accent);color:var(--on-accent);font-weight:800;font-size:.8rem;letter-spacing:.03em;flex:none}
.comp{margin:10px 0;color:var(--muted);font-size:.93rem}
.auth-f{display:flex;flex-wrap:wrap;gap:6px 12px;align-items:center}
.dom{background:var(--ok-soft);color:var(--ok);border-radius:999px;padding:2px 10px;font-weight:700;font-size:.85rem}
.ev{margin-top:8px}
.ev summary{cursor:pointer;color:var(--accent);font-weight:600;font-size:.9rem;padding:4px 0}
.ev ul{margin:4px 0 0;padding-left:20px} .ev li{margin:4px 0}
.note{display:flex;gap:12px;background:var(--accent-soft);border-radius:var(--r);padding:14px;margin:20px 0 8px}
.note svg{color:var(--accent);width:24px;height:24px;margin-top:2px}
.note p{margin:4px 0 0}

.toast{position:fixed;left:50%;bottom:calc(100px + env(safe-area-inset-bottom));transform:translateX(-50%);background:var(--fg);color:var(--bg);padding:12px 20px;border-radius:999px;font-weight:700;z-index:50;box-shadow:0 8px 24px rgba(0,0,0,.25)}
@media (min-width:821px){.toast{bottom:32px}}

/* system status (settings) */
.sys{padding:16px}
.sys-h{display:flex;gap:12px;align-items:flex-start}
.sys-h p{margin:2px 0 0;color:var(--muted);font-size:.92rem}
.pulse{width:12px;height:12px;border-radius:50%;background:var(--ok);margin-top:6px;flex:none;box-shadow:0 0 0 0 var(--ok);animation:pulse 2s infinite}
.pulse.stale{background:var(--gold);animation:none}
@keyframes pulse{70%{box-shadow:0 0 0 8px transparent}100%{box-shadow:0 0 0 0 transparent}}
#sys-rows{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin:14px 0 0}
#sys-rows div{background:var(--bg);border-radius:12px;padding:10px 12px}
#sys-rows dt{color:var(--muted);font-size:.82rem;font-weight:600}
#sys-rows dd{margin:2px 0 0;font-weight:700;font-size:1.05rem;font-variant-numeric:tabular-nums}
