/* BitProof design tokens — cloud-console idiom (GCP/AWS-like):
   dense but airy, thin borders, one accent, semantic status colors.
   Every page imports this; no page redefines a token. */

:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --surface-2: #f1f3f4;
  --border: #dadce0;
  --ink: #202124;
  --sub: #5f6368;

  --blue: #1a73e8;
  --blue-bg: #e8f0fe;
  --blue-ink: #1a73e8;

  --ok: #188038;
  --ok-bg: #e6f4ea;
  --warn: #b05a00;
  --warn-bg: #fef7e0;
  --err: #d93025;
  --err-bg: #fce8e6;

  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(60, 64, 67, .1), 0 1px 3px rgba(60, 64, 67, .08);
  --mono: ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #202124; --surface: #292a2d; --surface-2: #35363a; --border: #3c4043;
    --ink: #e8eaed; --sub: #9aa0a6;
    --blue: #8ab4f8; --blue-bg: #1f3352; --blue-ink: #8ab4f8;
    --ok: #81c995; --ok-bg: #1e3325; --warn: #fdd663; --warn-bg: #33301a;
    --err: #f28b82; --err-bg: #3c2422;
    --on-accent: #202124;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.25);
  }
}
:root[data-theme="dark"] {
  --bg: #202124; --surface: #292a2d; --surface-2: #35363a; --border: #3c4043;
  --ink: #e8eaed; --sub: #9aa0a6;
  --blue: #8ab4f8; --blue-bg: #1f3352; --blue-ink: #8ab4f8;
  --ok: #81c995; --ok-bg: #1e3325; --warn: #fdd663; --warn-bg: #33301a;
  --err: #f28b82; --err-bg: #3c2422;
  --on-accent: #202124;
}
:root[data-theme="light"] {
  --bg: #f8f9fa; --surface: #ffffff; --surface-2: #f1f3f4; --border: #dadce0;
  --ink: #202124; --sub: #5f6368;
  --blue: #1a73e8; --blue-bg: #e8f0fe; --blue-ink: #1a73e8;
  --ok: #188038; --ok-bg: #e6f4ea; --warn: #b05a00; --warn-bg: #fef7e0;
  --err: #d93025; --err-bg: #fce8e6;
  --on-accent: #ffffff;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 13px/1.55 var(--sans);
}

/* --- app bar --- */
.appbar {
  height: 52px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  position: sticky; top: 0; z-index: 5;
}
.brand { font-size: 16px; font-weight: 500; text-decoration: none; color: var(--ink); }
.brand span { color: var(--blue); }
.brand small { color: var(--sub); font-weight: 400; margin-left: 8px; font-size: 12px; }
.appbar .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* --- chips --- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500;
  border-radius: 12px; padding: 2px 10px; white-space: nowrap;
}
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.err { background: var(--err-bg); color: var(--err); }
.chip.blue { background: var(--blue-bg); color: var(--blue-ink); }
.chip.gray { background: var(--surface-2); color: var(--sub); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* --- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 4px; padding: 8px 20px;
  font: 500 13px var(--sans); cursor: pointer;
  background: var(--blue); color: var(--on-accent); text-decoration: none;
}
.btn:hover { filter: brightness(.95); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn.text { background: transparent; color: var(--blue-ink); padding: 8px 12px; }
.btn.outline { background: transparent; color: var(--blue-ink); border: 1px solid var(--border); }
.btn.danger { background: var(--err); }
.btn[disabled] { opacity: .4; cursor: default; pointer-events: none; }

/* --- layout --- */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: calc(100vh - 52px); }
.nav { background: var(--surface); border-right: 1px solid var(--border); padding: 12px 0; }
.nav .grp { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--sub); padding: 14px 20px 6px; }
.nav a { display: block; padding: 7px 20px; color: var(--ink); text-decoration: none;
  font-size: 13px; border-left: 3px solid transparent; }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--blue-bg); color: var(--blue-ink);
  border-left-color: var(--blue); font-weight: 500; }
.content { padding: 24px 32px 64px; max-width: 1060px; }

/* Below the sidebar breakpoint the nav becomes a horizontal strip under the app
   bar. It used to be display:none with no replacement, which hid the only link
   back to the current evidence pack on every tablet and phone. */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .nav {
    border-right: 0; border-bottom: 1px solid var(--border); padding: 6px 8px;
    display: flex; align-items: center; gap: 4px; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: thin;
  }
  .nav .grp { padding: 0 6px 0 10px; white-space: nowrap; flex-shrink: 0; }
  .nav .grp:first-child { padding-left: 4px; }
  .nav a {
    padding: 6px 10px; border-left: 0; border-radius: 4px; white-space: nowrap;
    flex-shrink: 0;
  }
  .nav a.on { border-left: 0; }
  .content { padding: 20px 16px 56px; }
}

.crumb { font-size: 12px; color: var(--sub); margin-bottom: 6px; }
.crumb b { color: var(--ink); font-weight: 500; }
h1 { font-size: 20px; font-weight: 400; margin: 0 0 4px; text-wrap: balance; }
.lede { color: var(--sub); margin: 0 0 20px; max-width: 70ch; }

/* --- cards, tables, disclosure --- */
.card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px; }
.card h2 { font-size: 14px; font-weight: 500; margin: 0 0 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) {
  .row2, .row3 { grid-template-columns: 1fr; }
  .row4 { grid-template-columns: 1fr 1fr; }
}

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-size: 11px; font-weight: 500; color: var(--sub);
  border-bottom: 1px solid var(--border); padding: 8px 10px; }
td { padding: 9px 10px; border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.scroll { overflow-x: auto; }

details { border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); margin-bottom: 12px; }
details summary { cursor: pointer; padding: 12px 16px; font-size: 13px; font-weight: 500;
  list-style: none; display: flex; align-items: center; gap: 8px; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "▸"; color: var(--sub); transition: transform .15s; }
details[open] summary::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { details summary::before { transition: none; } }
details .body { padding: 0 16px 14px; color: var(--sub); font-size: 12.5px; }

/* --- forms --- */
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 12px; color: var(--sub); margin-bottom: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface); color: var(--ink); font: 13px var(--sans);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; }

/* --- misc --- */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 4px 16px; font-size: 12.5px; margin: 0; }
.kv dt { color: var(--sub); }
.kv dd { margin: 0; }
.mono { font-family: var(--mono); font-size: 11.5px; }
pre.code { background: var(--surface-2); border-radius: 6px; padding: 12px;
  font-family: var(--mono); font-size: 11px; white-space: pre-wrap; word-break: break-all;
  max-height: 200px; overflow: auto; margin: 8px 0; }
.empty { text-align: center; padding: 48px 20px; color: var(--sub); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 20px; border-radius: 6px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s;
  z-index: 20; box-shadow: var(--shadow); }
.toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border);
  border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
