/* CloudSend control plane — dark greys, one accent, hairlines, zero JS.
   Palette is centralized below; --accent is the single-line theme switch. */
:root {
  color-scheme: dark;
  --bg: #0c0e11;
  --surface: #13161b;
  --surface2: #191d24;
  --line: #232830;
  --text: #e8ebf0;
  --text2: #a7b0bd;
  --text3: #6d7683;
  --accent: #4cc2ff;
  --accent-hover: #6dd0ff;
  --accent-ink: #04121c;
  --danger: #f26d6d;
  --ok: #4ade80;
  --warn: #fbbf24;
  --radius: 10px;
  --radius-sm: 8px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --elev: inset 0 1px 0 rgba(255, 255, 255, .04), 0 8px 24px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 var(--font);
}
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.02em; margin: 0 0 .75rem; }
h1 { font-size: 28px; font-weight: 600; }
h2 { font-size: 18px; font-weight: 600; margin-top: 1.75rem; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: .55rem 0; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Slim sticky chrome — blurred dark bar, degrades to solid without backdrop support. */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
  padding: .55rem 1.25rem;
  background: rgba(12, 14, 17, .8);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.brand { font-weight: 600; font-size: 14px; letter-spacing: -0.02em; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--text3); font-weight: 500; }
.topbar nav { display: flex; flex-wrap: wrap; gap: .25rem; margin-left: auto; align-items: center; }
.topbar nav a {
  color: var(--text2); text-decoration: none; padding: .35rem .65rem; border-radius: 999px;
  font-size: 13px; line-height: 1.4;
}
.topbar nav a:hover { background: var(--surface2); color: var(--text); }
.topbar nav a[aria-current="page"] { background: rgba(76, 194, 255, .15); color: var(--accent); }
.setup-link { flex: none; }
.skip-link { position: absolute; left: -9999px; top: 0; padding: .5rem .8rem; background: var(--surface2); z-index: 30; }
.skip-link:focus { left: .5rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.wrap { max-width: 1120px; margin: 1.75rem auto; padding: 0 1.25rem; }
.foot { max-width: 1120px; margin: 2.5rem auto; padding: 0 1.25rem; color: var(--text3); font-size: 12px; }

/* Buttons: primary accent / ghost hairline / danger tint. */
.btn {
  display: inline-block; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  text-decoration: none; line-height: 1.4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--line); box-shadow: none; }
.btn.secondary:hover { background: var(--surface2); color: var(--text); border-color: var(--text3); }
.btn.danger { background: rgba(242, 109, 109, .15); color: var(--danger); border-color: rgba(242, 109, 109, .35); box-shadow: none; }
.btn.danger:hover { background: rgba(242, 109, 109, .25); color: var(--danger); border-color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.full { display: block; width: 100%; text-align: center; margin-top: 1.2rem; padding: 10px 14px; }
form.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; align-items: center; }

/* Surfaces — hairline borders, subtle elevation, no heavy boxes. */
.panel, .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--elev);
  padding: 1.15rem 1.3rem;
  margin-bottom: 1.2rem;
}
.panel h2 { margin-top: 0; }
.card { margin-bottom: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin: .9rem 0 1.4rem; }
.card .label { color: var(--text3); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; }
.card .value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.card .value .badge { vertical-align: middle; font-size: 11px; }
.note { color: var(--text2); font-size: 13px; }
.empty { color: var(--text3); }
.page-head {
  display: flex; flex-wrap: wrap; gap: .8rem 1.5rem; align-items: end; justify-content: space-between;
  padding-bottom: 1rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--line);
}
.page-head .lede { margin: .45rem 0 0; }
.kicker {
  color: var(--text3); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em; margin: 0 0 .35rem;
}
.lede { color: var(--text2); font-size: 14px; max-width: 68ch; }

/* Tables — 11px uppercase headers, hairline rules, mono ids/keys/numbers. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table, .table-scroll .setup-rows { min-width: 640px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: .6rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  color: var(--text3); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--line);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
td code, td pre { font-family: var(--mono); font-size: .92em; }
.pager { display: flex; gap: .6rem; align-items: center; margin-top: 1rem; color: var(--text2); font-size: 13px; }

/* Status badges — tint bg + full-color text; accent is never used here. */
.badge {
  display: inline-block; padding: .12rem .55rem; border-radius: 999px;
  font-size: 12px; line-height: 1.5; border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: .4rem; vertical-align: middle; }
.badge.ok { color: var(--ok); background: rgba(74, 222, 128, .15); }
.badge.warn { color: var(--warn); background: rgba(251, 191, 36, .15); }
.badge.bad, .badge.error { color: var(--danger); background: rgba(242, 109, 109, .15); }
.badge.off { color: var(--text3); background: var(--surface2); }

code, pre { font-family: var(--mono); }
.code {
  background: var(--surface2); border: 1px dashed var(--line); border-radius: var(--radius-sm);
  padding: .7rem; font-family: var(--mono); word-break: break-all; user-select: all;
}
pre.raw {
  white-space: pre-wrap; word-break: break-word; background: var(--surface2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem;
  font-size: 12px; max-width: 32rem; margin: 0;
}
.kv { display: grid; grid-template-columns: 220px 1fr; gap: .45rem 1rem; }
.kv dt { color: var(--text3); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; }
.kv dd { margin: 0; word-break: break-word; }
.key-reveal .code { font-size: 14px; margin: 1rem 0; }
.alert {
  background: rgba(251, 191, 36, .08);
  border-left: 3px solid var(--warn);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .7rem .9rem; margin: .9rem 0; color: var(--text2); font-size: 13px;
}
.gate { border-left: 3px solid var(--warn); padding-left: 1rem; margin: .9rem 0; }
.gate h3 { margin: 0 0 .3rem; font-size: 14px; }

/* Forms — elevated inputs, hairline border, accent focus ring. */
form { max-width: 100%; }
label { display: block; margin: .7rem 0 .3rem; color: var(--text2); font-size: 12px; font-weight: 500; }
input, select {
  font: inherit; font-size: 13px; background: var(--surface2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; max-width: 100%;
}
input::placeholder { color: var(--text3); }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
input[type=text], input[type=email], input[type=date], input[type=datetime-local] { width: 320px; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.filters { display: flex; flex-wrap: wrap; gap: .8rem; align-items: end; }
.filters .field { display: flex; flex-direction: column; }
.filters input, .filters select { width: auto; min-width: 150px; }
.stack-form { max-width: 34rem; }
.stack-form label { margin-top: .9rem; }
.stack-form input, .stack-form select { display: block; width: 100%; max-width: 34rem; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem 1.2rem; }
.field-grid.three { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.field > label, .field .label-hint { display: block; }
.field > input, .field > select, .field-grid input, .field-grid select { width: 100%; max-width: 100%; }
.label-hint { color: var(--text3); font-size: 12px; font-weight: 400; }
.field-grid .wide { grid-column: 1 / -1; }
textarea { font: inherit; font-size: 13px; background: var(--surface2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; max-width: 100%; }
textarea:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.truncate { display: inline-block; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.raw-details { margin: 1rem 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: .8rem 1rem; }
.raw-details summary { cursor: pointer; color: var(--text2); font-size: 13px; }

/* Wizard: numbered step kickers, clear cards, ghost detect, tick rows, big primary. */
.wizard-section { margin-bottom: 1rem; border-left: 2px solid var(--line); }
.wizard-section:first-of-type { border-left-color: var(--accent); }
.wizard-section .kicker { color: var(--accent); }
.setup-rows input, .setup-rows select { width: 100%; min-width: 130px; }
.setup-rows .row-num { color: var(--text3); width: 2rem; }
.setup-rows input[type=password] { min-width: 190px; }
.credential-block { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface2); padding: 1rem; margin: 1rem 0; }
.credential-block h3 { margin-top: 0; }
.detect-list { border: 0; margin: .8rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; }
.detect-list legend { color: var(--text3); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; padding: 0 0 .4rem; }
.detect-item { display: inline-flex; align-items: center; gap: .4rem; color: var(--text2); font-size: 13px; margin: 0; cursor: pointer; }
.detect-item input { margin: 0; }
.detect-item code { color: var(--text); }
.setup-status-row + .setup-status-row { border-top: 1px solid var(--line); padding-top: .9rem; margin-top: .9rem; }
.result-jobs { list-style: none; padding: 0; margin: 0; }
.result-jobs li + li { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1rem; }

/* Pipeline strips: glyph + label per step, CSS only. */
.strip { display: flex; flex-wrap: wrap; gap: .45rem 1.1rem; align-items: baseline; }
.step { font-size: 13px; color: var(--text3); white-space: nowrap; }
.step .glyph { font-weight: 600; margin-right: .3rem; }
.step.done { color: var(--ok); }
.step.current { color: var(--accent); }
.step.failed { color: var(--danger); }
.step.manual { color: var(--warn); }
.step.pending { color: var(--text3); }
.step-note { color: var(--text3); font-size: 12px; }

/* Client usage bar — CSS width only. */
.muted { color: var(--text3); }
.bar { background: var(--surface2); border: 1px solid var(--line); border-radius: 999px; height: 10px; min-width: 140px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* Login — centered card on dark page with a subtle pure-CSS radial glow. */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.2rem;
  /* Base color must be explicit: the gradient's transparent stops fall through to the canvas. */
  background: radial-gradient(60rem 40rem at 50% 38%, rgba(76, 194, 255, .09), transparent 65%), var(--bg);
}
.login-wrap { width: 100%; max-width: 26rem; position: relative; }
.login-card { padding: 1.8rem; }
.login-card h1 { margin-top: .15rem; }
.login-foot { color: var(--text3); font-size: 12px; text-align: center; margin-top: 1.2rem; }

/* Public landing — same tokens, flat and fast. */
.landing { max-width: 900px; margin: 0 auto; padding: 0 1.25rem; }
.landing-page .landing-top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.2rem 0; border-bottom: 1px solid var(--line);
}
.landing-brand { font-weight: 600; font-size: 16px; letter-spacing: -0.02em; }
.landing .hero { padding: 4rem 0 2.5rem; }
.landing .hero h1 { font-size: clamp(30px, 5.5vw, 46px); font-weight: 600; line-height: 1.12; letter-spacing: -0.03em; max-width: 20ch; }
.landing .lede { color: var(--text2); font-size: 15px; max-width: 56ch; margin: 1.2rem 0 1.8rem; }
.landing-section { padding: 2.25rem 0; border-top: 1px solid var(--line); }
.landing-section h2 { margin-top: 0; font-size: 22px; }
.landing .steps { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.landing .steps .panel { position: relative; padding-left: 3.2rem; margin-bottom: 0; }
.landing .step-num {
  position: absolute; left: 1.2rem; top: 1.15rem;
  font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--accent);
}
.landing code { font-family: var(--mono); font-size: .9em; background: var(--surface2); padding: .1rem .35rem; border-radius: 5px; }
.landing .code-block {
  background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; overflow-x: auto; line-height: 1.6; margin: 1rem 0;
  font-family: var(--mono); font-size: 12px; color: var(--text2);
}
.landing .price-line { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; margin: 1rem 0; }
.landing .handled { padding-left: 1.2rem; color: var(--text2); }
.landing .handled li { margin: .6rem 0; }
.landing .cta { text-align: center; padding: 3.5rem 0; }
.landing .cta .lede { margin-left: auto; margin-right: auto; }
.landing-page .landing-foot {
  max-width: 900px; margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem;
  border-top: 1px solid var(--line); color: var(--text3); font-size: 12px;
}

/* Responsive: single column at ≤640px, scrollable tables, no 390px overflow. */
@media (max-width: 640px) {
  h1 { font-size: 26px; }
  .wrap, .landing { margin: 1.1rem auto; padding: 0 .9rem; }
  .topbar { padding: .55rem .9rem; gap: .5rem; }
  .topbar nav { width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .25rem; }
  .topbar nav a, .topbar nav .btn { white-space: nowrap; }
  .page-head { align-items: start; }
  .cards { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: .1rem; }
  .kv dt { margin-top: .5rem; }
  .card .value { font-size: 22px; }
  .field-grid, .field-grid.three { grid-template-columns: 1fr; }
  .table-scroll table, .table-scroll .setup-rows { min-width: 560px; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .landing .hero { padding: 2.5rem 0 1.5rem; }
  .landing .hero h1 { font-size: clamp(28px, 9vw, 36px); }
  .landing-section { padding: 1.75rem 0; }
  input[type=text], input[type=email], input[type=date], input[type=datetime-local] { width: 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .topbar nav a, a, .card, .panel, tbody tr, input, select {
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
