:root {
  --paper: #eef1f4; --panel: #ffffff; --ink: #1b2430; --muted: #5d6b7a; --line: #d5dce3;
  --accent: #2c5f7c; --accent-ink: #ffffff;
  --ok: #1f8a5b; --warn: #b7791f; --bad: #c2362b; --idle: #9aa7b4;
  --ok-bg: #e1f2ea; --warn-bg: #f7ecd6; --bad-bg: #f9e1de; --idle-bg: #e6ebf0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12181f; --panel: #1a222c; --ink: #e4eaf0; --muted: #94a3b3; --line: #2b3643;
    --accent: #7fb4d2; --accent-ink: #0f1820;
    --ok: #4cc38f; --warn: #e0a84a; --bad: #ef7268; --idle: #5f6e7d;
    --ok-bg: #173529; --warn-bg: #3a2f17; --bad-bg: #40201d; --idle-bg: #242e39;
  }
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: Archivo, ui-sans-serif, system-ui, sans-serif; font-variant-numeric: tabular-nums; line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Links never fall back to browser blue/purple. */
a, a:visited { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }

.shell { max-width: 1180px; margin: 0 auto; padding: 0 20px 64px; }
.top { display: flex; align-items: baseline; gap: 24px; padding: 22px 0 14px; flex-wrap: wrap; }
.brand { font-stretch: 118%; font-weight: 700; font-size: 1.35rem; letter-spacing: -0.01em; margin: 0; }
.health { color: var(--muted); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.top .spacer { flex: 1; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tab { background: none; border: 0; padding: 9px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tab .count { color: var(--muted); font-weight: 400; margin-left: 6px; }

h2 { font-size: 1.05rem; font-weight: 650; margin: 28px 0 10px; font-stretch: 110%; }
h2:first-child { margin-top: 0; }
.hint { color: var(--muted); margin: 0 0 12px; max-width: 72ch; }

/* The fleet strip: one lamp per account / proxy. */
.strip { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 6px; padding: 0; list-style: none; }
.lamp { width: 15px; height: 22px; border-radius: 3px; background: var(--idle); border: 0; padding: 0; cursor: pointer; }
.lamp.wide { width: 34px; }
.lamp.ok { background: var(--ok); } .lamp.warn { background: var(--warn); } .lamp.bad { background: var(--bad); }
.lamp.free { background: transparent; box-shadow: inset 0 0 0 2px var(--ok); }
.lamp.reserve { background: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--idle); }
.legend .ok::before { background: var(--ok); } .legend .warn::before { background: var(--warn); } .legend .bad::before { background: var(--bad); }
.legend .free::before { background: transparent; box-shadow: inset 0 0 0 2px var(--ok); }
.legend .reserve::before { background: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.readout { min-height: 1.5em; color: var(--muted); margin: 0 0 8px; }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
/* Cell rules drawn by the cells, so a short last row leaves plain panel, not a grey block. */
.figure { padding: 12px 14px; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.figure b { display: block; font-size: 1.5rem; font-weight: 600; font-stretch: 90%; }
.figure span { color: var(--muted); }

.tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 0.9rem; position: sticky; top: 0; background: var(--panel); }
tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; min-width: 22ch; max-width: 46ch; color: var(--muted); overflow-wrap: anywhere; }
td.num, th.num { text-align: right; }
td.actions { text-align: right; }
.sub { color: var(--muted); font-size: 0.9rem; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.87rem; background: var(--idle-bg); color: var(--muted); }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.bad { background: var(--bad-bg); color: var(--bad); }

.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.bar .spacer { flex: 1; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 5px; padding: 6px 12px; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 2px 9px; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.55; cursor: default; }
input[type=text], input[type=password], input[type=search], select, textarea {
  border: 1px solid var(--line); background: var(--panel); border-radius: 5px; padding: 7px 10px; width: 100%;
}
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-weight: 550; margin: 14px 0 5px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 12px 0 0; }
label.check input { width: auto; }
.field-hint { color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }

dialog { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); padding: 22px; width: min(540px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 16, 24, 0.5); }
dialog h3 { margin: 0 0 4px; font-size: 1.1rem; font-stretch: 110%; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.error { color: var(--bad); margin: 12px 0 0; min-height: 1.4em; overflow-wrap: anywhere; }

.gate { max-width: 420px; margin: 14vh auto 0; padding: 0 20px; }
.gate h1 { font-stretch: 118%; font-size: 1.7rem; margin: 0 0 6px; letter-spacing: -0.01em; }
.gate p { color: var(--muted); margin: 0 0 18px; }
.gate .btn { margin-top: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 9px 16px; border-radius: 6px; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bad); color: #fff; }
.empty { padding: 22px; color: var(--muted); }
.two { margin-top: 26px; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; }
td.says { color: var(--ink); max-width: 60ch; }
td.says b { font-weight: 600; }
@media (max-width: 800px) { .two { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: no-preference) { .lamp { transition: transform 0.08s; } .lamp:hover, .lamp:focus-visible { transform: scaleY(1.25); } }

a.ref { text-decoration-color: var(--line); font-weight: 550; }
a.ref:hover { text-decoration-color: currentColor; }
.who { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.avatar { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--idle-bg); flex: none; }
h2.title { font-size: 1.5rem; margin: 0 0 2px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.who .hint { margin: 0 0 4px; }
.wallets { display: flex; gap: 18px; flex-wrap: wrap; margin: 12px 0 0; max-width: none; }
code { font-family: inherit; color: var(--ink); overflow-wrap: anywhere; }
td.up { color: var(--ok); } td.down { color: var(--bad); }
.figures + .figures { margin-top: 10px; }
