@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap');

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

:root {
  --bg: #eae8e6;
  --paper: #f4f4f2;
  --ink: #2c2826;
  --ink-soft: #3a3633;
  --line: #d4d1ce;
  --line-soft: #e0ddda;
  --orange: #FA6B1E;
  --orange-dim: #c54f0f;
  --muted: #6b6660;
  --muted-2: #8b8680;
  --success: #3d7a4c;
  --error: #b8302a;
  --warn: #b8742a;
  /* Legacy tokens preserved for any inline references */
  --primary: var(--ink);
  --primary-hover: var(--orange);
  --accent: var(--orange);
  --accent-dark: var(--orange-dim);
  --secondary: var(--muted);
  --bg-dark: var(--ink);
  --bg-pattern: var(--bg);
  --card-bg: var(--paper);
  --text: var(--ink);
  --text-secondary: var(--muted);
  --border: var(--line);
  --input-bg: var(--paper);
}

html, body {
  height: 100%;
}

body {
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  background-image: linear-gradient(to right, rgba(44, 40, 38, 0.04) 1px, transparent 1px);
  background-size: 2px 2px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(250, 107, 30, 0.20);
  color: var(--ink);
}

/* ==================== Top status bar ==================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.topbar .brand svg {
  height: 16px;
  width: auto;
  display: block;
}

.topbar .brand .sep {
  color: var(--muted);
}

.topbar .brand .product {
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 11px;
  color: var(--muted);
}

.topbar-meta .ok {
  color: var(--success);
}

.setup-nudge {
  margin-top: 20px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.setup-nudge a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.12s;
}

.setup-nudge a:hover {
  color: var(--orange);
}

.topbar-setup-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.04em;
  transition: color 0.12s;
}

.topbar-setup-link:hover {
  color: var(--ink);
}

.topbar-meta .ok::before {
  content: '\25CF\00a0';
  color: var(--success);
}

.topbar-sep {
  display: block;
  width: 1px;
  height: 12px;
  background: var(--muted);
  opacity: 0.35;
}

.bottombar .ok {
  color: var(--success);
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.bottombar .ok::before {
  content: '\25CF\00a0';
  color: var(--success);
  display: inline-block;
  vertical-align: middle;
  position: relative;
  top: -1px;
  animation: status-pulse 2.4s ease-in-out infinite;
}

/* ==================== Container + card ==================== */
.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  margin: 0;
  position: relative;
  z-index: 1;
}

.card {
  flex: 1;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  width: 100%;
  max-width: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 0;
  transition: grid-template-columns 0.25s ease;
}

/* Wide mode for management views: hide editorial pane */
.card.wide {
  grid-template-columns: 1fr;
}
.card.wide .editorial {
  display: none;
}
.card.wide .form-pane {
  max-width: 880px;
  margin: 0 auto;
  width: 100%;
}

/* ==================== Editorial pane (left) ==================== */
.editorial {
  padding: 56px 64px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  min-height: 0;
  overflow-y: auto;
}

.editorial .eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
  font-weight: 600;
  margin-bottom: 20px;
}

.editorial .display {
  font-size: 38px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 18px;
}

.editorial .display .line {
  display: block;
}

.editorial .display .slash {
  color: var(--muted);
}

.editorial .lede {
  font-size: 13px;
  color: var(--muted);
  max-width: 460px;
  line-height: 1.65;
}

.editorial .lede .sentence {
  margin: 0;
}
.editorial .lede .sentence + .sentence {
  margin-top: 0.4em;
}

.changelog {
  font-size: 11px;
  color: var(--muted);
  max-width: 460px;
}

.changelog .changelog-eyebrow {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
  font-weight: 600;
  margin-bottom: 10px;
}

.changelog-row {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 14px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.changelog-row:last-child {
  border-bottom: 1px solid var(--line);
}
.changelog-row .date {
  color: var(--ink);
  font-weight: 500;
  font-feature-settings: 'tnum';
}
.changelog-row .what {
  color: var(--muted);
}
.changelog-row .what code {
  background: rgba(44, 40, 38, 0.06);
  padding: 1px 5px;
  border-radius: 0;
  font-size: 10px;
  color: var(--ink);
  font-family: inherit;
}

/* ==================== Form pane (right) ==================== */
.form-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.form-pane .form-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 64px;
}

.form-pane .form-inner {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

/* When card is wide (dashboard etc.), top-align and let inner stretch */
.card.wide .form-pane .form-content {
  justify-content: flex-start;
  padding-top: 56px;
}
.card.wide .form-pane .form-inner {
  max-width: none;
}

/* ==================== Logo (legacy, brand now in topbar) ==================== */
.logo {
  display: none;
}
.logo--legacy-keep {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
}

.logo svg {
  height: 22px;
  width: auto;
}

/* Override the orange path in the wordmark to keep ink color for word part */
.logo svg g[fill="#1E2030"] path {
  fill: var(--ink) !important;
}

.logo .product-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--orange);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.beta-badge {
  font-size: 9px;
  font-weight: 700;
  color: var(--paper);
  background: var(--orange);
  padding: 2px 6px;
  border-radius: 0;
  letter-spacing: 0.10em;
  vertical-align: middle;
  margin-left: 4px;
  text-transform: uppercase;
}

/* ==================== Steps ==================== */
.step {
  display: none;
}

.step.active {
  display: block;
}

/* ==================== Editorial pane line-by-line reveal ==================== */
/* Round 3 grill: shell prompt removed; orange cursor lives at end of the lede,
   appears after the lede animation completes.
   Brand voice animates, data (changelog) does not.
   Sequential: display lines (600ms, 300ms stagger) -> lede sentences (700ms, 300ms stagger).
   Cursor reveals at t=2700ms (after sentence 2 finishes) and blinks. */

/* Cursor — orange blinking block, always visible by default; first-load
   animation hides it until lede finishes, then reveals + blinks. */
.terminal-cursor {
  display: inline-block;
  width: 7px;
  height: 0.95em;
  background: var(--orange);
  margin-left: 4px;
  vertical-align: -0.10em;
  opacity: 1;
  animation: cursor-blink 1.05s steps(1) infinite;
}
@keyframes cursor-blink {
  50% { opacity: 0; }
}

.editorial[data-anim="play"] .display .line,
.editorial[data-anim="play"] .lede .sentence {
  clip-path: inset(0 100% 0 0);
}
.editorial[data-anim="play"] .display .line:nth-child(1) {
  animation: editorial-sweep 600ms 200ms ease-out forwards;
}
.editorial[data-anim="play"] .display .line:nth-child(2) {
  animation: editorial-sweep 600ms 500ms ease-out forwards;
}
.editorial[data-anim="play"] .lede .sentence:nth-child(1) {
  animation: editorial-sweep 700ms 1000ms ease-out forwards;
}
.editorial[data-anim="play"] .lede .sentence:nth-child(2) {
  animation: editorial-sweep 700ms 1300ms ease-out forwards;
}
.editorial[data-anim="play"] .terminal-cursor {
  opacity: 0;
  animation: cursor-show 0s 2000ms forwards, cursor-blink 1.05s 2000ms steps(1) infinite;
}
@keyframes editorial-sweep {
  to { clip-path: inset(0 0 0 0); }
}
@keyframes cursor-show {
  to { opacity: 1; }
}

/* Reduced-motion: snap to final state, no sweep */
@media (prefers-reduced-motion: reduce) {
  .editorial[data-anim="play"] .display .line,
  .editorial[data-anim="play"] .lede .sentence {
    animation: none;
    clip-path: inset(0 0 0 0);
  }
  .editorial[data-anim="play"] .terminal-cursor {
    animation: cursor-blink 1.05s steps(1) infinite;
    opacity: 1;
  }
}

/* ==================== Headings ==================== */
h2 {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.2;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 13px;
  line-height: 1.5;
}

/* ==================== Form controls ==================== */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--ink);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="password"],
.select-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  caret-color: var(--orange);
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.form-group input:focus,
.select-input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 2px rgba(250, 107, 30, 0.25);
}

.form-group input::placeholder {
  color: var(--muted-2);
}

.form-group .hint {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

.form-group.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.form-group.checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--orange);
  cursor: pointer;
  margin: 0;
}

.form-group.checkbox label {
  margin-bottom: 0;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

/* ==================== Buttons ==================== */
.btn {
  width: 100%;
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  margin-top: 24px;
}

.btn.primary::after {
  content: '\2192';
  font-weight: 400;
  transition: transform 0.15s;
}

.btn.primary:hover {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--paper);
}

.btn.primary:hover::after {
  transform: translateX(4px);
}

.btn.primary:disabled {
  background: var(--muted-2);
  border-color: var(--muted-2);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn.primary:disabled::after {
  display: none;
}

.btn.secondary {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
  margin-top: 14px;
  justify-content: center;
}

.btn.secondary::before {
  content: '\2190 ';
  margin-right: 6px;
}

.btn.secondary:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: transparent;
}

.btn .btn-loading {
  display: none;
}

.btn.loading .btn-text {
  display: none;
}

.btn.loading .btn-loading {
  display: inline;
}

.btn.loading::after {
  display: none;
}

/* ==================== Error ==================== */
.error-message {
  background: rgba(184, 48, 42, 0.08);
  border-left: 2px solid var(--error);
  color: var(--error);
  padding: 10px 14px;
  border-radius: 0;
  font-size: 12px;
  margin-top: 16px;
}

/* ==================== Auth method selection ==================== */
.auth-methods {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-method {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  background: var(--paper);
}

.auth-method:hover {
  border-color: var(--ink);
}

.auth-method.selected {
  border-color: var(--orange);
  background: rgba(250, 107, 30, 0.04);
  box-shadow: inset 2px 0 0 var(--orange);
}

.auth-method input[type="radio"] {
  margin-top: 2px;
  width: 14px;
  height: 14px;
  accent-color: var(--orange);
  cursor: pointer;
}

.auth-method-info {
  flex: 1;
}

.auth-method-info .title {
  font-weight: 500;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 3px;
}

.auth-method-info .description {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

/* ==================== Loading + success ==================== */
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.success-icon {
  width: 56px;
  height: 56px;
  background: transparent;
  color: var(--success);
  border: 1px solid var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 20px;
  font-weight: 400;
}

#step-loading,
#step-success,
#step-token-created {
  text-align: center;
  padding: 32px 0;
}

#step-loading p,
#step-success p {
  color: var(--muted);
  font-size: 13px;
}

/* ==================== Bottom strip ==================== */
.bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

footer {
  display: none;
}

/* ==================== Dashboard ==================== */
.session-info {
  display: flex;
  align-items: stretch;
  gap: 0;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 20px;
  padding: 0;
  background: var(--ink);
  border-radius: 0;
  overflow: hidden;
}

.session-detail {
  flex: 1;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.session-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(234, 232, 230, 0.50);
  font-weight: 500;
}

.session-value {
  font-size: 12px;
  font-weight: 500;
  color: rgba(234, 232, 230, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-divider {
  width: 1px;
  align-self: stretch;
  background: rgba(234, 232, 230, 0.10);
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.dashboard-header h2 {
  margin-bottom: 2px;
}

.dashboard-header .subtitle {
  margin-top: 2px;
  margin-bottom: 0;
  font-size: 12px;
}

.dashboard-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.btn-action {
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.btn-action:hover {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--paper);
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}

.btn-icon:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* Keys toolbar */
.keys-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.search-box {
  flex: 1;
  position: relative;
}

.search-box .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 8px 10px 8px 30px;
  font-size: 12px;
  font-family: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.search-box input::placeholder {
  color: var(--muted-2);
}

.search-box input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 2px rgba(250, 107, 30, 0.15);
}

.filter-toggles {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
  flex-shrink: 0;
}

.filter-btn {
  background: var(--paper);
  border: none;
  border-right: 1px solid var(--line);
  padding: 7px 14px;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.filter-btn:last-child {
  border-right: none;
}

.filter-btn:hover {
  color: var(--ink);
  background: var(--bg);
}

.filter-btn.active {
  background: var(--ink);
  color: var(--bg);
}

.api-keys-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
  background: var(--paper);
}

.api-key-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.api-key-item:last-child {
  border-bottom: none;
}

.api-key-item:hover {
  background: var(--bg);
}

.api-key-info {
  flex: 1;
  min-width: 0;
}

.api-key-label {
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--ink);
}

.api-key-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.api-key-chars {
  font-family: inherit;
  font-size: 11px;
  color: var(--muted);
  background: rgba(44, 40, 38, 0.06);
  padding: 1px 6px;
}

.api-key-dates {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-family: inherit;
}

.badge.active {
  background: rgba(61, 122, 76, 0.10);
  color: var(--success);
  border: 1px solid rgba(61, 122, 76, 0.30);
}

.badge.revoked {
  background: rgba(184, 48, 42, 0.10);
  color: var(--error);
  border: 1px solid rgba(184, 48, 42, 0.30);
}

.badge.expired {
  background: rgba(184, 116, 42, 0.10);
  color: var(--warn);
  border: 1px solid rgba(184, 116, 42, 0.30);
}

.btn-revoke {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 0;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.btn-revoke:hover {
  border-color: var(--error);
  color: var(--error);
  background: rgba(184, 48, 42, 0.04);
}

.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--muted);
  font-size: 12px;
}

.empty-state p::before {
  content: '// ';
  color: var(--orange);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  margin-top: 8px;
}

.pagination-info {
  font-size: 11px;
  color: var(--muted);
}

.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-page {
  font-size: 11px;
  color: var(--muted);
  min-width: 40px;
  text-align: center;
  font-feature-settings: 'tnum';
}

.pagination-btn {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0;
  width: 26px;
  height: 26px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.12s, background 0.12s;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--bg);
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Token display */
.token-display {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--ink);
  border-radius: 0;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--ink);
}

.token-display code {
  flex: 1;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 12px;
  color: var(--bg);
  word-break: break-all;
  line-height: 1.5;
  text-align: left;
  min-width: 0;
}

.btn-copy {
  padding: 14px 16px;
  background: var(--orange);
  color: var(--paper);
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.12s;
}

.btn-copy:hover {
  background: var(--orange-dim);
}

.warning {
  color: var(--error);
  font-size: 12px;
  margin-top: 8px;
  background: rgba(184, 48, 42, 0.08);
  border-left: 2px solid var(--error);
  padding: 8px 12px;
}

.warning::before {
  content: '! ';
  font-weight: 700;
}

.token-details {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
}

.token-details p {
  margin-bottom: 4px;
}

.select-input {
  cursor: pointer;
  appearance: auto;
}

/* ==================== Responsive ==================== */
@media (max-width: 980px) {
  .card {
    grid-template-columns: 1fr;
  }
  .editorial {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 32px;
    gap: 24px;
  }
  .editorial .display {
    font-size: 28px;
  }
  /* Tablet: top-align the form, no need to vertically center on a stacked layout */
  .form-pane .form-content {
    padding: 40px 32px;
    justify-content: flex-start;
  }
  .topbar-meta {
    gap: 12px;
    font-size: 10px;
  }
}

@media (max-width: 640px) {
  /* Mobile topbar: brand left, status indicator right; hide build/version meta */
  .topbar {
    padding: 10px 16px;
    flex-wrap: nowrap;
    gap: 12px;
    overflow: hidden;
  }
  .topbar .brand {
    min-width: 0;
    flex-shrink: 1;
  }
  .topbar .brand .product {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-meta {
    flex-shrink: 0;
    gap: 10px;
    font-size: 10px;
  }
  .topbar-meta span:not(.ok) {
    display: none;
  }

  /* Mobile editorial: compress, hide changelog so form is reachable */
  .editorial {
    padding: 24px;
    gap: 16px;
  }
  .editorial .display {
    font-size: 24px;
  }
  .editorial .lede {
    font-size: 12px;
    line-height: 1.6;
  }
  .changelog {
    display: none;
  }

  /* Mobile form */
  .form-pane .form-content {
    padding: 28px 24px 36px;
  }

  /* Mobile bottombar: stack and center */
  .bottombar {
    padding: 10px 16px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    font-size: 9px;
  }

  /* Mobile dashboard: list items stack */
  .api-key-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .btn-revoke {
    align-self: flex-end;
  }
  .keys-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .dashboard-header {
    flex-direction: column;
    gap: 12px;
  }
  .dashboard-actions {
    align-self: stretch;
    justify-content: flex-end;
  }
}

/* ==================== Theme toggle button ==================== */
.theme-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 0;
  line-height: 1;
  transition: color 0.12s;
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  color: var(--ink);
}

/* CSS-driven icon visibility — no JS needed after data-theme is set */
#theme-icon-sun  { display: none; }
#theme-icon-moon { display: block; }

html[data-theme="dark"] #theme-icon-sun  { display: block; }
html[data-theme="dark"] #theme-icon-moon { display: none; }

/* ==================== Theme transition ==================== */
/* Only active for the ~300ms window after a toggle click */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition:
    background-color 0.22s ease,
    border-color     0.22s ease,
    color            0.22s ease,
    box-shadow       0.22s ease !important;
}

/* ==================== Dark mode tokens ==================== */
html[data-theme="dark"] {
  /* Backgrounds — deep navy from Aviatrix Labs palette */
  --bg:        #060f1e;
  --paper:     #0c1628;

  /* Typography — warm cream so the product keeps its character */
  --ink:       #e8e3dc;
  --ink-soft:  #c4bdb4;

  /* Borders */
  --line:      #1a2440;
  --line-soft: #131c36;

  /* Brand orange — slightly more luminous for dark backgrounds */
  --orange:     #FD7A4E;
  --orange-dim: #e05a2a;

  /* Muted text */
  --muted:   #7a8099;
  --muted-2: #4e5570;

  /* Status */
  --success: #5aaa72;
  --error:   #f87171;
  --warn:    #fbbf60;
}

/* Aviatrix wordmark — override hardcoded SVG fill in dark mode.
   CSS fill overrides SVG presentation attributes, so no HTML changes needed. */
html[data-theme="dark"] .brand svg g[fill="#2c2826"],
html[data-theme="dark"] .brand svg g[fill="#1E2030"] {
  fill: var(--ink);
}

/* Dark mode grid: faint blue-tinted vertical lines instead of warm */
html[data-theme="dark"] body {
  background-image: linear-gradient(
    to right,
    rgba(100, 130, 200, 0.05) 1px,
    transparent 1px
  );
}

/* Inline code chips (changelog) */
html[data-theme="dark"] .changelog-row .what code {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
}

/* Selection highlight stays recognisable on both modes */
html[data-theme="dark"] ::selection {
  background: rgba(253, 122, 78, 0.25);
  color: var(--ink);
}

/* ── Buttons ──────────────────────────────────────────── */
/* Primary: swap from ink→orange so it pops on dark bg */
html[data-theme="dark"] .btn.primary {
  background:   var(--ink);
  border-color: var(--ink);
  color:        var(--bg);
}
html[data-theme="dark"] .btn.primary:hover {
  background:   var(--orange);
  border-color: var(--orange);
  color:        var(--bg);
}
html[data-theme="dark"] .btn.primary:disabled {
  background:   var(--muted-2);
  border-color: var(--muted-2);
}

html[data-theme="dark"] .btn-action {
  background:   var(--orange);
  border-color: var(--orange);
  color:        #fff;
}
html[data-theme="dark"] .btn-action:hover {
  background:   var(--orange-dim);
  border-color: var(--orange-dim);
}

/* Auth method selected state: slightly stronger tint on dark */
html[data-theme="dark"] .auth-method.selected {
  background: rgba(253, 122, 78, 0.09);
}

/* ── Inverted surfaces (dark stripe elements) ─────────── */
/* session-info and token-display use background: var(--ink) to create
   a dark stripe.  In dark mode --ink is now cream, so we lock these to
   a near-black surface explicitly so the existing light text stays legible. */
html[data-theme="dark"] .session-info {
  background: #020b18;
}

html[data-theme="dark"] .token-display {
  background:    #020b18;
  border-color:  #020b18;
}
html[data-theme="dark"] .token-display code {
  color: var(--ink);
}
html[data-theme="dark"] .btn-copy {
  background: var(--orange);
}
html[data-theme="dark"] .btn-copy:hover {
  background: var(--orange-dim);
}

/* ── Error / warning surfaces ─────────────────────────── */
html[data-theme="dark"] .error-message {
  background: rgba(248, 113, 113, 0.09);
}
html[data-theme="dark"] .warning {
  background: rgba(248, 113, 113, 0.09);
}

/* ── Scrollbar ────────────────────────────────────────── */
html[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--bg);
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--line);
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--muted-2);
}
