:root {
  --ink: #0c1612;
  --panel: #16241d;
  --line: rgba(243, 238, 228, 0.12);
  --cream: #f3eee4;
  --mute: #b7c3b8;
  --dim: #7d8c80;
  --brass: #ff4d42;
  --gold: #e8c27a;
  --ok: #8adf6a;
  --red: #ff6b62;
  --display: "Fraunces", Georgia, serif;
  --ui: "Outfit", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--ink); color: var(--cream); font-family: var(--ui); font-size: 15px; line-height: 1.55; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: #fff; }
h1, h2, h3 { font-family: var(--display); margin: 0 0 .35em; letter-spacing: -0.03em; line-height: 1.12; font-weight: 560; }
p { margin: 0 0 1em; }
.admin-shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.admin-side {
  background: #09130f; border-right: 1px solid var(--line);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--cream); font-family: var(--display); font-weight: 680; letter-spacing: .06em; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--brass); box-shadow: inset 0 -8px 0 rgba(0,0,0,.15); }
.side-nav { display: grid; gap: 3px; }
.side-nav a { color: var(--mute); padding: 8px 12px; border-radius: 9px; font-weight: 500; }
.side-nav a:hover, .side-nav a.is-active { background: rgba(225, 6, 0, .16); color: #fff; }
.side-user { margin-top: auto; font-size: 13px; color: var(--dim); }
.side-user a { color: var(--mute); }
.admin-main { padding: 32px 36px 72px; max-width: 1120px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 2rem; margin: 0; }
.muted, .hint { color: var(--mute); }
.hint { font-size: 13.5px; }
.btn {
  appearance: none; border: 1px solid var(--line); cursor: pointer; font: inherit; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; padding: 10px 16px;
  text-decoration: none; color: var(--cream); background: transparent;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn-primary { background: var(--brass); color: #fff; border-color: var(--brass); }
.btn-primary:hover { background: #ff2a1a; color: #fff; }
.btn-danger { background: transparent; color: var(--red); border-color: rgba(255,107,98,.4); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.flash-ok { background: rgba(138, 223, 106, .12); color: var(--ok); }
.flash-error { background: rgba(255, 77, 66, .14); color: #ffb0aa; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.card h2 { font-size: 1.25rem; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 6px; font-size: 13px; color: var(--mute); font-weight: 600; }
.form input, .form select, .form textarea {
  width: 100%; font: inherit; color: var(--cream); background: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.form textarea { min-height: 90px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--brass); }
.form label:has(input[type="checkbox"]) { display: flex; align-items: center; gap: 8px; }
.form input[type="checkbox"] { width: auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat b { display: block; font-family: var(--display); font-size: 1.7rem; color: var(--gold); line-height: 1; margin-bottom: 6px; }
.stat span { color: var(--mute); font-size: 13px; }
.stat .cmp { margin-top: 8px; font-size: 12px; color: var(--dim); }
.delta { font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.delta.up { color: var(--ok); background: rgba(138,223,106,.12); }
.delta.down { color: #ffb0aa; background: rgba(255,77,66,.14); }
.delta.flat { color: var(--dim); }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tablist { width: 100%; border-collapse: collapse; font-size: 14px; }
.tablist th, .tablist td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tablist th { color: var(--dim); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.tablist input, .tablist select { width: 100%; font: inherit; color: var(--cream); background: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; }
.pill { font-size: 11px; letter-spacing: .04em; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--mute); }
.pill.on { color: var(--gold); border-color: rgba(232,194,122,.45); }
.pill.off { opacity: .55; }
.donut-box { display: flex; align-items: center; gap: 18px; margin-top: 8px; }
.donut-chart { width: 168px; height: 168px; position: relative; flex: 0 0 168px; }
.donut-ring { width: 100%; height: 100%; border-radius: 50%; }
.donut-hole {
  position: absolute; inset: 23%; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.donut-hole b { font-family: var(--display); font-size: 22px; line-height: 1; color: var(--cream); }
.donut-hole span { font-size: 11px; color: var(--mute); margin-top: 3px; }
.donut-legend { flex: 1; min-width: 0; }
.donut-legend .lg { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.donut-legend .lg:last-child { border-bottom: 0; }
.donut-legend i { width: 8px; height: 8px; border-radius: 50%; }
.donut-legend .pct { color: var(--dim); }
.donut-legend .ct { color: var(--gold); font-weight: 650; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 130px; margin-top: 8px; }
.bars .bar { flex: 1; background: linear-gradient(180deg, #ffb0aa, var(--brass)); min-height: 2px; border-radius: 3px 3px 0 0; position: relative; }
.bars .bar span {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: #09130f; color: var(--cream); font-size: 11px; padding: 2px 6px; border-radius: 6px;
  white-space: nowrap; opacity: 0; pointer-events: none;
}
.bars .bar:hover span { opacity: 1; }
.barx { display: flex; justify-content: space-between; color: var(--dim); font-size: 11px; margin-top: 6px; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(600px 280px at 50% 0%, rgba(225,6,0,.25), transparent 60%), var(--ink); }
.login-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px 24px; }
.demo-access { margin-top: 16px; padding: 12px 14px; border: 1px dashed rgba(232,194,122,.35); border-radius: 12px; }
.demo-access p { margin: 0 0 6px; letter-spacing: .14em; text-transform: uppercase; font-size: 11px; color: var(--dim); }
.demo-access code { color: var(--gold); font-size: 14px; }
@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; }
  .side-nav { grid-template-columns: repeat(2, 1fr); }
  .side-user { margin-top: 8px; }
  .admin-main { padding: 20px 16px 48px; }
  .stats, .twocol, .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .donut-box { flex-direction: column; align-items: flex-start; }
  .page-head { flex-direction: column; align-items: start; }
  .tablist { display: block; overflow-x: auto; }
}
