/* ============================================================
   NetPhish Command Center — Design System
   ============================================================ */

/* ── 1. Tokens ─────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-root:       #020617;
  --bg-surface:    #080d18;
  --bg-elevated:   #0f172a;
  --bg-hover:      #131f35;
  --bg-border:     #1e293b;
  --bg-border-hi:  #334155;
  --bg-card-alt:   #0b1120;

  /* Text */
  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --text-disabled:  #475569;
  --text-inverse:   #020617;

  /* Accent */
  --accent:         #0ea5e9;
  --accent-hi:      #38bdf8;
  --accent-lo:      #0284c7;
  --accent-dim:     rgba(14,165,233,0.14);
  --accent-ring:    rgba(14,165,233,0.45);

  /* Semantic */
  --success:        #22c55e;
  --success-dim:    rgba(34,197,94,0.12);
  --success-border: rgba(34,197,94,0.35);
  --warning:        #f59e0b;
  --warning-dim:    rgba(245,158,11,0.12);
  --warning-border: rgba(245,158,11,0.4);
  --danger:         #ef4444;
  --danger-dim:     rgba(239,68,68,0.12);
  --danger-border:  rgba(239,68,68,0.4);
  --info-dim:       rgba(14,165,233,0.10);
  --info-border:    rgba(56,189,248,0.35);

  /* Radius */
  --r-xs:   3px;
  --r-sm:   5px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-pill: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.4);

  /* Transitions */
  --t-fast:   100ms ease;
  --t-normal: 180ms ease;

  /* Layout */
  --sidebar-w:  224px;
  --topbar-h:   56px;
  --content-max: none;
}

/* ── 2. Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Inter", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-root);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* Skip navigation — accessibility */
.skip-link {
  position: absolute;
  top: -100%;
  left: 12px;
  z-index: 9999;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--text-inverse);
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: top var(--t-fast);
}
.skip-link:focus { top: 12px; }

/* ── 3. Focus ───────────────────────────────────────────────── */
:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ── 4. Layout ──────────────────────────────────────────────── */
.app {
  display: flex;
  min-height: 100vh;
}

/* ── 5. Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--bg-border);
  padding: 14px 10px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 16px;
  border-bottom: 1px solid var(--bg-border);
  margin-bottom: 16px;
}

.sidebar__logo {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-lo) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: var(--text-inverse);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(14,165,233,0.35);
  letter-spacing: -0.5px;
}

.sidebar__brand { min-width: 0; }

.sidebar__brand-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar__brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 1px;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.sidebar__nav-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 20px;
}

.sidebar__nav-group:last-child { margin-bottom: 0; }

.sidebar__nav-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 10px 6px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 450;
  transition: background var(--t-fast), color var(--t-fast);
  border-left: 2px solid transparent;
  position: relative;
}

.sidebar__link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar__link--active {
  background: var(--accent-dim);
  color: var(--accent-hi);
  font-weight: 600;
  border-left-color: var(--accent);
}

.sidebar__link--active:hover {
  background: rgba(14,165,233,0.18);
  color: var(--accent-hi);
}

/* Platform variant */
.sidebar--platform {
  border-right-color: rgba(245,158,11,0.3);
  background: linear-gradient(180deg, #0c0a09 0%, var(--bg-surface) 50%);
}

.sidebar__logo--platform {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 2px 8px rgba(245,158,11,0.35);
}

.app--platform {
  box-shadow: inset 0 2px 0 rgba(245,158,11,0.5);
}

/* ── 6. Main content area ───────────────────────────────────── */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--bg-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.topbar__actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar__role {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 9px;
  border-radius: var(--r-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border-hi);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.content {
  padding: 20px;
  max-width: var(--content-max);
  width: 100%;
}

.content a { color: var(--accent-hi); text-decoration: none; }
.content a:hover { color: #93c5fd; text-decoration: underline; }

/* ── 7. Card ────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--bg-border);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.card:last-child { margin-bottom: 0; }

/* Workflow / onboarding cards */
.card--workflow {
  border-left: 3px solid var(--accent);
}

.card--onboarding {
  background: var(--info-dim);
  border-color: var(--info-border);
  border-left: 3px solid var(--accent);
  margin-bottom: 12px;
}

.card--onboarding h2 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--text-primary);
}

.card--onboarding p,
.card--onboarding ol {
  color: var(--text-secondary);
}

.card--onboarding p {
  margin: 0 0 10px;
}

.card--onboarding ol {
  margin: 0 0 12px 22px;
  padding: 0;
}

.card--onboarding strong {
  color: var(--text-primary);
}

/* ── 8. Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), opacity var(--t-fast),
              box-shadow var(--t-fast);
  white-space: nowrap;
  line-height: 1;
  user-select: none;
}

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

.btn--primary {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(14,165,233,0.3);
}

.btn--primary:hover {
  background: var(--accent-hi);
  border-color: var(--accent-hi);
  color: var(--text-inverse);
  box-shadow: 0 2px 8px rgba(14,165,233,0.4);
}

.btn--secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--bg-border-hi);
}

.btn--secondary:hover {
  background: var(--bg-hover);
  border-color: var(--bg-border-hi);
  color: var(--text-primary);
}

.btn--danger {
  background: var(--danger-dim);
  color: #fca5a5;
  border-color: var(--danger-border);
}

.btn--danger:hover {
  background: rgba(239,68,68,0.2);
  border-color: var(--danger);
  color: #fecaca;
}

.content a.btn,
.content a.btn:hover,
.content a.btn:focus {
  text-decoration: none;
}

.content a.btn--primary,
.content a.btn--primary:hover,
.content a.btn--primary:focus {
  color: var(--text-inverse);
}

.content a.btn--secondary,
.content a.btn--secondary:hover,
.content a.btn--secondary:focus {
  color: var(--text-primary);
}

.content a.btn--danger,
.content a.btn--danger:hover,
.content a.btn--danger:focus {
  color: #fecaca;
}

.btn--sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--r-xs);
}

.btn--lg {
  padding: 10px 20px;
  font-size: 15px;
  border-radius: var(--r-md);
}

.btn:disabled,
.btn[aria-busy="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn[aria-busy="true"]::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

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

/* ── 9. Forms ───────────────────────────────────────────────── */
.form {
  max-width: 480px;
  margin-top: 10px;
}

/* Wide forms (email compose, campaign new) */
.form--test-email-wide,
.form--wide {
  max-width: min(960px, 100%);
}

.form__group {
  margin-bottom: 16px;
}

/* Both raw label and .form__label */
.form__group label,
.form__label {
  display: block;
  margin-bottom: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.form__input {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--bg-border-hi);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
}

.form__input::placeholder { color: var(--text-disabled); }

.form__input:hover { border-color: #4b5e78; }

.form__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.form__input[readonly],
.form__input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

textarea.form__input {
  resize: vertical;
  min-height: 70px;
  line-height: 1.55;
}

select.form__input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M4.7 6.3l3.3 3.3 3.3-3.3.9 1L8 11.6 3.8 7.3z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
}

.form__actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.form__hint {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Input with inline button (password toggle etc.) */
.input-group {
  position: relative;
}

.input-group .form__input {
  padding-right: 42px;
}

.input-group__btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--r-xs);
  transition: color var(--t-fast);
  display: flex;
  align-items: center;
}

.input-group__btn:hover { color: var(--text-primary); }

/* ── 10. Tables ─────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  padding: 9px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--bg-border);
}

.table td {
  padding: 10px 10px;
  text-align: left;
  border-bottom: 1px solid var(--bg-border);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--t-fast);
}

.table tbody tr:hover td {
  background: var(--bg-hover);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table__empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 0;
  font-style: italic;
}

.table-scroll {
  max-height: min(70vh, 560px);
  overflow: auto;
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  z-index: 1;
  box-shadow: 0 1px 0 var(--bg-border);
}

.table-scroll .table { margin: 0; }

/* ── 11. Alerts ─────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  margin-bottom: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  border: 1px solid transparent;
}

.alert::before {
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert--error {
  background: var(--danger-dim);
  border-color: var(--danger-border);
  color: #fecaca;
}
.alert--error::before { content: "✕"; color: var(--danger); }

.alert--success {
  background: var(--success-dim);
  border-color: var(--success-border);
  color: #bbf7d0;
}
.alert--success::before { content: "✓"; color: var(--success); }

.alert--warning {
  background: var(--warning-dim);
  border-color: var(--warning-border);
  color: #fde68a;
}
.alert--warning::before { content: "!"; font-weight: 900; color: var(--warning); }

.alert--info {
  background: var(--info-dim);
  border-color: var(--info-border);
  color: #bae6fd;
}
.alert--info::before { content: "ℹ"; color: var(--accent); }

.alert--sensitive {
  background: rgba(120,53,15,0.2);
  border-color: rgba(245,158,11,0.4);
  color: #fde68a;
}
.alert--sensitive::before { content: "⚠"; color: var(--warning); }

/* ── 12. Badges & Status ────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  vertical-align: middle;
}

.badge--system {
  background: rgba(100,116,139,0.25);
  color: #cbd5e1;
  border: 1px solid rgba(100,116,139,0.3);
}
.badge--draft     { background: rgba(100,116,139,0.20); color: #94a3b8; }
.badge--running   { background: rgba(34,197,94,0.18);   color: #86efac; }
.badge--paused    { background: rgba(234,179,8,0.18);   color: #fde68a; }
.badge--completed { background: rgba(14,165,233,0.18);  color: #7dd3fc; }
.badge--scheduled { background: rgba(168,85,247,0.18);  color: #d8b4fe; }
.badge--failed    { background: rgba(239,68,68,0.18);   color: #fca5a5; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status--online  { background: var(--success-dim); color: #86efac; }
.status--online::before { background: var(--success); box-shadow: 0 0 6px var(--success); }

.status--offline { background: rgba(107,114,128,0.15); color: #9ca3af; }
.status--offline::before { background: #6b7280; }

.status--suspended { background: var(--danger-dim); color: #fecaca; }
.status--suspended::before { background: var(--danger); }

.status--queued  { background: rgba(107,114,128,0.15); color: #9ca3af; }
.status--queued::before { background: #6b7280; }

.status--sent    { background: var(--success-dim); color: #86efac; }
.status--sent::before { background: var(--success); }

.status--delivered { background: rgba(34,197,94,0.2); color: #4ade80; }
.status--delivered::before { background: var(--success); }

.status--failed  { background: var(--danger-dim); color: #fecaca; }
.status--failed::before { background: var(--danger); }

/* ── 13. Stage & Tag badges (targets) ──────────────────────── */
.stage-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--r-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.stage-badge--none     { background: rgba(100,116,139,0.18); color: #94a3b8; }
.stage-badge--sent     { background: rgba(14,165,233,0.16);  color: #7dd3fc; }
.stage-badge--opened   { background: rgba(250,204,21,0.16);  color: #fde68a; }
.stage-badge--clicked  { background: rgba(249,115,22,0.16);  color: #fdba74; }
.stage-badge--captured { background: rgba(239,68,68,0.18);   color: #fca5a5; }

.tag-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--accent-dim);
  color: #7dd3fc;
  border: 1px solid rgba(14,165,233,0.25);
  margin: 1px 2px;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--t-fast);
}
a.tag-badge:hover { background: rgba(14,165,233,0.22); }

/* ── 14. Typography helpers ─────────────────────────────────── */
.text-muted {
  color: var(--text-muted);
  font-size: 13px;
}

.text-error  { color: #fca5a5; font-size: 12px; }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.text-strong { font-weight: 600; }

/* ── 15. Dashboard ──────────────────────────────────────────── */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  display: block;
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--bg-border);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--t-normal), background var(--t-normal),
              box-shadow var(--t-normal), transform var(--t-normal);
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  border-color: var(--bg-border-hi);
  background: var(--bg-elevated);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.stat-card--static { cursor: default; }
.stat-card--static:hover {
  border-color: var(--bg-border);
  background: var(--bg-surface);
  transform: none;
  box-shadow: var(--shadow-sm);
}

.stat-card__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-card__value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.stat-card__value--sm {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
}

/* Dashboard event chart */
.dashboard-chart-card h2 { margin-bottom: 4px; font-size: 15px; }
.dashboard-chart__subtitle { margin: 0 0 14px; }

.dashboard-chart {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  min-height: 132px;
  padding-top: 4px;
  overflow-x: auto;
}

.dashboard-chart__col {
  flex: 1 0 22px;
  min-width: 22px;
  max-width: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.dashboard-chart__bar-wrap {
  width: 100%;
  height: 96px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: var(--r-xs);
  background: rgba(15,23,42,0.6);
}

.dashboard-chart__bar {
  width: 72%;
  min-height: 2px;
  max-height: 100%;
  background: linear-gradient(180deg, var(--accent-hi) 0%, var(--accent-lo) 100%);
  border-radius: 2px 2px 0 0;
  transition: height var(--t-normal);
}

.dashboard-chart__label {
  font-size: 9.5px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

/* ── 16. Detail list (single definition) ───────────────────── */
.detail-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 13.5px;
}

.detail-list dt {
  color: var(--text-muted);
  font-weight: 500;
  padding-top: 1px;
}

.detail-list dd {
  margin: 0;
  color: var(--text-primary);
  word-break: break-word;
}

/* ── 17. Credential / code blocks ──────────────────────────── */
.credential {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 12.5px;
  margin: 0 0 12px;
}

.credential code { word-break: break-all; }

/* ── 18. Tenant switch ──────────────────────────────────────── */
.tenant-switch {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-right: 4px;
}

.tenant-switch__label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
}

.tenant-switch__select {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--bg-border-hi);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  font-size: 13px;
  max-width: 200px;
  cursor: pointer;
  transition: border-color var(--t-fast);
}

.tenant-switch__select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ── 19. Callout ────────────────────────────────────────────── */
.callout {
  padding: 12px 16px;
  border-radius: var(--r-md);
  margin-bottom: 18px;
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--info-dim);
  border: 1px solid var(--info-border);
  color: #bae6fd;
}

.callout strong { color: #e0f2fe; }

/* ── 20. Agent-specific components ─────────────────────────── */
.agent-liveness { margin-bottom: 16px; }

.agent-liveness__strip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--bg-border-hi);
  background: var(--bg-elevated);
}

.agent-liveness__strip--ok {
  border-color: var(--success-border);
  background: var(--success-dim);
}

.agent-liveness__strip--wait {
  border-color: var(--warning-border);
  background: var(--warning-dim);
}

.agent-liveness__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  background: var(--text-muted);
}

.agent-liveness__strip--ok .agent-liveness__dot {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34,197,94,0.55);
}

.agent-liveness__strip--wait .agent-liveness__dot {
  background: var(--warning);
}

.agent-liveness__dot--pulse {
  animation: agent-dot-pulse 1.6s ease-in-out infinite;
}

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

.agent-liveness__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  line-height: 1.4;
}

.agent-liveness__meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.agent-dns-card {
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

.agent-dns-card--ready {
  border-color: var(--success-border);
  box-shadow: 0 0 0 1px rgba(34,197,94,0.1);
}

.agent-dns-card__head { padding: 4px 0 12px; }

.agent-dns-card__title { margin: 0 0 6px; font-size: 17px; }

.agent-dns-card__lede { margin: 0; font-size: 13px; line-height: 1.45; }

.agent-dns-card__detected-ip {
  margin: 10px 0 0;
  font-size: 13px;
  padding: 8px 11px;
  border-radius: var(--r-sm);
  background: var(--info-dim);
  border: 1px solid var(--info-border);
}

.agent-dns-card__banner { margin-bottom: 12px; }

.agent-dns-card__mailfqdn { font-size: 13px; margin: 0 0 12px; }

.dns-table-wrap {
  overflow-x: auto;
  margin-bottom: 12px;
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
}

.dns-records-table { margin: 0; min-width: 640px; }
.dns-records-table__code { font-size: 12px; word-break: break-all; white-space: pre-wrap; }
.dns-records-table__valuecell { max-width: 280px; }
.dns-records-table__notecell { font-size: 12px; max-width: 220px; }
.dns-records-table__actions { white-space: nowrap; vertical-align: top; }

.agent-dns-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.agent-dns-card__api-hint { font-size: 12px; flex: 1 1 220px; }
.agent-dns-card__hint a { color: var(--accent-hi); }

/* ── 21. Status message helpers ─────────────────────────────── */
.status-msg          { font-size: 13px; font-weight: 500; }
.status-msg--ok      { color: var(--success); }
.status-msg--err     { color: var(--danger); }

/* ── 22. Actions layout helpers ─────────────────────────────── */
.actions-cell    { display: flex; flex-direction: column; gap: 6px; }
.actions-buttons { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── 23. Scrollable region ──────────────────────────────────── */
.table-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.table-scroll::-webkit-scrollbar-track { background: var(--bg-elevated); }
.table-scroll::-webkit-scrollbar-thumb { background: var(--bg-border-hi); border-radius: 3px; }

/* ── 24. Email preview ──────────────────────────────────────── */
.email-preview {
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-elevated);
}

.email-preview__chrome {
  padding: 10px 14px;
  background: var(--bg-root);
  border-bottom: 1px solid var(--bg-border);
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.email-preview__chrome-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  min-width: 0;
}

.email-preview__chrome-row strong {
  flex: 0 0 52px;
  color: var(--text-muted);
  font-weight: 600;
}

.email-preview__chrome-row span {
  color: var(--text-primary);
  word-break: break-word;
  min-width: 0;
}

.email-preview__body {
  position: relative;
  min-height: 240px;
  max-height: min(70vh, 560px);
  background: #f1f5f9;
}

.email-preview__frame {
  display: block;
  width: 100%;
  height: min(70vh, 560px);
  min-height: 240px;
  border: 0;
  background: #fff;
}

.email-preview__frame[hidden] { display: none !important; }

.email-preview__plain {
  margin: 0;
  padding: 16px;
  min-height: 240px;
  max-height: min(70vh, 560px);
  overflow: auto;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.45;
  color: #0f172a;
  white-space: pre-wrap;
  word-break: break-word;
}

.email-preview__hint {
  padding: 7px 14px;
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--bg-root);
  border-top: 1px solid var(--bg-border);
}

/* ── 25. Panel secret credential ────────────────────────────── */
.panel-secret-block  { margin-bottom: 14px; }

.panel-secret-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.panel-secret-dots {
  letter-spacing: 0.12em;
  user-select: none;
  color: var(--text-secondary);
}

.panel-secret-code[hidden] + .panel-secret-dots { display: inline; }
.panel-secret-code:not([hidden]) + .panel-secret-dots { display: none !important; }

/* ── 26. Filter bar ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.filter-bar__input {
  max-width: 260px;
  padding: 7px 11px;
  font-size: 13px;
}

.filter-bar__select {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--bg-border-hi);
  border-radius: var(--r-sm);
  padding: 7px 32px 7px 11px;
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M4.7 6.3l3.3 3.3 3.3-3.3.9 1L8 11.6 3.8 7.3z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 16px;
  transition: border-color var(--t-fast);
}

.filter-bar__select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ── 27. Targets feature ────────────────────────────────────── */
.targets-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.targets-stat { display: flex; align-items: baseline; gap: 7px; }

.targets-stat__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.targets-stat__label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.targets-pagination {
  display: flex;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--bg-border);
  margin-top: 4px;
  gap: 12px;
}

/* ── 28. Phishlets ──────────────────────────────────────────── */
.phishlet-guide {
  margin-bottom: 16px;
  border-left: 3px solid var(--accent);
}

.phishlet-guide__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.phishlet-guide__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-hi);
}

.phishlet-guide__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.phishlet-guide__steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  color: #cbd5e1;
}

.phishlet-guide__step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.phishlet-guide__action-link {
  margin-left: 6px;
  color: var(--accent-hi);
  font-weight: 600;
  white-space: nowrap;
}

.phishlet-meta__grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 16px;
  font-size: 13.5px;
}

.phishlet-meta__grid dt { color: var(--text-muted); font-weight: 500; padding-top: 1px; }
.phishlet-meta__grid dd { margin: 0; color: var(--text-primary); display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

.phishlet-action-card__title { font-size: 14px; font-weight: 600; margin: 0 0 18px; color: var(--text-primary); }

.phishlet-action-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid var(--bg-border);
}

.phishlet-action-step:first-of-type { border-top: none; padding-top: 0; }

.phishlet-action-step__num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border-hi);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.phishlet-action-step__body { flex: 1; }

.phishlet-action-step__label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.phishlet-action-step__select { max-width: 360px; }

.phishlet-action-choices { display: flex; flex-direction: column; gap: 7px; }

.phishlet-action-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
  max-width: 640px;
}

.phishlet-action-choice:hover { border-color: var(--bg-border-hi); background: var(--bg-hover); }

.phishlet-action-choice--selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.phishlet-action-choice input[type=radio] {
  margin-top: 3px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.phishlet-action-choice__pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--r-xs);
  background: rgba(100,116,139,0.22);
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.phishlet-action-choice__pill--primary { background: rgba(14,165,233,0.18); color: var(--accent-hi); }
.phishlet-action-choice__pill--danger  { background: var(--danger-dim); color: #fca5a5; }

.phishlet-action-choice--selected .phishlet-action-choice__pill { background: rgba(14,165,233,0.22); color: var(--accent-hi); }

.phishlet-action-choice__desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.phishlet-action-choice--selected .phishlet-action-choice__desc { color: var(--text-secondary); }

.phishlet-action-submit {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-border);
  flex-wrap: wrap;
}

.phishlet-yaml-preview {
  background: #040810;
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  padding: 16px;
  overflow-x: auto;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0;
  max-height: 420px;
  white-space: pre;
}

.phishlet-yaml-preview code { background: none; color: inherit; font-family: inherit; font-size: inherit; }

.phishlet-yaml-editor {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace !important;
  font-size: 12.5px !important;
  line-height: 1.65 !important;
  resize: vertical;
}

.phishlet-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

@media (max-width: 600px) { .phishlet-form-row { grid-template-columns: 1fr; } }

/* ── 29. Campaign creation ──────────────────────────────────── */
.campaign-section {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.campaign-section__label {
  flex-shrink: 0;
  width: 110px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 18px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  white-space: nowrap;
}

.campaign-section__num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border-hi);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.campaign-section__body { flex: 1; min-width: 0; margin-bottom: 0; }

@media (max-width: 680px) {
  .campaign-section { flex-direction: column; gap: 6px; }
  .campaign-section__label { width: auto; padding-top: 0; }
}

.campaign-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

@media (max-width: 680px) { .campaign-form-row { grid-template-columns: 1fr; } }

.campaign-body-editor { min-height: 220px; resize: vertical; }

.lure-builder { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lure-builder__sub   { flex: 0 0 130px; min-width: 100px; }
.lure-builder__sep   { font-size: 13px; color: var(--text-muted); }
.lure-builder__domain { flex: 1; min-width: 160px; max-width: 260px; }

.campaign-template-picker {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--bg-border);
  margin-bottom: 16px;
}

.campaign-form-submit {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0 8px;
  flex-wrap: wrap;
}

/* ── 30. Accessibility utilities ────────────────────────────── */
.sr-only,
.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;
}

/* ── 31. Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 240px;
    height: 100vh;
    z-index: 200;
    box-shadow: var(--shadow-md);
  }

  .sidebar.is-open { display: flex; }

  .topbar { padding: 0 14px; }
  .content { padding: 14px; }
}

/* Mobile sidebar toggle button */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-primary);
  margin-right: 4px;
}

@media (max-width: 768px) { .sidebar-toggle { display: flex; align-items: center; } }

/* Backdrop for mobile sidebar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 150;
}

.sidebar-backdrop.is-visible { display: block; }

/* ── 32. Campaign detail — readiness & preflight ───────────── */
.checklist-card {
  margin-bottom: 12px;
}

.checklist-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.checklist-card__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.status-pill--ready    { background: rgba(14,165,233,0.2);  color: var(--accent-hi); border: 1px solid rgba(14,165,233,0.4); }
.status-pill--warn     { background: rgba(245,158,11,0.18); color: #fde68a;  border: 1px solid rgba(245,158,11,0.35); }
.status-pill--ok       { background: var(--success-dim);    color: #86efac;  border: 1px solid var(--success-border); }
.status-pill--fail     { background: var(--danger-dim);     color: #fca5a5;  border: 1px solid var(--danger-border); }
.status-pill--pass     { background: var(--success-dim);    color: #86efac;  border: 1px solid var(--success-border); }

.checklist-item {
  padding: 6px 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-bottom: 1px solid var(--bg-border);
}

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

.checklist-item__icon {
  flex: 0 0 20px;
  font-weight: 700;
  font-size: 13px;
  padding-top: 1px;
}

.checklist-item__icon--ok   { color: var(--success); }
.checklist-item__icon--warn { color: var(--warning); }
.checklist-item__icon--fail { color: var(--danger); }

.checklist-item__body { flex: 1; }
.checklist-item__action { flex: 0 0 auto; }

.preflight-check {
  padding: 4px 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.preflight-check__name {
  flex: 0 0 52px;
  text-transform: uppercase;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  font-size: 11px;
}

.preflight-check__name--ok   { color: var(--success); }
.preflight-check__name--fail { color: var(--danger); }

.preflight-check__icon { flex: 0 0 18px; font-size: 13px; }
.preflight-check__detail { flex: 1; color: var(--text-secondary); font-size: 12.5px; }

/* ── 33. Misc layout utilities ──────────────────────────────── */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.gap-6       { gap: 6px; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.gap-16      { gap: 16px; }
.flex-wrap   { flex-wrap: wrap; }
.mt-0        { margin-top: 0; }
.mb-0        { margin-bottom: 0; }
.mb-8        { margin-bottom: 8px; }
.mb-12       { margin-bottom: 12px; }
.mb-16       { margin-bottom: 16px; }
.mt-6        { margin-top: 6px; }
.mt-8        { margin-top: 8px; }
.mt-10       { margin-top: 10px; }
.mt-12       { margin-top: 12px; }
.w-full      { width: 100%; }
.min-w-0     { min-width: 0; }

.card--preflight-ok   { border-color: var(--success-border); }
.card--preflight-fail { border-color: var(--danger-border); }

/* ── 34. Platform settings ─────────────────────────────────── */
.settings-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.settings-intro h2,
.settings-section h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.settings-intro p,
.settings-section p {
  margin-bottom: 0;
}

.settings-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.settings-category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.settings-category-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  padding: 14px;
  min-height: 236px;
}

.settings-category-card--ok { border-color: var(--success-border); }
.settings-category-card--warning { border-color: var(--warning-border); }

.settings-category-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.settings-category-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.settings-category-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.settings-category-card ul {
  margin: 0 0 0 18px;
  padding: 0;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.55;
  flex: 1;
}

.settings-category-card__status {
  flex: 0 0 auto;
  border-radius: var(--r-pill);
  padding: 2px 8px;
  background: rgba(100,116,139,0.16);
  border: 1px solid rgba(100,116,139,0.28);
  color: #cbd5e1;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-category-card--ok .settings-category-card__status {
  color: #86efac;
  background: var(--success-dim);
  border-color: var(--success-border);
}

.settings-category-card--warning .settings-category-card__status {
  color: #fde68a;
  background: var(--warning-dim);
  border-color: var(--warning-border);
}

.settings-category-card__disabled {
  opacity: 0.65;
  pointer-events: none;
}

.settings-agent-summary {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  align-items: start;
  scroll-margin-top: 80px;
}

.settings-agent-summary h2 {
  margin: 0;
  font-size: 18px;
}

.settings-agent-summary p {
  margin-bottom: 0;
}

.settings-status-card {
  border: 1px solid var(--bg-border);
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  padding: 12px 14px;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.settings-status-card span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-status-card strong {
  color: var(--text-primary);
  font-size: 16px;
}

.settings-status-card--ok { border-color: var(--success-border); background: var(--success-dim); }
.settings-status-card--warning { border-color: var(--warning-border); background: var(--warning-dim); }

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-section__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--bg-border);
}

.settings-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.settings-field {
  min-width: 0;
}

.settings-field__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.settings-field__label-row label {
  margin: 0;
}

.settings-source {
  flex: 0 0 auto;
  border-radius: var(--r-pill);
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-source--database { color: #86efac; background: var(--success-dim); border: 1px solid var(--success-border); }
.settings-source--environment { color: #bae6fd; background: var(--info-dim); border: 1px solid var(--info-border); }
.settings-source--unset { color: #cbd5e1; background: rgba(100,116,139,0.16); border: 1px solid rgba(100,116,139,0.28); }

.settings-field__description {
  margin: 0 0 8px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.settings-field__control {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.settings-secret-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--bg-border);
  border-radius: var(--r-sm);
  background: var(--bg-card-alt);
  padding: 8px 10px;
  margin-bottom: 8px;
}

.settings-secret-summary__label {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-secret-summary code {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
}

.settings-clear-override {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
}

.settings-clear-override input {
  margin-top: 2px;
}

.settings-field__guide {
  margin-top: 8px;
  border: 1px solid var(--bg-border);
  border-radius: var(--r-sm);
  background: rgba(15,23,42,0.55);
  padding: 8px 10px;
}

.settings-field__guide summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 700;
}

.settings-field__guide ol {
  margin: 8px 0 0 18px;
  padding: 0;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.55;
}

.settings-field__advanced {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.settings-field__advanced summary {
  cursor: pointer;
  width: max-content;
}

.settings-field__advanced code {
  display: inline-block;
  margin-top: 4px;
  color: var(--text-secondary);
}

.settings-savebar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0 4px;
  background: linear-gradient(180deg, rgba(2,6,23,0), var(--bg-root) 35%);
}

@media (max-width: 900px) {
  .settings-category-grid,
  .settings-status-grid,
  .settings-fields,
  .settings-agent-summary {
    grid-template-columns: 1fr;
  }

  .settings-intro {
    flex-direction: column;
  }
}
