/* ==========================================================================
   NodeMail v4 — Carbon & Porcelain Enterprise Design System
   Zero gradients. Zero glassmorphism. Zero neon. 100% pill buttons (9999px).
   Typography: Bunny Fonts Inter & JetBrains Mono. Icons: Bootstrap Icons.
   ========================================================================== */

:root,
[data-theme="dark"] {
  color-scheme: dark;

  /* True Neutral Carbon Surfaces (Linear / Vercel / Superhuman inspired) */
  --surface-rail: #09090B;
  --surface-sidebar: #0E0E11;
  --surface-list: #121216;
  --surface-reader: #16161B;
  --surface-elevated: #1B1B21;
  --surface-input: #101014;
  --surface-hover: #202028;
  --surface-selected: #23232E;
  --surface-subtle: #18181F;
  --surface-backdrop: rgba(4, 4, 6, 0.72);

  /* Hairline Borders */
  --border-hairline: #23232A;
  --border-strong: #32323D;
  --border-focus: #6366F1;

  /* Typography Ink Hierarchy */
  --ink-primary: #FAFAFA;
  --ink-secondary: #A1A1AA;
  --ink-muted: #71717A;
  --ink-inverse: #09090B;

  /* High-Contrast Monochrome Primary CTA + Disciplined Indigo Signal */
  --cta-bg: #FAFAFA;
  --cta-hover: #E4E4E7;
  --cta-ink: #09090B;

  --accent: #6366F1;
  --accent-hover: #4F46E5;
  --accent-soft: rgba(99, 102, 241, 0.14);
  --accent-border: rgba(99, 102, 241, 0.34);
  --accent-ink: #A5B4FC;

  /* Restrained Enterprise Semantics */
  --ok: #22C55E;
  --ok-soft: rgba(34, 197, 94, 0.12);
  --ok-border: rgba(34, 197, 94, 0.30);

  --warn: #EAB308;
  --warn-soft: rgba(234, 179, 8, 0.12);
  --warn-border: rgba(234, 179, 8, 0.30);

  --danger: #EF4444;
  --danger-hover: #DC2626;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.32);

  /* Crisp Flat Elevation (minimal, zero glow) */
  --shadow-popover: 0 8px 24px rgba(0, 0, 0, 0.44);
  --shadow-modal: 0 18px 48px rgba(0, 0, 0, 0.56);

  /* Shared Typography & Geometry */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-pill: 9999px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --rail-w: 54px;
  --nav-w: 244px;
  --stream-w: 382px;
  --header-h: 52px;

  --ease: 130ms cubic-bezier(0.2, 0, 0, 1);
}

[data-theme="light"] {
  color-scheme: light;

  /* Crisp Porcelain Surfaces */
  --surface-rail: #F4F4F5;
  --surface-sidebar: #FAFAFA;
  --surface-list: #FFFFFF;
  --surface-reader: #FFFFFF;
  --surface-elevated: #FFFFFF;
  --surface-input: #FFFFFF;
  --surface-hover: #F4F4F5;
  --surface-selected: #EEF2FF;
  --surface-subtle: #F7F7F8;
  --surface-backdrop: rgba(9, 9, 11, 0.42);

  /* Hairline Borders */
  --border-hairline: #E4E4E7;
  --border-strong: #D4D4D8;
  --border-focus: #4F46E5;

  /* Typography Ink Hierarchy */
  --ink-primary: #09090B;
  --ink-secondary: #52525B;
  --ink-muted: #71717A;
  --ink-inverse: #FFFFFF;

  /* High-Contrast Vercel-style Solid Black CTA + Crisp Indigo Signal */
  --cta-bg: #09090B;
  --cta-hover: #27272A;
  --cta-ink: #FFFFFF;

  --accent: #4F46E5;
  --accent-hover: #4338CA;
  --accent-soft: #EEF2FF;
  --accent-border: #C7D2FE;
  --accent-ink: #4338CA;

  /* Restrained Semantics */
  --ok: #16A34A;
  --ok-soft: #F0FDF4;
  --ok-border: #BBF7D0;

  --warn: #CA8A04;
  --warn-soft: #FEFCE8;
  --warn-border: #FEF08A;

  --danger: #DC2626;
  --danger-hover: #B91C1C;
  --danger-soft: #FEF2F2;
  --danger-border: #FECACA;

  --shadow-popover: 0 8px 24px rgba(9, 9, 11, 0.08);
  --shadow-modal: 0 20px 50px rgba(9, 9, 11, 0.14);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-primary);
  background: var(--surface-rail);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p { margin: 0; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 9999px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
}

.bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  vertical-align: middle;
}

/* Refined thin scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }

/* ---------- Typography Helpers ---------- */
.mono { font-family: var(--font-mono); }
.tabular { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-xs { font-size: 11.5px; }
.text-sm { font-size: 12.5px; }
.text-muted { color: var(--ink-muted); }
.text-secondary { color: var(--ink-secondary); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

/* ---------- MANDATORY 100% PILL BUTTON SYSTEM ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 15px;
  border-radius: 9999px !important;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease), opacity var(--ease);
  user-select: none;
}

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

.btn-sm {
  height: 29px;
  padding: 0 12px;
  font-size: 12px;
  gap: 5px;
}

.btn-lg {
  height: 38px;
  padding: 0 18px;
  font-size: 13.5px;
}

/* High-contrast monochrome primary CTA */
.btn-primary {
  background: var(--cta-bg);
  color: var(--cta-ink);
  border-color: var(--cta-bg);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--cta-hover);
  border-color: var(--cta-hover);
}

/* Indigo accent pill for rare highlight states */
.btn-accent {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
  font-weight: 600;
}

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

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
}

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

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--ink-primary);
}

.btn-danger {
  background: var(--danger);
  color: #FFFFFF;
  border-color: var(--danger);
  font-weight: 600;
}

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

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger-border);
}

.btn-danger-outline:hover:not(:disabled) {
  background: var(--danger-soft);
}

/* Circular Icon-Only Pill Buttons */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9999px !important;
  color: var(--ink-secondary);
  background: transparent;
  border: 1px solid transparent;
  flex: none;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease);
}

.btn-icon:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--ink-primary);
}

.btn-icon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-icon--sm {
  width: 28px;
  height: 28px;
}

.btn-icon--xs {
  width: 24px;
  height: 24px;
}

.btn-icon--bordered {
  background: var(--surface-elevated);
  border-color: var(--border-hairline);
}

.btn-icon--bordered:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.btn-icon--danger:hover:not(:disabled) {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}

/* ---------- Form Controls ---------- */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.form-hint {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.form-required { color: var(--danger); }

.input,
.select,
.textarea {
  width: 100%;
  background: var(--surface-input);
  border: 1px solid var(--border-hairline);
  color: var(--ink-primary);
  font-size: 13px;
  transition: border-color var(--ease), background-color var(--ease);
  outline: none;
}

.input,
.select {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-md);
}

.input-sm,
.select-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.select {
  border-radius: var(--radius-pill);
  padding-right: 28px;
  cursor: pointer;
}

.textarea {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  resize: vertical;
  min-height: 80px;
  line-height: 1.55;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--border-strong);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--border-focus);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--ink-muted);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input--with-right { padding-right: 38px; }

.input-action-right {
  position: absolute;
  right: 4px;
}

/* Pill Search Input */
.search-pill-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-pill-box .search-pill-icon {
  position: absolute;
  left: 12px;
  color: var(--ink-muted);
  pointer-events: none;
  display: inline-flex;
}

.search-pill-box .input {
  height: 34px;
  border-radius: 9999px;
  padding-left: 34px;
  padding-right: 34px;
  background: var(--surface-input);
}

.checkbox-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-secondary);
  cursor: pointer;
  user-select: none;
}

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

/* ---------- Grid Helpers ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* ---------- Badges & Status Pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border-hairline);
  background: var(--surface-subtle);
  color: var(--ink-secondary);
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: currentColor;
  flex: none;
}

.badge-success { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.badge-warning { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.badge-info,
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-border); }
.badge-neutral { background: var(--surface-subtle); color: var(--ink-secondary); border-color: var(--border-hairline); }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  background: var(--ok);
  flex: none;
}
.status-dot--warn { background: var(--warn); }
.status-dot--danger { background: var(--danger); }

/* ---------- Avatars ---------- */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: var(--surface-hover);
  border: 1px solid var(--border-strong);
  color: var(--ink-primary);
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  letter-spacing: 0.02em;
  user-select: none;
}

.avatar--sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar--lg { width: 38px; height: 38px; font-size: 13px; }
.avatar--accent { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-ink); }

/* ---------- Progress Meter ---------- */
.progress-track {
  width: 100%;
  height: 4px;
  background: var(--border-hairline);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--ink-primary);
  border-radius: 9999px;
  transition: width 200ms ease;
}

.progress-fill--accent { background: var(--accent); }
.progress-fill--ok { background: var(--ok); }
.progress-fill--warn { background: var(--warn); }
.progress-fill--danger { background: var(--danger); }

/* ---------- Alerts ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-subtle);
  color: var(--ink-primary);
}

.alert-danger { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.alert-warning { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.alert-info { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-ink); }
.alert-success { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }

/* ---------- Segmented Pill Tabs ---------- */
.tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: 9999px;
}

.tab-item {
  height: 28px;
  padding: 0 13px;
  border-radius: 9999px !important;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  transition: background-color var(--ease), color var(--ease);
}

.tab-item:hover { color: var(--ink-primary); }

.tab-item.active {
  background: var(--surface-elevated);
  color: var(--ink-primary);
  border: 1px solid var(--border-strong);
  font-weight: 600;
}

/* ---------- Cards & Surfaces ---------- */
.panel-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.panel-card-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-card-sub {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.panel-card-body { padding: 16px 18px; }

/* ---------- Architectural Data Tables ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--surface-subtle);
  white-space: nowrap;
}

.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--ink-primary); }

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-hairline);
  color: var(--ink-primary);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--surface-hover); }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--border-hairline);
  font-size: 12px;
  color: var(--ink-muted);
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 9px;
  border-radius: 9999px !important;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  border: 1px solid var(--border-hairline);
  background: var(--surface-elevated);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease);
}

.page-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.page-btn.active {
  background: var(--cta-bg);
  color: var(--cta-ink);
  border-color: var(--cta-bg);
  font-weight: 600;
}

.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------- Key-Value List ---------- */
.kv-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--border-hairline);
  font-size: 12.5px;
}

.kv-row:last-child { border-bottom: none; }
.kv-key { color: var(--ink-muted); font-size: 12px; }
.kv-val { color: var(--ink-primary); font-weight: 500; text-align: right; }

/* Keyboard Key Cap */
kbd.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  min-height: 20px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  background: var(--surface-subtle);
  border: 1px solid var(--border-strong);
  color: var(--ink-secondary);
}

/* ---------- Dropdown Menus ---------- */
.dropdown { position: relative; display: inline-flex; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 196px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-popover);
  padding: 6px;
  z-index: 90;
  display: none;
  flex-direction: column;
  gap: 2px;
}

.dropdown-menu--up {
  top: auto;
  bottom: calc(100% + 6px);
  left: 0;
  right: auto;
}

.dropdown-menu--wide { min-width: 268px; }
.dropdown-menu.show { display: flex; }

.dropdown-header { padding: 8px 10px 6px; }
.dropdown-divider { height: 1px; background: var(--border-hairline); margin: 4px 0; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 9999px !important;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  text-align: left;
  transition: background-color var(--ease), color var(--ease);
}

.dropdown-item:hover { background: var(--surface-hover); color: var(--ink-primary); }
.dropdown-item--danger { color: var(--danger); }
.dropdown-item--danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--surface-backdrop);
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.show { display: flex; }

.modal-dialog {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-dialog--sm { max-width: 420px; }
.modal-dialog--lg { max-width: 720px; }
.modal-dialog--xl { max-width: 960px; height: 84vh; }

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

.modal-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.modal-tabs-bar {
  padding: 10px 18px 0;
  border-bottom: 1px solid var(--border-hairline);
  padding-bottom: 10px;
  flex: none;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-hairline);
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: none;
}

/* ---------- Slide-Over Inspection Drawer ---------- */
.detail-backdrop {
  position: fixed;
  inset: 0;
  background: var(--surface-backdrop);
  z-index: 110;
  display: none;
}
.detail-backdrop.show { display: block; }

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 96vw);
  background: var(--surface-elevated);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-modal);
  z-index: 115;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 180ms cubic-bezier(0.2, 0, 0, 1);
  will-change: transform;
}

.detail-drawer.show { transform: translateX(0); }

.detail-drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-drawer-title { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; }
.detail-drawer-subtitle { font-size: 12px; color: var(--ink-muted); margin-top: 3px; }
.detail-drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.detail-drawer-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-hairline);
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Toast Stack ---------- */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 9999px;
  box-shadow: var(--shadow-popover);
  font-size: 12.5px;
  color: var(--ink-primary);
}

/* ---------- Empty State & Loading ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 20px;
  gap: 8px;
}

.empty-state-icon {
  width: 42px;
  height: 42px;
  border-radius: 9999px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-subtle);
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.empty-state-title { font-size: 13.5px; font-weight: 600; color: var(--ink-primary); }
.empty-state-desc { font-size: 12px; color: var(--ink-muted); max-width: 280px; line-height: 1.5; }

/* ---------- Responsive Helpers ---------- */
.mobile-only { display: none !important; }
@media (max-width: 960px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: inline-flex !important; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
