/* AuthGuard design system: charcoal surfaces, off-white text, one violet accent. */
:root {
  --bg: #0e1013;
  --surface: #15181d;
  --surface-2: #1a1e24;
  --surface-hover: #1c2128;
  --border: #232830;
  --border-hover: #343c48;

  --text: #e9ebee;
  --text-dim: #b6bdc8;
  --muted: #8a93a1;

  --accent: #7367f0;
  --accent-hover: #8478ff;
  --accent-soft: rgba(115, 103, 240, 0.12);
  --accent-line: rgba(115, 103, 240, 0.35);

  --ok: #3fb950;
  --ok-soft: rgba(63, 185, 80, 0.12);
  --warn: #d2a022;
  --warn-soft: rgba(210, 160, 34, 0.12);
  --bad: #f0616d;
  --bad-soft: rgba(240, 97, 109, 0.12);

  --radius: 10px;
  --radius-lg: 14px;
  --speed: 150ms;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a.link { color: var(--text-dim); }
a.link:hover { color: var(--text); }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: 28px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0; }

.muted { color: var(--muted); }
.dim { color: var(--text-dim); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono, code, pre {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.right { margin-left: auto; }
.nowrap { white-space: nowrap; }

/* ---------- layout ---------- */

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 880px; }

.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-top { align-items: flex-start; }
.spread { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* Sized so the six overview tiles sit on one row at full width. */
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 14px; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(14, 16, 19, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .wrap { display: flex; align-items: center; gap: 22px; height: 58px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.02em; }
.brand .mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  display: grid; place-items: center;
  color: var(--accent);
}
.brand .mark svg { width: 15px; height: 15px; }

.topnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topnav a {
  padding: 7px 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  transition: color var(--speed), background var(--speed);
}
.topnav a:hover { color: var(--text); background: var(--surface-2); }
.topnav a.on { color: var(--text); background: var(--surface-2); }

.whoami {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  padding-left: 14px; border-left: 1px solid var(--border);
}

/* ---------- surfaces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); }

.hoverable { transition: border-color var(--speed), background var(--speed); }
.hoverable:hover { border-color: var(--border-hover); background: var(--surface-2); }

/* ---------- hero ---------- */

.hero { padding: 72px 0 40px; }
.hero h1 {
  font-size: clamp(34px, 5.2vw, 50px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 18px 0 14px;
}
.hero p.lead { color: var(--muted); font-size: 17px; max-width: 580px; }
.hero .actions { margin-top: 26px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: #b3abff;
  font-size: 12.5px;
}

/* ---------- buttons ---------- */

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--speed), border-color var(--speed), color var(--speed);
  white-space: nowrap;
}
button:hover, .btn:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.5; cursor: default; }

.btn-light { background: #edeef2; color: #14161a; }
.btn-light:hover { background: #fff; }

.btn-ghost, button.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover, button.ghost:hover { background: var(--surface-2); border-color: var(--border-hover); }

button.danger { background: transparent; border-color: var(--border); color: var(--bad); }
button.danger:hover { background: var(--bad-soft); border-color: var(--bad); }

button.sm, .btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
button.icon { padding: 6px; width: 30px; height: 30px; }

.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- forms ---------- */

label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
label.check { display: inline-flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 14px; margin: 0; }
label.check input { width: auto; margin: 0; }

input, select, textarea {
  width: 100%;
  padding: 8px 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color var(--speed), box-shadow var(--speed);
}
input::placeholder, textarea::placeholder { color: #5e6673; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 76px; resize: vertical; }
.field { min-width: 150px; flex: 1; }
.field.grow { flex: 2; }
.field.fixed { flex: 0 0 150px; min-width: 0; }

.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }

.error { color: var(--bad); font-size: 13px; min-height: 18px; }
.notice { color: var(--ok); font-size: 13px; min-height: 18px; }

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

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; white-space: nowrap; font-size: 13.5px; }
th {
  color: var(--muted);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.wrap-cell { white-space: normal; word-break: break-word; max-width: 280px; }

.empty { padding: 26px 18px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ---------- badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.active, .badge.valid, .badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.revoked, .badge.banned, .badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.expired, .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.unused, .badge.neutral { background: var(--surface-2); color: var(--muted); }
.badge.accent { background: var(--accent-soft); color: #b3abff; }

/* ---------- stats ---------- */

.stat { padding: 15px 16px; }
.stat .label {
  font-size: 11.5px; color: var(--muted);
  letter-spacing: 0.05em; text-transform: uppercase;
}
.stat .value { font-size: 25px; font-weight: 600; letter-spacing: -0.02em; margin-top: 5px; }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- chart ---------- */

.chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.chart .bar { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 100%; }
.chart .seg { border-radius: 2px; min-height: 0; }
.chart .seg.ok { background: var(--accent); }
.chart .seg.bad { background: var(--bad); }
.chart .rest { flex: 1; background: var(--surface-2); border-radius: 2px; min-height: 2px; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ---------- event feed ---------- */

.events { max-height: 360px; overflow-y: auto; }
.event {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.event:last-child { border-bottom: 0; }
.event:hover { background: var(--surface-2); }
.event .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.event .dot.ok { background: var(--ok); }
.event .dot.bad { background: var(--bad); }
.event .when { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---------- tabs ---------- */

.tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
}
.tabs button {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 6px 13px;
  font-size: 13.5px;
  border-radius: 7px;
}
.tabs button:hover { background: var(--surface-2); color: var(--text); }
.tabs button.on { background: var(--surface-hover); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }

/* ---------- code ---------- */

pre {
  margin: 0;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.6;
  color: var(--text-dim);
}
pre .k { color: #b3abff; }
pre .s { color: #7fd1a0; }
pre .c { color: #68717f; }

.copyrow {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.copyrow .val { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; color: var(--text-dim); }

.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px 16px; align-items: center; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }

/* ---------- misc ---------- */

.sep { height: 1px; background: var(--border); border: 0; margin: 0; }
.auth-card { max-width: 400px; margin: 70px auto; }
.footer { border-top: 1px solid var(--border); margin-top: 56px; padding: 22px 0; color: var(--muted); font-size: 13px; }

.endpoint { display: flex; align-items: baseline; gap: 10px; font-size: 13.5px; }
.method {
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em;
  padding: 2px 7px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-dim);
  border: 1px solid var(--border);
}
.method.post { color: #b3abff; }
.method.get { color: #7fd1a0; }
.method.del { color: var(--bad); }

[hidden] { display: none !important; }

/* ---------- motion ----------
   Hover feedback is a small lift plus a border that warms up. Everything animates
   transform and colour only, so nothing reflows while the pointer moves. */

.hoverable {
  transition:
    border-color var(--speed) var(--ease),
    background var(--speed) var(--ease),
    transform var(--speed) var(--ease);
  will-change: transform;
}
.hoverable:hover { transform: translateY(-2px); border-color: var(--border-hover); }

.card.stat.hoverable:hover { border-color: var(--accent-line); }
.card.stat .value { transition: color var(--speed) var(--ease); }
.card.stat.hoverable:hover .value { color: #cfc9ff; }

button, .btn {
  transition:
    background var(--speed) var(--ease),
    border-color var(--speed) var(--ease),
    color var(--speed) var(--ease),
    transform var(--speed) var(--ease);
}
button:hover, .btn:hover { transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); transition-duration: 60ms; }
button:disabled:hover { transform: none; }

/* The arrow on the hero call to action leans the way it points. */
.btn .arrow { transition: transform var(--speed) var(--ease); }
.btn:hover .arrow { transform: translate(2px, -2px); }

/* Nav links grow an underline from the centre. */
.topnav a { position: relative; }
.topnav a::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 3px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--speed) var(--ease);
}
.topnav a:hover::after, .topnav a.on::after { transform: scaleX(1); }

.brand .mark { transition: transform var(--speed) var(--ease), border-color var(--speed) var(--ease); }
.brand:hover .mark { transform: rotate(-6deg) scale(1.06); border-color: var(--accent); }

/* Table rows pick up an accent edge instead of shifting position. */
tbody tr { transition: background var(--speed) var(--ease), box-shadow var(--speed) var(--ease); }
tbody tr:hover { box-shadow: inset 2px 0 0 var(--accent); }

.event { transition: background var(--speed) var(--ease), transform var(--speed) var(--ease); }
.event:hover { transform: translateX(3px); }

.tabs button { transition: background var(--speed) var(--ease), color var(--speed) var(--ease); }

.copyrow { transition: border-color var(--speed) var(--ease); }
.copyrow:hover { border-color: var(--border-hover); }

a.link {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  transition: background-size var(--speed) var(--ease), color var(--speed) var(--ease);
}
a.link:hover { background-size: 100% 1px; }

input, select, textarea { transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease); }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
  .hoverable:hover, button:hover, .btn:hover, .event:hover { transform: none; }
}

@media (max-width: 900px) {
  .split, .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .topbar .wrap { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; gap: 10px; }
  .whoami { padding-left: 0; border-left: 0; }
  .hero { padding: 48px 0 32px; }
}
