/* DKDns — a family's private threat & ad blocker.
   Design language: a calm security console. Deep forest green is the brand and the "allowed/safe"
   signal; amber is reserved for one job only — things that were stopped — so colour carries meaning,
   not decoration. Two elevation levels (a lifted primary panel, flatter bordered lists) give hierarchy
   instead of a wall of identical cards. */
@font-face { font-family: "Bricolage"; src: url("/static/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/static/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/static/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --canvas: #e9edf0;
  --surface: #ffffff;
  --surface-2: #f3f6f8;
  --ink: #16211d;
  --ink-soft: #5c6b66;
  --ink-faint: #8a9892;
  --line: #e3e8ea;
  --line-strong: #d3dadd;
  --brand: #1f6b53;
  --brand-deep: #164c3b;
  --brand-tint: #e7f0ec;
  --stop: #c9881a;
  --stop-bright: #e0a22a;
  --stop-tint: #f7ecd2;
  --allowed: #b7cabf;
  --danger: #b4442f;
  --danger-tint: #f6e2dd;
  --on-brand: #f3faf6;
  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 20px;
  --shadow-sm: 0 1px 2px rgba(22, 33, 29, .05), 0 1px 1px rgba(22, 33, 29, .04);
  --shadow-md: 0 2px 4px rgba(22, 33, 29, .05), 0 8px 24px rgba(22, 33, 29, .07);
  --shadow-lg: 0 24px 60px rgba(22, 33, 29, .14);
  --display: "Bricolage", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson", "Segoe UI", system-ui, sans-serif;
  --step-0: 1rem;
  --step-1: 1.125rem;
  --step-2: 1.375rem;
  --step-3: 1.85rem;
  --step-4: 2.6rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0e1613;
    --surface: #16211c;
    --surface-2: #1d2b25;
    --ink: #e8efeb;
    --ink-soft: #9fb0a8;
    --ink-faint: #6f827a;
    --line: #273530;
    --line-strong: #324039;
    --brand: #5fb294;
    --brand-deep: #8fcab3;
    --brand-tint: #19302a;
    --stop: #e6b24a;
    --stop-bright: #f0bc4b;
    --stop-tint: #38300f;
    --allowed: #3f5349;
    --danger: #e68068;
    --danger-tint: #3a211c;
    --on-brand: #0c1512;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, .35), 0 10px 28px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font: 400 var(--step-0)/1.55 var(--body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--display); font-weight: 640; letter-spacing: -.015em; margin: 0; }
h1 { font-size: var(--step-3); line-height: 1.08; }
h2 { font-size: var(--step-2); line-height: 1.2; }
h3 { font-size: var(--step-1); line-height: 1.3; }
p { margin: 0; }
a { color: var(--brand); text-underline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--ink-soft); }
.small { font-size: .875rem; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 640; letter-spacing: -.02em; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.shell { min-height: 100dvh; }
.nav {
  position: fixed; inset: auto 0 0 0; z-index: 20; display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px) saturate(1.3);
  border-top: 1px solid var(--line); padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px;
  color: var(--ink-soft); text-decoration: none; font-size: .7rem; font-weight: 700; border-radius: var(--radius-s);
}
.nav a svg { width: 23px; height: 23px; stroke-width: 1.9; }
.nav a[aria-current="page"] { color: var(--brand); }
.brand, .nav-foot { display: none; }
main { padding: calc(18px + env(safe-area-inset-top)) 16px calc(98px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }

@media (min-width: 900px) {
  .nav {
    inset: 0 auto 0 0; width: 244px; flex-direction: column; justify-content: flex-start; gap: 3px;
    border-top: 0; border-right: 1px solid var(--line); padding: 22px 16px; background: var(--surface);
  }
  .nav a { flex: 0; flex-direction: row; gap: 13px; padding: 10px 13px; font-size: .98rem; border-radius: var(--radius-s); }
  .nav a:hover { background: var(--surface-2); color: var(--ink); }
  .nav a[aria-current="page"] { background: var(--brand-tint); color: var(--brand-deep); }
  .brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 22px; font-family: var(--display); font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; }
  .nav-foot { display: block; margin-top: auto; padding: 14px 6px 4px; border-top: 1px solid var(--line); }
  .nav-foot .who { display: flex; align-items: center; gap: 10px; }
  .nav-foot .who .avatar { width: 32px; height: 32px; font-size: .9rem; }
  .nav-foot .who .main { min-width: 0; }
  .nav-foot .who .title { display: block; font-weight: 700; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-foot .who .sub { display: block; font-size: .78rem; color: var(--ink-soft); }
  main { margin-left: 244px; padding: 36px 44px 60px; max-width: 1000px; }
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 2px 0 22px; }
.page-head h1 { font-size: var(--step-3); }
.page-head p { margin-top: 5px; color: var(--ink-soft); }

/* ---------- hero: the lifted primary panel ---------- */
.hero {
  position: relative; margin: 0 0 20px; padding: 22px 22px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow-md);
}
.hero h1 { font-size: clamp(1.7rem, 4.6vw, 2.5rem); font-weight: 680; line-height: 1.08; letter-spacing: -.03em; max-width: 20ch; margin-top: 12px; }
.hero h1 .count { color: var(--brand); }
.status-line { display: inline-flex; align-items: center; gap: 9px; padding: 6px 13px 6px 11px; border-radius: 99px; background: var(--brand-tint); color: var(--brand-deep); font-weight: 700; font-size: .92rem; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 55%, transparent); animation: pulse 2.6s ease-out 1; }
.status-line:has(.pulse.bad) { background: var(--stop-tint); color: color-mix(in srgb, var(--stop) 60%, var(--ink)); }
.pulse.bad { background: var(--stop-bright); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 50%, transparent); } 100% { box-shadow: 0 0 0 13px transparent; } }
.tide { display: grid; grid-template-columns: repeat(24, 1fr); align-items: end; gap: 3px; height: 128px; margin-top: 22px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.tide .col { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; border-radius: 4px 4px 0 0; overflow: hidden; background: var(--surface-2); }
.tide .allowed { background: var(--allowed); }
.tide .stopped { background: var(--stop-bright); }
.tide .col:last-child { box-shadow: inset 0 0 0 1.5px var(--brand); }
.tide .col:last-child .allowed { background: var(--brand); }
.tide-legend { display: flex; justify-content: space-between; margin-top: 10px; font-size: .78rem; color: var(--ink-soft); }
.tide-legend span i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
@media (prefers-reduced-motion: no-preference) {
  .tide .col { transform-origin: bottom; animation: rise .6s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 15ms); }
  @keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
}
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ---------- stat band ---------- */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 26px; }
.facts div { padding: 15px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow-sm); }
.facts .num { font-size: var(--step-3); display: block; line-height: 1.05; }
.facts .small { margin-top: 3px; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr 1fr; } .facts div:first-child { grid-column: 1 / -1; } }

/* ---------- groups & rows ---------- */
section.group { margin: 0 0 26px; }
section.group > header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 11px; padding: 0 2px; }
section.group > header h2 { font-size: 1.15rem; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; box-shadow: var(--shadow-sm); }
.row { display: flex; align-items: center; gap: 13px; padding: 13px 16px; min-height: 58px; width: 100%; text-align: left; background: none; border: 0; }
.row + .row { border-top: 1px solid var(--line); }
button.row, a.row { cursor: pointer; transition: background .12s; }
button.row:hover, a.row:hover { background: var(--surface-2); }
.row .main { flex: 1; min-width: 0; }
.row .title { display: block; font-weight: 700; overflow-wrap: anywhere; }
.row .sub { display: block; font-size: .85rem; color: var(--ink-soft); overflow-wrap: anywhere; margin-top: 1px; }
.row > .tag, .row > .btn { flex: none; }
.row .end { flex: none; text-align: right; font-size: .8rem; color: var(--ink-soft); line-height: 1.25; }
.row .end .num { color: var(--ink); font-size: 1.02rem; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: var(--on-brand); font-family: var(--display); font-weight: 700; }
.avatar.kid { background: var(--stop-bright); color: #3a2a06; }
.stop-mark { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--allowed); }
.stop-mark.on { background: var(--stop-bright); box-shadow: 0 0 0 3px var(--stop-tint); }
.tag { display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: .75rem; font-weight: 700; background: var(--brand-tint); color: var(--brand-deep); }
.tag.gold { background: var(--stop-tint); color: color-mix(in srgb, var(--stop) 55%, var(--ink)); }
.tag.red { background: var(--danger-tint); color: var(--danger); }
.empty { padding: 30px 18px; text-align: center; color: var(--ink-soft); }
.meter { height: 7px; border-radius: 99px; background: var(--line-strong); overflow: hidden; margin-top: 9px; }
.meter i { display: block; height: 100%; background: var(--stop-bright); border-radius: 99px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--radius-s); border: 0; background: var(--brand); color: var(--on-brand); font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, box-shadow .12s;
}
.btn:hover { background: var(--brand-deep); }
.btn.quiet { background: var(--surface); color: var(--brand-deep); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.btn.quiet:hover { background: var(--surface-2); }
.btn.danger { background: var(--surface); color: var(--danger); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--danger) 36%, transparent); }
.btn.danger:hover { background: var(--danger-tint); }
.btn.gold { background: var(--stop-bright); color: #3a2a06; }
.btn.gold:hover { background: var(--stop); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: .9rem; border-radius: 9px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
label.field { display: block; margin: 0 0 15px; }
label.field > span { display: block; font-size: .9rem; font-weight: 700; margin-bottom: 7px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[inputmode], select {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: var(--radius-s); border: 1.5px solid var(--line-strong);
  background: var(--surface); font-size: 1rem; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-tint); }
.code-input { font-family: var(--display); font-size: 1.8rem !important; letter-spacing: .3em; text-align: center; }
.seg { display: flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.seg button { flex: 1; min-height: 38px; border: 0; background: none; border-radius: 8px; color: var(--ink-soft); font-weight: 700; cursor: pointer; transition: background .12s, color .12s; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--brand-deep); box-shadow: var(--shadow-sm); }
.switch { position: relative; flex: none; width: 52px; height: 32px; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2.5px solid var(--brand); outline-offset: 2px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters .seg { flex: 1 1 260px; }
.filters select, .filters input { flex: 1 1 160px; }

/* ---------- sheet, dialog, toast ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(13, 22, 18, .5); backdrop-filter: blur(2px); }
.sheet {
  position: fixed; z-index: 41; inset: auto 0 0 0; max-height: 88dvh; overflow: auto; background: var(--surface);
  border-radius: var(--radius-l) var(--radius-l) 0 0; box-shadow: var(--shadow-lg);
  padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
}
.sheet .grab { width: 38px; height: 5px; border-radius: 99px; background: var(--line-strong); margin: 0 auto 16px; }
.sheet h2 { margin-bottom: 5px; word-break: break-word; }
@media (min-width: 700px) {
  .sheet { inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(560px, 92vw); border: 1px solid var(--line); border-radius: var(--radius-l); max-height: 86dvh; padding: 24px 26px; }
  .sheet .grab { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: up .28s cubic-bezier(.2, .8, .2, 1); }
  @keyframes up { from { transform: translateY(30px); opacity: 0; } }
  @media (min-width: 700px) { @keyframes up { from { transform: translate(-50%, -46%); opacity: 0; } } }
}
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(94px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--surface); padding: 13px 20px; border-radius: var(--radius-s); font-weight: 700; max-width: 90vw; box-shadow: var(--shadow-lg);
}
.toast.err { background: var(--danger); color: #fff; }
@media (min-width: 900px) { .toast { bottom: 28px; left: calc(50% + 122px); } }
.secret-box.key { word-break: normal; overflow-wrap: normal; letter-spacing: .04em; }
.secret-box { padding: 15px; border-radius: var(--radius-s); background: var(--stop-tint); font-family: var(--display); font-size: 1.05rem; word-break: break-all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 16px; font-family: var(--display); font-size: 1.05rem; padding: 15px; background: var(--surface-2); border-radius: var(--radius-s); }
.qr { width: 210px; height: 210px; margin: 10px auto 16px; background: #fff; padding: 8px; border-radius: var(--radius-s); box-shadow: var(--shadow-sm); }
.qr svg { width: 100%; height: 100%; display: block; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; max-height: 300px; overflow: auto; padding: 2px; }
.svc { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: var(--radius-s); border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: .9rem; text-align: left; }
.svc[aria-pressed="true"] { border-color: var(--stop-bright); background: var(--stop-tint); }
.svc img { width: 18px; height: 18px; }

/* ---------- sign-in ---------- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 80% at 50% -10%, var(--brand-tint), transparent 60%), var(--canvas); }
.gate-box { width: min(410px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow-md); padding: 32px 30px 30px; }
.gate-mark { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; font-family: var(--display); font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; }
.gate h1 { font-size: clamp(1.7rem, 7vw, 2.1rem); margin-bottom: 7px; letter-spacing: -.025em; }
.gate p.lead { color: var(--ink-soft); margin-bottom: 24px; }
.gate .btn.block { margin-top: 4px; }
.error { color: var(--danger); font-weight: 700; margin: 4px 0 12px; min-height: 1.4em; }
.logo { width: 34px; height: 34px; flex: none; }
.loading { padding: 64px 0; text-align: center; color: var(--ink-soft); }

/* ---------- easier navigation: tabs, sub-pages, menu ---------- */
.tabs {
  position: sticky; top: 0; z-index: 15; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -18px 18px; padding: 8px 18px; background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; padding: 8px 14px; border-radius: 99px; color: var(--ink-soft); text-decoration: none; font-weight: 700; font-size: .92rem;
}
.tabs a[aria-current="page"] { background: var(--brand); color: var(--on-brand); }
.tabs a:not([aria-current="page"]):hover { background: var(--surface-2); }
@media (min-width: 900px) { .tabs { margin: 0 0 22px; padding: 8px 0; top: 0; } }
.back { display: inline-flex; align-items: center; gap: 2px; min-height: 40px; margin: -6px 0 2px; color: var(--brand); text-decoration: none; font-weight: 700; }
.menu-row { color: inherit; text-decoration: none; }
.menu-row .chev { flex: none; font-size: 1.6rem; line-height: 1; color: var(--ink-faint); }
@media (max-width: 600px) {
  .row { padding: 11px 14px; min-height: 52px; gap: 11px; }
  .row .sub { font-size: .82rem; }
  section.group { margin-bottom: 22px; }
  .page-head { margin: 2px 0 14px; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
