/* =========================================================
   LeonSMTP — Refined operator UI
   Indigo / slate / amber accent
   ========================================================= */

:root {
  /* Indigo */
  --indigo-950: #0c0a25;
  --indigo-900: #1e1b4b;
  --indigo-800: #312e81;
  --indigo-700: #3730a3;
  --indigo-600: #4f46e5;
  --indigo-500: #6366f1;
  --indigo-400: #818cf8;
  --indigo-200: #c7d2fe;
  --indigo-100: #e0e7ff;
  --indigo-50:  #eef2ff;

  /* Slate */
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50:  #f8fafc;

  /* Amber accent */
  --amber-700: #b45309;
  --amber-600: #d97706;
  --amber-500: #f59e0b;
  --amber-200: #fde68a;
  --amber-100: #fef3c7;
  --amber-50:  #fffbeb;

  /* Emerald (success) */
  --emerald-700: #047857;
  --emerald-600: #059669;
  --emerald-500: #10b981;
  --emerald-100: #d1fae5;
  --emerald-50:  #ecfdf5;

  /* Status compat */
  --green-700: var(--emerald-700);
  --green-100: var(--emerald-100);
  --green-50:  var(--emerald-50);
  --red-700:   #b91c1c;
  --red-100:   #fee2e2;
  --red-50:    #fef2f2;
  --blue-700:  #1d4ed8;
  --blue-100:  #dbeafe;

  /* Semantic */
  --bg:          #f6f7fb;
  --bg-grid:     #eef0f6;
  --panel:       #ffffff;
  --panel-soft:  #fbfbfd;
  --text:        var(--slate-900);
  --text-muted:  var(--slate-500);
  --text-faint:  var(--slate-400);
  --border:      #e6e8ee;
  --border-soft: #eef0f5;
  --ring:        rgba(99,102,241,.45);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15,23,42,.04);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.05);
  --shadow-md: 0 4px 12px rgba(15,23,42,.06), 0 2px 4px rgba(15,23,42,.04);
  --shadow-lg: 0 16px 40px -12px rgba(15,23,42,.18), 0 4px 12px rgba(15,23,42,.06);

  /* Radii */
  --radius:     10px;
  --radius-sm:  6px;
  --radius-lg:  14px;
  --radius-pill: 999px;
}

/* =========================================================
   Reset & base
   ========================================================= */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(15,23,42,.025) 1px, transparent 0);
  background-size: 28px 28px;
  background-attachment: fixed;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea { font: inherit; }
h1, h2, h3, h4, p { margin-top: 0; }
a { color: var(--indigo-600); text-decoration: none; }
a:hover { color: var(--indigo-700); }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; background: var(--slate-100); padding: 1px 6px; border-radius: 4px; }

::selection { background: var(--indigo-100); color: var(--indigo-900); }

/* Focus-visible — accessible ring on every interactive control */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 3px var(--ring);
  border-radius: var(--radius-sm);
}

/* Scrollbar polish */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }

/* =========================================================
   App shell
   ========================================================= */

.app-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100vh;
}

/* ---- Sidebar ---- */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  background:
    radial-gradient(80% 50% at 0% 0%, rgba(99,102,241,.18), transparent 60%),
    linear-gradient(180deg, var(--indigo-950) 0%, #060418 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,.04);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 18px 14px 18px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  margin-bottom: 14px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
  box-shadow:
    0 6px 16px -4px rgba(99,102,241,.55),
    inset 0 1px 0 rgba(255,255,255,.18);
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}

.brand-text strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}

.brand-text small {
  font-size: 11px;
  color: var(--slate-400);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  word-break: break-all;
}

/* Nav */
.sidebar-nav { display: flex; flex-direction: column; gap: 1px; }

.sidebar-nav .nav-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.32);
  padding: 14px 12px 6px;
}

.sidebar-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 36px;
  border-radius: 8px;
  padding: 7px 11px;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(226,232,240,.78);
  transition: background .15s ease, color .15s ease;
}

.sidebar-nav a svg {
  flex-shrink: 0;
  opacity: .72;
  transition: opacity .15s;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,.05);
  color: #fff;
}
.sidebar-nav a:hover svg { opacity: 1; }

.sidebar-nav a.active {
  background: linear-gradient(180deg, rgba(99,102,241,.22), rgba(99,102,241,.12));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(99,102,241,.32);
}
.sidebar-nav a.active::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--indigo-400);
  box-shadow: 0 0 8px var(--indigo-400);
}
.sidebar-nav a.active svg { opacity: 1; color: var(--indigo-200); }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px 4px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-footer .footer-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.sidebar-footer .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-500);
  box-shadow: 0 0 0 3px rgba(16,185,129,.18);
}

.sidebar-footer .footer-status-text {
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255,255,255,.78);
}

.sidebar-footer small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.32);
  margin-top: 8px;
  margin-bottom: 3px;
}

.sidebar-footer strong {
  font-size: 11.5px;
  color: rgba(226,232,240,.65);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  word-break: break-all;
  font-weight: 500;
}

.logout-form {
  margin-top: 12px;
}

.logout-form .btn-ghost {
  color: rgba(226,232,240,.78);
  padding-left: 0;
}

.logout-form .btn-ghost:hover {
  color: #fff;
  background: transparent;
}

/* ---- Main ---- */

.main {
  min-width: 0;
  padding: 28px 32px 48px;
}

/* =========================================================
   Page header
   ========================================================= */

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

.page-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

h1 {
  margin-bottom: 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--slate-900);
}

h2 {
  margin-bottom: 0;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--slate-900);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

h2 svg { color: var(--slate-500); }

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.muted { color: var(--text-muted); }

/* =========================================================
   Cards
   ========================================================= */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.card-padded { padding: 20px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.card-header h2 { margin: 0; }

.auth-wrap {
  max-width: 420px;
  margin: 10vh auto 0;
}

.auth-card {
  box-shadow: var(--shadow-sm);
}

/* =========================================================
   Metric cards
   ========================================================= */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.metric-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow .18s ease, transform .18s ease;
}

.metric-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--indigo-50);
  color: var(--indigo-600);
  flex-shrink: 0;
}

.metric-icon-amber   { background: var(--amber-50);    color: var(--amber-600); }
.metric-icon-emerald { background: var(--emerald-50);  color: var(--emerald-600); }
.metric-icon-slate   { background: var(--slate-100);   color: var(--slate-600); }
.metric-icon-rose    { background: var(--red-50);      color: var(--red-700); }

.metric-card .metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--slate-500);
}

.metric-card .metric-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--slate-900);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.metric-card .metric-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Live indicator inside metric sub */
.metric-card .metric-sub .pulse-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue-700);
  position: relative;
}
.metric-card .metric-sub .pulse-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--blue-700);
  opacity: .35;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: .35; }
  50%      { transform: scale(1.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .metric-card .metric-sub .pulse-dot::after { animation: none; }
}

/* =========================================================
   Tables
   ========================================================= */

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: linear-gradient(180deg, var(--slate-50), #f3f5fa);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 11px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--slate-500);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-soft);
  color: var(--slate-700);
  font-size: 13.5px;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: #f9fafc; }

td strong { color: var(--slate-900); font-weight: 600; }

td small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 400;
}

td small svg {
  vertical-align: -2px;
  margin-right: 3px;
  color: var(--slate-400);
}

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

.td-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.text-right { text-align: right; }
.text-num { font-variant-numeric: tabular-nums; }

/* =========================================================
   Buttons
   ========================================================= */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, border-color .15s, transform .08s;
  white-space: nowrap;
  letter-spacing: -.005em;
}

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

/* Primary — explicit class only. Bare <button> gets layout from the
   `button, .btn` rule above but no fill, so third-party widgets (Quill
   toolbar, etc.) won't accidentally inherit the primary indigo. */
.btn, .btn-primary, button.primary {
  background: var(--indigo-600);
  color: #fff;
  box-shadow:
    0 1px 2px rgba(67,56,202,.4),
    inset 0 1px 0 rgba(255,255,255,.16);
}
.btn:hover, .btn-primary:hover, button.primary:hover {
  background: var(--indigo-700);
  box-shadow:
    0 2px 6px rgba(67,56,202,.32),
    inset 0 1px 0 rgba(255,255,255,.16);
}

/* Accent (amber) — for highlighted CTAs */
.btn-accent {
  background: var(--amber-500);
  color: #fff;
  box-shadow:
    0 1px 2px rgba(217,119,6,.36),
    inset 0 1px 0 rgba(255,255,255,.2);
}
.btn-accent:hover {
  background: var(--amber-600);
  color: #fff;
}

/* Secondary */
.btn-secondary, button.secondary {
  background: var(--panel);
  color: var(--slate-700);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover, button.secondary:hover {
  background: var(--slate-50);
  border-color: var(--slate-300);
  color: var(--slate-900);
}

/* Danger */
.btn-danger {
  background: var(--red-50);
  color: var(--red-700);
  border: 1px solid #fecaca;
  box-shadow: var(--shadow-xs);
}
.btn-danger:hover { background: var(--red-100); border-color: #fca5a5; }

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--indigo-600);
  padding: 4px 8px;
  min-height: 0;
  border: 0;
  box-shadow: none;
}
.btn-ghost:hover { background: var(--indigo-50); color: var(--indigo-700); }

/* Small */
.btn-sm { min-height: 28px; padding: 4px 10px; font-size: 12px; gap: 5px; }
.btn-xs { min-height: 24px; padding: 2px 8px; font-size: 11.5px; gap: 4px; }

button:disabled, .btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

/* =========================================================
   Forms
   ========================================================= */

.form-stack { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row.three { grid-template-columns: repeat(3, 1fr); }

label {
  display: grid;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate-700);
}

label.label-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="datetime-local"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  min-height: 36px;
  background: var(--panel);
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 7px 11px;
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s, background .15s;
  box-shadow: var(--shadow-xs);
}

input:hover, select:hover, textarea:hover { border-color: var(--slate-400); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,.16), var(--shadow-xs);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--slate-500) 50%),
    linear-gradient(-45deg, transparent 50%, var(--slate-500) 50%);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 11px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  accent-color: var(--indigo-600);
  cursor: pointer;
}

input[type="file"] {
  padding: 5px 8px;
  font-size: 12.5px;
  cursor: pointer;
}

textarea {
  resize: vertical;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  line-height: 1.55;
  min-height: 140px;
}

::placeholder { color: var(--slate-400); }

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: -2px;
  font-weight: 400;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-bar input, .filter-bar select { max-width: 260px; min-height: 32px; }

/* =========================================================
   Pills / status badges
   ========================================================= */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  border-radius: var(--radius-pill);
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .005em;
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1;
}

.pill svg { flex-shrink: 0; }

.pill-draft     { background: var(--indigo-50);   color: var(--indigo-800);   border-color: var(--indigo-100); }
.pill-scheduled { background: var(--amber-50);    color: var(--amber-700);    border-color: var(--amber-100); }
.pill-sending   { background: var(--blue-100);    color: var(--blue-700);     border-color: #bfdbfe; }
.pill-sent      { background: var(--emerald-50);  color: var(--emerald-700);  border-color: var(--emerald-100); }
.pill-paused,
.pill-failed    { background: var(--red-50);      color: var(--red-700);      border-color: #fecaca; }
.pill-canceled  { background: var(--slate-100);   color: var(--slate-600);    border-color: var(--slate-200); }
.pill-neutral   { background: var(--slate-100);   color: var(--slate-600);    border-color: var(--slate-200); }
.pill-ok        { background: var(--emerald-50);  color: var(--emerald-700);  border-color: var(--emerald-100); }
.pill-warn      { background: var(--amber-50);    color: var(--amber-700);    border-color: var(--amber-100); }
.pill-error     { background: var(--red-50);      color: var(--red-700);      border-color: #fecaca; }

.pill-dot::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 2px;
  opacity: .85;
}

/* Status pill that animates for live "sending" state */
.pill-sending.pill-live::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 4px;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse-ring 1.4s ease-out infinite;
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(29,78,216,.5); }
  100% { box-shadow: 0 0 0 6px rgba(29,78,216,0); }
}

@media (prefers-reduced-motion: reduce) {
  .pill-sending.pill-live::before { animation: none; }
}

.count-strip {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.count-strip .pill { font-size: 11px; padding: 1px 7px; min-height: 20px; }

/* =========================================================
   Notices / alerts
   ========================================================= */

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
}

.notice-info    { background: var(--indigo-50);   color: var(--indigo-800);   border-color: var(--indigo-100); }
.notice-warning { background: var(--amber-50);    color: var(--amber-700);    border-color: var(--amber-200); }
.notice-error   { background: var(--red-50);      color: var(--red-700);      border-color: #fecaca; }
.notice-success { background: var(--emerald-50);  color: var(--emerald-700);  border-color: var(--emerald-100); }

.notice code { background: rgba(0,0,0,.06); }

/* =========================================================
   Preflight / test-send panel
   ========================================================= */

.preflight-panel {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--slate-50);
}

.preflight-panel.blocked {
  background: var(--amber-50);
  border-color: var(--amber-200);
}

.preflight-panel.ok {
  background: var(--emerald-50);
  border-color: var(--emerald-100);
}

.preflight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 700;
}

.preflight-panel ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
  font-size: 12.5px;
}

.preflight-panel li.error   { color: var(--red-700); }
.preflight-panel li.warning { color: var(--amber-700); }

/* =========================================================
   Empty state
   ========================================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 180px;
  text-align: center;
  color: var(--text-muted);
  padding: 28px 24px;
}

.empty-state svg {
  width: 36px;
  height: 36px;
  color: var(--slate-300);
  margin-bottom: 4px;
}

.empty-state strong { color: var(--slate-700); font-size: 14px; }
.empty-state p { margin: 0; font-size: 13px; max-width: 320px; }

/* =========================================================
   Layouts
   ========================================================= */

.split-layout {
  display: grid;
  grid-template-columns: minmax(380px, 0.85fr) minmax(0, 1.4fr);
  gap: 20px;
  align-items: start;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-header h2 { margin: 0; }

.section-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
}

/* =========================================================
   Charts (CSS bars)
   ========================================================= */

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}

.chart-bar-label {
  width: 32px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.chart-bar-track {
  flex: 1;
  height: 16px;
  background: var(--slate-100);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.chart-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo-500), var(--indigo-600));
  border-radius: 4px;
  transition: width .35s cubic-bezier(.4,0,.2,1);
  min-width: 2px;
}

.chart-bar-count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--slate-700);
  width: 44px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* Stacked event row (dashboard) */
.event-stack { display: grid; gap: 4px; }

.event-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-soft);
}
.event-row:last-child { border-bottom: 0; }

.event-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.event-icon-emerald { background: var(--emerald-50); color: var(--emerald-600); }
.event-icon-amber   { background: var(--amber-50);   color: var(--amber-600); }
.event-icon-rose    { background: var(--red-50);     color: var(--red-700); }
.event-icon-slate   { background: var(--slate-100);  color: var(--slate-500); }

.event-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-700);
}

.event-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--slate-900);
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   Warm-up bar
   ========================================================= */

.warmup-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--slate-200);
  overflow: hidden;
  margin-top: 6px;
}

.warmup-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--indigo-500), var(--indigo-600));
}

.usage-bar-full {
  background: linear-gradient(90deg, var(--amber-500, #f59e0b), var(--amber-600, #d97706));
}

/* =========================================================
   Provider usage widget
   ========================================================= */

.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  padding: 14px;
  background: var(--slate-50, #f8fafc);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
}

.usage-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.usage-cell-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.usage-cell-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-600);
}

.usage-cell-meta {
  font-size: 11px;
  color: var(--slate-500);
}

.usage-cell-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--slate-900);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.usage-cell-of {
  font-size: 14px;
  font-weight: 500;
  color: var(--slate-500);
}

.usage-cell-sub {
  font-size: 12px;
  color: var(--slate-600);
  margin-top: 4px;
}

/* =========================================================
   Settings strips
   ========================================================= */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.settings-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.settings-item .label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.settings-item .value {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-800);
  word-break: break-all;
}

.font-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }

/* =========================================================
   Blocklist
   ========================================================= */

.blocklist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-soft);
}

.blocklist-row:last-child { border-bottom: 0; }

.blocklist-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.blocklist-indicator.ok      { background: var(--emerald-500); box-shadow: 0 0 0 3px var(--emerald-50); }
.blocklist-indicator.listed  { background: var(--red-700);     box-shadow: 0 0 0 3px var(--red-50); }
.blocklist-indicator.unknown { background: var(--slate-300); }

.blocklist-name {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
}

.blocklist-detail {
  font-size: 12px;
  color: var(--text-muted);
}

/* =========================================================
   Public pages (unsubscribe etc.)
   ========================================================= */

.public-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(99,102,241,.08), transparent 60%),
    var(--bg);
}

.public-card {
  width: min(100%, 440px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px;
  text-align: center;
}

.public-card .public-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
}

.public-card h1 { font-size: 20px; margin-bottom: 8px; }
.public-card p  { color: var(--text-muted); margin-bottom: 22px; }

/* =========================================================
   Row detail (collapsible per-row drawer)
   ========================================================= */

details.row-disclosure {
  margin: 0;
}

details.row-disclosure > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--indigo-600);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  user-select: none;
  transition: background .12s, color .12s;
}

details.row-disclosure > summary:hover {
  background: var(--indigo-50);
  color: var(--indigo-700);
}

details.row-disclosure > summary::-webkit-details-marker { display: none; }
details.row-disclosure > summary::marker { content: ""; }

details.row-disclosure > summary svg {
  transition: transform .15s ease;
}
details.row-disclosure[open] > summary svg.chev {
  transform: rotate(90deg);
}

details.row-disclosure > .row-disclosure-body {
  padding: 10px 4px 4px;
}

/* Inline test-send form variant */
.test-send-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--slate-50);
  border-radius: var(--radius-sm);
}

.test-send-form input { flex: 1; min-width: 200px; max-width: 360px; min-height: 30px; }

.test-recipients-list { list-style: none; padding: 0; margin: 0; }
.test-recipients-list li { padding: 8px 0; border-bottom: 1px solid var(--slate-100); }
.test-recipients-list li:last-child { border-bottom: 0; }

.test-send-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--slate-50);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

/* =========================================================
   Status dot (inline, generic)
   ========================================================= */

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--slate-400);
  flex-shrink: 0;
}

.status-dot-emerald { background: var(--emerald-500); }
.status-dot-amber   { background: var(--amber-500); }
.status-dot-blue    { background: var(--blue-700); }
.status-dot-rose    { background: var(--red-700); }

/* =========================================================
   KBD chip
   ========================================================= */

kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  color: var(--slate-600);
  box-shadow: inset 0 -1px 0 var(--slate-200);
}

/* =========================================================
   Utilities
   ========================================================= */

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

.text-sm { font-size: 12px; }

.flex { display: flex; align-items: center; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.w-full { width: 100%; }

.divider {
  height: 1px;
  background: var(--border-soft);
  margin: 18px 0;
}

/* =========================================================
   Signature preview (in campaign editor)
   ========================================================= */

.signature-preview {
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--indigo-50);
  padding: 10px 14px 12px;
}

.signature-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.signature-preview-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--indigo-700);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.signature-preview-body {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
  max-height: 220px;
  overflow: auto;
}

.signature-preview-body p { margin: 0 0 6px 0; }
.signature-preview-body p:last-child { margin-bottom: 0; }

.signature-preview-empty {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 10px 12px;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }

  .sidebar-inner {
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px;
    overflow: visible;
  }

  .brand { padding-bottom: 0; border-bottom: 0; margin-bottom: 0; flex-shrink: 0; }
  .brand-text small { display: none; }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
  }

  .sidebar-nav .nav-section { display: none; }
  .sidebar-nav a.active::before { display: none; }
  .sidebar-footer { display: none; }

  .main { padding: 20px 16px 40px; }

  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .split-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header-actions { width: 100%; }
}

@media (max-width: 520px) {
  .metrics { grid-template-columns: 1fr; }
  .main { padding: 16px 12px 32px; }
}
