/* The platform's sign-up site and SaaS admin: flat, compact surfaces on warm paper, with one accent for actions. */
:root {
  --paper: #f7f7f4; --surface: #ffffff; --sunken: #f1f1ed; --ink: #17181c; --ink-2: #4b4f58; --ink-3: #6f7480; --line: #e4e4df; --line-soft: #efefea;
  --accent: #4f46e5; --accent-hover: #4338ca; --accent-soft: #eeeefc; --on-accent: #ffffff;
  --rail: #15161b; --rail-2: #24262e; --rail-ink: #a7aab5; --rail-strong: #f4f4f1;
  --green: #0f7a55; --amber: #b45309; --red: #b91c1c; --blue: #2563eb; --grey: #8b909c;
  --warn-bg: #fdf4e3; --warn-ink: #7c4a06;
  --radius: 6px; --radius-lg: 8px;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, 'SF Mono', Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101115; --surface: #17181e; --sunken: #1e2027; --ink: #eeeeea; --ink-2: #c3c5cc; --ink-3: #9398a4; --line: #2a2c34; --line-soft: #22242b;
    --accent: #8b85f5; --accent-hover: #a5a1f8; --accent-soft: #25254a; --on-accent: #101115;
    --rail: #0b0c0f; --rail-2: #1d1f26;
    --green: #4ade9f; --amber: #f5b64c; --red: #f88a8a; --blue: #84aefc; --grey: #7f8491;
    --warn-bg: #33270f; --warn-ink: #f5cf8c;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 13.5px/1.45 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: 19px; } h2 { font-size: 13.5px; } h3 { font-size: 13.5px; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
b { font-weight: 600; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { text-align: right; }
[hidden] { display: none !important; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }

/* ---------- Form controls ---------- */
label.field, .field { display: flex; flex-direction: column; gap: 3px; }
.label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--ink-3); }
.input, select, textarea {
  width: 100%; min-height: 32px; padding: 5px 9px; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); transition: border-color 0.12s;
}
.input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
textarea { min-height: 72px; resize: vertical; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 7px; min-height: 24px; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }
.form { display: flex; flex-direction: column; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.limit { width: 100%; max-width: 620px; }
.error { color: var(--red); font-size: 13px; }
.ok-text { color: var(--green); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 32px; padding: 4px 12px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--sunken); border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.sm { min-height: 26px; padding: 2px 8px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.link-danger { padding: 0; border: 0; background: none; color: var(--red); font: inherit; font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* ---------- Small pages (sign in, paused) ---------- */
.center { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; }
.narrow { width: 100%; max-width: 340px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.01em; }
.brand img { width: 24px; height: 24px; border-radius: 5px; }

/* ---------- Sign-up site ---------- */
.join { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100dvh; }
.pitch { position: relative; display: flex; flex-direction: column; gap: 22px; padding: 28px 44px; background: var(--rail); color: var(--rail-ink); overflow: hidden; }
.pitch .brand { color: var(--rail-strong); font-size: 15px; }
.pitch .brand small { color: var(--rail-ink); font-weight: 500; font-size: 13px; }
.pitch-main { margin: auto 0; display: flex; flex-direction: column; gap: 18px; max-width: 500px; position: relative; z-index: 1; }
.pitch h1 { font-size: clamp(30px, 3.4vw, 44px); font-weight: 650; letter-spacing: -0.025em; line-height: 1.08; color: var(--rail-strong); }
.pitch p { font-size: 15px; line-height: 1.5; }
.address { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--rail-2); border: 1px solid #33363f; border-radius: var(--radius-lg); font-family: var(--mono); font-size: 13.5px; min-width: 0; }
.address svg { flex: none; color: #4ade9f; }
.address span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--rail-ink); }
.address b { color: var(--rail-strong); font-weight: 600; }
.points { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 14px; }
.points li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; }
.points svg { margin-top: 3px; color: #8b85f5; }
.points b { color: var(--rail-strong); }
.pulse { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 120px; color: #2b2d36; pointer-events: none; }
.side-form { display: flex; flex-direction: column; justify-content: center; padding: 28px 44px; background: var(--paper); }
.side-form > * { width: 100%; max-width: 430px; margin-left: auto; margin-right: auto; }
.signup-form { display: flex; flex-direction: column; gap: 10px; }
.signup-form h2, .step h2 { font-size: 20px; letter-spacing: -0.015em; }
.step { display: flex; flex-direction: column; gap: 10px; }
.plan-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.plan { position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 1px 9px; align-items: center; padding: 7px 11px; cursor: pointer; transition: background 0.12s; }
.plan + .plan { border-top: 1px solid var(--line-soft); }
.plan:hover { background: var(--sunken); }
.plan:has(input:checked) { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.plan:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.plan input { margin: 0; accent-color: var(--accent); width: 14px; height: 14px; }
.plan .price { font-weight: 600; white-space: nowrap; }
.plan .price small { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.plan .meta { grid-column: 2 / 4; font-size: 12px; color: var(--ink-3); }
.addr { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; transition: border-color 0.12s; }
.addr:hover { border-color: var(--ink-3); }
.addr:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.addr input { flex: 1 1 40%; min-width: 60px; border: 0; min-height: 32px; padding: 5px 2px 5px 9px; font: inherit; color: var(--ink); background: transparent; outline: none; }
.addr span { padding-right: 9px; color: var(--ink-3); white-space: nowrap; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.auth .side-form > * { max-width: 340px; }

/* ---------- SaaS admin ---------- */
.shell { display: grid; grid-template-columns: 188px minmax(0, 1fr); min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 1px; padding: 12px 8px; background: var(--rail); color: var(--rail-ink); }
.rail .brand { color: var(--rail-strong); padding: 2px 8px 12px; font-size: 13.5px; white-space: nowrap; }
.rail .brand small { color: var(--rail-ink); font-weight: 500; font-size: 12px; }
.rail a { display: flex; align-items: center; min-height: 30px; padding: 4px 8px; border-radius: 5px; color: inherit; text-decoration: none; font-weight: 500; transition: background 0.12s, color 0.12s; }
.rail a:hover { background: var(--rail-2); color: var(--rail-strong); }
.rail a[aria-current='page'] { background: var(--rail-2); color: var(--rail-strong); box-shadow: inset 2px 0 0 #8b85f5; }
.rail .foot { margin-top: auto; padding: 8px; font-size: 12.5px; display: flex; justify-content: space-between; gap: 8px; }
.rail .foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .foot button { flex: none; background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font: inherit; }
.rail .foot button:hover { color: var(--rail-strong); }
.main { padding: 14px 20px 28px; display: flex; flex-direction: column; gap: 12px; min-width: 0; max-width: 1280px; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; min-height: 32px; }
.head .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin-top: 1px; color: var(--ink-3); font-size: 12.5px; }
.crumb { font-size: 12.5px; color: var(--ink-3); }
.crumb a { color: inherit; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.kpi { background: var(--surface); padding: 8px 12px; min-width: 0; }
.kpi small { display: block; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi b { display: block; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; white-space: nowrap; }
.kpi.alert b { color: var(--amber); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.panel > .table-wrap { margin: 0 -12px -10px; }
.panel.sheet { padding-top: 0; }
.panel.sheet > .table-wrap { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 272px; gap: 12px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-3); padding: 6px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.num { text-align: right; }
td { padding: 6px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.link { cursor: pointer; transition: background 0.1s; }
tbody tr.link:hover { background: var(--sunken); }
td a { color: inherit; text-decoration: none; }
td a:hover { color: var(--accent); text-decoration: underline; }
.nowrap { white-space: nowrap; }

.st { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.st::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--grey); }
.st.active::before, .st.paid::before { background: var(--green); }
.st.trial::before, .st.provisioning::before { background: var(--blue); }
.st.past_due::before, .st.open::before { background: var(--amber); }
.st.suspended::before, .st.cancelled::before { background: var(--red); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; }
.tab { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 2px 9px; border: 1px solid transparent; border-radius: var(--radius); background: none; color: var(--ink-2); font: inherit; cursor: pointer; transition: background 0.12s; }
.tab:hover { background: var(--sunken); }
.tab[aria-pressed='true'] { background: var(--surface); border-color: var(--line); color: var(--ink); font-weight: 600; }
.tab small { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.toolbar .input { width: 240px; min-height: 28px; padding: 3px 9px; }

dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 12px; margin: 0; }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; margin: 0 -12px -10px; background: var(--line-soft); border-top: 1px solid var(--line-soft); }
.gauge { background: var(--surface); padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.gauge small { font-size: 12px; color: var(--ink-3); }
.gauge b { font-size: 15px; font-weight: 600; }
.gauge b span { font-weight: 400; font-size: 12.5px; color: var(--ink-3); }
.bar { height: 4px; border-radius: 2px; background: var(--sunken); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.empty { padding: 14px 8px; text-align: center; color: var(--ink-3); }
.quiet { color: var(--ink-3); padding: 2px 0; }
.notice { padding: 7px 10px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; }
.notice a { color: inherit; }
.copy { display: flex; gap: 6px; }
dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; background: var(--surface); color: var(--ink); width: min(440px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(15, 17, 21, 0.25); }
dialog::backdrop { background: rgba(15, 17, 21, 0.45); }
dialog h2 { margin-bottom: 10px; font-size: 15px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 2px; }
.toast { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 50; padding: 6px 12px; border-radius: var(--radius); background: var(--rail); color: var(--rail-strong); font-size: 13px; max-width: calc(100vw - 32px); }

@media (max-width: 1000px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .join { grid-template-columns: minmax(0, 1fr); }
  .pitch { padding: 16px; gap: 14px; }
  .pitch-main { margin: 0; gap: 10px; }
  .pitch h1 { font-size: 25px; }
  .pitch p, .pulse { display: none; }
  .auth { grid-template-rows: auto 1fr; }
  .auth .pitch h1 { font-size: 21px; }
  .auth .side-form > * { max-width: none; }
  .points { font-size: 13px; gap: 4px; }
  .points li:last-child { display: none; }
  .side-form { padding: 16px; justify-content: flex-start; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 2px; padding: 6px 8px; overflow-x: auto; scrollbar-width: none; }
  .rail .brand { padding: 0 8px 0 2px; }
  .rail .brand span, .rail .brand small { display: none; }
  .rail a { flex: none; min-height: 36px; }
  .rail a[aria-current='page'] { box-shadow: inset 0 -2px 0 #8b85f5; }
  .rail .foot { margin: 0 0 0 auto; padding: 0 6px; flex: none; }
  .rail .foot span { display: none; }
  .main { padding: 12px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-sm { display: none; }
  .toolbar .input { width: 100%; }
  .btn, .input, select { min-height: 38px; }
  .btn.sm { min-height: 32px; }
  .tab { min-height: 34px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
