:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef2ff;
  --text: #16202c;
  --muted: #5d6b7a;
  --line: #e2e6ec;
  --brand: #2563eb;
  --brand-ink: #ffffff;
  --ok: #0f8a4a;
  --warn: #b45309;
  --bad: #c02626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 32, 44, .06), 0 6px 18px rgba(16, 32, 44, .06);
}
:root[data-theme="dark"], html.dark {
  --bg: #0f1520;
  --surface: #161d2b;
  --surface-2: #1d273a;
  --text: #e8edf4;
  --muted: #97a4b6;
  --line: #26303f;
  --brand: #5b8cff;
  --brand-ink: #0b1020;
  --ok: #48c98a;
  --warn: #e0a44b;
  --bad: #ff7a7a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px rgba(0, 0, 0, .34);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1520; --surface: #161d2b; --surface-2: #1d273a;
    --text: #e8edf4; --muted: #97a4b6; --line: #26303f;
    --brand: #5b8cff; --brand-ink: #0b1020;
    --ok: #48c98a; --warn: #e0a44b; --bad: #ff7a7a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 22px rgba(0,0,0,.34);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--brand); }
.wrap { width: min(1080px, 100% - 2rem); margin-inline: auto; }
.skip {
  position: absolute; left: -9999px;
}
.skip:focus { left: 1rem; top: .5rem; background: var(--surface); padding: .5rem .75rem; z-index: 20; }

/* ------------------------------------------------------------------ header */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 0;
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 600; font-size: 1.05rem; text-decoration: none; color: var(--text);
  flex: 0 0 auto;
}
.brand-mark { font-size: 1.25rem; }
.brand-text b { color: var(--brand); }
.search { position: relative; flex: 1 1 auto; min-width: 0; }
.search input {
  width: 100%; padding: .6rem 2.2rem .6rem .85rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--text); font-size: .95rem;
}
.search input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.clear {
  position: absolute; right: .45rem; top: 50%; translate: 0 -50%;
  border: 0; background: transparent; color: var(--muted);
  font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 .35rem;
}
.icon-btn {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); border-radius: 999px; width: 2.3rem; height: 2.3rem;
  cursor: pointer; font-size: 1rem;
}

.tabs { display: flex; gap: .25rem; overflow-x: auto; padding-bottom: .4rem; }
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: .45rem .8rem; border-radius: 999px; cursor: pointer;
  font-size: .92rem; font-weight: 500; white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.is-active { background: var(--brand); color: var(--brand-ink); }
.pill {
  display: inline-block; margin-left: .3rem; font-size: .78rem;
  opacity: .8; font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------- cards */
main { padding: 1.1rem 0 2rem; }
.status { color: var(--muted); font-size: .92rem; padding: .5rem 0 1rem; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin: 1.6rem 0 .7rem;
}
.section-head:first-child { margin-top: .2rem; }
.section-head h2 { font-size: 1.12rem; margin: 0; }
.section-head .more { font-size: .88rem; background: none; border: 0; color: var(--brand); cursor: pointer; }

.grid { display: grid; gap: .7rem; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .85rem 1rem;
  box-shadow: var(--shadow);
  display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap;
}
.card-main { flex: 1 1 22rem; min-width: 0; }
.card h3 { margin: 0 0 .3rem; font-size: 1rem; line-height: 1.4; font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: .35rem .8rem; font-size: .85rem; color: var(--muted); }
.card-actions { display: flex; gap: .5rem; flex: 0 0 auto; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .45rem .8rem; border-radius: 8px; font-size: .88rem; font-weight: 500;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn[disabled] { opacity: .5; cursor: default; }

.badge { font-weight: 600; }
.badge-ok { color: var(--ok); }
.badge-warn { color: var(--warn); }
.badge-bad { color: var(--bad); }
.tag {
  font-size: .74rem; padding: .1rem .45rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}

/* ------------------------------------------------------------------ detail */
.detail-top { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .3rem 0 1rem; }
.detail h1 { font-size: 1.4rem; line-height: 1.3; margin: .2rem 0 .5rem; }
.summary {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .8rem 1rem; margin: 0 0 1rem; font-size: .94rem;
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .7rem; margin-bottom: 1.2rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; }
.stat dt { font-size: .78rem; color: var(--muted); margin: 0 0 .15rem; text-transform: uppercase; letter-spacing: .03em; }
.stat dd { margin: 0; font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.detail section { margin: 0 0 1.5rem; }
.detail h2 { font-size: 1.05rem; margin: 0 0 .6rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line); }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1.5rem; }

/* Wide content scrolls inside its own box so the page never scrolls sideways. */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }

.steps { margin: 0; padding-left: 1.3rem; }
.steps li { margin-bottom: .45rem; }
.faq { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: .7rem .9rem; margin-bottom: .5rem; }
.faq p:first-child { font-weight: 600; margin: 0 0 .3rem; }
.faq p:last-child { margin: 0; color: var(--muted); font-size: .93rem; }
.link-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .8rem; }
.link-list { font-size: .9rem; }
.link-list div { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.link-list div:last-child { border-bottom: 0; }

.empty { color: var(--muted); font-size: .92rem; font-style: italic; }
.foot { padding: 1.5rem 0 3rem; font-size: .86rem; color: var(--muted); border-top: 1px solid var(--line); }
.muted { color: var(--muted); }

@media (max-width: 560px) {
  .topbar-inner { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; }
  .card-actions { width: 100%; }
  .card-actions .btn { flex: 1 1 auto; justify-content: center; }
}
