:root {
  --bg: #17130C; --panel: #1F1810; --sunk: #241C12; --rule: #3A2F1E;
  --ink: #EFE6D3; --ink-soft: #A99A80; --ink-faint: #6B6150;
  --accent: #C98A3C; --accent-ink: #1A1409;
  --good: #82B341; --good-bg: #212B18;
  --warn: #CC7A2E; --warn-bg: #2E2013;
  --crit: #C4453A; --crit-bg: #301714;
}
* { box-sizing: border-box; }
/* 🐛 2026-08-20: the browser's built-in `[hidden] { display: none }` rule has the same
   specificity (0-1-0) as class rules like `.shell { display: flex }` below — whichever is
   declared later in the cascade wins, so app.js setting `el.hidden = true` on `#view-app`
   (class="shell") silently did nothing and the app shell rendered even while logged out, with
   no login page ever appearing. `!important` here makes `hidden` always win, which is what the
   attribute is supposed to mean regardless of what other display rules an element also carries. */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: 'Public Sans', system-ui, sans-serif; font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #E3A85C; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.slab { font-family: 'Zilla Slab', Georgia, serif; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600;
  letter-spacing: .02em; padding: 4px 11px; border-radius: 999px; white-space: nowrap;
}
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.crit { background: var(--crit-bg); color: var(--crit); }
.pill.neutral { background: var(--sunk); color: var(--ink-faint); }

.pill-btn {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; font-weight: 600;
  padding: 4px 9px; border-radius: 999px; border: 1px solid var(--rule);
  background: transparent; color: var(--ink-faint); cursor: pointer;
}
.pill-btn:hover { border-color: var(--ink-soft); color: var(--ink-soft); }
.pill-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.shell { height: 100%; display: flex; }
.rail { width: 200px; flex-shrink: 0; border-right: 1px solid var(--rule); display: flex; flex-direction: column; padding: 16px 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; object-fit: cover; border: 1px solid var(--rule); flex-shrink: 0; }
.brand-name { font-family: 'Zilla Slab', serif; font-weight: 600; font-size: 13.5px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px; font-size: 13px; color: var(--ink-soft); margin-bottom: 2px; cursor: pointer; }
.nav-item svg { flex-shrink: 0; color: var(--ink-faint); }
.nav-item.active, .nav-item:hover { background: var(--sunk); color: var(--ink); }
.nav-item.active svg { color: var(--accent); }
.nav-badge { margin-left: auto; min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--warn); color: var(--accent-ink); font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; font-weight: 700; text-align: center; }
.pill.accent { background: var(--sunk); color: var(--accent); }
.kv { display: flex; justify-content: space-between; padding: 6px 0; font-size: 12.5px; border-top: 1px solid var(--rule); }
.kv:first-child { border-top: none; }
.kv > span:first-child { color: var(--ink-faint); }
.radio-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: 13px; cursor: pointer; }

.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.topbar { height: 52px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex-shrink: 0; }
.breadcrumb { font-size: 12.5px; color: var(--ink-faint); display: flex; align-items: center; gap: 6px; }
.breadcrumb .cur { color: var(--ink-soft); }
.admin-chip { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 13px; }
.avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--sunk); border: 1px solid var(--rule); display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 600; color: var(--ink-soft); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.world-picker, .world-locked {
  display: flex; align-items: center; gap: 7px; padding: 6px 10px 6px 8px; border-radius: 7px;
  font-size: 12.5px; color: var(--ink-soft); background: var(--bg); border: 1px solid var(--rule);
}
.world-locked { color: var(--ink-faint); cursor: default; }
.world-picker { cursor: pointer; }
.world-picker svg:first-child, .world-locked svg { color: var(--accent); flex-shrink: 0; }
.world-picker svg:last-child { color: var(--ink-faint); flex-shrink: 0; }
.world-picker b, .world-locked b { color: var(--ink); font-weight: 600; }

/* min-height/min-width: 0 — a flex item's default min-size is auto ("never shrink below my
   content"), which can silently defeat flex:1 + overflow:auto. .main already had min-width:0 for
   its own row-axis sizing inside .shell; .content gets the matching pair here. Kept as real
   hardening even though it turned out NOT to be the cause of the actual bug below.
   contain: paint — the real fix, confirmed live against production with real admin data
   (2026-09-10/11 feedback: "a scrollbar inside a scroll bar... same on mine, side and bottom").
   .content's own overflow:auto WAS correctly clipping and scrolling internally the whole time —
   confirmed by testing overflow:hidden here, which made zero difference to the outer page. The
   actual cause: document.documentElement.scrollHeight was inflated to the trait table's full
   unclipped height (7000px+) even though nothing visibly painted outside .content's box — a
   Chromium quirk where a sufficiently tall nested scroll region's layout extent can leak into the
   root document's reported scrollHeight despite being visually contained, bringing in the
   browser's OWN second scrollbar alongside this element's. `contain: paint` tells the browser
   nothing here paints outside this box, which stops that leak — confirmed: with it applied,
   document.documentElement.scrollHeight dropped to exactly the viewport height while .content
   kept scrolling its own content normally. */
.content { flex: 1; min-height: 0; min-width: 0; overflow: auto; contain: paint; padding: 26px 32px 40px; }
h1 { font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 20px; margin: 0; }
.slabel { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-faint); margin: 24px 0 12px; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
thead th { text-align: left; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); font-weight: 500; padding: 12px 16px; background: var(--sunk); border-bottom: 1px solid var(--rule); }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--rule); font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.flagged { background: linear-gradient(90deg, var(--warn-bg) 0%, transparent 4%); box-shadow: inset 3px 0 0 var(--warn); }
tbody tr.corrupted { background: linear-gradient(90deg, var(--crit-bg) 0%, transparent 4%); box-shadow: inset 3px 0 0 var(--crit); }
.num { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }
.blank { color: var(--ink-faint); font-style: italic; }

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--rule); background: transparent; color: var(--ink-soft); cursor: pointer; }
.btn:hover { border-color: var(--ink-soft); }
.btn.act { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--crit); border-color: var(--crit); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.card { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 20px 24px; }
.field-label { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; display: block; }
.field { width: 100%; background: var(--sunk); border: 1px solid var(--rule); border-radius: 7px; padding: 9px 12px; color: var(--ink); font-family: 'Public Sans', sans-serif; font-size: 13px; }
.field.mono { font-family: 'IBM Plex Mono', monospace; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { width: 460px; max-width: 92vw; background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 24px 64px rgba(0,0,0,.5); overflow: hidden; }
.modal.danger { border-color: var(--crit); }
.modal-warnbar { background: var(--crit-bg); color: var(--crit); font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 9px 24px; }
.modal-head { padding: 18px 24px 4px; }
.modal-title { font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 17px; margin: 0 0 2px; }
.modal-sub { font-size: 12px; color: var(--ink-soft); }
.modal-body { padding: 14px 24px 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px 20px; }

.center-page { max-width: 640px; margin: 0 auto; padding: 88px 24px; text-align: center; }
.search-box { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 14px 16px; }
.search-box input { background: none; border: none; outline: none; color: var(--ink); font-size: 15px; flex: 1; font-family: 'Public Sans', sans-serif; }
.search-box svg { color: var(--ink-faint); flex-shrink: 0; }

.banner { display: flex; align-items: center; gap: 10px; border-radius: 8px; padding: 11px 16px; margin-bottom: 20px; font-size: 12.5px; }
.banner.warn { background: var(--warn-bg); border: 1px solid var(--warn); color: var(--warn); }
.banner svg { flex-shrink: 0; }

.empty-state { color: var(--ink-faint); font-size: 13px; padding: 24px; text-align: center; }
