/* Afterimage Admin: dense, readable, dark by default with a light theme that follows the system.
   Palette from the app: lavender accent, midnight and cream grounds; Outfit throughout. */

@font-face { font-family: "Outfit"; font-weight: 400; font-display: swap; src: url("assets/fonts/Outfit-Regular.ttf") format("truetype"); }
@font-face { font-family: "Outfit"; font-weight: 500; font-display: swap; src: url("assets/fonts/Outfit-Medium.ttf") format("truetype"); }
@font-face { font-family: "Outfit"; font-weight: 600; font-display: swap; src: url("assets/fonts/Outfit-SemiBold.ttf") format("truetype"); }

:root {
  color-scheme: dark;
  --bg: #151517;
  --side: #1b1b1e;
  --surface: #1f1f23;
  --surface-2: #29292e;
  --line: #36363c;
  --line-soft: #2a2a2f;
  --text: #f2f1ec;
  --text-2: #a9a8b0;
  --text-3: #7b7a83;
  --accent: #9ea8ff;
  --accent-ink: #14152b;
  --accent-soft: rgba(158, 168, 255, 0.14);
  --good: #6fd39a;
  --bad: #ff8b7d;
  --warn: #ffd273;
  --heat: 158, 168, 255;

  --radius: 14px;
  --side-w: 232px;
  --tabbar-h: 58px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 8px 24px -12px rgba(0, 0, 0, 0.35);
  --gap: 14px;
  --font: "Outfit", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #fbf8f0;
    --side: #f4f0e5;
    --surface: #ffffff;
    --surface-2: #f6f2e8;
    --line: #e6e0d2;
    --line-soft: #efeadf;
    --text: #1c1c1e;
    --text-2: #5d5c63;
    --text-3: #8b8a90;
    --accent: #4a52a8;
    --accent-ink: #ffffff;
    --accent-soft: rgba(74, 82, 168, 0.1);
    --good: #1f8a50;
    --bad: #c4432f;
    --warn: #a86b00;
    --heat: 74, 82, 168;
    --shadow: 0 1px 2px rgba(60, 50, 20, 0.06), 0 8px 24px -14px rgba(60, 50, 20, 0.18);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12px; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:disabled { opacity: 0.55; cursor: default; }
.ghost {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 8px;
  padding: 5px 11px;
  color: var(--text-2);
}
.ghost:hover { color: var(--text); border-color: var(--text-3); }
.ghost.icon { padding: 4px 9px; }
.primary {
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.primary.apple { display: inline-flex; align-items: center; gap: 9px; background: var(--text); color: var(--bg); padding: 11px 22px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- shell: a sidebar on wide screens; a top bar and a tab bar on a phone ---------- */

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 8px; }
.brand b { font-weight: 600; color: var(--accent); }

.side {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--side-w);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: max(18px, env(safe-area-inset-top)) 12px 16px max(12px, env(safe-area-inset-left));
  background: var(--side);
  border-right: 1px solid var(--line-soft);
  overflow-y: auto;
}
.side .brand { padding: 2px 8px 6px; }
.side-nav { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-heading { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); padding: 0 10px 6px; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--text-2);
  font-weight: 500;
}
.side-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.side-nav a[aria-current="page"] { color: var(--text); background: var(--accent-soft); }
.side-nav a[aria-current="page"] .nav-icon { color: var(--accent); }
.nav-icon { display: inline-flex; flex: none; }
.side-foot { display: flex; flex-direction: column; gap: 8px; }
.side-foot .pill { align-self: flex-start; margin-left: 4px; }
.ghost.wide { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; }

.bar { display: none; }
.tabbar { display: none; }

/* ---------- page ---------- */

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px max(28px, env(safe-area-inset-right)) 64px 28px;
  outline: none;
}
body.signed-in main { margin-left: var(--side-w); max-width: min(1400px, calc(100vw - var(--side-w))); }
@media (min-width: 1640px) { body.signed-in main { margin-left: max(var(--side-w), calc((100vw - 1400px + var(--side-w)) / 2)); } }
.page { display: flex; flex-direction: column; gap: 18px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; letter-spacing: -0.02em; }
.subtitle { color: var(--text-2); margin-top: 2px; }
.page-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.grid { display: grid; gap: var(--gap); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.charts { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); align-items: start; }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  min-width: 0;
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); font-weight: 600; }
.panel-head .aside, .panel-head > span { color: var(--text-3); font-size: 12px; }
.panel > .table-wrap { margin: 0 -18px -18px; border-top: 1px solid var(--line-soft); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- stat cards ---------- */

.stat {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.stat-title { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.stat-sub { color: var(--text-3); font-size: 12px; }
.stat .chart { margin-top: 8px; }
.stat.tone-muted .stat-value { color: var(--text-2); font-size: 18px; padding: 5px 0 3px; }
.stat.tone-alert .stat-value { color: var(--bad); }

.delta { font-size: 12px; font-weight: 600; letter-spacing: 0; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.delta.flat { color: var(--text-3); }

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.good { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.pill.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.pill.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

/* ---------- tables ---------- */

.table-wrap { overflow: auto; max-height: min(72vh, 760px); border-radius: var(--radius); }
.page > .table-wrap { border: 1px solid var(--line-soft); background: var(--surface); }

table { border-collapse: separate; border-spacing: 0; width: 100%; }
table.data th, table.data td, .heat-table th, .heat-table td { padding: 8px 12px; text-align: left; white-space: nowrap; }
table.data.dense th, table.data.dense td { padding: 6px 10px; }
table.data thead th, .heat-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
}
table.data tbody td { border-bottom: 1px solid var(--line-soft); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: var(--accent-soft); }
.num { text-align: right !important; }
td.wide { white-space: normal; min-width: 220px; max-width: 460px; }
td.empty { color: var(--text-3); text-align: center !important; padding: 26px 12px !important; }
.who { display: flex; flex-direction: column; line-height: 1.25; }
.who small { color: var(--text-3); font-size: 12px; }
.muted { color: var(--text-3); }
.clip { display: block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- controls ---------- */

.segmented { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line-soft); }
.segmented button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; color: var(--text-2); font-weight: 500; }
.segmented button.on { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }

input[type="search"], select {
  font: inherit;
  font-size: 16px; /* no iOS zoom on focus */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 11px;
  min-width: 0;
}
@media (min-width: 700px) { input[type="search"], select { font-size: 14px; } }
input[type="search"] { width: 260px; }
input[type="search"]::placeholder { color: var(--text-3); }

.pager { display: flex; justify-content: center; gap: 10px; align-items: center; color: var(--text-3); }

/* ---------- charts ---------- */

.chart { position: relative; height: var(--h, 64px); color: var(--accent); touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-line { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: currentColor; opacity: 0.14; }
.chart-bar { fill: currentColor; opacity: 0.85; }
.chart-bar.zero { opacity: 0.25; }
.chart.tone-good { color: var(--good); }
.chart.tone-bad { color: var(--bad); }
.chart.tone-warn { color: var(--warn); }
.chart-marker { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--text-3); pointer-events: none; }
.chart-tip {
  position: absolute;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  font-size: 11.5px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}
.chart-empty { color: var(--text-3); font-size: 12px; display: grid; place-items: center; height: 100%; }
.chart-axis { display: flex; justify-content: space-between; color: var(--text-3); font-size: 11px; margin-top: 4px; }

/* One grid for all rows (rows are display: contents) so every track starts and ends together. */
.bars { display: grid; grid-template-columns: minmax(96px, 170px) 1fr max-content; gap: 8px 12px; align-items: center; }
.bar-row { display: contents; }
.bar-label { color: var(--text-2); font-size: 13px; }
.bar-track { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; background: var(--accent); min-width: 2px; }
.bars.tone-good .bar-fill { background: var(--good); }
.bar-value { text-align: right; font-weight: 500; }
.bar-note { color: var(--text-3); font-weight: 400; margin-left: 6px; font-size: 12px; }

.heat-table { font-size: 12.5px; }
.heat-table tbody th { font-weight: 500; color: var(--text-2); background: var(--surface); position: sticky; left: 0; }
.heat-table td.heat {
  text-align: center;
  background: rgba(var(--heat), var(--a));
  color: var(--text);
  border: 2px solid var(--surface);
  border-radius: 6px;
  min-width: 48px;
}
.heat-table td.heat.strong { color: var(--accent-ink); }
.heat-table td.heat.none { background: transparent; }

/* ---------- key-values, lists ---------- */

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; text-align: right; font-weight: 500; }

.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rank-list li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); align-items: baseline; }
.rank-list li:last-child { border-bottom: 0; }
.rank-list .pos { color: var(--text-3); font-size: 12px; text-align: right; }
.rank-list .count { font-weight: 600; }
.rank-list small { color: var(--text-3); margin-left: 6px; }

/* ---------- crash frames ---------- */

.frames { list-style: none; margin: 0; padding: 0; font-family: var(--mono); font-size: 12px; counter-reset: frame; }
.frames li {
  display: grid;
  grid-template-columns: 26px minmax(120px, 190px) 1fr;
  gap: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  counter-increment: frame;
  color: var(--text-2);
}
.frames li::before { content: counter(frame) ; color: var(--text-3); text-align: right; }
.frames li.ours { background: var(--accent-soft); color: var(--text); }
.frames .bin { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frames .addr { overflow-wrap: anywhere; }
.report-card { border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.report-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-2); font-size: 12.5px; }
.thread-title { font-size: 12px; color: var(--text-3); margin: 4px 0; }
.signature { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }

.evidence { margin-top: 4px; padding: 8px 10px; border-left: 2px solid var(--accent); background: var(--surface-2); border-radius: 0 6px 6px 0; white-space: pre-wrap; font-size: 13px; max-width: 520px; }

/* ---------- states ---------- */

.state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 70px 20px; color: var(--text-2); text-align: center; }
.state.error strong { color: var(--bad); }
.state.error p { max-width: 520px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { color: var(--text-3); padding: 40px 0; text-align: center; }

.gate { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 14vh 20px 40px; text-align: center; }
.gate img { border-radius: 16px; }
.gate h1 { font-size: 24px; }
.fine { color: var(--text-3); font-size: 13px; max-width: 380px; }

.notice { padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--text-2); }

/* ---------- drawer ---------- */

.drawer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); opacity: 0; transition: opacity 200ms ease; }
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100vw);
  background: var(--bg);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}
.drawer.open { pointer-events: auto; }
.drawer.open .drawer-scrim { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-grip { display: none; width: 36px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; flex: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.drawer-head h2 { font-size: 17px; }
.drawer-body { overflow-y: auto; padding: 16px 18px max(30px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; }
.drawer-body .grid.stats { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.drawer-body .stat-value { font-size: 20px; }

@media (prefers-reduced-motion: reduce) {
  .drawer-panel, .drawer-scrim { transition: none; }
  .spinner { animation-duration: 2.4s; }
}

/* ---------- small screens ---------- */

@media (max-width: 900px) {
  .side { display: none; }
  body.signed-in main { margin-left: auto; max-width: none; }
  .bar:not([hidden]) {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(16px);
    -webkit-backdrop-filter: saturate(1.4) blur(16px);
    border-bottom: 1px solid var(--line-soft);
  }
  .bar-title { font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bar-actions { display: flex; align-items: center; gap: 8px; }
  .ghost.icon-only { display: inline-flex; padding: 7px; border-radius: 10px; }
  .ghost.icon-only span { display: none; }
  .tabbar:not([hidden]) {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 30;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--side) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(16px);
    -webkit-backdrop-filter: saturate(1.4) blur(16px);
    border-top: 1px solid var(--line-soft);
  }
  .tabbar a, .tabbar button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--text-3);
    font-size: 10.5px;
    font-weight: 500;
    min-height: 44px;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar [aria-current] { color: var(--accent); }
  main { padding: 16px max(16px, env(safe-area-inset-right)) calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .page-head h1 { font-size: 22px; }
  body.signed-in .page-head h1 { display: none; }
  .page { gap: 14px; }
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-value { font-size: 21px; }
  .panel { padding: 14px 14px 16px; }
  .panel > .table-wrap { margin: 0 -14px -16px; }
  input[type="search"] { width: 100%; }
  .page-controls { width: 100%; }
  .page-controls > * { flex: 1; }
  .bars { grid-template-columns: 1fr; }
  .bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
  .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .frames li { grid-template-columns: 22px 1fr; }
  .frames .addr { grid-column: 2; }

  /* The detail drawer becomes a bottom sheet. */
  .drawer-panel {
    top: auto;
    left: 0;
    width: 100%;
    max-height: 88dvh;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
  }
  .drawer-grip { display: block; }
}

/* Tables of three or more columns: each row a card, each cell its column's name and value. */
@media (max-width: 640px) {
  .table-wrap.stacks { max-height: none; overflow: visible; }
  .table-wrap.stacks table, .table-wrap.stacks tbody, .table-wrap.stacks tr, .table-wrap.stacks td { display: block; }
  .table-wrap.stacks thead { display: none; }
  .table-wrap.stacks tbody tr { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
  .table-wrap.stacks tbody tr:last-child { border-bottom: 0; }
  .table-wrap.stacks td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 3px 0 !important;
    border: 0 !important;
    white-space: normal;
    text-align: right !important;
    min-width: 0;
    max-width: none;
  }
  .table-wrap.stacks td::before { content: attr(data-label); color: var(--text-3); font-size: 12.5px; text-align: left; flex: none; }
  .table-wrap.stacks td:first-child { font-weight: 600; font-size: 15px; padding-bottom: 6px !important; text-align: left !important; }
  .table-wrap.stacks td:first-child::before { display: none; }
  .table-wrap.stacks td.empty { justify-content: center; }
  .table-wrap.stacks td.empty::before { display: none; }
  .page > .table-wrap.stacks { overflow: hidden; }
  .clip { max-width: 60vw; }
}

/* ---------- page bits ---------- */

.trend { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.trend-head { display: flex; justify-content: space-between; align-items: baseline; color: var(--text-2); font-size: 13px; }
.trend-head b { color: var(--text); font-weight: 600; }
.results, .reports, .detail { display: flex; flex-direction: column; gap: 14px; }
code.big { font-size: 22px; }
.stat-text { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; letter-spacing: 0; }
details.report-card > summary { cursor: pointer; list-style: none; align-items: center; }
details.report-card > summary::-webkit-details-marker { display: none; }
details.report-card > summary::before { content: "▸"; color: var(--text-3); transition: transform 150ms ease; }
details.report-card[open] > summary::before { transform: rotate(90deg); }

/* Profile pictures: the drawer's header and a reported picture's evidence. */
.user-head { display: flex; align-items: center; gap: 14px; }
.avatar-large { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
.avatar-report { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.avatar-evidence { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }

/* ---------- System ---------- */

.live { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); animation: pulse 2s ease-out infinite; }
.live-dot.paused { background: var(--text-3); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }

.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow);
  overflow: hidden;
  color: var(--text);
  min-width: 0;
  --tone: var(--text-3);
}
.tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--tone); }
.tile.tone-good { --tone: var(--good); }
.tile.tone-warn { --tone: var(--warn); }
.tile.tone-bad { --tone: var(--bad); }
.tile-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.tile-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); flex: none; }
.tile.tone-bad .tile-dot { animation: pulse-bad 1.6s ease-out infinite; }
@keyframes pulse-bad { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 60%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
.tile-name { color: var(--text-2); font-weight: 600; }
.tile-state { margin-left: auto; color: var(--tone); font-weight: 600; }
.tile.tone-muted .tile-state { color: var(--text-3); }
.tile-value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.tile-sub { color: var(--text-3); font-size: 12px; }

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 18px 24px; }
.sub-head { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin: 16px 0 10px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-stats > div { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.mini-stats span { color: var(--text-3); font-size: 12px; }
.mini-stats b { font-size: 19px; font-weight: 600; }
.over { color: var(--bad); font-weight: 600; }
code.route { font-size: 12.5px; color: var(--text); }
.error-text { color: var(--bad); font-size: 12.5px; }
.job-name { font-weight: 500; }

.meters { display: flex; flex-direction: column; gap: 12px; }
.meter-row { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; align-items: baseline; }
.meter-label { color: var(--text-2); font-size: 13px; }
.meter-value { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.meter { grid-column: 1 / -1; position: relative; height: 8px; border-radius: 4px; background: var(--surface-2); }
.meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--good); min-width: 3px; }
.meter.level-watch .meter-fill { background: var(--warn); }
.meter.level-upgrade .meter-fill { background: var(--bad); }
.meter.level-none .meter-fill { background: var(--text-3); }
.meter-fill.ghost-fill { opacity: 0.3; }
.meter-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 1px; background: var(--warn); }
.meter-tick.upgrade { background: var(--bad); }
.meter-key { margin: 12px 0 14px; }

.issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.issue { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); color: var(--text); }
.issues li:last-child .issue { border-bottom: 0; }
.issue:hover { text-decoration: none; }
.issue:hover .issue-title { color: var(--accent); }
.issue-title { font-weight: 500; overflow-wrap: anywhere; }
.issue-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; color: var(--text-3); font-size: 12px; }

/* ---------- More sheet ---------- */

.more { display: flex; flex-direction: column; gap: 18px; }
.more-group .nav-heading { padding-left: 2px; }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.more-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  color: var(--text-2);
  font-weight: 500;
  font-size: 13px;
}
.more-item:hover { text-decoration: none; color: var(--text); }
.more-item[aria-current] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }
.more-signout { justify-content: center; }

@media (prefers-reduced-motion: reduce) {
  .live-dot, .tile.tone-bad .tile-dot { animation: none; }
}
