/* ═══════════════════════════════════════════════════════════
   Aristos Chat — Design System
   Based on Nova concept · Jacarta/Lavender brand palette
   ═══════════════════════════════════════════════════════════ */

/* Inter Variable is the UI font; intonation uses the same family per Brand System v2.0 */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../brand/fonts/JetBrainsMono-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../brand/fonts/JetBrainsMono-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter Variable';
  src: url('../brand/fonts/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter Variable';
  src: url('../brand/fonts/InterVariable-Italic.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  /* ─── Brand identity (logo, Athena's presence only) ─── */
  --jacarta: #2d2769;
  --jacarta-rgb: 45, 39, 105;
  --lavender: #9889C0;
  --lavender-rgb: 152, 137, 192;
  --steel: #241E31;
  --steel-rgb: 36, 30, 49;

  /* ─── Athena's presence — contained purple, used ONLY for Athena ─── */
  --athena-presence: #C5A572;
  --athena-presence-rgb: 197, 165, 114;
  --athena-presence-soft: #E3C88F;
  --athena-presence-glow: rgba(197, 165, 114, 0.35);

  /* ─── Gold — primary accent, the anti-AI color ─── */
  --gold: #C5A572;
  --gold-rgb: 197, 165, 114;
  --gold-soft: #E3C88F;
  --gold-glow: rgba(197, 165, 114, 0.2);
  --gold-deep: #A88550;

  /* ─── Warm neutral dark surfaces (not purple-tinted) ─── */
  --s0: #0a0a0c;
  --s1: #121214;
  --s2: #1a1a1e;
  --s3: #242428;
  --s4: #2e2e34;

  --s0-rgb: 10, 10, 12;
  --s1-rgb: 18, 18, 20;
  --s2-rgb: 26, 26, 30;
  --s3-rgb: 36, 36, 40;
  --s4-rgb: 46, 46, 52;

  /* ─── Text — warm white, not clinical ─── */
  --athens: #F8F7FB;
  --athens-rgb: 245, 244, 242;
  --white: #F8F7FB;

  /* ─── Semantic colors ─── */
  --ok: #2dd4a7;
  --ok-rgb: 45, 212, 167;
  --warn: #C5A572;
  --warn-rgb: 197, 165, 114;
  --danger: #E5484D;
  --danger-rgb: 229, 72, 77;
  --info: #9889C0;
  --info-rgb: 152, 137, 192;

  /* ─── Brand alias — maps to gold for UI, purple for Athena ─── */
  /* UI accent = gold. Athena presence = --athena-presence */
  --brand: #C5A572;
  --brand-rgb: 197, 165, 114;
  --brand-deep: #A88550;
  --brand-soft: #E3C88F;
  --brand-glow: rgba(197, 165, 114, 0.2);

  --ff-brand: 'Inter Variable', system-ui, sans-serif;
  --ff-heading: 'Inter Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ff-body: 'Inter Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ff-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', 'Consolas', monospace;
  --ff-intonation: 'Inter Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --r-xl: 18px; --r-2xl: 24px; --r-pill: 999px;
  --r-cut: 0px;

  --glass-bg: rgba(16, 13, 40, 0.45);
  --glass-border: rgba(180, 160, 255, 0.06);
  --glass-blur: 24px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.25);
  --shadow: 0 8px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.4);
  --shadow-xl: 0 40px 100px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(var(--brand-rgb), 0.3);
  --shadow-brand: 0 8px 40px var(--brand-glow);
  --shadow-gold: 0 8px 40px var(--gold-glow);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,0.04);

  --sidebar-w: 280px;
  --sidebar-collapsed-w: 72px;
  --header-h: 56px;
  --input-max-h: 200px;

  /* ─── Living Glass material system — warm neutral dark ─── */
  --glass-0: rgba(10, 10, 12, 0.35);
  --glass-1: rgba(18, 18, 20, 0.55);
  --glass-2: rgba(26, 26, 30, 0.72);
  --glass-3: rgba(36, 36, 40, 0.88);
  --glass-edge: rgba(245, 244, 242, 0.06);
  --glass-edge-strong: rgba(245, 244, 242, 0.10);
  --glass-blur: 32px;
  --glass-blur-heavy: 48px;

  /* ─── Presence signatures ─── */
  --presence-athena: rgba(197, 165, 114, 0.06);    /* Athena's purple — contained */
  --presence-athena-strong: rgba(197, 165, 114, 0.12);
  --presence-self: rgba(197, 165, 114, 0.06);    /* gold — you */
  --presence-shared-1: rgba(197, 165, 114, 0.06); /* gold — collaborator 1 */
  --presence-shared-2: rgba(45, 212, 167, 0.06);  /* green — collaborator 2 */
  --presence-shared-3: rgba(152, 137, 192, 0.06);  /* indigo — collaborator 3 */

  /* ─── Text as material — warm white on neutral dark ─── */
  --text-primary: rgba(245, 244, 242, 0.92);
  --text-secondary: rgba(245, 244, 242, 0.55);
  --text-tertiary: rgba(245, 244, 242, 0.30);
  --text-athena: rgba(245, 244, 242, 0.95);
  --text-athena-memory: rgba(180, 160, 255, 0.85);  /* memory = Athena's purple warmth */
  --text-user: rgba(245, 244, 242, 0.85);

  /* ─── Legacy aliases — map old variable names to new design tokens ─── */
  --text: var(--text-primary);
  --text-muted: var(--text-secondary);
  --accent: var(--gold);
  --accent-glow: var(--gold-glow);
  --surface-elevated: rgba(var(--lavender-rgb), 0.06);
  --border: rgba(var(--lavender-rgb), 0.15);
  --border-subtle: rgba(var(--lavender-rgb), 0.08);

  /* ─── Motion vocabulary ─── */
  /* Motion has weight and material — nothing bounces, nothing performs */
  --ease-glass: cubic-bezier(0.32, 0.72, 0, 1);       /* glass sliding on glass */
  --ease-unfold: cubic-bezier(0.16, 1, 0.3, 1);        /* panels unfolding */
  --ease-develop: cubic-bezier(0.13, 0.63, 0.27, 1);   /* artifacts developing */
  --ease-breathe: cubic-bezier(0.45, 0, 0.55, 1);      /* breathing — presence */
  --ease-arrive: cubic-bezier(0.0, 0.0, 0.2, 1);       /* text arriving — considered */
  --ease-settle: cubic-bezier(0.25, 0.46, 0.45, 0.94); /* settling into place */

  /* ─── Development timings ─── */
  --t-breathe: 3s;           /* avatar breathing cycle */
  --t-breathe-slow: 5s;      /* slow breathing — idle */
  --t-develop: 0.8s;         /* artifact development */
  --t-unfold: 0.4s;          /* panel unfold */
  --t-arrive: 0.12s;         /* text chunk arrival */
  --t-settle: 0.3s;          /* element settling */
  --t-presence: 0.6s;        /* presence state transition */
}

/* ═══ Light Theme — warm paper, gold accent (DEFAULT) ═══ */
[data-theme="light"] {
  /* ─── Warm paper surfaces — like a crafted notebook ─── */
  --s0: #faf8f5;
  --s1: #ffffff;
  --s2: #f5f2ed;
  --s3: #ebe7e0;
  --s4: #ddd8ce;

  --s0-rgb: 250, 248, 245;
  --s1-rgb: 255, 255, 255;
  --s2-rgb: 245, 242, 237;
  --s3-rgb: 235, 231, 224;
  --s4-rgb: 221, 216, 206;

  /* ─── Warm dark text on paper ─── */
  --athens: #2a2825;
  --athens-rgb: 42, 40, 37;
  --white: #2a2825;

  /* ─── Gold accent — slightly deeper for light bg contrast ─── */
  --gold: #A88550;
  --gold-rgb: 168, 133, 80;
  --gold-soft: #C5A572;
  --gold-glow: rgba(168, 133, 80, 0.12);
  --gold-deep: #8a6d3e;

  /* ─── Brand alias follows gold ─── */
  --brand: #A88550;
  --brand-rgb: 168, 133, 80;
  --brand-deep: #8a6d3e;
  --brand-soft: #C5A572;
  --brand-glow: rgba(168, 133, 80, 0.12);

  /* ─── Athena's presence stays purple even in light theme ─── */
  --athena-presence: #C5A572;
  --athena-presence-rgb: 197, 165, 114;
  --athena-presence-soft: #9d85ff;
  --athena-presence-glow: rgba(197, 165, 114, 0.2);

  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(42, 40, 37, 0.06);
  --glass-edge: rgba(42, 40, 37, 0.06);
  --glass-edge-strong: rgba(42, 40, 37, 0.10);

  --shadow-xs: 0 1px 2px rgba(42,40,37,0.04);
  --shadow-sm: 0 2px 8px rgba(42,40,37,0.06);
  --shadow: 0 8px 24px rgba(42,40,37,0.08);
  --shadow-lg: 0 20px 60px rgba(42,40,37,0.1);
  --shadow-xl: 0 40px 100px rgba(42,40,37,0.12);
  --shadow-glow: 0 0 30px rgba(168,133,80,0.12);
  --shadow-brand: 0 8px 40px rgba(168,133,80,0.12);
  --shadow-gold: 0 8px 40px rgba(168,133,80,0.12);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,0.5);

  /* ─── Living Glass — light theme ─── */
  --glass-0: rgba(250, 248, 245, 0.4);
  --glass-1: rgba(255, 255, 255, 0.65);
  --glass-2: rgba(255, 255, 255, 0.82);
  --glass-3: rgba(255, 255, 255, 0.95);

  /* ─── Presence signatures — light theme ─── */
  --presence-athena: rgba(197, 165, 114, 0.04);
  --presence-athena-strong: rgba(197, 165, 114, 0.08);
  --presence-self: rgba(168, 133, 80, 0.04);
  --presence-shared-1: rgba(197, 165, 114, 0.06);
  --presence-shared-2: rgba(45, 212, 167, 0.04);
  --presence-shared-3: rgba(152, 137, 192, 0.04);

  /* ─── Text as material — light theme ─── */
  --text-primary: rgba(42, 40, 37, 0.88);
  --text-secondary: rgba(42, 40, 37, 0.55);
  --text-tertiary: rgba(42, 40, 37, 0.30);
  --text-athena: rgba(42, 40, 37, 0.92);
  --text-athena-memory: rgba(197, 165, 114, 0.85);
  --text-user: rgba(42, 40, 37, 0.80);

  /* ─── Legacy aliases — map old variable names to new design tokens ─── */
  --text: var(--text-primary);
  --text-muted: var(--text-secondary);
  --accent: var(--gold);
  --accent-glow: var(--gold-glow);
  --surface-elevated: rgba(45, 30, 100, 0.04);
  --border: rgba(45, 30, 100, 0.12);
  --border-subtle: rgba(45, 30, 100, 0.06);
}

[data-theme="light"] body {
  background: var(--s0);
  color: var(--athens);
}

[data-theme="light"] #auroraCanvas { opacity: 0.3; }
[data-theme="light"] .noise-overlay { opacity: 0.008; }
[data-theme="light"] .cursor-glow { mix-blend-mode: multiply; }

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html {
  font-size: 16px;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  font-family: var(--ff-body);
  background: var(--s0);
  color: var(--athens);
  overflow: hidden;
  height: 100vh; /* fallback */
  height: 100dvh; /* dynamic viewport height — respects mobile browser chrome */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  text-rendering: optimizeLegibility;
}

/* ─── Native app feel ───────────────────────────────────── */
/* Disable text selection on UI chrome — only allow it in message content */
button, .conv-item, .sidebar-brand, .sidebar-footer, .chat-header,
.input-area, .input-wrap, .input-footer, .input-tools, .input-actions,
.roladex-card, .model-selector, .business-selector,
.hamburger, .header-icon-btn, .sidebar-footer-btn, .new-chat-btn,
.sidebar-account, .sidebar-collapse-btn, .search-icon-btn {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Momentum scrolling on scrollable areas */
.sidebar-conversations, .chat-scroll, .model-dropdown-list,
.business-dropdown-list, .drawer-body, .ob-chat-messages {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Smooth touch interactions */
button, .conv-item, .input-tool-btn, .roladex-card {
  touch-action: manipulation;
}

/* Prevent pull-to-refresh on the whole app */
.app { overscroll-behavior: contain; }

/* Inputs keep text selection */
textarea, input, .msg-content, .msg-content * {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
/* Mobile: force the native long-press paste callout on the chat input.
   body-level -webkit-touch-callout:none suppresses the iOS paste menu. */
#chatInput {
  -webkit-touch-callout: default !important;
  -webkit-user-select: text !important;
  user-select: text !important;
  touch-action: auto !important;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(var(--lavender-rgb), 0.15); border-radius: var(--r-xs); }
::-webkit-scrollbar-thumb:hover { background: rgba(var(--lavender-rgb), 0.25); }

::selection { background: rgba(var(--lavender-rgb), 0.3); color: var(--white); }

/* ─── App Shell ─────────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  position: fixed;
  inset: 0;
}

/* ─── Sidebar (overlay-only on all screens) ─────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--s1);
  border-right: none;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  transform: translateX(-100%);
  z-index: 200;
  transition: transform 0.36s var(--ease-spring);
  will-change: transform;
  box-shadow: 4px 0 32px rgba(0,0,0,0.28);
}
.sidebar.open { transform: translateX(0); }

/* ── Sidebar header — brand + close ── */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand a.ath-fallback { text-decoration: none; color: inherit; }
.sidebar-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  object-fit: contain;
  filter: drop-shadow(0 1px 4px rgba(var(--jacarta-rgb), 0.3));
}
.sidebar-title {
  font-family: var(--ff-brand);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--athens);
  letter-spacing: 0.02em;
}
.sidebar-wordmark {
  height: 32px;
  width: auto;
  object-fit: contain;
  display: block;
}
/* Theme-aware wordmark swap — two stacked imgs, one per theme.
   -light asset = light artwork for DARK theme; -dark asset = dark artwork for LIGHT theme. */
.wm-light-theme { display: none; }
.wm-dark-theme { display: block; }
[data-theme="light"] .wm-dark-theme { display: none; }
[data-theme="light"] .wm-light-theme { display: block; }
.sidebar-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  color: rgba(var(--athens-rgb), 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s var(--ease-smooth);
  -webkit-tap-highlight-color: transparent;
}
.sidebar-close-btn:hover {
  background: rgba(var(--lavender-rgb), 0.06);
  color: var(--athens);
}
.sidebar-close-btn:active { transform: scale(0.95); }

.sidebar-collapse-btn {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
  background: rgba(var(--lavender-rgb), 0.035);
  color: rgba(var(--athens-rgb), 0.42);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s var(--ease-out);
}
.sidebar-collapse-btn { display: none; }
.sidebar-collapse-btn svg { transition: transform 0.2s var(--ease-out); }
/* Sidebar-collapsed mode removed — sidebar is overlay-only now */

.new-chat-btn {
  margin: 0;
  padding: 10px 16px;
  background: rgba(var(--lavender-rgb), 0.08);
  border: 1px solid rgba(var(--lavender-rgb), 0.35);
  border-radius: 0;
  color: var(--athens);
  font-family: var(--ff-heading);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s var(--ease-smooth);
  flex: 1;
  -webkit-tap-highlight-color: transparent;
}

.new-chat-btn:hover {
  background: rgba(var(--lavender-rgb), 0.15);
  border-color: rgba(var(--lavender-rgb), 0.5);
}
.new-chat-btn:active {
  transform: scale(0.98);
}

/* ── Sidebar actions — new chat + search ── */
.sidebar-actions {
  display: flex;
  gap: 8px;
  margin: 0 16px 16px;
  flex-shrink: 0;
  align-items: stretch;
}

.search-icon-btn {
  flex-shrink: 0;
  width: 40px;
  padding: 0;
  background: rgba(var(--lavender-rgb), 0.08);
  border: 1px solid rgba(var(--lavender-rgb), 0.35);
  border-radius: 0;
  color: var(--athens);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease-smooth);
  -webkit-tap-highlight-color: transparent;
}

.search-icon-btn:hover {
  background: rgba(var(--lavender-rgb), 0.06);
  border-color: rgba(var(--lavender-rgb), 0.15);
  color: var(--lavender);
}

.sidebar-search {
  margin: 12px 12px 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(var(--lavender-rgb), 0.04);
  border: 1px solid rgba(var(--lavender-rgb), 0.06);
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.sidebar-search svg { color: rgba(var(--lavender-rgb), 0.4); flex-shrink: 0; }

.sidebar-search input {
  background: transparent;
  border: none;
  color: var(--athens);
  font-family: var(--ff-body);
  font-size: 0.8rem;
  outline: none;
  width: 100%;
}

.sidebar-search input::placeholder { color: rgba(var(--athens-rgb), 0.25); }

/* Native clear button on type=search, tinted to match the sidebar */
.sidebar-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  cursor: pointer;
  background-color: rgba(var(--athens-rgb), 0.35);
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M18 6L6 18M6 6l12 12' stroke='black' stroke-width='3' stroke-linecap='round'/></svg>") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M18 6L6 18M6 6l12 12' stroke='black' stroke-width='3' stroke-linecap='round'/></svg>") center / contain no-repeat;
}

.sidebar-search input::-webkit-search-cancel-button:hover {
  background-color: rgba(var(--athens-rgb), 0.7);
}

/* Kill the WebKit autofill wash if a manager gets in anyway */
.sidebar-search input:-webkit-autofill,
.sidebar-search input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--athens);
  transition: background-color 9999s;
}

/* Sidebar filter tabs */
.sidebar-filters {
  display: flex;
  gap: 4px;
  padding: 4px 16px 8px;
  flex-shrink: 0;
}
.sidebar-filter {
  flex: 1;
  padding: 5px 0;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: rgba(var(--athens-rgb), 0.35);
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.2s var(--ease-smooth);
}
.sidebar-filter:hover { background: rgba(var(--lavender-rgb), 0.05); color: rgba(var(--athens-rgb), 0.5); }
.sidebar-filter.active {
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--lavender);
}

/* Conversation list */
.sidebar-conversations {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 8px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.conv-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.15s var(--ease-smooth);
  position: relative;
  margin-bottom: 1px;
}

.conv-item:hover { background: rgba(var(--lavender-rgb), 0.05); }

.conv-item.active {
  background: rgba(var(--lavender-rgb), 0.08);
}

.conv-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 20px;
  border-radius: 0 var(--r-pill) var(--r-pill) 0;
  background: var(--brand);
}

.conv-item-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: rgba(var(--lavender-rgb), 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(var(--lavender-rgb), 0.45);
  margin-top: 1px;
}
.conv-icon-image {
  background: rgba(168, 130, 255, 0.1);
  color: rgba(168, 130, 255, 0.7);
}
.conv-item.active .conv-icon-image { background: rgba(168, 130, 255, 0.2); color: rgba(168, 130, 255, 0.9); }
.conv-icon-voice {
  background: rgba(52, 211, 153, 0.1);
  color: rgba(52, 211, 153, 0.7);
}
.conv-item.active .conv-icon-voice { background: rgba(52, 211, 153, 0.2); color: rgba(52, 211, 153, 0.9); }
.conv-icon-code {
  background: rgba(96, 165, 250, 0.1);
  color: rgba(96, 165, 250, 0.7);
}
.conv-item.active .conv-icon-code { background: rgba(96, 165, 250, 0.2); color: rgba(96, 165, 250, 0.9); }
.conv-icon-map {
  background: rgba(152, 137, 192, 0.1);
  color: rgba(152, 137, 192, 0.7);
}
.conv-item.active .conv-icon-map { background: rgba(152, 137, 192, 0.2); color: rgba(152, 137, 192, 0.9); }

.conv-item-icon svg { width: 14px; height: 14px; }

.conv-item-body { flex: 1; min-width: 0; }

.conv-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.conv-item-title {
  flex: 1;
  min-width: 0;
  font-family: var(--ff-heading);
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(var(--athens-rgb), 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}

.conv-item.active .conv-item-title { color: var(--athens); font-weight: 600; }

.conv-item-time {
  flex-shrink: 0;
  font-family: var(--ff-heading);
  font-size: 0.62rem;
  font-weight: 500;
  color: rgba(var(--athens-rgb), 0.2);
  letter-spacing: 0.01em;
}
.conv-item.active .conv-item-time { color: rgba(var(--athens-rgb), 0.35); }

.conv-item-preview {
  font-size: 0.72rem;
  color: rgba(var(--athens-rgb), 0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  line-height: 1.3;
}
.conv-item.active .conv-item-preview { color: rgba(var(--athens-rgb), 0.35); }

.conv-pin-icon {
  color: var(--lavender);
  opacity: 0.5;
  flex-shrink: 0;
}
.conv-pinned-label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.conv-date-label {
  padding: 16px 12px 6px;
  font-family: var(--ff-heading);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(var(--lavender-rgb), 0.35);
}

/* Menu button — hidden by default, visible on hover */
.conv-item-menu-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: rgba(var(--athens-rgb), 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: all 0.15s;
  margin-top: 1px;
}
.conv-item:hover .conv-item-menu-btn,
.conv-item.active .conv-item-menu-btn { opacity: 1; }
.conv-item-menu-btn:hover { background: rgba(var(--lavender-rgb), 0.12); color: var(--lavender); }

/* Iris prompt hint */
.iris-prompt-hint {
  font-family: var(--ff-body);
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.2);
  padding: 4px 4px 0;
  line-height: 1.3;
}

.sidebar-empty {
  padding: 32px 20px;
  text-align: center;
  color: rgba(var(--athens-rgb), 0.3);
  font-size: 0.85rem;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 12px 12px;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* ── User account card (top of sidebar footer) ── */
.sidebar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s var(--ease-smooth);
  border-radius: var(--r-md);
}
.sidebar-account:hover {
  background: rgba(var(--lavender-rgb), 0.04);
}
.sidebar-account-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: rgba(var(--lavender-rgb), 0.1);
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  color: var(--lavender);
  font-family: var(--ff-heading);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
.sidebar-account-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-account-name {
  font-family: var(--ff-heading);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--athens);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.sidebar-account-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}
.sidebar-account-tier {
  font-family: var(--ff-heading);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  flex-shrink: 0;
}
.sidebar-account-tier.tier-free {
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--lavender-2);
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
}
.sidebar-account-tier.tier-beta {
  background: rgba(var(--gold-rgb), 0.1);
  color: var(--gold-soft);
  border: 1px solid rgba(var(--gold-rgb), 0.25);
}
.sidebar-account-tier.tier-admin {
  background: rgba(var(--ok-rgb, 45, 212, 167), 0.12);
  color: var(--ok);
  border: 1px solid rgba(var(--ok-rgb, 45, 212, 167), 0.25);
}
.sidebar-account-tier.tier-internal {
  background: rgba(var(--ok-rgb, 45, 212, 167), 0.12);
  color: var(--ok);
  border: 1px solid rgba(var(--ok-rgb, 45, 212, 167), 0.25);
}
.sidebar-account-tier.tier-funded {
  background: rgba(var(--gold-rgb), 0.12);
  color: var(--gold-soft);
  border: 1px solid rgba(var(--gold-rgb), 0.25);
}
.sidebar-account-tier.tier-pro,
.sidebar-account-tier.tier-business,
.sidebar-account-tier.tier-enterprise {
  background: rgba(var(--brand-rgb), 0.12);
  color: var(--brand-soft);
  border: 1px solid rgba(var(--brand-rgb), 0.25);
}
.sidebar-account-email {
  font-size: 0.65rem;
  color: rgba(var(--athens-rgb), 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-account-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: rgba(var(--athens-rgb), 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  transition: color 0.2s, background 0.2s;
}
.sidebar-account-btn:hover {
  color: var(--lavender);
  background: rgba(var(--lavender-rgb), 0.1);
}

/* ── Guest sign-in CTA ── */
.sidebar-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--gold);
  border-radius: 0;
  background: linear-gradient(135deg, rgba(var(--gold-rgb), 0.15), rgba(var(--gold-rgb), 0.05));
  color: var(--gold-soft);
  font-family: var(--ff-heading);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 16px rgba(var(--gold-rgb), 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.sidebar-signin-btn:hover {
  background: linear-gradient(135deg, rgba(var(--gold-rgb), 0.25), rgba(var(--gold-rgb), 0.1));
  box-shadow: 0 6px 20px rgba(var(--gold-rgb), 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.sidebar-signin-btn:active {
  transform: scale(0.98);
}
.sidebar-signin-btn svg {
  width: 18px;
  height: 18px;
  color: var(--gold);
}

/* ── Auth overlay (guest sign-in/sign-up modal) ─────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 60000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top, 0px));
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-smooth);
}
.auth-overlay:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}
.auth-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 12, 0.72);
}
.auth-overlay-card {
  position: relative;
  width: min(420px, calc(100vw - 40px));
  max-height: calc(100dvh - 40px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--glass-1, rgba(250, 248, 245, 0.96));
  border: 1px solid var(--glass-edge, rgba(42, 40, 37, 0.1));
  border-radius: var(--r-xl, 16px);
  padding: 32px 32px calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.35s var(--ease-spring);
}
.auth-overlay:not([hidden]) .auth-overlay-card {
  transform: translateY(0) scale(1);
}
.auth-overlay-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(var(--gold-rgb), 0.5), rgba(255, 255, 255, 0.2), rgba(var(--gold-rgb), 0.3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.auth-overlay-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--r-md, 8px);
  background: rgba(42, 40, 37, 0.06);
  color: var(--text-secondary, rgba(42, 40, 37, 0.6));
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s;
}
.auth-overlay-close:hover {
  background: rgba(42, 40, 37, 0.12);
  color: var(--text-primary, #1a1814);
}
.auth-overlay-close svg {
  width: 16px;
  height: 16px;
}
.auth-overlay-header {
  text-align: center;
  margin-bottom: 24px;
}
.auth-overlay-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--r-sm, 4px);
  margin: 0 auto 16px;
  display: block;
  filter: drop-shadow(0 0 12px rgba(var(--athena-presence-rgb, 123, 107, 168), 0.25));
}
/* Wordmark variant — wide lockup, no fixed-square sizing */
.auth-overlay-wordmark {
  width: auto;
  height: 52px;
  max-width: 240px;
  border-radius: 0;
}
.auth-overlay-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--gold-soft, #A88550);
  margin-bottom: 12px;
}
.auth-overlay-eyebrow svg {
  width: 14px;
  height: 14px;
  color: var(--gold, #C5A572);
}
.auth-overlay-card h2 {
  font-family: var(--ff-heading, system-ui, sans-serif);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary, #1a1814);
  margin: 0 0 8px;
}
.auth-overlay-lede {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary, rgba(42, 40, 37, 0.65));
  margin: 0;
}
.auth-overlay-form {
  margin-bottom: 20px;
}
.auth-overlay-field {
  margin-bottom: 14px;
}
.auth-overlay-field label {
  display: block;
  font-family: var(--ff-heading, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, rgba(42, 40, 37, 0.7));
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.auth-overlay-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--glass-edge, rgba(42, 40, 37, 0.12));
  border-radius: var(--r-cut);
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-primary, #1a1814);
  font-family: var(--ff-body, system-ui, sans-serif);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.auth-overlay-field input:focus {
  outline: none;
  border-color: rgba(var(--gold-rgb), 0.4);
  box-shadow: 0 0 0 3px rgba(var(--gold-rgb), 0.08);
}
.auth-overlay-cta {
  width: 100%;
  padding: 12px 18px;
  border: none;
  border-radius: var(--r-cut);
  background: linear-gradient(135deg, var(--gold, #C5A572), var(--gold-deep, #A88550));
  color: #fff;
  font-family: var(--ff-heading, system-ui, sans-serif);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 8px 24px rgba(var(--gold-rgb), 0.25);
}
.auth-overlay-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(var(--gold-rgb), 0.3);
}
.auth-overlay-cta:active {
  transform: translateY(0);
}
.auth-overlay-cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.auth-overlay-cta svg {
  width: 16px;
  height: 16px;
}
.auth-overlay-note {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary, rgba(42, 40, 37, 0.65));
  min-height: 0;
}
.auth-overlay-note.success {
  color: var(--ok, #2dd4a7);
}
.auth-overlay-note.error {
  color: var(--danger, #E5484D);
}
.auth-overlay-divider {
  display: flex;
  align-items: center;
  margin: 20px 0 16px;
  color: var(--text-tertiary, rgba(42, 40, 37, 0.4));
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.auth-overlay-divider::before,
.auth-overlay-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-edge, rgba(42, 40, 37, 0.1));
}
.auth-overlay-divider span {
  padding: 0 14px;
}
.auth-overlay-passkey {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--glass-edge, rgba(42, 40, 37, 0.15));
  border-radius: var(--r-cut);
  background: rgba(255, 255, 255, 0.4);
  color: var(--text-primary, #1a1814);
  font-family: var(--ff-heading, system-ui, sans-serif);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  margin-bottom: 10px;
}
.auth-overlay-passkey:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(var(--gold-rgb), 0.3);
}
.auth-overlay-passkey svg {
  width: 16px;
  height: 16px;
  color: var(--gold-soft, #A88550);
}
.auth-overlay-sso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--gold, #C5A572);
  border-radius: var(--r-cut);
  background: linear-gradient(135deg, rgba(var(--gold-rgb), 0.12), rgba(var(--gold-rgb), 0.04));
  color: var(--gold-soft, #A88550);
  font-family: var(--ff-heading, system-ui, sans-serif);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
  box-shadow: 0 8px 24px rgba(var(--gold-rgb), 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
}
.auth-overlay-sso:hover {
  background: linear-gradient(135deg, rgba(var(--gold-rgb), 0.22), rgba(var(--gold-rgb), 0.08));
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(var(--gold-rgb), 0.2);
}
.auth-overlay-sso svg {
  width: 18px;
  height: 18px;
  color: var(--gold, #C5A572);
}
.auth-overlay-trust {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
  font-size: 11px;
  color: var(--text-tertiary, rgba(42, 40, 37, 0.4));
  font-weight: 500;
}
.auth-overlay-trust span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.auth-overlay-trust svg {
  width: 12px;
  height: 12px;
}
.auth-overlay-alt {
  display: block;
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary, rgba(42, 40, 37, 0.5));
  text-decoration: none;
  transition: color 0.2s;
}
.auth-overlay-alt:hover {
  color: var(--gold-soft, #A88550);
}
/* ── Footer buttons row (below account card) ── */
.sidebar-footer-btn-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
}

.sidebar-footer-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  color: rgba(var(--athens-rgb), 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s var(--ease-smooth);
  -webkit-tap-highlight-color: transparent;
}

.sidebar-footer-btn:hover {
  background: rgba(var(--lavender-rgb), 0.06);
  color: var(--lavender);
}

.sidebar-footer-btn:active {
  transform: scale(0.95);
}

.sidebar-footer-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  color: rgba(var(--athens-rgb), 0.4);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(var(--athens-rgb), 0.2);
  transition: background 0.3s;
}

.status-dot.online { background: var(--ok); animation: pulse-dot 2s ease-in-out infinite; }
.status-dot.offline { background: var(--danger); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  /* above the composer (z-index 100), below the sidebar (200) —
     the dim must cover the prompt area too */
  z-index: 150;
  opacity: 0;
  transition: opacity 0.3s var(--ease-smooth);
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ─── Main Area ─────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--s0);
  position: relative;
}

/* ─── Chat Header ───────────────────────────────────────── */
.chat-header {
  height: var(--header-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: none;
  background: transparent;
  flex-shrink: 0;
  z-index: 10;
}

/* Sync/reload button with version badge — in sidebar footer */
.sidebar-footer-sync {
  position: relative;
  flex-direction: row;
  gap: 3px;
  padding: 6px 8px;
}
.sync-version {
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: rgba(var(--lavender-rgb), 0.5);
  line-height: 1;
}

.chat-header-left { display: flex; align-items: center; gap: 12px; }
/* ── The Athena signature in the workspace header — oversized but calmer than the guest pages ── */
.header-brand { position: relative; display: block; width: 148px; height: var(--header-h, 56px); flex: 0 0 auto; margin-left: 2px; }
.header-brand .hs { position: absolute; left: 0; top: 7px; height: 68px; width: auto; max-width: none; pointer-events: none; filter: drop-shadow(0 3px 8px rgba(5,3,20,.18)); }
.header-brand .hs-light { display: none; }
[data-theme="light"] .header-brand .hs-light { display: block; }
[data-theme="light"] .header-brand .hs-dark { display: none; }
@media (max-width: 700px) {
  .header-brand { width: 112px; }
  .header-brand .hs { height: 52px; top: 5px; }
}


/* System prompt badge in header */
.sysprompt-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(var(--lavender-rgb), 0.1);
  border: 1px solid rgba(var(--lavender-rgb), 0.25);
  color: var(--lavender);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.sysprompt-badge:hover {
  background: rgba(var(--lavender-rgb), 0.18);
  border-color: rgba(var(--lavender-rgb), 0.4);
}
.sysprompt-badge.hidden { display: none; }
@media (max-width: 600px) {
  .sysprompt-badge span { display: none; }
  .sysprompt-badge { padding: 5px 8px; }
}

/* System prompt quick-edit popover */
.sysprompt-popover {
  position: absolute;
  top: calc(var(--header-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 480px;
  max-width: calc(100vw - 32px);
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  z-index: 200;
  overflow: hidden;
}
.sysprompt-popover[hidden] { display: none; }
.sysprompt-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}
.sysprompt-popover-title {
  font-family: var(--ff-heading);
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--white);
}
.sysprompt-popover-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.sysprompt-popover-close:hover { color: var(--text); background: rgba(var(--border-rgb), 0.3); }
.sysprompt-popover-presets { padding: 0 16px 12px; }
.sysprompt-presets-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.sysprompt-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.sysprompt-preset {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(var(--border-rgb), 0.2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  text-align: left;
}
.sysprompt-preset:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  border-color: rgba(var(--lavender-rgb), 0.3);
  transform: translateY(-1px);
}
.sysprompt-preset-name {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.sysprompt-preset-desc {
  font-size: 0.66rem;
  color: var(--text-muted);
  line-height: 1.3;
}
.sysprompt-popover-edit { padding: 0 16px 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.sysprompt-popover-textarea {
  width: 100%;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--ff-body);
  font-size: 0.82rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 80px;
}
.sysprompt-popover-textarea:focus {
  outline: none;
  border-color: var(--lavender);
  box-shadow: 0 0 0 3px rgba(var(--lavender-rgb), 0.15);
}
.sysprompt-popover-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}
.sysprompt-popover-btn {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}
.sysprompt-popover-btn.save {
  background: var(--lavender);
  color: #fff;
}
.sysprompt-popover-btn.save:hover { opacity: 0.88; }
.sysprompt-popover-btn.clear {
  background: rgba(var(--border-rgb), 0.3);
  color: var(--text-muted);
}
.sysprompt-popover-btn.clear:hover { color: var(--text); }
.chat-header-right { display: flex; align-items: center; gap: 8px; }

/* ── Guest mode ── */
/* Guests don't get the sidebar, overlay or hamburger until they sign in —
   conversations, folders and settings are account features. The header wordmark
   stays; a compact sign-in button replaces the sidebar CTA. */
body.is-guest .sidebar,
body.is-guest .sidebar-overlay,
body.is-guest .hamburger {
  display: none !important;
}
.header-signin-btn {
  padding: 7px 16px;
  border: none;
  border-radius: var(--r-cut);
  background: var(--gold);
  color: #1a1a2e;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.header-signin-btn:hover { opacity: 0.85; }
.guest-counter {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-elevated);
  padding: 5px 12px;
  border-radius: var(--r-cut);
  white-space: nowrap;
}
.gl-perch-card {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 0; padding: 34px 28px 24px; margin: 60px auto 20px; max-width: 440px;
  background: linear-gradient(175deg, #fffdf8 0%, #fdf7ea 55%, #f7efdc 100%);
  border: 1px solid rgba(197,165,114,.55); border-radius: 18px;
  box-shadow: 0 3px 9px rgba(48,40,62,.06), 0 24px 54px rgba(48,40,62,.14), 0 18px 44px rgba(197,165,114,.22);
  animation: glCardIn .6s var(--ease-spring) both;
}
[data-theme="dark"] .gl-perch-card {
  background: linear-gradient(175deg, #26222f 0%, #201d28 55%, #1a1720 100%);
  border-color: rgba(197,165,114,.4);
  box-shadow: 0 3px 9px rgba(0,0,0,.3), 0 24px 54px rgba(0,0,0,.5);
}
@keyframes glCardIn { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
@media (prefers-reduced-motion: reduce) { .gl-perch-card { animation: none } }
.gl-halo {
  position: absolute; top: -70px; left: 50%; transform: translateX(-50%);
  width: 260px; height: 260px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(232,196,124,.32) 0%, rgba(232,196,124,.1) 45%, transparent 70%);
  animation: glHalo 4.5s ease-in-out infinite;
}
[data-theme="dark"] .gl-halo { background: radial-gradient(circle, rgba(197,165,114,.22) 0%, rgba(197,165,114,.07) 45%, transparent 70%) }
@keyframes glHalo { 0%,100% { opacity: .75; transform: translateX(-50%) scale(1) } 50% { opacity: 1; transform: translateX(-50%) scale(1.06) } }
@media (prefers-reduced-motion: reduce) { .gl-halo { animation: none } }
.gl-owl {
  position: absolute; top: -78px; left: 50%; transform: translateX(-50%);
  z-index: 3; pointer-events: none; filter: drop-shadow(0 10px 14px rgba(9,5,24,.35));
  animation: glOwlIn 1.2s var(--ease-spring) .15s both; transform-origin: 50% 92%;
}
.gl-owl athena-owl { display: block; width: 112px }
@keyframes glOwlIn { from { opacity: 0; transform: translateX(-50%) translateY(16px) } to { opacity: 1; transform: translateX(-50%) } }
@media (prefers-reduced-motion: reduce) { .gl-owl { animation: none } }
.gl-eyebrow {
  font-family: var(--ff-mono, monospace); font-size: 10px; font-weight: 500; letter-spacing: .24em;
  text-transform: uppercase; color: #7A5F30; margin-bottom: 8px;
}
[data-theme="dark"] .gl-eyebrow { color: #E3C88F }
.gl-perch-card h3 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 8px; color: #30283e }
[data-theme="dark"] .gl-perch-card h3 { color: #ece7f0 }
.gl-perch-card p { font-size: 13.5px; line-height: 1.65; color: #70677c; margin: 0 0 20px; max-width: 330px }
[data-theme="dark"] .gl-perch-card p { color: #9d94a8 }
.gl-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; max-width: 300px; min-height: 48px; padding: 13px 26px;
  border-radius: 8px; font-size: 15px; font-weight: 700; text-decoration: none;
  background: linear-gradient(135deg, #C5A572, #A88550); color: #14102E;
  box-shadow: 0 1px 2px rgba(20,16,46,.12);
  transition: transform .2s, box-shadow .2s;
}
.gl-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(197,165,114,.38); color: #14102E }
.gl-cta:focus-visible { outline: 2px solid #9889C0; outline-offset: 3px }
.gl-foot { font-size: 11px; color: #70677c; margin-top: 12px; opacity: .85 }
[data-theme="dark"] .gl-foot { color: #9d94a8 }
.chat-header-title {
  font-family: var(--ff-brand);
  font-weight: 700;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--athens);
  letter-spacing: 0.02em;
  opacity: 0.7;
}
.chat-header-wordmark {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.hamburger {
  width: 40px; height: 40px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none;
  color: rgba(var(--athens-rgb), 0.55);
  cursor: pointer;
  border-radius: var(--r-md);
  -webkit-tap-highlight-color: transparent;
  transition: color .18s var(--ease-smooth), background .18s var(--ease-smooth), transform .18s var(--ease-smooth);
}
.hamburger:hover { background: rgba(var(--lavender-rgb), 0.08); color: var(--athens); }
.hamburger:active { transform: scale(0.94); }
.hamburger:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[data-theme="light"] .hamburger { color: rgba(25, 20, 35, 0.55); }
[data-theme="light"] .hamburger:hover { color: #191423; }

/* The burger: 18×12, 2px lines, perfectly centred in its 40px box */
.burger { position: relative; display: block; width: 18px; height: 12px; pointer-events: none; }
.b-line { position: absolute; left: 0; right: 0; height: 2px; border-radius: 1px; background: currentColor; transition: transform .3s var(--ease-spring), opacity .18s var(--ease-smooth); }
.b-top { top: 0; }
.b-mid { top: 5px; }
.b-bot { top: 10px; }
@media (prefers-reduced-motion: reduce) { .b-line { transition: none; } }

.header-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  color: rgba(var(--athens-rgb), 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s var(--ease-smooth);
  -webkit-tap-highlight-color: transparent;
}

.header-icon-btn:hover {
  background: rgba(var(--lavender-rgb), 0.06);
  color: var(--lavender);
}

.header-icon-btn:active {
  transform: scale(0.95);
}

.header-icon-btn.active {
  background: rgba(var(--jacarta-rgb), 0.5);
  color: var(--lavender);
  border-color: rgba(var(--lavender-rgb), 0.22);
}

.studio-launchers {
  display: flex;
  align-items: center;
  gap: 6px;
}

.studio-launch-btn {
  width: 31px;
  height: 31px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: rgba(var(--lavender-rgb), 0.035);
  color: rgba(var(--athens-rgb), 0.55);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.22s var(--ease-smooth);
}

.studio-launch-btn:hover {
  transform: translateY(-1px);
  background: rgba(var(--lavender-rgb), 0.12);
  color: var(--white);
  border-color: rgba(var(--lavender-rgb), 0.24);
  box-shadow: 0 8px 24px rgba(var(--lavender-rgb), 0.1);
}

.studio-launch-btn:active {
  transform: translateY(0);
}

.studio-launch-btn.active {
  background: linear-gradient(135deg, rgba(var(--jacarta-rgb), 0.72), rgba(var(--lavender-rgb), 0.18));
  color: var(--lavender);
  border-color: rgba(var(--lavender-rgb), 0.32);
  box-shadow: 0 0 0 1px rgba(var(--lavender-rgb), 0.08), 0 14px 34px rgba(var(--lavender-rgb), 0.14);
}

/* ─── Model Selector ────────────────────────────────────── */
.model-selector { position: relative; }

.model-selector-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: rgba(var(--athens-rgb), 0.7);
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.model-selector-btn:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--lavender);
}

.model-provider-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lavender);
  flex-shrink: 0;
}

.model-provider-dot.ollama { background: var(--ok); }
.model-provider-dot.openrouter { background: var(--info); }

/* Dropdown pops UPWARD from the input footer */
.model-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  width: 360px;
  max-height: 440px;
  background: var(--s2);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg), 0 -4px 24px rgba(0,0,0,0.3);
  overflow: hidden;
  display: none;
  z-index: 200;
  animation: popUp 0.25s var(--ease-spring);
}

.model-dropdown.open { display: flex; flex-direction: column; }

@keyframes popUp {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Provider tabs — side by side, pill style ── */
.model-dropdown-tabs {
  display: flex;
  flex-direction: row;
  gap: 4px;
  padding: 8px 8px 0;
  flex-shrink: 0;
  background: rgba(var(--s1-rgb), 0.4);
}

.mdd-tab {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: rgba(var(--athens-rgb), 0.45);
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--ease-smooth);
  white-space: nowrap;
}

.mdd-tab svg { flex-shrink: 0; opacity: 0.6; }

.mdd-tab:hover {
  color: var(--athens);
  background: rgba(var(--lavender-rgb), 0.05);
}

.mdd-tab:hover svg { opacity: 0.9; }

.mdd-tab.active {
  color: var(--lavender);
  background: rgba(var(--lavender-rgb), 0.1);
  border-color: rgba(var(--lavender-rgb), 0.18);
}

.mdd-tab.active svg { opacity: 1; color: var(--lavender); }

/* ── Search ── */
.model-dropdown-search {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06);
  flex-shrink: 0;
}

.model-dropdown-search input {
  width: 100%;
  padding: 8px 12px;
  background: rgba(var(--lavender-rgb), 0.04);
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
  border-radius: var(--r-sm);
  color: var(--athens);
  font-family: var(--ff-body);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s;
}

.model-dropdown-search input:focus { border-color: rgba(var(--lavender-rgb), 0.2); }
.model-dropdown-search input::placeholder { color: rgba(var(--athens-rgb), 0.25); }

/* ── Model list ── */
.model-dropdown-list {
  overflow-y: auto;
  flex: 1;
  max-height: 320px;
  padding: 6px;
}

.model-option {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.12s;
}

.model-option:hover { background: rgba(var(--lavender-rgb), 0.06); }

/* Blocked by data classification — greyed out, not selectable */
.model-option--blocked,
.model-option--blocked:hover {
  opacity: 0.42;
  cursor: not-allowed;
  background: transparent;
}
.model-option--blocked.selected { box-shadow: none; }
.model-option-lock {
  display: inline-flex;
  vertical-align: -1px;
  margin-right: 5px;
  color: rgba(var(--athens-rgb), 0.55);
}
.model-option-blocked-tag {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(var(--athens-rgb), 0.5);
  white-space: nowrap;
}
/* Notice at the top of a blocked provider's model list */
.model-blocked-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin: 2px 2px 6px;
  border-left: 2px solid var(--gold);
  background: rgba(201, 162, 75, 0.07);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: rgba(var(--athens-rgb), 0.75);
}
.model-blocked-note svg { flex-shrink: 0; margin-top: 1px; color: var(--gold); }
.model-blocked-note strong { color: var(--gold); font-weight: 700; }
/* Frontier tab when blocked by classification */
.mdd-tab--blocked { opacity: 0.5; }
.mdd-tab--blocked:hover { opacity: 0.65; }

.model-option.selected {
  background: rgba(var(--jacarta-rgb), 0.35);
  box-shadow: inset 0 0 0 1px rgba(var(--lavender-rgb), 0.15);
}

.model-option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.model-option-name {
  font-family: var(--ff-heading);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--athens);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-option-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  min-width: 0;
}

.model-option-meta {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.35);
  white-space: nowrap;
}

.model-capabilities {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.model-cap {
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--lavender-rgb), 0.055);
  color: rgba(var(--athens-rgb), 0.56);
  transition: all 0.15s var(--ease-smooth);
}

.model-cap svg {
  width: 13px;
  height: 13px;
}

.model-option:hover .model-cap,
.model-option.selected .model-cap {
  color: var(--athens);
  border-color: rgba(var(--lavender-rgb), 0.22);
}

.model-cap-chat { color: rgba(var(--athens-rgb), 0.58); }
.model-cap-reasoning { color: var(--lavender); }
.model-cap-code { color: #7dd3fc; }
.model-cap-vision { color: #a7f3d0; }
.model-cap-image { color: #c4b5fd; }
.model-cap-tools { color: #fcd34d; }
.model-cap-cloud { color: #93c5fd; }

.model-empty {
  padding: 24px;
  text-align: center;
  color: rgba(var(--athens-rgb), 0.3);
  font-size: 0.82rem;
}

/* Guest/plan empty state in the model dropdown — actionable copy */
.model-empty_guest {
  color: rgba(var(--athens-rgb), 0.6);
  line-height: 1.5;
}
.model-empty-cta {
  display: inline-block;
  margin-top: 10px;
  padding: 7px 16px;
  border: none;
  border-radius: 100px;
  background: var(--gold);
  color: #1a1a2e;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}
.model-empty-cta:hover { opacity: 0.85; }

/* Model groups (curated frontier categories) */
.model-group {
  margin-bottom: 2px;
}
.model-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 6px;
  position: sticky;
  top: 0;
  background: var(--s1);
  z-index: 2;
}
.model-group-label {
  font-family: var(--ff-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(var(--lavender-rgb), 0.7);
}
.model-group-count {
  font-family: var(--ff-mono);
  font-size: 0.6rem;
  color: rgba(var(--athens-rgb), 0.25);
  background: rgba(var(--lavender-rgb), 0.06);
  padding: 1px 6px;
  border-radius: var(--r-sm);
}
.model-group-items {
  display: flex;
  flex-direction: column;
}
.model-group-items-hidden {
  display: none;
}
.model-group-expand-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: none;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.06);
  background: transparent;
  color: rgba(var(--athens-rgb), 0.4);
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.model-group-expand-btn:hover {
  color: var(--lavender);
  background: rgba(var(--lavender-rgb), 0.04);
}
.model-group-expand-btn svg {
  transition: transform 0.2s var(--ease-out);
}
.model-group-expand-btn.expanded svg {
  transform: rotate(180deg);
}

/* ─── Chat + Canvas Wrap ────────────────────────────────── */
.chat-canvas-wrap {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
  position: relative;
}

/* ─── Chat Area ─────────────────────────────────────────── */
.chat-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  max-width: 100%;
}

/* ─── Welcome Screen — calm, present, immediate ─────────── */
.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* safe center: when the stack is taller than the space (small phones)
     the content anchors to the top instead of being clipped by
     justify-content:center + overflow:hidden. */
  /* Auto margins on .welcome-content do the centering; flex-start means an
     overflowing stack anchors to the TOP instead of being clipped by
     justify-content:center (title cut off above the owl on small phones). */
  justify-content: flex-start !important; /* !important: a later rule re-centres .welcome and re-clips the top on small phones */
  padding: 32px 20px;
  text-align: center;
  position: relative;
  overflow-y: auto;
}

.welcome.hidden { display: none; }

.welcome-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 600px;
  width: 100%;
  /* Auto top/bottom margins: with free space this centres the stack; when the
     stack is taller than the space (small phones) the margins collapse to 0
     and the title stays at the top, reachable, instead of clipped away by
     justify-content:center + overflow. */
  margin: auto 0;
}

/* ── Aristos Orb — animated welcome centerpiece ── */
/* Concentric rings rotating around the Aristos mark, with a
   breathing glow. The orb is Athena's presence — alive, waiting. */
.welcome-orb {
  position: relative;
  width: 96px;
  height: 96px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-orb-core {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(var(--s1-rgb), 0.95), rgba(var(--s2-rgb), 0.85));
  box-shadow:
    0 0 20px rgba(var(--athena-presence-rgb), 0.25),
    inset 0 0 12px rgba(var(--athena-presence-rgb), 0.08);
  z-index: 2;
  animation: orbCoreBreathe var(--t-breathe) var(--ease-breathe) infinite;
}

.welcome-orb-core img {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  object-fit: contain;
}

@keyframes orbCoreBreathe {
  0%, 100% {
    box-shadow: 0 0 16px rgba(var(--athena-presence-rgb), 0.2), inset 0 0 10px rgba(var(--athena-presence-rgb), 0.06);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 28px rgba(var(--athena-presence-rgb), 0.35), inset 0 0 16px rgba(var(--athena-presence-rgb), 0.12);
    transform: scale(1.04);
  }
}

.welcome-orb-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(var(--athena-presence-rgb), 0.15);
  pointer-events: none;
}

.welcome-orb-ring-1 {
  width: 72px;
  height: 72px;
  border-color: rgba(var(--athena-presence-rgb), 0.2);
  animation: orbRingSpin 12s linear infinite;
}
.welcome-orb-ring-1::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--athena-presence-soft);
  box-shadow: 0 0 6px rgba(var(--athena-presence-rgb), 0.6);
}

.welcome-orb-ring-2 {
  width: 84px;
  height: 84px;
  border-color: rgba(var(--gold-rgb), 0.12);
  border-style: dashed;
  animation: orbRingSpin 20s linear infinite reverse;
}
.welcome-orb-ring-2::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 30%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--gold-soft);
  box-shadow: 0 0 6px rgba(var(--gold-rgb), 0.5);
}

.welcome-orb-ring-3 {
  width: 96px;
  height: 96px;
  border-color: rgba(var(--lavender-rgb), 0.08);
  animation: orbRingSpin 30s linear infinite;
}
.welcome-orb-ring-3::before {
  content: '';
  position: absolute;
  top: 40%;
  right: -2px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--lavender);
  box-shadow: 0 0 4px rgba(var(--lavender-rgb), 0.5);
}

@keyframes orbRingSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.welcome-title {
  font-family: var(--ff-heading);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.welcome-sub {
  font-size: 0.88rem;
  color: var(--text-tertiary);
  margin-bottom: 32px;
  max-width: 380px;
  line-height: 1.5;
  font-weight: 400;
}

/* ── Recent conversations on welcome screen ── */
.welcome-recent {
  margin-top: 28px;
  max-width: 560px;
  width: 100%;
}
.welcome-recent[hidden] { display: none; }
.welcome-recent-highlight {
  animation: welcomeRecentPulse 1.5s ease;
}
@keyframes welcomeRecentPulse {
  0%, 100% { transform: scale(1); }
  20% { transform: scale(1.02); box-shadow: 0 0 0 4px rgba(var(--lavender-rgb), 0.2); }
  40% { transform: scale(1); }
  60% { transform: scale(1.02); box-shadow: 0 0 0 4px rgba(var(--lavender-rgb), 0.15); }
}
.welcome-recent-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.35);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  text-align: left;
}
.welcome-recent-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.welcome-recent-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(var(--s2-rgb), 0.5);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  text-align: left;
  width: 100%;
}
.welcome-recent-card:hover {
  background: rgba(var(--lavender-rgb), 0.08);
  border-color: rgba(var(--lavender-rgb), 0.25);
  transform: translateY(-1px);
}
.welcome-recent-card-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--lavender-rgb), 0.12);
  color: var(--lavender);
}
.welcome-recent-card-icon.icon-map { background: rgba(95, 201, 184, 0.12); color: #5FC9B8; }
.welcome-recent-card-icon.icon-image { background: rgba(196, 156, 224, 0.12); color: #C49CE0; }
.welcome-recent-card-icon.icon-voice { background: rgba(143, 183, 255, 0.12); color: #8FB7FF; }
.welcome-recent-card-body { flex: 1; min-width: 0; }
.welcome-recent-card-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.welcome-recent-card-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.welcome-recent-card-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.15s, transform 0.15s;
}
.welcome-recent-card:hover .welcome-recent-card-arrow {
  opacity: 1;
  transform: translateX(2px);
}
@media (max-width: 600px) {
  .welcome-recent { max-width: calc(100vw - 32px); }
  .welcome-recent-card { padding: 10px 14px; }
}

/* ── Roladex — infinite scroll wheel of conversation starters ── */
/* A vertical drum/picker: drag, wheel, or touch to scroll through
   cards. Snaps to nearest card with tactile sound + haptic.
   No auto-rotation — the user drives the wheel. */
.roladex {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin-top: 8px;
}

.roladex-viewport {
  position: relative;
  height: 280px;
  flex: 0 0 auto;
  overflow: hidden;
  perspective: 1200px;
  perspective-origin: 50% 50%;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
  touch-action: none; /* prevent browser scroll while dragging the wheel */
}
.roladex-viewport.dragging { cursor: grabbing; }

/* Fade masks at top and bottom for depth */
.roladex-viewport::before,
.roladex-viewport::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 60px;
  z-index: 2;
  pointer-events: none;
}
.roladex-viewport::before {
  top: 0;
  background: linear-gradient(to bottom, var(--s0) 5%, transparent);
}
.roladex-viewport::after {
  bottom: 0;
  background: linear-gradient(to top, var(--s0) 5%, transparent);
}

.roladex-track {
  position: relative;
  will-change: transform;
}

.roladex-card {
  position: absolute;
  top: 0;
  left: 50%;
  width: calc(100% - 24px);
  max-width: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  background: var(--glass-1);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-pill);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  font-family: var(--ff-heading);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transform-origin: center center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--shadow-sm);
  /* opacity/transform driven by JS on scroll; transition only for snap */
  transition: opacity 0.18s ease-out, transform 0.18s ease-out, border-color 0.25s, background 0.25s;
}
.roladex-track.snapping .roladex-card {
  transition: opacity 0.3s var(--ease-spring), transform 0.3s var(--ease-spring), border-color 0.25s, background 0.25s;
}

/* Center (active) card — highlighted */
.roladex-card.active {
  background: var(--glass-2, rgba(255,255,255,0.08));
  border-color: var(--glass-edge-strong);
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(var(--lavender-rgb, 120,110,200), 0.12), var(--shadow-sm);
}
.roladex-card.active:hover {
  background: var(--presence-athena);
  scale: 1.02;
}
.roladex-card.active:active {
  scale: 0.97;
}
.roladex-card.roladex-card-gold.active:hover {
  background: linear-gradient(135deg, rgba(var(--gold-rgb), .34), rgba(var(--gold-rgb), .16));
}

.roladex-card svg {
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: color 0.25s;
}
.roladex-card.active svg {
  color: rgba(var(--gold-rgb, 200,170,80), 0.8);
}

.roladex-select-hint {
  text-align: center;
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-family: var(--ff-heading);
  letter-spacing: 0.02em;
  opacity: 0.7;
  transition: opacity 0.3s;
}
.roladex-select-hint.hidden { opacity: 0; }

/* ─── Classification Banner ──────────────────────────────── */
.classification-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}
.classification-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(140, 255, 193, 0.15);
  color: #8cffc1;
  border: 1px solid rgba(140, 255, 193, 0.3);
  white-space: nowrap;
}
.classification-pill.cls-official {
  background: rgba(140, 200, 255, 0.15);
  color: #8cc8ff;
  border-color: rgba(140, 200, 255, 0.3);
}
.classification-pill.cls-official-sensitive {
  background: rgba(255, 200, 140, 0.15);
  color: #ffc88c;
  border-color: rgba(255, 200, 140, 0.3);
}
.classification-pill.cls-protected {
  background: rgba(255, 140, 140, 0.15);
  color: #ff8c8c;
  border-color: rgba(255, 140, 140, 0.3);
}
.classification-select {
  background: var(--surface-2, #13101c);
  border: 1px solid var(--line, #2a2438);
  border-radius: 4px;
  padding: 4px 8px;
  color: var(--text, #f8f5ff);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.classification-select:focus {
  outline: none;
  border-color: var(--accent-2, #9889c0);
}
.provider-jurisdiction-badge {
  font-size: 10px;
  color: var(--muted, #9b90ad);
  padding: 2px 8px;
  border: 1px solid var(--line-soft, #221d2e);
  border-radius: 10px;
  white-space: nowrap;
}

/* ── Phase 4.4: Classification banner transition & tooltip ── */
.classification-pill {
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}
.classification-pill:hover {
  transform: scale(1.04);
}
.classification-banner {
  transition: opacity 0.3s ease;
}
.classification-info-icon {
  display: inline-flex;
  align-items: center;
  color: var(--muted, #9b90ad);
  cursor: help;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.classification-info-icon:hover {
  opacity: 1;
}

/* ── Phase 4.4: Input area classification pill ── */
.input-classification-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  height: 34px;
  border-radius: var(--r-md);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: transparent;
  color: #8cffc1;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.3s ease;
}
.input-classification-pill.cls-official {
  background: transparent;
  color: #8cc8ff;
  border: none;
}
.input-classification-pill.cls-official-sensitive {
  background: transparent;
  color: #ffc88c;
  border: none;
}
.input-classification-pill.cls-protected {
  background: transparent;
  color: #ff8c8c;
  border: none;
}

/* ── Light theme: classification pill contrast ── */
[data-theme="light"] .input-classification-pill {
  background: transparent;
  color: #1a7a4c;
  border: none;
}
[data-theme="light"] .input-classification-pill.cls-official {
  background: transparent;
  color: #2a64b8;
  border: none;
}
[data-theme="light"] .input-classification-pill.cls-official-sensitive {
  background: transparent;
  color: #9c6810;
  border: none;
}
[data-theme="light"] .input-classification-pill.cls-protected {
  background: transparent;
  color: #b02828;
  border: none;
}

/* Info button inside the pill */
.cls-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 2px;
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  border-radius: 50%;
  transition: opacity 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.cls-info-btn:hover, .cls-info-btn:focus {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

/* Popover with classification explanations */
.cls-info-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 300px;
  max-width: calc(100vw - 36px);
  padding: 12px;
  background: var(--s2);
  border: 1px solid var(--glass-edge);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(var(--s0-rgb), 0.4);
  z-index: 1000;
  font-size: 0.8rem;
  line-height: 1.4;
}
.cls-info-popover[hidden] { display: none; }
.cls-info-popover-arrow {
  position: absolute;
  bottom: -6px;
  left: 24px;
  width: 12px;
  height: 12px;
  background: var(--surface-2, #241E31);
  border-right: 1px solid var(--border, rgba(255,255,255,0.08));
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  transform: rotate(45deg);
}
.cls-info-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.cls-info-item:last-of-type { margin-bottom: 10px; }
.cls-info-item p {
  margin: 0;
  color: var(--text-muted, rgba(255,255,255,0.6));
  flex: 1;
}
.cls-info-badge {
  flex-shrink: 0;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 3px 8px;
  border-radius: 100px;
  white-space: nowrap;
}
.cls-info-badge.cls-unofficial {
  background: rgba(140, 255, 193, 0.12);
  color: #8cffc1;
  border: 1px solid rgba(140, 255, 193, 0.25);
}
.cls-info-badge.cls-official {
  background: rgba(140, 200, 255, 0.12);
  color: #8cc8ff;
  border: 1px solid rgba(140, 200, 255, 0.25);
}
.cls-info-badge.cls-official-sensitive {
  background: rgba(255, 200, 140, 0.12);
  color: #ffc88c;
  border: 1px solid rgba(255, 200, 140, 0.25);
}
.cls-info-badge.cls-protected {
  background: rgba(255, 140, 140, 0.12);
  color: #ff8c8c;
  border: 1px solid rgba(255, 140, 140, 0.25);
}
.cls-info-foot {
  margin: 8px 0 0;
  font-size: 0.7rem;
  color: var(--text-faint, rgba(255,255,255,0.4));
  font-style: italic;
}

/* Stacked layout — badge sits above its description so the text is
   left-aligned and doesn't jump around the badge width. */
.cls-info-item {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.cls-info-badge { align-self: flex-start; }

/* Light theme: popover + badge readability */
[data-theme="light"] .cls-info-popover {
  background: #ffffff;
  border-color: rgba(45, 30, 100, 0.12);
  box-shadow: 0 10px 40px rgba(45, 30, 100, 0.14);
}
[data-theme="light"] .cls-info-popover-arrow {
  background: #ffffff;
  border-color: rgba(45, 30, 100, 0.12);
}
[data-theme="light"] .cls-info-item p { color: #4d4763; }
[data-theme="light"] .cls-info-foot { color: #776e8f; }
[data-theme="light"] .cls-info-badge.cls-unofficial {
  background: rgba(26, 122, 76, 0.08);
  color: #166844;
  border-color: rgba(26, 122, 76, 0.3);
}
[data-theme="light"] .cls-info-badge.cls-official {
  background: rgba(42, 100, 184, 0.08);
  color: #1f4f96;
  border-color: rgba(42, 100, 184, 0.3);
}
[data-theme="light"] .cls-info-badge.cls-official-sensitive {
  background: rgba(156, 104, 16, 0.1);
  color: #8a5c0d;
  border-color: rgba(156, 104, 16, 0.32);
}
[data-theme="light"] .cls-info-badge.cls-protected {
  background: rgba(176, 40, 40, 0.08);
  color: #992424;
  border-color: rgba(176, 40, 40, 0.3);
}

/* Mobile: full-width bottom sheet instead of popover */
@media (max-width: 768px) {
  .cls-info-popover {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .cls-info-popover-arrow { display: none; }
}

/* ── Phase 4.4: Drag-drop visual feedback ── */
.input-wrap.drag-over {
  border: 2px dashed var(--lavender, #9889C0) !important;
  border-radius: 12px;
  background: rgba(152, 137, 192, 0.06);
  transition: border 0.2s ease, background 0.2s ease;
}
.input-wrap.drag-over::after {
  content: 'Drop files to attach';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--lavender, #9889C0);
  pointer-events: none;
  z-index: 5;
}

/* ─── Messages ──────────────────────────────────────────── */
.messages {
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 100%;
  min-width: 0;
}

/* ─── Messages — Living Glass, Captions with Intent ─────── */
.msg {
  padding: 14px 20px;
  display: flex;
  gap: 14px;
  max-width: 900px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
}

/* "Load more" button for capped long conversations */
.msg-load-more {
  max-width: 900px;
  margin: 12px auto;
  text-align: center;
  padding: 14px;
  cursor: pointer;
  color: var(--accent, #b8aadb);
  font-size: 13px;
  font-weight: 600;
  border: 1px dashed var(--line, #2a2438);
  border-radius: var(--r-sm, 6px);
  transition: all .2s;
  background: transparent;
}
.msg-load-more:hover {
  border-color: var(--accent, #b8aadb);
  background: rgba(184, 170, 219, .05);
}

/* No entrance animation — messages are data, not theater */

/* ── User messages (solo) — right-aligned, compact, no avatar ── */
.msg.user {
  padding: 10px 20px;
  justify-content: flex-end;
}

.msg.user .msg-body {
  max-width: 75%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.msg.user .msg-content {
  color: var(--text-user);
  background: var(--presence-self);
  padding: 10px 16px;
  border-radius: var(--r-lg) var(--r-lg) var(--r-sm) var(--r-lg);
  font-size: 0.92rem;
  line-height: 1.6;
  display: inline-block;
  text-align: left;
}

.msg.user .msg-actions {
  justify-content: flex-end;
}

/* ── Athena messages — left-aligned, breathing avatar, full width ── */
.msg.assistant {
  background: transparent;
  padding: 16px 20px;
}

.msg.assistant .msg-content {
  color: var(--text-athena);
  font-size: 0.95rem;
  line-height: 1.75;
}

/* ── Shared conversation messages — left-aligned with sender identity ── */
.msg.shared {
  padding: 14px 20px;
}

.msg.shared.user .msg-body {
  max-width: 100%;
  align-items: flex-start;
}

.msg.shared.user .msg-content {
  background: var(--presence-shared-1);
  border-radius: var(--r-sm) var(--r-lg) var(--r-lg) var(--r-lg);
}

/* ── Avatar — Athena's presence, small and breathing ── */
.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.msg-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  object-fit: contain;
  animation: avatarBreathe var(--t-breathe) var(--ease-breathe) infinite;
}

@keyframes avatarBreathe {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(var(--athena-presence-rgb), 0.15)); }
  50% { filter: drop-shadow(0 0 8px rgba(var(--athena-presence-rgb), 0.25)); }
}

.msg-avatar-initials {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  font-family: var(--ff-heading);
  font-weight: 700;
  font-size: 0.65rem;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Header — minimal, timestamp only (Athena), name+time (shared) ── */
.msg-body {
  flex: 1;
  min-width: 0;
}

.msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  min-height: 18px;
}

.msg-name {
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.msg-time {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.msg-time.msg-model {
  color: var(--text-tertiary);
  opacity: 0.7;
}

/* ── Content — warm, present text ── */
.msg-content {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-primary);
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
  overflow-x: hidden;
}
.msg-content table {
  max-width: 100%;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.msg-content a {
  word-break: break-all;
}
.msg-content img {
  max-width: 100%;
  height: auto;
}
  overflow-wrap: break-word;
  word-spacing: 0.01em;
  min-width: 0;
  overflow: hidden;
  letter-spacing: 0.003em;
  font-weight: 400;
  font-variation-settings: "wght" 400, "opsz" 14;
  font-feature-settings: "ss01", "cv01", "cv11";
}

/* ═══════════════════════════════════════════════════════════
   Caption with Intention — per the design system V1.0
   ───────────────────────────────────────────────────────────
   Typeface: Inter Variable
   Volume → font SIZE (louder = bigger, quieter = smaller)
   Pitch  → font WEIGHT + WIDTH (lower = heavier+wider, higher = lighter+narrower)
   Baseline: Regular 400, normal width, normal size.
   Only genuinely emphatic words deviate from baseline.
   Word-level only — no paragraph-level tone classes.
   ═══════════════════════════════════════════════════════════ */

/* Only assistant messages get intonation — user messages stay uniform.
   Inter Variable carries intonation through weight; the Brand System v2.0 two-family rule applies. */
.msg.assistant .msg-content {
  font-family: var(--ff-intonation);
  font-weight: 400;
  font-variation-settings: "wght" 400, "wdth" 100, "opsz" 14, "GRAD" 0;
}

/* Default body text — Athena speaking normally (the vast majority) */
.msg.assistant .msg-content p {
  font-weight: 400;
  font-variation-settings: "wght" 400, "wdth" 100, "opsz" 14, "GRAD" 0;
  letter-spacing: 0.003em;
}

/* Synchronization: during streaming, the last paragraph is still
   being generated — keep it at baseline until the sentence completes. */
.msg.assistant .msg-content.streaming > p:last-child {
  font-variation-settings: "wght" 400, "wdth" 100, "opsz" 14, "GRAD" 0 !important;
  font-style: normal !important;
  font-size: 1rem !important;
  letter-spacing: 0.003em !important;
  color: var(--text-primary) !important;
}
.msg.assistant .msg-content.streaming > p:last-child span[class^="iw-"] {
  font-variation-settings: "wght" 400, "wdth" 100, "opsz" 14, "GRAD" 0 !important;
  font-style: normal !important;
  font-size: 1em !important;
  letter-spacing: 0.003em !important;
  color: var(--text-primary) !important;
}

/* ═══════════════════════════════════════════════════════════
   Word-level intonation — Volume → SIZE, Pitch → WEIGHT + WIDTH
   Each word deviates from baseline based on how it would be spoken.
   ═══════════════════════════════════════════════════════════ */

/* Shout — ALL CAPS words (3+ chars). Loudest + lowest pitch.
   Volume: max size. Pitch: heaviest weight + widest. */
.msg.assistant .msg-content .iw-shout {
  font-weight: 800;
  font-variation-settings: "wght" 800, "wdth" 125, "opsz" 20, "GRAD" 0;
  font-size: 1.2em;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Strong — words before !. Loud + firm.
   Volume: large. Pitch: heavy + wide. */
.msg.assistant .msg-content .iw-strong {
  font-weight: 700;
  font-variation-settings: "wght" 700, "wdth" 112, "opsz" 18, "GRAD" 0;
  font-size: 1.1em;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

/* Firm — emphasis words (never, always, absolutely). Confident, not louder.
   Pitch: heavier weight + slightly wider. Volume: unchanged. */
.msg.assistant .msg-content .iw-firm {
  font-weight: 600;
  font-variation-settings: "wght" 600, "wdth" 108, "opsz" 15, "GRAD" 0;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

/* Question — words before ?. High pitch, lighter.
   Pitch: lighter weight + narrower. Volume: slightly smaller. */
.msg.assistant .msg-content .iw-question {
  font-weight: 300;
  font-variation-settings: "wght" 300, "wdth" 92, "opsz" 13, "GRAD" 0;
  font-style: italic;
  font-size: 0.96em;
  letter-spacing: 0.02em;
  color: rgba(var(--athens-rgb), 0.82);
}

/* Whisper — words before ... . Quietest, trailing off.
   Volume: smallest. Pitch: lightest + narrowest. */
.msg.assistant .msg-content .iw-whisper {
  font-weight: 300;
  font-variation-settings: "wght" 250, "wdth" 88, "opsz" 11, "GRAD" 0;
  font-style: italic;
  font-size: 0.85em;
  letter-spacing: 0.025em;
  color: rgba(var(--athens-rgb), 0.55);
}

/* Aside — parentheticals. Quiet, italic, smaller.
   Volume: small. Pitch: light + narrow. */
.msg.assistant .msg-content .iw-aside {
  font-weight: 300;
  font-variation-settings: "wght" 250, "wdth" 90, "opsz" 11, "GRAD" 0;
  font-style: italic;
  font-size: 0.85em;
  letter-spacing: 0.025em;
  color: rgba(var(--athens-rgb), 0.55);
}

/* Transition — "However", "Moreover". Light, airy, a breath.
   Pitch: lighter + narrower. Volume: slightly smaller. */
.msg.assistant .msg-content .iw-transition {
  font-weight: 300;
  font-variation-settings: "wght" 300, "wdth" 95, "opsz" 13, "GRAD" 0;
  font-size: 0.96em;
  letter-spacing: 0.025em;
  color: rgba(var(--athens-rgb), 0.72);
}

/* Streaming state — typing cursor at the end of streaming text */
.msg-content.streaming::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--lavender);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: stream-cursor 0.9s steps(2) infinite;
  border-radius: 1px;
}

@keyframes stream-cursor {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Smooth fade-in for streaming content updates */
.msg-content.streaming > * {
  animation: stream-fade-in 0.15s ease-out;
}

@keyframes stream-fade-in {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* Markdown rendering */
.msg-content h1, .msg-content h2, .msg-content h3, .msg-content h4 {
  font-family: var(--ff-heading);
  color: var(--white);
  margin: 24px 0 10px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.msg-content h1 { font-size: 1.35rem; font-weight: 800; }
.msg-content h2 { font-size: 1.15rem; font-weight: 700; border-bottom: 1px solid rgba(var(--lavender-rgb), 0.08); padding-bottom: 8px; }
.msg-content h3 { font-size: 1rem; font-weight: 700; color: var(--lavender); }
.msg-content h4 { font-size: 0.9rem; font-weight: 600; color: rgba(var(--athens-rgb), 0.8); text-transform: uppercase; letter-spacing: 0.04em; }

.msg-content > *:first-child { margin-top: 0; }

.msg-content p { margin: 12px 0; }

.msg-content strong { color: var(--white); font-weight: 600; }
.msg-content em { color: rgba(var(--athens-rgb), 0.9); font-style: italic; }

.msg-content a {
  color: var(--lavender);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.3);
  transition: all 0.15s;
}

.msg-content a:hover { border-color: var(--lavender); color: var(--white); }

.msg-content ul, .msg-content ol {
  padding-left: 22px;
  margin: 14px 0;
}

.msg-content ul { list-style-type: disc; }
.msg-content ol { list-style-type: decimal; }

.msg-content li {
  margin: 7px 0;
  padding-left: 4px;
  line-height: 1.7;
}

.msg-content li::marker {
  color: var(--lavender);
}

.msg-content blockquote {
  border-left: 3px solid var(--lavender);
  padding: 12px 18px;
  margin: 16px 0;
  background: linear-gradient(135deg, rgba(var(--jacarta-rgb), 0.15), rgba(var(--lavender-rgb), 0.04));
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: rgba(var(--athens-rgb), 0.75);
  font-style: italic;
  position: relative;
}

.msg-content hr {
  border: none;
  height: 1px;
  background: rgba(var(--lavender-rgb), 0.1);
  margin: 16px 0;
}

.msg-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0;
  font-size: 0.84rem;
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
  border-radius: var(--r-md);
  overflow: hidden;
}

.msg-content th, .msg-content td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06);
  text-align: left;
}

.msg-content th {
  background: rgba(var(--jacarta-rgb), 0.3);
  font-family: var(--ff-heading);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--lavender);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.12);
}

.msg-content tr:last-child td { border-bottom: none; }

.msg-content tr:hover td {
  background: rgba(var(--lavender-rgb), 0.03);
}

/* Inline code */
.msg-content code:not(pre code) {
  font-family: var(--ff-mono);
  font-size: 0.82em;
  padding: 3px 7px;
  background: rgba(var(--jacarta-rgb), 0.35);
  border: none;
  border-radius: var(--r-sm);
  color: #c4b5fd;
  white-space: nowrap;
}

/* ─── Code Blocks (fixed container) ─────────────────────── */
.code-block {
  position: relative;
  margin: 16px 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #09080f;
  border: none;
  box-shadow: var(--shadow-sm);
  display: block;             /* simple block — no flex stretching that buries the footer */
}

[data-theme="light"] .code-block {
  background: #f7f6fb;
  border: 1px solid rgba(45, 39, 105, 0.1);
  box-shadow: 0 1px 3px rgba(45, 30, 100, 0.05);
}
[data-theme="light"] .code-block-header { background: rgba(45, 39, 105, 0.04); border-bottom-color: rgba(45, 39, 105, 0.06); }
[data-theme="light"] .streaming-code-pre { background: #f7f6fb; }
[data-theme="light"] .streaming-code-pre code { color: #2a2536; }
[data-theme="light"] .code-block pre { color: #2a2536; }
[data-theme="light"] .code-block-lang { color: rgba(45, 39, 105, 0.6); }
[data-theme="light"] .code-block-lines { color: rgba(45, 39, 105, 0.45); }
[data-theme="light"] .code-block-footer { background: rgba(45, 39, 105, 0.03); border-top-color: rgba(45, 39, 105, 0.08); }
[data-theme="light"] .code-action-btn { color: rgba(45, 39, 105, 0.75); border-color: rgba(45, 39, 105, 0.18); background: rgba(45, 39, 105, 0.04); }
[data-theme="light"] .code-action-btn:hover { color: #2D2769; border-color: rgba(45, 39, 105, 0.32); background: rgba(45, 39, 105, 0.08); }

/* Header bar */
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(var(--lavender-rgb), 0.04);
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06);
  height: 42px;
  flex-shrink: 0;
}

.code-block-lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(var(--lavender-rgb), 0.5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.code-block-lang::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lavender);
  opacity: 0.4;
}

.code-block-lines {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  color: rgba(var(--lavender-rgb), 0.25);
}

/* Scrollable code area — fixed height, wrapping lines */
.code-block pre {
  display: block;
  margin: 0;
  padding: 20px 22px;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: var(--ff-mono);
  font-size: 0.79rem;
  line-height: 1.72;
  color: #abb2bf;
  tab-size: 2;
  max-height: 380px;
  min-height: 40px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}

.code-block pre code {
  font-family: inherit;
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: inherit;
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Footer action toolbar */
.code-block-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(var(--lavender-rgb), 0.025);
  border-top: 1px solid rgba(var(--lavender-rgb), 0.07);
  gap: 6px;
  min-height: 46px;
  position: relative;
  z-index: 10;
}

/* Streaming code block — fixed height with scrollbar during generation */
.streaming-code-block .streaming-code-pre {
  display: block;
  margin: 0;
  padding: 20px 22px;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: var(--ff-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  background: transparent;
  color: var(--athens);
}

.streaming-code-block .streaming-code-pre code {
  font-family: inherit;
  background: transparent;
  padding: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Streaming code block scrollbar */
.streaming-code-block .streaming-code-pre::-webkit-scrollbar { width: 6px; height: 6px; }
.streaming-code-block .streaming-code-pre::-webkit-scrollbar-track { background: transparent; }
.streaming-code-block .streaming-code-pre::-webkit-scrollbar-thumb { background: rgba(var(--lavender-rgb), 0.12); border-radius: var(--r-xs); }
.streaming-code-block .streaming-code-pre::-webkit-scrollbar-thumb:hover { background: rgba(var(--lavender-rgb), 0.2); }

.code-block-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.code-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px 6px 10px;
  background: rgba(var(--lavender-rgb), 0.04);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-sm);
  color: rgba(var(--athens-rgb), 0.8);
  font-family: var(--ff-heading);
  font-size: 0.71rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  letter-spacing: 0.01em;
  line-height: 1;
  user-select: none;
}

.code-action-btn svg {
  display: block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.code-action-btn:hover {
  background: rgba(var(--lavender-rgb), 0.12);
  color: var(--lavender);
  border-color: rgba(var(--lavender-rgb), 0.3);
}

.code-action-btn:active { opacity: 0.7; }

.code-action-btn.copied {
  color: var(--ok) !important;
  border-color: rgba(var(--ok-rgb), 0.35) !important;
  background: rgba(var(--ok-rgb), 0.08) !important;
}

/* Expand toggle */
.code-block.expanded pre { max-height: none; }

.code-block-expand {
  display: none;
  position: absolute;
  bottom: 40px;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(to bottom, transparent, #09080f);
  pointer-events: none;
}

.code-block.truncated .code-block-expand { display: block; }

/* Syntax highlighting — One Dark Pro palette */
.code-block .tok-kw   { color: #c678dd; font-weight: 500; }
.code-block .tok-str  { color: #98c379; }
.code-block .tok-num  { color: #d19a66; }
.code-block .tok-cm   { color: #5c6370; font-style: italic; }
.code-block .tok-fn   { color: #61afef; }
.code-block .tok-tag  { color: #e06c75; }
.code-block .tok-attr { color: #d19a66; }
.code-block .tok-val  { color: #98c379; }
.code-block .tok-op   { color: #56b6c2; }
.code-block .tok-type { color: #e5c07b; }
.code-block .tok-prop { color: #56b6c2; }
.code-block .tok-sel  { color: #e06c75; }
.code-block .tok-punc { color: #abb2bf; }

/* Scrollbar inside code blocks */
.code-block pre::-webkit-scrollbar { width: 6px; height: 6px; }
.code-block pre::-webkit-scrollbar-track { background: transparent; }
.code-block pre::-webkit-scrollbar-thumb { background: rgba(var(--lavender-rgb), 0.12); border-radius: var(--r-xs); }
.code-block pre::-webkit-scrollbar-thumb:hover { background: rgba(var(--lavender-rgb), 0.2); }

/* Memory usage chip — "Used N memories" indicator */
.msg-memory-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 5px 11px;
  border-radius: 20px;
  background: rgba(var(--lavender-rgb), 0.08);
  border: 1px solid rgba(var(--lavender-rgb), 0.2);
  color: var(--lavender);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.msg-memory-chip:hover {
  background: rgba(var(--lavender-rgb), 0.14);
  border-color: rgba(var(--lavender-rgb), 0.35);
}
.msg-memory-chip-text { white-space: nowrap; }
.msg-memory-chip-chevron { opacity: 0.6; transition: transform 0.2s; }
.msg-memory-chip.expanded .msg-memory-chip-chevron { transform: rotate(180deg); }
.msg-memory-chip-popover {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 280px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--s2);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 100;
  font-size: 0.78rem;
  color: var(--text);
}
.msg-memory-chip.expanded .msg-memory-chip-popover { display: block; }
.msg-memory-chip-popover-title {
  font-family: var(--ff-heading);
  font-weight: 600;
  font-size: 0.76rem;
  color: var(--white);
  margin-bottom: 8px;
}
.msg-memory-chip-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(var(--border-rgb), 0.4);
}
.msg-memory-chip-item:last-of-type { border-bottom: none; }
.msg-memory-chip-item-type {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--lavender);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.msg-memory-chip-item-label {
  color: var(--text);
  font-size: 0.76rem;
}
.msg-memory-chip-popover-footer {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.4;
}
@media (max-width: 600px) {
  .msg-memory-chip-popover { min-width: 240px; max-width: calc(100vw - 48px); }
}

/* Message actions — ghost toolbar: icon-only, quiet at rest, full on intent.
   Rest colour keeps >=3:1 against the ground (non-text contrast). */
.msg-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.15s var(--ease-smooth);
}
.msg:hover .msg-actions,
.msg:focus-within .msg-actions,
.msg.latest .msg-actions,
.msg-actions:has(.msg-more.open),
.msg-actions:has(.fb-popover) { opacity: 1; }

.msg-action-btn {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  color: rgba(var(--lavender-rgb), 0.78);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
[data-theme="light"] .msg-action-btn { color: rgba(var(--jacarta-rgb), 0.62); }
.msg-action-btn:hover { background: rgba(var(--lavender-rgb), 0.12); color: var(--text); }
.msg-action-btn:active { background: rgba(var(--lavender-rgb), 0.2); }
.msg-action-btn:focus-visible { outline: 2px solid var(--lavender); outline-offset: 3px; }
.msg-action-btn svg { width: 16px; height: 16px; transition: transform 0.25s; }
.msg-action-btn[data-action="regenerate"]:active svg { transform: rotate(180deg); }
.msg-actions .msg-action-btn { padding: 0; min-height: 0; }

/* Tooltip — mono label, appears on hover/focus after a short delay */
.msg-action-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  background: #14102E;
  color: #F8F7FB;
  border: 1px solid rgba(var(--lavender-rgb), 0.25);
  font: 500 10px/1 var(--ff-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s 0.35s, transform 0.12s 0.35s;
  z-index: 20;
}
.msg-action-btn[data-tip]:hover::after,
.msg-action-btn[data-tip]:focus-visible::after { opacity: 1; transform: translateX(-50%); }
@media (hover: none) { .msg-action-btn[data-tip]::after { display: none; } }

/* Touch: bigger targets, always present */
@media (pointer: coarse) {
  .msg-actions { opacity: 1; }
  .msg-actions .msg-action-btn { width: 40px; height: 40px; }
}

/* Overflow menu */
.msg-more { position: relative; display: inline-flex; }
.msg-more-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 150px;
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: var(--r-md);
  background: rgba(20, 16, 38, 0.96);
  backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  z-index: 30;
}
.msg-more.open .msg-more-menu { display: flex; }
.msg-actions .msg-more-menu .msg-action-btn {
  width: auto;
  height: auto;
  min-height: 0;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 12px;
  color: rgba(248, 247, 251, 0.85);
  font: 500 0.78rem var(--ff-heading);
}
.msg-actions .msg-more-menu .msg-action-btn:hover { color: #F8F7FB; background: rgba(var(--lavender-rgb), 0.14); }
.msg-more-menu .msg-action-btn::after { display: none; }
.msg-menu-label { font-weight: 500; display: inline !important; }

/* 👎 reason picker */
.fb-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: min(320px, calc(100vw - 48px));
  padding: 12px;
  border-radius: var(--r-md);
  background: rgba(20, 16, 38, 0.96);
  backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  color: #F8F7FB;
}
.fb-title { font: 500 10px var(--ff-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--lavender); margin-bottom: 8px; }
.fb-reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.fb-reason {
  padding: 6px 10px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.3);
  background: transparent;
  color: #F8F7FB;
  font: 500 0.75rem var(--ff-heading);
  cursor: pointer;
}
.fb-reason:hover { background: rgba(var(--lavender-rgb), 0.16); }
.fb-note { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.fb-note textarea {
  resize: vertical;
  min-height: 64px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.3);
  background: rgba(255, 255, 255, 0.04);
  color: #F8F7FB;
  font: 0.8rem var(--ff-body);
}
.fb-send {
  align-self: flex-end;
  padding: 7px 16px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--gold);
  color: #14102E;
  font: 700 0.78rem var(--ff-heading);
  cursor: pointer;
}
.fb-reason:focus-visible, .fb-send:focus-visible, .fb-note textarea:focus-visible { outline: 2px solid var(--lavender); outline-offset: 3px; }

/* Copy popover */
.copy-popover {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: var(--r-md);
  background: rgba(20, 16, 38, 0.96);
  backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  transition: opacity 0.2s var(--ease-spring), transform 0.2s var(--ease-spring);
  pointer-events: none;
}

.copy-popover.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.copy-popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  color: rgba(var(--athens-rgb), 0.75);
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: left;
  white-space: nowrap;
}

.copy-popover-item:hover {
  background: rgba(var(--lavender-rgb), 0.08);
  color: var(--white);
}

.copy-popover-item svg {
  flex-shrink: 0;
  color: rgba(var(--lavender-rgb), 0.6);
}

.copy-popover-item:hover svg {
  color: var(--lavender);
}

/* Thinking indicator — now rendered inline inside the assistant message card */
.typing-indicator { display: none !important; }

/* Auto-continuation banner */
.continuing-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin: 8px 0;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(var(--lavender-rgb), 0.08), rgba(var(--jacarta-rgb), 0.12));
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  color: var(--lavender);
  font-family: var(--ff-heading);
  font-size: 0.75rem;
  font-weight: 500;
  animation: pulse-soft 2s ease-in-out infinite;
}

.continuing-banner svg {
  animation: spin 1.5s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.msg-loader {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 10px;
}

.msg-loader-status {
  font-family: var(--ff-heading);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--athena-presence-soft);
  opacity: 0.85;
}

.msg-loader-status.pulse {
  animation: statusFade 0.5s var(--ease-spring) both;
}

.msg-loader-bar {
  width: 120px;
  height: 3px;
  border-radius: 2px;
  background: rgba(var(--athena-presence-rgb), 0.08);
  overflow: hidden;
}

.msg-loader-bar-fill {
  width: 40%;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--athena-presence), var(--athena-presence-soft));
  animation: barSlide 1.8s var(--ease-smooth) infinite;
}

/* ── Athena's avatar — stronger presence glow when thinking ── */
.msg.assistant.loading .msg-avatar-img {
  animation: avatarThinking 1.2s var(--ease-breathe) infinite;
}
@keyframes avatarThinking {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(var(--athena-presence-rgb), 0.2)); }
  50% { filter: drop-shadow(0 0 12px rgba(var(--athena-presence-rgb), 0.45)); }
}

/* ── Athena's avatar — streaming presence (active but calm) ── */
.msg.assistant .msg-avatar-img.is-streaming {
  animation: avatarStreaming 2s var(--ease-breathe) infinite;
}
@keyframes avatarStreaming {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(var(--athena-presence-rgb), 0.15)); }
  50% { filter: drop-shadow(0 0 8px rgba(var(--athena-presence-rgb), 0.3)); }
}

.msg-content.hidden { display: none; }

@keyframes statusFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes barSlide {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(200%); }
  100% { transform: translateX(-100%); }
}

/* ─── Think / Reasoning Block ───────────────────────────── */
.think-block {
  margin: 0 0 14px;
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-lg);
  background: rgba(var(--lavender-rgb), 0.035);
  overflow: hidden;
}

.think-block-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  cursor: pointer;
  font-family: var(--ff-heading);
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(var(--lavender-rgb), 0.6);
  user-select: none;
  transition: color 0.15s;
}

.think-block-header svg { flex-shrink: 0; }

.think-block-header:hover { color: var(--lavender); }

.think-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.think-toggle {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(var(--lavender-rgb), 0.85);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  background: rgba(var(--lavender-rgb), 0.08);
  transition: background 0.15s;
}

.think-toggle:hover {
  background: rgba(var(--lavender-rgb), 0.16);
}

.think-block-body {
  padding: 12px 16px 0;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.08);
  font-size: 0.82rem;
  line-height: 1.65;
  color: rgba(var(--athens-rgb), 0.55);
  max-height: 4.2em; /* fixed height when collapsed */
  overflow: hidden;
  position: relative;
  transition: max-height 0.25s ease, padding 0.25s ease;
}

.think-block.expanded .think-block-body {
  max-height: none;
  overflow: visible;
  padding-bottom: 14px;
}

/* Fade at bottom when collapsed */
.think-block.collapsed .think-block-body::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.2em;
  background: linear-gradient(transparent, rgba(var(--lavender-rgb), 0.035));
  pointer-events: none;
}

.think-block.expanded .think-block-body::after { display: none; }

.think-block-body p {
  margin: 0 0 8px;
}

.think-block-body p:last-child { margin-bottom: 0; }

/* Streaming think block — subtle pulse on the header */
.think-block.streaming .think-block-header {
  animation: thinkPulse 1.6s ease-in-out infinite;
}

@keyframes thinkPulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1;   }
}

/* ─── Task / Checklist Lists ─────────────────────────────── */
ul.task-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

li.task-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: rgba(var(--athens-rgb), 0.75);
}

li.task-item svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: rgba(var(--lavender-rgb), 0.45);
}

li.task-item.done svg {
  color: var(--lavender);
}

li.task-item.done span {
  color: rgba(var(--athens-rgb), 0.38);
  text-decoration: line-through;
  text-decoration-color: rgba(var(--lavender-rgb), 0.3);
}

/* ─── Code block filename ────────────────────────────────── */
.code-block-filename {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(var(--athens-rgb), 0.75);
  letter-spacing: 0.01em;
}

.code-block-filename svg {
  color: rgba(var(--lavender-rgb), 0.5);
  flex-shrink: 0;
}

/* ─── Canvas / Side Panel ───────────────────────────────── */
.canvas-panel {
  width: 0;
  overflow: hidden;
  background: var(--s1);
  border-left: 1px solid rgba(var(--lavender-rgb), 0.06);
  display: flex;
  flex-direction: column;
  transition: width 0.4s var(--ease-spring);
}

.canvas-panel.open { width: 60%; min-width: 480px; }

.canvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06);
  flex-shrink: 0;
}

.canvas-header-tabs { display: flex; gap: 2px; }

.canvas-tab {
  padding: 6px 14px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: rgba(var(--athens-rgb), 0.4);
  font-family: var(--ff-heading);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.canvas-tab:hover { color: var(--athens); }
.canvas-tab.active { background: rgba(var(--lavender-rgb), 0.12); color: var(--lavender); }

.canvas-version-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--r-xl);
  background: rgba(var(--lavender-rgb), 0.12);
  color: var(--lavender);
  align-self: center;
  margin-left: 4px;
}

.canvas-header-actions { display: flex; gap: 6px; }

.canvas-action-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
  background: rgba(var(--lavender-rgb), 0.025);
  color: rgba(var(--athens-rgb), 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.22s var(--ease-smooth);
}

.canvas-action-btn:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--white);
  border-color: rgba(var(--lavender-rgb), 0.2);
  transform: translateY(-1px);
}

.canvas-action-btn:active {
  transform: translateY(0);
}

.canvas-body { flex: 1; overflow: hidden; }

.canvas-tab-content { display: none; height: 100%; }
.canvas-tab-content.active { display: block; }

.canvas-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.canvas-code {
  margin: 0;
  padding: 16px;
  overflow: auto;
  height: 100%;
  font-family: var(--ff-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  /* Fixed light text on a permanently-dark code surface — this background
     intentionally does NOT theme (code viewers stay dark in both modes),
     so the text color must stay static too instead of following
     --athens-rgb (which flips to near-black in light mode and would make
     this text invisible against the dark background). */
  color: #abb2bf;
  background: #0d0b16;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ─── Generated Image Card ──────────────────────────────── */
.generated-image-wrap {
  display: inline-flex;
  flex-direction: column;
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin: 8px 0;
  max-width: 100%;
  background: var(--s1);
}

.generated-image {
  display: block;
  max-width: 100%;
  max-height: 640px;
  object-fit: contain;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.generated-image-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 12px;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.08);
}

.generated-image-dl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.45);
  text-decoration: none;
  transition: color 0.15s;
}

.generated-image-dl:hover { color: var(--lavender); }

/* ─── Queue Banner ───────────────────────────────────────── */
.queue-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 20px 8px;
  padding: 9px 14px;
  background: rgba(var(--lavender-rgb), 0.07);
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  border-radius: var(--r-lg);
  animation: msgIn 0.2s var(--ease-spring) both;
}

.queue-banner.hidden { display: none; }

.queue-banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ff-heading);
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(var(--lavender-rgb), 0.8);
  min-width: 0;
  overflow: hidden;
}

.queue-banner-left span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-cancel-btn {
  flex-shrink: 0;
  padding: 4px 11px;
  background: transparent;
  border: 1px solid rgba(var(--lavender-rgb), 0.2);
  border-radius: var(--r-sm);
  color: rgba(var(--athens-rgb), 0.5);
  font-family: var(--ff-heading);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.queue-cancel-btn:hover {
  background: rgba(var(--error-rgb, 239,68,68), 0.1);
  color: #E5484D;
  border-color: rgba(239,68,68, 0.3);
}

/* ─── Input Area ────────────────────────────────────────── */
.input-area {
  padding: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
  background: var(--s0);
  border-top: 1px solid rgba(var(--lavender-rgb), 0.08);
}

.input-wrap {
  max-width: 100%;
  margin: 0;
  background: var(--s0);
  backdrop-filter: none;
  border: none;
  border-radius: 0;
  overflow: visible;
  transition: background 0.2s var(--ease-smooth), box-shadow 0.2s var(--ease-smooth);
  box-shadow: none;
}

.input-wrap:focus-within {
  box-shadow: none;
}
.input-row textarea:focus, #chatInput:focus { outline: none; }

/* ── Drag & Drop — the prompt surface responds materially ── */
.input-wrap.drag-over {
  background: var(--presence-self);
  box-shadow: inset 0 0 0 2px rgba(var(--gold-rgb), 0.4), inset 0 0 60px rgba(var(--gold-rgb), 0.08);
}
.input-wrap.drag-over #chatInput::placeholder {
  color: rgba(var(--gold-rgb), 0.6);
}
.input-wrap.drag-over::before {
  content: 'Drop to attach';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--ff-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: rgba(var(--gold-rgb), 0.8);
  pointer-events: none;
  z-index: 10;
  letter-spacing: -0.01em;
}

/* ── Image attachment strip (input area) ─────────────────── */
.input-attachments {
  display: none;
}

.input-attachments.has-attachments {
  display: flex;
  gap: 8px;
  padding: 10px 14px 4px;
  flex-wrap: wrap;
}

.attachment-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  flex-shrink: 0;
  background: rgba(var(--lavender-rgb), 0.04);
}

.attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attachment-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.75);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.attachment-thumb:hover .attachment-remove { opacity: 1; }

.attachment-ocr-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 0.58rem;
  font-family: var(--ff-heading);
  text-align: center;
  padding: 2px 4px;
  background: rgba(var(--jacanta-rgb, var(--lavender-rgb)), 0.85);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-ocr-badge.done {
  background: rgba(34, 197, 94, 0.85);
}

/* ── Document attachments (input area) ─────────────────────── */
.attachment-doc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--s2-rgb), 0.4);
  min-width: 200px;
  max-width: 320px;
  position: relative;
}

.attachment-doc-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--lavender);
}

.attachment-doc-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.attachment-doc-name {
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--athens);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-doc-meta {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  color: rgba(var(--athens-rgb), 0.4);
}

.attachment-doc .attachment-remove {
  position: static;
  opacity: 0.5;
  flex-shrink: 0;
}

/* ── Document chips inside messages ────────────────────────── */
.msg-docs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.msg-doc-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--s2-rgb), 0.3);
  color: rgba(var(--athens-rgb), 0.7);
  font-family: var(--ff-heading);
  font-size: 0.72rem;
}

.msg-doc-chip svg { color: var(--lavender); opacity: 0.6; flex-shrink: 0; }

.msg-doc-name { font-weight: 500; }

.msg-doc-ext {
  font-family: var(--ff-mono);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--lavender);
  padding: 1px 5px;
  border-radius: var(--r-xs);
  background: rgba(var(--lavender-rgb), 0.1);
}

/* ── Loading state for doc attachments ─────────────────────── */
.attachment-doc.loading .attachment-doc-icon {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ── Images inside messages ──────────────────────────────── */
.msg-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.msg-image-thumb {
  max-width: 280px;
  max-height: 200px;
  border-radius: var(--r-md);
  object-fit: cover;
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  cursor: zoom-in;
  transition: opacity 0.15s;
}

.msg-image-thumb:hover { opacity: 0.9; }

/* ── Inline Artifact Cards (images & maps in chat) ─────────── */
.msg-artifacts {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.artifact-card {
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--glass-1);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  transition: box-shadow 0.3s var(--ease-smooth), border-color 0.3s var(--ease-smooth);
  box-shadow: var(--shadow-sm);
  max-width: 480px;
  animation: artifactDevelop 0.6s var(--ease-develop) both;
}

@keyframes artifactDevelop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Image cards — materialize in place */
.artifact-card.artifact-image {
  max-width: 100%;
  width: 100%;
}
.artifact-card.artifact-image .artifact-card-preview img {
  animation: imageMaterialize 0.8s var(--ease-develop) both;
}
@keyframes imageMaterialize {
  from { opacity: 0; filter: blur(8px); transform: scale(1.02); }
  to { opacity: 1; filter: blur(0); transform: scale(1); }
}

/* Map cards — grow in place */
.artifact-card.artifact-map .artifact-card-map-canvas {
  animation: mapGrow 0.5s var(--ease-develop) both;
}
@keyframes mapGrow {
  from { opacity: 0; transform: scaleY(0.6); transform-origin: top; }
  to { opacity: 1; transform: scaleY(1); }
}

/* Messages with any artifact card get wider */
.msg:has(.artifact-card.artifact-image) .msg-content,
.msg:has(.artifact-card.artifact-map) .msg-content {
  width: 100%;
  max-width: 100%;
}
.msg:has(.artifact-card.artifact-image),
.msg:has(.artifact-card.artifact-map) {
  max-width: 1100px;
}
.artifact-card:hover {
  border-color: rgba(var(--lavender-rgb), 0.22);
  box-shadow: 0 4px 20px rgba(var(--s0-rgb), 0.3);
}

.artifact-card-preview {
  position: relative;
  cursor: pointer;
  background: rgba(var(--lavender-rgb), 0.06);
  overflow: hidden;
}
.artifact-card-preview img {
  width: 100%;
  display: block;
  max-height: 480px;
  object-fit: cover;
  transition: transform 0.3s var(--ease-spring);
}
.artifact-card-preview:hover img { transform: scale(1.02); }

/* ── Image-search results grid ────────────────────────────── */
.artifact-image-grid { width: 100%; max-width: 100%; }
.ig-grid-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--glass-edge);
  background: rgba(var(--jacarta-rgb), 0.22);
}
.ig-grid-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--lavender-rgb), 0.12);
  color: var(--lavender-2, #b8aadb);
  flex-shrink: 0;
}
.ig-grid-meta { flex: 1; min-width: 0; }
.ig-grid-title { font-weight: 700; font-size: 0.86rem; color: var(--text); letter-spacing: -0.01em; }
.ig-grid-sub { font-size: 0.68rem; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  padding: 10px;
}
.ig-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 0;
  padding: 0;
  border-radius: var(--r-sm);
  overflow: hidden;
  cursor: pointer;
  background: rgba(var(--lavender-rgb), 0.06);
  display: block;
}
.ig-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s var(--ease-spring); }
.ig-tile:hover img { transform: scale(1.07); }
.ig-tile:focus-visible { outline: 2px solid var(--lavender); outline-offset: -2px; }
.ig-tile-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px 8px 5px;
  background: linear-gradient(0deg, rgba(5,3,20,0.78), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
}
.ig-tile:hover .ig-tile-overlay, .ig-tile:focus-visible .ig-tile-overlay { opacity: 1; }
.ig-tile-source {
  font-size: 0.62rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Image lightbox ───────────────────────────────────────── */
.ig-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
}
.ig-lightbox.open { display: flex; }
.ig-lb-backdrop { position: absolute; inset: 0; background: rgba(5,3,20,0.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.ig-lb-img {
  position: relative;
  z-index: 1;
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--r-lg);
  box-shadow: 0 30px 90px rgba(0,0,0,0.65);
  animation: igLbIn 0.28s var(--ease-spring);
}
@keyframes igLbIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.ig-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s var(--ease-spring);
}
.ig-lb-nav:hover { background: rgba(255,255,255,0.18); }
.ig-lb-nav:active { transform: translateY(-50%) scale(0.94); }
.ig-lb-prev { left: calc(12px + env(safe-area-inset-left)); }
.ig-lb-next { right: calc(12px + env(safe-area-inset-right)); }
.ig-lb-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}
.ig-lb-close:hover { background: rgba(255,255,255,0.18); }
.ig-lb-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  padding: 18px 22px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(5,3,20,0.88), transparent);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ig-lb-title { color: #fff; font-weight: 600; font-size: 0.85rem; flex: 1; min-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-lb-source { color: var(--lavender-2, #b8aadb); font-size: 0.75rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.ig-lb-source:hover { text-decoration: underline; }
.ig-lb-count { color: rgba(255,255,255,0.55); font-size: 0.72rem; font-variant-numeric: tabular-nums; }

/* Mobile: 2-up square grid, lighter chrome */
@media (max-width: 640px) {
  .ig-grid { grid-template-columns: repeat(2, 1fr); gap: 4px; padding: 8px; }
  .ig-tile { aspect-ratio: 1 / 1; }
  .ig-tile-overlay { opacity: 1; padding: 12px 6px 4px; }
  .ig-lb-img { max-width: 96vw; max-height: 78vh; border-radius: var(--r-md); }
  .ig-lb-nav { width: 42px; height: 42px; }
}

.artifact-card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--s0-rgb), 0.6);
  opacity: 0;
  transition: opacity 0.2s var(--ease-spring);
}
.artifact-card-preview:hover .artifact-card-overlay { opacity: 1; }
.artifact-card-open-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}

.artifact-map-preview {
  min-height: 140px;
  display: flex; align-items: center; justify-content: center;
}
.artifact-map-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text-secondary); font-size: 13px; font-weight: 600;
}

/* ── Inline map card — embedded interactive canvas ── */
.artifact-card.artifact-map {
  padding: 0;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}
.artifact-card-map-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: rgba(var(--lavender-rgb), 0.04);
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.08);
}

/* ── Map generation progress card ── */
.map-gen-progress {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 16px;
  min-height: 72px;
}

/* ── Agent-style map generation card ── */
.agent-map-card .agent-phases {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.agent-phase {
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0.4;
  transition: opacity 0.3s;
}
.agent-phase-active { opacity: 1; }
.agent-phase-done { opacity: 0.7; }
.agent-phase-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
}
.agent-phase-done .agent-phase-icon {
  color: var(--ok, #8cffc1);
  background: rgba(140, 255, 193, 0.1);
}
.agent-phase-active .agent-phase-icon {
  color: var(--gold, #C5A572);
  background: rgba(197, 165, 114, 0.15);
  animation: agent-pulse 1.5s ease-in-out infinite;
}
@keyframes agent-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(197, 165, 114, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(197, 165, 114, 0); }
}
.agent-phase-pending .agent-phase-icon {
  color: var(--text-muted, rgba(255,255,255,0.3));
  background: transparent;
  border: 1px solid var(--glass-edge, rgba(255,255,255,0.1));
}
.agent-phase-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary, #f8f5ff);
  display: flex;
  align-items: center;
  gap: 8px;
}
.agent-phase-detail {
  font-size: 0.78rem;
  color: var(--text-muted, rgba(255,255,255,0.5));
  line-height: 1.5;
  max-height: 60px;
  overflow: hidden;
  font-style: italic;
  margin-left: 30px;
  border-left: 2px solid rgba(var(--lavender-rgb), 0.2);
  padding-left: 10px;
}
.agent-phase-steps {
  font-size: 0.78rem;
  color: var(--text-muted, rgba(255,255,255,0.5));
  line-height: 1.4;
  margin-left: 30px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.agent-phase-bar {
  margin-left: 30px;
  height: 4px;
  background: rgba(var(--lavender-rgb), 0.1);
  border-radius: 2px;
  overflow: hidden;
}
.agent-phase-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold, #C5A572), var(--lavender, #9889C0));
  border-radius: 2px;
  transition: width 0.3s ease;
}
[data-theme="light"] .agent-phase-done .agent-phase-icon { color: #166844; background: rgba(26, 122, 76, 0.08); }
[data-theme="light"] .agent-phase-active .agent-phase-icon { color: #8a5c0d; background: rgba(197, 165, 114, 0.12); }
[data-theme="light"] .agent-phase-label { color: #1a1814; }
[data-theme="light"] .agent-phase-detail { color: #4d4763; border-left-color: rgba(45, 30, 100, 0.15); }
[data-theme="light"] .agent-phase-steps { color: #4d4763; }
[data-theme="light"] .agent-phase-bar { background: rgba(45, 30, 100, 0.08); }
.map-gen-spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(var(--lavender-rgb), 0.1);
  border-top-color: rgba(var(--lavender-rgb), 0.6);
  border-radius: 50%;
  animation: map-gen-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes map-gen-spin { to { transform: rotate(360deg); } }
.map-gen-text { display: flex; flex-direction: column; gap: 0; flex: 1; min-width: 0; }
.map-gen-phase {
  font-size: 13px; font-weight: 500; color: var(--text);
  opacity: 0.85;
  transition: opacity 0.4s;
}
.map-gen-detail {
  display: none;
}
/* Animated dots after the phase text */
.map-gen-phase::after {
  content: '';
  display: inline-block;
  width: 1.5em;
  text-align: left;
  animation: map-gen-dots 1.4s steps(4, end) infinite;
}
@keyframes map-gen-dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}
.artifact-card-error-body {
  padding: 16px;
  color: var(--danger, #e74c3c);
  font-size: 13px;
}
.artifact-card-map-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.artifact-card-map-title svg { flex-shrink: 0; color: var(--lavender); }
.artifact-card-map-meta {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.artifact-card-map-canvas {
  width: 100%;
  height: 500px;
  position: relative;
  background: var(--s0, #0a0a14);
}
[data-theme="light"] .artifact-card-map-canvas {
  background: #f5f4fc;
}
/* Taller canvas on mobile for better touch interaction */
@media (max-width: 768px) {
  .artifact-card-map-canvas { height: 400px; }
  .imr-hint { display: none; } /* Hide hint on mobile — double-tap is discoverable */
}
.artifact-card-map-canvas iframe {
  width: 100%; height: 100%; border: none; display: block;
}

/* ── Inline Map Renderer v2 — Aristos styled ── */
.imr-wrapper {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  position: relative;
  font-family: inherit;
}
.imr-toolbar {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 10px;
  background: rgba(36, 30, 49, 0.6);
  border-bottom: 1px solid rgba(152, 137, 192, 0.1);
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}
.imr-tool-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent; color: rgba(232, 228, 240, 0.4);
  cursor: pointer; transition: all 0.15s ease;
}
.imr-tool-btn:hover {
  background: rgba(152, 137, 192, 0.12);
  border-color: rgba(152, 137, 192, 0.15);
  color: #b8aadb;
}
.imr-tool-sep {
  width: 1px; height: 18px;
  background: rgba(152, 137, 192, 0.1);
  margin: 0 4px;
}
.imr-hint {
  font-size: 10px; color: rgba(232, 228, 240, 0.25);
  margin-left: auto; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.02em;
}
.imr-canvas-area {
  flex: 1; position: relative;
  display: flex; min-height: 0;
  overflow: hidden;
  touch-action: none; /* Prevent browser gestures from interfering with our touch handling */
}
.imr-svg {
  flex: 1; width: 100%; min-height: 0;
  cursor: default;
  touch-action: none; /* Critical: prevent scroll/zoom conflicts on touch */
  background: #0e0b1a;
  background-image:
    radial-gradient(circle at 25% 25%, rgba(152, 137, 192, 0.05), transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(45, 39, 105, 0.08), transparent 50%),
    linear-gradient(rgba(152, 137, 192, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(152, 137, 192, 0.025) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 28px 28px, 28px 28px;
}
.imr-node { cursor: grab; transition: filter 0.15s; }
.imr-node:active { cursor: grabbing; }
.imr-node.selected {
  filter: drop-shadow(0 0 12px rgba(152, 137, 192, 0.4));
}
.imr-connection { transition: stroke 0.15s, stroke-width 0.15s; }
.imr-connection:hover { stroke: rgba(255, 107, 107, 0.5) !important; stroke-width: 3 !important; }
.imr-connection.selected { stroke: #ff6b6b !important; stroke-width: 3 !important; }
.imr-port { cursor: crosshair; transition: r 0.15s, opacity 0.15s; }
.imr-port:hover { r: 8 !important; opacity: 1 !important; }
.imr-temp-conn { pointer-events: none; }

/* Connection delete button — small floating trash icon at connection midpoint */
.imr-conn-delete-btn {
  position: absolute;
  z-index: 10;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  background: rgba(255, 107, 107, 0.15);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: #ff6b6b;
  cursor: pointer;
  transition: all 0.15s var(--ease-spring);
  animation: ctxIn 0.15s var(--ease-spring);
}
.imr-conn-delete-btn:hover {
  background: rgba(255, 107, 107, 0.25);
  border-color: rgba(255, 107, 107, 0.5);
  transform: scale(1.1);
}

/* Inline label edit input */
.imr-edit-input {
  position: fixed;
  transform: translate(-50%, -50%);
  z-index: 10000;
  padding: 6px 10px;
  border: 1px solid rgba(152, 137, 192, 0.4);
  border-radius: 8px;
  background: rgba(26, 21, 48, 0.95);
  color: #e8e4f0;
  font-size: 12px; font-weight: 600;
  text-align: center;
  outline: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(152, 137, 192, 0.1);
  backdrop-filter: blur(12px);
}

/* ── Fields Panel (slides in from right) ── */
.imr-fields-panel {
  position: absolute;
  top: 0; right: 0;
  width: 280px; height: 100%;
  background: rgba(26, 21, 48, 0.92);
  border-left: 1px solid rgba(152, 137, 192, 0.12);
  display: flex; flex-direction: column;
  backdrop-filter: blur(16px) saturate(140%);
  z-index: 10;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
}
.imr-fields-panel[data-hidden="true"] {
  transform: translateX(100%);
}
.imr-fields-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(152, 137, 192, 0.08);
  flex-shrink: 0;
}
.imr-fields-title {
  font-size: 12px; font-weight: 700;
  color: #b8aadb; letter-spacing: 0.06em;
  text-transform: uppercase;
}
.imr-fields-close {
  width: 24px; height: 24px;
  border: none; border-radius: 6px;
  background: transparent; color: rgba(232, 228, 240, 0.4);
  font-size: 18px; cursor: pointer;
  transition: all 0.15s;
}
.imr-fields-close:hover {
  background: rgba(152, 137, 192, 0.1);
  color: #e8e4f0;
}
.imr-fields-body {
  flex: 1; overflow-y: auto;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.imr-field-row {
  display: flex; flex-direction: column; gap: 4px;
}
.imr-field-row label {
  font-size: 10px; font-weight: 600;
  color: rgba(232, 228, 240, 0.4);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.imr-field-input, .imr-field-textarea, .imr-field-select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid rgba(152, 137, 192, 0.1);
  border-radius: 6px;
  background: rgba(14, 11, 26, 0.6);
  color: #e8e4f0;
  font-size: 12px; font-family: inherit;
  outline: none; transition: border-color 0.15s;
}
.imr-field-input:focus, .imr-field-textarea:focus, .imr-field-select:focus {
  border-color: rgba(152, 137, 192, 0.3);
}
.imr-field-textarea { resize: vertical; min-height: 40px; }
.imr-fields-divider {
  height: 1px;
  background: rgba(152, 137, 192, 0.08);

/* ── Light theme: Inline Map Renderer ── */
[data-theme="light"] .imr-toolbar {
  background: rgba(245, 244, 252, 0.85);
  border-bottom-color: rgba(45, 39, 105, 0.1);
}
[data-theme="light"] .imr-tool-btn {
  color: rgba(45, 39, 105, 0.5);
}
[data-theme="light"] .imr-tool-btn:hover {
  background: rgba(45, 39, 105, 0.08);
  border-color: rgba(45, 39, 105, 0.12);
  color: #2d2769;
}
[data-theme="light"] .imr-tool-sep {
  background: rgba(45, 39, 105, 0.1);
}
[data-theme="light"] .imr-hint {
  color: rgba(45, 39, 105, 0.35);
}
[data-theme="light"] .imr-svg {
  background: #f0eef8;
  background-image:
    radial-gradient(circle at 25% 25%, rgba(152, 137, 192, 0.04), transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(45, 39, 105, 0.04), transparent 50%),
    linear-gradient(rgba(45, 39, 105, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 39, 105, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 28px 28px, 28px 28px;
}
[data-theme="light"] .imr-edit-input {
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a2e;
  border-color: rgba(45, 39, 105, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 0 3px rgba(45, 39, 105, 0.08);
}
[data-theme="light"] .imr-fields-panel {
  background: rgba(255, 255, 255, 0.95);
  border-left-color: rgba(45, 39, 105, 0.1);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .imr-fields-header {
  border-bottom-color: rgba(45, 39, 105, 0.08);
}
[data-theme="light"] .imr-fields-title {
  color: #2d2769;
}
[data-theme="light"] .imr-fields-close {
  color: rgba(45, 39, 105, 0.4);
}
[data-theme="light"] .imr-fields-close:hover {
  background: rgba(45, 39, 105, 0.08);
  color: #1a1a2e;
}
[data-theme="light"] .imr-field-row label {
  color: rgba(45, 39, 105, 0.5);
}
[data-theme="light"] .imr-field-input,
[data-theme="light"] .imr-field-textarea,
[data-theme="light"] .imr-field-select {
  background: rgba(240, 238, 248, 0.8);
  color: #1a1a2e;
  border-color: rgba(45, 39, 105, 0.12);
}
[data-theme="light"] .imr-field-input:focus,
[data-theme="light"] .imr-field-textarea:focus,
[data-theme="light"] .imr-field-select:focus {
  border-color: rgba(45, 39, 105, 0.3);
}
[data-theme="light"] .imr-fields-divider {
  background: rgba(45, 39, 105, 0.08);
}
  margin: 4px 0;
}
.imr-custom-fields-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.imr-custom-fields-header span {
  font-size: 10px; font-weight: 600;
  color: rgba(232, 228, 240, 0.4);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.imr-add-field-btn {
  padding: 3px 8px;
  border: 1px solid rgba(152, 137, 192, 0.15);
  border-radius: 5px;
  background: rgba(152, 137, 192, 0.06);
  color: #b8aadb;
  font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.imr-add-field-btn:hover {
  background: rgba(152, 137, 192, 0.15);
  border-color: rgba(152, 137, 192, 0.25);
}
.imr-custom-fields-list {
  display: flex; flex-direction: column; gap: 6px;
}
.imr-no-fields {
  font-size: 11px; color: rgba(232, 228, 240, 0.25);
  text-align: center; padding: 12px 0;
}
.imr-custom-field {
  display: grid;
  grid-template-columns: 1fr 70px auto;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(152, 137, 192, 0.06);
  border-radius: 6px;
  background: rgba(14, 11, 26, 0.4);
  align-items: center;
}
.imr-custom-field .imr-cf-name {
  grid-column: 1 / 3;
}
.imr-custom-field .imr-cf-type {
  grid-column: 1 / 2;
}
.imr-custom-field .imr-cf-data {
  grid-column: 2 / 3;
}
.imr-custom-field .imr-cf-delete {
  grid-column: 3 / 4;
  grid-row: 1 / 3;
}
.imr-cf-name, .imr-cf-data {
  padding: 4px 6px;
  border: 1px solid rgba(152, 137, 192, 0.08);
  border-radius: 4px;
  background: rgba(14, 11, 26, 0.5);
  color: #e8e4f0;
  font-size: 11px; outline: none;
}
.imr-cf-name:focus, .imr-cf-data:focus {
  border-color: rgba(152, 137, 192, 0.25);
}
.imr-cf-type {
  padding: 4px 6px;
  border: 1px solid rgba(152, 137, 192, 0.08);
  border-radius: 4px;
  background: rgba(14, 11, 26, 0.5);
  color: #e8e4f0;
  font-size: 11px; outline: none;
}
.imr-cf-delete {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 4px;
  background: transparent; color: rgba(255, 107, 107, 0.4);
  cursor: pointer; transition: all 0.15s;
}
.imr-cf-delete:hover {
  background: rgba(255, 107, 107, 0.1);
  color: #ff6b6b;
}

.artifact-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.artifact-card-prompt {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.artifact-card-meta {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.artifact-card-badge {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: var(--r-full);
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--lavender);
}
.artifact-card-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.artifact-card-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: var(--r-md);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: transparent; color: var(--text-secondary);
  font-family: var(--ff-heading); font-weight: 600; font-size: 11.5px;
  cursor: pointer; transition: all 0.15s var(--ease-spring);
}
.artifact-card-btn:hover {
  border-color: rgba(var(--lavender-rgb), 0.25);
  color: var(--text); background: rgba(var(--lavender-rgb), 0.06);
}

/* ── Generating + error states for inline artifact cards ── */
.artifact-card.generating .artifact-card-preview {
  min-height: 200px;
  background: rgba(var(--lavender-rgb), 0.04);
  display: flex; align-items: center; justify-content: center;
}
.artifact-card-gen-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  background: rgba(var(--s0-rgb), 0.7);
  backdrop-filter: blur(4px);
  color: var(--text-secondary); font-size: 13px; font-weight: 600;
  padding: 16px; text-align: center;
}
.artifact-card-gen-status {
  max-width: 280px; line-height: 1.4;
  opacity: 0.85; font-weight: 500;
  transition: opacity 0.4s;
}
.artifact-card-spinner {
  width: 28px; height: 28px;
  border: 2.5px solid rgba(var(--lavender-rgb), 0.15);
  border-top-color: var(--lavender);
  border-radius: 50%;
  animation: artifact-spin 0.8s linear infinite;
}
@keyframes artifact-spin { to { transform: rotate(360deg); } }

.artifact-card-error {
  padding: 16px 20px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444; font-size: 13px; font-weight: 500;
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 20px 8px;
  max-width: 900px;
  margin: 0 auto;
}

.input-row textarea {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  color: var(--athens);
  font-family: var(--ff-body);
  font-size: 1rem;
  line-height: 1.55;
  outline: none;
  max-height: var(--input-max-h);
  min-height: 26px;
  padding: 6px 0;
}

.input-row textarea::placeholder { color: rgba(var(--athens-rgb), 0.3); }

.input-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; padding-bottom: 4px; }

.char-count {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  color: rgba(var(--athens-rgb), 0.2);
  margin-right: 2px;
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  border: none;
  background: rgba(var(--lavender-rgb), 0.1);
  color: rgba(var(--athens-rgb), 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease-smooth);
  opacity: 0.5;
  -webkit-tap-highlight-color: transparent;
}

.send-btn:not(:disabled) {
  opacity: 1;
  background: var(--brand);
  color: #fff;
}

.send-btn:not(:disabled):hover {
  background: var(--brand-deep);
}
.send-btn:not(:disabled):active {
  transform: scale(0.95);
}

.stop-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--danger-rgb), 0.4);
  background: rgba(var(--danger-rgb), 0.08);
  color: var(--danger);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.22s var(--ease-smooth);
}

.stop-btn:hover {
  background: rgba(var(--danger-rgb), 0.18);
  border-color: var(--danger);
  transform: translateY(-1px);
}

.stop-btn:active {
  transform: translateY(0);
}

.mic-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  color: rgba(var(--athens-rgb), 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s var(--ease-smooth);
  -webkit-tap-highlight-color: transparent;
}

.mic-btn:hover {
  color: var(--lavender);
  background: rgba(var(--lavender-rgb), 0.06);
}

.mic-btn:active {
  transform: translateY(0);
}

.mic-btn.active {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(var(--danger-rgb), 0.1);
  animation: micPulse 1.2s ease-in-out infinite;
}

.mic-btn.recording {
  box-shadow: 0 0 0 3px rgba(var(--danger-rgb), 0.15);
}

.mic-btn.transcribing {
  border-color: var(--lavender);
  color: var(--lavender);
  animation: micPulse 0.8s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.hidden { display: none !important; }

/* ─── Drawer (Settings / Conv settings) ─────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.drawer-overlay.open { display: block; opacity: 1; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--s1);
  border-left: none;
  z-index: 501;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s var(--ease-spring);
  box-shadow: var(--shadow-xl);
}

.drawer.open { transform: translateX(0); }

.drawer.drawer-sm { width: 400px; }

.onboarding-drawer {
  width: min(920px, 94vw);
  background:
    radial-gradient(circle at top left, rgba(var(--lavender-rgb), 0.12), transparent 34%),
    linear-gradient(180deg, rgba(var(--s1-rgb), 0.98), rgba(var(--s0-rgb), 0.98));
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: none;
  flex-shrink: 0;
}

.drawer-title {
  font-family: var(--ff-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--white);
}

.drawer-close {
  width: 40px;
  height: 40px;
  border-radius: var(--r-lg);
  border: none;
  background: transparent;
  color: rgba(var(--athens-rgb), 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.drawer-close:hover { background: rgba(var(--lavender-rgb), 0.08); color: var(--white); }

/* ── Refined drawer header ── */
.drawer-header-pro {
  display: block;
  padding: 20px 24px 14px;
  border-bottom: none;
  background: transparent;
}
.drawer-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.drawer-eyebrow {
  font-family: var(--ff-heading);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(var(--lavender-rgb), 0.85);
}
.drawer-header-pro .drawer-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.drawer-hbtn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-lg);
  border: none;
  background: rgba(var(--lavender-rgb), 0.06);
  color: rgba(var(--athens-rgb), 0.55);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.16s var(--ease-smooth);
}
.drawer-hbtn:hover {
  background: rgba(var(--lavender-rgb), 0.12);
  color: var(--white);
  transform: translateY(-1px);
}
.drawer-hbtn:active { transform: translateY(0) scale(0.96); }
.drawer-hbtn-logout:hover {
  background: rgba(255, 90, 90, 0.1);
  border-color: rgba(255, 90, 90, 0.28);
  color: rgba(255, 140, 140, 1);
}
.drawer-hbtn-sep {
  width: 1px;
  height: 18px;
  background: rgba(var(--lavender-rgb), 0.12);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.onboarding-header {
  padding: 20px 24px;
  background: rgba(var(--s0-rgb), 0.2);
}
.onboarding-kicker {
  display: block;
  margin-bottom: 5px;
  font-family: var(--ff-mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(var(--lavender-rgb), 0.72);
}
.onboarding-body { padding: 22px; }
.onboarding-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  padding: 22px;
  border: 1px solid rgba(var(--lavender-rgb), 0.13);
  border-radius: var(--r-xl);
  background: radial-gradient(circle at 12% 20%, rgba(var(--lavender-rgb), 0.14), transparent 34%), rgba(var(--s2-rgb), 0.34);
  margin-bottom: 18px;
}
.onboarding-orb {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(255,255,255,0.98), rgba(var(--lavender-rgb), 0.82) 42%, rgba(var(--jacarta-rgb), 0.88));
  color: var(--jacarta);
  font-family: var(--ff-brand);
  box-shadow: 0 0 42px rgba(var(--lavender-rgb), 0.28);
}
.onboarding-hero h3 {
  font-family: var(--ff-heading);
  font-size: 1.18rem;
  color: var(--white);
  margin-bottom: 6px;
}
.onboarding-hero p,
.onboarding-prompt-box p {
  color: rgba(var(--athens-rgb), 0.58);
  line-height: 1.62;
  font-size: 0.86rem;
}
.onboarding-steps {
  display: grid;
  gap: 14px;
}
.onboarding-card {
  padding: 18px;
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: 22px;
  background: rgba(var(--s2-rgb), 0.28);
  box-shadow: 0 14px 42px rgba(0,0,0,0.12);
}
.onboarding-step {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.onboarding-step strong {
  font: 700 10px var(--ff-mono);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--lavender);
}
.onboarding-card { border-top: 1px solid rgba(var(--lavender-rgb), 0.14); padding-top: 16px; }

.onboarding-grid {
  display: grid;
  gap: 12px;
}
.onboarding-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.onboarding-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.onboarding-card .setting-label { margin-top: 12px; }
.onboarding-card .setting-input {
  background: rgba(var(--s0-rgb), 0.34);
  border-color: rgba(var(--lavender-rgb), 0.11);
  border-radius: var(--r-md);
}
.onboarding-card .setting-textarea { font-family: var(--ff-body); }
.onboarding-card .setting-textarea.compact { min-height: 70px; }

/* ── Multi-business onboarding cards ── */
.ob-business-card {
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: 18px;
  background: rgba(var(--s0-rgb), 0.22);
}
.ob-business-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.ob-business-card-head strong {
  font-family: var(--ff-heading);
  color: var(--white);
  font-size: 0.9rem;
}
.ob-business-remove {
  background: transparent;
  border: 1px solid rgba(255, 90, 90, 0.25);
  color: rgba(255, 120, 120, 0.85);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.18s;
}
.ob-business-remove:hover { background: rgba(255, 90, 90, 0.12); }
.ob-brand-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(var(--lavender-rgb), 0.14);
}
.ob-brand-section .setting-label:first-child { margin-top: 0; }
.onboarding-add-business {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  background: transparent;
  border: 1px dashed rgba(var(--lavender-rgb), 0.22);
  border-radius: var(--r-md);
  color: var(--lavender);
  font-family: var(--ff-heading);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}
.onboarding-add-business:hover {
  background: rgba(var(--lavender-rgb), 0.08);
  border-color: rgba(var(--lavender-rgb), 0.35);
}

/* ── Active business selector (in input footer) ── */
.business-selector { position: relative; }
.business-selector-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: rgba(var(--athens-rgb), 0.45);
  cursor: pointer;
  transition: all 0.18s var(--ease-smooth);
}
.business-selector-btn span { overflow: hidden; text-overflow: ellipsis; }
.business-selector-btn:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--lavender);
}
/* Business dropdown pops UPWARD from input footer */
.business-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  width: 280px;
  max-height: 360px;
  background: var(--s2);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg), 0 -4px 24px rgba(0,0,0,0.3);
  overflow: hidden;
  display: none;
  z-index: 200;
  animation: popUp 0.25s var(--ease-spring);
}
.business-dropdown.open { display: block; }
.business-dropdown-list { padding: 6px; overflow-y: auto; max-height: 360px; }
.business-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.15s;
  color: var(--athens);
  font-size: 0.84rem;
}
.business-dropdown-item:hover { background: rgba(var(--lavender-rgb), 0.1); }
.business-dropdown-item.active {
  background: rgba(var(--lavender-rgb), 0.16);
  color: var(--white);
}
.business-dropdown-item .biz-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: rgba(var(--lavender-rgb), 0.18);
  display: grid; place-items: center;
  flex-shrink: 0;
  font-family: var(--ff-mono);
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--lavender);
}
.business-dropdown-item .biz-meta { display: flex; flex-direction: column; min-width: 0; }
.business-dropdown-item .biz-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.business-dropdown-item .biz-summary {
  font-size: 0.7rem;
  color: rgba(var(--athens-rgb), 0.55);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Remember button on messages ── */
.msg-remember-popover {
  position: absolute;
  z-index: 300;
  width: 360px;
  background: var(--s2);
  border: 1px solid rgba(var(--lavender-rgb), 0.18);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  animation: dropIn 0.18s var(--ease-spring);
}
.msg-remember-popover textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  background: rgba(var(--s0-rgb), 0.4);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-md);
  color: var(--athens);
  padding: 10px;
  font-family: var(--ff-body);
  font-size: 0.84rem;
}
.msg-remember-popover-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}
.msg-remember-popover-actions button {
  padding: 6px 14px;
  border-radius: var(--r-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}
.msg-remember-popover-actions .cancel {
  background: transparent;
  border-color: rgba(var(--lavender-rgb), 0.18);
  color: var(--athens);
}
.msg-remember-popover-actions .save {
  background: linear-gradient(135deg, var(--jacarta), var(--lavender));
  color: #fff;
}

/* ── Security Tab ─────────────────────────────────────────── */
.security-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.security-overview-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-lg);
  background: rgba(var(--s2-rgb), 0.28);
}
.security-overview-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  background: linear-gradient(150deg, rgba(var(--jacarta-rgb), 0.55), rgba(var(--lavender-rgb), 0.12));
  border: 1px solid rgba(var(--lavender-rgb), 0.2);
  color: var(--lavender-2);
  flex-shrink: 0;
}
.security-overview-icon svg { width: 18px; height: 18px; }
.security-overview-body { display: flex; flex-direction: column; min-width: 0; }
.security-overview-label {
  font-family: var(--ff-heading);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(var(--athens-rgb), 0.5);
  font-weight: 700;
}
.security-overview-value {
  font-family: var(--ff-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--white);
}
@media (max-width: 640px) {
  .security-overview { grid-template-columns: 1fr; }
}

/* Password strength meter (shared between setup-password and security tab) */
.pw-strength { margin-bottom: 14px; }
.pw-strength-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(var(--athens-rgb), 0.08);
  overflow: hidden;
}
.pw-strength-fill {
  height: 100%; width: 0%;
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
}
.pw-strength-fill.weak { width: 25%; background: #ff6b6b; }
.pw-strength-fill.fair { width: 50%; background: #ffa94d; }
.pw-strength-fill.good { width: 75%; background: #74c0fc; }
.pw-strength-fill.strong { width: 100%; background: #69db7c; }
.pw-strength-label {
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 6px;
  color: rgba(var(--athens-rgb), 0.4);
  transition: color 0.3s ease;
}
.pw-strength-label.weak { color: #ff6b6b; }
.pw-strength-label.fair { color: #ffa94d; }
.pw-strength-label.good { color: #74c0fc; }
.pw-strength-label.strong { color: #69db7c; }
.pw-match {
  font-size: 0.78rem;
  margin-top: -6px;
  margin-bottom: 14px;
  min-height: 16px;
  transition: color 0.25s ease;
}
.pw-match.match { color: var(--ok); }
.pw-match.nomatch { color: var(--danger); }

/* Passkey cards */
.passkey-list { display: grid; gap: 10px; }
.passkey-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-lg);
  background: rgba(var(--s0-rgb), 0.22);
}
.passkey-card-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  background: linear-gradient(150deg, rgba(var(--jacarta-rgb), 0.55), rgba(var(--lavender-rgb), 0.12));
  border: 1px solid rgba(var(--lavender-rgb), 0.2);
  color: var(--lavender-2);
  flex-shrink: 0;
}
.passkey-card-icon svg { width: 18px; height: 18px; }
.passkey-card-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.passkey-label-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--white);
  font-family: var(--ff-heading);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 3px 6px;
  margin: 0 0 2px -6px;
  width: calc(100% + 12px);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.passkey-label-input:hover { border-color: rgba(var(--lavender-rgb), 0.15); }
.passkey-label-input:focus {
  border-color: rgba(var(--lavender-rgb), 0.3);
  background: rgba(var(--s0-rgb), 0.4);
  outline: none;
}
.passkey-meta {
  font-size: 0.72rem;
  color: rgba(var(--athens-rgb), 0.45);
}
.passkey-rename-btn {
  padding: 5px 10px;
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--lavender-2);
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}
.passkey-rename-btn:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  border-color: rgba(var(--lavender-rgb), 0.3);
}
.passkey-delete-btn {
  width: 32px; height: 32px;
  border: 1px solid rgba(255, 90, 90, 0.2);
  border-radius: var(--r-sm);
  background: transparent;
  color: rgba(255, 120, 120, 0.7);
  cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.18s;
  flex-shrink: 0;
}
.passkey-delete-btn:hover {
  background: rgba(255, 90, 90, 0.12);
  color: rgba(255, 120, 120, 1);
}
.passkey-delete-btn svg { width: 14px; height: 14px; }

/* Session cards */
.session-list { display: grid; gap: 10px; }
.session-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-lg);
  background: rgba(var(--s0-rgb), 0.22);
}
.session-card.current {
  border-color: rgba(var(--ok-rgb, 134, 239, 172), 0.25);
  background: rgba(var(--ok-rgb, 134, 239, 172), 0.06);
}
.session-card-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  background: linear-gradient(150deg, rgba(var(--jacarta-rgb), 0.55), rgba(var(--lavender-rgb), 0.12));
  border: 1px solid rgba(var(--lavender-rgb), 0.2);
  color: var(--lavender-2);
  flex-shrink: 0;
}
.session-card-icon svg { width: 18px; height: 18px; }
.session-card-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.session-device {
  font-family: var(--ff-heading);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--white);
}
.session-current-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: rgba(var(--ok-rgb, 134, 239, 172), 0.15);
  color: var(--ok);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-left: 6px;
}
.session-meta {
  font-size: 0.74rem;
  color: rgba(var(--athens-rgb), 0.5);
  margin-top: 2px;
}
.session-created {
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.35);
  margin-top: 1px;
}
.session-revoke-btn {
  padding: 6px 12px;
  border: 1px solid rgba(255, 90, 90, 0.2);
  border-radius: var(--r-sm);
  background: transparent;
  color: rgba(255, 120, 120, 0.8);
  font-family: var(--ff-heading);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  flex-shrink: 0;
}
.session-revoke-btn:hover {
  background: rgba(255, 90, 90, 0.12);
  color: rgba(255, 120, 120, 1);
}

/* Login history */
.login-history-list { display: grid; gap: 6px; max-height: 400px; overflow-y: auto; }
.history-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  transition: background 0.15s;
}
.history-entry:hover { background: rgba(var(--lavender-rgb), 0.05); }
.history-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.history-ok .history-dot { background: var(--ok); box-shadow: 0 0 8px rgba(var(--ok-rgb, 134, 239, 172), 0.4); }
.history-danger .history-dot { background: var(--danger); box-shadow: 0 0 8px rgba(255, 140, 140, 0.4); }
.history-info .history-dot { background: var(--info); box-shadow: 0 0 8px rgba(var(--lavender-rgb), 0.3); }
.history-body { display: flex; flex-direction: column; min-width: 0; }
.history-action {
  font-family: var(--ff-heading);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--athens);
}
.history-meta {
  font-size: 0.72rem;
  color: rgba(var(--athens-rgb), 0.45);
  margin-top: 1px;
}
.onboarding-import-card {
  background: linear-gradient(135deg, rgba(var(--jacarta-rgb), 0.2), rgba(var(--s2-rgb), 0.28));
}
.onboarding-prompt-box {
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(var(--lavender-rgb), 0.14);
  background: rgba(var(--s0-rgb), 0.38);
}
.onboarding-prompt-box strong {
  display: block;
  margin-bottom: 8px;
  font-family: var(--ff-heading);
  color: var(--athens);
  font-size: 0.82rem;
}
.onboarding-history { min-height: 180px; }
.onboarding-save {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 18px;
  box-shadow: 0 -16px 44px rgba(12, 10, 20, 0.72), var(--shadow-glow);
}

.setting-group {
  margin-bottom: 28px;
}

.setting-group-title {
  font-family: var(--ff-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-group-title svg { color: var(--lavender); }

.setting-label {
  display: block;
  font-family: var(--ff-heading);
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.5);
  margin-bottom: 6px;
  margin-top: 14px;
}

.setting-label:first-of-type { margin-top: 0; }

.setting-value {
  font-family: var(--ff-mono);
  color: var(--lavender);
}

.setting-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(var(--lavender-rgb), 0.04);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-sm);
  color: var(--athens);
  font-family: var(--ff-body);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}

.setting-input:focus { border-color: rgba(var(--lavender-rgb), 0.3); }
.setting-input::placeholder { color: rgba(var(--athens-rgb), 0.2); }

.setting-textarea {
  resize: vertical;
  font-family: var(--ff-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  min-height: 80px;
}

select.setting-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239889C0' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
/* Force dark dropdown list — browsers default to white bg for <option> */
select.setting-input option {
  background: #1a1530;
  color: #e8e6f0;
}
[data-theme="light"] select.setting-input option {
  background: #f5f4fa;
  color: #1a1530;
}

/* Admin default badge — small gold pill next to a setting label */
.admin-default-badge {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(var(--gold-rgb), 0.15);
  color: var(--gold);
  border: 1px solid rgba(var(--gold-rgb), 0.25);
  vertical-align: middle;
  margin-left: 6px;
}
.admin-default-badge[hidden] { display: none; }

.setting-range {
  width: 100%;
  appearance: none;
  height: 4px;
  background: rgba(var(--lavender-rgb), 0.15);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.setting-range::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--lavender);
  border: 2px solid var(--s1);
  cursor: pointer;
  transition: transform 0.15s;
}

.setting-range::-webkit-slider-thumb:hover { transform: scale(1.2); }

.setting-status {
  margin-top: 8px;
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.setting-status.online { color: var(--ok); }
.setting-status.offline { color: var(--danger); }

.setting-hint {
  font-weight: 400;
  font-style: italic;
  color: rgba(var(--athens-rgb), 0.3);
}

.setting-info-text {
  font-size: 0.73rem;
  color: rgba(var(--athens-rgb), 0.35);
  margin-top: 6px;
  line-height: 1.5;
}

.setting-info { display: flex; flex-direction: column; gap: 8px; }

/* ─── Settings — Collapsible Cards ─────────────────────── */
.set-drawer-body { padding-top: 4px; }

.set-card {
  border-radius: var(--r-xl);
  border: none;
  background: rgba(var(--lavender-rgb), 0.03);
  margin-bottom: 10px;
  overflow: hidden;
  transition: background 0.2s var(--ease-smooth);
}
.set-card:hover { background: rgba(var(--lavender-rgb), 0.05); }

.set-card-header {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s var(--ease-smooth);
}
.set-card-header:hover { background: rgba(var(--lavender-rgb), 0.04); }

.set-card-icon {
  color: var(--lavender);
  flex-shrink: 0;
}

.set-card-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.set-card-title {
  font-family: var(--ff-heading);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}

.set-card-summary {
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.set-card-chevron {
  flex-shrink: 0;
  color: rgba(var(--athens-rgb), 0.3);
  transition: transform 0.25s var(--ease-smooth);
}
.set-card-chevron.open { transform: rotate(180deg); }

.set-card-body {
  display: none;
  padding: 4px 16px 16px;
}
.set-card-body.open { display: block; }

.set-card-divider {
  height: 1px;
  background: rgba(var(--lavender-rgb), 0.08);
  margin: 14px 0;
}

/* Danger variant */
.set-card-danger {
  border-color: rgba(var(--danger-rgb), 0.12);
  background: rgba(var(--danger-rgb), 0.02);
}
.set-card-danger:hover { border-color: rgba(var(--danger-rgb), 0.2); }
.set-card-icon-danger { color: var(--danger); }
.set-card-title-danger { color: var(--danger); }
.set-card-danger .set-card-summary { color: rgba(var(--danger-rgb), 0.5); }

@media (max-width: 768px) {
  .set-card-header { padding: 12px 14px; gap: 9px; }
  .set-card-body { padding: 4px 14px 14px; }
  .set-card-title { font-size: 0.8rem; }
  .set-card-summary { font-size: 0.65rem; }
}

/* ─── Drawer Tabs ───────────────────────────────────────── */
.drawer-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-tabs {
  display: flex;
  gap: 0;
  margin-top: 12px;
  border-bottom: none;
}

.drawer-tab {
  padding: 10px 16px;
  font-family: var(--ff-heading);
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.45);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s var(--ease-smooth);
  position: relative;
  bottom: -1px;
}

/* Phase 4.5: Smooth underline animation for active tab */
.drawer-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--lavender);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-tab:hover {
  color: rgba(var(--athens-rgb), 0.7);
}

.drawer-tab.active {
  color: var(--lavender);
  border-bottom-color: var(--lavender);
}

.drawer-tab.active::after {
  width: 70%;
}

.drawer-tab-panel {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.drawer-tab-panel .drawer-body {
  flex: 1;
  overflow-y: auto;
}

/* ─── Toggle Switch ─────────────────────────────────────── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(var(--athens-rgb), 0.15);
  border-radius: 22px;
  transition: 0.25s var(--ease-smooth);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  /* Toggle knob is a conventional white puck regardless of theme (like iOS/
     Material switches) — it must NOT use var(--white), which is remapped to
     a dark text color in light mode and would make the knob nearly invisible
     against the track. */
  background: #fff;
  border-radius: 50%;
  transition: 0.25s var(--ease-smooth);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--lavender);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}
.setting-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}
.setting-toggle-label {
  font-size: 13px;
  color: var(--text);
}

/* ─── Voice Intro Modal ─────────────────────────────────── */
.voice-intro-root {
  position: fixed;
  inset: 0;
  z-index: 50000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', 'Open Sans', system-ui, sans-serif;
  opacity: 0;
  transition: opacity .35s ease;
}
.voice-intro-root.voice-intro-active {
  opacity: 1;
}
.voice-intro-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(45,39,105,.55), rgba(6,4,14,.92) 70%);
  backdrop-filter: blur(8px);
}
.voice-intro-card {
  position: relative;
  width: min(460px, calc(100vw - 40px));
  background: linear-gradient(180deg, rgba(28,21,52,.96), rgba(14,10,26,.97));
  border: 1px solid rgba(152,137,192,.32);
  border-radius: var(--r-xl);
  padding: 34px 34px 26px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(20px) saturate(150%);
  transform: translateY(12px) scale(.97);
  opacity: 0;
  transition: opacity .4s ease, transform .4s cubic-bezier(.22,1,.36,1);
}
.voice-intro-root.voice-intro-active .voice-intro-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.voice-intro-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(152,137,192,.6), rgba(255,255,255,.04), rgba(45,39,105,.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.voice-intro-hero {
  margin-bottom: 18px;
}
.voice-intro-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, #2D2769, #9889C0);
  box-shadow: 0 18px 44px rgba(45,39,105,.5);
  color: #fff;
}
.voice-intro-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: #b8aadb;
  margin-bottom: 12px;
}
.voice-intro-spark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9889C0;
  box-shadow: 0 0 12px #9889C0;
}
.voice-intro-title {
  font-family: 'Inter', 'Open Sans', sans-serif;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 10px;
  letter-spacing: -.4px;
  color: #fff;
}
.voice-intro-body {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255,255,255,.74);
  margin: 0 0 20px;
}
.voice-intro-body strong {
  color: #fff;
  font-weight: 700;
}
.voice-intro-tips {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  text-align: left;
}
.voice-intro-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255,255,255,.62);
  padding: 10px 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--r-md);
}
.voice-intro-tip svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: #9889C0;
}
.voice-intro-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  padding: 14px 20px;
  background: linear-gradient(135deg, #2D2769 0%, #9889C0 100%);
  color: #fff;
  box-shadow: 0 12px 30px rgba(45,39,105,.45);
  transition: transform .18s ease, box-shadow .18s ease;
}
.voice-intro-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(152,137,192,.4);
}
@media (prefers-reduced-motion: reduce) {
  .voice-intro-card { transition: opacity .2s ease; }
}

/* ─── Tour Pulse Animation ──────────────────────────────── */
@keyframes tour-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--lavender-rgb), 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(var(--lavender-rgb), 0); }
}

.tour-pulse {
  animation: tour-pulse 1.8s ease-in-out infinite;
  border-radius: 50%;
}

/* ─── Recorder Drawer ───────────────────────────────────── */
.rec-device-card {
  border-radius: var(--r-lg);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--lavender-rgb), 0.03);
  margin-bottom: 14px;
  overflow: hidden;
}

.rec-device-header {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 13px 14px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s var(--ease-smooth);
}
.rec-device-header:hover { background: rgba(var(--lavender-rgb), 0.05); }

.rec-device-chevron {
  margin-left: auto;
  flex-shrink: 0;
  color: rgba(var(--athens-rgb), 0.35);
  transition: transform 0.25s var(--ease-smooth);
}
.rec-device-chevron.open { transform: rotate(180deg); }

.rec-device-body {
  display: none;
  padding: 2px 14px 12px;
}
.rec-device-body.open { display: block; }

.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(var(--athens-rgb), 0.25);
  flex-shrink: 0;
}
.rec-dot.online { background: var(--ok, #34d399); box-shadow: 0 0 8px rgba(52, 211, 153, 0.5); }
.rec-dot.offline { background: #f59e0b; }

.rec-device-label {
  font-family: var(--ff-heading);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--athens);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-device-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}
.rec-device-actions .setting-save-btn,
.rec-device-actions .setting-danger-btn {
  width: auto;
  flex: 1;
  padding: 9px 14px;
}
.rec-device-actions .setting-danger-btn {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid rgba(var(--athens-rgb), 0.1);
  color: rgba(var(--athens-rgb), 0.4);
  font-weight: 500;
}
.rec-device-actions .setting-danger-btn:hover {
  background: rgba(var(--danger-rgb), 0.06);
  border-color: rgba(var(--danger-rgb), 0.25);
  color: var(--danger);
}

.rec-sync-status {
  font-size: 0.75rem;
  color: var(--lavender);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: rgba(var(--lavender-rgb), 0.07);
  border: 1px solid rgba(var(--lavender-rgb), 0.14);
  margin-bottom: 12px;
}

.rec-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 40px 20px;
  font-size: 0.76rem;
  color: rgba(var(--athens-rgb), 0.35);
  line-height: 1.5;
}
.rec-empty svg {
  color: rgba(var(--lavender-rgb), 0.35);
  margin-bottom: 6px;
}
.rec-empty-title {
  font-family: var(--ff-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.6);
}

.rec-list-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ff-heading);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(var(--athens-rgb), 0.4);
  padding: 4px 2px 10px;
}
.rec-list-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-sm);
  font-size: 0.66rem;
  background: rgba(var(--lavender-rgb), 0.12);
  color: var(--lavender);
}

.rec-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
  background: rgba(var(--lavender-rgb), 0.02);
  margin-bottom: 8px;
  transition: all 0.2s var(--ease-smooth);
}
.rec-item:hover {
  border-color: rgba(var(--lavender-rgb), 0.18);
  background: rgba(var(--lavender-rgb), 0.05);
}
.rec-item-clickable { cursor: pointer; }

.rec-item-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(var(--lavender-rgb), 0.14), rgba(var(--lavender-rgb), 0.05));
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  color: var(--lavender);
}

.rec-item-main { flex: 1; min-width: 0; }

.rec-item-name {
  font-family: var(--ff-heading);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--athens);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.4);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
}
.rec-meta-sep { color: rgba(var(--athens-rgb), 0.2); }

.rec-item-error {
  font-size: 0.66rem;
  color: var(--danger, #f04438);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-spinner {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border: 1.5px solid rgba(var(--lavender-rgb), 0.25);
  border-top-color: var(--lavender);
  border-radius: 50%;
  animation: rec-spin 0.8s linear infinite;
  vertical-align: -1px;
}
@keyframes rec-spin { to { transform: rotate(360deg); } }

.rec-status { font-weight: 600; display: inline-flex; align-items: center; }
.rec-status-done { color: var(--ok, #34d399); }
.rec-status-transcribing, .rec-status-summarizing { color: var(--lavender); }
.rec-status-uploaded, .rec-status-transcribed { color: #f59e0b; }
.rec-status-error { color: var(--danger, #f04438); }

.rec-item-actions { display: flex; gap: 5px; flex-shrink: 0; }

.rec-item-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: rgba(var(--lavender-rgb), 0.03);
  color: rgba(var(--athens-rgb), 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease-smooth);
}
.rec-item-btn:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--athens);
  border-color: rgba(var(--lavender-rgb), 0.22);
}
.rec-item-btn-danger:hover {
  background: rgba(var(--danger-rgb), 0.1);
  color: var(--danger);
  border-color: rgba(var(--danger-rgb), 0.3);
}

.rec-back-btn {
  background: none;
  border: none;
  color: var(--lavender);
  font-family: var(--ff-heading);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0 0 12px;
}

.rec-detail-title {
  font-family: var(--ff-heading);
  font-size: 0.95rem;
  color: var(--athens);
  margin: 0 0 14px;
  word-break: break-all;
}

.rec-detail-section { margin-bottom: 16px; }

.rec-detail-label {
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(var(--athens-rgb), 0.4);
  margin-bottom: 6px;
}

.rec-detail-body {
  font-size: 0.8rem;
  line-height: 1.6;
  color: rgba(var(--athens-rgb), 0.75);
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: rgba(var(--lavender-rgb), 0.03);
}
.rec-detail-body h2 { font-size: 0.85rem; margin: 10px 0 6px; color: var(--athens); }
.rec-detail-body ul { padding-left: 18px; margin: 6px 0; }

.rec-transcript {
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.rec-detail-actions { margin-top: 14px; }

/* ─── Recorder — global sync progress pill ───────────── */
.rec-progress {
  position: fixed;
  bottom: 22px;
  right: 22px;
  transform: translateY(80px);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(90vw, 420px);
  padding: 11px 18px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.25);
  background: rgba(20, 16, 38, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  color: var(--athens);
  font-family: var(--ff-heading);
  font-size: 0.76rem;
  font-weight: 500;
  z-index: 9000;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s var(--ease-smooth), opacity 0.35s var(--ease-smooth);
}
.rec-progress.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.rec-progress.done {
  border-color: rgba(52, 211, 153, 0.35);
}
.rec-progress.done .rec-progress-icon { color: var(--ok, #34d399); }

.rec-progress-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.rec-progress-icon .rec-spinner {
  width: 12px;
  height: 12px;
  margin-right: 0;
}

.rec-progress-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 768px) {
  .rec-progress {
    bottom: 14px;
    right: 14px;
    max-width: calc(100vw - 28px);
    font-size: 0.7rem;
    padding: 9px 14px;
    gap: 8px;
  }
}

/* ─── Recording Detail Modal ──────────────────────────── */
.rec-modal {
  max-width: 640px;
  width: 92%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.rec-modal-header {
  padding: 18px 20px 12px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.08);
  flex-shrink: 0;
}
.rec-modal-header-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rec-modal-name-input {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-family: var(--ff-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
  padding: 6px 10px;
  outline: none;
  transition: all 0.2s var(--ease-smooth);
}
.rec-modal-name-input:hover {
  background: rgba(var(--lavender-rgb), 0.04);
}
.rec-modal-name-input:focus {
  background: rgba(var(--lavender-rgb), 0.06);
  border-color: rgba(var(--lavender-rgb), 0.2);
}
.rec-modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
  color: rgba(var(--athens-rgb), 0.5);
  cursor: pointer;
  transition: all 0.2s var(--ease-smooth);
  flex-shrink: 0;
}
.rec-modal-close:hover {
  background: rgba(var(--lavender-rgb), 0.08);
  color: var(--athens);
  border-color: rgba(var(--lavender-rgb), 0.18);
}

.rec-modal-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  margin-top: 4px;
}
.rec-modal-status {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--lavender);
  display: flex;
  align-items: center;
  gap: 5px;
}
.rec-modal-meta {
  font-size: 0.7rem;
  color: rgba(var(--athens-rgb), 0.4);
}

.rec-modal-audio-box {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.08);
  flex-shrink: 0;
}
.rec-modal-audio-box audio {
  width: 100%;
  height: 38px;
  border-radius: var(--r-sm);
}
.rec-modal-audio-box audio::-webkit-media-controls-panel {
  background: rgba(var(--lavender-rgb), 0.04);
}

.rec-modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  min-height: 80px;
}

.rec-modal-error {
  font-size: 0.78rem;
  color: var(--danger, #f04438);
  background: rgba(var(--danger-rgb), 0.06);
  border: 1px solid rgba(var(--danger-rgb), 0.15);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
}

.rec-modal-placeholder {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  text-align: center;
  color: rgba(var(--athens-rgb), 0.4);
  font-size: 0.82rem;
  padding: 30px 20px;
}

.rec-modal-section { margin-bottom: 18px; }
.rec-modal-section:last-child { margin-bottom: 0; }

.rec-modal-section-label {
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(var(--lavender-rgb), 0.7);
  margin-bottom: 8px;
}

.rec-modal-section-body {
  font-size: 0.82rem;
  line-height: 1.65;
  color: rgba(var(--athens-rgb), 0.8);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
  background: rgba(var(--lavender-rgb), 0.02);
}
.rec-modal-markdown h2 { font-size: 0.88rem; margin: 10px 0 6px; color: var(--athens); }
.rec-modal-markdown h3 { font-size: 0.82rem; margin: 8px 0 4px; color: var(--athens); }
.rec-modal-markdown ul { padding-left: 18px; margin: 6px 0; }
.rec-modal-markdown li { margin-bottom: 3px; }
.rec-modal-markdown p { margin: 6px 0; }

.rec-modal-transcript {
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--ff-mono);
  font-size: 0.76rem;
  line-height: 1.6;
}

.rec-modal-footer {
  display: flex;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.08);
  flex-shrink: 0;
}
.rec-modal-footer .modal-btn {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 600;
}

.security-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ok);
  padding: 8px 12px;
  background: rgba(var(--ok-rgb), 0.06);
  border: 1px solid rgba(var(--ok-rgb), 0.12);
  border-radius: var(--r-sm);
}

/* Danger zone */
.setting-group-danger {
  border: 1px solid rgba(var(--danger-rgb), 0.15);
  border-radius: var(--r-md);
  padding: 16px;
  margin-top: 8px;
}
.setting-group-title.danger { color: var(--danger); }
.setting-danger-btn {
  width: 100%;
  padding: 10px 16px;
  background: rgba(var(--danger-rgb), 0.08);
  border: 1px solid rgba(var(--danger-rgb), 0.2);
  border-radius: var(--r-sm);
  color: var(--danger);
  font-family: var(--ff-heading);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s var(--ease-smooth);
}
.setting-danger-btn:hover {
  background: rgba(var(--danger-rgb), 0.15);
  border-color: rgba(var(--danger-rgb), 0.4);
}
.setting-danger-hint {
  font-size: 0.7rem;
  color: rgba(var(--athens-rgb), 0.3);
  margin-top: 8px;
  line-height: 1.4;
}

.setting-save-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--jacarta), rgba(var(--lavender-rgb), 0.4));
  border: 1px solid rgba(var(--lavender-rgb), 0.2);
  border-radius: var(--r-md);
  /* Permanent brand-gradient fill — must stay white in both themes. This is
     the "Save Settings" / "Save Voice Settings" / "Update Onboarding" button
     class; var(--white) flips to near-black text in light mode. */
  color: #fff;
  font-family: var(--ff-heading);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
  margin-top: 20px;
}

.setting-save-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

/* ═══════════════════════════════════════════════════════════
   Users Drawer — Premium redesign
   ═══════════════════════════════════════════════════════════ */

.users-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.users-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
  color: rgba(var(--athens-rgb), 0.45);
}

.users-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--r-xl);
  background: rgba(var(--lavender-rgb), 0.06);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(var(--lavender-rgb), 0.5);
  margin-bottom: 18px;
}

.users-empty-title {
  font-family: var(--ff-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--athens);
  margin-bottom: 6px;
}

.users-empty-text {
  font-size: 0.84rem;
  line-height: 1.5;
  max-width: 220px;
}

.user-card {
  background: rgba(var(--s2-rgb), 0.42);
  border: none;
  border-radius: var(--r-xl);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  animation: userCardIn 0.35s var(--ease-spring) backwards;
}

@keyframes userCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-card:hover {
  border-color: rgba(var(--lavender-rgb), 0.14);
  box-shadow: var(--shadow);
}

.user-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(var(--jacarta-rgb), 0.7), rgba(var(--lavender-rgb), 0.32));
  border: 1px solid rgba(var(--lavender-rgb), 0.25);
  color: #fff;
  font-family: var(--ff-heading);
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(var(--jacarta-rgb), 0.28);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.user-name {
  font-family: var(--ff-heading);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
}

.user-email {
  font-size: 0.8rem;
  color: rgba(var(--athens-rgb), 0.55);
  margin-bottom: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-meta {
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.4);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.user-pending-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--r-sm);
  background: rgba(var(--warn-rgb), 0.12);
  border: 1px solid rgba(var(--warn-rgb), 0.2);
  color: var(--warn);
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-pills {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.user-pill {
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
}

.user-pill--status {
  background: rgba(var(--lavender-rgb), 0.08);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  color: rgba(var(--athens-rgb), 0.55);
}

.user-pill--status.active {
  background: rgba(var(--ok-rgb), 0.1);
  border-color: rgba(var(--ok-rgb), 0.2);
  color: var(--ok);
}

.user-pill--status.disabled {
  background: rgba(var(--danger-rgb), 0.1);
  border-color: rgba(var(--danger-rgb), 0.2);
  color: var(--danger);
}

.user-pill--role {
  background: rgba(var(--lavender-rgb), 0.06);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  color: rgba(var(--athens-rgb), 0.55);
}

.user-pill--role.admin {
  background: rgba(var(--jacarta-rgb), 0.45);
  border-color: rgba(var(--lavender-rgb), 0.22);
  color: var(--lavender);
}

.user-card-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.08);
  margin-bottom: 16px;
}

.user-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-control-label {
  font-size: 0.62rem;
  font-weight: 800;
  color: rgba(var(--athens-rgb), 0.35);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.user-role-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-role-select {
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  min-width: 96px;
  padding: 9px 30px 9px 13px;
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--athens);
  background: rgba(var(--lavender-rgb), 0.06);
  border: 1px solid rgba(var(--lavender-rgb), 0.13);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239889C0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}

.user-role-select:hover:not(:disabled) {
  background-color: rgba(var(--lavender-rgb), 0.1);
  border-color: rgba(var(--lavender-rgb), 0.22);
}

.user-role-select:focus {
  outline: none;
  border-color: rgba(var(--lavender-rgb), 0.35);
  box-shadow: 0 0 0 3px rgba(var(--lavender-rgb), 0.1);
}

.user-role-select:disabled {
  opacity: 0.6;
  cursor: wait;
}

.role-saved {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--ok);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.role-saved.show {
  opacity: 1;
  transform: translateX(0);
}

.user-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.user-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: var(--r-md);
  font-family: var(--ff-heading);
  font-size: 0.73rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s var(--ease-out);
}

.user-btn svg {
  flex-shrink: 0;
}

.user-btn--primary {
  background: rgba(var(--lavender-rgb), 0.14);
  border-color: rgba(var(--lavender-rgb), 0.22);
  color: var(--white);
}

.user-btn--primary:hover {
  background: rgba(var(--lavender-rgb), 0.22);
  border-color: rgba(var(--lavender-rgb), 0.32);
  transform: translateY(-1px);
}

.user-btn--danger {
  background: rgba(var(--danger-rgb), 0.1);
  border-color: rgba(var(--danger-rgb), 0.18);
  color: var(--danger);
}

.user-btn--danger:hover {
  background: rgba(var(--danger-rgb), 0.18);
  border-color: rgba(var(--danger-rgb), 0.28);
  transform: translateY(-1px);
}

.user-btn--ghost {
  background: transparent;
  border-color: rgba(var(--lavender-rgb), 0.14);
  color: rgba(var(--athens-rgb), 0.65);
}

.user-btn--ghost:hover {
  background: rgba(var(--lavender-rgb), 0.08);
  border-color: rgba(var(--lavender-rgb), 0.22);
  color: var(--athens);
}

.user-password-section {
  padding-top: 16px;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.08);
}

.user-password-section .user-control-label {
  margin-bottom: 6px;
}

.user-password-row {
  display: flex;
  gap: 8px;
}

.user-password-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-family: var(--ff-body);
  font-size: 0.8rem;
  color: var(--athens);
  background: rgba(var(--lavender-rgb), 0.04);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-md);
  outline: none;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.user-password-input::placeholder {
  color: rgba(var(--athens-rgb), 0.3);
}

.user-password-input:focus {
  background: rgba(var(--lavender-rgb), 0.06);
  border-color: rgba(var(--lavender-rgb), 0.22);
  box-shadow: 0 0 0 3px rgba(var(--lavender-rgb), 0.08);
}

.user-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: rgba(var(--warn-rgb), 0.06);
  border: 1px solid rgba(var(--warn-rgb), 0.12);
  color: rgba(var(--warn-rgb), 0.9);
  font-size: 0.72rem;
  line-height: 1.45;
}

.user-hint svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.users-create-card {
  background: rgba(var(--s2-rgb), 0.42);
  border: none;
  border-radius: var(--r-xl);
  padding: 18px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.users-create-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--ff-heading);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.users-create-title svg {
  color: var(--lavender);
}

.users-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.users-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.users-form-field .user-control-label {
  margin-bottom: 0;
}

.users-form-field .user-password-input,
.users-form-field .user-role-select {
  width: 100%;
}

.users-create-btn {
  width: 100%;
  justify-content: center;
  padding: 11px 14px;
  font-size: 0.78rem;
}

.users-existing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.users-existing-header .users-create-title {
  margin-bottom: 0;
}

@media (max-width: 480px) {
  .users-form-grid {
    grid-template-columns: 1fr;
  }

  .user-card-header {
    flex-wrap: wrap;
  }

  .user-pills {
    flex-direction: row;
    align-items: center;
    width: 100%;
    margin-top: 10px;
  }

  .user-card-body {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .user-actions-group {
    justify-content: flex-start;
  }

  .user-role-wrap,
  .user-actions-group {
    width: 100%;
  }

  .user-role-select {
    flex: 1;
  }
}

.drawer-wide { width: min(820px, 94vw); }

/* ─── User Tier Pill ─── */
.user-pill--tier {
  background: rgba(var(--lavender-rgb), 0.1);
  border: 1px solid rgba(var(--lavender-rgb), 0.18);
  color: var(--lavender);
}
.user-pill--tier.none {
  opacity: 0.35;
}

/* ─── User Plan Pill ─── */
.user-pill--plan {
  background: rgba(140, 180, 255, 0.1);
  border: 1px solid rgba(140, 180, 255, 0.2);
  color: #8cb4ff;
}
.user-pill--plan.plan-free {
  background: rgba(255, 140, 140, 0.08);
  border-color: rgba(255, 140, 140, 0.2);
  color: #ff8c8c;
}
.user-pill--plan.plan-enterprise {
  background: rgba(var(--lavender-rgb), 0.12);
  border-color: rgba(var(--lavender-rgb), 0.25);
  color: var(--lavender);
}

/* ─── User Usage Row ─── */
.user-usage-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.06);
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06);
  background: rgba(var(--lavender-rgb), 0.03);
  flex-wrap: wrap;
}
.user-usage-credit {
  flex: 1;
  min-width: 120px;
}
.user-usage-bar {
  width: 100%;
  height: 5px;
  border-radius: var(--r-xs);
  background: rgba(var(--athens-rgb), 0.08);
  overflow: hidden;
}
.user-usage-bar-fill {
  height: 100%;
  border-radius: var(--r-xs);
  transition: width 0.4s var(--ease-out);
}
.user-usage-bar-fill.ok {
  background: linear-gradient(90deg, var(--jacarta), var(--lavender));
}
.user-usage-bar-fill.warn {
  background: linear-gradient(90deg, #8b6914, var(--warn));
}
.user-usage-bar-fill.over {
  background: linear-gradient(90deg, #5c1a1a, var(--danger));
}
.user-usage-text {
  font-size: 0.65rem;
  color: rgba(var(--athens-rgb), 0.5);
  margin-top: 4px;
  white-space: nowrap;
}
.user-usage-text strong {
  color: var(--athens);
  font-weight: 700;
}
.user-usage-stats {
  text-align: right;
  flex-shrink: 0;
}
.user-usage-cost {
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--lavender);
}
.user-usage-overage {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  color: var(--warn);
}
.user-usage-tokens {
  font-family: var(--ff-mono);
  font-size: 0.6rem;
  color: rgba(var(--athens-rgb), 0.35);
  margin-top: 2px;
}
.user-usage-expand {
  flex-shrink: 0;
  font-size: 0.65rem;
  padding: 4px 10px;
}

/* ─── User Detail Panel ─── */
.user-detail-panel {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06);
  background: rgba(var(--s2-rgb), 0.3);
}
.user-detail-loading {
  text-align: center;
  color: rgba(var(--athens-rgb), 0.35);
  font-size: 0.7rem;
  padding: 12px;
}
.user-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.user-detail-section h4 {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(var(--athens-rgb), 0.4);
  font-weight: 700;
  margin-bottom: 8px;
}
.user-detail-empty {
  font-size: 0.7rem;
  color: rgba(var(--athens-rgb), 0.3);
  padding: 8px 0;
}
.user-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
}
.user-detail-table th {
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.08);
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(var(--athens-rgb), 0.3);
  font-weight: 700;
}
.user-detail-table td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.04);
}
.user-detail-table td.mono {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
}
.user-detail-table tr:last-child td {
  border-bottom: 0;
}
.tier-saved {
  font-size: 0.6rem;
  color: var(--ok);
  opacity: 0;
  transition: opacity 0.3s;
}
.tier-saved.show {
  opacity: 1;
}
.plan-saved {
  font-size: 0.6rem;
  color: var(--ok);
  opacity: 0;
  transition: opacity 0.3s;
}
.plan-saved.show {
  opacity: 1;
}
@media (max-width: 600px) {
  .user-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Graph panel actions — quiet, on-token ──
   (the old violet/teal gradient toolbar is gone) */
.memory-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.mem-action {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-sm); cursor: pointer;
  background: rgba(var(--lavender-rgb), 0.08);
  border: 1px solid rgba(var(--lavender-rgb), 0.22);
  color: var(--text); font: 600 0.78rem var(--ff-heading);
  transition: background .15s, border-color .15s;
}
.mem-action:hover { background: rgba(var(--lavender-rgb), 0.14); border-color: rgba(var(--lavender-rgb), 0.4); }
.mem-action:focus-visible, .mem-action-link:focus-visible, .mem-action-danger:focus-visible {
  outline: 2px solid var(--lavender); outline-offset: 3px;
}
.mem-action-link, .mem-action-danger {
  background: none; border: 0; cursor: pointer; padding: 6px 4px;
  font: 500 0.75rem var(--ff-heading); color: var(--mute);
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: rgba(var(--lavender-rgb), .35);
}
.mem-action-link:hover { color: var(--text); text-decoration-color: var(--lavender); }
.mem-action-danger, .mem-action-danger-icon { color: rgba(229, 72, 77, 0.85); }
.mem-action-danger:hover, .mem-action-danger-icon:hover { color: #E5484D; }
.mem-action-danger-icon {
  background: none; border: 0; cursor: pointer;
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--mute); text-decoration: none;
  transition: background .15s, color .15s;
}
.mem-action-danger-icon:hover { background: rgba(229, 72, 77, 0.1); }
.mem-toolbar-spacer { flex: 1; }

/* ── Memory tools row — search, context, count, quiet trash ── */
.mem-tools {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.mem-search {
  display: inline-flex; align-items: center; gap: 7px; flex: 1 1 180px;
  min-width: 140px; height: 34px; padding: 0 12px;
  border-radius: var(--r-sm);
  background: rgba(var(--lavender-rgb), 0.06);
  border: 1px solid rgba(var(--lavender-rgb), 0.16);
  color: var(--mute);
  transition: border-color .15s;
}
.mem-search:focus-within { border-color: rgba(var(--lavender-rgb), 0.45); }
.mem-search svg { flex-shrink: 0; opacity: .7; }
.mem-search input {
  flex: 1; background: none; border: 0; outline: none;
  color: var(--text); font: 400 0.8rem var(--ff-body);
}
.mem-search input::placeholder { color: var(--mute); }
.mem-context-select {
  height: 34px; padding: 0 10px;
  border-radius: var(--r-sm);
  background: rgba(var(--lavender-rgb), 0.06);
  border: 1px solid rgba(var(--lavender-rgb), 0.16);
  color: var(--text); font: 500 0.76rem var(--ff-heading);
  cursor: pointer;
}
.mem-context-select:focus-visible { outline: 2px solid var(--lavender); outline-offset: 3px; }
.mem-count {
  font: 500 10px var(--ff-mono); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--mute); white-space: nowrap;
}
.mem-tools .mem-action-danger-icon { flex-shrink: 0; }
.mem-tools .mem-action-danger-icon.hidden { display: none; }

/* Classification badge shown on sovereign memory nodes */
.memory-class-badge {
  font-size: 0.56rem;
  font-family: var(--ff-heading);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
}
.memory-class-badge.official-sensitive {
  background: rgba(244, 185, 73, 0.18);
  color: #F4B949;
  border: 1px solid rgba(244, 185, 73, 0.4);
}
.memory-class-badge.protected {
  background: rgba(255, 117, 127, 0.18);
  color: #FF757F;
  border: 1px solid rgba(255, 117, 127, 0.4);
}
.memory-class-badge.official {
  background: rgba(95, 201, 184, 0.18);
  color: #5FC9B8;
  border: 1px solid rgba(95, 201, 184, 0.4);
}

.memory-graph {
  position: relative;
  min-height: 500px;
  overflow: hidden;
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-xl);
  /* This is a deliberately permanent-dark "starfield" canvas in BOTH themes
     (same reasoning as .canvas-code) — the nodes, edges and labels are all
     fixed light colors that only work on a dark backdrop. The base fill used
     to be translucent (rgba(6,5,11,0.62)), which let it show through to
     whatever sat behind it: in dark mode that's another near-black surface
     so it read fine, but in light mode it showed through to the white
     drawer and produced a muddy, washed-out gray panel instead of a clean
     dark card. Made opaque so it renders identically, deliberately dark, in
     both themes. */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.028), transparent 40%),
    radial-gradient(circle at 50% 45%, rgba(var(--lavender-rgb), 0.18), transparent 31%),
    radial-gradient(circle at 72% 24%, rgba(95, 201, 184, 0.08), transparent 28%),
    #06050b;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 24px 80px rgba(0,0,0,0.22);
}

.memory-graph::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(184,170,219,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184,170,219,0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 44%, black, transparent 72%);
  pointer-events: none;
}

.memory-aurora {
  position: absolute;
  inset: 18%;
  border-radius: var(--r-sm);
  background: conic-gradient(from 180deg, rgba(116,101,255,0.16), rgba(103,225,199,0.12), rgba(244,185,73,0.1), rgba(116,101,255,0.16));
  filter: blur(42px);
  opacity: 0.9;
  animation: memoryAurora 12s linear infinite;
}

.memory-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.memory-link {
  stroke-dasharray: 7 10;
  stroke-linecap: round;
  animation: memoryLineIn 0.8s ease both, memoryDash 18s linear infinite;
}

.memory-node {
  position: absolute;
  transform: translate(-50%, -50%) scale(0.92);
  min-width: 116px;
  max-width: 150px;
  padding: 10px 12px 11px;
  border: 1px solid rgba(var(--lavender-rgb), 0.18);
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(28, 25, 39, 0.92), rgba(16, 14, 24, 0.88));
  /* The memory graph is a permanently-dark "starfield" canvas in both themes
     (see .memory-graph background below), so node text must stay a fixed
     light color instead of following --athens, which flips to near-black
     text in light mode and would be unreadable on this dark node chip. */
  color: #f0eeff;
  font-family: var(--ff-heading);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 18px 55px rgba(0,0,0,0.36), inset 0 1px 0 rgba(255,255,255,0.05);
  transition: transform 0.22s var(--ease-spring), border-color 0.22s, box-shadow 0.22s, background 0.22s;
  z-index: 2;
  animation: memoryNodeIn 0.54s var(--ease-spring) both;
  animation-delay: var(--d);
}

.memory-node::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent 34%, rgba(var(--lavender-rgb),0.18));
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.memory-node:hover,
.memory-node.active {
  transform: translate(-50%, -50%) scale(1.04);
  border-color: rgba(var(--lavender-rgb), 0.62);
  box-shadow: 0 22px 70px rgba(0,0,0,0.42), 0 0 40px rgba(var(--lavender-rgb),0.2), inset 0 1px 0 rgba(255,255,255,0.08);
}

.memory-node:hover::after,
.memory-node.active::after { opacity: 1; }

.memory-node-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 7px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.07);
  font-size: 0.8rem;
  vertical-align: middle;
}

.memory-node-label {
  display: inline-block;
  max-width: 94px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  vertical-align: middle;
}

.memory-node-type {
  display: block;
  margin-top: 6px;
  padding-left: 31px;
  /* Same permanently-dark node background as .memory-node — keep a fixed
     light color instead of following --athens (see comment above). */
  color: rgba(240, 238, 255, 0.46);
  font-size: 0.61rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.memory-node.user_profile { background: linear-gradient(180deg, rgba(var(--lavender-rgb), 0.26), rgba(34, 27, 51, 0.9)); }
.memory-node.business { background: linear-gradient(180deg, rgba(95, 201, 184, 0.18), rgba(18, 34, 36, 0.9)); }
.memory-node.brand { background: linear-gradient(180deg, rgba(244, 185, 73, 0.18), rgba(39, 31, 19, 0.92)); }
.memory-node.palette { background: linear-gradient(180deg, rgba(184, 170, 219, 0.16), rgba(26, 22, 36, 0.92)); }
.memory-node.brand_asset { background: linear-gradient(180deg, rgba(118, 157, 255, 0.16), rgba(20, 24, 40, 0.92)); }
.memory-node.memory_fact,
.memory-node.chatbot_history { background: linear-gradient(180deg, rgba(255,255,255,0.065), rgba(16,14,22,0.92)); }

.memory-detail {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(var(--lavender-rgb), 0.11);
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(var(--lavender-rgb), 0.025));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.memory-detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.memory-detail-orb {
  width: 42px;
  height: 42px;
  border-radius: var(--r-lg);
  display: grid;
  place-items: center;
  background: rgba(var(--lavender-rgb), 0.14);
  border: 1px solid rgba(var(--lavender-rgb), 0.18);
  box-shadow: 0 12px 30px rgba(0,0,0,0.22);
}

.memory-detail-title {
  font-family: var(--ff-heading);
  font-size: 1.05rem;
  font-weight: 850;
  color: var(--white);
  letter-spacing: -0.03em;
}

.memory-detail-meta {
  margin-top: 3px;
  font-size: 0.72rem;
  color: rgba(var(--athens-rgb), 0.45);
  text-transform: capitalize;
}

.memory-detail-summary {
  margin: 0 0 14px;
  color: rgba(var(--athens-rgb), 0.68);
  line-height: 1.6;
  font-size: 0.86rem;
}

.memory-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.memory-field {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
  border-radius: var(--r-md);
  background: rgba(0,0,0,0.14);
}

.memory-field span {
  display: block;
  margin-bottom: 4px;
  color: rgba(var(--athens-rgb), 0.38);
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.memory-field strong {
  display: block;
  overflow: hidden;
  color: rgba(var(--athens-rgb), 0.78);
  font-size: 0.78rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memory-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: rgba(var(--athens-rgb), 0.52);
}

.memory-empty strong { color: var(--athens); font-family: var(--ff-heading); }
.memory-empty span { max-width: 320px; font-size: 0.82rem; }
.memory-detail-empty { color: rgba(var(--athens-rgb), 0.45); font-size: 0.84rem; }

.memory-loader {
  width: 28px;
  height: 28px;
  justify-self: center;
  border-radius: 50%;
  border: 2px solid rgba(var(--lavender-rgb), 0.14);
  border-top-color: rgba(var(--lavender-rgb), 0.85);
  animation: memorySpin 0.8s linear infinite;
}

@keyframes memoryNodeIn {
  from { opacity: 0; transform: translate(-50%, -42%) scale(0.82); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(0.92); }
}

@keyframes memoryLineIn {
  from { opacity: 0; stroke-dashoffset: 24; }
  to { opacity: 1; stroke-dashoffset: 0; }
}

@keyframes memoryDash { to { stroke-dashoffset: -240; } }
@keyframes memorySpin { to { transform: rotate(360deg); } }
@keyframes memoryAurora { to { transform: rotate(360deg); } }

.memory-graph .mem-svg {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 500px;
  user-select: none;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
}
.memory-graph .mem-svg.is-grabbing { cursor: grabbing; }

.memory-graph .memory-orbit {
  fill: none;
  stroke: rgba(196, 156, 224, 0.08);
  stroke-width: 1;
  stroke-dasharray: 3 5;
  pointer-events: none;
}

.memory-graph .memory-edge {
  stroke: rgba(196, 156, 224, 0.22);
  stroke-width: 1;
  pointer-events: none;
  transition: stroke 180ms var(--ease-out), stroke-width 180ms var(--ease-out), opacity 180ms var(--ease-out);
}

.memory-graph .memory-edge.active {
  stroke: rgba(255, 255, 255, 0.78);
  stroke-width: 1.6;
}

.memory-graph .memory-edge.dimmed { stroke: rgba(196, 156, 224, 0.05); stroke-width: 0.5; }

.memory-graph .memory-center { fill: url(#memCenter); pointer-events: none; filter: drop-shadow(0 0 18px rgba(196,156,224,0.38)); }
.memory-graph .memory-center-label {
  pointer-events: none;
  fill: #fff;
  font-family: var(--ff-heading);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
  pointer-events: none;
}

.memory-graph .memory-node {
  position: static;
  min-width: 0;
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
  transform: none;
  animation: memorySvgNodeIn 0.48s var(--ease-spring) both;
  animation-delay: var(--d);
  transition: opacity 180ms var(--ease-out);
}

.memory-graph .memory-node.dimmed { opacity: 0.16; }
.memory-graph .memory-node-halo {
  fill: var(--node-color);
  opacity: 0.18;
  transition: opacity 180ms var(--ease-out), r 180ms var(--ease-spring);
}
.memory-graph .memory-node-circle {
  fill: var(--node-color);
  stroke: rgba(255,255,255,0.36);
  stroke-width: 1.5;
  transition: r 180ms var(--ease-spring), stroke 180ms var(--ease-out), filter 180ms var(--ease-out);
}
.memory-graph .memory-node-glyph {
  fill: rgba(10, 8, 18, 0.78);
  font-family: var(--ff-heading);
  font-size: 7px;
  font-weight: 950;
  pointer-events: none;
}
.memory-graph .memory-node-label {
  fill: rgba(237, 233, 244, 0.82);
  font-family: var(--ff-body);
  font-size: 9px;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(8, 6, 16, 0.7);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}
.memory-graph .memory-node:hover .memory-node-circle,
.memory-graph .memory-node.active .memory-node-circle {
  stroke: rgba(255,255,255,0.82);
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.62));
}
.memory-graph .memory-node:hover .memory-node-halo,
.memory-graph .memory-node.active .memory-node-halo { opacity: 0.48; }
.memory-graph .memory-node:hover .memory-node-label,
.memory-graph .memory-node.active .memory-node-label {
  fill: #fff;
  font-weight: 850;
}

.memory-graph .memory-node.active .memory-node-halo {
  opacity: 0.55;
  r: 36;
}
.memory-graph .memory-node.active .memory-node-circle {
  stroke: #fff;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 12px rgba(255,255,255,0.85));
}

.memory-graph .memory-viewport {
  transition: transform 0.35s var(--ease-out);
}
.memory-graph.is-dragging .memory-viewport,
.memory-graph.is-pinch-zooming .memory-viewport {
  transition: none;
}

.memory-tooltip {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  max-width: 220px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: rgba(16, 14, 26, 0.94);
  border: 1px solid rgba(var(--lavender-rgb), 0.25);
  box-shadow: 0 14px 40px rgba(0,0,0,0.35);
  /* Tooltip background is a fixed dark chip in both themes — keep text
     fixed-light instead of following --athens (flips dark in light mode). */
  color: #f0eeff;
  font-size: 0.75rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  transition: opacity 0.18s, transform 0.18s var(--ease-out);
}
.memory-tooltip.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.memory-tooltip strong {
  display: block;
  color: #fff;
  font-weight: 800;
  margin-bottom: 2px;
}
.memory-tooltip span {
  color: rgba(240, 238, 255, 0.65);
}

@keyframes memorySvgNodeIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

/* Memory graph zoom controls */
.memory-graph-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mem-ctrl-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--lavender-rgb), 0.18);
  border-radius: var(--r-sm);
  background: rgba(20, 16, 30, 0.72);
  backdrop-filter: blur(8px);
  /* Fixed dark chip in both themes — keep icon color fixed-light. */
  color: rgba(240, 238, 255, 0.7);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 160ms var(--ease-out);
}
.mem-ctrl-btn:hover {
  border-color: rgba(var(--lavender-rgb), 0.45);
  color: #fff;
  background: rgba(var(--lavender-rgb), 0.12);
}

/* Memory graph — cluster node badges */
.memory-graph .memory-cluster-badge {
  fill: #2D2769;
  stroke: rgba(255,255,255,0.5);
  stroke-width: 1;
  transition: fill 180ms var(--ease-out);
}
.memory-graph .memory-cluster-count {
  fill: #fff;
  font-family: var(--ff-heading);
  font-size: 7px;
  font-weight: 850;
  text-anchor: middle;
  pointer-events: none;
}
.memory-graph .cluster-node .memory-node-circle {
  stroke-dasharray: 4 3;
  cursor: pointer;
}
.memory-graph .cluster-node.expanded .memory-node-circle {
  stroke: rgba(255,255,255,0.9);
  stroke-dasharray: none;
}
.memory-graph .cluster-node:hover .memory-cluster-badge {
  fill: #4a3a6e;
}

/* Memory graph — +N more label */
.memory-graph .memory-more-label,
.memory-graph .memory-cluster-badge,
.memory-graph .memory-cluster-count {
  /* Always-dark SVG canvas — fixed light fill regardless of theme. */
  fill: rgba(240, 238, 255, 0.4);
  font-family: var(--ff-body);
  font-size: 8px;
  font-weight: 600;
  pointer-events: none;
}

/* Memory graph — grab cursor for panning */
.memory-graph .mem-svg { cursor: grab; }
.memory-graph .mem-svg:active { cursor: grabbing; }

/* Memory detail — fact list */
.memory-facts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.memory-fact-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
  border-radius: var(--r-sm);
  background: rgba(0,0,0,0.14);
}
.memory-fact-num {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: rgba(var(--lavender-rgb), 0.18);
  color: var(--lavender);
  font-family: var(--ff-heading);
  font-size: 0.7rem;
  font-weight: 850;
}
.memory-fact-text {
  color: rgba(var(--athens-rgb), 0.72);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* Memory detail action buttons */
.memory-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.memory-action-btn {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  border-radius: var(--r-sm);
  background: rgba(var(--lavender-rgb), 0.06);
  color: rgba(var(--athens-rgb), 0.7);
  font-family: var(--ff-heading);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
}
.memory-action-btn:hover {
  background: rgba(var(--lavender-rgb), 0.12);
  color: var(--white);
  border-color: rgba(var(--lavender-rgb), 0.35);
}
.memory-action-btn.danger:hover {
  background: rgba(var(--danger-rgb), 0.1);
  color: var(--danger);
  border-color: rgba(var(--danger-rgb), 0.25);
}

/* Memory editor form */
.memory-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.memory-editor-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.memory-editor-label {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(var(--athens-rgb), 0.45);
  margin-top: 4px;
}
.memory-editor-select,
.memory-editor-input,
.memory-editor-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-md);
  background: rgba(0,0,0,0.18);
  color: var(--athens);
  font-family: var(--ff-body);
  font-size: 0.82rem;
}
.memory-editor-textarea {
  resize: vertical;
  min-height: 60px;
  font-family: var(--ff-mono);
  font-size: 0.76rem;
  line-height: 1.5;
}
.memory-editor-range {
  width: 100%;
  accent-color: var(--lavender);
}
.memory-editor-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.memory-editor-actions .modal-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-md);
  background: rgba(var(--lavender-rgb), 0.06);
  color: rgba(var(--athens-rgb), 0.6);
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.memory-editor-actions .modal-btn:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--white);
}
.memory-editor-save {
  flex: 1;
  padding: 10px;
  margin-top: 0;
}

/* Memory edges list */
.memory-edges-section {
  margin-top: 14px;
}
.memory-edges-title {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(var(--athens-rgb), 0.45);
  margin-bottom: 8px;
}
.memory-edge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
  border-radius: var(--r-sm);
  background: rgba(0,0,0,0.1);
  margin-bottom: 4px;
}
.memory-edge-dir {
  color: var(--lavender);
  font-size: 0.75rem;
  font-weight: 800;
}
.memory-edge-label {
  flex: 1;
  color: rgba(var(--athens-rgb), 0.75);
  font-size: 0.78rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.memory-edge-type {
  font-size: 0.62rem;
  color: rgba(var(--athens-rgb), 0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.memory-edge-unlink {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--danger-rgb), 0.15);
  border-radius: var(--r-xs);
  background: rgba(var(--danger-rgb), 0.06);
  color: rgba(var(--danger-rgb), 0.7);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.memory-edge-unlink:hover {
  background: rgba(var(--danger-rgb), 0.15);
  color: var(--danger);
  border-color: rgba(var(--danger-rgb), 0.3);
}

/* Link mode visual state */
.memory-graph.link-mode .mem-svg {
  cursor: crosshair;
}
.memory-graph.link-mode::after {
  content: 'Click a node to connect';
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: rgba(var(--lavender-rgb), 0.18);
  border: 1px solid rgba(var(--lavender-rgb), 0.3);
  color: var(--lavender);
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 700;
  pointer-events: none;
  animation: memoryPulseLink 1.5s ease-in-out infinite;
}
@keyframes memoryPulseLink {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* Conv settings actions */
.conv-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.conv-action-btn {
  flex: 1;
  padding: 10px;
  background: rgba(var(--lavender-rgb), 0.06);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-sm);
  color: rgba(var(--athens-rgb), 0.6);
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.conv-action-btn:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--white);
}

.conv-action-btn.danger:hover {
  background: rgba(var(--danger-rgb), 0.1);
  color: var(--danger);
  border-color: rgba(var(--danger-rgb), 0.2);
}

/* ─── Toast ─────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 360px;
}

.toast {
  padding: 10px 20px;
  background: var(--s3);
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-family: var(--ff-heading);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--athens);
  animation: toastIn 0.4s var(--ease-spring);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success { border-color: rgba(var(--ok-rgb), 0.3); }
.toast.success::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.toast.error { border-color: rgba(var(--danger-rgb), 0.3); }
.toast.error::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }
.toast.warn { border-color: rgba(255, 200, 140, 0.3); }
.toast.warn::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #ffc88c; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-8px); }
}

/* ─── Input Footer Tools ────────────────────────────────── */
.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px 10px;
  gap: 8px;
  max-width: 900px;
  margin: 0 auto;
}

.input-tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; position: relative; }

/* The Glow badge sits in the tool row beside attach and the brand selector */
.input-tools .usage-pill {
  gap: 5px;
  padding: 5px 11px;
  min-height: 28px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.input-tools .usage-pill.hidden { display: none; }

/* Divider between selectors (model/business) and tool toggles */
.input-tools-divider {
  width: 1px;
  height: 16px;
  background: rgba(var(--lavender-rgb), 0.1);
  flex-shrink: 0;
  margin: 0 3px;
}

.input-tool-btn[hidden],
#obChatMic,
#irisMicBtn,
#recorderPanel,
.drawer-tab[data-tab="recorder"] {
  display: none !important;
}

.input-tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: transparent;
  border: none;
  border-radius: var(--r-md);
  color: rgba(var(--athens-rgb), 0.45);
  cursor: pointer;
  transition: all 0.18s var(--ease-smooth);
  -webkit-tap-highlight-color: transparent;
}

/* Desktop: hide web search toggle — it lives in the "+" popover.
   Image and map generation are intent-based now (no mode toggles). */
@media (min-width: 769px) {
  .input-tools > .input-tool-btn#btnWebSearch {
    display: none;
  }
  /* When web search is active, show it inline so the user sees the state */
  .input-tools > .input-tool-btn#btnWebSearch.active {
    display: flex;
  }
}

.input-tool-btn:hover {
  color: var(--lavender);
  background: rgba(var(--lavender-rgb), 0.1);
}

.input-tool-btn:active {
  transform: scale(0.94);
}

/* Attach button — icon only, no background fill on hover/active.
   Keeps the color shift for affordance but stays visually quiet. */
.input-tool-btn#btnAttach,
.input-tool-btn#btnAttach:hover,
.input-tool-btn#btnAttach.active {
  background: transparent;
}

/* Toggle buttons — clear active state with colored fill */
.input-toggle.active {
  background: rgba(var(--lavender-rgb), 0.18);
  color: var(--lavender);
}

.input-toggle.active::after {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lavender);
  flex-shrink: 0;
  margin-left: 2px;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

/* Legacy active state for non-toggle buttons */
.input-tool-btn.active {
  background: rgba(var(--lavender-rgb), 0.15);
  color: var(--lavender);
}

/* ── Mode banner — colored strip above textarea ── */
.input-mode-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-family: var(--ff-heading);
  font-size: 0.75rem;
  font-weight: 600;
  border-bottom: none;
  animation: modeBannerIn 0.25s var(--ease-spring);
}

.input-mode-banner[hidden] { display: none; }

@keyframes modeBannerIn {
  from { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }
  to { opacity: 1; max-height: 40px; }
}

.input-mode-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.input-mode-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.input-mode-exit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--r-xs);
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.15s;
  flex-shrink: 0;
}

.input-mode-exit:hover {
  opacity: 1;
  background: rgba(255,255,255,0.1);
}

/* Mode-specific colors */
.input-mode-banner.mode-image {
  background: rgba(196, 181, 253, 0.08);
  color: #c4b5fd;
}
.input-mode-banner.mode-map {
  background: rgba(167, 243, 208, 0.08);
  color: #a7f3d0;
}
.input-mode-banner.mode-web {
  background: rgba(125, 211, 252, 0.08);
  color: #7dd3fc;
}

[data-theme="light"] .input-mode-banner.mode-image {
  background: rgba(123, 97, 209, 0.08);
  color: #6d5cc4;
}
[data-theme="light"] .input-mode-banner.mode-map {
  background: rgba(16, 122, 87, 0.08);
  color: #107a57;
}
[data-theme="light"] .input-mode-banner.mode-web {
  background: rgba(14, 116, 144, 0.08);
  color: #0e7490;
}

.input-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Mini usage pill with progress bar */
.usage-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: rgba(var(--lavender-rgb), 0.05);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  color: rgba(var(--athens-rgb), 0.45);
  cursor: help;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.usage-pill:hover {
  border-color: rgba(var(--lavender-rgb), 0.22);
  background: rgba(var(--lavender-rgb), 0.08);
}
.usage-pill svg {
  color: var(--lavender);
  opacity: 0.7;
  flex-shrink: 0;
}
.usage-pill-text {
  font-family: var(--ff-heading);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.usage-pill-track {
  width: 42px;
  height: 3px;
  border-radius: 2px;
  background: rgba(var(--athens-rgb), 0.08);
  overflow: hidden;
  flex-shrink: 0;
}
.usage-pill-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--jacarta), var(--lavender));
  transition: width 0.5s ease;
}
.usage-pill-fill.warn { background: linear-gradient(90deg, #b3541e, #ffa94d); }
.usage-pill-fill.danger { background: linear-gradient(90deg, #c22, #ff6b6b); }

/* AI accuracy disclaimer — enterprise/government requirement */
.ai-disclaimer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px 2px;
  font-family: var(--ff-heading);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(var(--athens-rgb), 0.32);
  user-select: none;
  position: relative;
  flex-wrap: wrap;
}
.ai-disclaimer svg {
  flex-shrink: 0;
  opacity: 0.55;
}

/* ─── Tool Use Indicator ────────────────────────────────── */
.tool-use-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(var(--jacarta-rgb), 0.3);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-md);
  margin: 0 0 8px;
  font-family: var(--ff-heading);
  font-size: 0.75rem;
  color: var(--lavender);
  animation: msgIn 0.25s var(--ease-spring);
}

.tool-use-banner svg {
  flex-shrink: 0;
  animation: orbitSpin 1.5s linear infinite;
}

.tool-use-banner.done svg { animation: none; color: var(--ok); }
.tool-use-banner.done { color: rgba(var(--athens-rgb), 0.5); }

.tool-use-banner .tool-query-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tool-use-banner .tool-query-list li {
  font-size: 0.7rem;
  color: rgba(var(--athens-rgb), 0.5);
  padding-left: 12px;
  position: relative;
}
.tool-use-banner .tool-query-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--lavender);
  opacity: 0.6;
}

/* ─── Image Generation Placeholder ─────────────────────── */
.img-gen-placeholder {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-lg, 16px);
  overflow: hidden;
  background: rgba(var(--jacarta-rgb), 0.15);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
}

.img-gen-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    transparent 25%,
    rgba(var(--lavender-rgb), 0.08) 37%,
    rgba(var(--lavender-rgb), 0.15) 50%,
    rgba(var(--lavender-rgb), 0.08) 63%,
    transparent 75%
  );
  background-size: 200% 100%;
  animation: imgShimmer 2s ease-in-out infinite;
}

@keyframes imgShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.img-gen-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
}

.img-gen-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(var(--lavender-rgb), 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lavender);
  animation: imgIconPulse 2s ease-in-out infinite;
}

@keyframes imgIconPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.08); opacity: 1; }
}

.img-gen-status {
  font-family: var(--ff-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.8);
  letter-spacing: -0.01em;
}

.img-gen-prompt {
  font-size: 0.75rem;
  color: rgba(var(--athens-rgb), 0.4);
  text-align: center;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.img-gen-timer {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  color: rgba(var(--lavender-rgb), 0.6);
  background: rgba(var(--jacarta-rgb), 0.2);
  padding: 3px 10px;
  border-radius: var(--r-sm);
}

.img-gen-placeholder.done {
  animation: imgFadeOut 0.4s ease forwards;
}

@keyframes imgFadeOut {
  to { opacity: 0; transform: scale(0.95); }
}

/* ─── DotGrid: the joyful "creating image" state ───────────
   A glowing dot lattice that warms lavender → gold as the render completes.
   Drawn by assets/js/dot-grid.js; this is only the frame around it. */
.dotgrid {
  --dg-p: 0;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  height: clamp(260px, 38vw, 420px);
  border-radius: var(--r-lg, 14px);
  background:
    radial-gradient(120% 90% at 50% 100%, rgba(var(--lavender-rgb), 0.10), transparent 60%),
    rgba(var(--s0-rgb), 0.55);
  border: 1px solid rgba(var(--lavender-rgb), 0.14);
}
.dotgrid-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block; z-index: 1;
  transition: opacity 0.35s ease;
}
.dotgrid-preview {
  position: absolute; inset: -8%;
  background-size: cover; background-position: center;
  filter: blur(18px) saturate(1.2);
  opacity: 0; z-index: 0;
  transition: opacity 0.6s ease;
}
.dotgrid.has-preview .dotgrid-preview { opacity: calc(0.18 + 0.5 * var(--dg-p, 0)); }
.dotgrid-title {
  position: absolute; top: 16px; left: 18px; z-index: 2;
  font-family: var(--ff-heading);
  font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em;
  color: var(--text-primary, var(--text));
  text-shadow: 0 0 10px rgba(var(--s0-rgb), 0.95), 0 1px 2px rgba(var(--s0-rgb), 0.8);
  animation: dgTitleGlow 2.4s ease-in-out infinite;
}
@keyframes dgTitleGlow { 0%, 100% { opacity: 0.72; } 50% { opacity: 1; } }
.dotgrid-status {
  position: absolute; top: 38px; left: 18px; right: 110px; z-index: 2;
  font-size: 0.78rem; color: var(--text-secondary, rgba(var(--lavender-rgb), 0.8));
  text-shadow: 0 0 8px rgba(var(--s0-rgb), 0.95);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dotgrid-status:empty { display: none; }
.dotgrid-pill {
  position: absolute; right: 14px; bottom: 14px; z-index: 2;
  padding: 5px 12px; border-radius: 999px;
  font-family: var(--ff-mono); font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--lavender);
  background: rgba(var(--s2-rgb), 0.75);
  border: 1px solid rgba(var(--lavender-rgb), 0.22);
  backdrop-filter: blur(6px);
}
.dotgrid.is-done .dotgrid-canvas { opacity: 0; }
.dotgrid.is-done .dotgrid-title,
.dotgrid.is-done .dotgrid-status { opacity: 0; transition: opacity 0.25s ease; animation: none; }

.artifact-card-preview--dots,
.artifact-card.generating .artifact-card-preview--dots {
  display: block; min-height: 0; cursor: default; background: none;
}
.img-gen-placeholder.img-gen-dots {
  max-width: 100%; aspect-ratio: auto;
  background: none; border: none; border-radius: 0; overflow: visible;
}
.img-gen-prompt--below { max-width: 100%; margin-top: 8px; text-align: left; }

@media (prefers-reduced-motion: reduce) {
  .dotgrid-title { animation: none; }
  .dotgrid-canvas, .dotgrid-preview { transition: none; }
}

/* ─── Confirm Modal ─────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.open { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--s2);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(var(--jacarta-rgb), 0.4);
  padding: 32px 28px 24px;
  width: 360px;
  max-width: calc(100vw - 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: modalIn 0.3s var(--ease-spring);
  text-align: center;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(var(--danger-rgb), 0.1);
  border: 1px solid rgba(var(--danger-rgb), 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--danger);
  margin-bottom: 4px;
}

.modal-title {
  font-family: var(--ff-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
}

.modal-message {
  font-size: 0.85rem;
  color: rgba(var(--athens-rgb), 0.6);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  width: 100%;
}

.modal-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  font-family: var(--ff-heading);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
}

.modal-btn.cancel {
  background: rgba(var(--lavender-rgb), 0.06);
  color: rgba(var(--athens-rgb), 0.6);
}

.modal-btn.cancel:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--white);
}

.modal-btn.danger {
  background: rgba(var(--danger-rgb), 0.1);
  border-color: rgba(var(--danger-rgb), 0.25);
  color: var(--danger);
}

.modal-btn.danger:hover {
  background: rgba(var(--danger-rgb), 0.2);
  box-shadow: 0 4px 16px rgba(var(--danger-rgb), 0.15);
  transform: translateY(-1px);
}

/* ─── Iterate Modal ────────────────────────────────────── */
.modal-lg {
  max-width: 540px;
  width: 90%;
}

.iterate-icon {
  background: rgba(var(--lavender-rgb), 0.12);
  color: var(--lavender);
}

.iterate-textarea {
  width: 100%;
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(var(--lavender-rgb), 0.04);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-md);
  color: var(--white);
  font-family: var(--ff-body);
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.iterate-textarea:focus {
  outline: none;
  border-color: rgba(var(--lavender-rgb), 0.35);
  box-shadow: 0 0 0 3px rgba(var(--lavender-rgb), 0.08);
}

.iterate-textarea::placeholder {
  color: rgba(var(--athens-rgb), 0.3);
}

.modal-btn.primary {
  background: rgba(var(--lavender-rgb), 0.15);
  border-color: rgba(var(--lavender-rgb), 0.3);
  color: var(--lavender);
}

.modal-btn.primary:hover {
  background: rgba(var(--lavender-rgb), 0.25);
  box-shadow: 0 4px 16px rgba(var(--lavender-rgb), 0.15);
  transform: translateY(-1px);
}

/* ─── Conversation Context Menu ─────────────────────────── */
.context-menu {
  position: fixed;
  background: var(--s3);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  min-width: 180px;
  display: none;
  flex-direction: column;
  padding: 4px;
  animation: ctxIn 0.15s var(--ease-spring);
}

.context-menu.open { display: flex; }

@keyframes ctxIn {
  from { opacity: 0; transform: scale(0.95) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: rgba(var(--athens-rgb), 0.7);
  font-family: var(--ff-heading);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s;
}

.ctx-item:hover { background: rgba(var(--lavender-rgb), 0.08); color: var(--white); }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover { background: rgba(var(--danger-rgb), 0.1); }

.ctx-divider {
  height: 1px;
  background: rgba(var(--lavender-rgb), 0.06);
  margin: 4px 0;
}

@keyframes athenaCtxIn {
  from { opacity: 0; transform: scale(0.92) translateY(-6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Header */

/* Usage bar + sparkline */

/* Divider */

/* Items */

/* Light theme */

/* ── Mobile: long-press context menu ── */
@media (max-width: 768px) {
  /* Prevent iOS text-selection callout and highlight on long-press */
  .msg, .chat-main, .messages, .sidebar, .conv-list {
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
  }
  /* But allow text selection within message content for manual copy */
  .msg-content, .msg-content * {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
  }
}

/* ─── Message Edit / Regenerate ─────────────────────────── */
.msg-action-btn.edit-active { color: var(--lavender); background: rgba(var(--lavender-rgb), 0.14); }

.msg-edit-wrap {
  margin-top: 8px;
  display: none;
}

.msg-edit-wrap.open { display: block; }

.msg-edit-textarea {
  width: 100%;
  background: rgba(var(--jacarta-rgb), 0.2);
  border: 1px solid rgba(var(--lavender-rgb), 0.2);
  border-radius: var(--r-md);
  color: var(--athens);
  font-family: var(--ff-body);
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 10px 14px;
  outline: none;
  resize: vertical;
  min-height: 60px;
}

.msg-edit-textarea:focus {
  border-color: rgba(var(--lavender-rgb), 0.4);
}

.msg-edit-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.msg-edit-btn {
  padding: 5px 14px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-family: var(--ff-heading);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.msg-edit-btn.save {
  background: rgba(var(--lavender-rgb), 0.15);
  border-color: rgba(var(--lavender-rgb), 0.3);
  color: var(--lavender);
}

.msg-edit-btn.save:hover {
  background: rgba(var(--lavender-rgb), 0.25);
}

.msg-edit-btn.cancel {
  background: transparent;
  border-color: rgba(var(--lavender-rgb), 0.08);
  color: rgba(var(--athens-rgb), 0.4);
}

.msg-edit-btn.cancel:hover { color: var(--white); }

/* ─── iOS Safe Areas ────────────────────────────────────── */
.app {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Standalone mode: no browser chrome */
@media (display-mode: standalone) {
  .chat-header { padding-top: max(12px, env(safe-area-inset-top)); }
  .input-area { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .voice-mode { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .voice-mode-close { top: max(24px, calc(env(safe-area-inset-top) + 8px)); }
  .voice-mode-help { top: max(24px, calc(env(safe-area-inset-top) + 8px)); }
  .voice-mode-footer { bottom: max(48px, calc(env(safe-area-inset-bottom) + 24px)); }
  /* Landscape PWA: notch/Dynamic Island cuts into left/right edges */
  .app { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .drawer { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .sidebar { padding-left: env(safe-area-inset-left); }
}

/* Mobile browsers: ensure input bar clears browser chrome + home indicator */
@media (max-width: 600px) {
  .input-area {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* ─── Touch optimizations ───────────────────────────────── */
@media (pointer: coarse) {
  button, .input-tool-btn, .conv-item, .model-option, .iris-pill {
    min-height: 44px;
    min-width: 44px;
  }
  .input-tool-btn { padding: 10px 14px; }
  .conv-item { padding: 14px 16px; }
  .send-btn, .mic-btn, .stop-btn { width: 44px; height: 44px; }
  .msg-action-btn { min-height: 44px; min-width: 44px; padding: 6px 10px; }
  .code-action-btn { min-height: 44px; padding: 8px 12px; }
  .header-icon-btn { width: 40px; height: 40px; }
  .sidebar-footer-btn { width: 40px; height: 40px; }
  .studio-launch-btn { width: 40px; height: 40px; }
  .canvas-action-btn { width: 40px; height: 40px; }
  .voice-mode-btn { width: 48px; height: 48px; }
  .voice-mode-close, .voice-mode-help { width: 42px; height: 42px; }
  .model-selector-btn { min-height: 40px; padding: 8px 12px; }
  .msg-actions { opacity: 1; }
}

/* ─── Responsive: Tablet (≤900px) ───────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 300px; }
  .sidebar-collapse-btn { display: none; }
  .canvas-panel.open { width: 100%; min-width: 0; position: absolute; inset: 0; z-index: 50; }
  .model-dropdown { width: 300px; }
  .msg-actions { opacity: 1; }
  .input-area { padding: 0 0 12px; }
  .input-wrap { max-width: 100%; }
}

/* ─── Responsive: Phone (≤600px) ────────────────────────── */
@media (max-width: 600px) {
  .msg { padding: 12px 14px; gap: 10px; }
  .msg-avatar { width: 28px; height: 28px; flex-shrink: 0; }
  .msg-content { font-size: 0.9rem; line-height: 1.65; }
  .msg-content h1 { font-size: 1.2rem; }
  .msg-content h2 { font-size: 1.05rem; }
  .msg-content h3 { font-size: 0.95rem; }
  .msg-content p { margin: 8px 0; }
  .msg-content ul, .msg-content ol { padding-left: 20px; margin: 8px 0; }
  .msg-content li { margin: 4px 0; }
  .msg-content blockquote { padding: 10px 14px; margin: 12px 0; }
  .msg-content th, .msg-content td { padding: 8px 10px; font-size: 0.82rem; }
  .msg-content pre { padding: 14px 16px; font-size: 0.78rem; }
  .msg-actions { flex-wrap: wrap; gap: 3px; }
  .msg-action-btn { font-size: 0.68rem; padding: 5px 8px; gap: 3px; }
  .msg-action-btn span { display: none; }
  .msg-action-btn svg { width: 14px; height: 14px; }
  .code-block { margin: 12px 0; border-radius: var(--r-md); }
  .code-block-header { padding: 8px 12px; }
  /* Inline map — smaller canvas, full-width fields panel on mobile */
  .artifact-card-map-canvas { height: 350px; }
  .imr-hint { display: none; }
  .imr-fields-panel { width: 100%; }
  .imr-fields-panel[data-hidden="true"] { transform: translateY(100%); }
  .imr-fields-panel { top: auto; bottom: 0; height: 60%; border-left: none; border-top: 1px solid rgba(152,137,192,0.12); }
  /* Image cards — smaller preview on mobile */
  .artifact-card-preview img { max-height: 280px; }
  .artifact-card-body { padding: 10px 12px; }
  .artifact-card-prompt { font-size: 12px; }
  .artifact-card-actions { gap: 4px; }
  .artifact-card-btn { padding: 4px 8px; font-size: 11px; }
  .artifact-card-btn span { display: none; }
  .artifact-card-btn svg { width: 14px; height: 14px; }
  .code-block-lang { font-size: 0.62rem; }
  .code-block-lines { font-size: 0.58rem; }
  .code-block pre { padding: 14px 16px; font-size: 0.76rem; max-height: 300px; }
  .streaming-code-block .streaming-code-pre { padding: 14px 16px; font-size: 0.76rem; max-height: 300px; }
  .code-block-footer { padding: 8px 12px; min-height: 42px; }
  .code-action-btn { font-size: 0.68rem; padding: 6px 10px; gap: 4px; }
  .code-action-btn span { display: none; }
  .code-block-truncated .code-block-expand { bottom: 36px; }
  .chat-header { padding: 0 10px; height: 52px; }
  .chat-header-left { gap: 8px; }
  .model-selector-btn { padding: 6px 10px; }
  .model-selector-btn .model-name { max-width: 140px; }
  .studio-launch-btn { width: 34px; height: 34px; }
  .header-icon-btn { width: 34px; height: 34px; }
  .input-area { padding: 0 0 max(12px, env(safe-area-inset-bottom)); }
  .input-wrap { border-radius: 0; }
  .input-row { padding: 12px 16px 6px; gap: 6px; }
  .input-row textarea { font-size: 16px; line-height: 1.5; }
  .input-footer { padding: 6px 16px 8px; gap: 4px; flex-wrap: wrap; }
  .input-tool-btn { padding: 8px 10px; font-size: 0.72rem; }
  .input-footer-hint { display: none; }
  .input-footer-right { gap: 8px; }
  .ai-disclaimer { flex-wrap: nowrap; white-space: nowrap; font-size: 0.58rem; padding: 4px 8px 2px; }
  .ai-disclaimer > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .ai-disclaimer-sep, .ai-disclaimer-mem { display: none; }
  .send-btn, .stop-btn, .mic-btn { width: 38px; height: 38px; }
  .welcome { padding: 20px 16px; }
  .welcome-orb { width: 72px; height: 72px; margin-bottom: 18px; }
  .welcome-orb-core { width: 40px; height: 40px; }
  .welcome-orb-core img { width: 24px; height: 24px; }
  .welcome-orb-ring-1 { width: 56px; height: 56px; }
  .welcome-orb-ring-2 { width: 64px; height: 64px; }
  .welcome-orb-ring-3 { width: 72px; height: 72px; }
  .welcome-title { font-size: 1.25rem; }
  .welcome-subtitle { font-size: 0.78rem; }
  .welcome-sub { font-size: 0.82rem; margin-bottom: 24px; }
  .roladex { max-width: calc(100vw - 32px); }
  .roladex-card { font-size: 0.78rem; padding: 10px 18px; }
  .model-dropdown { width: calc(100vw - 24px); left: -12px; max-height: 60vh; }
  .voice-orb { width: 140px; height: 140px; }
  .voice-orb-core { width: 84px; height: 84px; }
  .voice-orb-core img { width: 52px; height: 52px; }
  .voice-orb-ring-2 { inset: -10px; }
  .voice-orb-ring-3 { inset: -20px; }
  .voice-dot { width: 7px; height: 7px; }
  .voice-mode-dots { gap: 7px; }
  .voice-mode-transcript { font-size: 0.82rem; max-width: 300px; padding: 0 16px; }
  .voice-mode-footer { bottom: 32px; gap: 12px; }
  .voice-mode-btn { width: 48px; height: 48px; }
  .voice-mode-close, .voice-mode-help { top: 16px; width: 38px; height: 38px; }
  .voice-mode-help { right: 62px; }
  .iris-header { padding: 12px 16px; }
  .iris-body { padding: 12px; gap: 12px; }
  .iris-canvas { min-height: 220px; border-radius: var(--r-md); }
  .canvas-command-panel { padding: 12px; border-radius: var(--r-xl); }
  .iris-prompt { font-size: 16px; padding: 14px 46px 16px 14px; min-height: 132px; }
  .iris-options { flex-direction: column; align-items: stretch; gap: 10px; }
  .iris-options-left { justify-content: center; }
  .iris-aspect-pills { justify-content: center; }
  .iris-generate { width: 100%; justify-content: center; padding: 14px; }
  .iris-adv-row { flex-direction: column; }
  .iris-advanced { padding: 14px; gap: 14px; }
  .iris-negative { font-size: 16px; }
  .settings-drawer, .conv-settings-drawer, .onboarding-drawer, .memory-drawer, .users-drawer, #overlayInspectorDrawer { width: 100vw !important; max-width: 100vw; }
  .onboarding-body { padding: 14px; }
  .onboarding-hero { grid-template-columns: 1fr; padding: 18px; }
  .onboarding-grid.two, .onboarding-grid.three { grid-template-columns: 1fr; }
  .settings-body { padding: 14px; }
  .settings-section { padding: 14px; }
  .memory-drawer { width: 100vw; }
  .memory-graph-container { height: 50vh; }
  .slash-popup { width: calc(100vw - 24px); left: 12px !important; }
  .confirm-overlay { padding: 16px; }
  .confirm-dialog { padding: 24px 20px; max-width: calc(100vw - 32px); }
  .toast-container { left: auto; right: 12px; bottom: auto; top: 70px; transform: none; max-width: calc(100vw - 24px); }
  .toast { max-width: calc(100vw - 24px); }
  .queue-banner { left: 8px; right: 8px; }
  .conv-context-menu { min-width: 160px; }
}

/* ─── Responsive: Small phone (≤380px) ──────────────────── */
@media (max-width: 380px) {
  .chat-header { gap: 4px; padding: 0 8px; }
  .studio-launchers { gap: 4px; }
  .studio-launch-btn { width: 30px; height: 30px; border-radius: var(--r-sm); }
  .model-selector-btn .model-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .model-selector-btn .provider-dot { display: none; }
  .input-footer { flex-direction: column; gap: 6px; align-items: stretch; }
  .input-footer-hint { display: none; }
  .welcome-orb { width: 80px; height: 80px; }
  .welcome-orb-core { width: 44px; height: 44px; }
  .welcome-orb-core img { width: 28px; height: 28px; }
  .welcome-title { font-size: 1.15rem; }
  .welcome-subtitle { font-size: 0.72rem; }
  .msg { padding: 10px 10px; }
  .msg-avatar { width: 24px; height: 24px; }
  .msg-content { font-size: 0.85rem; }
  .input-tool-btn { padding: 8px; }
}

/* ─── Responsive: Landscape phone ───────────────────────── */
@media (max-width: 950px) and (orientation: landscape) and (max-height: 500px) {
  .chat-header { height: 44px; }
  .msg { padding: 8px 14px; }
  .msg-content { font-size: 0.85rem; }
  .input-area { padding: 0 0 max(8px, env(safe-area-inset-bottom)); }
  .input-row { padding: 8px 16px 4px; }
  .input-row textarea { min-height: 20px; max-height: 80px; }
  .model-dropdown { max-height: 50vh; }
  .welcome { padding: 12px 16px; }
  .welcome-orb { width: 72px; height: 72px; }
  .welcome-orb-core { width: 40px; height: 40px; }
  .welcome-orb-core img { width: 24px; height: 24px; }
  .welcome-title { font-size: 1rem; }
  .welcome-subtitle { display: none; }
  .roladex { max-width: 100%; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE OVERHAUL — World-class mobile experience
   Full viewport, larger text, simplified navigation
   ═══════════════════════════════════════════════════════════ */

/* ── Mobile input "+" tool button — now also shown on desktop ── */
.input-tool-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: transparent;
  border: none;
  color: rgba(var(--athens-rgb), 0.5);
  cursor: pointer;
  transition: all 0.18s var(--ease-out);
  flex-shrink: 0;
}
.input-tool-add:hover {
  background: rgba(var(--lavender-rgb), 0.08);
  color: rgba(var(--athens-rgb), 0.8);
}
.input-tool-add:active {
  transform: scale(0.95);
}
.input-tool-add[aria-expanded="true"] {
  background: rgba(var(--lavender-rgb), 0.12);
  color: var(--lavender);
}

/* Tools popover removed — image/map generation is intent-based now */

/* ─── Mobile breakpoint (≤768px) ─────────────────────────── */
@media (max-width: 768px) {

  /* ── Perf: remove ALL backdrop-filter on mobile ── */
  /* iOS WebKit composites backdrop-filter on the CPU even at small radii,
     causing scroll jank and slow rendering across every overlaid element.
     A universal override catches all 40+ declarations without listing them. */
  *, *::before, *::after {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  /* ── Perf: reduce expensive box-shadows on mobile ── */
  /* 60-80px blur radii are costly on mobile GPUs. Cap at 20px. */
  .auth-overlay-card,
  .voice-intro-card,
  .drawer,
  .model-dropdown,
  .canvas-command-panel,
  .iris-gen-overlay {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2) !important;
  }

  /* ── Perf: disable CSS animations that trigger continuous repaints ── */
  /* The welcome orb pulse and voice orb animations run continuously,
     consuming GPU cycles even when idle. Disable on mobile. */
  .welcome-orb-core,
  .voice-orb {
    animation: none !important;
  }

  /* ── Drawer: full-screen on mobile ── */
  .drawer {
    width: 100vw !important;
    max-width: 100vw !important;
  }

  /* ── Full viewport, no padding, edge-to-edge ── */
  .app {
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 0;
  }

  /* ── Header: simplified, just hamburger + model ── */
  .chat-header {
    height: 56px;
    padding: 0 12px;
    padding-top: env(safe-area-inset-top);
    height: calc(56px + env(safe-area-inset-top));
  }
  .chat-header-left { gap: 10px; }
  .chat-header-right {
    gap: 4px;
  }
  /* Hide secondary header buttons on mobile — keep tour + sync */
  .chat-header-right .header-icon-btn#btnAthenaTour,
  .chat-header-right .header-icon-btn#btnRecorder,
  .chat-header-right .header-icon-btn#btnCanvas {
    display: none;
  }
  .header-icon-btn {
    width: 40px;
    height: 40px;
  }
  .model-selector-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
  .model-selector-btn .model-name {
    max-width: 160px;
  }
  .hamburger { width: 44px; height: 44px; }  /* slightly larger tap target on touch */

  /* ── Messages: bigger text, full width, more readable ── */
  .msg {
    padding: 16px 16px;
    gap: 12px;
  }
  .msg-avatar {
    width: 34px;
    height: 34px;
  }
  .msg-content {
    font-size: 16px;
    line-height: 1.7;
  }
  .msg-content h1 { font-size: 1.35rem; }
  .msg-content h2 { font-size: 1.2rem; }
  .msg-content h3 { font-size: 1.05rem; }
  .msg-content p { margin: 10px 0; }
  .msg-content ul, .msg-content ol { padding-left: 24px; margin: 10px 0; }
  .msg-content li { margin: 6px 0; }
  .msg-content blockquote { padding: 12px 16px; margin: 14px 0; }
  .msg-content th, .msg-content td { padding: 10px 12px; font-size: 0.9rem; }
  .msg-content pre { padding: 16px; font-size: 0.85rem; }

  /* Message action buttons — bigger touch targets */
  .msg-actions { opacity: 1; flex-wrap: wrap; gap: 4px; }
  .msg-action-btn {
    font-size: 0.75rem;
    padding: 8px 12px;
    gap: 4px;
    min-height: 44px;
  }
  .msg-action-btn span { display: none; }
  .msg-action-btn svg { width: 16px; height: 16px; }

  /* Code blocks — readable on mobile */
  .code-block { margin: 14px 0; border-radius: var(--r-md); }
  .code-block-header { padding: 10px 14px; }
  .code-block pre { padding: 16px; font-size: 0.82rem; max-height: 400px; }
  .streaming-code-block .streaming-code-pre { padding: 16px; font-size: 0.82rem; max-height: 400px; }
  .code-block-footer { padding: 10px 14px; min-height: 48px; }
  .code-action-btn { font-size: 0.75rem; padding: 8px 12px; gap: 5px; min-height: 36px; }
  .code-action-btn span { display: none; }
  .code-block-lang { font-size: 0.7rem; }
  .code-block-lines { font-size: 0.65rem; }

  /* ── Welcome screen: conversational, clean, world-class ── */
  .welcome {
    padding: 0 20px;
    justify-content: center;
  }
  .welcome-content {
    max-width: 100%;
  }
  .welcome-orb {
    width: 88px;
    height: 88px;
  }
  .welcome-title {
    font-size: 1.75rem;
    margin-bottom: 8px;
  }
  .welcome-sub {
    font-size: 1rem;
    margin-bottom: 28px;
    line-height: 1.6;
  }
  /* ── Roladex: bigger touch targets on mobile ── */
  .roladex {
    max-width: 100%;
  }
  .roladex-card {
    padding: 14px 18px;
    font-size: 0.85rem;
    min-height: 44px;
  }

  /* ── Input area: full width, no padding, bigger touch targets ── */
  .input-area {
    padding: 0 12px max(12px, env(safe-area-inset-bottom));
  }
  .input-wrap {
    max-width: 100%;
    border-radius: var(--r-xl);
  }
  .input-row {
    padding: 14px 14px 8px;
    gap: 8px;
  }
  .input-row textarea {
    font-size: 16px; /* 16px prevents iOS zoom */
    line-height: 1.55;
    min-height: 24px;
  }
  .input-footer {
    padding: 8px 12px 12px;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
  }
  .input-footer-right {
    gap: 8px;
  }
  .input-footer-hint {
    display: none;
  }

  /* ── Mobile: hide inline tool buttons — except Attach, the primary tool ── */
  .input-tools > .input-tool-btn {
    display: none;
  }
  /* Attach must survive on mobile regardless of lock state or specificity —
     it is the ONLY way to add a file on a touch device. */
  .input-tools > .input-tool-btn#btnAttach,
  .input-tools > .input-tool-btn#btnAttach.plan-locked,
  .input-tools > button.input-tool-btn#btnAttach[hidden] {
    display: flex !important;
    visibility: visible;
    pointer-events: auto;
  }
  .input-tools > .business-selector {
    display: none !important;
  }
  .input-tools-divider {
    display: none;
  }

  /* Tools popover removed — no longer needed */

  /* ── Send/mic/stop buttons — bigger touch targets ── */
  .send-btn, .stop-btn, .mic-btn {
    width: 42px;
    height: 42px;
  }
  .send-btn svg, .stop-btn svg, .mic-btn svg {
    width: 20px;
    height: 20px;
  }

  /* ── AI disclaimer — minimal on mobile ── */
  .ai-disclaimer {
    flex-wrap: nowrap;
    white-space: nowrap;
    font-size: 0.65rem;
    padding: 4px 8px 2px;
  }
  .ai-disclaimer > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .ai-disclaimer-sep, .ai-disclaimer-mem { display: none; }
  .ai-disclaimer .sandbox-popover {
    font-size: 0.7rem;
  }

  /* ── Sidebar drawer — full width on mobile ── */
  .sidebar {
    width: 85vw;
    max-width: 340px;
  }

  /* ── Model dropdown — full width, pops upward ── */
  .model-dropdown {
    width: calc(100vw - 24px);
    left: -12px;
    max-height: 65vh;
    bottom: 100%;
    margin-bottom: 8px;
  }

  /* ── Settings drawer — full screen on mobile ── */
  .settings-drawer, .conv-settings-drawer, .onboarding-drawer, .memory-drawer, .users-drawer, #overlayInspectorDrawer {
    width: 100vw !important;
    max-width: 100vw;
  }
  .drawer-tabs {
    gap: 0;
    padding: 0 8px;
  }
  .drawer-tab {
    padding: 12px 14px;
    min-height: 48px;
  }
  .drawer-tab span {
    font-size: 0.8rem;
  }
  .settings-body, .drawer-body {
    padding: 16px;
  }
  .settings-section, .set-card {
    padding: 16px;
  }
  .set-card-header {
    min-height: 52px;
  }
  .set-card-title {
    font-size: 0.95rem;
  }
  .setting-label {
    font-size: 0.85rem;
  }
  .setting-input, select.setting-input {
    font-size: 16px; /* prevent iOS zoom */
    min-height: 48px;
  }

  /* ── Canvas panel — full screen on mobile ── */
  .canvas-panel.open {
    width: 100%;
    min-width: 0;
    position: absolute;
    inset: 0;
    z-index: 50;
  }

  /* ── Voice mode — larger orb, readable transcript ── */
  .voice-orb { width: 160px; height: 160px; }
  .voice-orb-core { width: 96px; height: 96px; }
  .voice-orb-core img { width: 60px; height: 60px; }
  .voice-mode-transcript {
    font-size: 0.9rem;
    max-width: 320px;
    padding: 0 20px;
    line-height: 1.6;
  }
  .voice-mode-footer { bottom: 40px; gap: 16px; }
  .voice-mode-btn { width: 52px; height: 52px; }
  .voice-mode-close, .voice-mode-help {
    top: max(20px, env(safe-area-inset-top));
    width: 42px;
    height: 42px;
  }

  /* ── Toasts — top right on mobile ── */
  .toast-container {
    left: auto;
    right: 12px;
    bottom: auto;
    top: 70px;
    transform: none;
  }
  .toast {
    max-width: none;
    font-size: 0.85rem;
    padding: 14px 16px;
  }

  /* ── Confirm dialogs ── */
  .confirm-dialog {
    padding: 24px 20px;
    max-width: calc(100vw - 32px);
    font-size: 0.95rem;
  }

  /* ── Slash command popup ── */
  .slash-popup {
    width: calc(100vw - 24px);
    left: 12px !important;
  }

  /* ── Artifact cards — bigger on mobile ── */
  .artifact-card-preview img { max-height: 320px; }
  .artifact-card-body { padding: 12px 14px; }
  .artifact-card-prompt { font-size: 0.85rem; }
  .artifact-card-actions { gap: 6px; }
  .artifact-card-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
    min-height: 40px;
  }
  .artifact-card-btn svg { width: 16px; height: 16px; }

  /* ── Inline map — full width fields panel ── */
  .artifact-card-map-canvas { height: 400px; }
  .imr-hint { display: none; }
  .imr-fields-panel { width: 100%; }
  .imr-fields-panel[data-hidden="true"] { transform: translateY(100%); }
  .imr-fields-panel {
    top: auto;
    bottom: 0;
    height: 65%;
    border-left: none;
    border-top: 1px solid rgba(152,137,192,0.12);
  }

  /* ── Queue banner ── */
  .queue-banner { left: 8px; right: 8px; }

  /* ── Context menu ── */
  .conv-context-menu { min-width: 180px; }

  /* ── Redaction panel — simplified on mobile ── */
  .redact-btn { font-size: 0.8rem; padding: 10px 14px; }
}

/* ─── Small phone (≤400px) — even more compact ───────────── */
@media (max-width: 400px) {
  .chat-header { padding: 0 8px; padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); }
  .chat-header-left { gap: 6px; }
  .model-selector-btn { padding: 6px 10px; }
  .model-selector-btn .model-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
  .model-selector-btn .provider-dot { display: none; }
  .msg { padding: 14px 12px; }
  .msg-content { font-size: 15px; }
  .input-area { padding: 0 0 max(10px, env(safe-area-inset-bottom)); }
  .welcome-title { font-size: 1.5rem; }
  .welcome-sub { font-size: 0.9rem; }
  .roladex-card { padding: 10px 14px; font-size: 0.82rem; }
  .header-icon-btn { width: 36px; height: 36px; }
  .hamburger { width: 36px; height: 36px; }

  /* ── Drawer tabs: larger touch targets, scrollable ── */
  .drawer-tab {
    padding: 12px 18px;
    font-size: 0.85rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .drawer-tabs-icons .drawer-tab span {
    display: none;
  }
  .drawer-tabs-icons .drawer-tab {
    padding: 12px 14px;
  }
  .drawer-tabs-icons .drawer-tab svg {
    width: 22px;
    height: 22px;
  }
  .drawer-header-pro {
    padding: 16px 18px 10px;
  }
  .drawer-body {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   High contrast mode — boost text contrast and add outlines
   ═══════════════════════════════════════════════════════════ */
@media (prefers-contrast: more) {
  .msg-content { color: #000 !important; }
  .msg.user .msg-content { background: #e8e8e8 !important; border: 1px solid #000 !important; }
  .msg.assistant .msg-content { border: 1px solid #000 !important; }
  .btn, .setting-save-btn, .setting-btn, .setting-danger-btn,
  .conv-action-btn, .msg-action-btn, .code-action-btn,
  .header-icon-btn, .sidebar-footer-btn, .send-btn, .mic-btn, .stop-btn {
    border: 2px solid currentColor !important;
  }
  .input-wrap, .chat-area, .drawer, .model-dropdown {
    border: 1px solid #000 !important;
  }
  .code-block { border: 2px solid #000 !important; }
  .code-block pre { color: #000 !important; }
  a { text-decoration: underline !important; }
  .toast { border: 2px solid #000 !important; }
}

/* ═══════════════════════════════════════════════════════════
   Print styles — show only message content
   ═══════════════════════════════════════════════════════════ */
@media print {
  .sidebar, .sidebar-overlay, .chat-header, .input-area, .input-wrap,
  .msg-actions, .msg-action-btn, .code-action-btn, .welcome,
  .drawer, .drawer-overlay, .modal-overlay, .toast-container, .model-dropdown, .msg-loader, .msg-load-more,
  .input-classification-pill, .cls-info-popover, .sidebar-footer,
  .studio-launch-btn, .voice-mode, .voice-intro-root, .canvas-panel,
  .artifact-card-gen-overlay, .upgrade-modal, .confirm-overlay,
  .auth-overlay, .share-overlay, .folder-overlay,
  .redact-gate-overlay, .redact-panel, .iterate-overlay,
  .cmd-palette-overlay, .slash-popup, .msg-history-notice {
    display: none !important;
  }
  .app { position: static !important; height: auto !important; overflow: visible !important; padding: 0 !important; }
  .chat-area { overflow: visible !important; height: auto !important; }
  .messages { max-width: 100% !important; padding: 0 !important; }
  .msg { page-break-inside: avoid; max-width: 100% !important; padding: 8px 12px !important; }
  .msg-content { font-size: 11pt !important; line-height: 1.5 !important; color: #000 !important; }
  .msg.user .msg-content { background: #f0f0f0 !important; }
  .msg.assistant .msg-content { background: transparent !important; }
  .code-block pre { max-height: none !important; overflow: visible !important; }
  .code-block { page-break-inside: avoid; }
  body { background: white !important; }
  .bg-noise, .bg-grid, #bg-particles { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════
   Voice Mode — Immersive conversational overlay
   ═══════════════════════════════════════════════════════════ */
.voice-mode {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: var(--s0);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 35%, rgba(var(--jacarta-rgb), 0.45) 0%, transparent 65%),
    radial-gradient(ellipse 60% 40% at 50% 80%, rgba(var(--brand-rgb), 0.12) 0%, transparent 60%),
    radial-gradient(circle at 20% 20%, rgba(var(--lavender-rgb), 0.06) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(var(--brand-rgb), 0.04) 0%, transparent 35%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: voiceFadeIn 0.5s var(--ease-spring);
  overflow: hidden;
}

.voice-mode::before {
  content: '';
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg at 50% 45%,
    transparent 0deg,
    rgba(var(--lavender-rgb), 0.04) 60deg,
    transparent 120deg,
    rgba(var(--brand-rgb), 0.03) 180deg,
    transparent 240deg,
    rgba(var(--lavender-rgb), 0.04) 300deg,
    transparent 360deg);
  animation: voiceAurora 20s linear infinite;
  pointer-events: none;
}

@keyframes voiceAurora {
  to { transform: rotate(360deg); }
}

@keyframes voiceFadeIn {
  from { opacity: 0; transform: scale(1.02); }
  to { opacity: 1; transform: scale(1); }
}

.voice-mode.hidden { display: none !important; }

/* ── Top bar buttons ── */
.voice-mode-close,
.voice-mode-help {
  position: absolute;
  top: 24px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--s2-rgb), 0.5);
  backdrop-filter: blur(16px) saturate(140%);
  color: rgba(var(--athens-rgb), 0.55);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s var(--ease-spring);
  z-index: 10;
}

.voice-mode-close { right: 24px; }
.voice-mode-help { right: 76px; }

.voice-mode-close:hover,
.voice-mode-help:hover {
  background: rgba(var(--lavender-rgb), 0.12);
  color: var(--athens);
  border-color: rgba(var(--lavender-rgb), 0.3);
  transform: scale(1.06);
  box-shadow: 0 4px 20px rgba(var(--lavender-rgb), 0.1);
}

.voice-mode-close:active,
.voice-mode-help:active {
  transform: scale(0.96);
}

/* ── Body layout ── */
.voice-mode-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  position: relative;
  z-index: 2;
}

/* ── Voice Orb ── */
.voice-orb {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(var(--lavender-rgb), 0.12);
}

.voice-orb-ring-1 {
  animation: orbPulse 2.8s ease-in-out infinite;
}

.voice-orb-ring-2 {
  inset: -14px;
  border-color: rgba(var(--lavender-rgb), 0.07);
  animation: orbPulse 2.8s ease-in-out infinite 0.5s;
}

.voice-orb-ring-3 {
  inset: -28px;
  border-color: rgba(var(--lavender-rgb), 0.035);
  animation: orbPulse 2.8s ease-in-out infinite 1s;
}

@keyframes orbPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.5; }
}

.voice-orb {
  --waveform: 0;
}

.voice-orb-core {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--jacarta), rgba(var(--lavender-rgb), 0.35));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 40px rgba(var(--lavender-rgb), 0.15),
    0 0 80px rgba(var(--jacarta-rgb), 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: scale(calc(1 + var(--waveform) * 0.12));
  transition: transform 0.08s ease-out;
  position: relative;
}

.voice-orb-core::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, rgba(var(--lavender-rgb), 0.15), transparent, rgba(var(--brand-rgb), 0.1), transparent);
  animation: orbCoreSpin 8s linear infinite;
  z-index: -1;
  filter: blur(4px);
}

@keyframes orbCoreSpin {
  to { transform: rotate(360deg); }
}

.voice-orb-core img {
  border-radius: 50%;
  width: 64px;
  height: 64px;
  object-fit: contain;
}

/* ── Orb state: listening ── */
.voice-mode[data-state="listening"] .voice-orb-ring {
  border-color: rgba(var(--lavender-rgb), 0.22);
  transform: scale(calc(1 + var(--waveform) * 0.06));
  transition: transform 0.08s ease-out;
}
.voice-mode[data-state="listening"] .voice-orb-core {
  box-shadow:
    0 0 calc(40px + var(--waveform) * 35px) rgba(var(--lavender-rgb), calc(0.18 + var(--waveform) * 0.17)),
    0 0 80px rgba(var(--jacarta-rgb), 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ── Orb state: thinking ── */
.voice-mode[data-state="thinking"] .voice-orb-ring {
  border-color: rgba(var(--lavender-rgb), 0.1);
  animation: thinkBreath 2.2s ease-in-out infinite;
}
.voice-mode[data-state="thinking"] .voice-orb-core {
  animation: thinkBreath 2.2s ease-in-out infinite;
}
.voice-mode[data-state="thinking"] .voice-orb-core::after {
  animation: orbCoreSpin 2s linear infinite;
}
@keyframes thinkBreath {
  0%, 100% { transform: scale(1); box-shadow: 0 0 40px rgba(var(--lavender-rgb), 0.12), 0 0 80px rgba(var(--jacarta-rgb), 0.3), inset 0 1px 0 rgba(255,255,255,0.06); }
  50% { transform: scale(1.05); box-shadow: 0 0 60px rgba(var(--lavender-rgb), 0.22), 0 0 100px rgba(var(--jacarta-rgb), 0.4), inset 0 1px 0 rgba(255,255,255,0.08); }
}

/* ── Orb state: speaking ── */
.voice-mode[data-state="speaking"] .voice-orb-ring {
  border-color: rgba(var(--ok-rgb), 0.18);
  animation: speakGlow 1.8s ease-in-out infinite;
}
.voice-mode[data-state="speaking"] .voice-orb-core {
  animation: speakGlow 1.8s ease-in-out infinite;
}
@keyframes speakGlow {
  0%, 100% { box-shadow: 0 0 40px rgba(var(--ok-rgb), 0.12), 0 0 80px rgba(var(--jacarta-rgb), 0.3), inset 0 1px 0 rgba(255,255,255,0.06); }
  50% { box-shadow: 0 0 60px rgba(var(--ok-rgb), 0.22), 0 0 120px rgba(var(--jacarta-rgb), 0.4), inset 0 1px 0 rgba(255,255,255,0.08); }
}

/* ── Caption under transcript — state-aware hint ── */
.voice-mode-caption {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(var(--athens-rgb), 0.35);
  margin-top: 12px;
  transition: color 0.3s ease, opacity 0.3s ease;
  text-transform: uppercase;
}
.voice-mode[data-state="listening"] .voice-mode-caption { color: rgba(var(--lavender-rgb), 0.5); }
.voice-mode[data-state="thinking"] .voice-mode-caption { color: rgba(var(--lavender-rgb), 0.35); }
.voice-mode[data-state="speaking"] .voice-mode-caption { color: rgba(var(--ok-rgb), 0.45); }

/* ── Connecting state — animated indicator, not a stuck label ── */
.voice-mode[data-state="connecting"] .voice-orb-ring {
  animation: connectSpin 1.4s ease-in-out infinite;
}
.voice-mode[data-state="connecting"] .voice-orb-core {
  animation: connectPulse 1.4s ease-in-out infinite;
}
.voice-mode[data-state="connecting"] .voice-orb-core::after {
  animation: orbCoreSpin 3s linear infinite;
}
.voice-mode[data-state="connecting"] .voice-mode-caption { color: rgba(var(--lavender-rgb), 0.4); }
@keyframes connectSpin {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.3; }
}
@keyframes connectPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.95); }
}
/* Connecting dots — different animation from thinking (circular flow) */
.voice-mode[data-state="connecting"] .voice-dot {
  animation: connectFlow 1.2s ease-in-out infinite;
}
.voice-mode[data-state="connecting"] .voice-dot:nth-child(2) { animation-delay: 0.15s; }
.voice-mode[data-state="connecting"] .voice-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes connectFlow {
  0%, 100% { transform: translateY(0) scale(0.6); opacity: 0.2; }
  50% { transform: translateY(-6px) scale(1); opacity: 1; }
}

/* ── Bouncing dots indicator ── */
.voice-mode-dots {  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  height: 24px;
  transition: opacity 0.3s ease;
}

.voice-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(var(--lavender-rgb), 0.55);
  box-shadow: 0 0 8px rgba(var(--lavender-rgb), 0.2);
  animation: dotFloat 2s ease-in-out infinite;
}
.voice-dot:nth-child(2) { animation-delay: 0.25s; }
.voice-dot:nth-child(3) { animation-delay: 0.5s; }

@keyframes dotFloat {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50% { transform: translateY(-10px); opacity: 1; }
}

/* Thinking: faster, more energetic bounce */
.voice-mode[data-state="thinking"] .voice-dot {
  background: rgba(var(--lavender-rgb), 0.75);
  box-shadow: 0 0 12px rgba(var(--lavender-rgb), 0.3);
  animation: dotBounce 0.65s ease-in-out infinite alternate;
}
.voice-mode[data-state="thinking"] .voice-dot:nth-child(2) { animation-delay: 0.12s; }
.voice-mode[data-state="thinking"] .voice-dot:nth-child(3) { animation-delay: 0.24s; }

@keyframes dotBounce {
  0% { transform: translateY(0) scale(1); opacity: 0.5; }
  100% { transform: translateY(-14px) scale(1.25); opacity: 1; }
}

/* Speaking: hide dots — just voice */
.voice-mode[data-state="speaking"] .voice-mode-dots {
  opacity: 0;
  pointer-events: none;
}

/* ── Transcript ── */
.voice-mode-transcript {
  font-size: 0.88rem;
  font-family: var(--ff-body);
  color: rgba(var(--athens-rgb), 0.55);
  max-width: 440px;
  text-align: center;
  min-height: 1.4em;
  transition: opacity 0.25s ease;
  line-height: 1.6;
  letter-spacing: 0.005em;
  padding: 0 20px;
}

/* ── Footer with action buttons ── */
.voice-mode-footer {
  position: absolute;
  bottom: 48px;
  display: flex;
  gap: 16px;
  z-index: 10;
}

.voice-mode-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(var(--lavender-rgb), 0.18);
  background: rgba(var(--s2-rgb), 0.45);
  backdrop-filter: blur(16px) saturate(140%);
  color: rgba(var(--lavender-rgb), 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s var(--ease-spring);
}

.voice-mode-btn:hover {
  background: rgba(var(--lavender-rgb), 0.12);
  border-color: rgba(var(--lavender-rgb), 0.35);
  color: var(--athens);
  transform: scale(1.06);
  box-shadow: 0 4px 24px rgba(var(--lavender-rgb), 0.12);
}

.voice-mode-btn:active {
  transform: scale(0.95);
}

.voice-mode-btn.danger {
  border-color: rgba(var(--danger-rgb), 0.2);
  color: rgba(var(--danger-rgb), 0.7);
}

.voice-mode-btn.danger:hover {
  background: rgba(var(--danger-rgb), 0.12);
  border-color: rgba(var(--danger-rgb), 0.4);
  color: var(--danger);
  box-shadow: 0 4px 24px rgba(var(--danger-rgb), 0.12);
}

.voice-mode-btn.muted {
  border-color: rgba(var(--warn-rgb), 0.25);
  color: rgba(var(--warn-rgb), 0.8);
  background: rgba(var(--warn-rgb), 0.06);
}

.voice-mode-btn.muted:hover {
  background: rgba(var(--warn-rgb), 0.12);
  border-color: rgba(var(--warn-rgb), 0.4);
  color: var(--warn);
}

/* ═══════════════════════════════════════════════════════════
   Iris Studio header — used by the image generation panel
   ═══════════════════════════════════════════════════════════ */
@keyframes irisFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.iris-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06);
}

.iris-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.iris-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--lavender-rgb), 0.03);
  color: rgba(var(--athens-rgb), 0.65);
  font-family: var(--ff-heading);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s var(--ease-smooth);
}

.iris-back:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--athens);
  border-color: rgba(var(--lavender-rgb), 0.28);
  transform: translateY(-1px);
}

.iris-back:active {
  transform: translateY(0);
}

.iris-title {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 8px;
  font-family: var(--ff-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--lavender);
}

.iris-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 20px;
  overflow-y: auto;
}

.iris-canvas {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-lg);
  background: rgba(var(--jacarta-rgb), 0.08);
  border: 1px solid rgba(var(--lavender-rgb), 0.06);
  min-height: 300px;
  position: relative;
  overflow: hidden;
}

.iris-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: rgba(var(--athens-rgb), 0.3);
}

.iris-empty-icon { color: rgba(var(--lavender-rgb), 0.3); }
.iris-empty p { font-size: 0.85rem; }

.iris-result {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--r-md);
  image-rendering: auto;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.iris-result.hidden { display: none; }

@keyframes irisReveal {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* ── Use-case Presets ── */
.iris-presets {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.iris-presets::-webkit-scrollbar { display: none; }

.iris-preset {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: rgba(var(--s2-rgb), 0.24);
  color: rgba(var(--athens-rgb), 0.44);
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}
.iris-preset:hover {
  border-color: rgba(var(--lavender-rgb), 0.25);
  color: var(--athens);
  background: rgba(var(--lavender-rgb), 0.06);
}
.iris-preset.active {
  background: rgba(var(--lavender-rgb), 0.13);
  border-color: rgba(var(--lavender-rgb), 0.28);
  color: var(--white);
  box-shadow: 0 0 0 1px rgba(var(--lavender-rgb), 0.04) inset;
}

.iris-preset-flagship {
  border-color: rgba(var(--lavender-rgb), 0.28);
  background: linear-gradient(135deg, rgba(var(--jacarta-rgb), 0.5), rgba(var(--lavender-rgb), 0.12));
  color: var(--athens);
  box-shadow: 0 0 0 1px rgba(var(--lavender-rgb), 0.06) inset;
}

.iris-preset-flagship:hover {
  border-color: rgba(var(--lavender-rgb), 0.45);
  background: linear-gradient(135deg, rgba(var(--jacarta-rgb), 0.7), rgba(var(--lavender-rgb), 0.18));
}

.iris-preset-flagship.active {
  background: linear-gradient(135deg, var(--jacarta), var(--lavender));
  color: #fff;
  box-shadow: 0 6px 24px rgba(var(--jacarta-rgb), 0.28);
}

.iris-preset-icon {
  font-size: 0.8rem;
  line-height: 1;
}
.iris-preset-label {
  line-height: 1;
}

.iris-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.canvas-command-panel {
  padding: 16px;
  border-radius: var(--r-xl);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background:
    radial-gradient(circle at top left, rgba(var(--lavender-rgb), 0.12), transparent 32%),
    linear-gradient(135deg, rgba(var(--s2-rgb), 0.72), rgba(var(--s1-rgb), 0.58));
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(255,255,255,0.018) inset;
  backdrop-filter: blur(20px);
}

[data-theme="light"] .canvas-command-panel {
  box-shadow: 0 22px 70px rgba(45, 30, 100, 0.08), 0 0 0 1px rgba(45, 30, 100, 0.03) inset;
}

.canvas-command-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.canvas-command-kicker,
.canvas-mini-label,
.canvas-control-label {
  display: block;
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(var(--lavender-rgb), 0.64);
}

.canvas-command-head strong {
  display: block;
  margin-top: 3px;
  font-family: var(--ff-heading);
  color: var(--athens);
  font-size: 1rem;
}

.canvas-command-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-collapse-btn {
  width: 31px;
  height: 31px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--lavender-rgb), 0.055);
  color: rgba(var(--athens-rgb), 0.55);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s var(--ease-out);
}

.canvas-collapse-btn:hover {
  color: var(--white);
  border-color: rgba(var(--lavender-rgb), 0.26);
  background: rgba(var(--lavender-rgb), 0.12);
}

.canvas-command-panel.is-collapsed { padding-bottom: 12px; }
.canvas-collapse-btn svg { transform: rotate(180deg); transition: transform 0.18s var(--ease-out); }
.canvas-command-panel.is-collapsed .canvas-collapse-btn svg { transform: rotate(0deg); }

.canvas-command-content.hidden { display: none !important; }
.canvas-mode-switch.hidden,
.canvas-edit-card.hidden { display: none !important; }

.canvas-mode-switch {
  display: flex;
  gap: 5px;
  padding: 4px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: rgba(0, 0, 0, 0.14);
}

.canvas-mode-btn {
  padding: 6px 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: rgba(var(--athens-rgb), 0.48);
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.18s var(--ease-out);
}

.canvas-mode-btn:hover { color: var(--athens); background: rgba(var(--lavender-rgb), 0.08); }
.canvas-mode-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(var(--jacarta-rgb), 0.88), rgba(var(--lavender-rgb), 0.32));
  box-shadow: 0 8px 22px rgba(var(--jacarta-rgb), 0.22);
}

.canvas-command-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.canvas-command-grid:has(.canvas-edit-card:not(.hidden)) {
  grid-template-columns: minmax(0, 1.18fr) minmax(280px, 0.82fr);
}

.canvas-brief-card,
.canvas-edit-card,
.canvas-workflow-section,
.canvas-output-bar {
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-xl);
  background: rgba(var(--s0-rgb), 0.28);
}

.canvas-brief-card,
.canvas-edit-card {
  padding: 12px;
}

.canvas-control-label { margin-bottom: 8px; }

.canvas-workflow-section {
  margin-top: 12px;
  padding: 12px;
}

.canvas-style-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.canvas-format-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.canvas-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.canvas-section-head span {
  font-family: var(--ff-heading);
  color: var(--athens);
  font-size: 0.82rem;
  font-weight: 750;
}

.canvas-section-head small {
  color: rgba(var(--athens-rgb), 0.42);
  font-size: 0.7rem;
}

.canvas-output-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
}

.canvas-output-group,
.canvas-output-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.canvas-edit-card .canvas-refine-head { margin-bottom: 10px; }
.canvas-refine-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.iris-prompt-wrap {
  position: relative;
}

.iris-mic-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(var(--lavender-rgb), 0.08);
  color: rgba(var(--athens-rgb), 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease-smooth);
  z-index: 1;
}
.iris-mic-btn:hover {
  background: rgba(var(--lavender-rgb), 0.15);
  color: var(--lavender);
}
.iris-mic-btn.recording {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  animation: iris-mic-pulse 1.2s ease infinite;
}
.iris-mic-btn.transcribing {
  background: rgba(var(--lavender-rgb), 0.12);
  color: var(--lavender);
  opacity: 0.6;
  pointer-events: none;
}
@keyframes iris-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.iris-prompt {
  width: 100%;
  padding: 16px 54px 18px 18px;
  min-height: 128px;
  border-radius: var(--r-xl);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: linear-gradient(180deg, rgba(var(--s2-rgb), 0.64), rgba(var(--s1-rgb), 0.5));
  color: var(--athens);
  font-family: var(--ff-body);
  font-size: 0.9rem;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

.iris-prompt:focus {
  border-color: rgba(var(--lavender-rgb), 0.35);
}

.iris-prompt::placeholder { color: rgba(var(--athens-rgb), 0.3); }

.canvas-reference-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-lg);
  background: rgba(var(--lavender-rgb), 0.055);
}
.canvas-reference-preview img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.16);
}
.canvas-reference-preview div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.canvas-reference-preview strong {
  font-family: var(--ff-heading);
  font-size: 0.76rem;
  color: var(--athens);
}
.canvas-reference-preview span {
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.42);
}
.canvas-reference-preview button {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(0,0,0,0.12);
  color: rgba(var(--athens-rgb), 0.56);
  cursor: pointer;
}
.canvas-reference-preview button:hover {
  color: var(--athens);
  background: rgba(var(--lavender-rgb), 0.12);
}

.iris-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.iris-aspect-pills {
  display: flex;
  gap: 6px;
}

.iris-pill {
  padding: 4px 10px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: rgba(var(--s2-rgb), 0.18);
  color: rgba(var(--athens-rgb), 0.44);
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.iris-pill:hover {
  border-color: rgba(var(--lavender-rgb), 0.3);
  color: var(--athens);
}

.iris-pill.active {
  background: rgba(var(--jacarta-rgb), 0.72);
  border-color: rgba(var(--lavender-rgb), 0.26);
  color: #fff;
}

.iris-generate {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--r-sm);
  border: none;
  background: linear-gradient(135deg, var(--jacarta), rgba(var(--lavender-rgb), 0.6));
  color: #fff;
  font-family: var(--ff-heading);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
  box-shadow: 0 4px 16px rgba(var(--jacarta-rgb), 0.3);
}

.iris-generate:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(var(--jacarta-rgb), 0.4);
}

.iris-generate:active { transform: translateY(0); }

.iris-generate.generating {
  pointer-events: none;
  animation: irisGenPulse 1.5s ease-in-out infinite;
}

@keyframes irisGenPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ── Advanced toggle button ── */
.iris-options-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.iris-advanced-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: transparent;
  color: rgba(var(--athens-rgb), 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.iris-advanced-toggle:hover {
  border-color: rgba(var(--lavender-rgb), 0.3);
  color: var(--athens);
  background: rgba(var(--lavender-rgb), 0.06);
}
.iris-advanced-toggle.active {
  background: rgba(var(--lavender-rgb), 0.1);
  border-color: rgba(var(--lavender-rgb), 0.3);
  color: var(--lavender);
}
.iris-advanced-toggle.active svg {
  animation: gearSpin 4s linear infinite;
}
@keyframes gearSpin {
  to { transform: rotate(360deg); }
}

/* ── Advanced panel ── */
.iris-advanced {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
  background: rgba(var(--s1-rgb), 0.5);
  backdrop-filter: blur(12px);
  animation: advSlide 0.3s var(--ease-spring);
}
.iris-advanced.hidden { display: none !important; }

@keyframes advSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.iris-adv-section { display: flex; flex-direction: column; gap: 8px; }

.iris-adv-label {
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.5);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.iris-adv-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.iris-adv-value {
  font-family: var(--ff-mono, monospace);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--lavender);
  min-width: 32px;
  text-align: right;
}

.iris-adv-row {
  display: flex;
  gap: 16px;
}
.iris-adv-flex { flex: 1; min-width: 0; }

/* ── Style chips ── */
.iris-style-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.iris-chip {
  padding: 5px 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: transparent;
  color: rgba(var(--athens-rgb), 0.45);
  font-family: var(--ff-heading);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.iris-chip:hover {
  border-color: rgba(var(--lavender-rgb), 0.25);
  color: var(--athens);
}
.iris-chip.active {
  background: var(--jacarta);
  border-color: var(--jacarta);
  color: #fff;
}

/* ── Negative prompt ── */
.iris-negative {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: rgba(var(--s2-rgb), 0.4);
  color: rgba(var(--athens-rgb), 0.7);
  font-family: var(--ff-body);
  font-size: 0.78rem;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}
.iris-negative:focus { border-color: rgba(var(--lavender-rgb), 0.3); }
.iris-negative::placeholder { color: rgba(var(--athens-rgb), 0.25); }

/* ── Slider ── */
.iris-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: var(--r-xs);
  background: rgba(var(--lavender-rgb), 0.12);
  outline: none;
  cursor: pointer;
}
.iris-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--lavender);
  border: 2px solid var(--s0);
  box-shadow: 0 2px 8px rgba(var(--jacarta-rgb), 0.3);
  cursor: pointer;
  transition: transform 0.15s;
}
.iris-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
.iris-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--lavender);
  border: 2px solid var(--s0);
  box-shadow: 0 2px 8px rgba(var(--jacarta-rgb), 0.3);
  cursor: pointer;
}

.iris-slider-hints {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: rgba(var(--athens-rgb), 0.25);
  font-family: var(--ff-heading);
  margin-top: -2px;
}

/* ── Seed input ── */
.iris-seed-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: rgba(var(--s2-rgb), 0.4);
  color: var(--athens);
  font-family: var(--ff-mono, monospace);
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.2s;
}
.iris-seed-input:focus { border-color: rgba(var(--lavender-rgb), 0.3); }
.iris-seed-input::-webkit-inner-spin-button,
.iris-seed-input::-webkit-outer-spin-button { opacity: 0.3; }

/* ── Select dropdown ── */
.iris-select {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: rgba(var(--s2-rgb), 0.4);
  color: var(--athens);
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.iris-select:focus { border-color: rgba(var(--lavender-rgb), 0.3); }
.iris-select option {
  background: var(--s1);
  color: var(--athens);
}

.iris-seed-random {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: transparent;
  color: rgba(var(--athens-rgb), 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.iris-seed-random:hover {
  color: var(--lavender);
  border-color: rgba(var(--lavender-rgb), 0.3);
}

.iris-history {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: none;
}

.iris-history::-webkit-scrollbar { display: none; }

.iris-history-thumb-wrap {
  position: relative;
  flex-shrink: 0;
}

.iris-history-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--r-sm);
  object-fit: cover;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s, transform 0.2s;
}

.iris-history-thumb:hover {
  border-color: var(--lavender);
  transform: scale(1.06);
}

.iris-history-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--lavender);
  color: var(--white);
  font-size: 0.55rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-heading);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   Iris Generation Live UX
   ═══════════════════════════════════════════════════════════ */
.iris-gen-live {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--r-lg);
}

/* ── Animated orb background ── */
.iris-gen-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.iris-gen-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: irisOrbFloat 6s ease-in-out infinite;
}
.iris-gen-orb-1 {
  width: 200px; height: 200px;
  background: var(--lavender);
  top: 10%; left: 15%;
  animation-delay: 0s;
}
.iris-gen-orb-2 {
  width: 160px; height: 160px;
  background: #6c63ff;
  bottom: 15%; right: 20%;
  animation-delay: -2s;
  animation-duration: 7s;
}
.iris-gen-orb-3 {
  width: 120px; height: 120px;
  background: #ff6b9d;
  top: 50%; left: 55%;
  animation-delay: -4s;
  animation-duration: 5s;
}
@keyframes irisOrbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, -15px) scale(1.1); }
  66% { transform: translate(-15px, 10px) scale(0.95); }
}

/* ── Live preview image ── */
.iris-gen-preview-wrap {
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  z-index: 0;
  display: none;
}
.iris-gen-preview-wrap.visible {
  display: flex;
  animation: irisPreviewFade 0.5s ease forwards;
}
@keyframes irisPreviewFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.iris-gen-preview-wrap.visible ~ .iris-gen-content {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  border-radius: var(--r-lg);
  padding: 20px 24px;
}
.iris-gen-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--r-lg);
  filter: blur(1px);
  transition: filter 0.3s ease;
}
.iris-gen-preview-wrap.visible .iris-gen-preview {
  filter: blur(0);
}

/* ── Content overlay ── */
.iris-gen-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
  transition: background 0.3s, padding 0.3s;
}

/* ── Step counter ── */
.iris-gen-step {
  font-family: var(--ff-mono, monospace);
  font-size: 0.75rem;
  color: var(--lavender);
  letter-spacing: 0.5px;
  opacity: 0.9;
  min-height: 1em;
}

/* ── Animated ring ── */
.iris-gen-ring {
  position: relative;
  width: 90px;
  height: 90px;
}
.iris-gen-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.iris-gen-ring-track {
  fill: none;
  stroke: rgba(var(--lavender-rgb), 0.12);
  stroke-width: 4;
}
.iris-gen-ring-progress {
  fill: none;
  stroke: var(--lavender);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 263.89;
  stroke-dashoffset: 263.89;
  transition: stroke-dashoffset 0.4s ease;
}
.iris-gen-ring-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lavender);
  animation: irisPulse 2s ease-in-out infinite;
}
@keyframes irisPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.92); }
}

/* ── Stage text ── */
.iris-gen-stage {
  font-family: var(--ff-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--athens);
  transition: opacity 0.15s ease;
}
.iris-gen-prompt-echo {
  font-size: 0.75rem;
  color: rgba(var(--athens-rgb), 0.35);
  font-style: italic;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: none; /* hidden when preview is active */
}
.iris-gen-preview-wrap:not(.visible) ~ .iris-gen-content .iris-gen-prompt-echo {
  display: block;
}

/* ── Progress bar ── */
.iris-gen-bar-wrap {
  width: 200px;
  height: 4px;
  border-radius: var(--r-xs);
  background: rgba(var(--lavender-rgb), 0.12);
  overflow: hidden;
}
.iris-gen-bar {
  height: 100%;
  width: 0%;
  border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--lavender), #6c63ff);
  transition: width 0.4s ease;
}

/* ── Elapsed time ── */
.iris-gen-elapsed {
  font-family: var(--ff-mono, monospace);
  font-size: 0.72rem;
  color: rgba(var(--athens-rgb), 0.3);
  letter-spacing: 0.5px;
}

/* ── Error state ── */
.iris-gen-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 280px;
  padding: 32px;
  text-align: center;
}
.iris-gen-error-icon {
  color: #E5484D;
  opacity: 0.8;
}
.iris-gen-error-msg {
  font-size: 0.85rem;
  color: rgba(var(--athens-rgb), 0.6);
  max-width: 300px;
}
.iris-gen-retry {
  margin-top: 8px;
  padding: 8px 20px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.3);
  background: rgba(var(--lavender-rgb), 0.08);
  color: var(--lavender);
  font-family: var(--ff-heading);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.iris-gen-retry:hover {
  background: rgba(var(--lavender-rgb), 0.18);
  border-color: var(--lavender);
  transform: translateY(-1px);
}

/* ── Image reveal animation ── */
.iris-result.iris-reveal {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.iris-result.iris-reveal.revealed {
  opacity: 1;
  transform: scale(1);
}

.canvas-actions {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(22px, 6vw, 72px);
  width: min(520px, calc(100% - 32px));
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  z-index: 4;
}
.canvas-actions.hidden { display: none !important; }
.canvas-action-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(var(--lavender-rgb), 0.22);
  background: rgba(8, 8, 12, 0.58);
  color: var(--athens);
  border-radius: 50%;
  padding: 0;
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
  transition: all 0.18s var(--ease-smooth);
}
.canvas-action-btn svg {
  width: 17px;
  height: 17px;
  color: var(--lavender);
  flex-shrink: 0;
}
.canvas-action-btn span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.canvas-action-btn:hover {
  background: rgba(var(--lavender-rgb), 0.18);
  border-color: rgba(var(--lavender-rgb), 0.34);
  transform: translateY(-2px) scale(1.04);
}

@media (max-width: 760px) {
  .canvas-command-grid,
  .canvas-command-grid:has(.canvas-edit-card:not(.hidden)) { grid-template-columns: 1fr; }
  .canvas-command-head,
  .canvas-output-bar,
  .canvas-style-row { align-items: stretch; flex-direction: column; }
  .canvas-format-inline { justify-content: space-between; }
  .canvas-command-actions { align-items: stretch; justify-content: space-between; }
  .canvas-mode-switch,
  .canvas-output-actions { justify-content: space-between; }
}

@media (max-width: 520px) {
  .canvas-actions {
    gap: 18px;
  }
}
.canvas-refine-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(var(--lavender-rgb), 0.16);
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(var(--lavender-rgb), 0.14), transparent 34%),
    linear-gradient(135deg, rgba(var(--s1-rgb), 0.88), rgba(var(--s0-rgb), 0.82));
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(255,255,255,0.02) inset;
  animation: advSlide 0.28s var(--ease-spring);
}
.canvas-refine-panel.hidden { display: none !important; }
.canvas-refine-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.canvas-refine-kicker {
  display: block;
  margin-bottom: 3px;
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(var(--lavender-rgb), 0.62);
}
.canvas-refine-head strong {
  font-family: var(--ff-heading);
  color: var(--athens);
  font-size: 0.96rem;
}
.canvas-refine-head button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--lavender-rgb), 0.06);
  color: rgba(var(--athens-rgb), 0.55);
  cursor: pointer;
}
.canvas-refine-head button:hover {
  color: var(--athens);
  background: rgba(var(--lavender-rgb), 0.08);
}
.canvas-refine-grid {
  display: grid;
  grid-template-columns: 1fr 230px;
  gap: 14px;
  align-items: stretch;
}
.canvas-refine-main,
.canvas-refine-side {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.canvas-refine-side {
  padding-left: 14px;
  border-left: 1px solid rgba(var(--lavender-rgb), 0.08);
}
.canvas-refine-label {
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(var(--athens-rgb), 0.46);
}
.canvas-refine-textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-lg);
  background: rgba(0, 0, 0, 0.16);
  color: var(--athens);
  font-family: var(--ff-body);
  font-size: 0.86rem;
  line-height: 1.5;
  padding: 12px 14px;
  outline: none;
}
.canvas-refine-textarea:focus {
  border-color: rgba(var(--lavender-rgb), 0.34);
  box-shadow: 0 0 0 3px rgba(var(--lavender-rgb), 0.08);
}
.canvas-refine-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.canvas-refine-chip {
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--lavender-rgb), 0.06);
  color: rgba(var(--athens-rgb), 0.68);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s var(--ease-smooth);
}
.canvas-refine-chip:hover {
  color: var(--athens);
  border-color: rgba(var(--lavender-rgb), 0.28);
  background: rgba(var(--lavender-rgb), 0.12);
  transform: translateY(-1px);
}
.canvas-refine-submit {
  margin-top: auto;
  border: 1px solid rgba(var(--lavender-rgb), 0.36);
  background: linear-gradient(135deg, var(--jacarta), var(--lavender));
  color: #fff;
  border-radius: var(--r-lg);
  padding: 11px 14px;
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(var(--jacarta-rgb), 0.26);
  transition: all 0.16s var(--ease-smooth);
}
.canvas-refine-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(var(--jacarta-rgb), 0.32);
}
.canvas-refine-side .iris-select {
  width: 100%;
  max-width: none;
}

@media (max-width: 720px) {
  .canvas-refine-grid {
    grid-template-columns: 1fr;
  }
  .canvas-refine-side {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid rgba(var(--lavender-rgb), 0.08);
    padding-top: 12px;
  }
}

/* ═══════════════════════════════════════════════════════════
   Pro Features: Folders, Command Palette, Slash Commands,
   Share Dialog, Feedback Buttons, Folder Modal
   ═══════════════════════════════════════════════════════════ */

/* ── Sidebar Folders ── */
.sidebar-folders {
  padding: 0 12px;
  margin-bottom: 4px;
}
.folder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(var(--lavender-rgb), 0.4);
}
.folder-add-btn {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: rgba(var(--lavender-rgb), 0.5);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.folder-add-btn:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  color: rgba(var(--lavender-rgb), 0.9);
}
.folder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.8rem;
  color: rgba(var(--athens-rgb), 0.7);
}
.folder-item:hover {
  background: rgba(var(--lavender-rgb), 0.06);
}
.folder-item.active {
  background: rgba(var(--lavender-rgb), 0.12);
  color: rgba(var(--athens-rgb), 0.95);
}
.folder-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.folder-dot-default {
  background: rgba(var(--lavender-rgb), 0.3);
}
.folder-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-count {
  font-size: 0.65rem;
  color: rgba(var(--lavender-rgb), 0.35);
  flex-shrink: 0;
}
.folder-menu-btn {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: rgba(var(--lavender-rgb), 0.3);
  cursor: pointer;
  border-radius: var(--r-xs);
  font-size: 0.8rem;
  line-height: 1;
  opacity: 0;
  transition: all 0.15s;
}
.folder-item:hover .folder-menu-btn {
  opacity: 1;
}
.folder-menu-btn:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  color: rgba(var(--lavender-rgb), 0.8);
}

/* ── Command Palette ── */
.cmd-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  animation: fadeIn 0.15s ease;
}
.cmd-palette {
  width: 90%;
  max-width: 560px;
  background: var(--s2);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: slideUp 0.2s var(--ease-spring);
}
.cmd-palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.08);
  color: rgba(var(--lavender-rgb), 0.5);
}
.cmd-palette-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--athens);
  font-size: 0.95rem;
  font-family: var(--ff-body);
}
.cmd-palette-input::placeholder {
  color: rgba(var(--lavender-rgb), 0.35);
}
.cmd-palette-esc {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: rgba(var(--lavender-rgb), 0.08);
  color: rgba(var(--lavender-rgb), 0.4);
  font-family: var(--ff-mono);
  flex-shrink: 0;
}
.cmd-palette-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 0;
}
.cmd-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 0.85rem;
  color: rgba(var(--athens-rgb), 0.8);
}
.cmd-palette-item:hover,
.cmd-palette-item.active {
  background: rgba(var(--lavender-rgb), 0.08);
}
.cmd-palette-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: rgba(var(--lavender-rgb), 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.cmd-palette-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmd-palette-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cmd-palette-preview {
  font-size: 0.7rem;
  color: rgba(var(--athens-rgb), 0.35);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmd-palette-loading {
  padding: 10px 16px;
  font-size: 0.75rem;
  color: rgba(var(--athens-rgb), 0.35);
  font-style: italic;
}
.cmd-palette-type {
  font-size: 0.65rem;
  color: rgba(var(--lavender-rgb), 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

/* ── Slash Commands Popup ── */
.slash-popup {
  position: fixed;
  z-index: 9000;
  width: 320px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--s2);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-md);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.15s var(--ease-spring);
}
.slash-popup-list {
  padding: 4px;
}
.slash-popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.1s;
}
.slash-popup-item:hover,
.slash-popup-item.active {
  background: rgba(var(--lavender-rgb), 0.08);
}
.slash-popup-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  background: rgba(var(--lavender-rgb), 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: rgba(var(--lavender-rgb), 0.6);
  flex-shrink: 0;
}
.slash-popup-cmd {
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  color: var(--athens);
  font-weight: 500;
  flex-shrink: 0;
}
.slash-popup-desc {
  font-size: 0.7rem;
  color: rgba(var(--lavender-rgb), 0.4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Share Dialog ── */
#shareModal { text-align: left; width: 480px; max-width: calc(100vw - 40px); align-items: stretch; }
#shareModal .modal-title { text-align: left; }
#shareModal .modal-actions { align-self: stretch; }
#shareModal .modal-actions .modal-btn { width: 100%; }
#shareModal .share-create-row { text-align: left; }
.share-section {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.08);
  text-align: left;
}
.share-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.share-section .modal-message { text-align: left; margin-bottom: 4px; }
.share-section-title {
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lavender);
  margin-bottom: 6px;
}
.share-invite-row {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}
.share-invite-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--lavender-rgb), 0.16);
  background: rgba(var(--lavender-rgb), 0.05);
  color: var(--white);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.share-invite-input::placeholder { color: rgba(var(--athens-rgb), 0.35); }
.share-invite-input:focus {
  border-color: var(--lavender);
  box-shadow: 0 0 0 3px rgba(var(--lavender-rgb), 0.15);
}
.share-participants {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.share-participant {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: rgba(var(--lavender-rgb), 0.04);
  border: 1px solid rgba(var(--lavender-rgb), 0.06);
}
.share-participant-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.65rem; font-weight: 700;
  background: rgba(var(--jacarta-rgb), 0.5);
  color: var(--white);
  flex-shrink: 0;
}
.share-participant-info { flex: 1; min-width: 0; }
.share-participant-name { font-size: 0.82rem; font-weight: 600; color: var(--white); }
.share-participant-email { font-size: 0.7rem; color: rgba(var(--athens-rgb), 0.45); }
.share-participant-status {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
}
.share-participant-status.active { background: rgba(16, 185, 129, 0.12); color: #34d399; }
.share-participant-status.pending { background: rgba(245, 158, 11, 0.12); color: #C5A572; }
.share-participant-remove {
  background: none; border: none; color: rgba(var(--athens-rgb), 0.35);
  cursor: pointer; font-size: 0.85rem; padding: 4px;
}
.share-participant-remove:hover { color: #E5484D; }
.share-join-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.68rem; color: rgba(var(--athens-rgb), 0.55);
  cursor: pointer; user-select: none;
}
.share-join-toggle input { accent-color: var(--lavender); }
.share-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  max-height: 200px;
  overflow-y: auto;
}
.share-link-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--r-sm);
  background: rgba(var(--lavender-rgb), 0.04);
  border: 1px solid rgba(var(--lavender-rgb), 0.06);
}
.share-link-item.expired {
  opacity: 0.5;
}
.share-link-url {
  flex: 1;
  font-size: 0.75rem;
  font-family: var(--ff-mono);
}
.share-link-item .modal-btn {
  padding: 4px 10px;
  font-size: 0.7rem;
  border-radius: var(--r-sm);
}
.share-expired-tag {
  font-size: 0.6rem;
  color: #f44336;
  text-transform: uppercase;
  font-weight: 600;
}
.share-create-row {
  margin-bottom: 12px;
}

/* ── Shared conversation UI ── */
.conv-shared-icon { color: var(--lavender); flex-shrink: 0; margin-right: 2px; }
.conv-shared-label { color: var(--lavender) !important; }

.conv-invite-banner {
  margin: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.conv-invite-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(var(--lavender-rgb), 0.12), rgba(var(--jacarta-rgb), 0.2));
  border: 1px solid rgba(var(--lavender-rgb), 0.25);
}
.conv-invite-text {
  flex: 1;
  font-size: 0.75rem;
  line-height: 1.45;
  color: rgba(var(--athens-rgb), 0.85);
}
.conv-invite-title { color: var(--lavender); font-weight: 600; }
.conv-invite-actions { display: flex; gap: 6px; }
.conv-invite-accept {
  padding: 5px 12px;
  border-radius: var(--r-sm);
  border: none;
  background: var(--lavender);
  color: #14102E;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}
.conv-invite-accept:hover { filter: brightness(1.15); }
.conv-invite-decline {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(var(--lavender-rgb), 0.2);
  background: transparent;
  color: rgba(var(--athens-rgb), 0.5);
  cursor: pointer;
  font-size: 0.7rem;
}
.conv-invite-decline:hover { color: #E5484D; border-color: rgba(229, 72, 77, 0.4); }

/* Shared conversation banner in the chat header area */
.shared-conv-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 0.72rem;
  color: rgba(var(--athens-rgb), 0.6);
  background: rgba(var(--lavender-rgb), 0.05);
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.08);
}
.shared-conv-banner svg { color: var(--lavender); flex-shrink: 0; }
.shared-conv-banner .shared-conv-who { font-weight: 600; color: rgba(var(--athens-rgb), 0.8); }
.shared-conv-banner button {
  margin-left: auto;
  padding: 3px 10px;
  font-size: 0.66rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--lavender-rgb), 0.25);
  background: transparent;
  color: var(--lavender);
  cursor: pointer;
}
.shared-conv-banner button:hover { background: rgba(var(--lavender-rgb), 0.12); }

/* Sender attribution on human messages in shared conversations */
.msg-sender-name {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--lavender);
  margin-bottom: 3px;
}

/* System notes in shared conversations (context imports, joins) */
.msg.system-note {
  justify-content: center;
  margin: 10px 0;
}
.msg-system-text {
  font-size: 0.72rem;
  color: rgba(var(--athens-rgb), 0.45);
  background: rgba(var(--lavender-rgb), 0.06);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: 999px;
  padding: 5px 14px;
}

/* ── Folder Modal ── */
.folder-color-picker {
  display: flex;
  gap: 8px;
  margin: 8px 0 16px;
}
.folder-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}
.folder-color-swatch.active {
  border-color: var(--athens);
  transform: scale(1.15);
}
.folder-color-swatch:hover {
  transform: scale(1.1);
}

/* ── Message Feedback Buttons ── */
.msg-feedback-btn svg { width: 16px; height: 16px; }
.msg-feedback-btn.feedback-active { color: #B9A9F2; background: rgba(var(--lavender-rgb), 0.14); }
[data-theme="light"] .msg-feedback-btn.feedback-active { color: var(--jacarta); }
.msg-feedback-btn.feedback-active svg { fill: currentColor; fill-opacity: 0.25; }

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════
   Simplified Canvas — Floating Prompt Bar + Text Overlay Editor
   ═══════════════════════════════════════════════════════════ */

/* ── Header action buttons ── */
.iris-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.iris-header-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--lavender-rgb), 0.03);
  color: rgba(var(--athens-rgb), 0.6);
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s var(--ease-smooth);
}

.iris-header-btn:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--athens);
  border-color: rgba(var(--lavender-rgb), 0.28);
  transform: translateY(-1px);
}

.iris-header-btn:active {
  transform: translateY(0);
}

.iris-header-btn.hidden { display: none !important; }

/* ── Floating prompt bar ── */
.canvas-prompt-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--r-xl);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--s0-rgb), 0.5);
  backdrop-filter: blur(12px);
}

.canvas-prompt-bar.hidden { display: none !important; }

.canvas-prompt-bar textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--white);
  font-family: var(--ff-body);
  font-size: 0.95rem;
  line-height: 1.5;
  min-height: 44px;
  max-height: 120px;
  overflow-y: auto;
}

.canvas-prompt-bar textarea::placeholder {
  color: rgba(var(--athens-rgb), 0.3);
}

.canvas-prompt-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.canvas-ratio-pills {
  display: flex;
  gap: 4px;
}

.canvas-ratio-pill {
  padding: 4px 10px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: transparent;
  color: rgba(var(--athens-rgb), 0.5);
  font-family: var(--ff-mono, monospace);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.canvas-ratio-pill:hover {
  border-color: rgba(var(--lavender-rgb), 0.3);
  color: var(--athens);
}

.canvas-ratio-pill.active {
  background: rgba(var(--jacarta-rgb), 0.72);
  border-color: rgba(var(--lavender-rgb), 0.26);
  color: #fff;
}

.canvas-generate-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--r-sm);
  border: none;
  background: linear-gradient(135deg, var(--jacarta), var(--lavender));
  color: #fff;
  font-family: var(--ff-heading);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s var(--ease-smooth);
  box-shadow: 0 4px 16px rgba(var(--jacarta-rgb), 0.3);
}

.canvas-generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(var(--lavender-rgb), 0.35);
}

.canvas-generate-btn:active {
  transform: translateY(0);
}

.canvas-generate-btn.generating {
  opacity: 0.7;
  pointer-events: none;
}

/* ── Refine controls ── */
.canvas-refine-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.canvas-refine-toggle-group,
.canvas-strength-group {
  display: flex;
  gap: 4px;
}

.canvas-strength-group {
  align-items: center;
}

.canvas-refine-pill,
.canvas-strength-pill {
  padding: 4px 11px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: rgba(var(--lavender-rgb), 0.025);
  color: rgba(var(--athens-rgb), 0.45);
  font-family: var(--ff-heading);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s var(--ease-smooth);
  white-space: nowrap;
}

.canvas-refine-pill:hover,
.canvas-strength-pill:hover {
  border-color: rgba(var(--lavender-rgb), 0.28);
  color: var(--athens);
  background: rgba(var(--lavender-rgb), 0.08);
}

.canvas-refine-pill.active,
.canvas-strength-pill.active {
  background: rgba(var(--lavender-rgb), 0.13);
  border-color: rgba(var(--lavender-rgb), 0.28);
  color: var(--white);
}

/* ── Mask button ── */
.canvas-mask-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--lavender-rgb), 0.025);
  color: rgba(var(--athens-rgb), 0.6);
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s var(--ease-smooth);
}

.canvas-mask-btn:hover {
  border-color: rgba(var(--lavender-rgb), 0.28);
  color: var(--athens);
  background: rgba(var(--lavender-rgb), 0.08);
}

.canvas-mask-btn.active {
  background: rgba(240, 68, 56, 0.12);
  border-color: rgba(240, 68, 56, 0.4);
  color: #f04438;
}

/* ── Mask canvas overlay ── */
.mask-canvas-overlay {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
  z-index: 10;
  touch-action: none;
}

.mask-brush-indicator {
  position: absolute;
  border: 2px solid rgba(255, 0, 0, 0.5);
  border-radius: 50%;
  pointer-events: none;
  z-index: 11;
  display: none;
  transition: width 0.05s, height 0.05s;
}

/* ── Mask toolbar ── */
.mask-toolbar {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: rgba(var(--s0-rgb), 0.95);
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  backdrop-filter: blur(12px);
  z-index: 12;
  white-space: nowrap;
}

.mask-toolbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mask-toolbar-label {
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.6);
}

.mask-toolbar-val {
  font-family: var(--ff-mono, monospace);
  font-size: 0.68rem;
  color: var(--lavender);
  min-width: 24px;
}

.mask-toolbar-actions {
  display: flex;
  gap: 6px;
}

.mask-toolbar-btn {
  padding: 4px 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  background: transparent;
  color: rgba(var(--athens-rgb), 0.7);
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.mask-toolbar-btn:hover {
  border-color: rgba(var(--lavender-rgb), 0.3);
  color: var(--athens);
  background: rgba(var(--lavender-rgb), 0.06);
}

/* ── Reference preview ── */
.canvas-reference-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  background: rgba(var(--s0-rgb), 0.3);
  margin-bottom: 4px;
}

.canvas-reference-preview img {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  object-fit: cover;
}

.canvas-reference-preview div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.canvas-reference-preview strong {
  font-size: 0.78rem;
  color: var(--athens);
  font-weight: 600;
}

.canvas-reference-preview span {
  font-size: 0.7rem;
  color: rgba(var(--athens-rgb), 0.4);
}

.canvas-reference-preview button {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: rgba(var(--athens-rgb), 0.4);
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: all 0.15s;
}

.canvas-reference-preview button:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--athens);
}

/* ═══════════════════════════════════════════════════════════
   Text Overlay Editor
   ═══════════════════════════════════════════════════════════ */

/* ═══ Maps Editor Overlay ═══
   Slides up within the chat area (position: absolute within .main),
   not a full-screen takeover. The sidebar stays visible.
   Opens from a map artifact card's "Open Editor" button.
   The iframe loads maps/index.php?diagram=ID which handles
   all editing, node types, connections, export, and AI analysis. */
.maps-overlay {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: rgba(5, 3, 20, 0.96);
  backdrop-filter: blur(20px);
  animation: mapsSlideUp 0.35s var(--ease-spring);
}
/* On mobile, stop the overlay at the top of the prompt box so the
   maps sidebar isn't hidden behind the full-width input area.
   --input-area-h is set by JS on .main. */
@media (max-width: 768px) {
  .maps-overlay {
    bottom: var(--input-area-h, 140px);
  }
}
.maps-overlay.hidden { display: none !important; }

/* ── Map iteration status chip (inside the maps overlay) ──
   Shows progress while the prompt box iterates the open map. */
.map-iterate-status {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 95;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(520px, calc(100% - 32px));
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(var(--s0-rgb), 0.94);
  border: 1px solid rgba(var(--lavender-rgb), 0.28);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  color: var(--text-1, #e5e7eb);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.map-iterate-status.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.map-iterate-spinner {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(var(--lavender-rgb), 0.3);
  border-top-color: var(--lavender, #a78bfa);
  animation: mapIterateSpin 0.8s linear infinite;
}
@keyframes mapIterateSpin { to { transform: rotate(360deg); } }
@media (max-width: 768px) {
  .map-iterate-status { bottom: 12px; font-size: 0.72rem; padding: 8px 14px; }
  .map-iterate-status { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* ── Image Gallery overlay ── */
.gallery-overlay {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: rgba(5, 3, 20, 0.96);
  backdrop-filter: blur(20px);
  animation: mapsSlideUp 0.35s var(--ease-spring);
}
.gallery-overlay.hidden { display: none !important; }
.gallery-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.gallery-overlay-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ff-heading);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--white);
}
.gallery-overlay-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
}
.gallery-overlay-close:hover { color: var(--text); background: rgba(var(--border-rgb), 0.3); }
.gallery-overlay-grid {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.gallery-item {
  border-radius: 12px;
  overflow: hidden;
  background: var(--s2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.gallery-item:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--lavender-rgb), 0.4);
}
.gallery-item-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--s1);
}
.gallery-item-info {
  padding: 8px 10px;
}
.gallery-item-prompt {
  font-size: 0.7rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.gallery-item-meta {
  font-size: 0.62rem;
  color: var(--text-muted);
}
.gallery-overlay-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.84rem;
}
.gallery-overlay-empty.hidden { display: none; }
@media (max-width: 600px) {
  .gallery-overlay-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 12px;
  }
}

/* ── Map Templates popover ── */
.map-templates-popover {
  position: absolute;
  bottom: calc(var(--input-area-h, 140px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: 640px;
  max-width: calc(100vw - 24px);
  max-height: 70vh;
  background: var(--s2);
  border: none;
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: mapTemplatesSlideUp 0.3s var(--ease-spring);
}
@keyframes mapTemplatesSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.map-templates-popover[hidden] { display: none; }
.map-templates-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: none;
  flex-shrink: 0;
}
.map-templates-popover-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.map-templates-popover-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-lg);
  background: rgba(95, 201, 184, 0.12);
  color: #5FC9B8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.map-templates-popover-title {
  font-family: var(--ff-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--white);
}
.map-templates-popover-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.map-templates-popover-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--r-md);
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.map-templates-popover-close:hover { color: var(--text); background: rgba(var(--border-rgb), 0.2); }
.map-templates-popover-body {
  overflow-y: auto;
  padding: 16px 20px 20px;
}
.map-templates-category-label {
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 12px 0 8px;
}
.map-templates-category-label:first-child { margin-top: 0; }
.map-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 4px;
}
.map-template {
  padding: 16px;
  border-radius: var(--r-xl);
  background: rgba(var(--border-rgb), 0.1);
  border: none;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.map-template::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #5FC9B8, rgba(95, 201, 184, 0));
  opacity: 0;
  transition: opacity 0.18s;
}
.map-template:hover {
  background: rgba(95, 201, 184, 0.06);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.map-template:hover::before { opacity: 1; }
.map-template:active { transform: translateY(0); }
.map-template-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.map-template-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(95, 201, 184, 0.12);
  color: #5FC9B8;
  display: flex;
  align-items: center;
  justify-content: center;
}
.map-template-steps {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(var(--border-rgb), 0.3);
  padding: 3px 7px;
  border-radius: 10px;
}
.map-template-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.map-template-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.35;
}
@media (max-width: 600px) {
  .map-templates-popover { width: calc(100vw - 24px); max-height: 75vh; }
  .map-templates-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 8px; }
  .map-template { padding: 12px; }
  .map-templates-popover-header { padding: 12px 14px 10px; }
  .map-templates-popover-body { padding: 10px 14px 14px; }
}

@keyframes mapsSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Toolbar matches the image overlay editor's .overlay-editor-toolbar */
.maps-overlay-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.08);
  background: rgba(var(--s0-rgb), 0.3);
  flex-shrink: 0;
}
.maps-overlay-label {
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.6);
  letter-spacing: 0.02em;
}
/* Done button reuses .overlay-tool-btn — same styling as image editor */
.maps-overlay-iframe {
  flex: 1;
  border: none;
  width: 100%;
  background: #0a0a0a;
}

.canvas-overlay-editor {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  border-radius: var(--r-lg);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: rgba(var(--s0-rgb), 0.15);
  overflow: hidden;
  min-height: 400px;
}

.canvas-overlay-editor.hidden { display: none !important; }

.overlay-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.08);
  background: rgba(var(--s0-rgb), 0.3);
  flex-wrap: wrap;
}

.overlay-tool-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.overlay-tool-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: rgba(var(--lavender-rgb), 0.025);
  color: rgba(var(--athens-rgb), 0.6);
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s var(--ease-smooth);
}

.overlay-tool-btn:hover {
  border-color: rgba(var(--lavender-rgb), 0.28);
  color: var(--athens);
  background: rgba(var(--lavender-rgb), 0.1);
  transform: translateY(-1px);
}

.overlay-tool-btn:active {
  transform: translateY(0);
}

.overlay-editor-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
}

#overlayCanvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--r-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  touch-action: none;
}

/* Inspector slideout drawer — content styles */
.overlay-inspector-empty {
  text-align: center;
  color: rgba(var(--athens-rgb), 0.3);
  font-size: 0.8rem;
  padding: 20px;
}

.ov-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06);
}

.ov-section:last-child {
  border-bottom: none;
}

.ov-section-title {
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--lavender);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.ov-row {
  margin-bottom: 10px;
}

.ov-field-label {
  display: block;
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.6);
  margin-bottom: 5px;
}

.overlay-inspector-value {
  float: right;
  font-family: var(--ff-mono, monospace);
  font-size: 0.68rem;
  color: var(--lavender);
}

.overlay-inspector-input {
  width: 100%;
  background: rgba(var(--s0-rgb), 0.5);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  color: var(--white);
  font-family: var(--ff-body);
  font-size: 0.85rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

.overlay-inspector-input:focus {
  border-color: rgba(var(--lavender-rgb), 0.3);
}

.overlay-inspector-select {
  width: 100%;
  background: rgba(var(--s0-rgb), 0.5);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  color: var(--white);
  font-family: var(--ff-body);
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
}

.overlay-inspector-range {
  width: 100%;
  height: 4px;
  border-radius: var(--r-xs);
  background: rgba(var(--lavender-rgb), 0.12);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}

.overlay-inspector-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--lavender);
  cursor: pointer;
  border: 2px solid var(--white);
}

.overlay-inspector-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--lavender);
  cursor: pointer;
  border: 2px solid var(--white);
}

/* Colour palette */
.overlay-inspector-colour-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.overlay-inspector-colour {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.overlay-swatch {
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  cursor: pointer;
  transition: transform 0.15s;
  padding: 0;
  flex-shrink: 0;
}

.overlay-swatch:hover {
  transform: scale(1.15);
}

.overlay-swatch.active {
  box-shadow: 0 0 0 2px var(--lavender);
}

/* Button groups */
.overlay-inspector-weight-row,
.overlay-align-row,
.overlay-bgstyle-row,
.overlay-shadow-row {
  display: flex;
  gap: 4px;
}

.overlay-weight-btn,
.overlay-align-btn,
.overlay-bgstyle-btn,
.overlay-shadow-btn {
  flex: 1;
  padding: 5px 6px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: transparent;
  color: rgba(var(--athens-rgb), 0.5);
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-weight-btn:hover,
.overlay-align-btn:hover,
.overlay-bgstyle-btn:hover,
.overlay-shadow-btn:hover {
  border-color: rgba(var(--lavender-rgb), 0.3);
  color: var(--athens);
}

.overlay-weight-btn.active,
.overlay-align-btn.active,
.overlay-bgstyle-btn.active,
.overlay-shadow-btn.active {
  background: rgba(var(--lavender-rgb), 0.13);
  border-color: rgba(var(--lavender-rgb), 0.28);
  color: var(--white);
}

/* Actions */
.overlay-inspector-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.overlay-inspector-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  background: transparent;
  color: rgba(var(--athens-rgb), 0.6);
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.overlay-inspector-btn:hover {
  border-color: rgba(var(--lavender-rgb), 0.3);
  color: var(--athens);
  background: rgba(var(--lavender-rgb), 0.06);
}

.overlay-inspector-btn-danger:hover {
  border-color: rgba(240, 68, 56, 0.4);
  color: #f04438;
  background: rgba(240, 68, 56, 0.06);
}

/* Layers list */
.overlay-inspector-layers {
  margin-top: 4px;
}

.overlay-layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.06);
  background: rgba(var(--s0-rgb), 0.2);
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.overlay-layer-item:hover {
  border-color: rgba(var(--lavender-rgb), 0.2);
}

.overlay-layer-item.active {
  border-color: rgba(var(--lavender-rgb), 0.3);
  background: rgba(var(--lavender-rgb), 0.08);
}

.overlay-layer-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.overlay-layer-row strong {
  font-size: 0.72rem;
  color: var(--athens);
  font-weight: 600;
  white-space: nowrap;
}

.overlay-layer-text {
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overlay-layer-vis {
  display: flex;
  align-items: center;
  color: rgba(var(--athens-rgb), 0.5);
  cursor: pointer;
  flex-shrink: 0;
}

.overlay-layer-vis:hover {
  color: var(--athens);
}

.overlay-layer-vis.hidden-layer {
  opacity: 0.3;
}

.overlay-layer-controls {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.overlay-layer-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: rgba(var(--athens-rgb), 0.4);
  cursor: pointer;
  transition: all 0.15s;
}

.overlay-layer-arrow:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--athens);
}

/* Tool divider */
.overlay-tool-divider {
  width: 1px;
  height: 20px;
  background: rgba(var(--lavender-rgb), 0.15);
  margin: 0 4px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .canvas-prompt-bar { border-radius: var(--r-lg); padding: 10px 12px; }
  .canvas-prompt-bar textarea { font-size: 16px; }
  .overlay-editor-toolbar { flex-direction: column; align-items: stretch; }
  .overlay-tool-group { justify-content: center; flex-wrap: wrap; }
  #overlayCanvas { max-height: 50vh; }
}

/* ── Settings Drawer: 2/3 width on desktop ── */
#settingsDrawer {
  width: min(880px, 66vw);
}

@media (max-width: 900px) {
  #settingsDrawer {
    width: 100vw;
    max-width: 100vw;
  }
}

/* ── Scrollable Drawer Tabs ── */
.drawer-tabs-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* Fade the strip edges so cut-off tabs read as "scroll for more" */
  mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 28px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 28px), transparent 100%);
}
.drawer-tabs-scroll::-webkit-scrollbar { display: none; }
.drawer-tabs-scroll .drawer-tab {
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Performance Monitor Panel ── */
#perfPanel .drawer-body { padding: 16px 18px; }
#perfHours {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(var(--lavender-rgb), 0.06);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  color: var(--athens);
  font-family: var(--ff-heading);
  cursor: pointer;
  outline: none;
}
#perfHours:focus { border-color: rgba(var(--lavender-rgb), 0.3); }
#perfPanel .btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--ff-heading);
  border-radius: 8px;
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--lavender-rgb), 0.06);
  color: var(--athens);
  cursor: pointer;
  transition: all 0.18s var(--ease-smooth);
}
#perfPanel .btn:hover {
  background: rgba(var(--lavender-rgb), 0.12);
  border-color: rgba(var(--lavender-rgb), 0.22);
}
#perfPanel .btn:active { transform: scale(0.97); }
#perfPanel .btn-sm { padding: 5px 11px; font-size: 0.68rem; }
#perfOutput { font-family: var(--ff-body); }
#perfOutput h4 {
  margin: 20px 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(var(--athens-rgb), 0.45);
  font-family: var(--ff-heading);
  font-weight: 700;
}
#perfOutput table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
  font-family: var(--ff-heading);
}
#perfOutput thead tr { border-bottom: 2px solid rgba(var(--lavender-rgb), 0.12); }
#perfOutput thead th {
  text-align: left;
  padding: 8px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(var(--athens-rgb), 0.4);
  font-weight: 700;
}
#perfOutput thead th[style*="text-align:right"],
#perfOutput th[style*="text-align: right"] { text-align: right; }
#perfOutput tbody tr { border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06); }
#perfOutput tbody tr:hover { background: rgba(var(--lavender-rgb), 0.03); }
#perfOutput td { padding: 8px 12px; color: rgba(var(--athens-rgb), 0.7); }
#perfOutput td[style*="text-align:right"],
#perfOutput td[style*="text-align: right"] { text-align: right; }
#perfOutput .spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(var(--lavender-rgb), 0.15);
  border-top-color: var(--lavender);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Usage Panel Styles ── */
.usage-loading, .usage-empty, .usage-error {
  text-align: center;
  padding: 40px 20px;
  color: rgba(var(--athens-rgb), 0.4);
  font-size: 0.85rem;
}
.usage-error { color: var(--danger, #ff8c8c); }

.usage-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.usage-stat {
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: rgba(var(--lavender-rgb), 0.04);
  border: 1px solid rgba(var(--lavender-rgb), 0.06);
}
.usage-stat--accent {
  background: rgba(var(--lavender-rgb), 0.08);
  border-color: rgba(var(--lavender-rgb), 0.15);
}
.usage-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(var(--athens-rgb), 0.4);
  margin-bottom: 4px;
}
.usage-stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  font-family: var(--ff-heading);
}
.usage-stat-sub {
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.3);
  margin-top: 2px;
}
.usage-stat-value.overage { color: var(--warn, #ffc88c); }

.usage-credit-bar-wrap { margin-bottom: 20px; }
.usage-credit-bar {
  width: 100%;
  height: 8px;
  border-radius: var(--r-xs);
  background: rgba(var(--lavender-rgb), 0.08);
  overflow: hidden;
}
.usage-credit-fill {
  height: 100%;
  border-radius: var(--r-xs);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.usage-credit-fill--ok { background: linear-gradient(90deg, #2d2769, var(--lavender)); }
.usage-credit-fill--warn { background: linear-gradient(90deg, #b8860b, var(--warn, #ffc88c)); }
.usage-credit-fill--over { background: linear-gradient(90deg, #8b0000, var(--danger, #ff8c8c)); }
.usage-credit-text {
  font-size: 0.75rem;
  color: rgba(var(--athens-rgb), 0.5);
  margin-top: 6px;
}

.usage-section-title {
  font-size: 0.9rem;
  font-weight: 800;
  font-family: var(--ff-heading);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06);
}

.usage-table-wrap {
  overflow-x: auto;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.06);
}
.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.usage-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.08);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(var(--athens-rgb), 0.4);
  font-weight: 700;
  white-space: nowrap;
}
.usage-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.04);
  white-space: nowrap;
}
.usage-table tr:hover td { background: rgba(var(--lavender-rgb), 0.02); }
.usage-table .mono { font-family: var(--ff-mono); font-size: 0.72rem; }
.usage-table .overage { color: var(--warn, #ffc88c); font-weight: 700; }
.usage-subtext { font-size: 0.68rem; color: rgba(var(--athens-rgb), 0.3); }
.usage-tier-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-size: 0.62rem;
  font-weight: 700;
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--lavender);
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  white-space: nowrap;
}

/* ── Usage Bar Rows (horizontal bars) ── */
.usage-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.72rem;
}
.usage-bar-label {
  width: 120px;
  text-align: right;
  color: rgba(var(--athens-rgb), 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.usage-bar-track {
  flex: 1;
  height: 22px;
  border-radius: var(--r-xs);
  background: rgba(var(--lavender-rgb), 0.06);
  overflow: hidden;
}
.usage-bar-fill {
  height: 100%;
  border-radius: var(--r-xs);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  background: var(--lavender);
}
.usage-bar-fill--ok { background: linear-gradient(90deg, #2d2769, var(--lavender)); }
.usage-bar-fill--warn { background: linear-gradient(90deg, #b8860b, var(--warn, #ffc88c)); }
.usage-bar-fill--over { background: linear-gradient(90deg, #8b0000, var(--danger, #ff8c8c)); }
.usage-bar-value {
  width: 80px;
  text-align: right;
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  flex-shrink: 0;
}

/* ── Usage Charts ── */
.usage-chart-wrap {
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.06);
  padding: 16px;
  background: rgba(var(--lavender-rgb), 0.02);
}
.usage-chart-svg {
  width: 100%;
  height: 120px;
  display: block;
  overflow: visible;
}
.usage-chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: rgba(var(--athens-rgb), 0.3);
  margin-top: 6px;
}

/* ── Usage Donut ── */
.usage-donut-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.06);
  padding: 20px;
  background: rgba(var(--lavender-rgb), 0.02);
}
.usage-donut {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.usage-donut-center {
  font-size: 7px;
  font-weight: 800;
  fill: var(--white, #f8f5ff);
}
.usage-donut-sub {
  font-size: 3px;
  fill: rgba(var(--athens-rgb), 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.usage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.5);
  flex: 1;
  min-width: 200px;
}
.usage-legend span { display: inline-flex; align-items: center; gap: 5px; }
.usage-legend i {
  width: 10px;
  height: 10px;
  border-radius: var(--r-xs);
  display: inline-block;
  flex-shrink: 0;
}

/* ── Mobile: usage panels ── */
@media (max-width: 720px) {
  .usage-stats-grid { grid-template-columns: 1fr 1fr; }
  .usage-bar-label { width: 80px; }
  .usage-bar-value { width: 60px; }
  .usage-table { font-size: 0.68rem; }
  .usage-table th, .usage-table td { padding: 6px 6px; }
  .usage-donut-wrap { flex-direction: column; align-items: flex-start; }
}

/* ── Engage-inspired Usage Analytics Polish ── */
#myUsageBody,
#adminUsageBody {
  --usage-purple: #6c5ce7;
  --usage-lavender: #a594d6;
  --usage-text: #f8f7ff;
  --usage-muted: rgba(248,247,255,.62);
  --usage-ghost: rgba(248,247,255,.38);
  --usage-border: rgba(165,148,214,.14);
  --usage-card: rgba(31,27,50,.98);
  --usage-card-2: rgba(37,32,58,.92);
}
.usage-hero {
  margin-bottom: 18px;
  padding: 20px 22px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 8% 0%, rgba(108,92,231,.26), transparent 36%),
    linear-gradient(135deg, rgba(31,27,50,.98), rgba(20,17,34,.96));
  border: 1px solid var(--usage-border);
  box-shadow: 0 18px 45px rgba(0,0,0,.28);
}
.usage-kicker {
  color: var(--usage-lavender);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 6px;
}
.usage-hero h3 {
  margin: 0;
  color: var(--usage-text);
  font-size: 1.45rem;
  letter-spacing: -0.04em;
}
.usage-hero p {
  margin: 6px 0 0;
  color: var(--usage-muted);
  font-size: .82rem;
}
.usage-stat {
  border-radius: 22px;
  padding: 18px;
  background: var(--usage-card);
  border: 1px solid var(--usage-border);
  box-shadow: 0 18px 45px rgba(0,0,0,.24);
  transition: transform .2s var(--ease-smooth), box-shadow .2s var(--ease-smooth);
}
.usage-stat:hover,
.usage-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 60px rgba(0,0,0,.34);
}
.usage-stat--accent {
  background:
    radial-gradient(circle at top left, rgba(108,92,231,.26), transparent 40%),
    var(--usage-card);
  border-color: rgba(165,148,214,.24);
}
.usage-stat-label {
  color: var(--usage-muted);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .1em;
}
.usage-stat-value {
  color: var(--usage-text);
  font-size: 1.7rem;
  font-weight: 950;
  letter-spacing: -0.04em;
}
.usage-stat-sub { color: var(--usage-muted); }
.usage-credit-card,
.usage-card {
  border-radius: var(--r-xl);
  background: var(--usage-card);
  border: 1px solid var(--usage-border);
  box-shadow: 0 18px 45px rgba(0,0,0,.28);
}
.usage-credit-card { padding: 18px; margin-bottom: 20px; }
.usage-credit-top,
.usage-credit-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--usage-muted);
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.usage-credit-top strong { color: var(--usage-text); }
.usage-credit-bar {
  height: 10px;
  border-radius: var(--r-xs);
  background: rgba(255,255,255,.08);
  margin: 12px 0;
}
.usage-credit-fill,
.usage-credit-fill--ok {
  border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--usage-purple), var(--usage-lavender));
  box-shadow: 0 0 22px rgba(108,92,231,.28);
}
.usage-dashboard-grid {
  gap: 18px;
}
.usage-card {
  padding: 20px;
  transition: transform .2s var(--ease-smooth), box-shadow .2s var(--ease-smooth);
}
.usage-section-head {
  margin-bottom: 16px;
}
.usage-section-title {
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--usage-text);
  font-size: .78rem;
  font-weight: 950;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.usage-section-head p {
  margin: 4px 0 0;
  color: var(--usage-muted);
  font-size: .74rem;
}
.usage-chart-wrap {
  border-radius: var(--r-xl);
  border: 1px solid rgba(165,148,214,.1);
  background: rgba(255,255,255,.03);
  padding: 14px;
}
.usage-chart-wrap--large .usage-chart-svg,
.usage-chart-svg {
  height: 220px;
}
.usage-grid-line {
  stroke: rgba(255,255,255,.08);
  stroke-width: 1;
}
.usage-line-path {
  fill: none;
  stroke: var(--usage-purple);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.usage-line-dot {
  fill: #fff;
  stroke: var(--usage-purple);
  stroke-width: 2;
}
.usage-axis-label,
.usage-chart-labels {
  fill: var(--usage-ghost);
  color: var(--usage-ghost);
  font-size: .66rem;
  font-weight: 700;
}
.usage-ring-panel {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 220px;
}
.usage-ring-wrap {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto;
  display: grid;
  place-items: center;
}
.usage-ring {
  width: 180px;
  height: 180px;
  transform: rotate(-90deg);
  filter: drop-shadow(0 14px 28px rgba(0,0,0,.28));
}
.usage-ring-track,
.usage-ring-segment {
  fill: none;
  stroke-width: 12;
}
.usage-ring-track { stroke: rgba(255,255,255,.08); }
.usage-ring-segment {
  stroke-linecap: round;
  transition: stroke-dasharray .8s var(--ease-smooth);
}
.usage-ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  pointer-events: none;
}
.usage-ring-center strong {
  color: var(--usage-text);
  font-size: 1.32rem;
  font-weight: 950;
  letter-spacing: -0.04em;
}
.usage-ring-center span {
  color: var(--usage-muted);
  font-size: .58rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.usage-chart-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.usage-chart-leg {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(165,148,214,.1);
}
.usage-chart-leg:hover { background: rgba(255,255,255,.07); }
.usage-leg-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(165,148,214,.08);
}
.usage-chart-leg strong {
  display: block;
  color: var(--usage-text);
  font-size: .74rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.usage-chart-leg small {
  display: block;
  color: var(--usage-muted);
  font-size: .63rem;
  margin-top: 2px;
}
.usage-chart-leg b {
  color: var(--usage-lavender);
  font-size: .78rem;
  font-weight: 950;
  font-family: var(--ff-mono);
}
.usage-bar-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) 74px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.usage-bar-label {
  width: auto;
  text-align: right;
  color: var(--usage-text);
  font-weight: 800;
  font-size: .72rem;
}
.usage-bar-track {
  height: 26px;
  border-radius: var(--r-xs);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.04);
}
.usage-bar-fill {
  border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--bar-color, var(--usage-purple)), var(--usage-lavender)) !important;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 0 20px rgba(108,92,231,.22);
}
.usage-bar-value {
  color: var(--usage-lavender);
  font-weight: 950;
}
.usage-table-wrap {
  border-radius: var(--r-lg);
  border: 1px solid rgba(165,148,214,.12);
  background: rgba(255,255,255,.025);
}
.usage-table th {
  padding: 10px 8px;
  color: var(--usage-ghost);
  font-weight: 900;
  font-size: .62rem;
}
.usage-table td {
  padding: 11px 8px;
  color: var(--usage-text);
  border-bottom-color: rgba(165,148,214,.08);
}
.usage-table tr:hover td { background: rgba(255,255,255,.04); }
.usage-empty,
.usage-loading,
.usage-error {
  border: 1px dashed rgba(165,148,214,.18);
  border-radius: var(--r-xl);
  background: rgba(255,255,255,.025);
  color: var(--usage-muted);
}
@media (max-width: 720px) {
  .usage-ring-panel { grid-template-columns: 1fr; }
  .usage-bar-row { grid-template-columns: 1fr; }
  .usage-bar-label { text-align: left; }
  .usage-bar-value { width: auto; text-align: left; }
}

/* ── Add Credit Modal (Stripe) ── */
.add-credit-modal {
  max-width: 460px;
  width: 92%;
  text-align: left;
  padding: 0;
  gap: 0;
}
.add-credit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(165,148,214,.1);
}
.add-credit-header .modal-title {
  margin: 0 0 4px;
  font-size: 1.1rem;
}
.add-credit-header .modal-message {
  margin: 0;
  font-size: .78rem;
  color: rgba(248,247,255,.55);
}
.add-credit-close {
  background: none;
  border: none;
  color: rgba(248,247,255,.45);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--r-sm);
  transition: all .2s;
}
.add-credit-close:hover {
  color: var(--athens, #f8f7ff);
  background: rgba(165,148,214,.1);
}
.add-credit-amounts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 24px 8px;
}
.add-credit-chip {
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(165,148,214,.18);
  background: rgba(255,255,255,.04);
  color: rgba(248,247,255,.7);
  font-family: var(--ff-heading, Inter, sans-serif);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s var(--ease-smooth, ease);
}
.add-credit-chip:hover {
  border-color: rgba(108,92,231,.4);
  background: rgba(108,92,231,.08);
}
.add-credit-chip.active {
  background: linear-gradient(135deg, #6c5ce7, #a594d6);
  border-color: #6c5ce7;
  color: #fff;
  box-shadow: 0 4px 16px rgba(108,92,231,.3);
}
.add-credit-chip--custom { font-size: .78rem; }
.add-credit-custom-row {
  padding: 0 24px 8px;
}
.add-credit-custom-row .setting-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(165,148,214,.18);
  background: rgba(255,255,255,.04);
  color: var(--athens, #f8f7ff);
  font-size: .9rem;
}
.add-credit-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  margin: 8px 0 0;
  background: rgba(108,92,231,.08);
  border-top: 1px solid rgba(108,92,231,.15);
  border-bottom: 1px solid rgba(108,92,231,.15);
}
.add-credit-summary span {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(248,247,255,.5);
}
.add-credit-summary strong {
  font-size: 1.2rem;
  font-weight: 950;
  color: #6c5ce7;
  font-family: var(--ff-mono, monospace);
}
#addCreditElement {
  padding: 16px 24px 8px;
  min-height: 80px;
}
.add-credit-stripe-msg {
  padding: 20px;
  text-align: center;
  color: rgba(248,247,255,.5);
  font-size: .82rem;
  border: 1px dashed rgba(165,148,214,.18);
  border-radius: var(--r-lg);
  background: rgba(255,255,255,.025);
}
.add-credit-error {
  margin: 0 24px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.2);
  color: #E5484D;
  font-size: .78rem;
  font-weight: 600;
}
.add-credit-actions {
  display: flex;
  gap: 10px;
  padding: 16px 24px 20px;
}
.add-credit-pay-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.add-credit-pay-btn .add-credit-pay-icon {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Usage Add Credit Button ── */
.usage-credit-added {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(165,148,214,.1);
}
.usage-credit-added span {
  font-size: .72rem;
  color: rgba(248,247,255,.5);
  font-weight: 600;
}
.usage-add-credit-btn {
  padding: 7px 16px;
  border-radius: var(--r-sm);
  border: none;
  background: linear-gradient(135deg, #6c5ce7, #a594d6);
  color: #fff;
  font-family: var(--ff-heading, Inter, sans-serif);
  font-size: .76rem;
  font-weight: 800;
  cursor: pointer;
  transition: all .2s var(--ease-smooth, ease);
  box-shadow: 0 4px 16px rgba(108,92,231,.25);
}
.usage-add-credit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(108,92,231,.35);
}

/* ── World-class Users Tab Cards ── */
.users-list {
  display: grid;
  gap: 16px;
}
.user-card-pro {
  position: relative;
  overflow: hidden;
  padding: 0;
  border-radius: var(--r-xl);
  background:
    radial-gradient(circle at 8% 0%, rgba(var(--lavender-rgb), 0.18), transparent 34%),
    linear-gradient(145deg, rgba(var(--s2-rgb), 0.72), rgba(var(--s1-rgb), 0.94));
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  box-shadow: 0 22px 58px rgba(0,0,0,0.24), 0 1px 0 rgba(255,255,255,0.03) inset;
}
.user-card-pro.is-disabled { opacity: 0.62; }
.user-card-pro:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--lavender-rgb), 0.2);
  box-shadow: 0 28px 72px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.035) inset;
}
.user-pro-topline {
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(var(--lavender-rgb),0.9), rgba(var(--jacarta-rgb),0.8), transparent);
}
.user-pro-header {
  padding: 18px 20px 14px;
  align-items: center;
}
.user-avatar-pro {
  width: 46px;
  height: 46px;
  border-radius: var(--r-lg);
  background: linear-gradient(145deg, rgba(var(--jacarta-rgb),0.9), rgba(var(--lavender-rgb),0.35));
  box-shadow: 0 12px 30px rgba(0,0,0,0.28), 0 0 0 1px rgba(255,255,255,0.08) inset;
}
.user-pro-pills { margin-left: auto; justify-content: flex-end; }
.user-pill--tier.internal {
  color: #d8fff3;
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.16), rgba(var(--lavender-rgb), 0.12));
  border-color: rgba(74, 222, 128, 0.28);
}
.user-pro-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 20px 16px;
}
.user-pro-metric {
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: rgba(var(--s3-rgb), 0.38);
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
}
.user-pro-metric span {
  display: block;
  margin-bottom: 4px;
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: rgba(var(--athens-rgb), 0.38);
}
.user-pro-metric strong {
  font-family: var(--ff-mono);
  font-size: 0.88rem;
  color: rgba(var(--athens-rgb), 0.9);
}
.user-pro-metric.is-over strong { color: var(--danger); }
.user-pro-usage {
  margin: 0 20px 16px;
  padding: 14px;
  border-radius: var(--r-xl);
  background: rgba(var(--s0-rgb), 0.24);
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
}
.user-usage-credit-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  font-size: 0.66rem;
  color: rgba(var(--athens-rgb),0.48);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 850;
}
.user-usage-credit-head strong { color: var(--athens); }
.user-pro-controls {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px 20px;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.08);
  background: rgba(var(--s0-rgb), 0.18);
}
.user-pro-actions {
  justify-content: flex-end;
  align-self: end;
}
.user-pro-password {
  padding: 0 20px 18px;
  border-top: 0;
}
.user-role-select {
  cursor: pointer;
  position: relative;
  z-index: 2;
}
.user-role-select option {
  color: #111;
  background: #fff;
}
.user-btn--delete {
  background: rgba(var(--danger-rgb), 0.08);
}
.user-detail-panel {
  margin: 0 20px 16px;
  border-radius: var(--r-xl);
  border: 1px solid rgba(var(--lavender-rgb),0.08);
  background: rgba(var(--s0-rgb),0.18);
}
@media (max-width: 820px) {
  .user-pro-header { align-items: flex-start; }
  .user-pro-pills { width: 100%; margin-left: 0; justify-content: flex-start; }
  .user-pro-metrics, .user-pro-controls { grid-template-columns: 1fr 1fr; }
  .user-pro-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 560px) {
  .user-pro-metrics, .user-pro-controls { grid-template-columns: 1fr; }
  .user-pro-usage { margin-inline: 14px; }
  .user-pro-header, .user-pro-controls, .user-pro-password { padding-inline: 14px; }
}

/* ── Enhanced Icon Settings Navigation ── */
#settingsDrawer { width: min(1040px, 72vw); }
.drawer-tabs-icons {
  display: flex;
  gap: 6px;
  padding: 12px 2px 6px;
  margin-top: 2px;
  border-bottom: none;
}
.drawer-tabs-icons .drawer-tab {
  min-width: 68px;
  height: 58px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 9px;
  border-radius: 13px;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(var(--athens-rgb), 0.5);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: transform 0.18s var(--ease-spring), background 0.18s var(--ease-spring), border-color 0.18s var(--ease-spring), color 0.18s var(--ease-spring), box-shadow 0.18s var(--ease-spring);
}

/* ── Group dividers — subtle vertical separators between tab groups ── */
.drawer-tab-divider {
  width: 1px;
  height: 32px;
  background: rgba(var(--lavender-rgb), 0.12);
  flex-shrink: 0;
  align-self: center;
  margin: 0 4px;
}

/* ── Subtle group tinting — very faint background per group ── */
/* Group 1: AI Behaviour — lavender tint */
.drawer-tabs-icons .tab-grp-ai {
  background: rgba(var(--lavender-rgb), 0.015);
}
/* Group 2: Personal Data — neutral, no tint (baseline) */
.drawer-tabs-icons .tab-grp-data {
  /* intentionally plain — the divider + lack of tint distinguishes it */
}
/* Group 3: Admin — gold tint */
.drawer-tabs-icons .tab-grp-admin {
  background: rgba(var(--gold-rgb), 0.02);
}
.drawer-tabs-icons .tab-grp-admin:hover {
  border-color: rgba(var(--gold-rgb), 0.14);
  background: rgba(var(--gold-rgb), 0.06);
  color: var(--gold-soft);
}
.drawer-tabs-icons .tab-grp-admin.active {
  color: var(--white);
  border-color: rgba(var(--gold-rgb), 0.3);
  background: linear-gradient(145deg, rgba(var(--gold-rgb), 0.55), rgba(var(--gold-rgb), 0.12));
  box-shadow: 0 10px 26px rgba(0,0,0,0.24), 0 0 0 1px rgba(255,255,255,0.04) inset, 0 1px 0 rgba(255,255,255,0.07) inset;
}
.drawer-tabs-icons .drawer-tab svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.18s var(--ease-spring);
}
.drawer-tabs-icons .drawer-tab:hover {
  color: rgba(var(--athens-rgb), 0.92);
  border-color: rgba(var(--lavender-rgb), 0.14);
  background: rgba(var(--lavender-rgb), 0.06);
}
.drawer-tabs-icons .drawer-tab:hover svg { transform: translateY(-1px); }
.drawer-tabs-icons .drawer-tab.active {
  color: var(--white);
  border-color: rgba(var(--lavender-rgb), 0.32);
  background: linear-gradient(145deg, rgba(var(--jacarta-rgb), 0.75), rgba(var(--lavender-rgb), 0.18));
  box-shadow: 0 10px 26px rgba(0,0,0,0.24), 0 0 0 1px rgba(255,255,255,0.04) inset, 0 1px 0 rgba(255,255,255,0.07) inset;
}
.drawer-tabs-icons .drawer-tab.active svg {
  color: var(--lavender-2);
  filter: drop-shadow(0 0 8px rgba(var(--lavender-rgb), 0.5));
}

/* ── Admin-only tab indicator — small gold dot in top-right corner ── */
.drawer-tab-admin::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px rgba(var(--gold-rgb), 0.5);
  flex-shrink: 0;
}
.drawer-tab-admin.active::after {
  background: var(--gold-soft);
  box-shadow: 0 0 8px rgba(var(--gold-rgb), 0.7);
}

/* ── Billing integrity card ── */
.integrity-card { margin-bottom: 18px; }
.integrity-alert {
  display: block;
  padding: 11px 14px;
  margin: 12px 0 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--lavender-rgb), 0.2);
  background: rgba(var(--lavender-rgb), 0.06);
  font-size: 0.78rem;
  line-height: 1.55;
  color: rgba(var(--athens-rgb), 0.72);
}
.integrity-alert strong { color: var(--white); font-weight: 700; }
.integrity-alert--bad {
  border-color: rgba(255, 90, 90, 0.32);
  background: rgba(255, 90, 90, 0.08);
}
.integrity-alert--bad strong { color: rgba(255, 150, 150, 1); }
.integrity-alert--good {
  border-color: rgba(134, 239, 172, 0.28);
  background: rgba(134, 239, 172, 0.07);
}
.integrity-alert--good strong { color: var(--ok); }

.integrity-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
@media (max-width: 720px) { .integrity-grid { grid-template-columns: repeat(2, 1fr); } }
.integrity-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 14px;
  border-radius: var(--r-lg);
  background: rgba(var(--s0-rgb), 0.3);
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
}
.integrity-label {
  font-family: var(--ff-heading);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(var(--athens-rgb), 0.45);
}
.integrity-value {
  font-family: var(--ff-heading);
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.01em;
}
.integrity-value--accent { color: var(--lavender-2); }
.integrity-value--good { color: var(--ok); }
.integrity-value--bad { color: var(--danger); }
.integrity-note {
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.38);
}
.integrity-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.integrity-btn-ghost {
  background: transparent !important;
  border: 1px solid rgba(var(--lavender-rgb), 0.24) !important;
  color: var(--lavender-2) !important;
}
.integrity-btn-ghost:hover {
  background: rgba(var(--lavender-rgb), 0.1) !important;
  border-color: rgba(var(--lavender-rgb), 0.4) !important;
}
.integrity-synced {
  font-size: 0.7rem;
  color: rgba(var(--athens-rgb), 0.35);
  margin-left: auto;
}
.integrity-status {
  min-height: 16px;
  margin-top: 10px;
  font-size: 0.76rem;
  line-height: 1.5;
  color: rgba(var(--athens-rgb), 0.55);
}
.integrity-status.success { color: var(--ok); }
.integrity-status.error { color: var(--danger); }

/* ── Enhanced Usage Dashboard ── */
.usage-hero {
  margin-bottom: 18px;
  padding: 22px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 12% 0%, rgba(var(--lavender-rgb), 0.22), transparent 34%),
    linear-gradient(145deg, rgba(var(--jacarta-rgb), 0.52), rgba(var(--s2-rgb), 0.74));
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  box-shadow: 0 24px 70px rgba(0,0,0,0.24);
}
.usage-kicker {
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(var(--lavender-rgb), 0.95);
  margin-bottom: 6px;
}
.usage-hero h3 {
  margin: 0;
  font-family: var(--ff-heading);
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}
.usage-hero p {
  margin: 6px 0 0;
  color: rgba(var(--athens-rgb), 0.55);
  font-size: 0.82rem;
}
.usage-hero-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -6px 0 16px;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-soft);
  text-decoration: none;
  border: 1px solid rgba(var(--gold-rgb), 0.25);
  border-radius: var(--r-lg, 4px);
  background: rgba(var(--gold-rgb), 0.06);
  transition: background 0.2s, border-color 0.2s;
}
.usage-hero-link:hover {
  background: rgba(var(--gold-rgb), 0.12);
  border-color: rgba(var(--gold-rgb), 0.4);
}
.usage-stats-grid--hero { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.usage-stat {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  background: linear-gradient(145deg, rgba(var(--lavender-rgb), 0.055), rgba(var(--s2-rgb), 0.42));
  border-color: rgba(var(--lavender-rgb), 0.1);
  box-shadow: 0 14px 36px rgba(0,0,0,0.18);
}
.usage-stat::after {
  content: '';
  position: absolute;
  inset: auto 14px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--lavender-rgb),0.35), transparent);
}
.usage-stat--accent { background: linear-gradient(145deg, rgba(var(--jacarta-rgb),0.78), rgba(var(--lavender-rgb),0.16)); }
.usage-stat-value { letter-spacing: -0.03em; }
.usage-credit-card {
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid rgba(var(--lavender-rgb),0.1);
  border-radius: var(--r-xl);
  background: rgba(var(--s2-rgb),0.42);
}
.usage-credit-top, .usage-credit-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.72rem;
  color: rgba(var(--athens-rgb),0.52);
}
.usage-credit-top { margin-bottom: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.usage-credit-top strong { color: var(--white); font-size: .9rem; }
.usage-credit-foot { margin-top: 8px; }
.usage-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(280px, 0.86fr);
  gap: 16px;
}
.usage-card {
  border: 1px solid rgba(var(--lavender-rgb),0.1);
  border-radius: var(--r-xl);
  background: linear-gradient(145deg, rgba(var(--s2-rgb),0.55), rgba(var(--s1-rgb),0.78));
  padding: 18px;
  box-shadow: 0 16px 46px rgba(0,0,0,0.2);
  min-width: 0;
}
.usage-card--wide { grid-column: 1 / -1; }
.usage-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.usage-section-head .usage-section-title {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 0.86rem;
}
.usage-section-head p {
  margin: 4px 0 0;
  font-size: 0.7rem;
  color: rgba(var(--athens-rgb),0.38);
}
.usage-chart-wrap--large { padding: 18px; }
.usage-chart-wrap--large .usage-chart-svg { height: 220px; }
.usage-donut-wrap, .usage-chart-wrap, .usage-table-wrap { border-radius: var(--r-lg); }
.usage-user-bar { margin-bottom: 13px; }
.usage-user-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 0.76rem;
}
.usage-user-meta span {
  color: rgba(var(--athens-rgb),0.42);
  font-size: 0.68rem;
  text-align: right;
}

@media (max-width: 900px) {
  #settingsDrawer { width: 100vw; max-width: 100vw; }
  .usage-stats-grid--hero, .usage-dashboard-grid { grid-template-columns: 1fr; }
  .drawer-tabs-icons .drawer-tab { min-width: 70px; height: 58px; }
}
@media (max-width: 560px) {
  .drawer-tabs-icons .drawer-tab span { display: none; }
  .drawer-tabs-icons .drawer-tab { min-width: 48px; height: 48px; border-radius: var(--r-lg); }
  .usage-hero { padding: 18px; }
  .usage-stats-grid { grid-template-columns: 1fr; }
  .usage-user-meta { flex-direction: column; gap: 2px; }
  .usage-user-meta span { text-align: left; }
}

/* ═══ Light Theme Adjustments ═══ */
[data-theme="light"] .sidebar {
  background: var(--s1);
  border-right-color: rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .chat-header {
  background: rgba(var(--s1-rgb), 0.88);
  border-bottom-color: rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .chat-input-wrap {
  background: rgba(var(--s1-rgb), 0.88);
  border-top-color: rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .msg.assistant {
  background: rgba(45, 30, 100, 0.02);
  border-left-color: rgba(45, 30, 100, 0.1);
}
[data-theme="light"] .new-chat-btn {
  background: linear-gradient(135deg, var(--jacarta), var(--lavender));
  border: 1px solid var(--jacarta);
  border-radius: 0;
  color: #fff;
}
[data-theme="light"] .search-icon-btn {
  border-radius: 0;
  border-color: rgba(45, 30, 100, 0.35);
  background: rgba(45, 30, 100, 0.04);
  color: var(--athens);
}
[data-theme="light"] .conv-item:hover {
  background: rgba(45, 30, 100, 0.04);
}
[data-theme="light"] .conv-item.active {
  background: rgba(45, 30, 100, 0.06);
  border-left-color: var(--lavender);
}
[data-theme="light"] .drawer {
  background: var(--s1);
}
[data-theme="light"] .modal-content {
  background: var(--s1);
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(45, 30, 100, 0.15);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 30, 100, 0.25);
}
[data-theme="light"] .welcome-orb-core {
  background: radial-gradient(circle, rgba(255,255,255,0.95), rgba(245,242,237,0.85));
  box-shadow: 0 0 20px rgba(197, 165, 114, 0.15), inset 0 0 12px rgba(197, 165, 114, 0.06);
}

[data-theme="light"] .chat-area {
  background: var(--s0);
}
[data-theme="light"] .model-selector-dropdown {
  background: var(--s1);
  border-color: rgba(45, 30, 100, 0.08);
}
[data-theme="light"] .input-wrap {
  background: var(--s0);
  border-color: transparent;
}
[data-theme="light"] .input-wrap:focus-within {
  border-color: transparent;
  box-shadow: none;
}
[data-theme="light"] .btn-ghost {
  color: rgba(var(--athens-rgb), 0.5);
}
[data-theme="light"] .btn-ghost:hover {
  background: rgba(45, 30, 100, 0.04);
  color: var(--athens);
}

/* ── Usage/Settings variables in light mode ── */
[data-theme="light"] #myUsageBody,
[data-theme="light"] #adminUsageBody {
  --usage-text: #1a1530;
  --usage-muted: rgba(26, 21, 48, 0.55);
  --usage-ghost: rgba(26, 21, 48, 0.35);
  --usage-border: rgba(45, 30, 100, 0.1);
  --usage-card: rgba(255, 255, 255, 0.98);
  --usage-card-2: rgba(240, 238, 248, 0.92);
}

/* ── Usage hero/cards/tables in light mode ── */
[data-theme="light"] .usage-hero {
  background:
    radial-gradient(circle at 8% 0%, rgba(152, 137, 192, 0.12), transparent 36%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(240, 238, 248, 0.96));
  border-color: rgba(45, 30, 100, 0.08);
  box-shadow: 0 18px 45px rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .usage-stat {
  background: linear-gradient(145deg, rgba(152, 137, 192, 0.04), rgba(240, 238, 248, 0.42));
  border-color: rgba(45, 30, 100, 0.06);
  box-shadow: 0 14px 36px rgba(45, 30, 100, 0.04);
}
[data-theme="light"] .usage-stat--accent {
  background: linear-gradient(145deg, rgba(45, 39, 105, 0.06), rgba(152, 137, 192, 0.04));
}
[data-theme="light"] .usage-credit-card {
  background: rgba(240, 238, 248, 0.42);
  border-color: rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .usage-credit-bar {
  background: rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .usage-card {
  background: linear-gradient(145deg, rgba(240, 238, 248, 0.55), rgba(255, 255, 255, 0.78));
  border-color: rgba(45, 30, 100, 0.06);
  box-shadow: 0 16px 46px rgba(45, 30, 100, 0.04);
}
[data-theme="light"] .usage-chart-wrap {
  background: rgba(45, 30, 100, 0.02);
  border-color: rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .usage-chart-leg {
  background: rgba(45, 30, 100, 0.02);
  border-color: rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .usage-chart-leg:hover {
  background: rgba(45, 30, 100, 0.04);
}
[data-theme="light"] .usage-bar-track {
  background: rgba(45, 30, 100, 0.06);
  border-color: rgba(45, 30, 100, 0.04);
}
[data-theme="light"] .usage-table-wrap {
  background: rgba(45, 30, 100, 0.015);
  border-color: rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .usage-table tr:hover td {
  background: rgba(45, 30, 100, 0.02);
}
[data-theme="light"] .usage-empty,
[data-theme="light"] .usage-loading,
[data-theme="light"] .usage-error {
  background: rgba(45, 30, 100, 0.015);
  border-color: rgba(45, 30, 100, 0.1);
}
[data-theme="light"] .usage-ring-track {
  stroke: rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .usage-grid-line {
  stroke: rgba(45, 30, 100, 0.09);
}
[data-theme="light"] .usage-line-dot {
  fill: var(--usage-card, #fff);
}
[data-theme="light"] .usage-ring {
  filter: drop-shadow(0 14px 28px rgba(45, 30, 100, 0.12));
}
[data-theme="light"] .usage-leg-dot {
  box-shadow: 0 0 0 4px rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .user-card-pro:hover {
  box-shadow: 0 28px 72px rgba(45, 30, 100, 0.08), 0 0 0 1px rgba(45, 30, 100, 0.04) inset;
}
[data-theme="light"] .user-avatar-pro {
  box-shadow: 0 12px 30px rgba(45, 30, 100, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

/* ── User cards in light mode ── */
[data-theme="light"] .user-card-pro {
  background:
    radial-gradient(circle at 8% 0%, rgba(152, 137, 192, 0.08), transparent 34%),
    linear-gradient(145deg, rgba(240, 238, 248, 0.72), rgba(255, 255, 255, 0.94));
  border-color: rgba(45, 30, 100, 0.06);
  box-shadow: 0 22px 58px rgba(45, 30, 100, 0.04);
}
[data-theme="light"] .user-pro-metric {
  background: rgba(240, 238, 248, 0.38);
  border-color: rgba(45, 30, 100, 0.04);
}
[data-theme="light"] .user-pro-usage {
  background: rgba(245, 244, 252, 0.24);
  border-color: rgba(45, 30, 100, 0.04);
}
[data-theme="light"] .user-pro-controls {
  background: rgba(245, 244, 252, 0.18);
  border-top-color: rgba(45, 30, 100, 0.04);
}
[data-theme="light"] .user-detail-panel {
  background: rgba(245, 244, 252, 0.18);
  border-color: rgba(45, 30, 100, 0.04);
}

/* ── Settings drawer tabs in light mode ── */
[data-theme="light"] .drawer-tabs-icons .drawer-tab {
  background: rgba(152, 137, 192, 0.04);
  border-color: rgba(45, 30, 100, 0.06);
  color: rgba(26, 21, 48, 0.5);
}
[data-theme="light"] .drawer-tabs-icons .drawer-tab:hover {
  background: rgba(152, 137, 192, 0.08);
  border-color: rgba(45, 30, 100, 0.12);
  color: rgba(26, 21, 48, 0.85);
}
[data-theme="light"] .drawer-tabs-icons .drawer-tab.active {
  color: #fff;
  border-color: rgba(45, 39, 105, 0.36);
  background: linear-gradient(145deg, rgba(45, 39, 105, 0.9), rgba(152, 137, 192, 0.3));
  box-shadow: 0 16px 38px rgba(45, 30, 100, 0.1);
}
[data-theme="light"] .drawer-tabs-icons .tab-grp-admin.active {
  border-color: rgba(168, 136, 78, 0.36);
  background: linear-gradient(145deg, rgba(168, 136, 78, 0.85), rgba(168, 136, 78, 0.2));
}

/* ── Add credit modal in light mode ── */
[data-theme="light"] .add-credit-chip {
  background: rgba(45, 30, 100, 0.03);
  border-color: rgba(45, 30, 100, 0.08);
  color: rgba(26, 21, 48, 0.7);
}
[data-theme="light"] .add-credit-chip:hover {
  border-color: rgba(108, 92, 231, 0.4);
  background: rgba(108, 92, 231, 0.06);
}
[data-theme="light"] .add-credit-custom-row .setting-input {
  background: rgba(45, 30, 100, 0.03);
  border-color: rgba(45, 30, 100, 0.08);
  color: var(--athens);
}
[data-theme="light"] .add-credit-stripe-msg {
  background: rgba(45, 30, 100, 0.015);
  border-color: rgba(45, 30, 100, 0.08);
  color: rgba(26, 21, 48, 0.5);
}
[data-theme="light"] .add-credit-summary span {
  color: rgba(26, 21, 48, 0.5);
}

/* ── Overlays in light mode ── */
[data-theme="light"] .modal-overlay,
[data-theme="light"] .overlay {
  background: rgba(245, 244, 252, 0.75);
}
[data-theme="light"] .conv-context-menu {
  background: rgba(0, 0, 0, 0.14);
}

/* ── Memory graph in light mode ── */
[data-theme="light"] .memory-node.chatbot_history {
  background: linear-gradient(180deg, rgba(240, 238, 248, 0.65), rgba(255, 255, 255, 0.92));
}

/* Memory toolbar buttons ("Update Onboarding" / "+ Add Memory" / "Reset
   Memory") are translucent glass gradients that fade into a near-opaque dark
   stop — designed to look premium sitting on the dark drawer body. In light
   mode that same translucency shows through to a white drawer instead,
   producing a gradient that looks like it's fading into a broken dark smudge
   rather than a deliberate effect. Give each an opaque, light-appropriate
   treatment instead of letting the dark-only gradient show through. */
[data-theme="light"] .memory-toolbar .setting-save-btn {
  background: linear-gradient(135deg, var(--jacarta), var(--lavender));
  border-color: rgba(45, 30, 100, 0.16);
  box-shadow: 0 16px 38px rgba(45, 30, 100, 0.16);
}
[data-theme="light"] .memory-toolbar .setting-danger-btn {
  background: rgba(var(--danger-rgb), 0.08);
  border-color: rgba(var(--danger-rgb), 0.28);
}
[data-theme="light"] 
[data-theme="light"] 
[data-theme="light"] .memory-context-reset-btn {
  background: rgba(var(--danger-rgb), 0.08);
  border-color: rgba(var(--danger-rgb), 0.28);
}
[data-theme="light"] .memory-class-badge.official-sensitive {
  background: rgba(180, 130, 20, 0.12);
  color: #9a6a10;
  border-color: rgba(180, 130, 20, 0.4);
}
[data-theme="light"] .memory-class-badge.protected {
  background: rgba(190, 40, 50, 0.1);
  color: #b3261e;
  border-color: rgba(190, 40, 50, 0.4);
}
[data-theme="light"] .memory-class-badge.official {
  background: rgba(31, 138, 118, 0.1);
  color: #157a68;
  border-color: rgba(31, 138, 118, 0.4);
}

/* ── Voice mode in light mode ── */
[data-theme="light"] .voice-mode {
  background: #f5f4fc;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 35%, rgba(108, 92, 231, 0.08) 0%, transparent 65%),
    radial-gradient(ellipse 60% 40% at 50% 80%, rgba(152, 137, 192, 0.06) 0%, transparent 60%),
    radial-gradient(circle at 20% 20%, rgba(108, 92, 231, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(152, 137, 192, 0.03) 0%, transparent 35%);
}
[data-theme="light"] .voice-mode::before {
  background: conic-gradient(from 0deg at 50% 45%,
    transparent 0deg,
    rgba(108, 92, 231, 0.03) 60deg,
    transparent 120deg,
    rgba(152, 137, 192, 0.02) 180deg,
    transparent 240deg,
    rgba(108, 92, 231, 0.03) 300deg,
    transparent 360deg);
}
[data-theme="light"] .voice-mode-close,
[data-theme="light"] .voice-mode-help,
[data-theme="light"] .voice-mode-btn {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(45, 30, 100, 0.1);
  color: rgba(26, 21, 48, 0.5);
}
[data-theme="light"] .voice-mode-close:hover,
[data-theme="light"] .voice-mode-help:hover,
[data-theme="light"] .voice-mode-btn:hover {
  background: rgba(108, 92, 231, 0.08);
  color: #1a1530;
  border-color: rgba(108, 92, 231, 0.25);
}
[data-theme="light"] .voice-orb-core {
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(152, 137, 192, 0.25));
  box-shadow:
    0 0 40px rgba(108, 92, 231, 0.12),
    0 0 80px rgba(152, 137, 192, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
[data-theme="light"] .voice-orb-ring {
  border-color: rgba(108, 92, 231, 0.12);
}
[data-theme="light"] .voice-dot {
  background: rgba(108, 92, 231, 0.5);
  box-shadow: 0 0 8px rgba(108, 92, 231, 0.15);
}
[data-theme="light"] .voice-mode-transcript {
  color: rgba(26, 21, 48, 0.55);
}
[data-theme="light"] .voice-mode-btn.danger {
  border-color: rgba(239, 68, 68, 0.15);
  color: rgba(239, 68, 68, 0.6);
}
[data-theme="light"] .voice-mode-btn.danger:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}
[data-theme="light"] .voice-mode-btn.muted {
  border-color: rgba(245, 158, 11, 0.2);
  color: rgba(245, 158, 11, 0.7);
  background: rgba(245, 158, 11, 0.04);
}

/* ── Speaker-labeled transcript (recorder) ── */
.rec-speaker-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.rec-speaker-label {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  border: 1px solid;
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.rec-speaker-text {
  font-size: 0.88rem;
  line-height: 1.6;
  color: rgba(var(--athens-rgb), 0.82);
}
.rec-speaker-text-continuation {
  font-size: 0.88rem;
  line-height: 1.6;
  color: rgba(var(--athens-rgb), 0.82);
  margin-bottom: 8px;
  padding-left: 0;
}

/* ── Recording detail modal — Fireflies-quality UX ── */
.rec-modal {
  max-width: 760px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.rec-modal-header {
  padding: 20px 24px 14px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.08);
  flex-shrink: 0;
}
.rec-modal-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.rec-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.rec-modal-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-2xl);
  background: linear-gradient(135deg, rgba(var(--brand-rgb), 0.15), rgba(var(--lavender-rgb), 0.08));
  border: 1px solid rgba(var(--brand-rgb), 0.15);
  display: grid;
  place-items: center;
  color: var(--brand-soft);
  flex-shrink: 0;
}
.rec-modal-name-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-family: var(--ff-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.rec-modal-name-input:hover {
  border-color: rgba(var(--lavender-rgb), 0.1);
  background: rgba(var(--s2-rgb), 0.3);
}
.rec-modal-name-input:focus {
  border-color: rgba(var(--brand-rgb), 0.3);
  background: rgba(var(--s2-rgb), 0.5);
}
.rec-modal-close {
  background: transparent;
  border: none;
  color: rgba(var(--athens-rgb), 0.5);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-sm);
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.rec-modal-close:hover {
  color: var(--white);
  background: rgba(var(--athens-rgb), 0.08);
}
.rec-modal-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-left: 46px;
}
.rec-modal-status {
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: rgba(var(--ok-rgb), 0.12);
  color: var(--ok);
  border: 1px solid rgba(var(--ok-rgb), 0.15);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.rec-modal-meta {
  font-size: 0.75rem;
  color: rgba(var(--athens-rgb), 0.45);
  font-family: var(--ff-heading);
}

/* Audio player */
.rec-modal-audio-box {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06);
  flex-shrink: 0;
}
.rec-audio-player {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(var(--s2-rgb), 0.4);
  border: 1px solid rgba(var(--lavender-rgb), 0.06);
  border-radius: var(--r-2xl);
  padding: 10px 16px;
}
.rec-audio-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, rgba(var(--brand-rgb), 0.2), rgba(var(--lavender-rgb), 0.1));
  display: grid;
  place-items: center;
  color: var(--brand-soft);
  flex-shrink: 0;
}
.rec-audio-player audio {
  flex: 1;
  height: 36px;
  filter: invert(0.85) sepia(0.3) hue-rotate(220deg);
}
[data-theme="light"] .rec-audio-player audio {
  filter: invert(0.1) sepia(0.3) hue-rotate(220deg);
}

/* Speaker stats */
.rec-modal-stats {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06);
  flex-shrink: 0;
}
.rec-speaker-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.rec-speaker-stat-item {
  background: rgba(var(--s2-rgb), 0.35);
  border: 1px solid rgba(var(--lavender-rgb), 0.06);
  border-radius: var(--r-2xl);
  padding: 12px 14px;
}
.rec-speaker-stat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.rec-speaker-stat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rec-speaker-stat-name {
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--white);
  flex: 1;
}
.rec-speaker-stat-pct {
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.5);
}
.rec-speaker-stat-bar {
  height: 4px;
  border-radius: var(--r-pill);
  background: rgba(var(--athens-rgb), 0.06);
  overflow: hidden;
  margin-bottom: 6px;
}
.rec-speaker-stat-fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 0.6s var(--ease-spring);
}
.rec-speaker-stat-meta {
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.38);
  font-family: var(--ff-heading);
}

/* Content scroll area */
.rec-modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.rec-modal-content::-webkit-scrollbar {
  width: 6px;
}
.rec-modal-content::-webkit-scrollbar-thumb {
  background: rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-pill);
}

/* Sections */
.rec-modal-section {
  margin-bottom: 24px;
}
.rec-modal-section:last-child {
  margin-bottom: 0;
}
.rec-modal-section-label {
  font-family: var(--ff-heading);
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(var(--athens-rgb), 0.65);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rec-modal-section-toggle {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}
.rec-modal-section-toggle:hover {
  color: rgba(var(--athens-rgb), 0.85);
}
.rec-modal-section-toggle .rec-toggle-chevron {
  transition: transform 0.25s var(--ease-spring);
  margin-left: auto;
}
.rec-modal-section-toggle.collapsed .rec-toggle-chevron {
  transform: rotate(-90deg);
}
.rec-modal-section-body {
  transition: max-height 0.3s var(--ease-spring), opacity 0.2s;
  max-height: 9999px;
  overflow: hidden;
}
.rec-modal-section-body.collapsed {
  max-height: 0;
  opacity: 0;
}

/* Summary cards grid */
.rec-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 640px) {
  .rec-summary-grid {
    grid-template-columns: 1fr;
  }
}
.rec-summary-card {
  background: rgba(var(--s2-rgb), 0.4);
  border: 1px solid rgba(var(--lavender-rgb), 0.06);
  border-radius: var(--r-2xl);
  padding: 14px 16px;
}
.rec-summary-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.rec-summary-card-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-xl);
  background: rgba(var(--brand-rgb), 0.1);
  display: grid;
  place-items: center;
  color: var(--brand-soft);
  flex-shrink: 0;
}
.rec-summary-card-title {
  font-family: var(--ff-heading);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--white);
}
.rec-summary-card-body {
  font-size: 0.84rem;
  line-height: 1.65;
  color: rgba(var(--athens-rgb), 0.75);
}
.rec-summary-card-body p {
  margin: 6px 0;
}
.rec-summary-card-body ul {
  margin: 6px 0;
  padding-left: 18px;
  list-style: none;
}
.rec-summary-card-body ul li {
  position: relative;
  padding-left: 4px;
  margin-bottom: 4px;
}
.rec-summary-card-body ul li::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 9px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand-soft);
  opacity: 0.6;
}
.rec-summary-card-body strong {
  color: var(--white);
  font-weight: 700;
}

/* Transcript area */
.rec-modal-transcript {
  background: rgba(var(--s2-rgb), 0.25);
  border: 1px solid rgba(var(--lavender-rgb), 0.04);
  border-radius: var(--r-2xl);
  padding: 16px 18px;
  max-height: 400px;
  overflow-y: auto;
}
.rec-modal-transcript::-webkit-scrollbar {
  width: 5px;
}
.rec-modal-transcript::-webkit-scrollbar-thumb {
  background: rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-pill);
}

/* Error / placeholder */
.rec-modal-error {
  background: rgba(var(--danger-rgb), 0.08);
  border: 1px solid rgba(var(--danger-rgb), 0.15);
  border-radius: var(--r-2xl);
  padding: 14px 16px;
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.rec-modal-placeholder {
  text-align: center;
  padding: 40px 20px;
  color: rgba(var(--athens-rgb), 0.4);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Footer */
.rec-modal-footer {
  display: flex;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.08);
  flex-shrink: 0;
  justify-content: flex-end;
}

/* Markdown in modal */
.rec-modal-markdown {
  color: rgba(var(--athens-rgb), 0.75);
}
.rec-modal-markdown p {
  margin: 6px 0;
}
.rec-modal-markdown ul, .rec-modal-markdown ol {
  margin: 6px 0;
  padding-left: 18px;
}
.rec-modal-markdown li {
  margin-bottom: 3px;
}
.rec-modal-markdown strong {
  color: var(--white);
}

/* Light theme overrides for recorder modal */
[data-theme="light"] .rec-modal-icon {
  background: linear-gradient(135deg, rgba(197, 165, 114, 0.1), rgba(152, 137, 192, 0.06));
  border-color: rgba(197, 165, 114, 0.12);
  color: var(--brand);
}
[data-theme="light"] .rec-modal-name-input {
  color: var(--athens);
}
[data-theme="light"] .rec-modal-name-input:hover {
  background: rgba(45, 30, 100, 0.03);
  border-color: rgba(45, 30, 100, 0.08);
}
[data-theme="light"] .rec-modal-name-input:focus {
  background: rgba(45, 30, 100, 0.04);
  border-color: rgba(197, 165, 114, 0.25);
}
[data-theme="light"] .rec-audio-player {
  background: rgba(240, 238, 248, 0.6);
  border-color: rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .rec-audio-icon {
  background: linear-gradient(135deg, rgba(197, 165, 114, 0.1), rgba(152, 137, 192, 0.06));
  color: var(--brand);
}
[data-theme="light"] .rec-speaker-stat-item {
  background: rgba(240, 238, 248, 0.5);
  border-color: rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .rec-speaker-stat-name {
  color: var(--athens);
}
[data-theme="light"] .rec-summary-card {
  background: rgba(240, 238, 248, 0.5);
  border-color: rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .rec-summary-card-title {
  color: var(--athens);
}
[data-theme="light"] .rec-summary-card-body strong {
  color: var(--athens);
}
[data-theme="light"] .rec-modal-transcript {
  background: rgba(240, 238, 248, 0.35);
  border-color: rgba(45, 30, 100, 0.04);
}
[data-theme="light"] .rec-modal-section-label {
  color: rgba(26, 21, 48, 0.55);
}
[data-theme="light"] .rec-modal-markdown strong {
  color: var(--athens);
}

/* ═══════════════════════════════════════════════════════════
   Recording Detail Modal — v2 (authoritative)
   Overrides the generic .modal base (centred text, padding)
   ═══════════════════════════════════════════════════════════ */
#recModalOverlay {
  padding: 24px;
}
#recModalOverlay .rec-modal {
  padding: 0;
  text-align: left;
  width: min(920px, 100%);
  max-width: min(920px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;   /* base .modal centres children — must not */
  justify-content: flex-start;
  overflow: hidden;
  gap: 0;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(var(--brand-rgb), 0.09), transparent 55%),
    linear-gradient(180deg, rgba(var(--s2-rgb), 0.98), rgba(var(--s1-rgb), 0.99));
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0, 0, 0, 0.35);
}

/* ── Header ── */
#recModalOverlay .rec-modal-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.08);
  background: rgba(var(--s0-rgb), 0.25);
  flex-shrink: 0;
}
#recModalOverlay .rec-modal-header-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
#recModalOverlay .rec-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
  min-width: 0;
}
#recModalOverlay .rec-modal-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-2xl);
  background: linear-gradient(140deg, rgba(var(--brand-rgb), 0.22), rgba(var(--lavender-rgb), 0.08));
  border: 1px solid rgba(var(--brand-rgb), 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  color: var(--brand-soft);
  flex-shrink: 0;
}
#recModalOverlay .rec-modal-name-input {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-lg);
  padding: 7px 10px;
  font-family: var(--ff-heading);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--white);
  outline: none;
  text-overflow: ellipsis;
  transition: border-color 0.18s, background 0.18s;
}
#recModalOverlay .rec-modal-name-input:hover {
  border-color: rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--s3-rgb), 0.5);
}
#recModalOverlay .rec-modal-name-input:focus {
  border-color: rgba(var(--brand-rgb), 0.4);
  background: rgba(var(--s3-rgb), 0.7);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.1);
}
#recModalOverlay .rec-modal-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-lg);
  color: rgba(var(--athens-rgb), 0.45);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s;
}
#recModalOverlay .rec-modal-close:hover {
  color: var(--white);
  background: rgba(var(--athens-rgb), 0.07);
  border-color: rgba(var(--lavender-rgb), 0.12);
}
#recModalOverlay .rec-modal-sub {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 9px;
  padding-left: 49px;
}
#recModalOverlay .rec-modal-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: rgba(var(--ok-rgb), 0.1);
  color: var(--ok);
  border: 1px solid rgba(var(--ok-rgb), 0.2);
  text-transform: uppercase;
}
#recModalOverlay .rec-modal-meta {
  font-family: var(--ff-heading);
  font-size: 0.73rem;
  font-weight: 500;
  color: rgba(var(--athens-rgb), 0.4);
}

/* ── Audio player (custom) ── */
#recModalOverlay .rec-modal-audio-box {
  padding: 14px 22px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06);
  flex-shrink: 0;
}
.rec-audio {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  background: rgba(var(--s0-rgb), 0.45);
  border: 1px solid rgba(var(--lavender-rgb), 0.07);
  border-radius: var(--r-2xl);
}
.rec-audio audio { display: none; }
.rec-audio-play {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(140deg, var(--brand), var(--brand-deep));
  box-shadow: 0 5px 16px rgba(var(--brand-rgb), 0.32);
  transition: transform 0.16s var(--ease-spring), box-shadow 0.16s;
}
.rec-audio-play:hover { transform: scale(1.06); box-shadow: 0 7px 22px rgba(var(--brand-rgb), 0.45); }
.rec-audio-play:active { transform: scale(0.96); }
.rec-audio-play svg { margin-left: 1px; }
.rec-audio-main { flex: 1; min-width: 0; }
.rec-audio-track {
  position: relative;
  height: 6px;
  border-radius: var(--r-pill);
  background: rgba(var(--athens-rgb), 0.09);
  cursor: pointer;
}
.rec-audio-track::before {
  content: '';
  position: absolute;
  inset: -9px 0;
}
.rec-audio-buffered,
.rec-audio-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0;
  border-radius: var(--r-pill);
  pointer-events: none;
}
.rec-audio-buffered { background: rgba(var(--athens-rgb), 0.1); }
.rec-audio-fill { background: linear-gradient(90deg, var(--brand-deep), var(--brand), var(--brand-soft)); }
.rec-audio-knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(var(--brand-rgb), 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s;
}
.rec-audio:hover .rec-audio-knob,
.rec-audio.playing .rec-audio-knob { opacity: 1; }
.rec-audio-times {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-family: var(--ff-mono);
  font-size: 0.67rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.4);
  font-variant-numeric: tabular-nums;
}
.rec-audio-rate {
  flex-shrink: 0;
  min-width: 42px;
  padding: 6px 9px;
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(var(--athens-rgb), 0.6);
  background: rgba(var(--athens-rgb), 0.05);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all 0.16s;
}
.rec-audio-rate:hover {
  color: var(--white);
  background: rgba(var(--brand-rgb), 0.14);
  border-color: rgba(var(--brand-rgb), 0.3);
}

/* ── Speaker stats strip ── */
#recModalOverlay .rec-modal-stats {
  padding: 14px 22px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06);
  flex-shrink: 0;
}
.rec-speaker-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.rec-speaker-stat-item {
  background: rgba(var(--s0-rgb), 0.4);
  border: 1px solid rgba(var(--lavender-rgb), 0.07);
  border-radius: var(--r-xl);
  padding: 10px 12px;
}
.rec-speaker-stat-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}
.rec-speaker-stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rec-speaker-stat-name {
  flex: 1;
  min-width: 0;
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rec-speaker-stat-pct {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(var(--athens-rgb), 0.55);
  font-variant-numeric: tabular-nums;
}
.rec-speaker-stat-bar {
  height: 3px;
  border-radius: var(--r-pill);
  background: rgba(var(--athens-rgb), 0.07);
  overflow: hidden;
  margin-bottom: 6px;
}
.rec-speaker-stat-fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 0.7s var(--ease-spring);
}
.rec-speaker-stat-meta {
  font-family: var(--ff-heading);
  font-size: 0.66rem;
  font-weight: 500;
  color: rgba(var(--athens-rgb), 0.33);
}

/* ── Scrollable content ── */
#recModalOverlay .rec-modal-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 22px 24px;
  text-align: left;
}
#recModalOverlay .rec-modal-content::-webkit-scrollbar { width: 8px; }
#recModalOverlay .rec-modal-content::-webkit-scrollbar-track { background: transparent; }
#recModalOverlay .rec-modal-content::-webkit-scrollbar-thumb {
  background: rgba(var(--lavender-rgb), 0.14);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
#recModalOverlay .rec-modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--lavender-rgb), 0.26);
  background-clip: padding-box;
}

/* ── Section heads ── */
.rec-modal-section { margin-bottom: 22px; }
.rec-modal-section:last-child { margin-bottom: 0; }
.rec-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
}
.rec-section-head--toggle {
  cursor: pointer;
  user-select: none;
  border-radius: var(--r-lg);
  margin-left: -6px;
  padding: 4px 6px;
  transition: background 0.16s;
}
.rec-section-head--toggle:hover { background: rgba(var(--athens-rgb), 0.035); }
.rec-section-chevron {
  color: rgba(var(--athens-rgb), 0.4);
  transition: transform 0.24s var(--ease-spring);
  flex-shrink: 0;
}
.rec-section-head--toggle.collapsed .rec-section-chevron { transform: rotate(-90deg); }
.rec-section-title {
  font-family: var(--ff-heading);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(var(--athens-rgb), 0.5);
  margin: 0;
}
.rec-section-badge {
  font-family: var(--ff-heading);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: rgba(var(--athens-rgb), 0.055);
  border: 1px solid rgba(var(--lavender-rgb), 0.08);
  color: rgba(var(--athens-rgb), 0.45);
  white-space: nowrap;
}
.rec-section-badge--accent {
  background: rgba(var(--brand-rgb), 0.11);
  border-color: rgba(var(--brand-rgb), 0.22);
  color: var(--brand-soft);
}
.rec-section-action {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.45);
  background: rgba(var(--athens-rgb), 0.04);
  border: 1px solid rgba(var(--lavender-rgb), 0.09);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all 0.16s;
  flex-shrink: 0;
}
.rec-section-action:hover {
  color: var(--white);
  background: rgba(var(--brand-rgb), 0.13);
  border-color: rgba(var(--brand-rgb), 0.28);
}
.rec-section-action.copied {
  color: var(--ok);
  background: rgba(var(--ok-rgb), 0.12);
  border-color: rgba(var(--ok-rgb), 0.3);
}

/* ── Summary cards ── */
.rec-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  align-items: start;
}
.rec-summary-card {
  background: rgba(var(--s0-rgb), 0.4);
  border: 1px solid rgba(var(--lavender-rgb), 0.07);
  border-radius: var(--r-2xl);
  padding: 14px 16px 15px;
  text-align: left;
  transition: border-color 0.18s, background 0.18s;
}
.rec-summary-card:hover {
  border-color: rgba(var(--lavender-rgb), 0.13);
  background: rgba(var(--s0-rgb), 0.55);
}
.rec-summary-card--wide { grid-column: 1 / -1; }
.rec-summary-card-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06);
}
.rec-summary-card-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--r-lg);
  background: rgba(var(--brand-rgb), 0.13);
  border: 1px solid rgba(var(--brand-rgb), 0.16);
  display: grid;
  place-items: center;
  color: var(--brand-soft);
  flex-shrink: 0;
}
.rec-summary-card-title {
  font-family: var(--ff-heading);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--white);
}
.rec-summary-card-body {
  font-family: var(--ff-body);
  font-size: 0.845rem;
  line-height: 1.68;
  color: rgba(var(--athens-rgb), 0.72);
  text-align: left;
}
.rec-summary-card-body > *:first-child { margin-top: 0; }
.rec-summary-card-body > *:last-child { margin-bottom: 0; }
.rec-summary-card-body p { margin: 0 0 9px; }
.rec-summary-card-body h4,
.rec-summary-card-body h5,
.rec-summary-card-body h6 {
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(var(--athens-rgb), 0.9);
  margin: 12px 0 6px;
}
.rec-summary-card-body strong { color: var(--white); font-weight: 700; }
.rec-summary-card-body em { color: rgba(var(--athens-rgb), 0.85); }
.rec-summary-card-body code {
  font-family: var(--ff-mono);
  font-size: 0.8em;
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: rgba(var(--brand-rgb), 0.12);
  color: var(--brand-soft);
}
.rec-summary-card-body a { color: var(--brand-soft); text-decoration: none; }
.rec-summary-card-body a:hover { text-decoration: underline; }
.rec-summary-card-body hr {
  border: none;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.08);
  margin: 12px 0;
}
.rec-summary-card-body blockquote {
  margin: 9px 0;
  padding: 2px 0 2px 12px;
  border-left: 2px solid rgba(var(--brand-rgb), 0.35);
  color: rgba(var(--athens-rgb), 0.62);
  font-style: italic;
}
.rec-summary-card-body ul,
.rec-summary-card-body ol {
  margin: 0 0 9px;
  padding-left: 0;
  list-style: none;
}
.rec-summary-card-body ol { counter-reset: recol; }
.rec-summary-card-body li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 7px;
}
.rec-summary-card-body li:last-child { margin-bottom: 0; }
.rec-summary-card-body ul > li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand-soft);
  opacity: 0.7;
}
.rec-summary-card-body ol > li {
  counter-increment: recol;
  padding-left: 22px;
}
.rec-summary-card-body ol > li::before {
  content: counter(recol);
  position: absolute;
  left: 0;
  top: 0.1em;
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--brand-soft);
  opacity: 0.8;
}

/* ── Transcript ── */
.rec-transcript {
  background: rgba(var(--s0-rgb), 0.32);
  border: 1px solid rgba(var(--lavender-rgb), 0.06);
  border-radius: var(--r-2xl);
  padding: 6px 16px 14px;
  text-align: left;
  overflow: hidden;
  transition: max-height 0.32s var(--ease-out), opacity 0.2s, padding 0.32s, border-width 0.32s;
  max-height: 4000px;
}
.rec-transcript.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}
.rec-plain-para {
  font-size: 0.87rem;
  line-height: 1.72;
  color: rgba(var(--athens-rgb), 0.75);
  margin: 12px 0;
}
.rec-turn {
  display: flex;
  gap: 11px;
  padding: 11px 0;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.045);
}
.rec-turn:first-child { border-top: none; }
.rec-turn--same {
  border-top: none;
  padding-top: 0;
  margin-top: -4px;
}
.rec-turn--same .rec-turn-avatar { visibility: hidden; height: 0; }
.rec-turn-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid;
  display: grid;
  place-items: center;
  font-family: var(--ff-heading);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  margin-top: 1px;
}
.rec-turn-body { flex: 1; min-width: 0; }
.rec-turn-name {
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.rec-turn-text {
  font-family: var(--ff-body);
  font-size: 0.87rem;
  line-height: 1.7;
  color: rgba(var(--athens-rgb), 0.78);
  overflow-wrap: break-word;
}
.rec-turn-cont {
  font-family: var(--ff-body);
  font-size: 0.87rem;
  line-height: 1.7;
  color: rgba(var(--athens-rgb), 0.78);
  padding: 0 0 4px 39px;
}

/* ── Error / empty states ── */
.rec-modal-error {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: rgba(var(--danger-rgb), 0.08);
  border: 1px solid rgba(var(--danger-rgb), 0.2);
  border-radius: var(--r-xl);
  padding: 11px 14px;
  color: var(--danger);
  font-size: 0.82rem;
  line-height: 1.55;
  margin-bottom: 18px;
  text-align: left;
}
.rec-modal-error svg { flex-shrink: 0; margin-top: 2px; }
.rec-modal-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  text-align: center;
  padding: 52px 24px;
  color: rgba(var(--athens-rgb), 0.3);
}
.rec-modal-placeholder strong {
  font-family: var(--ff-heading);
  font-size: 0.92rem;
  font-weight: 700;
  color: rgba(var(--athens-rgb), 0.7);
}
.rec-modal-placeholder span {
  font-size: 0.82rem;
  line-height: 1.6;
  max-width: 380px;
  color: rgba(var(--athens-rgb), 0.42);
}
.rec-modal-placeholder b { color: rgba(var(--athens-rgb), 0.75); font-weight: 700; }
.rec-spinner-lg { width: 22px; height: 22px; border-width: 2px; }

/* ── Footer ── */
#recModalOverlay .rec-modal-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.08);
  background: rgba(var(--s0-rgb), 0.3);
  flex-shrink: 0;
  margin: 0;
}
#recModalOverlay .rec-modal-footer .modal-btn {
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--r-lg);
  min-width: 0;
  white-space: nowrap;
  margin: 0;
  flex: 0 0 auto;
}
#recModalOverlay .rec-modal-footer #recModalChat { margin-left: auto; }
#recModalOverlay .rec-modal-footer #recModalDelete {
  background: transparent;
  border: 1px solid rgba(var(--danger-rgb), 0.22);
  color: rgba(var(--danger-rgb), 0.85);
}
#recModalOverlay .rec-modal-footer #recModalDelete:hover {
  background: rgba(var(--danger-rgb), 0.12);
  border-color: rgba(var(--danger-rgb), 0.4);
  color: var(--danger);
}
#recModalOverlay .rec-modal-footer #recModalProcess {
  background: rgba(var(--athens-rgb), 0.05);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  color: rgba(var(--athens-rgb), 0.72);
}
#recModalOverlay .rec-modal-footer #recModalProcess:hover {
  background: rgba(var(--brand-rgb), 0.14);
  border-color: rgba(var(--brand-rgb), 0.32);
  color: var(--white);
}
#recModalOverlay .rec-modal-footer #recModalChat {
  background: linear-gradient(140deg, var(--brand), var(--brand-deep));
  border: 1px solid rgba(var(--brand-rgb), 0.5);
  color: #fff;
  box-shadow: 0 5px 18px rgba(var(--brand-rgb), 0.3);
}
#recModalOverlay .rec-modal-footer #recModalChat:hover {
  box-shadow: 0 8px 26px rgba(var(--brand-rgb), 0.44);
  transform: translateY(-1px);
}

/* ── Mobile ── */
@media (max-width: 620px) {
  #recModalOverlay { padding: 0; }
  #recModalOverlay .rec-modal {
    width: 100%;
    max-width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }
  #recModalOverlay .rec-modal-header,
  #recModalOverlay .rec-modal-audio-box,
  #recModalOverlay .rec-modal-stats,
  #recModalOverlay .rec-modal-content,
  #recModalOverlay .rec-modal-footer { padding-left: 15px; padding-right: 15px; }
  #recModalOverlay .rec-modal-sub { padding-left: 0; }
  .rec-summary-grid { grid-template-columns: 1fr; }
  #recModalOverlay .rec-modal-footer .modal-btn { flex: 1 1 0; padding: 11px 10px; }
  #recModalOverlay .rec-modal-footer #recModalChat { margin-left: 0; }
  .rec-section-badge { display: none; }
}

/* ── Light theme ── */
[data-theme="light"] #recModalOverlay .rec-modal {
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(197, 165, 114, 0.05), transparent 55%),
    linear-gradient(180deg, #ffffff, #fbfaff);
  border-color: rgba(45, 30, 100, 0.08);
  box-shadow: var(--shadow-xl);
}
[data-theme="light"] #recModalOverlay .rec-modal-header,
[data-theme="light"] #recModalOverlay .rec-modal-footer {
  background: rgba(240, 238, 248, 0.5);
  border-color: rgba(45, 30, 100, 0.07);
}
[data-theme="light"] #recModalOverlay .rec-modal-name-input { color: var(--athens); }
[data-theme="light"] #recModalOverlay .rec-modal-name-input:hover {
  background: rgba(45, 30, 100, 0.03);
  border-color: rgba(45, 30, 100, 0.08);
}
[data-theme="light"] #recModalOverlay .rec-modal-close:hover { color: var(--athens); }
[data-theme="light"] .rec-audio,
[data-theme="light"] .rec-speaker-stat-item,
[data-theme="light"] .rec-summary-card {
  background: rgba(240, 238, 248, 0.55);
  border-color: rgba(45, 30, 100, 0.07);
}
[data-theme="light"] .rec-summary-card:hover { background: rgba(240, 238, 248, 0.85); }
[data-theme="light"] .rec-transcript {
  background: rgba(240, 238, 248, 0.4);
  border-color: rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .rec-speaker-stat-name,
[data-theme="light"] .rec-summary-card-title,
[data-theme="light"] .rec-summary-card-body strong { color: var(--athens); }
[data-theme="light"] .rec-turn { border-top-color: rgba(45, 30, 100, 0.05); }
[data-theme="light"] .rec-summary-card-icon { color: var(--brand); }
[data-theme="light"] #recModalOverlay .rec-modal-icon { color: var(--brand); }

/* ═══════════════════════════════════════════════════════════
   Recording modal — top section tidy-up + editable speakers
   ═══════════════════════════════════════════════════════════ */

/* One continuous top block: header → player → speakers */
#recModalOverlay .rec-modal-header {
  padding: 16px 22px 12px;
  border-bottom: none;
}
#recModalOverlay .rec-modal-audio-box {
  padding: 0 22px 14px;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.07);
  background: rgba(var(--s0-rgb), 0.25);
}
#recModalOverlay .rec-modal-stats {
  padding: 14px 22px;
  background: rgba(var(--s0-rgb), 0.14);
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.07);
}

/* Header: title row is tighter, meta sits on the baseline */
#recModalOverlay .rec-modal-header-top { gap: 12px; }
#recModalOverlay .rec-modal-icon {
  width: 34px;
  height: 34px;
}
#recModalOverlay .rec-modal-icon svg { width: 17px; height: 17px; }
#recModalOverlay .rec-modal-name-input {
  padding: 5px 9px;
  font-size: 0.98rem;
}
#recModalOverlay .rec-modal-sub {
  margin-top: 6px;
  padding-left: 46px;
  gap: 8px;
}
#recModalOverlay .rec-modal-status {
  font-size: 0.62rem;
  padding: 2px 8px;
  letter-spacing: 0.06em;
}
#recModalOverlay .rec-modal-meta { font-size: 0.71rem; }

/* Player sits flush under the title, lighter chrome */
#recModalOverlay .rec-audio {
  padding: 9px 13px;
  gap: 13px;
  background: rgba(var(--s3-rgb), 0.42);
  border-color: rgba(var(--lavender-rgb), 0.08);
}
.rec-audio-play { width: 34px; height: 34px; }
.rec-audio-play svg { width: 14px; height: 14px; }
.rec-audio-times { margin-top: 6px; gap: 12px; }
.rec-audio-times span { flex-shrink: 0; }
.rec-audio-rate { padding: 5px 8px; min-width: 40px; }

/* Speaker strip header */
.rec-speaker-strip-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  font-family: var(--ff-heading);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: rgba(var(--athens-rgb), 0.38);
}
.rec-speaker-strip-hint {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: rgba(var(--athens-rgb), 0.28);
}

/* Editable speaker name */
.rec-speaker-name-input {
  flex: 1;
  min-width: 0;
  padding: 3px 7px;
  margin: -3px 0 -3px -7px;
  font-family: var(--ff-heading);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--white);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  outline: none;
  text-overflow: ellipsis;
  cursor: text;
  transition: background 0.16s, border-color 0.16s;
}
.rec-speaker-name-input::placeholder {
  color: rgba(var(--athens-rgb), 0.3);
  font-weight: 600;
}
.rec-speaker-name-input:hover {
  background: rgba(var(--athens-rgb), 0.055);
  border-color: rgba(var(--lavender-rgb), 0.12);
}
.rec-speaker-name-input:focus {
  background: rgba(var(--s0-rgb), 0.7);
  border-color: rgba(var(--brand-rgb), 0.45);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.12);
  cursor: text;
}
.rec-speaker-stat-item:hover .rec-speaker-name-input:not(:focus) {
  background: rgba(var(--athens-rgb), 0.04);
}
.rec-speaker-stat-item {
  transition: border-color 0.18s, background 0.18s;
}
.rec-speaker-stat-item:hover {
  border-color: rgba(var(--lavender-rgb), 0.13);
}

/* Transcript speaker name reflects renames */
.rec-turn-name { transition: color 0.2s; }
.rec-turn-avatar { transition: background 0.2s, color 0.2s; }

[data-theme="light"] #recModalOverlay .rec-modal-audio-box,
[data-theme="light"] #recModalOverlay .rec-modal-stats {
  background: rgba(240, 238, 248, 0.4);
  border-bottom-color: rgba(45, 30, 100, 0.07);
}
[data-theme="light"] #recModalOverlay .rec-audio {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(45, 30, 100, 0.08);
}
[data-theme="light"] .rec-speaker-name-input { color: var(--athens); }
[data-theme="light"] .rec-speaker-name-input:hover {
  background: rgba(45, 30, 100, 0.04);
  border-color: rgba(45, 30, 100, 0.09);
}
[data-theme="light"] .rec-speaker-name-input:focus {
  background: #fff;
  border-color: rgba(197, 165, 114, 0.4);
}

/* ═══════════════════════════════════════════════════════════
   Transcript — scrollable box + playback sync
   ═══════════════════════════════════════════════════════════ */
.rec-transcript {
  max-height: min(48vh, 460px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding: 4px 14px 10px;
  transition: none;                 /* was a max-height collapse hack */
  position: relative;
}
.rec-transcript[hidden] { display: none; }

.rec-transcript::-webkit-scrollbar { width: 8px; }
.rec-transcript::-webkit-scrollbar-track { background: transparent; }
.rec-transcript::-webkit-scrollbar-thumb {
  background: rgba(var(--lavender-rgb), 0.16);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
.rec-transcript::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--lavender-rgb), 0.3);
  background-clip: padding-box;
}

.rec-transcript-note {
  margin: 9px 2px 0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: rgba(var(--athens-rgb), 0.34);
}
.rec-transcript-note b { color: rgba(var(--athens-rgb), 0.55); font-weight: 700; }

/* Turn head: name + timestamp on one line */
.rec-turn-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}
.rec-turn-time {
  font-family: var(--ff-mono);
  font-size: 0.64rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.3);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  transition: color 0.18s;
}
.rec-turn-avatar--none { width: 0; margin: 0; border: none; }

/* Seekable turns */
.rec-turn--seekable {
  cursor: pointer;
  border-radius: var(--r-lg);
  padding-left: 9px;
  padding-right: 9px;
  margin-left: -9px;
  margin-right: -9px;
  transition: background 0.16s;
}
.rec-turn--seekable:hover { background: rgba(var(--athens-rgb), 0.04); }
.rec-turn--seekable:hover .rec-turn-time { color: var(--brand-soft); }

/* Currently-playing turn */
.rec-turn.is-active {
  background: linear-gradient(90deg, rgba(var(--brand-rgb), 0.16), rgba(var(--brand-rgb), 0.05) 65%, transparent);
  box-shadow: inset 2px 0 0 var(--brand);
}
.rec-turn.is-active .rec-turn-text { color: var(--white); }
.rec-turn.is-active .rec-turn-time { color: var(--brand-soft); }
.rec-turn.is-active .rec-turn-avatar {
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.22);
}

/* Scrolled-content fade so it reads as a contained box */
.rec-modal-section:has(.rec-transcript) { position: relative; }

@media (max-width: 620px) {
  .rec-transcript { max-height: 54vh; }
}

[data-theme="light"] .rec-turn--seekable:hover { background: rgba(45, 30, 100, 0.035); }
[data-theme="light"] .rec-turn.is-active {
  background: linear-gradient(90deg, rgba(197, 165, 114, 0.13), rgba(197, 165, 114, 0.04) 65%, transparent);
}
[data-theme="light"] .rec-turn.is-active .rec-turn-text { color: var(--athens); }

/* ═══════════════════════════════════════════════════════════
   Codebase Ledger — admin-only change history (Security tab)
   ═══════════════════════════════════════════════════════════ */

.ledger-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 6px;
  padding-top: 20px;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.12);
}

.ledger-section-title {
  font-family: var(--ff-heading);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--athens);
  letter-spacing: 0.01em;
}

.ledger-admin-badge {
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: rgba(var(--gold-rgb), 0.12);
  border: 1px solid rgba(var(--gold-rgb), 0.3);
  color: var(--gold-soft);
  font-family: var(--ff-heading);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ledger-section-intro { margin-bottom: 14px; }
.ledger-section-intro code,
.set-card-body .setting-info-text code {
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: rgba(var(--s4-rgb), 0.7);
  color: var(--brand-soft);
}

.ledger-readonly-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 2px solid rgba(var(--lavender-rgb), 0.35);
  background: rgba(var(--s2-rgb), 0.5);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

/* ── Stat strip ── */
.ledger-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.ledger-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: rgba(var(--s2-rgb), 0.6);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-md);
}

.ledger-stat-label {
  font-family: var(--ff-heading);
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(var(--athens-rgb), 0.5);
}

.ledger-stat-value {
  font-family: var(--ff-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--athens);
}

.ledger-stat-value.ledger-stat-warn { color: var(--warn); }

@media (max-width: 560px) {
  .ledger-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── Snapshot list ── */
.ledger-list {
  display: grid;
  gap: 6px;
  max-height: 520px;
  overflow-y: auto;
}

.ledger-entry {
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-md);
  background: rgba(var(--s1-rgb), 0.6);
  overflow: hidden;
}

.ledger-entry-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s var(--ease-smooth);
}

.ledger-entry-head:hover { background: rgba(var(--lavender-rgb), 0.06); }

.ledger-entry-id {
  flex-shrink: 0;
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.45);
  min-width: 34px;
}

.ledger-entry-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ledger-entry-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-heading);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--athens);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-entry-meta {
  font-size: 0.66rem;
  color: rgba(var(--athens-rgb), 0.45);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-pin-badge,
.ledger-base-badge {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ledger-pin-badge {
  background: rgba(var(--gold-rgb), 0.15);
  color: var(--gold-soft);
}

.ledger-base-badge {
  background: rgba(var(--info-rgb), 0.15);
  color: var(--info);
}

.ledger-entry-delta {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  font-weight: 600;
}

.ledger-add { color: var(--ok); }
.ledger-del { color: var(--danger); }

.ledger-entry-detail {
  padding: 4px 12px 12px;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.08);
}

.ledger-note {
  margin: 10px 0;
  padding: 8px 10px;
  font-size: 0.72rem;
  line-height: 1.6;
  color: rgba(var(--athens-rgb), 0.75);
  background: rgba(var(--s3-rgb), 0.5);
  border-radius: var(--r-sm);
}

.ledger-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.ledger-detail-stat {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  color: rgba(var(--athens-rgb), 0.45);
}

.ledger-mini-btn {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(var(--lavender-rgb), 0.1);
  border: 1px solid rgba(var(--lavender-rgb), 0.2);
  border-radius: var(--r-sm);
  color: var(--athens);
  font-family: var(--ff-heading);
  font-size: 0.66rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s var(--ease-smooth);
}

.ledger-mini-btn:hover {
  background: rgba(var(--lavender-rgb), 0.18);
  color: var(--white);
}

/* ── Changed files ── */
.ledger-file {
  border-top: 1px solid rgba(var(--lavender-rgb), 0.06);
}

.ledger-file-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 2px;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.ledger-file-head:hover .ledger-file-path { color: var(--brand-soft); }

.ledger-file-type {
  flex-shrink: 0;
  min-width: 58px;
  padding: 1px 6px;
  border-radius: var(--r-sm);
  font-family: var(--ff-heading);
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.ledger-file-added    { background: rgba(var(--ok-rgb), 0.15); color: var(--ok); }
.ledger-file-modified { background: rgba(var(--warn-rgb), 0.15); color: var(--warn); }
.ledger-file-deleted  { background: rgba(var(--danger-rgb), 0.15); color: var(--danger); }

.ledger-file-path {
  flex: 1;
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  color: rgba(var(--athens-rgb), 0.8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl;
  text-align: left;
  transition: color 0.15s var(--ease-smooth);
}

.ledger-file-delta {
  flex-shrink: 0;
  display: flex;
  gap: 5px;
  font-family: var(--ff-mono);
  font-size: 0.62rem;
}

/* ── Diff view ── */
.ledger-diff {
  margin: 6px 0 10px;
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-sm);
  background: rgba(var(--s0-rgb), 0.7);
  overflow-x: auto;
}

.ledger-hunk { border-bottom: 1px solid rgba(var(--lavender-rgb), 0.07); }
.ledger-hunk:last-child { border-bottom: 0; }

.ledger-hunk-head {
  padding: 4px 10px;
  background: rgba(var(--s3-rgb), 0.6);
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  color: rgba(var(--athens-rgb), 0.45);
}

.ledger-line {
  display: flex;
  align-items: flex-start;
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  line-height: 1.55;
  white-space: pre;
}

.ledger-line-add { background: rgba(var(--ok-rgb), 0.08); }
.ledger-line-del { background: rgba(var(--danger-rgb), 0.08); }

.ledger-lineno {
  flex-shrink: 0;
  width: 42px;
  padding-right: 8px;
  text-align: right;
  color: rgba(var(--athens-rgb), 0.25);
  user-select: none;
}

.ledger-mark {
  flex-shrink: 0;
  width: 16px;
  text-align: center;
  user-select: none;
}

.ledger-line-add .ledger-mark { color: var(--ok); }
.ledger-line-del .ledger-mark { color: var(--danger); }

.ledger-code {
  flex: 1;
  padding-right: 12px;
  color: rgba(var(--athens-rgb), 0.85);
}

.ledger-line-add .ledger-code { color: #b8f5e2; }
.ledger-line-del .ledger-code { color: #ffc4c4; }

/* ── Shared helpers introduced with the Ledger ── */
.setting-ghost-btn {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  background: transparent;
  border: 1px solid rgba(var(--lavender-rgb), 0.22);
  border-radius: var(--r-md);
  color: rgba(var(--athens-rgb), 0.85);
  font-family: var(--ff-heading);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
}

.setting-ghost-btn:hover {
  background: rgba(var(--lavender-rgb), 0.1);
  color: var(--white);
}

.setting-label-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: rgba(var(--athens-rgb), 0.4);
}

/* ── Light theme ── */
[data-theme="light"] .ledger-entry { background: rgba(255, 255, 255, 0.6); }
[data-theme="light"] .ledger-stat { background: rgba(255, 255, 255, 0.7); }
[data-theme="light"] .ledger-diff { background: rgba(250, 249, 255, 0.9); }
[data-theme="light"] .ledger-hunk-head { background: rgba(45, 30, 100, 0.05); }
[data-theme="light"] .ledger-stat-value,
[data-theme="light"] .ledger-entry-title { color: var(--jacarta); }
[data-theme="light"] .ledger-code { color: rgba(45, 39, 105, 0.9); }
[data-theme="light"] .ledger-line-add .ledger-code { color: #0d7a5f; }
[data-theme="light"] .ledger-line-del .ledger-code { color: #b02a2a; }
[data-theme="light"] .ledger-readonly-note { background: rgba(45, 30, 100, 0.04); }

/* ═══════════════════════════════════════════════════════════
   Sandbox disclosure bar + model provenance labels
   Honest-by-default data location disclosure. Keep in sync with
   public/legal/data-flows.php.
   ═══════════════════════════════════════════════════════════ */

/* Sandbox link — sits inline with the AI disclaimer at the bottom.
   Click opens a floating popover with the full disclosure. */
.ai-disclaimer-sep {
  color: rgba(var(--athens-rgb), 0.2);
  margin: 0 2px;
}

.sandbox-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  font: inherit;
  font-size: inherit;
  font-weight: 500;
  color: rgba(var(--warn-rgb), 0.7);
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}
.sandbox-link:hover {
  color: var(--warn);
}
.sandbox-link svg {
  opacity: 0.7;
  flex-shrink: 0;
}

/* Floating popover — opens upward from the disclaimer */
.sandbox-popover {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 24px));
  padding: 12px 14px;
  background: var(--s2);
  border: 1px solid rgba(var(--warn-rgb), 0.3);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg, 0 20px 60px rgba(0,0,0,0.4));
  font-size: 0.72rem;
  line-height: 1.55;
  color: rgba(var(--athens-rgb), 0.88);
  z-index: 100;
  text-align: left;
}
.sandbox-popover.is-open {
  display: block;
}
.sandbox-popover b {
  color: var(--warn);
  font-weight: 700;
}
.sandbox-popover-link {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  border: 1px solid rgba(var(--warn-rgb), 0.4);
  border-radius: var(--r-pill);
  color: var(--warn);
  font-family: var(--ff-heading);
  font-size: 0.64rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.sandbox-popover-link:hover { background: rgba(var(--warn-rgb), 0.15); }

@media (max-width: 640px) {
  .sandbox-popover { width: min(280px, calc(100vw - 20px)); font-size: 0.68rem; left: 50%; }
}

/* ── Model provenance ── */
.model-option-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
}

.model-loc {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-family: var(--ff-heading);
  font-size: 0.56rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  cursor: help;
}

.model-loc::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.model-loc--eu {
  background: rgba(var(--warn-rgb), 0.13);
  color: var(--warn);
}

.model-loc--global {
  background: rgba(var(--danger-rgb), 0.13);
  color: var(--danger);
}

.model-dropdown-note {
  padding: 8px 12px;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.12);
  background: rgba(var(--s1-rgb), 0.7);
  font-size: 0.64rem;
  line-height: 1.45;
  color: rgba(var(--athens-rgb), 0.55);
}

.model-dropdown-note a {
  color: var(--brand-soft);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.model-dropdown-note a:hover { text-decoration: underline; }

/* ── Light theme ── */
[data-theme="light"] .sandbox-link {
  color: rgba(150, 99, 26, 0.7);
}
[data-theme="light"] .sandbox-link:hover {
  color: #96631a;
}
[data-theme="light"] .sandbox-popover {
  background: #fff;
  border-color: rgba(150, 99, 26, 0.3);
  color: rgba(45, 39, 105, 0.85);
}
[data-theme="light"] .sandbox-popover b { color: #96631a; }
[data-theme="light"] .sandbox-popover-link {
  color: #96631a;
  border-color: rgba(150, 99, 26, 0.45);
}

/* ═══ Active Development Chip ═══
   Subtle green-bordered pill with the Aristos logo and a pulsing dot.
   Sits inline with the AI disclaimer, next to the sandbox link. */
.dev-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px 2px 4px;
  border: 1px solid rgba(var(--ok-rgb, 45, 212, 167), 0.3);
  border-radius: var(--r-pill);
  background: rgba(var(--ok-rgb, 45, 212, 167), 0.06);
  font-family: var(--ff-heading);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(var(--ok-rgb, 45, 212, 167), 0.75);
  user-select: none;
  white-space: nowrap;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.dev-chip:hover {
  border-color: rgba(var(--ok-rgb, 45, 212, 167), 0.5);
  background: rgba(var(--ok-rgb, 45, 212, 167), 0.1);
}
.dev-chip-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(var(--ok-rgb, 45, 212, 167), 0.4));
}
.dev-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(var(--ok-rgb, 45, 212, 167), 0.6);
  animation: dev-chip-pulse 2.4s ease-in-out infinite;
}
@keyframes dev-chip-pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}
[data-theme="light"] .dev-chip {
  border-color: rgba(13, 122, 95, 0.25);
  background: rgba(13, 122, 95, 0.05);
  color: rgba(13, 122, 95, 0.7);
}
[data-theme="light"] .dev-chip-dot {
  background: #0d7a5f;
  box-shadow: 0 0 6px rgba(13, 122, 95, 0.5);
}
@media (max-width: 640px) {
  .dev-chip { font-size: 0.56rem; padding: 2px 7px 2px 3px; }
  .dev-chip-icon { width: 12px; height: 12px; }
}
[data-theme="light"] .model-loc--eu { color: #96631a; background: rgba(180, 120, 0, 0.12); }
[data-theme="light"] .model-loc--global { color: #a8302f; background: rgba(168, 48, 47, 0.11); }
[data-theme="light"] .model-dropdown-note { background: rgba(250, 249, 255, 0.9); }

/* ═══ Light Theme — Popups, Overlays & Inline Elements ═══ */

/* Copy popover (appears when copying code/messages) */
[data-theme="light"] .copy-popover {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(45, 30, 100, 0.1);
  box-shadow: 0 16px 48px rgba(45, 30, 100, 0.12), 0 0 0 1px rgba(45, 30, 100, 0.04) inset;
}
[data-theme="light"] .copy-popover-item {
  color: rgba(26, 21, 48, 0.75);
}
[data-theme="light"] .copy-popover-item:hover {
  background: rgba(197, 165, 114, 0.08);
  color: #1a1530;
}

/* Canvas mode switch */
[data-theme="light"] .canvas-mode-switch {
  background: rgba(45, 30, 100, 0.06);
  border-color: rgba(45, 30, 100, 0.1);
}

/* Slash popup */
[data-theme="light"] .slash-popup {
  box-shadow: 0 12px 40px rgba(45, 30, 100, 0.12);
}

/* Model dropdown shadow */
[data-theme="light"] .model-dropdown {
  box-shadow: var(--shadow-lg), 0 -4px 24px rgba(45, 30, 100, 0.08);
}

/* Business dropdown shadow */
[data-theme="light"] .business-dropdown {
  box-shadow: var(--shadow-lg), 0 -4px 24px rgba(45, 30, 100, 0.08);
}

/* Input tools popover removed — intent-based generation now */

/* Attachment remove button */
[data-theme="light"] .attachment-remove {
  background: rgba(45, 30, 100, 0.6);
  color: #fff;
}

/* Recorder progress pill */
[data-theme="light"] .rec-progress {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(197, 165, 114, 0.2);
  box-shadow: 0 8px 32px rgba(45, 30, 100, 0.1);
  color: #1a1530;
}

/* Inline map renderer — toolbar */
[data-theme="light"] .imr-toolbar {
  background: rgba(245, 244, 252, 0.85);
  border-bottom-color: rgba(45, 30, 100, 0.08);
}

/* Inline map renderer — fields panel */
[data-theme="light"] .imr-fields-panel {
  background: rgba(255, 255, 255, 0.95);
  border-left-color: rgba(45, 30, 100, 0.08);
  box-shadow: -8px 0 32px rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .imr-fields-header {
  border-bottom-color: rgba(45, 30, 100, 0.06);
}

/* Inline map — add node button */
[data-theme="light"] .imr-add-node-btn {
  box-shadow: 0 8px 32px rgba(45, 30, 100, 0.12), 0 0 0 3px rgba(197, 165, 114, 0.08);
}

/* Canvas panel */
[data-theme="light"] .canvas-panel {
  background: var(--s1);
  border-left-color: rgba(45, 30, 100, 0.06);
}

/* Context menu shadow */
[data-theme="light"] .context-menu {
  box-shadow: var(--shadow-lg);
}
/* Corrections: .model-option-meta is now a flex child of .model-option-sub */
.model-option-sub .model-option-meta {
  margin-top: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-option-sub:empty { display: none; }
.model-dropdown-note { flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════
   Redaction tool — sidebar panel, review gate, message badges
   Client-side PI stripping before messages go to frontier models.
   ═══════════════════════════════════════════════════════════ */

/* ── Sidebar button (now in footer as icon-only) ── */
.redact-btn {
  position: relative;
}
.redact-btn svg { flex-shrink: 0; }

.redact-status-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(var(--athens-rgb), 0.2);
  flex-shrink: 0;
}

.redact-status-dot--on {
  background: #3da068;
  box-shadow: 0 0 6px rgba(61, 160, 104, 0.5);
}

/* ── Expandable panel ── */
.redact-panel {
  padding: 10px 12px 12px;
  background: rgba(var(--s1-rgb), 0.5);
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.1);
  font-size: 0.66rem;
  line-height: 1.5;
}

.redact-panel[hidden],
.redact-test-result[hidden] { display: none; }

.redact-panel-section {
  padding: 6px 0;
}

.redact-panel-section + .redact-panel-section {
  border-top: 1px solid rgba(var(--lavender-rgb), 0.08);
}

.redact-panel-subtitle {
  font-family: var(--ff-heading);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(var(--athens-rgb), 0.4);
  margin-bottom: 6px;
}

/* ── Toggle switch ── */
.redact-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.redact-toggle input { display: none; }

.redact-toggle-track {
  flex-shrink: 0;
  width: 32px;
  height: 18px;
  border-radius: 10px;
  background: rgba(var(--athens-rgb), 0.15);
  position: relative;
  transition: background 0.2s var(--ease-smooth);
  margin-top: 1px;
}

.redact-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--athens, #fff);
  transition: transform 0.2s var(--ease-smooth);
}

.redact-toggle input:checked + .redact-toggle-track {
  background: #3da068;
}

.redact-toggle input:checked + .redact-toggle-track .redact-toggle-thumb {
  transform: translateX(14px);
}

.redact-toggle-text {
  flex: 1;
  min-width: 0;
}

.redact-toggle-text b {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(var(--athens-rgb), 0.85);
}

.redact-toggle-text small {
  display: block;
  font-size: 0.58rem;
  color: rgba(var(--athens-rgb), 0.5);
  margin-top: 2px;
  line-height: 1.4;
}

/* ── Pattern list ── */
.redact-patterns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.redact-pattern {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: rgba(var(--lavender-rgb), 0.06);
  font-size: 0.58rem;
  color: rgba(var(--athens-rgb), 0.6);
}

.redact-pattern-sev {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.redact-pattern-sev--critical { background: var(--danger); }
.redact-pattern-sev--high { background: var(--warn); }
.redact-pattern-sev--medium { background: #6b8fd6; }
.redact-pattern-sev--low { background: rgba(var(--athens-rgb), 0.3); }

/* ── Test sandbox ── */
.redact-test-input {
  width: 100%;
  padding: 6px 8px;
  background: rgba(var(--s0-rgb), 0.5);
  border: 1px solid rgba(var(--lavender-rgb), 0.12);
  border-radius: var(--r-xs);
  color: var(--athens, #fff);
  font-family: var(--ff-body);
  font-size: 0.62rem;
  resize: vertical;
  min-height: 36px;
}

.redact-test-input:focus {
  outline: none;
  border-color: var(--brand-soft);
}

.redact-test-btn {
  margin-top: 5px;
  padding: 4px 12px;
  background: rgba(var(--brand-rgb), 0.15);
  border: 1px solid rgba(var(--brand-rgb), 0.25);
  border-radius: var(--r-pill);
  color: var(--brand-soft);
  font-family: var(--ff-heading);
  font-size: 0.58rem;
  font-weight: 700;
  cursor: pointer;
}

.redact-test-btn:hover { background: rgba(var(--brand-rgb), 0.25); }

.redact-test-result {
  margin-top: 6px;
  padding: 8px;
  background: rgba(var(--warn-rgb), 0.06);
  border: 1px solid rgba(var(--warn-rgb), 0.15);
  border-radius: var(--r-xs);
}

.redact-test-result--clean {
  background: rgba(61, 160, 104, 0.08);
  border-color: rgba(61, 160, 104, 0.2);
  color: #3da068;
}

.redact-test-count {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--warn);
  margin-bottom: 4px;
}

.redact-test-items {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 6px;
}

.redact-test-item {
  padding: 1px 6px;
  border-radius: var(--r-pill);
  font-size: 0.56rem;
  font-weight: 600;
}

.redact-test-item--critical { background: rgba(var(--danger-rgb), 0.12); color: var(--danger); }
.redact-test-item--high { background: rgba(var(--warn-rgb), 0.12); color: var(--warn); }
.redact-test-item--medium { background: rgba(107, 143, 214, 0.12); color: #6b8fd6; }
.redact-test-item--low { background: rgba(var(--lavender-rgb), 0.1); color: rgba(var(--athens-rgb), 0.5); }

.redact-test-redacted {
  font-family: var(--ff-mono, monospace);
  font-size: 0.58rem;
  color: rgba(var(--athens-rgb), 0.6);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 100px;
  overflow-y: auto;
}

/* ── Last redaction info ── */
.redact-panel-last { padding-top: 4px; }
.redact-last {
  font-size: 0.6rem;
  color: rgba(var(--athens-rgb), 0.5);
}

/* ── Review gate modal ── */
.redact-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* The [hidden] attribute must win over display:flex above, otherwise the
   gate renders on page load. Author stylesheets beat the UA stylesheet. */
.redact-gate-overlay[hidden] { display: none; }

.redact-gate {
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface, #1e1a2e);
  border: 1px solid rgba(var(--warn-rgb), 0.3);
  border-radius: var(--r-md, 12px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.redact-gate-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(var(--warn-rgb), 0.2);
  color: var(--warn);
}

.redact-gate-header h3 {
  margin: 0;
  font-family: var(--ff-heading);
  font-size: 0.9rem;
  font-weight: 700;
}

.redact-gate-body {
  padding: 16px 20px;
}

.redact-gate-notice {
  font-size: 0.72rem;
  line-height: 1.5;
  color: rgba(var(--athens-rgb), 0.75);
  margin: 0 0 12px;
}

.redact-gate-notice b { color: var(--warn); }

.redact-gate-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.redact-gate-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--r-xs, 6px);
  font-size: 0.66rem;
  background: rgba(var(--s1-rgb), 0.5);
}

.redact-gate-item--critical { border-left: 3px solid var(--danger); }
.redact-gate-item--high { border-left: 3px solid var(--warn); }
.redact-gate-item--medium { border-left: 3px solid #6b8fd6; }
.redact-gate-item--low { border-left: 3px solid rgba(var(--athens-rgb), 0.3); }

.redact-gate-item-label {
  font-weight: 700;
  color: rgba(var(--athens-rgb), 0.8);
  white-space: nowrap;
}

.redact-gate-item-value {
  font-family: var(--ff-mono, monospace);
  color: var(--danger);
  font-size: 0.62rem;
}

.redact-gate-item-arrow {
  color: rgba(var(--athens-rgb), 0.3);
  flex-shrink: 0;
}

.redact-gate-item-placeholder {
  font-family: var(--ff-mono, monospace);
  color: #3da068;
  font-size: 0.62rem;
  font-weight: 600;
}

.redact-gate-preview {
  margin-top: 4px;
}

.redact-gate-preview-label {
  display: block;
  font-family: var(--ff-heading);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(var(--athens-rgb), 0.4);
  margin-bottom: 5px;
}

.redact-gate-preview-text {
  padding: 10px 12px;
  background: rgba(var(--s0-rgb), 0.5);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-xs, 6px);
  font-family: var(--ff-mono, monospace);
  font-size: 0.64rem;
  line-height: 1.5;
  color: rgba(var(--athens-rgb), 0.7);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow-y: auto;
}

.redact-gate-actions {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid rgba(var(--lavender-rgb), 0.1);
}

.redact-gate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--r-sm, 8px);
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s var(--ease-smooth);
  border: none;
}

.redact-gate-btn--cancel {
  background: none;
  color: rgba(var(--athens-rgb), 0.5);
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
}

.redact-gate-btn--cancel:hover {
  background: rgba(var(--lavender-rgb), 0.06);
  color: rgba(var(--athens-rgb), 0.8);
}

.redact-gate-btn--send {
  margin-left: auto;
  background: #3da068;
  color: #fff;
}

.redact-gate-btn--send:hover {
  background: #48b87a;
}

/* ── Message redaction badge ── */
.msg-redact-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  margin-bottom: 6px;
  border-radius: var(--r-pill);
  background: rgba(61, 160, 104, 0.1);
  border: 1px solid rgba(61, 160, 104, 0.2);
  color: #3da068;
  font-family: var(--ff-heading);
  font-size: 0.58rem;
  font-weight: 600;
  cursor: help;
}

.msg-redact-badge svg { flex-shrink: 0; }

/* ── Light theme overrides ── */
[data-theme="light"] .redact-btn {
  border-color: rgba(45, 30, 100, 0.1);
  color: rgba(45, 39, 105, 0.65);
}
[data-theme="light"] .redact-btn:hover {
  background: rgba(45, 30, 100, 0.04);
  color: rgba(45, 39, 105, 0.85);
}
[data-theme="light"] .redact-panel {
  background: rgba(250, 249, 255, 0.7);
  border-bottom-color: rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .redact-toggle-text b { color: rgba(45, 39, 105, 0.85); }
[data-theme="light"] .redact-toggle-text small { color: rgba(45, 39, 105, 0.5); }
[data-theme="light"] .redact-test-input {
  background: rgba(255, 255, 255, 0.8);
  color: #1a1a2e;
}
[data-theme="light"] .redact-gate {
  background: #fff;
  border-color: rgba(180, 120, 0, 0.25);
}
[data-theme="light"] .redact-gate-notice { color: rgba(45, 39, 105, 0.75); }
[data-theme="light"] .redact-gate-preview-text {
  background: rgba(250, 249, 255, 0.9);
  color: rgba(45, 39, 105, 0.7);
}
[data-theme="light"] .redact-gate-btn--cancel {
  color: rgba(45, 39, 105, 0.5);
  border-color: rgba(45, 30, 100, 0.1);
}
[data-theme="light"] .msg-redact-badge {
  background: rgba(61, 160, 104, 0.08);
  border-color: rgba(61, 160, 104, 0.15);
}

/* ── Mobile ── */
@media (max-width: 640px) {
  .redact-gate { max-width: 100%; max-height: 90vh; }
  .redact-gate-header { padding: 12px 16px; }
  .redact-gate-body { padding: 12px 16px; }
  .redact-gate-actions { padding: 10px 16px; }
  .redact-gate-item {
    flex-wrap: wrap;
    font-size: 0.62rem;
  }
}

/* ═══════════════════════════════════════════════════════════
   Conversational onboarding
   Talk-to-Athena intake that fills the same profile the form saves.
   Runs entirely on the local Aristos GPU — see onboarding_chat.php.
   ═══════════════════════════════════════════════════════════ */

.ob-chat-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 16px;
  align-items: start;
}

.ob-chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ob-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 380px;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid rgba(var(--lavender-rgb), 0.13);
  border-radius: var(--r-xl, 18px);
  background: rgba(var(--s2-rgb), 0.28);
}

.ob-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
}

.ob-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ob-msg-avatar {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(var(--lavender-rgb), 0.18);
  color: rgba(var(--athens-rgb), 0.8);
  font-size: 0.56rem;
  font-weight: 700;
  font-family: var(--ff-heading);
}

.ob-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

.ob-msg-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 0.78rem;
  line-height: 1.55;
  color: rgba(var(--athens-rgb), 0.9);
  background: rgba(var(--s1-rgb), 0.7);
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
}

.ob-msg.assistant .ob-msg-bubble { border-top-left-radius: 4px; }
.ob-msg.user .ob-msg-bubble {
  border-top-right-radius: 4px;
  background: rgba(var(--brand-rgb), 0.16);
  border-color: rgba(var(--brand-rgb), 0.25);
}

.ob-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ob-typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(var(--athens-rgb), 0.4);
  animation: obTypingBounce 1.1s infinite ease-in-out;
}

.ob-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.ob-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

/* Improved typing bubble with "Athena is thinking…" label */
.ob-typing-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
}
.ob-typing-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  animation: obTypingFade 2s infinite ease-in-out;
}
@keyframes obTypingFade {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Send button "sending" state — prevents double-clicks visually */
.ob-chat-send.sending {
  opacity: 0.5;
  pointer-events: none;
  animation: obSendPulse 1.5s infinite ease-in-out;
}
@keyframes obSendPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

@keyframes obTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.ob-chat-inputrow {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 8px 8px 14px;
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  border-radius: var(--r-lg, 14px);
  background: rgba(var(--s1-rgb), 0.5);
}

.ob-chat-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--athens);
  font-family: var(--ff-body);
  font-size: 0.82rem;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  padding: 6px 0;
}

.ob-chat-input:focus { outline: none; }
.ob-chat-input::placeholder { color: rgba(var(--athens-rgb), 0.3); }

.ob-chat-send {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s var(--ease-smooth);
}

.ob-chat-send:hover { opacity: 0.85; }
.ob-chat-send:disabled { opacity: 0.4; cursor: default; }

/* ── Plan gating UI ──────────────────────────────────────── */
.plan-locked {
  opacity: 0.4;
  position: relative;
}
.plan-locked::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(0,0,0,0.2);
  pointer-events: none;
}
/* Roladex cards handle their own lock indicator */
.roladex-card.plan-locked::after {
  content: none;
}
.plan-locked:hover {
  opacity: 0.6;
}

/* Plan badge in sidebar */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-pill, 999px);
  font-size: 0.7rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s var(--ease-smooth);
}
.plan-badge.free {
  background: rgba(var(--lavender-rgb, 152,137,192), 0.1);
  color: var(--lavender-2, #b8aadb);
  border: 1px solid rgba(var(--lavender-rgb, 152,137,192), 0.15);
}
.plan-badge.beta {
  background: rgba(var(--gold-rgb, 197,165,114), 0.1);
  color: var(--gold-soft, #E3C88F);
  border: 1px solid rgba(var(--gold-rgb, 197,165,114), 0.25);
}
.plan-badge:hover { opacity: 0.8; }

/* Upgrade modal */
.upgrade-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5,3,20,0.8);
  backdrop-filter: blur(8px);
  animation: upgrade-fade-in 0.2s ease;
}
@keyframes upgrade-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.upgrade-card {
  width: 100%;
  max-width: 400px;
  margin: 20px;
  padding: 32px;
  border-radius: var(--r-xl, 6px);
  background: var(--s2, #100d28);
  border: 1px solid rgba(var(--lavender-rgb, 152,137,192), 0.15);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  text-align: center;
}
.upgrade-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(var(--brand-rgb, 124,92,252), 0.12);
  display: grid;
  place-items: center;
  color: var(--brand-soft, #E3C88F);
}
.upgrade-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--athens, #f0eeff);
}
.upgrade-card p {
  font-size: 0.85rem;
  color: var(--muted, #a59ab8);
  line-height: 1.5;
  margin-bottom: 24px;
}
.upgrade-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.upgrade-cta {
  display: block;
  padding: 12px;
  border-radius: var(--r-md, 3px);
  background: var(--brand, #C5A572);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: opacity 0.2s;
}
.upgrade-cta:hover { opacity: 0.85; }
.upgrade-dismiss {
  padding: 10px;
  border-radius: var(--r-md, 3px);
  background: none;
  border: none;
  color: var(--muted, #a59ab8);
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.2s;
}
.upgrade-dismiss:hover { color: var(--athens, #f0eeff); }

/* ── Onboarding voice mic button ─────────────────────────── */
.ob-chat-mic {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: rgba(var(--athens-rgb), 0.5);
  border: 1px solid rgba(var(--lavender-rgb), 0.15);
  cursor: pointer;
  transition: all 0.2s var(--ease-smooth);
}
.ob-chat-mic:hover {
  color: var(--athens);
  border-color: rgba(var(--lavender-rgb), 0.35);
  background: rgba(var(--lavender-rgb), 0.06);
}
.ob-chat-mic.active {
  background: var(--brand-soft);
  color: #fff;
  border-color: var(--brand-soft);
}
.ob-chat-mic.listening {
  background: #e8466a;
  border-color: #e8466a;
  color: #fff;
  animation: ob-mic-pulse 1.4s ease-in-out infinite;
}
@keyframes ob-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 70, 106, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(232, 70, 106, 0); }
}

/* Input row states when voice is active */
.ob-chat-inputrow.voice-on {
  border-color: rgba(var(--lavender-rgb), 0.3);
}
.ob-chat-inputrow.listening {
  border-color: #e8466a;
  box-shadow: 0 0 0 2px rgba(232, 70, 106, 0.12);
}

.ob-chat-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.ob-chat-link {
  background: none;
  border: none;
  color: rgba(var(--athens-rgb), 0.45);
  font-size: 0.7rem;
  font-family: var(--ff-heading);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 4px 0;
}

.ob-chat-link:hover { color: rgba(var(--athens-rgb), 0.7); }

.ob-chat-review-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  background: #3da068;
  color: #fff;
  border: none;
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  animation: obReviewPulse 2.4s infinite;
}

.ob-chat-review-btn:hover { background: #48b87a; animation: none; }

/* Same class of bug as .redact-gate-overlay before it: the [hidden] attribute
   must win over display:inline-flex above, or the button shows on first
   paint regardless of whether anything's actually been captured yet. */
.ob-chat-review-btn[hidden] { display: none; }

@keyframes obReviewPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(61, 160, 104, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(61, 160, 104, 0); }
}

/* ── Live memory chips sidebar ── */
.ob-chat-chips {
  padding: 14px;
  border: 1px solid rgba(var(--lavender-rgb), 0.1);
  border-radius: var(--r-lg, 14px);
  background: rgba(var(--s2-rgb), 0.22);
  align-self: stretch;
}

.ob-chips-title {
  font-family: var(--ff-heading);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(var(--athens-rgb), 0.4);
  margin-bottom: 10px;
}

.ob-chips-empty {
  font-size: 0.7rem;
  line-height: 1.5;
  color: rgba(var(--athens-rgb), 0.35);
}

.ob-chips-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ob-chip {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 9px;
  border-radius: var(--r-xs, 6px);
  background: rgba(var(--lavender-rgb), 0.07);
  border-left: 2px solid var(--brand-soft);
  animation: obChipIn 0.25s var(--ease-smooth);
}

@keyframes obChipIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.ob-chip-label {
  font-family: var(--ff-heading);
  font-size: 0.54rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(var(--athens-rgb), 0.4);
}

.ob-chip-value {
  font-size: 0.7rem;
  color: rgba(var(--athens-rgb), 0.85);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Back to conversation (form view) ── */




/* ── Light theme ── */
[data-theme="light"] .ob-chat-messages { background: rgba(250, 249, 255, 0.6); }
[data-theme="light"] .ob-msg-bubble { color: rgba(45, 39, 105, 0.85); background: rgba(255,255,255,0.7); }
[data-theme="light"] .ob-msg.user .ob-msg-bubble { background: rgba(var(--brand-rgb), 0.1); }
[data-theme="light"] .ob-chat-input { color: #1a1a2e; }
[data-theme="light"] .ob-chat-chips { background: rgba(250, 249, 255, 0.6); }
[data-theme="light"] .ob-chip { background: rgba(45, 30, 100, 0.04); }
[data-theme="light"] .ob-chip-value { color: rgba(45, 39, 105, 0.85); }

/* ── Mobile ── */
@media (max-width: 640px) {
  .ob-chat-layout { grid-template-columns: 1fr; }
  .ob-chat-messages { height: 300px; }
  .ob-chat-chips { order: -1; }
  .ob-chips-list { flex-direction: row; flex-wrap: wrap; }
  .ob-chip { flex: 1 1 auto; }
}

/* ═══ Phase 4.5: Settings Drawer Polish ═══ */

/* Classification preview cards */
.cls-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.cls-preview-card {
  padding: 10px 12px;
  border-radius: var(--r-md, 10px);
  border: 1px solid var(--line, #2a2438);
  background: var(--surface-2, #13101c);
  transition: border-color 0.25s ease, transform 0.15s ease;
  cursor: default;
}
.cls-preview-card:hover {
  transform: translateY(-1px);
}
.cls-preview-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.cls-preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cls-preview-name {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.cls-preview-desc {
  font-size: 0.68rem;
  color: var(--muted, #9b90ad);
  margin: 0;
  line-height: 1.4;
}
.cls-preview-unofficial .cls-preview-dot { background: #8cffc1; }
.cls-preview-unofficial .cls-preview-name { color: #8cffc1; }
.cls-preview-official .cls-preview-dot { background: #8cc8ff; }
.cls-preview-official .cls-preview-name { color: #8cc8ff; }
.cls-preview-sensitive .cls-preview-dot { background: #ffc88c; }
.cls-preview-sensitive .cls-preview-name { color: #ffc88c; }
.cls-preview-protected .cls-preview-dot { background: #ff8c8c; }
.cls-preview-protected .cls-preview-name { color: #ff8c8c; }
/* Highlight active card */
.cls-preview-card.cls-preview-active {
  border-color: var(--lavender, #9889C0);
  box-shadow: 0 0 0 1px rgba(152, 137, 192, 0.2);
}
@media (max-width: 520px) {
  .cls-preview-grid { grid-template-columns: 1fr; }
}

/* Light theme: classification preview cards */
[data-theme="light"] .cls-preview-card {
  background: #ffffff;
  border-color: rgba(45, 30, 100, 0.12);
  box-shadow: 0 1px 4px rgba(45, 30, 100, 0.06);
}
[data-theme="light"] .cls-preview-card:hover { border-color: rgba(45, 30, 100, 0.22); }
[data-theme="light"] .cls-preview-desc { color: #4d4763; }
[data-theme="light"] .cls-preview-unofficial .cls-preview-name { color: #166844; }
[data-theme="light"] .cls-preview-official .cls-preview-name { color: #1f4f96; }
[data-theme="light"] .cls-preview-sensitive .cls-preview-name { color: #8a5c0d; }
[data-theme="light"] .cls-preview-protected .cls-preview-name { color: #992424; }
[data-theme="light"] .cls-preview-card.cls-preview-active {
  border-color: var(--lavender, #9889C0);
  box-shadow: 0 0 0 1px rgba(152, 137, 192, 0.35);
}

/* No Frontier warning icon */
.set-card-warn-icon {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  color: rgba(245, 158, 11, 0.8);
  cursor: help;
  vertical-align: middle;
  transition: color 0.2s;
}
.set-card-warn-icon:hover {
  color: rgba(245, 158, 11, 1);
}

/* Smooth underline for icon-based drawer tabs */
.drawer-tabs-icons .drawer-tab::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--lavender, #9889C0);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.drawer-tabs-icons .drawer-tab.active::after {
  width: 60%;
}

/* ═══ Phase 4.7: Onboarding Flow Polish ═══ */

/* Guest empty state — need an account to save memory */
.onboarding-guest-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  gap: 16px;
}
.onboarding-guest-empty .onboarding-guest-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-glow);
  color: var(--accent);
  margin-bottom: 4px;
}
.onboarding-guest-empty h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.onboarding-guest-empty p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 360px;
  margin: 0;
}
.onboarding-guest-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--r-lg);
  font-size: 15px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease;
  margin-top: 8px;
}
.onboarding-guest-btn:active { transform: scale(.97); }
.onboarding-guest-btn:hover { box-shadow: 0 4px 20px var(--accent-glow); }
.onboarding-guest-btn:disabled { opacity: 0.6; cursor: wait; }
.onboarding-guest-note {
  font-size: 12px !important;
  color: var(--text-muted);
  opacity: 0.7;
}

/* Prominent data handling notice — card-style with amber border */

/* Smooth fade transition for chat view after consent */
.ob-chat-view {
  transition: opacity 0.5s ease;
}

/* Quick Start card */
.onboarding-quickstart {
  margin-top: 24px;
  padding: 20px;
  border-radius: var(--r-lg, 14px);
  background: var(--surface-2, #13101c);
  border: 1px solid rgba(var(--lavender-rgb, 152, 137, 192), 0.2);
}
.onboarding-quickstart-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--lavender, #9889C0);
  margin: 0 0 4px 0;
}
.onboarding-quickstart-hint {
  font-size: 12px;
  color: var(--muted, #9b90ad);
  margin: 0 0 14px 0;
}
.onboarding-quickstart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.quickstart-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border-radius: var(--r-md, 10px);
  background: var(--surface, #0d0a14);
  border: 1px solid var(--line, #2a2438);
  color: var(--text, #f8f5ff);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
  text-align: center;
}
.quickstart-card:hover {
  border-color: var(--lavender, #9889C0);
  background: rgba(152, 137, 192, 0.06);
  transform: translateY(-2px);
}
.quickstart-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(152, 137, 192, 0.1);
  color: var(--lavender, #9889C0);
}
.quickstart-label {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}
@media (max-width: 600px) {
  .onboarding-quickstart-grid { grid-template-columns: 1fr; }
}
/* ═══ User Management — World-Class UX ═══ */
.um-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, rgba(var(--jacarta-rgb), 0.08));
  flex-shrink: 0;
  flex-wrap: wrap;
}
.um-search-wrap {
  position: relative;
  flex: 1;
  min-width: 160px;
}
.um-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(var(--athens-rgb), 0.35);
  pointer-events: none;
}
.um-search {
  width: 100%;
  padding: 7px 10px 7px 30px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--jacarta-rgb), 0.1);
  background: rgba(var(--s1-rgb), 0.5);
  color: var(--athens);
  font-size: 0.78rem;
  font-family: var(--ff-body);
  outline: none;
  transition: border-color 0.15s;
}
.um-search:focus { border-color: rgba(var(--lavender-rgb), 0.3); }
.um-search::placeholder { color: rgba(var(--athens-rgb), 0.3); }
.um-filter {
  padding: 7px 10px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--jacarta-rgb), 0.1);
  background: rgba(var(--s1-rgb), 0.5);
  color: var(--athens);
  font-size: 0.73rem;
  font-family: var(--ff-body);
  cursor: pointer;
  outline: none;
}
.um-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--r-md);
  border: none;
  background: rgba(var(--lavender-rgb), 0.16);
  color: var(--athens);
  font-size: 0.73rem;
  font-weight: 700;
  font-family: var(--ff-heading);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.um-btn-primary:hover { background: rgba(var(--lavender-rgb), 0.26); }
.um-btn-ghost {
  padding: 7px 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--jacarta-rgb), 0.12);
  background: transparent;
  color: rgba(var(--athens-rgb), 0.6);
  font-size: 0.73rem;
  font-weight: 600;
  font-family: var(--ff-heading);
  cursor: pointer;
}
.um-btn-ghost:hover { background: rgba(var(--lavender-rgb), 0.06); }

/* Bulk action bar */
.um-bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(var(--lavender-rgb), 0.06);
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.1);
  font-size: 0.73rem;
  flex-shrink: 0;
}
.um-bulk-bar span { font-weight: 700; color: var(--lavender); }
.um-bulk-btn {
  padding: 4px 10px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(var(--jacarta-rgb), 0.1);
  background: rgba(var(--s1-rgb), 0.5);
  color: var(--athens);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
}
.um-bulk-btn--danger { color: var(--danger); border-color: rgba(var(--danger-rgb), 0.2); }
.um-bulk-btn--ghost { background: transparent; border-color: transparent; color: rgba(var(--athens-rgb), 0.5); }

/* Summary stats */
.um-summary {
  display: flex;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border, rgba(var(--jacarta-rgb), 0.06));
  flex-shrink: 0;
  flex-wrap: wrap;
}
.um-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.5);
}
.um-stat strong { color: var(--athens); font-weight: 700; }
.um-stat-dot { width: 7px; height: 7px; border-radius: 50%; }
.um-stat-dot.active { background: var(--ok); }
.um-stat-dot.disabled { background: var(--danger); }
.um-stat-dot.admin { background: var(--lavender); }

/* Compact user list */
.um-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.um-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid rgba(var(--jacarta-rgb), 0.04);
}
.um-row:hover { background: rgba(var(--lavender-rgb), 0.04); }
.um-row.selected { background: rgba(var(--lavender-rgb), 0.08); }
.um-row.is-disabled { opacity: 0.5; }
.um-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid rgba(var(--jacarta-rgb), 0.2);
  flex-shrink: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  background: transparent;
}
.um-check:checked {
  background: var(--lavender);
  border-color: var(--lavender);
}
.um-check:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.um-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(var(--lavender-rgb), 0.15);
  color: var(--lavender);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}
.um-avatar.admin { background: rgba(var(--gold-rgb), 0.15); color: var(--gold); }
.um-avatar.disabled { background: rgba(var(--danger-rgb), 0.1); color: var(--danger); }
.um-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.um-row-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--athens);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.um-row-email {
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.um-row-badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.um-badge {
  font-size: 0.58rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.um-badge--admin { background: rgba(var(--gold-rgb), 0.15); color: var(--gold); }
.um-badge--super { background: rgba(var(--lavender-rgb), 0.2); color: var(--lavender); }
.um-badge--user { background: rgba(var(--jacarta-rgb), 0.1); color: rgba(var(--athens-rgb), 0.6); }
.um-badge--active { background: rgba(var(--ok-rgb, 16, 185, 129), 0.12); color: var(--ok); }
.um-badge--disabled { background: rgba(var(--danger-rgb), 0.12); color: var(--danger); }
.um-badge--tier { background: rgba(var(--brand-rgb), 0.12); color: var(--brand); }
.um-badge--plan { background: rgba(var(--jacarta-rgb), 0.08); color: rgba(var(--athens-rgb), 0.5); }
.um-row-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
  font-size: 0.62rem;
  color: rgba(var(--athens-rgb), 0.35);
}
.um-row-spend { font-weight: 700; color: rgba(var(--athens-rgb), 0.7); }
.um-row-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.um-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: rgba(var(--athens-rgb), 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.um-icon-btn:hover { background: rgba(var(--lavender-rgb), 0.1); color: var(--lavender); }
.um-icon-btn--danger:hover { background: rgba(var(--danger-rgb), 0.1); color: var(--danger); }
.um-icon-btn--ok:hover { background: rgba(var(--ok-rgb, 16, 185, 129), 0.1); color: var(--ok); }
.um-empty {
  padding: 60px 20px;
  text-align: center;
  color: rgba(var(--athens-rgb), 0.35);
  font-size: 0.82rem;
}

/* Detail drawer */
.um-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
}
.um-detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: var(--s1);
  z-index: 201;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.2);
}
.um-dd-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(var(--jacarta-rgb), 0.08);
  flex-shrink: 0;
}
.um-dd-close {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  color: rgba(var(--athens-rgb), 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.um-dd-close:hover { background: rgba(var(--lavender-rgb), 0.08); color: var(--athens); }
.um-dd-userinfo { flex: 1; min-width: 0; }
.um-dd-name { font-size: 1rem; font-weight: 700; color: var(--athens); }
.um-dd-email { font-size: 0.78rem; color: rgba(var(--athens-rgb), 0.45); }
.um-dd-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(var(--jacarta-rgb), 0.06);
  flex-shrink: 0;
}
.um-dd-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: none;
  color: rgba(var(--athens-rgb), 0.4);
  font-size: 0.73rem;
  font-weight: 600;
  font-family: var(--ff-heading);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.um-dd-tab:hover { color: rgba(var(--athens-rgb), 0.7); }
.um-dd-tab.active { color: var(--lavender); border-bottom-color: var(--lavender); }
.um-dd-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.um-dd-section {
  margin-bottom: 20px;
}
.um-dd-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(var(--athens-rgb), 0.4);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.um-dd-section-title::before {
  content: '';
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--lavender), var(--brand-deep));
  flex-shrink: 0;
}
.um-dd-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.78rem;
  border-bottom: 1px solid rgba(var(--jacarta-rgb), 0.04);
}
.um-dd-field-label { color: rgba(var(--athens-rgb), 0.5); }
.um-dd-field-value { font-weight: 600; color: var(--athens); }
.um-dd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.um-dd-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--jacarta-rgb), 0.1);
  background: rgba(var(--s1-rgb), 0.5);
  color: var(--athens);
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.um-dd-action-btn:hover { background: rgba(var(--lavender-rgb), 0.08); border-color: rgba(var(--lavender-rgb), 0.2); }
.um-dd-action-btn--danger { color: var(--danger); border-color: rgba(var(--danger-rgb), 0.15); }
.um-dd-action-btn--danger:hover { background: rgba(var(--danger-rgb), 0.08); }
.um-dd-action-btn--ok { color: var(--ok); border-color: rgba(var(--ok-rgb, 16, 185, 129), 0.15); }
.um-dd-action-btn--ok:hover { background: rgba(var(--ok-rgb, 16, 185, 129), 0.08); }
.um-dd-select-group {
  margin-bottom: 12px;
}
.um-dd-select-group label {
  display: block;
  font-size: 0.68rem;
  color: rgba(var(--athens-rgb), 0.5);
  margin-bottom: 4px;
  font-weight: 600;
}
.um-dd-select {
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--jacarta-rgb), 0.1);
  background: rgba(var(--s1-rgb), 0.5);
  color: var(--athens);
  font-size: 0.78rem;
  cursor: pointer;
  outline: none;
}
.um-dd-select:focus { border-color: rgba(var(--lavender-rgb), 0.3); }
.um-dd-pw-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.um-dd-pw-input {
  flex: 1;
  padding: 7px 10px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--jacarta-rgb), 0.1);
  background: rgba(var(--s1-rgb), 0.5);
  color: var(--athens);
  font-size: 0.78rem;
  outline: none;
}
.um-dd-pw-input:focus { border-color: rgba(var(--lavender-rgb), 0.3); }
.um-dd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}
.um-dd-table th {
  text-align: left;
  padding: 6px 8px;
  font-weight: 700;
  color: rgba(var(--athens-rgb), 0.4);
  border-bottom: 1px solid rgba(var(--jacarta-rgb), 0.08);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(var(--s1-rgb), 0.35);
}
.um-dd-table td {
  padding: 6px 8px;
  color: var(--athens);
  border-bottom: 1px solid rgba(var(--jacarta-rgb), 0.04);
}
.um-dd-table tbody tr:nth-child(even) td { background: rgba(var(--jacarta-rgb), 0.025); }
.um-dd-table td:first-child { font-weight: 600; }
.um-dd-table tr:hover td { background: rgba(var(--lavender-rgb), 0.03); }
.um-dd-empty { color: rgba(var(--athens-rgb), 0.3); font-size: 0.78rem; padding: 12px 0; }
.um-dd-credit-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(var(--jacarta-rgb), 0.08);
  overflow: hidden;
  margin: 8px 0;
}
.um-dd-credit-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--lavender);
  transition: width 0.3s;
}
.um-dd-credit-fill.over { background: var(--danger); }
.um-dd-credit-fill.warn { background: var(--warn); }
.um-dd-credit-fill.ok { background: var(--ok); }
.um-dd-activity-item {
  display: flex;
  gap: 10px;
  padding: 7px 6px;
  margin: 0 -6px;
  border-radius: var(--r-sm);
  border-bottom: 1px solid rgba(var(--jacarta-rgb), 0.04);
  font-size: 0.73rem;
  transition: background 0.12s;
}
.um-dd-activity-item:hover { background: rgba(var(--lavender-rgb), 0.04); }
.um-dd-activity-time {
  color: rgba(var(--athens-rgb), 0.35);
  flex-shrink: 0;
  width: 70px;
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}
.um-dd-activity-text { color: var(--athens); min-width: 0; flex: 1; line-height: 1.45; }
/* Full activity tab (admin user drawer) */
.um-act-preview {
  display: block;
  margin-top: 2px;
  color: rgba(var(--athens-rgb), 0.45);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 340px;
}
.um-act-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: var(--r-sm, 2px);
  border: 1px solid var(--line);
  vertical-align: middle;
  margin-right: 6px;
}
/* Conversation reader (Activity tab) */
.um-act-conv-row { cursor: pointer; }
.um-act-conv-row:hover td { background: rgba(var(--lavender-rgb), 0.05) !important; }
.um-act-reader-row > td { padding: 0 !important; border-bottom: 1px solid rgba(var(--jacarta-rgb), 0.06) !important; }
.um-act-reader {
  max-height: 480px;
  overflow-y: auto;
  padding: 12px 14px;
  margin: 2px 0 10px;
  background: rgba(var(--s1-rgb), 0.4);
  border-radius: var(--r-md);
}
.um-act-msg { margin-bottom: 12px; }
.um-act-msg-meta {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(var(--athens-rgb), 0.38);
  margin-bottom: 3px;
}
.um-act-msg-body {
  font-size: 0.74rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--athens);
}
.um-act-msg--user .um-act-msg-body {
  color: rgba(var(--athens-rgb), 0.72);
  border-left: 2px solid rgba(var(--lavender-rgb), 0.45);
  padding-left: 10px;
}
.um-act-event {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: rgba(var(--brand-rgb), 0.08);
  color: var(--brand-soft);
  margin: 4px 0;
}
.um-act-event--fail { background: rgba(var(--danger-rgb), 0.08); color: var(--danger); }
.um-act-event-time { opacity: 0.55; font-weight: 400; }

/* Create user modal */
.um-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.um-modal {
  width: 480px;
  max-width: 90vw;
  max-height: 85vh;
  background: var(--s1);
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.3);
}
.um-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(var(--jacarta-rgb), 0.08);
}
.um-modal-header h3 { font-size: 1rem; font-weight: 700; color: var(--athens); margin: 0; }
.um-modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  color: rgba(var(--athens-rgb), 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.um-modal-close:hover { background: rgba(var(--lavender-rgb), 0.08); }
.um-modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.um-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid rgba(var(--jacarta-rgb), 0.08);
}
.um-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.um-form-field { display: flex; flex-direction: column; gap: 4px; }
.um-form-field label {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(var(--athens-rgb), 0.5);
}
.um-form-field input, .um-form-field select {
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--jacarta-rgb), 0.1);
  background: rgba(var(--s1-rgb), 0.5);
  color: var(--athens);
  font-size: 0.8rem;
  font-family: var(--ff-body);
  outline: none;
}
.um-form-field input:focus, .um-form-field select:focus { border-color: rgba(var(--lavender-rgb), 0.3); }
.um-form-field input::placeholder { color: rgba(var(--athens-rgb), 0.3); }

/* Light mode adjustments */
[data-theme="light"] .um-search,
[data-theme="light"] .um-filter,
[data-theme="light"] .um-dd-select,
[data-theme="light"] .um-dd-pw-input,
[data-theme="light"] .um-form-field input,
[data-theme="light"] .um-form-field select {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(var(--athens-rgb), 0.1);
}
[data-theme="light"] .um-detail-drawer,
[data-theme="light"] .um-modal {
  background: var(--s1);
  box-shadow: -8px 0 40px rgba(42, 40, 37, 0.1);
}
[data-theme="light"] .um-row { border-bottom-color: rgba(var(--athens-rgb), 0.04); }
[data-theme="light"] .um-row:hover { background: rgba(var(--lavender-rgb), 0.04); }

/* Responsive */

/* ch 16 lockups: the interface fallback (emblem + Inter Bold) and the signature */
.ath-fallback { display: inline-flex; align-items: center; gap: 0.5rem; }
.ath-fallback img { width: 20px; height: 20px; flex: 0 0 auto; }
.ath-fallback b { font-family: var(--ff-brand); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; color: var(--text); line-height: 1; }
/* Brand lockup: the "Athena" text is replaced by the signature wordmark.
   aw-dark is drawn for dark grounds (default theme), aw-light for light grounds;
   the swap mirrors the .wm-dark-theme/.wm-light-theme pattern above. */
.ath-fallback img.ath-word { width: auto; height: 28px; flex: 0 0 auto; object-fit: contain; }
.ath-fallback img.ath-word.aw-light { display: none; }
[data-theme="light"] .ath-fallback img.ath-word.aw-light { display: inline-block; }
[data-theme="light"] .ath-fallback img.ath-word.aw-dark { display: none; }
.ath-signature { width: 200px; height: auto; }
/* the auth gate signature: the theme swap outranks .auth-overlay-logo's display:block */
img.ath-signature.wm-light-theme{display:none}
img.ath-signature.wm-dark-theme{display:block}
[data-theme="light"] img.ath-signature.wm-dark-theme{display:none}
[data-theme="light"] img.ath-signature.wm-light-theme{display:block}
.auth-overlay-logo.ath-signature{width:200px;height:auto}

/* ═══ Welcome overlay — first-run, three doors ═══ */
.welcome-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 32px 20px; text-align: center;
  background: rgba(10, 8, 16, 0.92);
  backdrop-filter: blur(24px) saturate(160%);
}
.welcome-sig { width: 220px; height: auto; }
.hs-light { display: none; }
[data-theme="light"] .welcome-sig.hs-light { display: block; }
[data-theme="light"] .welcome-sig.hs-dark { display: none; }
[data-theme="light"] .welcome-overlay { background: rgba(248, 247, 251, 0.94); }
.welcome-title { font-family: var(--ff-heading); font-weight: 800; font-size: 1.7rem; letter-spacing: -0.02em; margin: 4px 0 0; color: var(--text); }
.welcome-sub { font-family: var(--ff-body); font-size: 0.95rem; color: var(--mute); margin: 0 0 12px; }
.welcome-doors { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; max-width: 820px; width: 100%; }
.welcome-door {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  padding: 20px 18px; border-radius: var(--r-lg); cursor: pointer; text-align: left;
  background: rgba(var(--lavender-rgb), 0.07);
  border: 1px solid rgba(var(--lavender-rgb), 0.2);
  color: var(--text); font-family: var(--ff-body);
  transition: border-color .15s, background .15s, transform .15s;
}
.welcome-door:hover { border-color: rgba(var(--lavender-rgb), 0.45); background: rgba(var(--lavender-rgb), 0.12); transform: translateY(-2px); }
.welcome-door:focus-visible { outline: 2px solid var(--lavender); outline-offset: 3px; }
.welcome-door svg { width: 22px; height: 22px; color: rgba(var(--lavender-rgb), 0.85); }
.welcome-door-title { font-family: var(--ff-heading); font-weight: 700; font-size: 1.02rem; }
.welcome-door-desc { font-size: 0.82rem; color: var(--mute); line-height: 1.45; }
.welcome-door-chat { background: linear-gradient(135deg, var(--gold), var(--gold-deep)); border-color: rgba(197, 165, 114, 0.5); }
.welcome-door-chat .welcome-door-title, .welcome-door-chat .welcome-door-desc { color: #14102E; }
.welcome-door-chat svg { color: #14102E; }
.welcome-door-chat:hover { background: linear-gradient(135deg, var(--gold-light), var(--gold)); }
.welcome-foot { font: 500 10px var(--ff-mono); letter-spacing: 0.1em; text-transform: uppercase; color: rgba(var(--athens-rgb), 0.5); max-width: 640px; margin-top: 6px; }

/* ═══ Onboarding live frame — in the main chat, above the input ═══ */
.ob-live-panel {
  display: flex; flex-direction: column; gap: 10px;
  max-width: var(--chat-max, 860px); margin: 0 auto 10px;
  padding: 14px 16px 12px;
  border-radius: var(--r-lg);
  background: rgba(var(--lavender-rgb), 0.07);
  border: 1px solid rgba(var(--lavender-rgb), 0.18);
}
.ob-live-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ob-live-title { display: flex; flex-direction: column; gap: 2px; }
.ob-live-kicker { font: 700 10px var(--ff-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--lavender); }
.ob-live-why { font: 400 0.78rem var(--ff-body); color: var(--mute); line-height: 1.4; }
.ob-live-actions { display: flex; gap: 8px; flex-shrink: 0; }
.ob-live-review {
  padding: 7px 14px; border: 0; border-radius: var(--r-sm); cursor: pointer;
  background: var(--gold); color: #14102E; font: 700 0.78rem var(--ff-heading);
}
.ob-live-review:focus-visible { outline: 2px solid var(--lavender); outline-offset: 3px; }
.ob-live-skip { padding: 7px 12px; border: 0; background: none; cursor: pointer; color: var(--mute); font: 500 0.75rem var(--ff-heading); }
.ob-live-skip:hover { color: var(--text); }
.ob-rail { display: flex; gap: 6px; flex-wrap: wrap; }
.ob-rail-step {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-sm);
  font: 500 0.7rem var(--ff-heading); color: var(--mute);
  border: 1px solid rgba(var(--lavender-rgb), 0.18);
}
.ob-rail-step i { width: 6px; height: 6px; border-radius: 50%; background: rgba(var(--lavender-rgb), 0.4); }
.ob-rail-step.done { color: var(--lavender); border-color: rgba(var(--lavender-rgb), 0.4); }
.ob-rail-step.done i { background: var(--lavender); }
.ob-rail-step.current { color: var(--text); border-color: rgba(197, 165, 114, 0.55); }
.ob-rail-step.current i { background: var(--gold); }
.ob-live-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ob-live-chip {
  padding: 3px 9px; border-radius: var(--r-sm); font: 500 0.7rem var(--ff-heading);
  background: rgba(var(--lavender-rgb), 0.12); color: var(--text);
}
.ob-live-chips-empty { font: 400 0.75rem var(--ff-body); color: var(--mute); }

/* ═══ Resume bar ═══ */
.ob-resume-bar {
  display: flex; align-items: center; gap: 12px; justify-content: center;
  max-width: var(--chat-max, 860px); margin: 0 auto 14px;
  padding: 9px 14px; border-radius: var(--r-md);
  background: rgba(var(--lavender-rgb), 0.07);
  border: 1px solid rgba(var(--lavender-rgb), 0.18);
}
.ob-resume-text { font: 400 0.8rem var(--ff-body); color: var(--mute); }
.ob-resume-text b { color: var(--text); font-weight: 600; }
.ob-resume-start { padding: 6px 12px; border: 0; border-radius: var(--r-sm); background: var(--gold); color: #14102E; font: 700 0.75rem var(--ff-heading); cursor: pointer; }
.ob-resume-start:focus-visible, .ob-resume-dismiss:focus-visible { outline: 2px solid var(--lavender); outline-offset: 3px; }
.ob-resume-dismiss { background: none; border: 0; color: var(--mute); cursor: pointer; font-size: 0.85rem; padding: 4px; }
.ob-resume-dismiss:hover { color: var(--text); }

/* ═══ Memory panel — notes with receipts (in the drawer) ═══ */
.mem-notes-section { padding: 18px 20px 6px; border-bottom: 1px solid rgba(var(--lavender-rgb), 0.12); }
.mem-notes-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.mem-notes-title { font: 700 10px var(--ff-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--lavender); }
.mem-notes-refresh { background: none; border: 0; cursor: pointer; color: var(--mute); font: 500 0.72rem var(--ff-heading); }
.mem-notes-refresh:hover { color: var(--text); }
.mem-notes-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; }
.mem-note { padding: 10px 12px; border-radius: var(--r-md); background: rgba(var(--lavender-rgb), 0.06); border: 1px solid rgba(var(--lavender-rgb), 0.14); }
.mem-note-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.mem-note-source { font: 500 9px var(--ff-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-ink, #7A5F30); }
[data-theme="light"] .mem-note-source { color: #7A5F30; }
.mem-note-del { background: none; border: 0; color: var(--mute); cursor: pointer; font-size: 0.8rem; padding: 2px 4px; }
.mem-note-del:hover { color: var(--danger); }
.mem-note-label { font: 600 0.85rem var(--ff-heading); color: var(--text); }
.mem-note-summary, .mem-note-excerpt { font: 400 0.76rem var(--ff-body); color: var(--mute); margin-top: 2px; line-height: 1.45; }

/* ═══ Sidebar memory button ═══ */
.sidebar-footer-btn-label { font-size: 0.62rem; letter-spacing: 0.04em; }
.mem-badge {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px;
  background: var(--lavender); color: #14102E;
  font: 700 9px/16px var(--ff-mono); text-align: center;
}
[data-theme="light"] .mem-badge { background: var(--jacarta); color: #F8F7FB; }

/* ═══ Welcome print + reduced motion ═══ */
@media print { .welcome-overlay, .ob-live-panel, .ob-resume-bar { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .welcome-door, .ob-rail-step { transition: none; } }

/* ═══ Memory panel — tabs + graph hero (drawer) ═══ */
.mem-panel-tabs {
  display: flex; gap: 4px; padding: 12px 20px 0;
  border-bottom: 1px solid rgba(var(--lavender-rgb), 0.12);
}
.mem-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; margin-bottom: -1px; cursor: pointer;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--mute); font: 600 0.8rem var(--ff-heading);
  transition: color .15s, border-color .15s;
}
.mem-tab svg { width: 14px; height: 14px; opacity: .8; }
.mem-tab:hover { color: var(--text); }
.mem-tab.active { color: var(--text); border-bottom-color: var(--gold); }
.mem-tab:focus-visible { outline: 2px solid var(--lavender); outline-offset: 3px; }
[data-theme="light"] .mem-tab.active { border-bottom-color: var(--gold-deep); }

.mem-panel-body { padding: 16px 20px 20px; }
.mem-graph-panel { padding: 12px 14px 16px; }
.mem-graph-panel .memory-graph { height: clamp(300px, 48vh, 460px); }
.mem-update-intro { margin: 0 0 14px; font: 400 0.82rem var(--ff-body); color: var(--mute); }

#memTabNotes .mem-notes-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
#memTabNotes .mem-notes-title { font: 700 10px var(--ff-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--lavender); }
#memTabNotes .mem-notes-refresh { background: none; border: 0; cursor: pointer; color: var(--mute); font: 500 .72rem var(--ff-heading); }
#memTabNotes .mem-notes-refresh:hover { color: var(--text); }
#memTabNotes .mem-notes-list { display: flex; flex-direction: column; gap: 8px; }

.ai-disclaimer-mem {
  background: none; border: 0; cursor: pointer; padding: 0;
  font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(var(--lavender-rgb), .4);
}
.ai-disclaimer-mem:hover { color: var(--lavender); text-decoration-color: var(--lavender); }

@media (max-width: 600px) {
  .mem-panel-tabs { overflow-x: auto; padding: 10px 14px 0; }
  .mem-tab { padding: 8px 12px; font-size: .74rem; flex-shrink: 0; }
  .mem-panel-body { padding: 12px 14px 16px; }
  .mem-graph-panel .memory-graph { height: clamp(260px, 44vh, 380px); }
}

/* Notes tab: edit + delete tools and the inline editor */
.mem-note-tools { display: inline-flex; gap: 2px; }
.mem-note-edit, .mem-note-del { background: none; border: 0; cursor: pointer; padding: 3px 4px; color: var(--mute); display: inline-flex; }
.mem-note-edit:hover { color: var(--lavender); }
.mem-note-del:hover { color: var(--danger); }
.mem-note-edit:focus-visible, .mem-note-del:focus-visible { outline: 2px solid var(--lavender); outline-offset: 2px; }
.mem-note.editing .mem-note-label, .mem-note.editing .mem-note-summary, .mem-note.editing .mem-note-excerpt { display: none; }
.mem-note-editbox { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.mem-note-edit-label, .mem-note-edit-summary {
  width: 100%; padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid rgba(var(--lavender-rgb), 0.3);
  background: rgba(var(--lavender-rgb), 0.05); color: var(--text);
  font: 400 0.8rem var(--ff-body);
}
.mem-note-edit-label { font-weight: 600; }
.mem-note-edit-summary { resize: vertical; min-height: 60px; }
.mem-note-edit-label:focus, .mem-note-edit-summary:focus { outline: 2px solid var(--lavender); outline-offset: 2px; border-color: transparent; }
.mem-note-edit-actions { display: flex; gap: 8px; }
.mem-note-save { padding: 7px 16px; border: 0; border-radius: var(--r-sm); background: var(--gold); color: #14102E; font: 700 0.75rem var(--ff-heading); cursor: pointer; }
.mem-note-save:focus-visible { outline: 2px solid var(--lavender); outline-offset: 3px; }
.mem-note-cancel { background: none; border: 0; cursor: pointer; color: var(--mute); font: 500 0.75rem var(--ff-heading); }
.mem-note-cancel:hover { color: var(--text); }

/* Cache-refresh icon button beside the theme switcher (Engage semantics) */
.sidebar-footer-btn .refresh-status-dot {
  position: absolute; top: 5px; right: 5px; width: 6px; height: 6px;
  border-radius: 50%; background: #2DD4A7;
  box-shadow: 0 0 4px rgba(45,212,167,.55); pointer-events: none;
}
.sidebar-footer-btn { position: relative; }
.sidebar-footer-btn#versionRefresh.is-refreshing { pointer-events: none; color: #E3C88F; }
.sidebar-footer-btn#versionRefresh.is-refreshing svg {
  animation: refreshIconSpin .8s linear infinite;
}
.sidebar-footer-btn#versionRefresh.is-refreshing .refresh-status-dot {
  background: #E3C88F; box-shadow: 0 0 4px rgba(227,200,143,.55);
}
@keyframes refreshIconSpin { to { transform: rotate(360deg); } }

/* Deployed version tag — teeny tiny, under the footer button row */
.sidebar-version {
  display: block; text-align: center; margin-top: 4px;
  font-family: var(--font-mono, monospace); font-size: 9px; font-weight: 600;
  letter-spacing: .04em; color: rgba(139,125,167,.45); user-select: none;
}
.sidebar:hover .sidebar-version { color: rgba(227,200,143,.55); }
/* Business picker: default-business star */
.business-dropdown-item .biz-default { margin-left: auto; flex: none; border: none; background: transparent; color: var(--text-mute, rgba(255,255,255,.4)); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 13px; opacity: .55; transition: opacity .15s, background .15s, color .15s; }
.business-dropdown-item:hover .biz-default, .business-dropdown-item .biz-default.on { opacity: 1; }
.business-dropdown-item .biz-default:hover { background: rgba(197,165,114,.16); color: #C5A572; }
.business-dropdown-item .biz-default.on { color: #C5A572; }

/* Settings > Changelog (admin) */
.cl-body { padding: 18px 18px 40px; }
.cl-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cl-title { font-size: 18px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.cl-sub { font-size: 12px; color: var(--text-mute); margin-top: 3px; line-height: 1.5; }
.cl-sync { flex: none; border: none; border-radius: 10px; background: var(--gold, #C5A572); color: #14102E; font: inherit; font-size: 12.5px; font-weight: 700; padding: 8px 14px; cursor: pointer; transition: filter .15s, transform .15s; }
.cl-sync:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); }
.cl-sync:disabled { opacity: .55; cursor: default; }
.cl-status { display: flex; align-items: center; gap: 9px; font-size: 12.5px; padding: 9px 12px; border-radius: 10px; margin-bottom: 18px; background: var(--s2); border: 1px solid var(--line, rgba(255,255,255,.08)); color: var(--text-dim, var(--text)); }
.cl-dot { width: 8px; height: 8px; border-radius: 50%; background: #C5A572; flex: none; }
.cl-status.ok .cl-dot { background: #2DD4A7; box-shadow: 0 0 8px rgba(45,212,167,.6); }
.cl-release { margin-bottom: 22px; }
.cl-rhead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line, rgba(255,255,255,.08)); }
.cl-ver { font-size: 15px; font-weight: 800; color: var(--text); }
.cl-type { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: rgba(152,137,192,.18); color: var(--text-dim, var(--text)); }
.cl-type.major { background: rgba(197,165,114,.22); color: #C5A572; }
.cl-type.patch { background: rgba(45,212,167,.14); color: #2DD4A7; }
.cl-date { margin-left: auto; font-size: 12px; color: var(--text-mute); }
.cl-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.cl-items li { display: flex; gap: 10px; align-items: flex-start; }
.cl-tag { flex: none; width: 64px; text-align: center; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 0; border-radius: 6px; margin-top: 2px; background: rgba(152,137,192,.16); color: var(--text-dim, var(--text)); }
.cl-tag.added { background: rgba(45,212,167,.14); color: #2DD4A7; }
.cl-tag.fixed { background: rgba(214,106,106,.16); color: #D86A6A; }
.cl-tag.improved { background: rgba(197,165,114,.18); color: #C5A572; }
[data-theme="light"] .cl-tag.added { color: #0B7A55; }
[data-theme="light"] .cl-tag.improved { color: #7A5F30; }
[data-theme="light"] .cl-tag.fixed { color: #B42318; }
[data-theme="light"] .cl-type.major { color: #7A5F30; }
[data-theme="light"] .cl-type.patch { color: #0B7A55; }
.cl-text { font-size: 13px; line-height: 1.55; color: var(--text); }
.cl-empty { padding: 30px 0; text-align: center; color: var(--text-mute); font-size: 13px; }

/* Welcome screen: Athena the character replaces the orb.
   Size lives HERE, not inline on the element: an inline custom property
   beats every media query, which is how the owl overflowed its box on
   phones (148px art in a 128px container). */
.welcome-owl { position: relative; display: grid; place-items: center; width: 168px; height: 168px; margin: 0 auto 10px; }
.welcome-owl athena-owl { --athena-size: 148px; animation: owl-breathe 5.2s ease-in-out infinite; }
@keyframes owl-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@media (max-width: 760px) { .welcome-owl { width: 104px; height: 104px; margin: 0 auto 2px; } .welcome-owl athena-owl { --athena-size: 104px; } }
@media (max-width: 760px) { .welcome { padding: 14px 16px 10px; } }
@media (max-width: 760px), (max-height: 720px) { .roladex-viewport { height: 210px; } }
@media (max-width: 760px) and (max-height: 680px) { .roladex-viewport { height: 178px; } }
@media (prefers-reduced-motion: reduce) { .welcome-owl athena-owl { animation: none; } }
.dm-owl { width: 28px; height: 28px; flex: none; margin-top: 2px; }
@media (max-width: 1000px) { .dm-owl { width: 26px; height: 26px; } }

/* ═══ Chat message typography (19 Nov 2026) ═══════════════════════════
   Pairs with the marked-based renderer: real lists, real structure, so the
   rhythm below can actually apply. Theme variables only (light + dark). */
.msg-content { font-size: 0.97rem; line-height: 1.72; }
.msg-content p { margin: 0 0 14px; }
.msg-content > :last-child { margin-bottom: 0; }

/* Section lead-ins: "Posting tips:", "**First 24 hours:**" */
.msg-content p.md-lead {
  margin: 22px 0 8px; font-family: var(--ff-heading); font-weight: 700;
  font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--lavender); display: flex; align-items: center; gap: 10px;
}
.msg-content p.md-lead::after { content: ""; flex: 1; height: 1px; background: rgba(var(--lavender-rgb), 0.14); }
.msg-content > p.md-lead:first-child { margin-top: 0; }

/* Headings */
.msg-content h1, .msg-content h2, .msg-content h3, .msg-content h4 { margin: 28px 0 10px; }
.msg-content h2 { font-size: 1.18rem; }
.msg-content h1 + p, .msg-content h2 + p, .msg-content h3 + p { margin-top: 0; }

/* Lists: tight, aligned, readable. Loose-list <p> inside <li> no longer adds gaps. */
.msg-content ul, .msg-content ol { margin: 4px 0 16px; padding-left: 24px; }
.msg-content li { margin: 0 0 8px; padding-left: 6px; line-height: 1.65; }
.msg-content li > p { margin: 0 0 6px; }
.msg-content li > p:last-child { margin-bottom: 0; }
.msg-content li > ul, .msg-content li > ol { margin: 6px 0 4px; }
.msg-content ul > li::marker { color: var(--lavender); font-size: 0.9em; }
.msg-content ol > li::marker { color: var(--lavender); font-weight: 700; font-family: var(--ff-heading); font-variant-numeric: tabular-nums; }
.msg-content li > strong:first-child, .msg-content li > p:first-child > strong:first-child { color: var(--white); }

/* Task lists */
.msg-content li:has(> .md-check), .msg-content li:has(> p > .md-check) { list-style: none; margin-left: -20px; }
.msg-content .md-check {
  display: inline-block; width: 15px; height: 15px; margin: 0 9px -2px 0;
  border: 1.5px solid rgba(var(--lavender-rgb), 0.55); border-radius: 4px; vertical-align: baseline;
}
.msg-content .md-check.on { background: var(--lavender); border-color: var(--lavender); box-shadow: inset 0 0 0 2.5px var(--s1, #14102e); }

/* Tables: the wrapper scrolls, the table keeps its rounded frame */
.msg-content .md-table-wrap { max-width: 100%; overflow-x: auto; margin: 16px 0; border: 1px solid rgba(var(--lavender-rgb), 0.1); border-radius: var(--r-md); -webkit-overflow-scrolling: touch; }
.msg-content .md-table-wrap table { display: table; margin: 0; border: none; border-radius: 0; min-width: 100%; }
.msg-content td { vertical-align: top; }
.msg-content tbody tr:nth-child(even) td { background: rgba(var(--lavender-rgb), 0.025); }

/* Blockquote as a calm callout, not shouting italics */
.msg-content blockquote { font-style: normal; color: var(--text-primary); }
.msg-content blockquote p:last-child { margin-bottom: 0; }

/* Dividers fade at the edges */
.msg-content hr { margin: 24px 0; background: linear-gradient(90deg, transparent, rgba(var(--lavender-rgb), 0.22), transparent); }

/* Long URLs wrap without breaking every word */
.msg-content a { word-break: normal; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .msg-content { font-size: 0.95rem; }
  .msg-content ul, .msg-content ol { padding-left: 20px; }
}
[data-theme="light"] .msg-content th { background: rgba(var(--lavender-rgb), 0.12); color: #2D2769; }
[data-theme="light"] .msg-content p.md-lead, [data-theme="light"] .msg-content ol > li::marker { color: #2D2769; }

/* ═══ Thinking card: fully collapsed until clicked (20 Nov 2026) ═══ */
.think-block.collapsed .think-block-body { max-height: 0; padding-top: 0; padding-bottom: 0; border-top-color: transparent; }
.think-block.collapsed .think-block-body::after { display: none; }
.think-block.collapsed { background: rgba(var(--lavender-rgb), 0.04); }
.think-block .think-block-header { padding: 7px 12px; }
.think-block { display: block; width: fit-content; max-width: 100%; border-radius: 20px; }
.think-block.expanded { width: auto; border-radius: var(--r-lg); }

/* ═══ Tool banners (searching, reading pages) styled as the memory chip ═══ */
.tool-use-banner {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px;
  width: fit-content; max-width: 100%;
  padding: 5px 11px; margin: 0 6px 8px 0;
  border-radius: 20px;
  background: rgba(var(--lavender-rgb), 0.08);
  border: 1px solid rgba(var(--lavender-rgb), 0.2);
  color: var(--lavender);
  font-size: 0.72rem; font-weight: 500; line-height: 1.4;
}
.tool-use-banner svg { width: 12px; height: 12px; animation: none; }
.tool-use-banner svg.tool-spinner { animation: orbitSpin 1.5s linear infinite; }
.tool-use-banner.done { color: var(--lavender); opacity: 0.75; }
.tool-use-banner.done svg { color: var(--lavender); }
.tool-use-banner .tool-query-list { display: inline-flex; flex-wrap: wrap; flex-direction: row; gap: 4px 6px; margin: 0; }
.tool-use-banner .tool-query-list li { padding: 1px 8px; border-radius: 10px; background: rgba(var(--lavender-rgb), 0.1); }

/* ═══ Model-aware routing: per-task model picker list ═══ */
.routing-task-list { margin-top: 14px; border-top: 1px solid rgba(var(--lavender-rgb), 0.12); padding-top: 4px; }
.routing-task-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(var(--lavender-rgb), 0.06); }
.routing-task-row:last-child { border-bottom: none; }
.routing-task-info { flex: 1; min-width: 0; }
.routing-task-name { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.routing-task-desc { display: block; font-size: 11.5px; color: var(--text-mute); margin-top: 2px; line-height: 1.4; }
.routing-task-model { flex: none; width: 220px; font-size: 12px; padding: 6px 28px 6px 10px; border-radius: 8px; border: 1px solid rgba(var(--lavender-rgb), 0.15); background: var(--s2); color: var(--text); cursor: pointer; }
.routing-task-model:hover { border-color: var(--gold); }
.routing-task-model:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }
@media (max-width: 600px) { .routing-task-row { flex-direction: column; align-items: stretch; gap: 6px; } .routing-task-model { width: 100%; } }

/* ═══ Model-aware routing badge (appears above the reply) ═══ */
.routing-badge {
    display: inline-flex; align-items: center; gap: 8px;
    margin: 0 0 8px; padding: 5px 12px;
    border-radius: 20px; font-size: 12px; font-weight: 600;
    animation: routingIn 0.3s ease-out;
    max-width: 100%; flex-wrap: wrap;
}
@keyframes routingIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.routing-badge.sovereign {
    background: rgba(var(--lavender-rgb), 0.08);
    border: 1px solid rgba(var(--lavender-rgb), 0.2);
    color: var(--lavender);
}
.routing-badge.frontier {
    background: rgba(197,165,114,0.1);
    border: 1px solid rgba(197,165,114,0.25);
    color: var(--gold-text, #A88550);
}
[data-theme="light"] .routing-badge.sovereign { color: #2D2769; }
[data-theme="light"] .routing-badge.frontier { color: #7A5F30; }
.routing-badge i { font-size: 11px; flex: none; }
.routing-badge.sovereign i { color: var(--lavender); }
.routing-badge.frontier i { color: var(--gold-text, #A88550); }
.routing-badge-model { font-weight: 700; }
.routing-badge-task { color: var(--text-mute); font-weight: 400; font-size: 11px; text-transform: capitalize; }
.routing-badge-reason { color: var(--text-mute); font-weight: 400; font-size: 11px; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routing-badge-switch {
    border: none; border-radius: 10px; padding: 2px 10px;
    background: var(--gold, #C5A572); color: #14102E;
    font: inherit; font-size: 11px; font-weight: 700;
    cursor: pointer; transition: filter 0.15s;
}
.routing-badge-switch:hover { filter: brightness(1.1); }
.routing-badge.current { opacity: 0.6; }
.routing-badge.switched { border-color: var(--ok, #2DD4A7); }

/* ═══ Routing model picker popover ═══ */
.routing-task-model-btn {
    flex: none; display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 14px; border-radius: 10px;
    border: 1px solid rgba(var(--lavender-rgb), 0.15);
    background: var(--s2); color: var(--text);
    font: inherit; font-size: 12.5px; font-weight: 600;
    cursor: pointer; transition: border-color 0.15s;
    max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.routing-task-model-btn:hover { border-color: var(--gold); }
.routing-task-model-btn i { font-size: 10px; opacity: 0.6; flex: none; }
.routing-task-model-label { overflow: hidden; text-overflow: ellipsis; }
.routing-picker {
    position: fixed; z-index: 9999;
    width: 380px; max-height: 420px;
    background: var(--s1); border: 1px solid rgba(var(--lavender-rgb), 0.2);
    border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,0.4);
    display: flex; flex-direction: column; overflow: hidden;
    animation: routingIn 0.15s ease-out;
}
.routing-picker-search {
    margin: 10px; padding: 8px 12px; border-radius: 10px;
    border: 1px solid rgba(var(--lavender-rgb), 0.15);
    background: var(--s2); color: var(--text); font: inherit; font-size: 13px;
    outline: none;
}
.routing-picker-search:focus { border-color: var(--gold); }
.routing-picker-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.routing-picker-group {
    font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--text-mute); padding: 10px 8px 4px;
}
.routing-picker-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; padding: 8px 10px; border: none; border-radius: 8px;
    background: transparent; color: var(--text); font: inherit; font-size: 13px;
    cursor: pointer; text-align: left;
}
.routing-picker-item:hover { background: var(--s3); }
.routing-picker-item.selected { background: rgba(var(--lavender-rgb), 0.1); border-left: 2px solid var(--gold); }
.routing-picker-name { font-weight: 600; }
.routing-picker-id { font-size: 10px; color: var(--text-mute); font-family: var(--ff-mono, monospace); }
.routing-picker-empty { padding: 20px; text-align: center; color: var(--text-mute); font-size: 13px; }
.routing-picker-list::-webkit-scrollbar { width: 6px; }
.routing-picker-list::-webkit-scrollbar-thumb { background: rgba(var(--lavender-rgb), 0.15); border-radius: 3px; }

/* Canvas action buttons: readable in both themes */
[data-theme="light"] .canvas-action-btn {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(45, 30, 100, 0.15);
  color: #2D2769;
  box-shadow: 0 6px 18px rgba(45, 30, 100, 0.1);
}
[data-theme="light"] .canvas-action-btn svg { color: #2D2769; }
[data-theme="light"] .canvas-action-btn:hover {
  background: #FFFFFF;
  border-color: var(--gold, #C5A572);
}

/* Canvas toolbar: hide buttons superseded by the Documents workspace.
   Keep: close, copy, new tab. Hidden: iterate (document chat is better),
   print (Documents editor PDF is properly branded), download (same). */
#canvasIterate { display: none !important; }

/* ═══ Owl-led first-run onboarding (ob2) — steps inside #welcomeOverlay ═══ */
.welcome-overlay { overflow-y: auto; }
@keyframes ob2In { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.ob2-step {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  max-width: 560px; width: 100%;
  animation: ob2In .45s ease;
}
.ob2-step[hidden] { display: none; }
.welcome-overlay athena-owl { --athena-size: 104px; margin-bottom: 2px; }
.ob2-name-field {
  width: 100%; max-width: 360px; text-align: left;
  display: flex; flex-direction: column; gap: 6px; margin-top: 6px;
}
.ob2-name-field label {
  font: 700 11px var(--ff-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mute);
}
.ob2-name-field input {
  width: 100%; height: 48px; padding: 0 14px;
  border-radius: var(--r-md, 4px);
  background: rgba(var(--lavender-rgb), .06);
  border: 1px solid rgba(var(--lavender-rgb), .25);
  color: var(--text); font: 500 15px var(--ff-body);
}
.ob2-name-field input:focus {
  outline: none; border-color: rgba(197,165,114,.6); background: rgba(var(--lavender-rgb), .1);
}
[data-theme="light"] .ob2-name-field input { background: #fff; }
.ob2-nudge { animation: ob2Nudge .5s ease; }
@keyframes ob2Nudge { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.ob2-cta {
  height: 46px; padding: 0 22px; border-radius: var(--r-lg, 4px);
  border: 1px solid rgba(197,165,114,.4);
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: #14102E; font: 700 14px var(--ff-heading); cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform .2s var(--ease-spring, ease), box-shadow .2s ease;
}
.ob2-cta:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(197,165,114,.25); }
.ob2-cta[disabled] { opacity: .5; cursor: default; transform: none; box-shadow: none; }
.ob2-cta-ghost { background: transparent; border-color: rgba(var(--lavender-rgb), .3); color: var(--text); }
.ob2-cta-ghost:hover { border-color: rgba(var(--lavender-rgb), .5); box-shadow: none; }
.ob2-skip {
  background: none; border: 0; cursor: pointer;
  font: 600 12px var(--ff-body); color: var(--mute);
  padding: 8px; text-decoration: underline; text-underline-offset: 3px;
}
.ob2-skip:hover { color: var(--text); }
.ob2-prompt-steps {
  text-align: left; margin: 0; padding-left: 20px;
  display: flex; flex-direction: column; gap: 6px;
  color: var(--mute); font-size: .88rem;
}
.ob2-paste {
  width: 100%; max-width: 560px; padding: 12px 14px;
  border-radius: var(--r-md, 4px); resize: vertical;
  background: rgba(var(--lavender-rgb), .06);
  border: 1px solid rgba(var(--lavender-rgb), .25);
  color: var(--text); font: 400 13px var(--ff-body); line-height: 1.5;
}
.ob2-paste:focus { outline: none; border-color: rgba(197,165,114,.6); }
[data-theme="light"] .ob2-paste { background: #fff; }
.ob2-row { display: flex; align-items: center; gap: 14px; }
.ob2-back { background: none; border: 0; cursor: pointer; font: 600 12px var(--ff-body); color: var(--mute); padding: 8px; }
.ob2-back:hover { color: var(--text); }
.ob2-fine { font-size: .8rem !important; }

/* ═══ Free-plan daily usage meter (account users, chat header) ═══ */
.free-usage-counter.near-limit { color: var(--gold-soft, #E3C88F); border-color: rgba(197,165,114,.45); }
.free-usage-counter.at-limit { color: #ff6b6b; border-color: rgba(229,72,77,.5); }
[data-theme="light"] .free-usage-counter.near-limit { color: var(--gold-ink, #7A5F30); }
[data-theme="light"] .free-usage-counter.at-limit { color: #C2373C; }
@media (max-width: 640px) {
  .welcome-overlay athena-owl { --athena-size: 84px; }
  .ob2-row { flex-direction: column; gap: 6px; }
}

/* ═══ Migration prompt source picker (ob2) ═══ */
.ob2-src-picker {
  display: inline-flex; gap: 4px; padding: 4px;
  border: 1px solid rgba(var(--lavender-rgb), .22);
  border-radius: var(--r-pill, 999px);
  background: rgba(var(--lavender-rgb), .05);
}
.ob2-src {
  border: 0; border-radius: var(--r-pill, 999px);
  padding: 7px 16px; cursor: pointer;
  background: transparent; color: var(--mute);
  font: 600 12.5px var(--ff-heading);
  transition: color .2s ease, background .2s ease;
}
.ob2-src:hover { color: var(--text); }
.ob2-src.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: #14102E;
}
.ob2-src:focus-visible { outline: 2px solid var(--lavender); outline-offset: 2px; }
[data-theme="light"] .ob2-src-picker { background: #fff; }

/* The Perch: one responsive composition. Artwork never carries navigation. */
.perch-overlay {
  --perch-ground: #121025;
  --perch-surface: #1b182f;
  --perch-card: #242039;
  --perch-ink: #f4f0fa;
  --perch-muted: #b7aec9;
  --perch-line: #3b344e;
  --perch-selected: #3c3256;
  --perch-accent: #e9cf9d;
  position: fixed;
  inset: 0;
  z-index: 495;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--perch-ground);
  color: var(--perch-ink);
  opacity: 0;
  transition: opacity .2s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--perch-line) var(--perch-ground);
}
.perch-overlay.hidden { display: none; }
.perch-overlay.in { opacity: 1; }
body.perch-open { overflow: hidden; }
[data-theme="light"] .perch-overlay {
  --perch-ground: #f3f0ed;
  --perch-surface: #fffcf8;
  --perch-card: #fffdfa;
  --perch-ink: #30283e;
  --perch-muted: #70677c;
  --perch-line: #e5dedf;
  --perch-selected: #e9e2f0;
  --perch-accent: #59417d;
}
.perch-shell { max-width: 1440px; min-height: 100%; margin: 0 auto; }
.perch-hero {
  --scene-height: 286px;
  position: relative;
  height: var(--scene-height);
  isolation: isolate;
  overflow: hidden;
  background: #27213f;
  color: #fff8ed;
}
.perch-stage, .perch-sky { position: absolute; inset: 0; pointer-events: none; }
.perch-stage { z-index: -1; left: auto; width: calc(var(--scene-height) * 2); }
.perch-sky {
  background: linear-gradient(90deg, #27213f, rgba(28,20,48,.22) 48%, transparent 80%),
    url('../perch/perch-scene-v4.webp') center / 100% 100% no-repeat;
}
.perch-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  z-index: 2;
}
.perch-eyebrow {
  color: #ead3a5;
  font: 600 11px var(--ff-heading, sans-serif);
  letter-spacing: .22em;
  text-transform: uppercase;
}
.perch-top-actions { display: flex; gap: 10px; }
.perch-hbtn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #ffffff36;
  border-radius: 50%;
  background: #211b3b94;
  color: #fff8ed;
  cursor: pointer;
}
.perch-hbtn:hover { background: #463757; }
.perch-welcome { position: absolute; left: 40px; bottom: 44px; max-width: 54%; }
.perch-welcome h2 {
  margin: 0 0 12px;
  font: 600 clamp(26px, 3vw, 38px)/1.17 var(--ff-heading, sans-serif);
  letter-spacing: -.035em;
  color: #fff8ed;
}
.perch-welcome p { margin: 0; font-size: 14px; line-height: 1.6; color: #e2d6e5; }
.perch-owl-wrap {
  position: absolute;
  right: calc(var(--scene-height) * .29);
  bottom: calc(var(--scene-height) * .24);
  transform-origin: 50% 95%;
  animation: perchSway 8s ease-in-out infinite;
  pointer-events: none;
}
.perch-owl-wrap .perch-owl {
  display: block;
  --athena-size: calc(var(--scene-height) * .48);
  filter: drop-shadow(0 6px 8px #160d2b70);
}
@keyframes perchSway {
  0%, 100% { transform: rotate(-.4deg); }
  50% { transform: rotate(.5deg); }
}
.perch-workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  padding: 32px 40px 48px;
  align-items: start;
}
.perch-rail { min-width: 0; position: sticky; top: 24px; }
.perch-conversation { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--perch-line); }
.perch-faculties, .perch-admin-links { display: grid; gap: 6px; }
.perch-rail .perch-node {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--perch-muted);
  text-align: left;
  bottom: auto;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.perch-rail .perch-node::after { display: none; }
.perch-node-label { font: 600 14px/1.3 var(--ff-heading, sans-serif); white-space: normal; }
.perch-node-orb {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: .45;
}
.perch-rail .perch-node:hover { background: var(--perch-selected); color: var(--perch-ink); }
.perch-rail .perch-node.active {
  background: var(--perch-selected);
  color: var(--perch-accent);
  border-color: var(--perch-line);
}
.perch-node.active .perch-node-orb { opacity: 1; }
.perch-keepers { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--perch-line); }
.perch-group-label { display: block; margin: 0 16px 12px; color: var(--perch-muted); font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.perch-content {
  min-width: 0;
  background: var(--perch-surface);
  border: 1px solid var(--perch-line);
  border-radius: 24px;
  box-shadow: 0 8px 30px #1f143508;
  overflow: hidden;
}
.perch-section-heading { padding: 28px 32px 24px; border-bottom: 1px solid var(--perch-line); }
.perch-section-kicker { color: var(--perch-muted); font-size: 11px; letter-spacing: .04em; }
.perch-title { margin: 6px 0; color: var(--perch-ink); font: 600 28px/1.2 var(--ff-heading, sans-serif); letter-spacing: -.03em; }
.perch-section-heading p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--perch-muted); }
.perch-panels { min-width: 0; }
.perch-panels .drawer-tab-panel { min-width: 0; }
.perch-panels .drawer-body { padding: 12px 32px 28px; overflow: visible; }
.perch-panels .set-card {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--perch-line);
  border-radius: 0;
  margin: 0;
  padding: 0;
  box-shadow: none;
  overflow: hidden;
}
.perch-panels .set-card-header {
  min-height: 82px;
  padding: 18px 0;
  gap: 14px;
  color: var(--perch-ink);
  background: transparent;
}
.perch-panels .set-card-header:hover { background: transparent; }
.perch-panels .set-card-icon { color: var(--perch-accent); flex-shrink: 0; }
.perch-panels .set-card-title { color: var(--perch-ink); font-size: 15px; font-weight: 600; }
.perch-panels .set-card-summary { color: var(--perch-muted); font-size: 12px; line-height: 1.5; margin-top: 3px; white-space: normal; }
.perch-panels .set-card-chevron { color: var(--perch-muted); flex-shrink: 0; }
.perch-panels .set-card-body { padding: 0 0 22px; }
.perch-panels .setting-label { color: var(--perch-ink); font-size: 13px; }
.perch-panels .setting-info-text { color: var(--perch-muted); line-height: 1.65; }
.perch-panels .setting-input {
  background: var(--perch-card);
  color: var(--perch-ink);
  border-color: var(--perch-line);
  border-radius: 10px;
  font-size: 14px;
}
.perch-panels .setting-toggle-row { background: var(--perch-card); border-color: var(--perch-line); border-radius: 12px; }
.perch-panels .setting-save-btn {
  width: auto;
  min-width: 164px;
  min-height: 44px;
  margin-top: 24px;
  padding: 12px 22px;
  border: 1px solid #706084;
  border-radius: 12px;
  background: #514068;
  color: #fffaf2;
  box-shadow: none;
}
.perch-panels .setting-save-btn:hover { background: #66517f; }
.perch-overlay :is(button, input, textarea, select, a):focus-visible {
  outline: 2px solid var(--perch-accent);
  outline-offset: 3px;
}
.perch-hero button:focus-visible { outline-color: #ead3a5; }
/* Memory shares the same surface, with its own three views inside it. */
#memoryPanel .onboarding-body { padding: 20px 28px 28px; }
#memoryPanel .mem-panel-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  overflow: visible;
  border: 1px solid var(--perch-line);
  border-radius: 14px;
  background: var(--perch-ground);
  margin-bottom: 22px;
}
#memoryPanel .mem-tab {
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 10px 8px;
  border: 0;
  border-radius: 10px;
  color: var(--perch-muted);
}
#memoryPanel .mem-tab.active { background: var(--perch-selected); color: var(--perch-accent); }
#memoryPanel .mem-panel-body { padding: 0; min-width: 0; }
#memoryPanel .mem-panel-body[hidden] { display: none; }
#memoryPanel .memory-toolbar { gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
#memoryPanel .mem-action, #memoryPanel .mem-action-link, #memoryPanel .mem-action-danger-icon { min-height: 44px; }
#memoryPanel .mem-action-danger-icon { width: 44px; flex: 0 0 44px; }
#memoryPanel .mem-search { min-width: 0; height: 44px; }
#memoryPanel .mem-search input { min-width: 0; width: 100%; color: var(--perch-ink); }
#memoryPanel .mem-context-select { max-width: 100%; height: 44px; color: var(--perch-ink); }
#memoryPanel .memory-graph { min-height: 0; height: clamp(300px, 46vh, 440px); border-radius: 16px; box-shadow: none; }
#memoryPanel .memory-detail,
#memoryPanel .onboarding-card,
#memoryPanel .mem-note {
  background: var(--perch-card);
  border: 1px solid var(--perch-line);
  border-radius: 16px;
  box-shadow: none;
}
#memoryPanel .memory-detail-title,
#memoryPanel .memory-field-value,
#memoryPanel .mem-note-label { color: var(--perch-ink); overflow-wrap: anywhere; }
#memoryPanel .memory-detail-summary,
#memoryPanel .memory-detail-meta,
#memoryPanel .memory-field-label,
#memoryPanel .memory-detail-empty,
#memoryPanel .mem-update-intro,
#memoryPanel .mem-note-summary,
#memoryPanel .mem-note-excerpt,
#memoryPanel .onboarding-prompt-box p { color: var(--perch-muted); }
#memoryPanel .onboarding-step strong { color: var(--perch-accent); }
#memoryPanel .onboarding-card { padding: 20px; }
#memoryPanel .memory-editor-actions { flex-wrap: wrap; align-items: center; }
#memoryPanel .memory-editor-save { margin-top: 0; min-width: 120px; }
@media (min-width: 1200px) {
  #memoryPanel .mem-graph-panel { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: 16px; align-items: start; }
  #memoryPanel .memory-toolbar, #memoryPanel .mem-tools { grid-column: 1 / -1; margin: 0; }
  #memoryPanel .memory-detail { margin-top: 0; min-width: 0; }
}
@media (max-width: 600px) {
  #memoryPanel .onboarding-body { padding: 16px; }
  #memoryPanel .mem-tab { font-size: 12px; gap: 0; }
  #memoryPanel .mem-tab svg { display: none; }
  #memoryPanel .mem-tools { gap: 8px; }
  #memoryPanel .mem-search { flex-basis: 100%; }
  #memoryPanel .mem-search input, #memoryPanel .mem-context-select { font-size: 16px; }
  #memoryPanel .mem-context-select { flex: 1; min-width: 0; }
  #memoryPanel .mem-count { flex-basis: 100%; }
  #memoryPanel .onboarding-card { padding: 16px; }
  #memoryPanel .onboarding-grid.two, #memoryPanel .onboarding-grid.three { grid-template-columns: 1fr; }
  #memoryPanel .memory-fields { grid-template-columns: 1fr; }
}
/* The shared support launcher must not cover modal controls. */
body.perch-open aristos-support { visibility: hidden; }
@media (min-width: 1441px) {
  .perch-shell { padding: 24px 0; }
  .perch-hero { border-radius: 28px; }
}
@media (max-width: 800px) {
  .perch-hero { --scene-height: 220px; }
  .perch-top { padding: 16px 24px; }
  .perch-welcome { left: 24px; bottom: 30px; }
  .perch-welcome h2 { font-size: 28px; }
  .perch-welcome p { font-size: 12px; max-width: 260px; }
  .perch-workspace { display: block; padding: 18px 20px 32px; }
  .perch-rail { position: static; margin-bottom: 18px; }
  .perch-conversation { margin-bottom: 12px; padding-bottom: 12px; }
  .perch-faculties { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .perch-rail .perch-node { min-height: 44px; padding: 10px; justify-content: center; gap: 7px; border-radius: 12px; }
  .perch-node-label { font-size: 13px; }
  .perch-keepers { margin-top: 12px; padding-top: 12px; }
  .perch-group-label { margin: 0 4px 6px; font-size: 9px; }
  .perch-admin-links { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .perch-admin-links .perch-node { padding: 8px 4px; }
  .perch-admin-links .perch-node-orb { display: none; }
  .perch-admin-links .perch-node-label { font-size: 12px; }
  .perch-content { border-radius: 20px; }
  .perch-section-heading { padding: 22px 24px 18px; }
  .perch-panels .drawer-body { padding: 4px 24px 24px; }
}
@media (max-width: 480px) {
  .perch-hero { --scene-height: 204px; }
  .perch-top { padding: max(12px, env(safe-area-inset-top)) 16px 8px; }
  .perch-hbtn { width: 44px; height: 44px; }
  .perch-welcome { left: 20px; bottom: 26px; max-width: 62%; }
  .perch-welcome h2 { font-size: 24px; margin-bottom: 10px; }
  .perch-welcome p { font-size: 12px; max-width: 195px; }
  .perch-owl-wrap { right: calc(var(--scene-height) * .20); }
  .perch-workspace { padding: 12px 12px max(24px, env(safe-area-inset-bottom)); }
  .perch-node-orb { display: none; }
  .perch-node-label { font-size: 12px; }
  .perch-rail .perch-node { padding: 10px 6px; }
  .perch-section-heading { padding: 20px; }
  .perch-title { font-size: 25px; }
  .perch-section-heading p { font-size: 13px; }
  .perch-panels .drawer-body { padding: 2px 20px 24px; }
  .perch-panels .setting-save-btn { width: 100%; }
  .perch-panels .setting-input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .perch-overlay, .perch-owl-wrap, .perch-node { animation: none; transition: none; }
}

/* Guest-only gold "Learn about me" card in the roladex */
.roladex-card.roladex-card-gold {
  border-color: rgba(var(--gold-rgb), .65);
  background: linear-gradient(135deg, rgba(var(--gold-rgb), .26), rgba(var(--gold-rgb), .1));
  color: var(--gold-ink, #7A5F30);
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(var(--gold-rgb), .22);
}
.roladex-card.roladex-card-gold svg { color: var(--gold); }
html:not([data-theme="light"]) .roladex-card.roladex-card-gold { color: var(--gold-light, #E3C88F); }


/* ── Collapsible Perch rail groups ── */
.perch-group-head{display:flex;align-items:center;justify-content:space-between;width:100%;background:none;border:none;padding:2px 8px 8px;color:var(--perch-muted);font-family:inherit;font-size:10px;font-weight:600;letter-spacing:.14em;text-transform:uppercase;cursor:pointer;transition:color .2s;border-radius:6px}
.perch-group-head:hover{color:var(--perch-ink,#30283e)}
.perch-group-head .pg-chevron{transition:transform .25s var(--ease-spring);flex-shrink:0}
.perch-group.collapsed .perch-group-head .pg-chevron{transform:rotate(-90deg)}
.perch-group.collapsed .perch-group-body{display:none}
.perch-group[data-pgroup="chat"] .perch-group-body{margin-bottom:12px;padding-bottom:16px;border-bottom:1px solid var(--perch-line)}
.perch-group[data-pgroup="you"]{margin-top:8px}
.perch-group[data-pgroup="admin"]{margin-top:18px;padding-top:16px;border-top:1px solid var(--perch-line)}
@media(max-width:700px){.perch-group[data-pgroup="chat"] .perch-group-body{margin-bottom:8px;padding-bottom:10px}}

/* Light mode: the truncation fade matches the paper code surface */
[data-theme="light"] .code-block-expand { background: linear-gradient(to bottom, rgba(247,246,251,0), #f7f6fb); }

/* ── Process editor inside Athena: one toolbar (the editor's own), and a
   sleeping Athena that wakes the iteration prompt, as in Documents ── */
#mapsOverlay .maps-overlay-toolbar { display: none; }
body.maps-open:not(.maps-chat) .input-area { display: none; }
@media (max-width: 768px) { body.maps-open:not(.maps-chat) .maps-overlay { bottom: 0; } }
.maps-owl-fab { position: absolute; right: 22px; bottom: 22px; z-index: 5; width: 168px; height: 168px; padding: 0; border: none; border-radius: 50%; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .25s ease, opacity .25s ease; }
.maps-owl-fab athena-owl { --athena-size: 168px; pointer-events: none; filter: drop-shadow(0 10px 22px rgba(20,16,46,.35)); }
.maps-owl-fab:hover { transform: translateY(-3px); }
.maps-owl-fab:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.maps-owl-fab.waking { animation: mapsOwlWake .42s ease forwards; }
@keyframes mapsOwlWake { 0% { transform: scale(1); } 40% { transform: scale(1.08) translateY(-6px); opacity: 1; } 100% { transform: scale(.7) translateY(10px); opacity: 0; } }
body.maps-chat .maps-owl-fab { display: none; }
.maps-chat-collapse { display: none; position: absolute; right: 18px; bottom: calc(var(--input-area-h, 140px) + 10px); z-index: 6; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(var(--lavender-rgb), .25); background: rgba(var(--s0-rgb), .85); color: var(--athens); cursor: pointer; align-items: center; justify-content: center; backdrop-filter: blur(10px); }
body.maps-chat .maps-chat-collapse { display: inline-flex; }
[data-theme="light"] .maps-chat-collapse { background: rgba(255,255,255,.92); color: #2D2769; border-color: rgba(45,39,105,.18); }
@media (max-width: 768px) { .maps-owl-fab { width: 84px; height: 84px; right: 14px; bottom: 14px; } .maps-owl-fab athena-owl { --athena-size: 84px; } .maps-chat-collapse { bottom: 10px; } }
@media (prefers-reduced-motion: reduce) { .maps-owl-fab, .maps-owl-fab.waking { animation: none; transition: none; } }

/* ── Maps: the prompt that appears over the editor reads as the Documents
   chat pane — a warm floating panel, not the raw full-width composer ── */
body.maps-chat .input-area {
  background: transparent;
  border-top: none;
  padding: 0 18px 18px;
  pointer-events: none;
}
body.maps-chat .input-wrap {
  pointer-events: auto;
  max-width: 620px;
  margin: 0 auto;
  background: var(--s1);
  border: 1px solid rgba(var(--lavender-rgb), 0.14);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  backdrop-filter: blur(18px);
  overflow: hidden;
}
body.maps-chat .input-wrap:focus-within {
  border-color: rgba(var(--gold-rgb), 0.35);
  box-shadow: 0 20px 60px rgba(0,0,0,.45), 0 0 0 3px rgba(var(--gold-rgb), 0.1);
}
body.maps-chat .input-row {
  max-width: 620px;
  margin: 0 auto;
  padding: 14px 16px 8px;
}
body.maps-chat .input-area .input-tools,
body.maps-chat .input-area .tool-row {
  max-width: 620px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}
body.maps-chat .input-area .queue-bar,
body.maps-chat .input-area .input-attachments {
  max-width: 620px;
  margin: 0 auto;
}
[data-theme="light"] body.maps-chat .input-wrap {
  background: rgba(255,255,255,.96);
  border-color: rgba(45,39,105,.12);
  box-shadow: 0 20px 60px rgba(45,30,100,.14);
}
@media (max-width: 768px) {
  body.maps-chat .input-area { padding: 0 10px 10px; }
  body.maps-chat .input-wrap,
  body.maps-chat .input-row { border-radius: 14px; }
}
