/* Clever storefront — one stylesheet, no framework.
 *
 * **CSS custom properties rather than utility classes**, matching `admin.html`, so
 * the two surfaces read as one product and a colour is changed in one place.
 * Dark by default: this is a developer tool, and the operator dashboard already is.
 */

:root {
  --bg: #0b1220;
  --panel: #111b2e;
  --panel-2: #16233b;
  --line: #24324d;
  --ink: #e8eefc;
  --dim: #93a4c4;
  --faint: #64748b;
  --good: #4ade80;
  --bad: #f87171;
  --warn: #fbbf24;
  --accent: #5eead4;
  --accent-ink: #042f2e;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f9fc; --panel: #fff; --panel-2: #f0f4fa; --line: #dde5f0;
    --ink: #0d1526; --dim: #4a5b78; --faint: #7a8aa3; --accent-ink: #042f2e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- shell -------------------------------------------------------------- */

header.site {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); z-index: 10;
}
header.site .brand { font-weight: 700; letter-spacing: -0.02em; font-size: 1.05rem; color: var(--ink); }
header.site nav { display: flex; gap: 1.25rem; margin-left: auto; align-items: center; flex-wrap: wrap; }
header.site nav a { color: var(--dim); font-size: 0.92rem; }
header.site nav a:hover, header.site nav a[aria-current="page"] { color: var(--ink); text-decoration: none; }

main { max-width: 62rem; margin: 0 auto; padding: 2.5rem 1.5rem 5rem; }
main.narrow { max-width: 32rem; }
footer.site {
  border-top: 1px solid var(--line); margin-top: 4rem;
  padding: 1.5rem; color: var(--faint); font-size: 0.85rem; text-align: center;
}

/* --- type --------------------------------------------------------------- */

h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.15; letter-spacing: -0.03em; margin: 0 0 0.6rem; }
h2 { font-size: 1.25rem; letter-spacing: -0.01em; margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 1.5rem 0 0.5rem; }
p.lede { font-size: 1.1rem; color: var(--dim); margin: 0 0 1.75rem; max-width: 44rem; }
.muted { color: var(--dim); }
.faint { color: var(--faint); font-size: 0.85rem; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--panel-2); padding: 0.1em 0.35em; border-radius: 4px; }
pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; overflow-x: auto; }
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

/* --- components --------------------------------------------------------- */

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }

.grid { display: grid; gap: 1rem; }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }

.plan { display: flex; flex-direction: column; gap: 0.5rem; }
.plan.featured { border-color: var(--accent); }
.plan .price { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; }
.plan .price small { font-size: 0.9rem; font-weight: 400; color: var(--dim); }
.plan ul { margin: 0; padding-left: 1.1rem; color: var(--dim); font-size: 0.92rem; }
.plan li { margin: 0.2rem 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 0.75rem; margin: 1rem 0 1.5rem; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 0.9rem; }
.kpi .label { font-size: 0.75rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi .value { font-size: 1.3rem; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 0.15rem; }
.kpi .value.good { color: var(--good); }
.kpi .value.bad { color: var(--bad); }

/* A usage bar, because a percentage hides the period. */
.meter { background: var(--panel-2); border-radius: 999px; height: 0.55rem; overflow: hidden; border: 1px solid var(--line); }
.meter > span { display: block; height: 100%; background: var(--accent); }
.meter.warn > span { background: var(--warn); }
.meter.bad > span { background: var(--bad); }
.meter-label { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--dim); margin-bottom: 0.3rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); }
th { color: var(--faint); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

label { display: block; font-size: 0.88rem; color: var(--dim); margin-bottom: 0.85rem; }
label span.name { display: block; margin-bottom: 0.3rem; }
input, select, textarea {
  width: 100%; padding: 0.6rem 0.7rem; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input[type=checkbox] { width: auto; }

button {
  padding: 0.6rem 1.1rem; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.06); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
button.danger { background: transparent; color: var(--bad); border-color: var(--bad); }

.notice { padding: 0.75rem 0.9rem; border-radius: 8px; font-size: 0.9rem; margin: 1rem 0; border: 1px solid; }
.notice.info { background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: var(--accent); }
.notice.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: var(--bad); }
.notice.good { background: color-mix(in srgb, var(--good) 12%, transparent); border-color: var(--good); }
.notice.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: var(--warn); }

.row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

.chat { display: flex; flex-direction: column; gap: 0.75rem; }
.bubble { padding: 0.8rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; }
.bubble.them { background: var(--panel); }
.bubble.me { background: var(--panel-2); border-color: var(--accent); }

.pill { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em; }
.pill.trialing { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.pill.expired { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.pill.entitled { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }

/* --- docs --------------------------------------------------------------- */

.docs-nav { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; font-size: 0.9rem; }
.endpoint { font-family: var(--mono); font-size: 0.85rem; }
.endpoint .verb { color: var(--accent); font-weight: 700; }

.hidden { display: none !important; }
