:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #16202a; --muted: #5b6b7a; --line: #dde3ea;
  --accent: #0f766e; --accent-ink: #ffffff; --accent-soft: #e0f2f0;
  --info-bg: #e8f1fb; --info-line: #9cc3ee; --ok-bg: #e6f6ea; --ok-line: #8fd0a0; --warn-bg: #fff4de; --warn-line: #f0c36d; --bad-bg: #fde8e8; --bad-line: #eba0a0;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151b; --card: #18212a; --text: #e8eef3; --muted: #9db0c0; --line: #2a3744;
    --accent: #2dd4bf; --accent-ink: #062521; --accent-soft: #123a37;
    --info-bg: #14283d; --info-line: #2f5b8a; --ok-bg: #11301d; --ok-line: #2f7a48; --warn-bg: #3a2e12; --warn-line: #8a6a22; --bad-bg: #3a1717; --bad-line: #8a3a3a;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; padding-bottom: env(safe-area-inset-bottom); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
a { color: var(--accent); }
@media (prefers-color-scheme: light) { a { color: #0b5f58; } }

.top { background: var(--card); padding: env(safe-area-inset-top) 0 4px; }
.titlerow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 1.35rem; line-height: 1.2; letter-spacing: -.01em; }
.meta { margin: 4px 0 8px; color: var(--muted); font-size: .85rem; }
.sync { font-size: .78rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.sync::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); vertical-align: 0; }
.sync.ok::before { background: #22a559; } .sync.busy::before { background: #e0a21a; } .sync.bad::before { background: #d9534f; }

.tabsbar { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; max-width: 884px; margin: 0 auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 0 0 auto; border: 1px solid transparent; background: transparent; color: var(--muted); font: inherit; font-size: .95rem; font-weight: 600; padding: 8px 14px; border-radius: 999px; cursor: pointer; min-height: 40px; }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.tabs button:not([aria-selected="true"]):hover { background: var(--accent-soft); color: var(--text); }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

main { padding-top: 16px; padding-bottom: 80px; outline: none; }
.sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin: 0 0 14px; padding: 16px; }
.sec > h2, details.sec > summary { margin: 0; font-size: 1.12rem; line-height: 1.3; font-weight: 700; }
.sec > h2 { margin-bottom: 10px; }
details.sec { padding: 0; }
details.sec > summary { cursor: pointer; padding: 14px 16px; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: "▾"; color: var(--muted); transition: transform .15s; flex: none; }
details.sec[open] > summary::after { transform: rotate(180deg); }
details.sec > summary small { color: var(--muted); font-weight: 500; font-size: .82rem; margin-left: auto; }
details.sec > .body { padding: 0 16px 16px; }
p { margin: 0 0 10px; } p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); font-size: .92rem; }
ul.bul, ol.steps { margin: 0 0 10px; padding-left: 1.25rem; } ul.bul li { margin: 0 0 8px; }
ol.steps { list-style: none; padding: 0; counter-reset: s; }
ol.steps li { counter-increment: s; position: relative; padding: 0 0 12px 40px; }
ol.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--text); font-weight: 700; display: grid; place-items: center; font-size: .9rem; }
ol.steps b { display: block; } ol.steps span { color: var(--muted); font-size: .94rem; }

.callout { border: 1px solid var(--info-line); background: var(--info-bg); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 14px; }
.callout.success { border-color: var(--ok-line); background: var(--ok-bg); } .callout.warning { border-color: var(--warn-line); background: var(--warn-bg); }
.callout b { display: block; margin-bottom: 2px; }
.sec .callout { margin-top: 12px; margin-bottom: 0; }

dl.props { margin: 0; display: grid; grid-template-columns: 1fr; gap: 0; }
dl.props div { padding: 9px 0; border-bottom: 1px solid var(--line); } dl.props div:last-child { border: 0; }
dl.props dt { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
dl.props dd { margin: 2px 0 0; }
@media (min-width: 640px) { dl.props div { display: grid; grid-template-columns: 180px 1fr; gap: 12px; } dl.props dd { margin: 0; } dl.props dt { text-transform: none; letter-spacing: 0; font-size: .95rem; } }

.tablewrap { overflow-x: auto; margin: 0 0 10px; border: 1px solid var(--line); border-radius: 10px; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--accent-soft); font-weight: 700; white-space: nowrap; } tr:last-child td { border-bottom: 0; }
.r { text-align: right; } td.r, th.r { font-variant-numeric: tabular-nums; }

.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 14px; }
@media (min-width: 640px) { .metrics { grid-template-columns: repeat(4, 1fr); } .metrics.two { grid-template-columns: repeat(2, 1fr); } .metrics.one { grid-template-columns: 1fr; } }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.metric b { display: block; font-size: 1.7rem; line-height: 1.1; } .metric > span { color: var(--muted); font-size: .86rem; display: block; margin-top: 2px; }

.links { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 12px 0 0; }
@media (min-width: 640px) { .links.wide { grid-template-columns: 1fr 1fr; } }
.linkcard { display: block; text-decoration: none; color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; background: var(--bg); min-height: 48px; }
.linkcard:hover { border-color: var(--accent); }
.linkcard b { display: block; font-weight: 600; line-height: 1.3; color: var(--text); }
.linkcard span { font-size: .8rem; color: var(--muted); }
.linkcard b::after { content: " ↗"; color: var(--accent); }

.btn { appearance: none; font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 10px 18px; border-radius: 10px; cursor: pointer; min-height: 44px; margin: 6px 8px 0 0; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.field { display: block; margin: 0 0 12px; } .field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
select, input[type="search"], input[type="text"] { width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); min-height: 44px; }

.task { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; cursor: pointer; border-top: 1px solid var(--line); }
.task:first-of-type { border-top: 0; }
.task input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.task.on span { opacity: .6; text-decoration: line-through; }

.opt { display: block; width: 100%; text-align: left; font: inherit; color: var(--text); padding: 12px 14px; margin-top: 8px; border-radius: 10px; border: 1px solid var(--line); background: transparent; cursor: pointer; line-height: 1.45; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.right { background: var(--ok-bg); border-color: var(--ok-line); } .opt.wrong { background: var(--bad-bg); border-color: var(--bad-line); }
.q { font-size: 1.05rem; font-weight: 600; margin-bottom: 4px; }

.review { margin: 0; padding: 0; list-style: none; } .review li { padding: 10px 0; border-top: 1px solid var(--line); } .review li:first-child { border: 0; }
.review .lead { font-size: .78rem; font-weight: 700; color: var(--accent); } .review .ans { color: var(--muted); font-size: .92rem; margin-top: 3px; }
.bars { display: grid; gap: 10px; margin: 0 0 12px; }
.bar .top2 { display: flex; justify-content: space-between; gap: 8px; font-size: .92rem; } .bar .top2 span { color: var(--muted); }
.track { height: 12px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; margin-top: 4px; } .fill { height: 100%; background: var(--accent); border-radius: 99px; }
svg.chart { width: 100%; height: auto; display: block; } svg.chart text { fill: var(--muted); font-size: 11px; }
.foot { color: var(--muted); font-size: .8rem; margin: 22px 0 0; }
.totop { position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 10px 14px; font: inherit; font-size: .85rem; box-shadow: 0 2px 8px rgba(0,0,0,.18); cursor: pointer; z-index: 30; }
.totop[hidden] { display: none; }
@media (min-width: 900px) { h1 { font-size: 1.6rem; } body { font-size: 17px; } .sec { padding: 20px; } details.sec > summary { padding: 16px 20px; } details.sec > .body { padding: 0 20px 20px; } }
@media print { .tabsbar, .totop { display: none; } }
