/* The admin panel's own pieces, on top of Basecoat and the dashboard theme
   (insightkit.css). A separate file because the panel's CSP allows no inline
   style. Dark by default, like the dashboard (Ch. 12 G2). */

:root {
  /* One series (the chart) and the two change directions. Checked with the
     dataviz validator against the card surface: each is at least 3:1 in its
     theme. The arrow and the words carry the direction too, never colour
     alone. */
  --bar: #b45309;
  --good: #15803d;
  --bad: #e40014;
}
.dark {
  --bar: #f0a04b;
  --good: #4ade80;
  --bad: #ff7176;
}

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted-foreground); }
.cnt { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- top bar ------------------------------------------------------------- */
.admin-top {
  position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 20px;
  display: flex; align-items: center; gap: 14px;
  background: var(--background); border-bottom: 1px solid var(--border);
}
.admin-top .brand { font-weight: 700; letter-spacing: -.32px; white-space: nowrap; }
.admin-top .brand span { color: var(--logo-accent); }
.admin-top .brand small { margin-left: 6px; font-weight: 600; color: var(--muted-foreground); }
.admin-top nav { display: flex; gap: 2px; }
.admin-top nav a { padding: 5px 12px; border-radius: var(--radius-full); font-size: 13px; color: var(--muted-foreground); }
.admin-top nav a:hover { color: var(--foreground); }
.admin-top nav a[aria-current] { background: var(--card); color: var(--foreground); font-weight: 600; }
.admin-top .host { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted-foreground); }
.admin-top .who { font-size: 13px; }
.admin-top form { margin: 0; }
main.admin { margin: 0 auto; }

/* ---- sign-in ------------------------------------------------------------- */
.signin-box { max-width: 380px; margin: 12vh auto 0; }
.signin-box .or { text-align: center; color: var(--muted-foreground); font-size: 12px; margin: 12px 0; }
.signin-box .btn.wide { width: 100%; }
.signin-box footer { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted-foreground); }

/* ---- overview: tiles ---------------------------------------------------- */
.tilegroup { margin-bottom: 22px; }
.tilegroup > h2 { font-size: 13px; font-weight: 600; color: var(--muted-foreground); margin: 0 0 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile { background: var(--card); border-radius: var(--radius-xl); padding: 14px 16px; }
.tile .tlabel { font-size: 13px; color: var(--muted-foreground); }
.tile .value { font-size: 30px; font-weight: 600; letter-spacing: -.8px; line-height: 1.2; margin: 2px 0 6px; }
.tile .delta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 12px; color: var(--foreground); }
.tile .delta .arrow { font-size: 10px; color: var(--muted-foreground); }
.tile .delta.good .arrow { color: var(--good); }
.tile .delta.bad .arrow { color: var(--bad); }
.tile .delta .vs { color: var(--muted-foreground); }
.tile .sub, .tile .note { font-size: 12px; color: var(--muted-foreground); margin-top: 4px; }
.tile .note { font-style: italic; }
.pending-card { background: transparent; border: 1.5px dashed var(--ring); }
.footnote { font-size: 12px; color: var(--muted-foreground); max-width: 760px; }

/* ---- overview: chart ----------------------------------------------------- */
.chartcard { margin-bottom: 22px; }
.barchart svg { display: block; width: 100%; height: auto; max-width: 960px; }
.barchart .grid line, .barchart .baseline { stroke: var(--border); stroke-width: 1; }
.barchart text { fill: var(--muted-foreground); font-size: 11px; font-family: var(--font-sans); }
.barchart .bar path { fill: var(--bar); }
.barchart .bar .hit { fill: transparent; }
.barchart .bar:hover path, .barchart .bar:focus path { opacity: .72; }
.barchart .bar:focus { outline: none; }
.barchart .bar:focus .hit { fill: color-mix(in oklab, var(--bar) 12%, transparent); }
.tableview { margin-top: 10px; font-size: 13px; }
.tableview summary { cursor: pointer; color: var(--muted-foreground); }
.tableview table { margin-top: 8px; max-width: 360px; }

/* ---- users --------------------------------------------------------------- */
.usersearch { margin-bottom: 10px; }
.usersearch .input { width: 280px; }
.usersearch .select { width: auto; }
.tablewrap { overflow-x: auto; }
table.users td { vertical-align: top; }
table.users .acct b { display: block; font-weight: 600; }
table.users small, table.facts small { display: block; color: var(--muted-foreground); font-size: 12px; }
table.users th a { color: inherit; }
table.users th a[aria-current] { color: var(--foreground); font-weight: 600; }
.badge.plan.lifetime { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.badge.plan.pro { color: var(--foreground); }
.badge.plan.free { color: var(--muted-foreground); }
.split2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.split2 > .card { margin: 0; }

@media (max-width: 860px) {
  .split2 { grid-template-columns: 1fr; }
  .admin-top .host, .admin-top .who { display: none; }
}
@media (max-width: 520px) {
  .admin-top { padding: 0 12px; gap: 8px; }
  .usersearch .input { width: 100%; }
  /* The SVG scales with its width, its text too; at phone width 11 units
     would be about 4px. Larger units keep the axis readable there. */
  .barchart text { font-size: 22px; }
}
