/* MailSetu design system
   Tokens are semantic: components reference roles (--text, --surface, --accent), never raw hex.
   Contrast: body text and status colors meet WCAG AA (4.5:1) in both themes.
   Touch targets: interactive controls are at least 40px high; 44px on mobile. */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --sidebar: #0f1424;
  --sidebar-text: #c3c9d6;
  --sidebar-active: #1c2439;
  --text: #0f1424;
  --muted: #5c6578;
  --border: #e2e5eb;
  --border-strong: #cdd2dc;
  --accent: #4338ca;
  --accent-hover: #3730a3;
  --accent-soft: #eef0ff;
  --accent-ink: #ffffff;
  --ok: #047857;
  --ok-soft: #e7f6ef;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --warn: #92400e;
  --warn-soft: #fef5e6;
  --focus: #4338ca;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(15, 20, 36, 0.05), 0 1px 1px rgba(15, 20, 36, 0.03);
  --shadow-lg: 0 12px 32px rgba(15, 20, 36, 0.12);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px;
  --sidebar-w: 248px;
}

:root[data-theme="dark"] {
  --bg: #0b0f1a;
  --surface: #121829;
  --surface-2: #182036;
  --sidebar: #090c16;
  --sidebar-text: #aab3c5;
  --sidebar-active: #1b2540;
  --text: #eef1f7;
  --muted: #a3acbf;
  --border: #242d45;
  --border-strong: #33405e;
  --accent: #8b8cf7;
  --accent-hover: #a5a6fa;
  --accent-soft: #1d2250;
  --accent-ink: #0b0f1a;
  --ok: #4ade9c;
  --ok-soft: #0f2d22;
  --bad: #ff8a80;
  --bad-soft: #3a1714;
  --warn: #fcd34d;
  --warn-soft: #33270d;
  --focus: #a5a6fa;
  --shadow: none;
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.55 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; letter-spacing: -0.012em; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; max-width: 100%; }
.truncate-cell { display: inline-block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: 8px; top: -48px; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 50; }
.skip-link:focus { top: 8px; }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; }

/* ----- Brand ----- */
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; color: var(--text); letter-spacing: -0.01em; }
.brand-lockup:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); }
.brand-mark .icon { width: 17px; height: 17px; }

/* ----- Auth layout ----- */
.shell { max-width: 440px; margin: 0 auto; padding: 56px 20px; }
.shell .brand-lockup { margin-bottom: 28px; }
.auth-card { padding: 28px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .muted { margin-bottom: 20px; }
.auth-links { margin-top: 18px; text-align: center; font-size: 14px; color: var(--muted); }
.auth-links .btn { margin-top: 0; }

/* ----- App shell ----- */
.frame { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px;
  background: var(--sidebar); color: var(--sidebar-text); padding: 20px 14px;
}
.sidebar .brand-lockup { color: #fff; padding: 0 8px; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px;
  border-radius: var(--radius-sm); color: var(--sidebar-text); font-weight: 500; font-size: 14px;
}
.nav a:hover { background: var(--sidebar-active); color: #fff; text-decoration: none; }
.nav a.is-active { background: var(--sidebar-active); color: #fff; box-shadow: inset 2px 0 0 #8b8cf7; }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding: 0 8px; }
.sidebar-foot .muted { color: #8a93a8; }
.sidebar-foot .btn-ghost { color: var(--sidebar-text); }
.sidebar-foot .btn-ghost:hover { background: var(--sidebar-active); color: #fff; }
.scrim { position: fixed; inset: 0; background: rgba(5, 8, 16, 0.5); z-index: 25; }
.main-col { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--space-3);
  height: 60px; padding: 0 var(--space-6); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar .page-title { font-size: 15px; font-weight: 600; flex: 1; }
.content { padding: var(--space-6); max-width: 1180px; display: grid; gap: var(--space-5); }
.only-mobile { display: none; }
.only-dark { display: none; }
:root[data-theme="dark"] .only-dark { display: inline-flex; }
:root[data-theme="dark"] .only-light { display: none; }

/* ----- Cards ----- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: var(--space-5); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.card-head a { font-size: 14px; font-weight: 500; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); }
.stat { display: grid; gap: 4px; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--space-5); }
.chart-box { position: relative; height: 260px; }
.activity { list-style: none; margin: 0; padding: 0; display: grid; }
.activity li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.activity li:first-child { border-top: 0; }
.empty { display: grid; justify-items: start; gap: 8px; padding: var(--space-6) var(--space-2); }
.empty-title { font-weight: 600; }
.empty.card, .card.empty { padding: var(--space-8); }

/* ----- Badges ----- */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 550; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.badge-accent { background: var(--accent-soft); color: var(--accent); margin-left: 6px; }

/* ----- Buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px;
  padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-size: 14px;
  font-weight: 550; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger-ghost { background: transparent; color: var(--bad); }
.btn-danger-ghost:hover { background: var(--bad-soft); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; margin-top: var(--space-2); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }

/* ----- Forms ----- */
.field { display: grid; gap: 6px; margin-bottom: var(--space-3); min-width: 0; }
.field.grow { flex: 1; }
.field.port { width: 120px; }
.field-row { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.field-row .field { flex: 1 1 200px; }
.field-row .field.port { flex: 0 0 120px; }
label { font-size: 13px; font-weight: 550; color: var(--text); }
input, select, textarea {
  font: inherit; font-size: 14px; width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
input::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus { border-color: var(--focus); outline: 2px solid color-mix(in srgb, var(--focus) 35%, transparent); outline-offset: 0; }
.help { font-size: 12.5px; color: var(--muted); }
.field-error { color: var(--bad); font-size: 14px; margin: 0 0 var(--space-3); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 450; margin: var(--space-2) 0; min-height: 40px; }
.check input { width: 18px; height: 18px; min-height: 18px; }
.form-card { max-width: 760px; display: grid; gap: var(--space-4); }
.form-grid { display: grid; gap: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-4); }
.inline-form { display: flex; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; }
.inline-form .field { margin: 0; min-width: 180px; }
.filters { display: flex; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; }
.filters .field { margin: 0; min-width: 150px; }
.filters .field.grow { min-width: 200px; }
.filter-actions { display: flex; gap: 8px; }

/* ----- Notices, toasts, key reveal ----- */
.notice { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.notice .icon { vertical-align: -4px; margin-right: 6px; }
.notice form { margin: 0; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 60; width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 14px; transition: opacity .3s, transform .3s; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); }
.toast-success { border-left: 3px solid var(--ok); }
.toast-error { border-left: 3px solid var(--bad); }
.toast-info { border-left: 3px solid var(--accent); }
.toast-close { border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; min-width: 32px; min-height: 32px; border-radius: 6px; }
.toast-close:hover { background: var(--surface-2); color: var(--text); }
.key-reveal { border-color: var(--accent); background: var(--accent-soft); display: grid; gap: var(--space-3); }
.copy-row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.copy-row code { flex: 1 1 280px; min-width: 0; overflow-wrap: anywhere; background: var(--surface); padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* ----- Tables ----- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.table-card { padding: 0; overflow: hidden; }
.table-meta { padding: var(--space-4) var(--space-5) 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); }

/* ----- Detail ----- */
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.detail { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px 24px; margin: 0; font-size: 14px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; overflow-wrap: anywhere; }

/* ----- Responsive ----- */
@media (max-width: 1024px) {
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .frame { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(288px, 86vw); height: auto; z-index: 30;
    transform: translateX(-100%); transition: transform .24s ease;
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .only-mobile { display: grid; }
  .content { padding: var(--space-4); }
  .topbar { padding: 0 var(--space-4); }
  .detail { grid-template-columns: 1fr; gap: 4px; }
  .detail dt { margin-top: 10px; }
  .field.port { width: auto; }
  .field-row .field.port { flex-basis: 100%; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  input, select { min-height: 44px; }
}
@media (max-width: 480px) {
  .stat-value { font-size: 24px; }
  .shell { padding: 32px 16px; }
  .auth-card { padding: 22px; }
  .toasts { left: 16px; right: 16px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ----- Phase 4 additions ----- */
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); display: grid; gap: var(--space-3); }
.doc { display: grid; gap: var(--space-3); }
.doc h2 { margin-bottom: 0; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--text); }
.code-block { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 6px 14px; border-bottom: 1px solid var(--border); }
.code { margin: 0; padding: 14px; overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 1.6; white-space: pre; }
.code code { font-family: var(--mono); }
@media (max-width: 860px) {
  .code { font-size: 12.5px; }
}

/* ----- Phase 5 additions ----- */
.nav-section { margin: 8px 0 2px; padding: 0 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #7f89a0; }
.nav-admin { display: inline-flex; margin: 8px 0 0; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--sidebar-text); font-size: 13px; }
.nav-admin:hover { background: var(--sidebar-active); color: #fff; text-decoration: none; }
.badge-accent + .badge-accent { margin-left: 4px; }
.table-meta { padding: 16px 20px 0; }
@media (max-width: 860px) {
  .nav-section { color: #7f89a0; }
}

/* Screen-reader labels are absolutely positioned. Contain them so they never widen the page. */
.table-card, .table-wrap, .card { position: relative; }

/* ===== Authentication pages ===== */
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); }
.auth-aside { display: none; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 20px; min-height: 100vh; }
.auth-wrap { width: 100%; max-width: 400px; display: grid; gap: 24px; }
.brand-compact { margin-bottom: 0; }
.brand-light { color: #fff; }
.brand-light:hover { text-decoration: none; }
.auth-head { display: grid; gap: 8px; }
.auth-head h1 { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.auth-head .muted { margin: 0; font-size: 15px; }
.auth-form { display: grid; gap: 18px; }
.auth-form .field { margin: 0; gap: 8px; }
.auth-form input { min-height: 46px; font-size: 15px; padding: 10px 14px; border-radius: 10px; }
.auth-form input[aria-invalid="true"] { border-color: var(--bad); }
.auth-form input:focus { border-color: var(--accent); }
.auth-form label { font-size: 14px; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.label-link { font-size: 13px; font-weight: 500; }
.input-group { position: relative; }
.input-group input { padding-right: 76px; }
.input-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 34px; min-width: 56px;
  padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 550; cursor: pointer;
}
.input-toggle:hover { background: var(--surface-2); color: var(--text); }
.input-toggle[aria-pressed="true"] { color: var(--accent); }
.btn-lg { min-height: 46px; font-size: 15px; border-radius: 10px; }
.form-alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px;
  background: var(--bad-soft); color: var(--bad); font-size: 14px; line-height: 1.45;
}
.form-alert-icon {
  display: grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; margin-top: 1px;
}
.auth-switch { text-align: center; font-size: 14px; color: var(--muted); }
.auth-switch a { font-weight: 550; }
.rules { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.rules li { display: flex; align-items: center; gap: 8px; }
.rules li::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--border-strong); flex: none;
}
.rules li.is-met { color: var(--ok); }
.rules li.is-met::before { background: var(--ok); border-color: var(--ok); box-shadow: inset 0 0 0 3px var(--surface); }
.strength { display: grid; gap: 6px; margin-top: 2px; }
.strength[hidden] { display: none; }
.strength-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.strength-bars span { height: 4px; border-radius: 4px; background: var(--border); transition: background .2s; }
.strength-text { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.strength[data-level="1"] .strength-bars span:nth-child(-n+1),
.strength[data-level="2"] .strength-bars span:nth-child(-n+2),
.strength[data-level="3"] .strength-bars span:nth-child(-n+3),
.strength[data-level="4"] .strength-bars span { background: var(--bad); }
.strength[data-level="2"] .strength-bars span:nth-child(-n+2) { background: var(--warn); }
.strength[data-level="3"] .strength-bars span:nth-child(-n+3) { background: var(--warn); }
.strength[data-level="4"] .strength-bars span { background: var(--ok); }
.strength[data-level="1"] .strength-text { color: var(--bad); }
.strength[data-level="2"] .strength-text, .strength[data-level="3"] .strength-text { color: var(--warn); }
.strength[data-level="4"] .strength-text { color: var(--ok); }
.auth-form .field-error { font-size: 13px; margin: 0; }
.status-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; font-size: 20px; font-weight: 700;
  margin-bottom: 6px;
}
.status-ok { background: var(--ok-soft); color: var(--ok); }
.status-info { background: var(--accent-soft); color: var(--accent); }

/* Split layout on wide screens: brand panel and form */
.aside-body { display: grid; gap: 18px; align-content: center; }
.aside-title { color: #fff; font-size: 34px; line-height: 1.15; font-weight: 650; letter-spacing: -0.025em; }
.aside-lead { color: #b4bdd0; font-size: 16px; max-width: 440px; }
.aside-points { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 14px; }
.aside-points li { display: flex; gap: 12px; align-items: flex-start; color: #dbe1ee; font-size: 14.5px; }
.aside-points .icon { color: #a9abff; margin-top: 2px; }
.aside-foot { color: #8a93a8; font-size: 12.5px; max-width: 420px; }
@media (min-width: 960px) {
  .auth-layout { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
  .auth-aside {
    display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 48px 56px;
    background: var(--sidebar); position: relative; overflow: hidden;
  }
  .auth-aside::before {
    content: ""; position: absolute; inset: auto -20% -30% auto; width: 520px; height: 520px; border-radius: 50%;
    background: radial-gradient(closest-side, rgba(139, 140, 247, 0.22), transparent); pointer-events: none;
  }
  .auth-aside .brand-lockup { position: relative; }
  .brand-compact { display: none; }
  .auth-main { padding: 56px 64px; }
}
@media (max-width: 959px) {
  .auth-main { align-items: flex-start; padding-top: 32px; }
}
@media (max-width: 480px) {
  .auth-head h1 { font-size: 23px; }
  .auth-main { padding: 24px 18px; }
}

/* ===== UI/UX Power Upgrades ===== */
.user-pill { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.06); }
.user-avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 650; flex: none; }
.user-meta { min-width: 0; display: grid; gap: 1px; }
.user-name { font-size: 13px; font-weight: 600; color: #eef1f7; line-height: 1.2; }

.cmd-trigger {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; transition: border-color .15s, color .15s;
}
.cmd-trigger:hover { border-color: var(--border-strong); color: var(--text); }
.cmd-trigger .icon { width: 15px; height: 15px; }
.kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px;
  padding: 0 5px; border-radius: 4px; border: 1px solid var(--border-strong); background: var(--surface-2);
  font-family: var(--mono); font-size: 11px; color: var(--muted);
}
@media (max-width: 560px) { .cmd-trigger-label, .cmd-trigger .kbd { display: none; } }

.cmd-backdrop {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: start center;
  padding: 12vh 16px 16px; background: rgba(5, 8, 16, 0.56); backdrop-filter: blur(4px);
}
.cmd-dialog {
  width: min(540px, 100%); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
}
.cmd-input-wrap { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.cmd-input-wrap .icon { color: var(--muted); flex: none; }
.cmd-input-wrap input { border: 0; background: transparent; min-height: 34px; padding: 0; font-size: 15px; }
.cmd-input-wrap input:focus { outline: none; }
.cmd-list { list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow-y: auto; display: grid; gap: 2px; }
.cmd-list a, .cmd-list button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0;
  border-radius: var(--radius-sm); background: transparent; color: var(--text); font: inherit; font-size: 14px;
  text-align: left; cursor: pointer; text-decoration: none;
}
.cmd-list a:hover, .cmd-list button:hover, .cmd-list .is-highlighted { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.cmd-hint { margin-left: auto; font-size: 12px; color: var(--muted); }

/* Enhanced KPI stat cards */
.stat { position: relative; transition: border-color .15s, transform .15s; }
.stat:hover { border-color: var(--border-strong); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--surface-2); color: var(--muted); }
.stat-icon .icon { width: 15px; height: 15px; }
.stat-accent .stat-icon { background: var(--accent-soft); color: var(--accent); }
.stat-ok .stat-icon { background: var(--ok-soft); color: var(--ok); }
.stat-bad .stat-icon { background: var(--bad-soft); color: var(--bad); }

/* Onboarding checklist */
.onboarding-card { display: grid; gap: 14px; border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.onboarding-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.progress-track { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .25s ease; }
.onboarding-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 10px; }
.onboarding-steps li {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); font-size: 13.5px; font-weight: 500;
}
.onboarding-steps li.is-done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.onboarding-steps li.is-done a { color: var(--ok); }
.step-dot {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-strong); font-size: 12px; font-weight: 650; flex: none;
}
.step-dot .icon { width: 13px; height: 13px; }
.onboarding-steps li.is-done .step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }

/* Recent activity sub-row */
.activity-main { min-width: 0; display: grid; gap: 2px; }

/* Provider presets & pill tabs */
.preset-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.preset-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn {
  display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.chip-btn:hover { background: var(--surface-2); }
.chip-btn.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.pill-tabs { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.pill-tab {
  display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border-radius: 999px;
  font-size: 13px; font-weight: 550; color: var(--muted); text-decoration: none;
}
.pill-tab:hover { color: var(--text); text-decoration: none; }
.pill-tab.is-active { background: var(--accent); color: var(--accent-ink); }

/* Doc tabs & playground */
.doc-tabs { display: grid; gap: 10px; }
.doc-tablist { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.doc-tab {
  min-height: 32px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 550; cursor: pointer;
}
.doc-tab:hover { background: var(--surface-2); color: var(--text); }
.doc-tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }

/* Recipients, inline copy, acceptance rate bar */
.recipient-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.inline-copy { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rate-cell { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.rate-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--bad-soft); overflow: hidden; max-width: 90px; }
.rate-bar span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }

@media (min-width: 861px) { .only-mobile { display: none; } }
.field-row { align-items: start; }

/* ===== Responsive Mobile-First & Quick Actions Upgrades ===== */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.qa-btn {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13.5px;
  font-weight: 550; text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, background .15s;
}
.qa-btn:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.qa-btn .icon { color: var(--accent); flex: none; }

.toolbar-compact { gap: 10px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.only-mobile-inline { display: none; }

@media (max-width: 860px) {
  .only-mobile-inline { display: inline-flex; }
  .filters-collapsible { display: none; }
  .filters-collapsible.is-open { display: grid; }
  .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .filters .field.grow { grid-column: 1 / -1; min-width: 0; }
  .filters .field { min-width: 0; }
  .filters .filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .filters-collapsible:not(.is-open) { display: none; }
  .stats-grid-mobile { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats-grid-mobile .card { padding: 14px; }
  .stats-grid-mobile .stat-value { font-size: 22px; }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .mobile-cards thead { display: none; }
  .mobile-cards, .mobile-cards tbody, .mobile-cards tr, .mobile-cards td { display: block; width: 100%; }
  .mobile-cards tbody tr {
    padding: 12px 16px; border-bottom: 1px solid var(--border); display: grid; gap: 6px;
  }
  .mobile-cards tbody tr:last-child { border-bottom: 0; }
  .mobile-cards td {
    padding: 0; border: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    text-align: right; min-width: 0;
  }
  .mobile-cards td::before {
    content: attr(data-label); font-size: 12px; font-weight: 550; color: var(--muted); text-align: left; flex: none;
  }
  .mobile-cards td.mobile-actions { justify-content: flex-start; padding-top: 6px; }
  .mobile-cards td.mobile-actions::before { display: none; }
  .mobile-cards .truncate-cell { max-width: 65vw; white-space: normal; word-break: break-word; text-align: right; }
  .mobile-cards .rate-cell { justify-content: flex-end; }
  .pill-tabs { max-width: 100%; overflow-x: auto; }
}

/* ===== Docs Grid Overflow Fix & Public Docs Layout ===== */
.frame { overflow-x: clip; }
.content { min-width: 0; width: 100%; }
.doc { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.doc-tabs, .doc-tabs > [role="tabpanel"], .code-block, .table-wrap { min-width: 0; max-width: 100%; }
.doc .code { max-width: 100%; overflow-x: auto; }
.mobile-cards td[data-label] { overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .mobile-cards td[data-label="Description"],
  .mobile-cards td[data-label="Notes"],
  .mobile-cards td[data-label="Meaning"],
  .mobile-cards td[data-label="What to do"] {
    flex-direction: column; align-items: flex-start; text-align: left; gap: 3px;
  }
}

.public-topbar { padding: 0; }
.public-topbar-inner {
  width: 100%; max-width: 980px; margin: 0 auto; padding: 0 var(--space-4);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.public-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.public-docs-main { max-width: 980px; margin: 0 auto; padding: var(--space-6) var(--space-4); }
.public-docs-head { display: grid; gap: 6px; }
@media (max-width: 600px) {
  .public-topbar { height: auto; padding: 10px 0; }
  .public-topbar-inner { flex-wrap: wrap; }
  .public-docs-main { padding: var(--space-4); }
}

/* ===== Full-Page Cardless Docs & Animations ===== */
.docs-shell {
  display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 36px; align-items: start;
  width: 100%; min-width: 0;
}
.docs-toc { position: sticky; top: 80px; }
.docs-toc-inner { display: grid; gap: 12px; }
.docs-toc-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.docs-toc-nav { display: grid; gap: 2px; border-left: 1px solid var(--border); }
.docs-toc-nav a {
  display: block; padding: 6px 12px; margin-left: -1px; border-left: 2px solid transparent;
  font-size: 13.5px; font-weight: 500; color: var(--muted); text-decoration: none;
  transition: color .18s, border-color .18s, transform .18s;
}
.docs-toc-nav a:hover { color: var(--text); text-decoration: none; transform: translateX(2px); }
.docs-toc-nav a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.docs-toc-meta { padding-top: 8px; }

.docs-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px; min-width: 0; }
.docs-hero { display: grid; gap: 14px; padding-bottom: 28px; border-bottom: 1px solid var(--border); min-width: 0; }
.docs-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.docs-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 650;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: docs-pulse 2s infinite; }
@keyframes docs-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(1.25); } }
.docs-llms-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 550; color: var(--muted); }
.docs-llms-link:hover { color: var(--accent); }
.docs-h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; }
.docs-lead { font-size: 15.5px; color: var(--muted); max-width: 66ch; }

.endpoint-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px;
  border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface);
  min-width: 0; max-width: 100%; overflow: hidden;
}
.endpoint-bar code { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.method-badge {
  flex: none; padding: 3px 8px; border-radius: 6px; background: var(--ok-soft); color: var(--ok);
  font-family: var(--mono); font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em;
}

.docs-steps {
  list-style: none; margin: 4px 0 0; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px;
}
.docs-steps li {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 0;
  border-top: 2px solid var(--border); transition: border-color .2s;
}
.docs-steps li:hover { border-top-color: var(--accent); }
.docs-step-num {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; flex: none;
}

.docs-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding-bottom: 32px; border-bottom: 1px solid var(--border); min-width: 0; scroll-margin-top: 76px; }
.docs-section:last-child { border-bottom: 0; padding-bottom: 16px; }
.docs-sec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.docs-callout {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); background: var(--surface);
}
.docs-table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.docs-resp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; min-width: 0; }
.playground-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 20px; align-items: start; min-width: 0; }
.playground-preview { display: grid; gap: 12px; min-width: 0; }

/* Smooth section reveal animation */
.docs-reveal { animation: docs-enter .4s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes docs-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1024px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .docs-toc { position: static; }
  .docs-toc-title, .docs-toc-meta { display: none; }
  .docs-toc-nav {
    display: flex; gap: 6px; overflow-x: auto; border-left: 0; padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .docs-toc-nav a {
    border-left: 0; margin-left: 0; white-space: nowrap; padding: 6px 12px;
    border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13px;
  }
  .docs-toc-nav a.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
  .playground-grid, .docs-resp-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .docs-h1 { font-size: 22px; }
}

/* ===== Common Professional Public Footer & Auth OTP Upgrades ===== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 40px 0 32px;
  color: var(--muted);
  font-size: 13.5px;
}
.site-footer-inner {
  width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--space-5);
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px; align-items: start;
}
.site-footer-brand { display: grid; gap: 10px; max-width: 380px; }
.site-footer-copy { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.site-footer-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.site-footer-col { display: grid; gap: 8px; align-content: start; }
.site-footer-heading { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); margin-bottom: 2px; }
.site-footer-col a { color: var(--muted); text-decoration: none; transition: color .15s; }
.site-footer-col a:hover { color: var(--accent); text-decoration: none; }

@media (max-width: 720px) {
  .site-footer { padding: 32px 0 28px; }
  .site-footer-inner { grid-template-columns: 1fr; gap: 24px; padding: 0 var(--space-4); }
}

.auth-mode-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border);
}
.auth-mode-tab {
  min-height: 38px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background .18s, color .18s, box-shadow .18s;
}
.auth-mode-tab:hover { color: var(--text); }
.auth-mode-tab.is-active {
  background: var(--surface); color: var(--accent); box-shadow: var(--shadow);
}
.otp-input {
  text-align: center; font-size: 22px !important; font-weight: 700; letter-spacing: 0.35em;
}

.site-footer-bottom {
  width: 100%; max-width: 1120px; margin: 28px auto 0; padding: 18px var(--space-5) 0;
  border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted);
}
@media (max-width: 720px) {
  .site-footer-bottom { margin-top: 22px; padding: 16px var(--space-4) 0; }
}

/* ===== Profile Page & Avatar Upgrades ===== */
.form-actions { align-items: center; }
.user-avatar-img {
  width: 32px; height: 32px; border-radius: 999px; object-fit: cover; flex: none;
  background: var(--accent-soft); border: 1px solid rgba(255, 255, 255, 0.14);
}
.profile-hero { display: grid; gap: 20px; }
.profile-hero-top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.avatar-ring {
  position: relative; width: 84px; height: 84px; padding: 3px; border-radius: 999px; flex: none;
  background: conic-gradient(from 0deg, var(--accent), #7c3aed, #0ea5e9, var(--accent));
  animation: avatar-spin 6s linear infinite;
}
.profile-avatar {
  width: 100%; height: 100%; border-radius: 999px; object-fit: cover;
  background: var(--surface); display: block; border: 2px solid var(--surface);
}
@keyframes avatar-spin { to { filter: hue-rotate(360deg); } }
.profile-identity { display: grid; gap: 4px; min-width: 0; }
.profile-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.profile-avatar-controls {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px;
  padding-top: 16px; border-top: 1px solid var(--border); align-items: end;
}
.avatar-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-presets form { margin: 0; }
.avatar-preset-btn {
  width: 50px; height: 50px; padding: 3px; border-radius: 999px; border: 2px solid var(--border);
  background: var(--surface-2); cursor: pointer; transition: transform .18s, border-color .18s;
  display: grid; place-items: center; overflow: hidden;
}
.avatar-preset-btn:hover { transform: translateY(-2px) scale(1.05); border-color: var(--accent); }
.avatar-preset-btn.is-selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.avatar-preset-btn img { width: 100%; height: 100%; border-radius: 999px; }

.avatar-upload-row { display: flex; gap: 8px; align-items: center; }
.avatar-upload-row input[type="file"] { padding: 6px 10px; font-size: 13px; min-height: 38px; }

.otp-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-left: 3px solid var(--accent);
}
.otp-banner form { margin: 0; }
.otp-ok { color: var(--ok); font-weight: 550; }

@media (max-width: 760px) {
  .profile-avatar-controls { grid-template-columns: 1fr; }
  .avatar-upload-row { flex-wrap: wrap; }
  .avatar-upload-row .btn { width: 100%; }
}

.profile-hero-actions { margin-left: auto; }
.profile-edit-panel { display: grid; gap: var(--space-5); }
@media (max-width: 600px) { .profile-hero-actions { margin-left: 0; width: 100%; } .profile-hero-actions .btn { width: 100%; } }


/* ===== All-Device Responsive & SMTP Live Toggle Polish ===== */
.row-paused {
  opacity: 0.78;
  background: color-mix(in srgb, var(--surface-2, #f8fafc) 65%, transparent);
}
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.card-head {
  flex-wrap: wrap;
  gap: 10px;
}
[role="tablist"] {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
[role="tablist"]::-webkit-scrollbar { display: none; }

@media (max-width: 1024px) {
  .table th, .table td { padding: 11px 12px; }
  .actions { gap: 6px; flex-wrap: wrap; }
}

@media (max-width: 720px) {
  .mobile-cards td.mobile-actions {
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 8px;
  }
  .mobile-cards td.mobile-actions .btn,
  .mobile-cards td.mobile-actions form {
    flex: 0 1 auto;
  }
  .btn-sm {
    min-height: 36px;
    padding: 6px 12px;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .toolbar .btn,
  .toolbar-right {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .stats-grid-mobile {
    grid-template-columns: 1fr;
  }
  .filters {
    grid-template-columns: 1fr;
  }
  .filters .filter-actions {
    width: 100%;
    justify-content: stretch;
  }
  .filters .filter-actions .btn {
    flex: 1 1 0;
  }
  .mobile-cards td.mobile-actions form,
  .mobile-cards td.mobile-actions > a.btn {
    flex: 1 1 calc(50% - 4px);
    text-align: center;
  }
  .mobile-cards td.mobile-actions form .btn {
    width: 100%;
  }
}


/* ===== ChatGPT-Style Syntax Highlighting & Code Surface ===== */
.code-block {
  background: #141724;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(2, 6, 23, 0.22);
}
.code-block-head {
  background: #1b1f31;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  padding: 9px 14px;
}
.code-block pre.code,
pre.code {
  background: #141724;
  color: #e2e8f0;
  line-height: 1.65;
  padding: 16px;
}
.tok-kw { color: #c084fc; font-weight: 500; }
.tok-str { color: #6ee7b7; }
.tok-key { color: #93c5fd; }
.tok-num { color: #fbbf24; }
.tok-fn { color: #60a5fa; }
.tok-flag { color: #f472b6; }
.tok-var { color: #fda4af; }
.tok-com { color: #64748b; font-style: italic; }


/* ===== Enhanced Flash Toasts & Form Alerts ===== */
@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast {
  align-items: center;
  padding: 13px 16px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: toastSlideIn 0.22s ease-out;
}
.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex: none;
}
.toast-icon svg { width: 16px; height: 16px; }
.toast-msg { flex: 1; min-width: 0; line-height: 1.45; font-weight: 500; }
.toast-success {
  border-left: 4px solid var(--ok);
  background: color-mix(in srgb, var(--ok) 10%, var(--surface));
}
.toast-success .toast-icon { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.toast-error {
  border-left: 4px solid var(--bad);
  background: color-mix(in srgb, var(--bad) 10%, var(--surface));
}
.toast-error .toast-icon { color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, transparent); }
.toast-warning {
  border-left: 4px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, var(--surface));
}
.toast-warning .toast-icon { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.toast-info {
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.toast-info .toast-icon { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.form-alert {
  animation: toastSlideIn 0.2s ease-out;
  border-left: 4px solid var(--bad);
}


/* ===== Admin User Detail All-Device Responsive UI/UX ===== */
.form-card { min-width: 0; overflow: hidden; }
.user-detail-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 260px;
}
.user-detail-email {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: clamp(17px, 2.4vw, 22px);
  line-height: 1.3;
}
.user-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 14px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
}
.user-actions-bar .btn-ghost {
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.timed-ban-form {
  display: grid;
  grid-template-columns: 110px 130px minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--border);
  min-width: 0;
}
.timed-ban-form .field { margin: 0; min-width: 0; }
.timed-ban-form input,
.timed-ban-form select { width: 100%; min-width: 0; box-sizing: border-box; }
.form-alert {
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .timed-ban-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .timed-ban-reason,
  .timed-ban-submit {
    grid-column: 1 / -1;
  }
  .timed-ban-submit {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .user-actions-bar form {
    flex: 1 1 calc(50% - 5px);
  }
  .user-actions-bar form .btn {
    width: 100%;
  }
}


/* ===== User Detail 3-Column Skeleton (MailSetu Theme Tokens) ===== */
.ud-shell {
  display: grid;
  gap: 18px;
  min-width: 0;
}
.ud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.ud-header-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
  flex: 1 1 280px;
}
.ud-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.ud-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.ud-card {
  padding: 20px;
  min-width: 0;
}
.ud-card-title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 650;
}
.ud-kv-list {
  display: grid;
  gap: 12px;
}
.ud-kv {
  display: grid;
  gap: 3px;
}
.ud-k {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.ud-v {
  font-size: 14px;
  font-weight: 550;
  color: var(--text);
}
.ud-stat-stack {
  display: grid;
  gap: 10px;
}
.ud-stat-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.ud-stat-ok {
  border-left: 3px solid var(--ok);
  background: color-mix(in srgb, var(--ok) 8%, var(--surface-2));
}
.ud-stat-bad {
  border-left: 3px solid var(--bad);
  background: color-mix(in srgb, var(--bad) 8%, var(--surface-2));
}
.ud-stat-accent {
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
}
.ud-stat-num {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1024px) {
  .ud-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ud-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .ud-grid-3 {
    grid-template-columns: 1fr;
  }
  .ud-card {
    padding: 16px;
  }
}


/* ===== Admin Users List Skeleton Styles ===== */
.users-cell-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.users-cell-link:hover strong {
  color: var(--accent);
  text-decoration: underline;
}
.users-cell-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
  text-align: left;
}
.users-status-stack {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}
