/* Dfive Admin - cost & ops dashboard.
   Deliberately plain: no framework, no web fonts (the CSP allows neither
   remote script nor remote fonts), and a palette that works in both schemes. */

:root {
  --bg: #ffffff;
  --panel: #f7f8fa;
  --line: #e3e6eb;
  --ink: #16181d;
  --muted: #6b7280;
  --accent: #2563eb;
  --warn: #b91c1c;
  --ok: #15803d;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141a;
    --panel: #191c23;
    --line: #2a2f3a;
    --ink: #e8eaed;
    --muted: #9aa2b1;
    --accent: #60a5fa;
    --warn: #f87171;
    --ok: #4ade80;
  }
}

* { box-sizing: border-box; }

/* The `hidden` attribute is how every pane and the sign-in gate get toggled,
   and it only works through the UA stylesheet's `display: none` - which ANY
   author `display` rule outranks. `.gate` sets `display: grid` to centre the
   card, so without this the gate stays on screen after sign-in, covering the
   dashboard. Keep this rule above everything that sets `display`. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

code { font-size: 0.9em; background: var(--panel); padding: 1px 4px; border-radius: 4px; }

/* ----- sign-in gate ------------------------------------------------------ */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 360px;
  text-align: center;
}
.gate-card h1 { margin: 0 0 8px; font-size: 20px; }
.gate-card p { margin: 0 0 20px; color: var(--muted); }

/* ----- chrome ------------------------------------------------------------ */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.tabs { display: flex; gap: 4px; }
.tab {
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 6px 12px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}
.tab:hover { background: var(--panel); color: var(--ink); }
.tab.active { background: var(--panel); color: var(--ink); font-weight: 600; }

main { padding: 24px; max-width: 1100px; margin: 0 auto; }
.pane-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.pane-head > div:first-child { flex: 1; }
.pane-head h2 { margin: 0 0 2px; font-size: 18px; }
.pane-head p { margin: 0; font-size: 13px; }

h3 { font-size: 14px; margin: 28px 0 8px; text-transform: uppercase;
     letter-spacing: 0.04em; color: var(--muted); }

.muted { color: var(--muted); font-size: 13px; }
.note {
  background: var(--panel);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  margin: 0 0 20px;
}
.error { color: var(--warn); font-size: 13px; }

/* ----- buttons ----------------------------------------------------------- */
.btn {
  font: inherit;
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: none; }

/* ----- cards ------------------------------------------------------------- */
.cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card {
  flex: 1 1 160px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.card-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.card-value { font-size: 22px; font-variant-numeric: tabular-nums; }

/* ----- tables ------------------------------------------------------------ */
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--line);
}
.grid td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid tr:last-child td { border-bottom: 0; }
.up { color: var(--warn); }
.down { color: var(--ok); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 720px) { .split { grid-template-columns: 1fr; } }

/* ----- trend bars -------------------------------------------------------- */
.trend { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.trend-bar {
  width: 100%;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  opacity: 0.85;
}
.trend-label { font-size: 10px; color: var(--muted); white-space: nowrap; }

/* ----- tag audit --------------------------------------------------------- */
.acct {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.acct-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.acct-head strong { font-size: 15px; }
.bar { height: 6px; background: var(--line); border-radius: 3px; margin: 10px 0; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ok); }
.arn-list { margin: 10px 0 0; padding: 0; list-style: none;
            font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.arn-list li { padding: 3px 0; color: var(--muted); overflow-wrap: anywhere; }

/* ----- feature requests -------------------------------------------------- */
.fr {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.fr-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
}
.chip.open { border-color: var(--accent); color: var(--accent); }
.chip.shipped { border-color: var(--ok); color: var(--ok); }
.chip.declined { opacity: 0.7; }
.fr-body { white-space: pre-wrap; }

.foot { padding: 16px 24px; border-top: 1px solid var(--line); }
