/* Relay control plane. Tokens mirror relay-app/src/app.css (iOS-light default,
   navy dark) so signup, the console and the app read as one product. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: light dark;
  --bg: #f5f5f8;
  --surface: #ffffff;
  --surface-hover: #eeeef2;
  --surface-elevated: #ebebef;
  --border: #e4e4e8;
  --text: #14141f;
  --text-muted: #6b6b78;
  --green: #1a9f4b;
  --green-bg: #25d36622;
  --amber: #b26b00;
  --amber-bg: #f59e0b22;
  --red: #ff3b30;
  --red-text: #d70015;
  --red-bg: #ff3b3014;
  --blue: #007aff;
  --blue-bg: #007aff14;
  --purple: #6b4eff;
  --radius: 14px;
  --field-radius: 8px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f1a;
    --surface: #1a1a2e;
    --surface-hover: #21253a;
    --surface-elevated: #24243e;
    --border: #2a2d3e;
    --text: #eeeeff;
    --text-muted: #9696a8;
    --green: #3ddc84;
    --green-bg: #25d36622;
    --amber: #fbbf24;
    --amber-bg: #f59e0b22;
    --red: #ff453a;
    --red-text: #ff6961;
    --red-bg: #ff453a1f;
    --blue: #0a84ff;
    --blue-bg: #0a84ff22;
  }
}

html, body { background: var(--bg); color: var(--text); }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--blue); }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- brand ---------- */
.mark { color: var(--blue); display: block; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -0.3px; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 26px; height: 26px; }

/* ---------- public shell ---------- */
.public-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; max-width: 1040px; width: 100%; margin: 0 auto; }
.public-top nav { display: flex; gap: 16px; font-size: 14px; }
.public-top nav a { color: var(--text-muted); text-decoration: none; }
.public-top nav a:hover { color: var(--blue); }
main { flex: 1; width: 100%; }
.center { display: flex; align-items: center; justify-content: center; padding: 24px 16px 48px; }
.card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.card-wide { max-width: 760px; }
.card-header { text-align: center; margin-bottom: 24px; }
.card-header .mark { margin: 0 auto 10px; width: 40px; height: 40px; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.25; }
h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.2px; margin: 24px 0 10px; }
h3 { font-size: 15px; font-weight: 650; margin: 18px 0 8px; }
.subtitle { font-size: 14px; color: var(--text-muted); margin-top: 6px; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
p + p { margin-top: 10px; }
.footer { text-align: center; font-size: 13px; color: var(--text-muted); padding: 24px 16px 32px; }
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--blue); }
.footer span + span::before { content: "·"; margin: 0 8px; }

/* ---------- landing ---------- */
.hero { max-width: 760px; margin: 0 auto; padding: 56px 20px 32px; text-align: center; }
.hero .mark { width: 64px; height: 64px; margin: 0 auto 18px; }
.hero h1 { font-size: 40px; letter-spacing: -1.2px; line-height: 1.1; }
.hero .lede { font-size: 18px; color: var(--text-muted); margin: 14px auto 0; max-width: 560px; }
.hero .actions { justify-content: center; margin-top: 28px; }
.features { max-width: 920px; margin: 0 auto; padding: 16px 20px 40px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.feature h2 { margin: 0 0 6px; font-size: 15px; }
.feature p { font-size: 14px; color: var(--text-muted); }
.notice { max-width: 560px; margin: 0 auto; text-align: center; font-size: 14px; color: var(--text-muted); padding: 0 20px 24px; }

/* ---------- forms ---------- */
form.stack, .stack { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 13px; font-weight: 550; color: var(--text-muted); }
.field-hint { font-size: 12.5px; color: var(--text-muted); }
.field-error { font-size: 13px; color: var(--red-text); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--field-radius);
  color: var(--text); font: inherit; font-size: 15px; outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
input[aria-invalid=true] { border-color: var(--red); }
.address { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--field-radius); background: var(--bg); overflow: hidden; }
.address:focus-within { border-color: var(--blue); }
.address input { border: 0; border-radius: 0; min-width: 0; flex: 1; background: transparent; }
.address .suffix { display: flex; align-items: center; padding: 0 12px 0 2px; color: var(--text-muted); font-size: 14px; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; width: 17px; height: 17px; flex: none; accent-color: var(--blue); }
.captcha { display: flex; flex-direction: column; gap: 6px; }
.captcha-status { margin: 0; min-height: 1.4em; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 140px; }

/* ---------- buttons ---------- */
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: var(--field-radius);
  font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: opacity .15s, background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { opacity: .9; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--text-muted); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-danger:disabled, .btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 13px; font-weight: 550; }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; }
form.inline { display: inline; }

/* ---------- messages ---------- */
.alert { font-size: 14px; padding: 10px 12px; border-radius: var(--field-radius); border: 1px solid var(--border); background: var(--surface-hover); }
.alert-error { color: var(--red-text); background: var(--red-bg); border-color: transparent; }
.alert-ok { color: var(--green); background: var(--green-bg); border-color: transparent; }
.alert-warn { color: var(--amber); background: var(--amber-bg); border-color: transparent; }
.banner-template { background: var(--red-bg); color: var(--red-text); border: 1px solid var(--red); border-radius: var(--field-radius); padding: 12px 14px; font-size: 14px; font-weight: 600; margin-bottom: 20px; }

/* ---------- status / progress ---------- */
.steps { list-style: none; display: flex; flex-direction: column; gap: 12px; margin: 8px 0 4px; }
.steps li { display: flex; gap: 12px; align-items: center; font-size: 15px; }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); flex: none; display: inline-flex; align-items: center; justify-content: center; }
.steps .done .dot { background: var(--blue); border-color: var(--blue); }
.steps .done .dot::after { content: ""; width: 6px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.steps .now .dot { border-color: var(--blue); border-top-color: transparent; animation: spin 1s linear infinite; }
.steps .todo { color: var(--text-muted); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .steps .now .dot { animation: none; border-top-color: var(--blue); } }
.linkbox { display: flex; gap: 8px; align-items: stretch; }
.linkbox input { font-family: var(--mono); font-size: 13px; }
.big-ok { width: 44px; height: 44px; border-radius: 50%; background: var(--green-bg); color: var(--green); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }

/* ---------- legal ---------- */
.prose h2 { margin-top: 22px; }
.prose p, .prose li { color: var(--text); font-size: 15px; }
.prose ul, .prose ol { padding-left: 22px; margin: 8px 0; }
.prose li + li { margin-top: 4px; }

/* ---------- error page ---------- */
.error-page { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; text-align: center; }
.error-page .mark { color: var(--red); width: 34px; height: 34px; margin: 0 auto 14px; }
.error-code { font-size: 72px; font-weight: 800; letter-spacing: -4px; line-height: 1; margin-bottom: 8px; }
.error-message { font-size: 16px; color: var(--text-muted); margin-bottom: 28px; max-width: 380px; }
.error-page .actions { justify-content: center; }

/* ---------- console ---------- */
.console-top { background: var(--surface); border-bottom: 1px solid var(--border); }
.console-top .inner { max-width: 1240px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 18px; min-height: 52px; flex-wrap: wrap; }
.console-top nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.console-top nav::-webkit-scrollbar { display: none; }
.console-top nav a { padding: 15px 10px; font-size: 14px; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.console-top nav a:hover { color: var(--text); }
.console-top nav a[aria-current=page] { color: var(--text); border-bottom-color: var(--blue); font-weight: 600; }
.console-top .who { font-size: 13px; color: var(--text-muted); display: flex; gap: 10px; align-items: center; }
.pill-count { background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 6px; margin-left: 4px; }
.console-main { max-width: 1240px; margin: 0 auto; padding: 20px 16px 48px; width: 100%; }
.console-main > h1 { margin-bottom: 4px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.stat .value { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.panel > h2:first-child { margin-top: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; background: var(--surface-hover); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.actions-cell { white-space: nowrap; }
td.actions-cell form + form { margin-left: 4px; }
.empty { padding: 22px; text-align: center; color: var(--text-muted); font-size: 14px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 9px; background: var(--surface-elevated); color: var(--text-muted); white-space: nowrap; }
.badge-up, .badge-active, .badge-ready, .badge-sent, .badge-done { background: var(--green-bg); color: var(--green); }
.badge-degraded, .badge-waitlisted, .badge-capacity, .badge-held, .badge-queued, .badge-provisioning, .badge-pending, .badge-running, .badge-deleting, .badge-suspended { background: var(--amber-bg); color: var(--amber); }
.badge-down, .badge-failed, .badge-missing, .badge-rejected { background: var(--red-bg); color: var(--red-text); }
.badge-unknown, .badge-deleted, .badge-expired, .badge-handled, .badge-cancelled { background: var(--surface-elevated); color: var(--text-muted); }
pre.out { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; max-height: 280px; overflow: auto; }
.mailbody { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; }
details > summary { cursor: pointer; color: var(--blue); font-size: 13px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--text-muted); }
.kv dd { word-break: break-word; }
.danger-zone { border-color: var(--red); }
.code-reveal { font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: 1px; padding: 12px; text-align: center; background: var(--bg); border: 1px dashed var(--border); border-radius: 10px; user-select: all; }
.login-card { max-width: 380px; }

@media (max-width: 720px) {
  .features { grid-template-columns: 1fr; }
  .hero { padding-top: 32px; }
  .hero h1 { font-size: 32px; }
  .hero .lede { font-size: 16px; }
  .card { padding: 24px 20px; }
  .console-top .inner { gap: 4px 12px; padding-top: 8px; }
  .console-top nav { order: 3; flex-basis: 100%; }
  .console-top nav a { padding: 10px 8px; }
  .console-top .who { margin-left: auto; }
  .hide-sm { display: none; }
  .error-code { font-size: 60px; }
}
.center-text { text-align: center; margin-top: 16px; }

/* ---------- layout refinements from the 375/1280 screenshot review ---------- */
.card > .alert { margin-bottom: 16px; }
.footer a, td a, .kv a { text-decoration: none; }
.footer a:hover, td a:hover, .kv a:hover { text-decoration: underline; }
td time { white-space: nowrap; }
.mailbody, .kv dd, td.mono { overflow-wrap: anywhere; word-break: normal; }
.table-wrap > table { min-width: 640px; }
.panel .actions + form, .panel p + form { margin-top: 14px; }
.danger-zone p { margin-bottom: 4px; }
tr.row-dim td { opacity: .6; }
@media (max-width: 720px) {
  .console-top nav { flex-wrap: wrap; overflow-x: visible; }
  .console-top nav a { padding: 8px 8px; }
}
