:root {
  --bg: #f8f4ee;
  --bg-soft: #f2ece3;
  --surface: #fffdfa;
  --surface-alt: #f8f2ea;
  --surface-dark: #162033;
  --border: #e6ddcf;
  --border-strong: #d9cfbf;
  --text: #283447;
  --muted: #6f7685;
  --accent: #4b6fc7;
  --accent-strong: #3559a8;
  --accent-soft: #edf1fb;
  --success: #0f766e;
  --success-bg: #eef8f3;
  --danger: #b24659;
  --danger-bg: #fff1f2;
  --shadow: 0 16px 34px rgba(50, 38, 18, 0.06);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

:root[data-theme="dark"] {
  --bg: #0b1220;
  --bg-soft: #10192b;
  --surface: #121c2d;
  --surface-alt: #172235;
  --surface-dark: #0a101a;
  --border: #25344d;
  --border-strong: #334764;
  --text: #edf3ff;
  --muted: #93a4bf;
  --accent: #60a5fa;
  --accent-strong: #93c5fd;
  --accent-soft: #132742;
  --success: #4fd1c5;
  --success-bg: #123a3b;
  --danger: #ff8aa1;
  --danger-bg: #3f1d29;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  font-family: Inter, "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(96, 124, 191, 0.08), transparent 34%),
    radial-gradient(circle at bottom right, rgba(191, 160, 124, 0.08), transparent 26%),
    linear-gradient(180deg, var(--bg), var(--bg-soft));
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
pre, code, .mono-copy { font-family: Consolas, Monaco, "Liberation Mono", monospace; }

.site-shell { min-height: 100vh; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  border-bottom: 1px solid var(--border);
}
.header-inner,
.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-soft);
}
.brand-copy strong {
  display: block;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand-copy small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.site-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.nav-pill,
.icon-button,
.ghost-button,
.primary-button,
.tag {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-pill {
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
}
.nav-pill.is-active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border-strong));
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.icon-button,
.ghost-button {
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.icon-button { width: 42px; padding: 0; }
.primary-button {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  padding: 0 16px;
  cursor: pointer;
}
.primary-button:hover { background: var(--accent-strong); }
.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  box-shadow: none;
}
.link-button { box-shadow: none; }
.light-ghost {
  background: rgba(255,255,255,0.06);
  color: #f3f8ff;
  border-color: rgba(255,255,255,0.18);
}

.page-shell {
  padding: 28px 0 40px;
}
.page-shell > section + section {
  margin-top: 28px;
}
.page-heading {
  margin-bottom: 22px;
}
.page-heading h1,
.hero-simple h2,
.page-hero-simple h2,
.login-grid h1,
.login-grid h2,
.card h3 {
  margin: 8px 0 0;
  letter-spacing: -0.04em;
}
.page-heading h1 {
  font-size: clamp(32px, 5vw, 48px);
}
.eyebrow,
.code-label,
.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.lead-copy,
.muted,
.field-note,
.item-meta,
.detail-line,
.login-intro p,
.login-card p {
  color: var(--muted);
  line-height: 1.7;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-dark {
  background: linear-gradient(180deg, var(--surface-dark), #1a2438);
  color: #eff6ff;
  border-color: rgba(255,255,255,0.08);
}
.card-dark .muted,
.card-dark .code-label,
.card-dark .eyebrow,
.card-dark .detail-line,
.card-dark p {
  color: rgba(239,246,255,0.72);
}
.hero-simple,
.page-hero-simple,
.login-grid { margin-bottom: 0; }
.hero-simple {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}
.inset-card { height: 100%; }
.hero-code {
  display: flex;
  flex-direction: column;
}
.button-row,
.stats-row,
.grid-2,
.grid-3,
.table-actions,
.tag-row {
  display: grid;
  gap: 20px;
}
.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-cards { align-items: stretch; }
.stat-card strong {
  display: block;
  font-size: 42px;
  line-height: 1;
  letter-spacing: -0.06em;
  margin: 12px 0 10px;
}
.stat-title { font-size: 22px !important; line-height: 1.2 !important; }
.card-link {
  display: inline-block;
  margin-top: 16px;
}
.card-head-top {
  align-items: center;
}
.card-link-top {
  font-weight: 600;
  white-space: nowrap;
}
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.simple-stack {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.simple-item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}
.item-title { font-weight: 600; }
.inline-list {
  margin: 18px 0 0;
  padding-left: 18px;
}
.inline-list li + li {
  margin-top: 8px;
}

pre {
  margin: 10px 0 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: #172132;
  color: #eff6ff;
  border: 1px solid rgba(255,255,255,0.08);
  white-space: pre-wrap;
  overflow-x: auto;
  line-height: 1.65;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.compact-head { margin-bottom: 12px; }
.text-link,
.domain-link { color: var(--accent-strong); }

.form-grid.two-up {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.stack-form { display: grid; gap: 18px; }
label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}
.field-stack {
  display: grid;
  gap: 8px;
}
.field-stack > span {
  display: block;
}
.details-content {
  margin-top: 16px;
}
.token-action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.token-action-row form {
  margin: 0;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  color: var(--text);
  padding: 13px 14px;
}
textarea { resize: vertical; min-height: 120px; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}
.wide-button { width: 100%; }

.table-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-top: 14px;
}
.simple-table {
  width: 100%;
  border-collapse: collapse;
}
.simple-table th,
.simple-table td {
  padding: 14px 16px;
  text-align: left;
  border-top: 1px solid var(--border);
  vertical-align: top;
}
.simple-table thead th {
  border-top: 0;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.table-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.inline-danger {
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  padding: 0;
}
.tag-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.tag {
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 0 12px;
  min-height: 36px;
}
.details-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.details-block summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}
.light-details { border-top-color: rgba(255,255,255,0.12); }
.domain-cards {
  display: grid;
  gap: 20px;
  margin-top: 28px;
}
.compact-command-grid { margin-top: 12px; }

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}
.flash {
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}
.flash-success { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 20%, var(--border)); }
.flash-error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 20%, var(--border)); }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  position: relative;
}
.floating-theme {
  position: absolute;
  top: 20px;
  right: 20px;
}
.login-grid {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
}
.login-intro h1 { font-size: clamp(34px, 6vw, 54px); }
.login-card h2 { font-size: 30px; }
.simple-list {
  margin: 20px 0 0;
  padding-left: 18px;
  line-height: 1.9;
}
.login-flashes {
  position: absolute;
  top: 72px;
  width: min(1080px, calc(100% - 40px));
}
.light-eyebrow,
.light-label { color: rgba(239,246,255,0.72); }

@media (max-width: 980px) {
  .stats-row,
  .grid-2,
  .grid-3,
  .login-grid,
  .form-grid.two-up,
  .review-split-card {
    grid-template-columns: 1fr;
  }
  .header-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .site-nav,
  .header-actions,
  .button-row,
  .table-actions,
  .tag-row {
    width: 100%;
  }
  .header-actions { justify-content: space-between; }
}

@media (max-width: 720px) {
  .header-inner,
  .page-shell {
    width: min(100% - 24px, 1180px);
  }
  .card { padding: 18px; }
  .page-heading h1,
  .hero-simple h2,
  .page-hero-simple h2,
  .login-grid h1,
  .login-grid h2 { font-size: 30px; }
  .button-row,
  .header-actions,
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }
}

.review-card {
  display: grid;
  gap: 24px;
}
.review-split-card {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  align-items: stretch;
}
.review-copy-block {
  display: grid;
  align-content: start;
  gap: 16px;
}
.instruction-window {
  display: grid;
  gap: 16px;
}
.instruction-window-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
}
.instruction-window-title {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 600;
  color: #f3f8ff;
}

.review-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tab-button {
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--muted);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 16px;
  cursor: pointer;
}
.tab-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tab-button-dark {
  background: rgba(255,255,255,0.06);
  color: rgba(239,246,255,0.82);
  border-color: rgba(255,255,255,0.12);
}

.tab-button.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border-strong));
}
.tab-button-dark.is-active {
  background: rgba(96,165,250,0.18);
  color: #f3f8ff;
  border-color: rgba(96,165,250,0.42);
}

.tab-panels {
  display: grid;
}

.tab-panel {
  display: grid;
  gap: 18px;
}

.instruction-step {
  padding: 18px 0;
  border-top: 1px solid var(--border);
}
.instruction-step-dark {
  border-top-color: rgba(255,255,255,0.10);
}
.instruction-step-dark h3 {
  color: #f3f8ff;
}
.instruction-window .muted {
  color: rgba(239,246,255,0.72);
}

.instruction-step:first-child {
  padding-top: 0;
  border-top: 0;
}

.instruction-note {
  padding-bottom: 0;
}

.full-width-card {
  width: 100%;
}

.full-width-table {
  width: 100%;
}

.domain-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(720px, calc(100vw - 32px));
  width: 100%;
}

.domain-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.dialog-card {
  padding: 24px;
}

@media (max-width: 720px) {
  .review-tabs {
    flex-direction: column;
  }
}


.review-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.inline-key-creator {
  display: none;
  gap: 14px;
  margin-top: 6px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-alt);
}

.inline-key-creator.is-visible {
  display: grid;
}

.inline-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.inline-key-row .field-note {
  margin: 0;
}

.review-split-card.setup-pending {
  grid-template-columns: minmax(0, 1fr);
}

.instruction-window.is-hidden,
.setup-form-card {
  display: none;
}

.setup-form-card.is-visible {
  display: block;
}

.setup-summary {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}

.setup-summary strong {
  display: block;
  margin-bottom: 4px;
}

.tab-panel {
  display: none;
  gap: 18px;
}

.tab-panel.is-active {
  display: grid;
}


.setup-form-card.is-visible {
  display: block;
  margin-top: 32px;
}

.saved-keys-card {
  margin-top: 32px;
}

.table-actions-end {
  justify-content: flex-end;
}

.tag-muted {
  background: var(--surface-alt);
  color: var(--muted);
}

.tag-status-active {
  background: var(--success-bg);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 20%, var(--border));
}

.tag-status-inactive {
  background: #fff1e8;
  color: #b45309;
  border-color: color-mix(in srgb, #b45309 24%, var(--border));
}

.domain-card-inactive {
  border-color: color-mix(in srgb, #b45309 22%, var(--border));
}

.inactive-domain-note {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, #b45309 20%, var(--border));
  background: #fff7ed;
  color: #9a3412;
  line-height: 1.7;
}


.review-actions .is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border-strong));
}

.setup-summary.is-hidden {
  display: none;
}

.domain-edit-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
