/* Hypercharge admin panel.
   Mirrors the Home Club app's palette: Hypercharge orange on white, navy ink
   for text, with the app's own accent hexes rather than approximations. Values
   come from the app's theme.js (see the hypercharge-design skill).
     ember  #ea3c1e  primary accent / CTA        ink       #001629  headings
     paper  #ffffff  cards                       mist      #eff7fb  page bg
     slate  #547590  secondary text              border    #dbe6ef  hairlines
     seafoam #04ac8f money-positive              link      #2b73da  informational */

:root {
  --bg: #eff7fb;
  --panel: #ffffff;
  --panel-2: #f5f7f9;
  --panel-3: #e8f1f8;
  --border: #dbe6ef;
  --text: #001629;
  --text-2: #3d546d;
  --muted: #547590;
  --accent: #ea3c1e;
  --accent-dark: #c53c1a;
  --accent-wash: #fdeeea;
  --ok: #04ac8f;
  --info: #2b73da;
  --warn: #b27a12;
  --fault: #c53c1a;
  --radius: 12px;
  --s1: 6px; --s2: 12px; --s3: 18px; --s4: 26px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 1px 2px rgba(0, 22, 41, .04), 0 4px 14px rgba(0, 22, 41, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

/* ─── App shell ─────────────────────────────────────────────────────────── */

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: var(--s3) var(--s2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  font-size: 15px;
  font-weight: 600;
  padding: 0 var(--s2) var(--s4);
  letter-spacing: .2px;
  color: var(--text);
}
.brand span { color: var(--accent); }

.nav-link {
  display: block;
  padding: 9px var(--s2);
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.nav-link:hover { background: var(--panel-2); color: var(--text); }
.nav-link.active { background: var(--accent); color: #fff; }

.sidebar-footer {
  margin-top: auto;
  padding: var(--s2);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

main { padding: var(--s4); max-width: 1400px; }

h1 { font-size: 22px; margin: 0 0 var(--s3); font-weight: 600; letter-spacing: -.2px; }
h2 { font-size: 15px; margin: 0 0 var(--s2); font-weight: 600; }

/* ─── Cards, tiles, tables ──────────────────────────────────────────────── */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s3);
  margin-bottom: var(--s3);
  box-shadow: var(--shadow);
}

/* auto-fit rather than a hardcoded 3: the dashboard went from 6 tiles to 8 when the
   lifecycle gained a fourth stage plus a total, and a fixed column count leaves a
   ragged last row every time the tile count changes. */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s2); margin-bottom: var(--s3); }
.tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s3);
  box-shadow: var(--shadow);
}
.tile .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.tile .value { font-size: 28px; font-weight: 600; margin-top: var(--s1); color: var(--text); letter-spacing: -.5px; }
.tile .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px var(--s2); border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
tr.clickable { cursor: pointer; }
.table-wrap { overflow-x: auto; }

/* ─── Pills, buttons, forms ─────────────────────────────────────────────── */

.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.pill-ok    { background: rgba(4,172,143,.13);  color: #04705e; }
.pill-info  { background: rgba(43,115,218,.11); color: #1f5bb0; }
.pill-warn  { background: rgba(246,183,60,.18); color: #8a5d0a; }
.pill-fault { background: rgba(197,60,26,.11);  color: var(--fault); }
.pill-muted { background: var(--panel-3);       color: var(--muted); }
.pill-accent{ background: var(--accent-wash);   color: var(--accent-dark); }

button {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
button.primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
button.danger:hover:not(:disabled) { border-color: var(--fault); color: var(--fault); }
button.small { padding: 5px 10px; font-size: 12px; }

input, select {
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
input::placeholder { color: var(--slateLight, #aab8c8); }

.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.note {
  background: var(--panel-3);
  border-left: 3px solid var(--info);
  border-radius: 0 8px 8px 0;
  padding: var(--s2);
  color: var(--text-2);
  font-size: 13px;
}
.error-text { color: var(--fault); }
.ok-text { color: #04705e; }
/* Same amber as .pill-warn, for text that is wrong but not in the expensive
   direction (Reconciliation uses it where the app UNDER-reports). */
.warn-text { color: #8a5d0a; }

/* ─── Login page ────────────────────────────────────────────────────────── */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--s3); }
.login-card { width: 100%; max-width: 360px; }
.login-card .field { display: block; margin-bottom: var(--s2); }
.login-card label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.login-card input { width: 100%; }
.login-card button { width: 100%; margin-top: var(--s1); }

/* ─── Tabs, numeric columns, banners ────────────────────────────────────── */

.tab {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-weight: 600;
}
.tab:hover:not(.active) { background: var(--panel-2); color: var(--text); }
.tab.active { background: var(--accent-wash); border-color: var(--accent-wash); color: var(--accent-dark); }

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.banner {
  display: flex;
  gap: var(--s2);
  align-items: flex-start;
  border-radius: var(--radius);
  padding: var(--s2) var(--s3);
  margin-bottom: var(--s3);
  font-size: 13px;
}
.banner-warn { background: rgba(246,183,60,.16); border: 1px solid rgba(246,183,60,.4); color: #6b4708; }
.banner strong { display: block; margin-bottom: 2px; }

/* ─── Charger detail ────────────────────────────────────────────────────── */

.detail-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--s2);
}
.detail-head-left { display: flex; align-items: center; gap: var(--s2); }
.detail-head-mid { text-align: center; }
.detail-head-right { text-align: right; }
.detail-title { font-size: 20px; font-weight: 600; }
.detail-title code { background: none; border: none; padding: 0; font-size: 20px; }

.back {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 17px;
  flex: none;
}
.back:hover { border-color: var(--accent); color: var(--accent); }

.pill-lg { font-size: 14px; padding: 6px 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); }
.stat { background: var(--panel-2); border-radius: 10px; padding: var(--s2) var(--s3); }
.stat .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.stat .value { font-size: 19px; font-weight: 600; margin-top: 3px; }
.stat .sub { color: var(--muted); font-size: 11px; margin-top: 2px; }

.event-log { display: flex; flex-direction: column; gap: 2px; }
.evt { display: flex; align-items: baseline; gap: var(--s2); padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.evt:last-child { border-bottom: none; }
.evt-time { flex: none; min-width: 118px; }
.evt-text { flex: 1; }
.evt-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--slateLight, #aab8c8); transform: translateY(-1px); }
.evt-dot.evt-ok { background: var(--ok); }
.evt-dot.evt-info { background: var(--info); }
.evt-dot.evt-warn { background: #d99a1f; }
.evt-dot.evt-fault { background: var(--fault); }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-head { grid-template-columns: 1fr; }
  .detail-head-mid, .detail-head-right { text-align: left; }
}

/* ─── Charts ────────────────────────────────────────────────────────────── */

.chart-row { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s3); }
.chart-row .card { margin-bottom: var(--s3); }

.chart-host { position: relative; }
.chart-host svg { display: block; overflow: visible; }

.chart-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: var(--text);
  color: #fff;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 22, 41, .22);
}
.chart-tip .muted { color: rgba(255, 255, 255, .68); }

.donut-wrap { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.legend { flex: 1; min-width: 170px; }
.legend-row { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; font-size: 13px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; transform: translateY(1px); }
.legend-label { color: var(--muted); }
.legend-value { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 500; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}

@media (max-width: 1100px) {
  .chart-row { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; align-items: center; }
  .sidebar-footer, .brand { display: none; }
  .tile-grid { grid-template-columns: 1fr; }
  main { padding: var(--s2); }
}

/* ─── Lifecycle pills (2026-08-18) ────────────────────────────────────────────
   Deliberately NOT the .pill-ok/info/warn tonal family used by HC.status.pill.
   Those two systems were both drawn from the same five tones and every stage
   collided with a monitoring state: Activated/Ready both green, Shipped/Charging
   both blue, In stock/Not connected both grey. Reported as "Ready and Activated
   look like the same thing", which they did.

   The rule: COLOUR CARRIES URGENCY, and lifecycle has none. Being "In stock" is
   not worse than being "Activated", it is just earlier - whereas "Fault" really
   is worse than "Ready". So lifecycle reads as a neutral progression (increasing
   ink weight, left to right) and never competes with a status colour. */
.pill-stage {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.pill-stage::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
  background: currentColor;
  opacity: .55;
}
.pill-stage-1 { color: var(--muted); }
.pill-stage-2 { color: var(--text-2); border-color: #cbd9e6; }
.pill-stage-3 { color: var(--text-2); border-color: #b6c9da; background: var(--panel-2); }
.pill-stage-4 { color: var(--text); border-color: #a8bfd2; background: var(--panel-3); }
/* Not a stage at all: booted with no pre-registration row. An anomaly, so it is
   the one lifecycle pill allowed to borrow a warning tone. */
.pill-stage-alert { color: var(--fault); border-color: #eccfc7; background: #fdeeea; }
