/* Kanon — shared styles for the website and the console.
   κανών: a measuring rod. The one recurring motif is the rule with tick marks. */

@font-face {
  font-family: "Geist";
  src: url("/assets/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/assets/geist-mono.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #0d0e12;
  --surface: #13151c;
  --surface-2: #1a1d27;
  --line: #252836;
  --line-strong: #353a4d;
  --fg: #edeef2;
  --fg-2: #a3a7b8;
  --fg-3: #7b8094;
  --accent: #8f73ff;
  --accent-strong: #7c5cff;
  --accent-ink: #0d0e12;
  --ok: #3ddc84;
  --warn: #f5b041;
  --err: #ff6b6b;
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --tick: 8px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent-strong); color: #fff; }
* { scrollbar-color: var(--line-strong) transparent; scrollbar-width: thin; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; letter-spacing: -0.02em; font-weight: 600; line-height: 1.15; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
code, kbd, pre, .mono { font-family: var(--mono); font-variant-ligatures: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.wrap { width: min(100% - 40px, 1040px); margin-inline: auto; }

/* ── The rule ───────────────────────────────────────────────────────────── */
/* A hairline with ticks every 8px and a taller tick every 40px. */
.rule {
  height: 9px;
  border-top: 1px solid var(--line-strong);
  background:
    repeating-linear-gradient(90deg, var(--line-strong) 0 1px, transparent 1px calc(var(--tick) * 5)) 0 0 / 100% 9px no-repeat,
    repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px var(--tick)) 0 0 / 100% 4px no-repeat;
}

/* ── Top bar ────────────────────────────────────────────────────────────── */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 18px; }
.wordmark { font-weight: 650; font-size: 18px; letter-spacing: -0.03em; text-decoration: none; display: inline-flex; align-items: baseline; gap: 8px; }
.wordmark:hover { color: var(--fg); }
.wordmark small { font: 500 12px/1 var(--mono); color: var(--fg-3); letter-spacing: 0; }
.top nav { display: flex; align-items: center; gap: 18px; color: var(--fg-2); font-size: 14px; }

/* ── Buttons & inputs ───────────────────────────────────────────────────── */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 8px;
  font: 550 14px/1 var(--sans); padding: 10px 14px; min-height: 38px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not([disabled]) { background: #a48dff; color: var(--accent-ink); }
.btn-quiet { background: transparent; border-color: var(--line-strong); color: var(--fg); }
.btn-quiet:hover:not([disabled]) { background: var(--surface-2); color: var(--fg); }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--err) 45%, transparent); color: var(--err); }
.btn-danger:hover:not([disabled]) { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }
.btn-icon { padding: 0; width: 32px; min-height: 32px; border-radius: 6px; background: transparent; color: var(--fg-3); border: 0; }
.btn-icon:hover { background: var(--surface-2); color: var(--fg); }
.btn svg, .btn-icon svg { width: 16px; height: 16px; flex: none; }

label { display: block; font-size: 13px; font-weight: 500; color: var(--fg-2); margin-bottom: 6px; }
.field { margin-bottom: 16px; }
input[type="text"], input[type="email"], input[type="password"] {
  width: 100%; min-height: 40px; padding: 9px 12px;
  background: var(--bg); color: var(--fg); caret-color: var(--accent);
  border: 1px solid var(--line-strong); border-radius: 8px;
  font: 400 15px/1.3 var(--sans);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: var(--fg-3); }
input:hover { border-color: #474d64; }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

.msg { font-size: 14px; margin-top: 12px; min-height: 21px; }
.msg-err { color: var(--err); }

/* ── Console: sign in ───────────────────────────────────────────────────── */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.signin-box { width: min(100%, 360px); }
.signin-box h1 { font-size: 26px; margin: 28px 0 6px; }
.signin-box > p { color: var(--fg-2); margin-bottom: 26px; }
.signin-box .btn { width: 100%; }

/* ── Console: projects ──────────────────────────────────────────────────── */
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 44px 0 20px; }
.page-head h1 { font-size: 26px; }
.page-head .count { font: 500 13px/1 var(--mono); color: var(--fg-3); font-variant-numeric: tabular-nums; }

.create { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.create .name { flex: 1 1 320px; min-width: 0; }
.create > .btn { margin-top: 25px; }
.name-input { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); transition: border-color 0.15s, box-shadow 0.15s; }
.name-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.name-input input { border: 0; background: transparent; box-shadow: none !important; font-family: var(--mono); font-size: 14px; flex: 1 1 8ch; min-width: 8ch; }
.name-input span { flex: 0 1 auto; align-self: center; min-width: 0; padding-right: 12px; color: var(--fg-3); font: 400 14px/1.4 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint { font-size: 13px; color: var(--fg-3); margin-top: 8px; }

.projects { list-style: none; margin: 28px 0 80px; padding: 0; border-top: 1px solid var(--line); }
.project { border-bottom: 1px solid var(--line); }
.project > summary, .project-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 16px;
  padding: 16px 4px; cursor: pointer; list-style: none;
}
.project > summary::-webkit-details-marker { display: none; }
.project > summary:hover .project-name { color: var(--accent); }
.project-name { font: 550 16px/1.3 var(--mono); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color 0.15s; }
.project-url { font: 400 13px/1.3 var(--mono); color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--fg-3); transition: transform 0.25s var(--ease); display: grid; }
.chev svg { width: 16px; height: 16px; }
.project[open] .chev { transform: rotate(90deg); }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-2); white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-3); }
.status[data-state="ready"] i { background: var(--ok); }
.status[data-state="failed"] i { background: var(--err); }
.status[data-state="failed"] { color: var(--err); }
.status[data-state="creating"] i, .status[data-state="deleting"] i { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* The authored moment: while a project is being built, its row is measured
   out — a rule whose ticks light up left to right, over and over. */
.measuring { height: 9px; margin: 0 4px 16px; position: relative; overflow: hidden; }
.measuring::before, .measuring::after { content: ""; position: absolute; inset: 0; }
.measuring::before {
  border-top: 1px solid var(--line-strong);
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 1px, transparent 1px var(--tick)) 0 0 / 100% 5px no-repeat;
}
.measuring::after {
  border-top: 1px solid var(--accent);
  background: repeating-linear-gradient(90deg, var(--accent) 0 1px, transparent 1px var(--tick)) 0 0 / 100% 9px no-repeat;
  clip-path: inset(0 100% 0 0);
  animation: measure 2.6s var(--ease) infinite;
}
@keyframes measure {
  0% { clip-path: inset(0 100% 0 0); opacity: 1; }
  80% { clip-path: inset(0 0 0 0); opacity: 1; }
  100% { clip-path: inset(0 0 0 0); opacity: 0; }
}

.detail { padding: 4px 4px 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.detail > * { min-width: 0; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; }
.kv dt { color: var(--fg-3); font-size: 13px; }
.kv dd { margin: 0; font: 400 13px/1.5 var(--mono); color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv .acts { display: flex; gap: 2px; }
.note { font-size: 13px; color: var(--fg-3); max-width: 70ch; }
.note-err { color: var(--err); }

pre.snippet {
  margin: 0; padding: 14px 16px; background: var(--surface); border-radius: 10px;
  font-size: 13px; line-height: 1.65; color: var(--fg-2); overflow-x: auto; tab-size: 2;
}
pre.snippet b { color: var(--fg); font-weight: 500; }
.snippet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: var(--fg-3); }
.detail-foot { display: flex; justify-content: flex-end; gap: 10px; align-items: center; flex-wrap: wrap; }

.empty { padding: 56px 4px 80px; color: var(--fg-2); max-width: 52ch; }
.empty h2 { font-size: 18px; color: var(--fg); margin-bottom: 6px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; translate: -50% 12px; opacity: 0; pointer-events: none;
  background: var(--fg); color: var(--bg); font-size: 13px; font-weight: 550; padding: 9px 14px; border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.45);
  transition: opacity 0.2s, translate 0.3s var(--ease);
}
.toast.show { opacity: 1; translate: -50% 0; }

/* ── Website ────────────────────────────────────────────────────────────── */
.hero { padding: clamp(56px, 11vw, 132px) 0 clamp(48px, 8vw, 96px); }
.hero h1 { font-size: clamp(38px, 7vw, 76px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 620; max-width: 15ch; }
.hero p { font-size: clamp(17px, 2vw, 20px); color: var(--fg-2); max-width: 56ch; margin: 26px 0 34px; }
.hero .acts { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hero .acts span { font-size: 14px; color: var(--fg-3); }

/* A project, measured: the spec sheet reads down a vertical rule. */
.spec { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(28px, 6vw, 80px); padding: clamp(48px, 8vw, 96px) 0; align-items: start; }
.spec h2 { font-size: clamp(26px, 3.6vw, 38px); line-height: 1.12; max-width: 16ch; }
.spec > div > p { color: var(--fg-2); margin-top: 16px; max-width: 46ch; }
.spec dl { margin: 0; border-left: 1px solid var(--line-strong); }
.spec dl > div { position: relative; padding: 0 0 26px 28px; }
.spec dl > div:last-child { padding-bottom: 0; }
.spec dl > div::before { content: ""; position: absolute; left: 0; top: 11px; width: 14px; height: 1px; background: var(--accent); }
.spec dt { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.spec dd { margin: 4px 0 0; color: var(--fg-2); max-width: 52ch; }

.code-band { padding: clamp(40px, 7vw, 80px) 0; }
.code-band h2 { font-size: clamp(24px, 3.2vw, 34px); max-width: 22ch; }
.code-band > .wrap > p { color: var(--fg-2); margin: 14px 0 28px; max-width: 60ch; }
.code-band pre.snippet { font-size: 14px; padding: 22px 24px; }

.closing { padding: clamp(56px, 9vw, 110px) 0; }
.closing h2 { font-size: clamp(28px, 4.4vw, 48px); line-height: 1.08; max-width: 18ch; letter-spacing: -0.03em; }
.closing p { color: var(--fg-2); margin: 16px 0 28px; max-width: 52ch; }
footer.site { padding: 22px 0 40px; color: var(--fg-3); font-size: 13px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

@media (max-width: 720px) {
  .spec { grid-template-columns: 1fr; }
  .kv { grid-template-columns: minmax(0, 1fr) auto; }
  .kv dt { grid-column: 1 / -1; margin-bottom: -4px; }
  .project > summary { grid-template-columns: minmax(0, 1fr) auto; }
  .project > summary .status { grid-column: 1; grid-row: 2; margin-top: -8px; }
  .project > summary .chev { grid-row: 1 / span 2; grid-column: 2; }
  .top nav .email { display: none; }
  .create > .btn { margin-top: 0; width: 100%; }
  .detail-foot .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .measuring::after { clip-path: inset(0 40% 0 0); }
}

/* ── Console: project page ──────────────────────────────────────────────── */
.project-row { text-decoration: none; color: inherit; }
.project-row:hover { color: inherit; }
.project-row:hover .project-name { color: var(--accent); }

.crumbs { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 36px 0 14px; color: var(--fg-3); font-size: 14px; }
.crumbs a { color: var(--fg-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; color: var(--fg); }
.crumbs .status { margin-left: 4px; }
#p-busy { margin: 0 0 4px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 28px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 10px 12px 11px; font-size: 14px; font-weight: 500; color: var(--fg-2); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.15s, border-color 0.15s;
}
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }

.tab { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; padding-bottom: 96px; }
.tab > * { min-width: 0; }
.tab h2 { font-size: 17px; margin-top: 18px; }
.tab h2:first-child { margin-top: 0; }
.tab .note strong { color: var(--fg); font-weight: 600; }

.btn-link { appearance: none; background: none; border: 0; padding: 4px 2px; font: 500 13px/1.2 var(--sans); color: var(--fg-2); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; border-radius: 4px; }
.btn-link:hover { color: var(--accent); text-decoration-color: currentColor; }
.btn-link.danger, .btn-link.danger:hover { color: var(--err); }
.btn-link[disabled] { opacity: 0.5; cursor: not-allowed; }

.badge { display: inline-block; font: 500 11px/1 var(--mono); padding: 4px 6px; border-radius: 5px; background: var(--surface-2); color: var(--fg-2); white-space: nowrap; }
.badge-warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }

kbd { font: 500 11px/1 var(--mono); padding: 3px 5px; border-radius: 4px; background: var(--surface-2); color: var(--fg-2); }

textarea {
  width: 100%; padding: 12px 14px; resize: vertical; min-height: 84px;
  background: var(--bg); color: var(--fg); caret-color: var(--accent);
  border: 1px solid var(--line-strong); border-radius: 8px;
  font: 400 13px/1.6 var(--mono); tab-size: 2;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea::placeholder { color: var(--fg-3); }
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input.mono { font-family: var(--mono); font-size: 14px; }
input.narrow { max-width: 180px; }

/* Database */
.db { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.db aside { min-width: 0; }
.side-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.side-head h2 { margin: 0; }
.tables { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.tables .note { padding: 6px 0; }
.tables button {
  appearance: none; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: none; border: 0; border-radius: 6px; padding: 7px 8px; margin-left: -8px; color: var(--fg); cursor: pointer; text-align: left; font-size: 13px;
}
.tables button:hover { background: var(--surface-2); }
.tables button .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor { min-width: 0; display: grid; gap: 12px; }
.editor label { margin: 0; }
.editor-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#sql { min-height: 220px; }

.grid-wrap { overflow: auto; max-height: 520px; border: 1px solid var(--line); border-radius: 10px; }
table.grid { border-collapse: collapse; width: 100%; font: 400 13px/1.45 var(--mono); font-variant-numeric: tabular-nums; }
table.grid th, table.grid td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
table.grid th { position: sticky; top: 0; background: var(--surface); color: var(--fg-2); font-weight: 500; z-index: 1; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover td { background: color-mix(in srgb, var(--surface) 60%, transparent); }
table.grid td.null { color: var(--fg-3); font-style: italic; }
table.grid.users td:not(.mono) { font-family: var(--sans); }
.row-acts { display: flex; gap: 14px; justify-content: flex-end; align-items: center; }

/* Forms inside tabs */
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; flex: 1 1 220px; min-width: 0; }
.inline-form .field.grow { flex-basis: 320px; }
.with-btn { display: flex; gap: 8px; }
.with-btn input { min-width: 0; }
.tab .msg { margin-top: -6px; min-height: 0; }
.tab .msg:empty { display: none; }

.settings { display: grid; gap: 18px; max-width: 640px; }
.settings .field { margin: 0; }
.settings h2 { margin-top: 14px; }
.check { display: flex; gap: 12px; align-items: flex-start; margin: 0; font-size: 15px; font-weight: 500; color: var(--fg); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent-strong); flex: none; }
.check small { display: block; font-size: 13px; font-weight: 400; color: var(--fg-3); margin-top: 2px; }
.form-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; }

/* Domains */
.domains { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.domains > li { border-bottom: 1px solid var(--line); padding: 16px 0; display: grid; gap: 14px; }
.domain-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.domain-head > .mono { font-size: 15px; font-weight: 550; }
.domain-head .row-acts { margin-left: auto; }
.dns-step { background: var(--surface); border-radius: 10px; padding: 16px 18px; display: grid; gap: 12px; }
.dns-step p { font-size: 14px; }
.dns-step .kv { grid-template-columns: 70px minmax(0, 1fr) auto; }

@media (max-width: 720px) {
  .db { grid-template-columns: 1fr; }
  .crumbs { margin-top: 26px; }
  .row-acts { justify-content: flex-start; }
  .domain-head .row-acts { margin-left: 0; width: 100%; }
  .dns-step .kv { grid-template-columns: minmax(0, 1fr) auto; }
}

/* Site */
.drop {
  border: 1px dashed var(--line-strong); border-radius: 12px; padding: 28px 20px; text-align: center;
  display: grid; gap: 10px; justify-items: center; transition: border-color 0.15s, background-color 0.15s;
}
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.drop[aria-busy="true"] { opacity: 0.6; pointer-events: none; }
.drop p { font-size: 15px; }
.drop strong { font-weight: 600; }
.drop .btn { margin-top: 4px; cursor: pointer; }
.drop input:focus-visible + *, .drop label:has(+ input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.releases { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.releases li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; font-variant-numeric: tabular-nums; }
.tab a.mono { color: var(--fg); }
.tab a.mono:hover { color: var(--accent); }
@media (max-width: 720px) {
  .releases li { grid-template-columns: minmax(0, 1fr) auto; }
  .releases li .note { grid-column: 1; grid-row: 2; margin-top: -8px; }
}

/* ── Insights and logs ─────────────────────────────────────────────────── */
:root { --s-ok: #8f73ff; --s-c4: #cf8a1f; --s-c5: #e5484d; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.bar h2 { margin: 0; }
.bar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { appearance: none; background: none; border: 0; border-right: 1px solid var(--line-strong); padding: 7px 12px; font: 500 13px/1.2 var(--sans); color: var(--fg-2); cursor: pointer; white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--fg); background: var(--surface-2); }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--fg); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats > div { padding: 14px 16px 14px 0; }
.stats > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.stats dt { font-size: 13px; color: var(--fg-3); }
.stats dd { margin: 2px 0 0; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stats dd .of { font-size: 14px; font-weight: 400; color: var(--fg-3); letter-spacing: 0; }
.stats small { display: block; font-size: 12px; color: var(--fg-3); margin-top: 4px; line-height: 1.4; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 400 11px var(--mono); fill: var(--fg-3); }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: color-mix(in srgb, var(--fg) 6%, transparent); }
.s-ok { fill: var(--s-ok); background: var(--s-ok); }
.s-c4 { fill: var(--s-c4); background: var(--s-c4); }
.s-c5 { fill: var(--s-c5); background: var(--s-c5); }
.legend { list-style: none; display: flex; gap: 18px; flex-wrap: wrap; margin: -6px 0 0; padding: 0; font-size: 13px; color: var(--fg-2); }
.legend i, .tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; }
.tip {
  position: absolute; top: 6px; translate: -50% 0; min-width: 170px; pointer-events: none; z-index: 2;
  background: var(--surface-2); border-radius: 8px; padding: 10px 12px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.45);
  display: grid; gap: 4px; font-size: 13px; color: var(--fg-2);
}
.tip strong { color: var(--fg); font-weight: 600; font-size: 12px; margin-bottom: 2px; }
.tip span { display: flex; align-items: center; }
.tip b { margin-left: auto; padding-left: 14px; color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.tip .tot { border-top: 1px solid var(--line-strong); padding-top: 5px; margin-top: 2px; }

table.grid th.num, table.grid td.num { text-align: right; }
table.grid td.bad, .loglines .bad span { color: var(--err); }
table.grid td.warn, .loglines .warn span { color: var(--warn); }
.method { color: var(--fg-3); margin-right: 4px; }
table.grid.reqs tr.req { cursor: pointer; }
table.grid.reqs tr.req:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
table.grid.reqs tr.req[aria-expanded="true"] td { background: var(--surface); border-bottom-color: transparent; }
table.grid tr.req-detail td { white-space: normal; max-width: none; background: var(--surface); padding: 4px 12px 14px; }
table.grid tr.req-detail .kv { grid-template-columns: 110px minmax(0, 1fr) auto; }
table.grid tr.req-detail dt { font-family: var(--sans); }

select {
  width: 100%; min-height: 40px; padding: 8px 12px; background: var(--bg); color: var(--fg);
  border: 1px solid var(--line-strong); border-radius: 8px; font: 400 14px/1.3 var(--sans);
}
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input[type="search"] { width: 100%; min-height: 40px; padding: 9px 12px; background: var(--bg); color: var(--fg); caret-color: var(--accent); border: 1px solid var(--line-strong); border-radius: 8px; }
input[type="search"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

.loglines { border: 1px solid var(--line); border-radius: 10px; max-height: 620px; overflow: auto; font: 400 12.5px/1.55 var(--mono); }
.loglines > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.loglines > div:last-child { border-bottom: 0; }
.loglines time { color: var(--fg-3); white-space: nowrap; }
.loglines span { color: var(--fg-2); overflow-wrap: anywhere; white-space: pre-wrap; }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .loglines > div { grid-template-columns: 1fr; gap: 0; }
  .bar-right { margin-left: 0; }
}

/* ── Console shell: top bar, service sidebar, content ───────────────────── */
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px clamp(16px, 2.4vw, 32px); }
.topbar .wordmark { margin-right: 6px; }
.topbar .email { margin-left: auto; color: var(--fg-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.topbar .btn { min-height: 34px; padding: 7px 12px; }

.switcher {
  width: auto; max-width: 220px; min-height: 34px; padding: 6px 30px 6px 12px;
  font: 500 14px/1.2 var(--mono); background-color: var(--surface); border-color: var(--line-strong); border-radius: 8px; cursor: pointer;
}
.jump {
  appearance: none; display: inline-flex; align-items: center; gap: 28px; min-height: 34px; padding: 6px 8px 6px 12px;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px; color: var(--fg-3);
  font: 400 14px/1.2 var(--sans); cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.jump:hover { border-color: #474d64; color: var(--fg-2); }

.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); align-items: start; max-width: 1360px; margin: 0 auto; }
.side { position: sticky; top: 0; padding: 22px 12px 40px clamp(8px, 1.6vw, 20px); display: grid; gap: 2px; max-height: 100dvh; overflow-y: auto; scrollbar-width: none; }
.side::-webkit-scrollbar { display: none; }
.side-group { margin: 18px 0 6px; padding: 0 10px; font: 500 11px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-3); }
.side a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
  color: var(--fg-2); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.side a svg { width: 18px; height: 18px; flex: none; color: var(--fg-3); transition: color 0.15s; }
.side a:hover { background: var(--surface); color: var(--fg); }
.side a:hover svg { color: var(--fg-2); }
.side a[aria-current="page"] { background: var(--surface-2); color: var(--fg); }
.side a[aria-current="page"] svg { color: var(--accent); }

.content { min-width: 0; padding: 0 clamp(16px, 2.4vw, 32px) 0 clamp(12px, 2vw, 28px); }
.content .crumbs { margin-top: 26px; }
.crumbs a.mono { font-size: 14px; }
.crumbs h1 { font-size: 24px; }

/* ── Home: service cards ────────────────────────────────────────────────── */
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.home-head > div { display: flex; align-items: center; gap: 4px; min-width: 0; }
.home-url { font-size: 15px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.card {
  display: grid; grid-template-rows: auto 1fr auto; gap: 18px; height: 100%; padding: 18px 18px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  color: inherit; text-decoration: none;
  transition: border-color 0.18s, background-color 0.18s, transform 0.25s var(--ease);
}
.card:hover { border-color: var(--line-strong); background: #161922; color: inherit; transform: translateY(-2px); }
.card:active { transform: translateY(0); }
.card-top { display: flex; gap: 13px; align-items: flex-start; }
.card-icon { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.card-icon svg { width: 20px; height: 20px; }
.card h2 { font-size: 16px; margin: 0; line-height: 1.25; }
.card p { font-size: 13px; color: var(--fg-3); margin: 3px 0 0; line-height: 1.4; }
.card-stats { margin: 0; display: flex; gap: 22px; align-items: flex-end; }
.card-stats div { min-width: 0; }
.card-stats dd { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-stats dt { font-size: 12px; color: var(--fg-3); margin-top: 3px; white-space: nowrap; }
.card-state { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-2); padding-top: 12px; border-top: 1px solid var(--line); }
.card-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-3); }
.card-state[data-state="ok"] i { background: var(--ok); }
.card-state[data-state="warn"] i { background: var(--warn); }
.card-state[data-state="warn"] { color: var(--warn); }
.card-state[data-state="off"] i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--fg-3); }

/* ── Quick navigation ───────────────────────────────────────────────────── */
.jump-dialog {
  width: min(560px, calc(100vw - 32px)); margin-top: 12vh; padding: 0; border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--surface); color: var(--fg); box-shadow: 0 24px 60px rgb(0 0 0 / 0.55); overflow: hidden;
}
.jump-dialog::backdrop { background: rgb(5 6 9 / 0.6); }
.jump-dialog input { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 16px 18px; font: 400 16px/1.3 var(--sans); color: var(--fg); min-height: 0; box-shadow: none !important; }
.jump-dialog ul { list-style: none; margin: 0; padding: 6px; max-height: 46vh; overflow-y: auto; }
.jump-dialog li { display: grid; grid-template-columns: 20px auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.jump-dialog li svg { width: 18px; height: 18px; color: var(--fg-3); }
.jump-dialog li small { color: var(--fg-3); font-size: 13px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jump-dialog li[aria-selected="true"] { background: var(--surface-2); }
.jump-dialog li[aria-selected="true"] svg { color: var(--accent); }
.jump-dialog li.none { display: block; color: var(--fg-3); cursor: default; }
.jump-dialog .note { padding: 10px 18px 12px; border-top: 1px solid var(--line); margin: 0; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  /* The sidebar becomes one scrolling row of services. */
  .side { position: static; display: flex; gap: 4px; padding: 10px 12px; max-height: none; overflow-x: auto; border-bottom: 1px solid var(--line); }
  .side-group { display: none; }
  .side a { padding: 8px 12px; }
  .content { padding: 0 16px; }
  .topbar { gap: 10px; padding: 10px 16px; }
  .topbar .email, .jump span { display: none; }
  .jump { gap: 0; margin-left: auto; padding: 6px 8px; }
  .switcher { max-width: 150px; }
}
@media (max-width: 520px) {
  .jump { display: none; }
  .topbar .btn { margin-left: auto; }
  .cards { grid-template-columns: 1fr; }
}

/* ── Admin: ranked consumption ──────────────────────────────────────────── */
.wrap.wide { width: min(100% - 40px, 1280px); }
.admin-link { margin-left: auto; font-size: 14px; font-weight: 500; color: var(--fg-2); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.admin-link:hover { background: var(--surface); color: var(--fg); }
.admin-link[aria-current="page"] { background: var(--surface-2); color: var(--fg); }
.admin-link:not([hidden]) + .email { margin-left: 0; }
#view-admin { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; padding-bottom: 96px; }
#view-admin > * { min-width: 0; }
#view-admin .page-head { margin-bottom: 0; align-items: center; flex-wrap: wrap; }
#view-admin h2 { font-size: 17px; margin-top: 14px; }
#view-admin .bar h2 { margin: 0; font-size: 14px; font-weight: 500; color: var(--fg-2); }
#view-admin .bar { justify-content: flex-start; margin-top: 10px; }
table.rank td { vertical-align: middle; }
table.rank .th-note { color: var(--fg-3); font-weight: 400; margin-left: 6px; }
.share { display: grid; grid-template-columns: 76px minmax(90px, 1fr) 40px; align-items: center; gap: 12px; min-width: 260px; }
.share-val { font-weight: 600; color: var(--fg); text-align: right; }
.share-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.share-bar i { display: block; height: 100%; min-width: 2px; border-radius: 4px; background: var(--accent); }
.share-pct { color: var(--fg-3); text-align: right; }
.badge-top { background: color-mix(in srgb, var(--accent) 22%, transparent); color: #c9bcff; margin-left: 8px; font-family: var(--sans); }
table.rank .status { margin-left: 8px; font-family: var(--sans); font-size: 12px; }
.mono-s { font-size: 12px; color: var(--fg-2); }
@media (max-width: 900px) { .admin-link { margin-left: 0; } }
@media (max-width: 520px) {
  /* Keep the top bar on one line when the Admin link is present. */
  .topbar .wordmark small { display: none; }
  .switcher { max-width: 118px; padding-right: 24px; }
  .topbar .btn, .admin-link { padding: 6px 9px; font-size: 13px; }
}

/* Access tokens */
a.email { text-decoration: none; padding: 6px 8px; border-radius: 8px; }
a.email:hover { background: var(--surface); color: var(--fg); }
#view-tokens { padding-bottom: 96px; }
#view-tokens .page-head { margin-bottom: 14px; }
#view-tokens pre.snippet b { color: var(--fg-3); font-weight: 400; }
#view-tokens .dns-step .kv { grid-template-columns: 110px minmax(0, 1fr) auto; }
#view-tokens .dns-step dd { white-space: normal; overflow-wrap: anywhere; }

/* Error types (admin): what went wrong, failures marked. */
.kinds { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.kind { display: inline-block; font: 500 11px/1 var(--sans); padding: 4px 6px; border-radius: 5px; background: var(--surface-2); color: var(--fg-2); white-space: nowrap; }
.kind b { font: 500 11px/1 var(--mono); color: var(--fg); margin-left: 2px; }
.kind-fail { background: color-mix(in srgb, var(--err) 18%, transparent); color: var(--err); }
.kind-fail b { color: var(--err); }
.kind-none { color: var(--fg-2); }
.kinds-row { margin-top: 6px; }
.kinds-row .kinds { justify-content: flex-start; }
table.grid td.wrap { white-space: normal; overflow: visible; text-overflow: clip; font-family: var(--sans); min-width: 260px; }
.muted { color: var(--fg-2); }
.kinds-row { min-width: 360px; }
