/* =============================================================================
   alg-mcv design system  (one canonical file, used by every admin page + login)
   - tokens (color, type, spacing, radius, shadow, motion)
   - layout primitives (app, sidebar, topbar, content, card, table, form, btn)
   - 2026 polish (glassmorphism, ambient gradient, subtle motion, focus ring)
   - mobile-first responsive (tested at 360, 480, 768, 1024+ widths)
   - light + dark themes via [data-theme] on <html>
   ============================================================================= */

/* -------------------------------------------------------------------------
   1. RESET + BASE
   ------------------------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html {
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI',
               Roboto, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'kern';
  transition: background-color 0.25s ease, color 0.2s ease;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* -------------------------------------------------------------------------
   2. TOKENS
   ------------------------------------------------------------------------- */
:root, [data-theme="light"] {
  /* surfaces */
  --bg:           #f5f0e8;
  --bg-alt:       #ece5d9;
  --bg-grad-1:    rgba(255, 200, 145, 0.18);
  --bg-grad-2:    rgba(180, 220, 255, 0.16);
  --bg-grad-3:    rgba(220, 200, 255, 0.14);
  --surface:      #ffffff;
  --surface-alt:  #fcfaf6;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --surface-glass-strong: rgba(255, 255, 255, 0.88);
  /* ink */
  --ink:          #1a1614;
  --ink-muted:    #6b5f56;
  --ink-soft:     #9b8f86;
  --ink-faint:    #c9bfb5;
  --rule:         rgba(107, 95, 86, 0.16);
  --rule-strong:  rgba(107, 95, 86, 0.30);
  /* accent + semantic */
  --accent:       #1a1614;
  --accent-hover: #2a2420;
  --accent-on:    #ffffff;
  --error:        #c0392b;
  --error-bg:     #fde8e6;
  --error-bd:     #f5b7b1;
  --success:      #2d6a4f;
  --success-bg:   #d4e9d6;
  --info:         #1e5fa8;
  --info-bg:      #e3edfa;
  --warn:         #b67800;
  --warn-bg:      #fef3c7;
  /* effects */
  --shadow-xs:    0 1px 2px rgba(26, 22, 20, 0.04);
  --shadow-sm:    0 2px 6px rgba(26, 22, 20, 0.05), 0 1px 2px rgba(26, 22, 20, 0.04);
  --shadow-md:    0 4px 16px rgba(26, 22, 20, 0.07), 0 2px 4px rgba(26, 22, 20, 0.04);
  --shadow-lg:    0 12px 32px rgba(26, 22, 20, 0.12), 0 4px 8px rgba(26, 22, 20, 0.06);
  --shadow-xl:    0 24px 64px rgba(26, 22, 20, 0.18), 0 8px 16px rgba(26, 22, 20, 0.08);
  --ring:         0 0 0 3px rgba(26, 22, 20, 0.10);
  --ring-accent:  0 0 0 3px rgba(26, 22, 20, 0.15);
  /* status pill colors */
  --pill-new-bg:  #1a1614;     --pill-new-fg:  #ffffff;
  --pill-rev-bg:  #fef3c7;     --pill-rev-fg:  #92660a;
  --pill-acc-bg:  #d4e9d6;     --pill-acc-fg:  #1c4a25;
  --pill-dec-bg:  #f3dada;     --pill-dec-fg:  #802420;
  --pill-mut-bg:  #ece8df;     --pill-mut-fg:  #6b5f56;
  --hover-row:    rgba(26, 22, 20, 0.025);
}

[data-theme="dark"] {
  --bg:           #100d0c;
  --bg-alt:       #181311;
  --bg-grad-1:    rgba(245, 175, 100, 0.10);
  --bg-grad-2:    rgba(120, 170, 220, 0.10);
  --bg-grad-3:    rgba(180, 150, 220, 0.09);
  --surface:      #1c1815;
  --surface-alt:  #221d1a;
  --surface-glass: rgba(28, 24, 21, 0.68);
  --surface-glass-strong: rgba(28, 24, 21, 0.88);
  --ink:          #f1ece3;
  --ink-muted:    #a89e94;
  --ink-soft:     #6e655c;
  --ink-faint:    #4a4137;
  --rule:         rgba(245, 240, 232, 0.10);
  --rule-strong:  rgba(245, 240, 232, 0.22);
  --accent:       #f5f0e8;
  --accent-hover: #ffffff;
  --accent-on:    #1a1614;
  --error:        #ef9a8e;
  --error-bg:     #3a1a16;
  --error-bd:     #5a2a23;
  --success:      #8edcb1;
  --success-bg:   #16331f;
  --info:         #79b8ff;
  --info-bg:      #14253b;
  --warn:         #ffd76a;
  --warn-bg:      #3a2c0a;
  --shadow-xs:    0 1px 2px rgba(0,0,0,0.5);
  --shadow-sm:    0 2px 6px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.5);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.55), 0 2px 4px rgba(0,0,0,0.45);
  --shadow-lg:    0 12px 32px rgba(0,0,0,0.65), 0 4px 8px rgba(0,0,0,0.5);
  --shadow-xl:    0 24px 64px rgba(0,0,0,0.7),  0 8px 16px rgba(0,0,0,0.5);
  --ring:         0 0 0 3px rgba(245, 240, 232, 0.12);
  --ring-accent:  0 0 0 3px rgba(245, 240, 232, 0.18);
  --pill-new-bg:  #f5f0e8;     --pill-new-fg:  #1a1614;
  --pill-rev-bg:  #3a2c0a;     --pill-rev-fg:  #ffd76a;
  --pill-acc-bg:  #16331f;     --pill-acc-fg:  #8edcb1;
  --pill-dec-bg:  #3a1a16;     --pill-dec-fg:  #ef9a8e;
  --pill-mut-bg:  #221d1a;     --pill-mut-fg:  #a89e94;
  --hover-row:    rgba(245, 240, 232, 0.03);
}

/* -------------------------------------------------------------------------
   3. AMBIENT BACKGROUND  (very subtle, static gradient - no animation)
   The earlier animated version caused repaint-flicker on some browsers.
   This is a static, low-intensity wash that adds depth without movement.
   ------------------------------------------------------------------------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 1100px 600px at 18% 18%, var(--bg-grad-1), transparent 60%),
    radial-gradient(ellipse 900px  500px at 82% 12%, var(--bg-grad-2), transparent 60%),
    radial-gradient(ellipse 1000px 500px at 50% 92%, var(--bg-grad-3), transparent 60%);
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001s !important; animation-duration: 0.001s !important; }
}

/* -------------------------------------------------------------------------
   4. APP LAYOUT
   ------------------------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  position: relative;        /* anchor for the collapse handle */
  transition: grid-template-columns 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}
.app.is-collapsed { grid-template-columns: 64px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1rem 0.75rem;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  overflow-x: hidden;        /* hide labels mid-collapse-animation */
  transition: padding 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}
.app.is-collapsed .sidebar { padding: 1rem 0.5rem; }

/* Collapsed mode: hide labels, center icons, hide the firm logo entirely
   so the sidebar reads as a clean icon rail. The native title attr on
   each nav link still shows the full label on hover. */
.app.is-collapsed .nav a {
  justify-content: center;
  padding: 0.55rem 0;
  gap: 0;
}
.app.is-collapsed .nav-label { display: none; }
.app.is-collapsed .brand,
.app.is-collapsed .sidebar-footer,
.app.is-collapsed .imp-block { display: none; }

/* Collapse handle — sibling of .sidebar inside .app. Position is anchored
   to the sidebar's right edge via calc(): expanded = 240px, collapsed =
   64px. Vertically centered against the viewport so it stays in sight
   even when the user scrolls the main content. */
.sidebar-collapse-btn {
  position: fixed;
  top: 50vh;
  left: calc(240px - 12px);
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink-muted);
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 2px 6px rgba(26, 22, 20, 0.10);
  transition: left 0.22s cubic-bezier(0.32, 0.72, 0, 1),
              background 0.13s, color 0.13s, border-color 0.13s;
}
.app.is-collapsed .sidebar-collapse-btn { left: calc(64px - 12px); }
.sidebar-collapse-btn:hover {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.sidebar-collapse-btn svg {
  width: 12px; height: 12px;
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}
.app.is-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
html[data-theme="dark"] .sidebar-collapse-btn { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); }

@media (max-width: 720px) {
  /* On phones, the sidebar already does its own thing — hide the collapse
     handle and let the existing mobile overlay logic run. */
  .sidebar-collapse-btn { display: none; }
  .app.is-collapsed { grid-template-columns: 240px 1fr; }
}
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.5rem 1rem;
  border-bottom: 1px solid var(--rule);
}
.brand img { height: 36px; width: auto; transition: filter 0.2s ease; max-width: 100%; }
[data-theme="dark"] .brand img,
[data-theme="dark"] .logo-invert,
[data-theme="dark"] .login-card .logo { filter: invert(1) brightness(1.05); }

.nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.nav a:hover { background: var(--bg-alt); color: var(--ink); }
.nav a:active { transform: translateX(1px); }
.nav a.active {
  background: var(--accent);
  color: var(--accent-on);
  box-shadow: var(--shadow-sm);
}
.nav a.active svg { opacity: 1; }
.nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.7; }

.sidebar-footer {
  padding: 0.5rem 0.5rem 0.25rem;
  font-size: 0.66rem;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* main column */
.main { display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.85rem 1.5rem;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  min-width: 0;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--ink-muted);
}
.topbar-actions .who {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding-right: 0.5rem;
  font-size: 0.82rem;
  white-space: nowrap;
}
.topbar-actions .who-email { max-width: 24ch; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions .welcome {
  color: var(--ink-muted);
  font-size: 0.88rem;
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-actions .welcome strong {
  color: var(--ink);
  font-weight: 600;
}

/* Portal switcher: 2-segment pill toggle in the topbar.
   Lets the user flip between Intake & Outreach and the Tasks Portal in
   one click. The active segment is filled-ink; the other is ghost. */
.portal-switch {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px;
  background: var(--surface);
  margin-left: 0.25rem;
}
.portal-switch .ps-seg {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  text-decoration: none;
  border-radius: 999px;
  transition: background 0.13s, color 0.13s;
  white-space: nowrap;
}
.portal-switch .ps-seg:hover {
  color: var(--ink);
  background: rgba(122, 94, 74, 0.08);
}
.portal-switch .ps-seg.active {
  background: var(--ink);
  color: var(--surface);
}
.portal-switch .ps-seg.active:hover {
  background: var(--ink);
  color: var(--surface);
}
html[data-theme="dark"] .portal-switch .ps-seg.active {
  background: var(--ink);
  color: #1a1614;
}
@media (max-width: 720px) {
  /* On mobile, keep the pill but hide the welcome text so it fits */
  .topbar-actions .welcome { display: none; }
}

/* Notifications bell + popover */
.notif-wrap { position: relative; }
.notif-btn { position: relative; }
.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: #b13a3a;
  border: 2px solid var(--surface);
}
.notif-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 200;
  width: min(360px, 90vw);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: 0 12px 32px -12px rgba(26,22,20,0.32);
  overflow: hidden;
  animation: notifIn 0.14s ease-out;
}
@keyframes notifIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.notif-popover-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 0.9rem;
  font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--rule);
}
.notif-mark-all {
  font-size: 0.72rem; font-weight: 600;
  color: var(--ink); border: none; background: transparent; cursor: pointer;
  text-transform: none; letter-spacing: 0.01em;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-list {
  max-height: 60vh;
  overflow-y: auto;
}
.notif-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.86rem;
  font-style: italic;
}
.notif-item {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
  font-size: 0.86rem;
  position: relative;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(122,94,74,0.05); }
html[data-theme="dark"] .notif-item:hover { background: rgba(245,240,232,0.04); }
.notif-item.unread::before {
  content: '';
  position: absolute;
  top: 50%; left: 4px; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 999px;
  background: #b13a3a;
}
.notif-item.unread { padding-left: 1.1rem; }
.notif-item.unread .notif-summary { font-weight: 600; }
.notif-time { font-size: 0.72rem; color: var(--ink-muted); }

/* =============================================================================
   IMPERSONATION
   ========================================================================== */
/* Sidebar block — sits above the footer when superadmin (or while active). */
.imp-block {
  margin-top: auto;        /* push to bottom of sidebar above footer */
  margin-bottom: 0.6rem;
  padding: 0.65rem 0.7rem 0.7rem;
  border: 1px solid rgba(122, 94, 74, 0.30);
  border-radius: 10px;
  background: rgba(122, 94, 74, 0.06);
  font-size: 0.78rem;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
html[data-theme="dark"] .imp-block {
  background: rgba(245, 240, 232, 0.05);
  border-color: rgba(245, 240, 232, 0.16);
}
.imp-block-head {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.imp-select-wrap {
  position: relative;
}
.imp-select {
  width: 100%;
  appearance: none; -webkit-appearance: none;
  padding: 0.45rem 1.6rem 0.45rem 0.6rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 7px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%236b5f56' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
}
.imp-select:focus {
  outline: none;
  border-color: rgba(122, 94, 74, 0.55);
}
.imp-select:disabled {
  cursor: default;
  opacity: 0.85;
  background-image: none;
  padding-right: 0.6rem;
}
.imp-help {
  font-size: 0.7rem;
  color: var(--ink-muted);
  line-height: 1.35;
  font-style: italic;
}
.imp-stop {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 7px;
  border: 1px solid #b13a3a;
  background: #b13a3a;
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.13s, transform 0.1s;
}
.imp-stop:hover {
  background: #9c2f2f;
  transform: translateY(-1px);
}

/* Top-of-page banner — shows whenever impersonation is active. Sticky so
   it stays visible while scrolling, and visually distinct enough that the
   user can never forget they're in someone else's view. */
.imp-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 1rem;
  background: linear-gradient(90deg, #b13a3a, #8b3a2e);
  color: #fff;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 14px -8px rgba(0, 0, 0, 0.4);
  flex-wrap: wrap;
}
.imp-banner-dot {
  flex: 0 0 auto;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55);
  animation: impPulse 1.4s ease-in-out infinite;
}
@keyframes impPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); }
  50%     { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); }
}
.imp-banner-text { flex: 1 1 auto; min-width: 12ch; }
.imp-banner-text em { font-style: normal; opacity: 0.85; font-weight: 500; }
.imp-banner-stop {
  flex: 0 0 auto;
  padding: 0.35rem 0.85rem;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.13s, border-color 0.13s, transform 0.1s;
}
.imp-banner-stop:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: #fff;
  transform: translateY(-1px);
}
/* When the app wraps in is-impersonating, give the sidebar a subtle red
   accent on the brand to reinforce the visual cue. */
.app.is-impersonating .sidebar { box-shadow: inset -2px 0 0 rgba(177, 58, 58, 0.45); }

/* Sidebar footer: health dot + version + copyright stacked tightly */
.sidebar-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  font-size: 0.72rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}
.sidebar-footer .footer-version { font-weight: 700; color: var(--ink); }
.sidebar-footer .footer-copy { font-weight: 500; opacity: 0.85; }
.health-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: rgba(107,95,86,0.45);
  flex: 0 0 auto;
  cursor: help;
  transition: background 0.2s;
}
.health-dot.ok      { background: #2c7a4b; box-shadow: 0 0 6px rgba(44,122,75,0.55); }
.health-dot.bad     { background: #b13a3a; box-shadow: 0 0 6px rgba(177,58,58,0.55); }
.health-dot.pending { background: #b08620; }

/* Intake table - assigned-to cell */
.assignee-name { color: var(--ink); font-weight: 500; }
.assignee-name.is-mine { color: #1f8a4c; font-weight: 600; }
.assignee-name small { color: var(--ink-muted); font-weight: 400; margin-left: 0.2rem; }
html[data-theme="dark"] .assignee-name.is-mine { color: #4ec880; }

/* Live signup-link preview shown under the invite form */
.invite-preview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding-top: 0.4rem;
}
.invite-preview .invite-preview-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.invite-preview .invite-preview-hint {
  font-size: 0.78rem;
  color: var(--ink-muted);
  flex: 1 1 100%;
  margin-top: 0.15rem;
}
.topbar-actions .env-strip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.topbar-actions .env-strip .env-time { color: var(--ink); font-weight: 600; }
.topbar-actions .env-strip .env-sep  { opacity: 0.5; }
.topbar-actions .env-strip .env-weather {
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.topbar-actions .env-strip .env-icon {
  font-size: 0.95rem; line-height: 1;
}
.topbar-actions .env-strip .env-temp { font-weight: 500; }
@media (max-width: 900px) {
  .topbar-actions .env-strip { display: none; }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 10px;
  color: var(--ink-muted);
  transition: background 0.12s ease, color 0.12s ease,
              border-color 0.12s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--rule-strong);
  transform: translateY(-1px);
}
.icon-btn:active { transform: translateY(0); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring-accent); }
.icon-btn svg { width: 17px; height: 17px; }

.content {
  flex: 1;
  padding: 1.75rem 1.75rem 4rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.content > h1 {
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}
.content > .subtitle {
  color: var(--ink-muted);
  font-size: 0.92rem;
  margin-bottom: 1.5rem;
}

/* -------------------------------------------------------------------------
   5. CARDS, EMPTY, TABLES
   ------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 1.4rem;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-glass {
  background: var(--surface-glass);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
}

.empty {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--ink-muted);
  box-shadow: var(--shadow-sm);
  animation: fadeUp 0.35s ease-out;
}
.empty .icon-circle {
  width: 56px; height: 56px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--bg-alt);
  display: grid; place-items: center;
  color: var(--ink-soft);
}
.empty .icon-circle svg { width: 26px; height: 26px; }
.empty h3 {
  color: var(--ink); font-size: 1.05rem; font-weight: 600; margin-bottom: 0.4rem;
}
.empty p {
  font-size: 0.92rem; line-height: 1.55; max-width: 440px; margin: 0 auto;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

table {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
th, td {
  padding: 0.85rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9rem;
  vertical-align: middle;
}
th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-muted);
  font-weight: 700;
  background: var(--bg-alt);
}
tbody tr { transition: background 0.12s ease; }
tbody tr:hover td { background: var(--hover-row); }
tbody tr:last-child td { border-bottom: none; }

/* pills */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.pill.new       { background: var(--pill-new-bg); color: var(--pill-new-fg); }
.pill.in_review { background: var(--pill-rev-bg); color: var(--pill-rev-fg); }
.pill.accepted  { background: var(--pill-acc-bg); color: var(--pill-acc-fg); }
.pill.declined  { background: var(--pill-dec-bg); color: var(--pill-dec-fg); }
.pill.duplicate, .pill.closed { background: var(--pill-mut-bg); color: var(--pill-mut-fg); }
.pill.admin     { background: var(--pill-new-bg); color: var(--pill-new-fg); }
.pill.attorney  { background: var(--info-bg); color: var(--info); }
.pill.paralegal { background: var(--pill-mut-bg); color: var(--pill-mut-fg); }
.pill.read_only { background: var(--pill-mut-bg); color: var(--ink-soft); }
.pill.pending   { background: var(--pill-rev-bg); color: var(--pill-rev-fg); }
/* Superadmin: distinct from admin — deep-warm-brown chip on cream so the
   token stands out in the topbar. Dark mode swaps to the warm-cream-on-ink
   inverse so it still pops against the dark sidebar/topbar. */
.pill.superadmin {
  background: #1a1614;
  color: #e8d8c2;
  border: 1px solid #5a4632;
  letter-spacing: 0.08em;
}
html[data-theme="dark"] .pill.superadmin {
  background: #e8d8c2;
  color: #1a1614;
  border-color: #d6c5b3;
}

/* Invite-link copy chip (user management → pending invites)
   Green-tinted, transparent background, thin frame. Shows the actual signup
   URL (truncated) with a copy icon; click copies the full URL to clipboard. */
.invite-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(31, 138, 76, 0.45);
  background: rgba(31, 138, 76, 0.06);
  color: #1f8a4c;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, color 0.14s, transform 0.12s, box-shadow 0.14s;
  max-width: 100%;
  letter-spacing: 0.01em;
}
.invite-chip:hover {
  background: rgba(31, 138, 76, 0.12);
  border-color: #1f8a4c;
  color: #176c3a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31,138,76,0.16);
}
.invite-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 138, 76, 0.25);
}
.invite-chip svg { color: currentColor; flex: 0 0 auto; }
.invite-chip .invite-chip-link {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: -apple-system-ui-monospace, SF Mono, Menlo, monospace;
  font-size: 0.78rem;
  max-width: 26ch;
}
html[data-theme="dark"] .invite-chip {
  border-color: rgba(78, 200, 128, 0.45);
  background: rgba(78, 200, 128, 0.08);
  color: #4ec880;
}
html[data-theme="dark"] .invite-chip:hover {
  background: rgba(78, 200, 128, 0.16);
  border-color: #4ec880;
  color: #6fd99b;
  box-shadow: 0 4px 14px rgba(78,200,128,0.18);
}
.invite-chip.copied {
  background: #1f8a4c;
  border-color: #176c3a;
  color: #ffffff;
}
.invite-chip.copied:hover {
  background: #176c3a;
  color: #ffffff;
}
html[data-theme="dark"] .invite-chip.copied {
  background: #4ec880;
  border-color: #4ec880;
  color: #0d0a09;
}

/* Editable status pill: a pill that hosts a hidden <select> on top of it.
   Clicking anywhere in the pill opens the native dropdown; the visible
   label stays in sync with the selected value via JS. */
.status-cell {
  position: relative;
  cursor: pointer;
  padding-right: 1.55rem;     /* space for the caret */
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  user-select: none;
}
.status-cell .status-label { line-height: 1; }
.status-cell .status-caret {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.7;
  pointer-events: none;
}
.status-cell .status-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;            /* invisible but still receives clicks/focus */
  cursor: pointer;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
}
.status-cell:hover { box-shadow: 0 0 0 2px rgba(122,94,74,0.18); }
.status-cell:focus-within { box-shadow: 0 0 0 2px rgba(122,94,74,0.32); }
/* Style the dropdown options to read black-on-white regardless of pill bg */
.status-cell .status-select option {
  color: #1a1614;
  background: #ffffff;
  font-weight: 500;
}
html[data-theme="dark"] .status-cell .status-select option {
  color: #f1ece3;
  background: #1c1815;
}

/* -------------------------------------------------------------------------
   5a. INTAKE TOOLBAR (search + date range + my-queue + export)
   ------------------------------------------------------------------------- */
.intake-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}
.search-input {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  transition: border-color 0.14s, box-shadow 0.14s;
}
.search-input:focus {
  outline: none;
  border-color: var(--rule-strong, rgba(107,95,86,0.55));
  box-shadow: 0 0 0 3px rgba(122,94,74,0.18);
}
.date-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.date-pill input[type="date"] {
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.date-pill input[type="date"]:focus { outline: none; }
.result-count {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------------
   5b. FILTER CHIPS (transparent / thin frame, modern)
   ------------------------------------------------------------------------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  width: fit-content;
}
.filter-bar .filter-label {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 0 0.4rem 0 0.3rem;
}
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s, transform 0.12s, box-shadow 0.14s;
  white-space: nowrap;
}
.filter-btn:hover {
  color: var(--ink);
  border-color: var(--rule-strong, rgba(107,95,86,0.55));
  transform: translateY(-1px);
}
.filter-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(122, 94, 74, 0.20);
}
.filter-btn.active {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
  font-weight: 600;
}
html[data-theme="dark"] .filter-btn.active {
  background: #f1ece3;
  color: #1a1614;
  border-color: #f1ece3;
}
/* Subtle status dot before each label so the chip rail reads at a glance */
.filter-btn[data-status]::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.45;
  flex: 0 0 auto;
}
.filter-btn[data-status=""]::before        { background: var(--ink-muted); }
.filter-btn[data-status="new"]::before     { background: #2c7a4b; opacity: 0.85; }
.filter-btn[data-status="reviewing"]::before { background: #b08620; opacity: 0.85; }
.filter-btn[data-status="contacted"]::before { background: #4a73c4; opacity: 0.85; }
.filter-btn[data-status="retained"]::before  { background: #6b3fa0; opacity: 0.85; }
.filter-btn[data-status="declined"]::before  { background: #b13a3a; opacity: 0.85; }
.filter-btn[data-status="closed"]::before    { background: #6b5f56; opacity: 0.85; }
.filter-btn.active::before { opacity: 1; }
@media (max-width: 640px) {
  .filter-bar { width: 100%; padding: 0.5rem; }
}

/* -------------------------------------------------------------------------
   6. FORMS
   ------------------------------------------------------------------------- */
label.lbl {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--ink);
}
input.txt, select.txt, textarea.txt {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input.txt:focus, select.txt:focus, textarea.txt:focus {
  outline: none;
  border-color: var(--ink-muted);
  box-shadow: var(--ring);
}
input.txt::placeholder, textarea.txt::placeholder { color: var(--ink-faint); }
.form-row { margin-bottom: 0.85rem; }
.form-row .help {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  user-select: none;
  transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease,
              transform 0.10s ease, box-shadow 0.15s ease;
}
.btn:hover {
  background: var(--bg-alt);
  border-color: var(--rule-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-on);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: var(--shadow-md); }
.btn.danger {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-bd);
}
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-muted); }
.btn.ghost:hover { background: var(--bg-alt); color: var(--ink); border-color: var(--rule); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* -------------------------------------------------------------------------
   7. DROPDOWN, TOAST, SPINNER, SKELETON, PROGRESS
   ------------------------------------------------------------------------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 0.35rem;
  display: none;
  z-index: 100;
  transform-origin: top right;
  animation: ddOpen 0.15s ease-out;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.88rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.12s ease;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg-alt); }
.dropdown-menu hr { border: none; border-top: 1px solid var(--rule); margin: 0.3rem 0; }
.dropdown-menu svg { width: 16px; height: 16px; opacity: 0.7; }
@keyframes ddOpen {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* =============================================================================
   TOAST  (firm-brand styling: beige + ink for everything except errors,
   regardless of light or dark theme. Error stays red. Title is a separate
   block element so trailing punctuation in body text never orphans.)
   ============================================================================= */
.toast-stack {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 9999;
  max-width: 400px;
  pointer-events: none;
}
.toast {
  /* Hardcoded firm palette - intentional, NOT theme-aware */
  background: #f5f0e8;
  color: #1a1614;
  border: 1px solid rgba(107, 95, 86, 0.20);
  pointer-events: auto;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(26, 22, 20, 0.18), 0 4px 8px rgba(26, 22, 20, 0.08);
  font-size: 0.92rem;
  line-height: 1.45;
  display: grid;
  grid-template-columns: 22px 1fr 18px;
  gap: 0.65rem;
  align-items: start;
  animation: slideIn 0.22s ease-out;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.toast.error {
  background: #c0392b;
  color: #ffffff;
  border-color: transparent;
}
.toast.success {
  /* same beige base, success accent only on the icon */
  background: #f5f0e8;
  color: #1a1614;
  border: 1px solid rgba(107, 95, 86, 0.20);
}
.toast .icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #1a1614;
  color: #f5f0e8;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}
.toast.error .icon { background: rgba(255,255,255,0.22); color: #fff; }
.toast.success .icon { background: #2d6a4f; color: #fff; }
.toast .body { min-width: 0; }
.toast .title {
  display: block;
  font-weight: 700;
  margin-bottom: 0.1rem;
  font-size: 0.94rem;
}
.toast .text { display: block; }
/* legacy <strong> in .text should NOT block-break */
.toast .text strong { font-weight: 700; }
.toast button.close {
  background: none; border: none;
  color: rgba(26, 22, 20, 0.55);
  cursor: pointer; padding: 0; font-size: 18px; line-height: 1;
  align-self: start;
  margin-top: 1px;
  transition: color 0.12s ease;
}
.toast button.close:hover { color: #1a1614; }
.toast.error button.close { color: rgba(255,255,255,0.78); }
.toast.error button.close:hover { color: #fff; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { to { transform: translateX(20px); opacity: 0; } }
.toast.hiding { animation: slideOut 0.18s ease-in forwards; }

/* spinner */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
  opacity: 0.75;
  vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* skeleton loaders (use during data fetch) */
.skel {
  display: block;
  background: linear-gradient(90deg, var(--bg-alt), var(--rule), var(--bg-alt));
  background-size: 200% 100%;
  animation: skelShine 1.4s ease-in-out infinite;
  border-radius: 6px;
  height: 14px;
}
.skel.lg { height: 22px; border-radius: 8px; }
.skel.sm { height: 10px; border-radius: 4px; }
@keyframes skelShine { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel-table { display: flex; flex-direction: column; gap: 12px; padding: 1rem 0; }
.skel-row { display: grid; grid-template-columns: 100px 1fr 1fr 80px 120px 140px; gap: 1rem; align-items: center; }

/* progress bar */
.progress {
  width: 100%;
  height: 6px;
  background: var(--bg-alt);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress > .bar {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--ink-muted));
  border-radius: inherit;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.progress.indeterminate > .bar {
  width: 30%;
  animation: indet 1.4s ease-in-out infinite;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
@keyframes indet {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(400%);  }
}

/* time-ago auto-updating */
.time-ago { font-variant-numeric: tabular-nums; color: var(--ink-muted); }

/* utility classes */
.text-muted { color: var(--ink-muted); }
.text-soft  { color: var(--ink-soft); }
.row-flex   { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.spacer     { flex: 1; }
.stack      { display: flex; flex-direction: column; }
.gap-2      { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; }
.mt-2       { margin-top: 0.5rem; } .mt-3 { margin-top: 0.75rem; } .mt-4 { margin-top: 1rem; }
.mt-6       { margin-top: 1.5rem; } .mt-8 { margin-top: 2rem; }
.section-h  {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin: 1.25rem 0 0.65rem;
}

/* status indicator dot */
.dot-status {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); margin-right: 0.4rem; vertical-align: 1px;
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.16);
}
[data-theme="dark"] .dot-status { box-shadow: 0 0 0 3px rgba(142, 220, 177, 0.18); }

/* page transition fade */
.page-enter {
  animation: pageIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------------------
   8. MOBILE RESPONSIVE
   ------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .app { grid-template-columns: 220px 1fr; }
  .content { padding: 1.5rem; }
}

@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    padding: 0.65rem 1rem;
    gap: 0.65rem;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    overflow-x: auto;
    overflow-y: hidden;
  }
  .brand {
    border-bottom: none;
    padding: 0 0.85rem 0 0;
    border-right: 1px solid var(--rule);
    flex-shrink: 0;
    justify-content: flex-start;
  }
  .brand img { height: 28px; }
  .nav { flex-direction: row; flex: 1; }
  .nav a {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    white-space: nowrap;
  }
  .sidebar-footer { display: none; }
  .topbar { padding: 0.75rem 1rem; }
  .topbar-actions .who-email { max-width: 0; overflow: hidden; }
  .topbar-actions .who { padding-right: 0; }
  .content { padding: 1.1rem 1rem 3rem; }
  .content > h1 { font-size: 1.3rem; }
  table th, table td { padding: 0.65rem 0.75rem; font-size: 0.85rem; }
  .card { padding: 1.1rem; }
  .empty { padding: 2.25rem 1rem; }
  .toast-stack { left: 0.85rem; right: 0.85rem; max-width: none; }
  .skel-row { grid-template-columns: 80px 1fr 80px; }
}

@media (max-width: 480px) {
  body { font-size: 14.5px; }
  .topbar-actions { gap: 0.3rem; }
  .icon-btn { width: 34px; height: 34px; }
  .icon-btn svg { width: 16px; height: 16px; }
  .topbar-actions .pill { display: none; }
  .nav a svg { width: 16px; height: 16px; }
  .content > h1 { font-size: 1.2rem; }
  /* tables become card-grid on tiny phones */
  table thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  table { background: transparent; border: none; box-shadow: none; }
  tbody tr {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 12px;
    margin-bottom: 0.7rem;
    padding: 0.5rem 0;
  }
  td {
    border-bottom: 1px solid var(--rule);
    padding: 0.55rem 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
  }
  td:last-child { border-bottom: none; }
  td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-muted);
    flex: 0 0 auto;
  }
}
