/* Darb palette: black navigation, ink-navy bars, paper background, the silver of the Darb card. */
:root {
  --black: #000000;
  --ink: #111521;
  --ink-2: #1f2433;
  --paper: #f7f7f5;
  --panel: #ffffff;
  --text: #16171a;
  --muted: #5d606b;
  --line: #e2e2e4;
  --silver: #cdccd1;
  --silver-2: #a9abb5;
  --slate: #4a5068;
  --ok: #2f7d5b;
  --warn: #b7791f;
  --bad: #b23b3b;
  --radius: 12px;
  --font: "Helvetica Neue", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 var(--font); color: var(--text); background: var(--paper); font-variant-numeric: tabular-nums; }
a { color: inherit; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; margin: 0; }
small { font-size: 12px; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--slate); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side { flex: 0 0 232px; background: var(--black); color: var(--paper); padding: 20px 16px; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; }
.brand .mark { width: 36px; height: 36px; border-radius: 10px; background: var(--paper); color: var(--black); display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.brand b { display: block; font-size: 18px; }
.brand small { display: block; color: var(--silver-2); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.navlabel { margin: 0 0 6px; font-size: 12px; color: var(--silver-2); }
.nav a, .nav button { all: unset; box-sizing: border-box; cursor: pointer; padding: 9px 12px; border-radius: 10px; color: var(--paper); }
.nav a:hover, .nav button:hover { background: var(--ink-2); }
.nav a.on, .nav button.on { background: var(--paper); color: var(--text); font-weight: 600; }
.nav a:focus-visible, .nav button:focus-visible { outline: 2px solid var(--silver); }
.who { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.who small { display: block; color: var(--silver-2); overflow-wrap: anywhere; }
.who .linkbtn { color: var(--silver); }
.main { flex: 1 1 auto; min-width: 0; padding: 24px clamp(16px, 3vw, 36px) 48px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .side { position: static; height: auto; flex-basis: auto; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .navlabel { width: 100%; }
  .who { margin-top: 0; }
}

/* ---------- controls ---------- */
.btn { all: unset; box-sizing: border-box; cursor: pointer; display: inline-block; background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-weight: 600; text-decoration: none; }
.btn:hover { background: var(--ink-2); }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.linkbtn { all: unset; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn.danger { color: var(--bad); }
.flash { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.flash.error { border-color: var(--bad); color: var(--bad); }
.flash.ok { border-color: var(--ok); color: var(--ok); }
input[type=email], input[type=password], input[type=text], select.plain { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); width: 100%; }

/* ---------- sign in, picker, empty ---------- */
.signin, .pick, .empty { max-width: 720px; width: 100%; margin: 6vh auto 0; display: flex; flex-direction: column; gap: 12px; }
.signin { max-width: 420px; }
.signin h1, .pick h1, .empty h1 { font-size: 30px; }
.signin p, .pick > p, .empty p { margin: 0; color: var(--muted); }
.signin form, .form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.signin label, .form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.form label.check, .check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.form fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 16px; }
.form legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.pick .grp { margin-top: 14px; font-size: 13px; color: var(--muted); }
.pickcard { display: grid; grid-template-columns: 48px 1fr auto; gap: 16px; align-items: center; padding: 18px 20px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; }
.pickcard:hover { border-color: var(--ink); }
.pickcard.lead { box-shadow: inset 0 0 0 1px var(--ink); border-color: var(--ink); }
.pickcard .ic { width: 48px; height: 48px; border-radius: 12px; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.pickcard .ic.alt { background: var(--silver); color: var(--ink); }
.pickcard b { display: block; font-size: 18px; }
.pickcard small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.pickcard .chev { color: var(--muted); font-size: 20px; }

/* ---------- dashboard ---------- */
.dash, .admin { display: flex; flex-direction: column; gap: 18px; }
.bar { background: var(--ink); border-radius: 16px; padding: 12px 14px 12px 20px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.bar h1 { color: var(--paper); font-size: 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters label { position: relative; }
.filters .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.filters select { font: inherit; font-size: 14px; background: var(--paper); color: var(--text); border: 0; border-radius: 999px; padding: 8px 32px 8px 14px; max-width: 240px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text) 50%), linear-gradient(135deg, var(--text) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.filters select.set { box-shadow: inset 0 0 0 2px var(--silver-2); }
.take { margin: 0; font-size: 17px; color: var(--muted); max-width: 78ch; }
.take b { color: var(--text); font-weight: 600; }
.sync { margin: -10px 0 0; font-size: 13px; color: var(--muted); }
.sync.err { color: var(--bad); }
.skel { color: var(--muted); }
.section { display: flex; flex-direction: column; gap: 14px; }
.section[hidden] { display: none; }
.blocktitle { font-size: 17px; margin-top: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--silver); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile span { font-size: 13px; color: var(--muted); }
.tile b { font-size: 30px; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
.tile small { color: var(--muted); }
.tile.ok { border-top-color: var(--ok); }
.tile.warn { border-top-color: var(--warn); }
.tile.bad { border-top-color: var(--bad); }
/* The headline tile is the Darb card: brushed silver. */
.tile.hero { border: 0; color: var(--ink); background: linear-gradient(115deg, #e9e9ec 0%, #c9c8cd 38%, #efeff1 52%, #bdbcc2 100%); box-shadow: inset 0 0 0 1px rgba(17, 21, 33, .12); }
.tile.hero span, .tile.hero small { color: #3a3e4c; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card h2 { font-size: 17px; }
.card h3 { font-size: 15px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.c-ok { background: var(--ok); } .c-warn { background: var(--warn); } .c-bad { background: var(--bad); }
.c-slate { background: var(--slate); } .c-silver { background: var(--silver-2); } .c-muted { background: #dedee2; }
.hbars { display: flex; flex-direction: column; gap: 7px; }
.hrow { display: grid; grid-template-columns: minmax(96px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hrow > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track { display: flex; height: 14px; border-radius: 3px; overflow: hidden; }
.track i { display: block; height: 100%; }
.hrow b { font-weight: 600; min-width: 4ch; text-align: right; }
.tablewrap { overflow-x: auto; }
.table { border-collapse: collapse; width: 100%; font-size: 14px; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: top; }
.table th { font-size: 13px; color: var(--muted); font-weight: 600; }
.table .n { text-align: right; }
.table tbody tr:hover { background: var(--paper); }
.actions { display: flex; gap: 12px; align-items: center; }
.actions form { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.notes summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.notes ul { color: var(--muted); font-size: 14px; max-width: 80ch; }
.empty-msg { color: var(--muted); font-size: 14px; margin: 0; padding: 8px 0; }
