/* Care Radar: mobile-first, large readable text, light and dark. */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #16212b;
  --muted: #5b6b7a;
  --line: #d9e0e6;
  --accent: #0f3d5e;
  --accent-text: #ffffff;
  --official: #0f3d5e;
  --news: #7a4b00;
  --data: #3f2a7a;
  --high: #b3261e;
  --medium: #b36b00;
  --low: #4b7a5b;
  --verify-bg: #fff4e5;
  --verify-text: #6b3d00;
  --add: #0a6b3a;
  --add-bg: #e6f6ec;
  --del: #a3221d;
  --del-bg: #fbeae9;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1620;
    --panel: #132230;
    --text: #e8eef3;
    --muted: #9fb0bf;
    --line: #243546;
    --accent: #4fa3d8;
    --accent-text: #061018;
    --official: #7cc0ea;
    --news: #e0a94a;
    --data: #b39ddb;
    --high: #ff7b72;
    --medium: #f0b35a;
    --low: #7fcf9b;
    --verify-bg: #3a2a10;
    --verify-text: #ffd9a0;
    --add: #7fe0a4;
    --add-bg: #10301f;
    --del: #ff8f88;
    --del-bg: #3a1614;
  }
}

* { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { margin: 0 0 0.4em; line-height: 1.2; }
p { margin: 0 0 0.8em; }
a { color: var(--accent); }
button, input, textarea { font: inherit; }
[hidden] { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand h1 { font-size: 1.25rem; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.pages { display: flex; gap: 4px; overflow-x: auto; }
.pages a { padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.pages a.active { background: var(--accent); color: var(--accent-text); }
.topbar .link { margin-left: auto; background: none; border: 0; color: var(--accent); padding: 6px; }

main { max-width: 760px; margin: 0 auto; padding: 12px 12px 40px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }

label { display: block; font-weight: 600; margin-bottom: 4px; }
.small { font-size: 0.9rem; }
.small .link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }
input[type="email"], input[type="password"], input[type="search"], textarea {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); margin-bottom: 12px;
}
button.primary, a.primary {
  display: inline-block; text-align: center; text-decoration: none;
  background: var(--accent); color: var(--accent-text); border: 0;
  padding: 11px 16px; border-radius: 10px; font-weight: 600; cursor: pointer;
}
button.secondary {
  background: transparent; color: var(--text); border: 1px solid var(--line);
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
}
button.secondary.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.wide { width: 100%; margin-top: 12px; }
button:disabled { opacity: 0.6; cursor: default; }
.status { color: var(--muted); min-height: 1.2em; }
.status.error { color: var(--high); }

.toolbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.tab.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 0.9rem; cursor: pointer; }
.chip.on { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.search input { margin: 0; }

.items { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; border-left-width: 6px; }
.card.importance-high { border-left-color: var(--high); }
.card.importance-medium { border-left-color: var(--medium); }
.card.importance-low { border-left-color: var(--low); }
.card.read { opacity: 0.72; }
.card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.85rem; margin-bottom: 6px; }
.badge { padding: 2px 8px; border-radius: 6px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: #fff; }
.badge.official { background: var(--official); }
.badge.news { background: var(--news); }
.badge.data { background: var(--data); }
@media (prefers-color-scheme: dark) { .badge { color: #061018; } }
.importance { font-weight: 700; }
.importance.high { color: var(--high); }
.importance.medium { color: var(--medium); }
.importance.low { color: var(--low); }
.meta { color: var(--muted); }
.card .title { font-size: 1.15rem; margin: 4px 0 8px; }
.facts { display: grid; grid-template-columns: 1fr; gap: 2px 10px; margin: 0 0 8px; }
.facts dt { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-top: 6px; }
.facts dd { margin: 0; }
@media (min-width: 560px) { .facts { grid-template-columns: 9em 1fr; } .facts dt { margin-top: 0; } }
.means { margin: 6px 0 10px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; }
.means-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 4px; }
.means-title { font-weight: 700; }
.means-label { font-size: 0.78rem; color: var(--muted); }
.means .plain { margin: 0 0 6px; }
.means .analogy { margin: 0; font-style: italic; color: var(--muted); }
.verify { background: var(--verify-bg); color: var(--verify-text); padding: 10px 12px; border-radius: 8px; font-weight: 600; }
.wording summary { cursor: pointer; font-weight: 600; margin: 6px 0; }
.quote { margin: 8px 0; padding: 10px 12px; border-left: 3px solid var(--line); background: var(--bg); border-radius: 0 8px 8px 0; font-style: italic; white-space: pre-wrap; }
.diff-label { font-size: 0.85rem; color: var(--muted); margin: 8px 0 4px; }
.diff { margin: 0; padding: 10px; background: var(--bg); border-radius: 8px; font-size: 0.82rem; overflow-x: auto; white-space: pre-wrap; word-break: break-word; max-height: 24em; }
.diff .add { color: var(--add); background: var(--add-bg); display: block; }
.diff .del { color: var(--del); background: var(--del-bg); display: block; }
.diff .ctx { color: var(--muted); display: block; }
.related { font-size: 0.9rem; margin-top: 6px; }
.corrections-list { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--verify-bg); color: var(--verify-text); font-size: 0.9rem; }
.corrections-list p { margin: 0 0 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.actions .primary { flex: 1 1 100%; }
@media (min-width: 480px) { .actions .primary { flex: 0 0 auto; } }

/* Step 5 pages */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.page-head h2 { margin: 0; }
.digest-group { margin-bottom: 16px; }
.digest-group h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 6px; }
.digest-item { background: var(--panel); border: 1px solid var(--line); border-left-width: 6px; border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.digest-item .line { font-size: 0.85rem; color: var(--muted); }
.digest-item .t { font-weight: 700; margin: 2px 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat .n { font-size: 1.4rem; font-weight: 700; }
.stat .l { font-size: 0.8rem; color: var(--muted); }
.source-list { display: flex; flex-direction: column; gap: 8px; }
.source { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: start; }
.source.off { opacity: 0.6; }
.source .name { font-weight: 700; grid-column: 1; grid-row: 1; }
.source .sub { font-size: 0.85rem; color: var(--muted); grid-column: 1; grid-row: 2; }
.source .err { font-size: 0.85rem; color: var(--high); grid-column: 1 / -1; grid-row: 3; }
.source .toggle { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.switch { position: relative; width: 50px; height: 28px; border-radius: 14px; border: 0; background: var(--line); cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--panel); transition: left 0.15s; }
.switch.on { background: var(--low); }
.switch.on::after { left: 25px; }
.correction { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.correction .note { margin: 6px 0; }
.correction .line { font-size: 0.85rem; color: var(--muted); }

dialog { border: 0; border-radius: var(--radius); padding: 18px; max-width: 480px; width: calc(100% - 32px); background: var(--panel); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog .row { display: flex; gap: 8px; justify-content: flex-end; }
