/* =============================================
   NAINA PERSONA — DESIGN SYSTEM v2
   Dark premium AI chat application
   ============================================= */

/* ── Tokens ── */
:root {
  --bg:             #0d0d0f;
  --bg-raised:      #141418;
  --bg-overlay:     #1a1a20;
  --bg-input:       #111115;
  --border:         rgba(255,255,255,.07);
  --border-mid:     rgba(255,255,255,.11);
  --border-hi:      rgba(255,255,255,.16);
  --text-primary:   #f0eff4;
  --text-secondary: #8b8a96;
  --text-muted:     #55535e;
  --accent:         #c084fc;
  --accent-dim:     rgba(192,132,252,.14);
  --accent-glow:    rgba(192,132,252,.07);
  --green:          #34d399;
  --green-dim:      rgba(52,211,153,.13);
  --red:            #f87171;
  --red-dim:        rgba(248,113,113,.11);
  --yellow:         #fbbf24;
  --font-sans:      'Manrope', system-ui, sans-serif;
  --font-serif:     'Fraunces', Georgia, serif;
  --font-mono:      'DM Mono', monospace;
  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      16px;
  --sidebar-w:      220px;
  --header-h:       52px;
  --ease:           cubic-bezier(.16,1,.3,1);
  --transition:     .18s var(--ease);
  --chat-max:       680px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  height: 100%;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }
pre { white-space: pre-wrap; word-break: break-all; }

/* ── Non-chat pages need scroll ── */
body[data-page]:not([data-page="chat"]) {
  overflow: auto;
  height: auto;
  min-height: 100%;
}

/* ── App Shell ── */
.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
body[data-page]:not([data-page="chat"]) .app-shell {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: visible;
}

/* ── Sidebar ── */
.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
}
body[data-page]:not([data-page="chat"]) .app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
  border: 1px solid rgba(192,132,252,.2);
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}
.brand-copy strong { display: block; font-size: 13px; font-weight: 700; color: var(--text-primary); }
.brand-copy small  { display: block; font-size: 11px; color: var(--text-muted); }

/* Nav */
.site-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 20px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 0 8px;
  margin-bottom: 4px;
}
.site-nav a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.site-nav a:hover { background: var(--bg-overlay); color: var(--text-primary); }
.site-nav a[data-active] { background: var(--accent-dim); color: var(--accent); }
.nav-group-secondary { margin-top: auto; }

/* Sidebar session card */
.sidebar-card {
  margin: 8px;
  padding: 12px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.sidebar-card .eyebrow {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px;
}
.sidebar-metric {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--border);
}
.sidebar-metric:last-of-type { border-bottom: none; }
.sidebar-metric span   { color: var(--text-muted); }
.sidebar-metric strong { color: var(--text-primary); font-weight: 600; }
.sidebar-card .text-link { display: block; margin-top: 10px; font-size: 12px; color: var(--accent); }
.sidebar-card .text-link:hover { text-decoration: underline; }

/* ── Main shell ── */
.app-main-shell {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-width: 0;
}
body[data-page]:not([data-page="chat"]) .app-main-shell {
  overflow: visible;
}

/* ── Header ── */
.site-header {
  height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  gap: 12px;
  z-index: 5;
}
body[data-page]:not([data-page="chat"]) .site-header {
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-mobile-brand { display: none; }
.brand-mobile { display: flex; align-items: center; gap: 8px; }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-overlay);
  transition: background var(--transition), color var(--transition);
}
.nav-toggle:hover { color: var(--text-primary); }

.header-summary { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.summary-chip {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 4px 10px;
  border-radius: 20px; background: var(--bg-overlay); border: 1px solid var(--border);
}
.summary-chip span   { color: var(--text-muted); }
.summary-chip strong { color: var(--text-primary); font-weight: 600; }

/* ── Footer — hidden on chat, shown on utility pages ── */
.site-footer {
  flex-shrink: 0;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-raised);
}
body[data-page="chat"] .site-footer { display: none; }

/* ── Buttons ── */
.primary-button {
  background: var(--accent); color: #0d0d0f; font-weight: 700;
  font-size: 13px; padding: 8px 16px; border-radius: var(--radius-sm);
  transition: opacity var(--transition), transform var(--transition);
  display: inline-block; text-align: center;
}
.primary-button:hover   { opacity: .88; transform: translateY(-1px); }
.primary-button:active  { transform: translateY(0); opacity: .95; }
.primary-button:disabled { opacity: .35; cursor: not-allowed; transform: none; }

.secondary-button {
  background: var(--bg-overlay); color: var(--text-secondary);
  font-size: 13px; font-weight: 600; padding: 7px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-mid);
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  display: inline-block; text-align: center;
}
.secondary-button:hover { border-color: var(--accent); color: var(--text-primary); background: var(--accent-glow); }

.ghost-button {
  color: var(--text-secondary); font-size: 12px; font-weight: 500;
  padding: 6px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.ghost-button:hover { background: var(--bg-overlay); color: var(--text-primary); border-color: var(--border-mid); }
.ghost-button:active { background: var(--bg-overlay); }

.danger-button { color: var(--red) !important; }
.danger-button:hover { background: var(--red-dim) !important; border-color: var(--red) !important; }

.full-width { width: 100%; }
.text-link { color: var(--accent); font-size: 12px; font-weight: 500; }
.text-link:hover { text-decoration: underline; }

/* ── Status pill ── */
.status-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px; font-size: 12px;
  border: 1px solid var(--border); background: var(--bg-overlay);
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted); flex-shrink: 0;
}
.status-pill.status-ok    .status-dot { background: var(--green); box-shadow: 0 0 5px rgba(52,211,153,.45); }
.status-pill.status-error .status-dot { background: var(--red); }
.status-pill.status-pending .status-dot {
  background: var(--yellow);
  animation: pulseDot 1.4s ease-in-out infinite;
}
@keyframes pulseDot { 0%,100%{opacity:.35} 50%{opacity:1} }
.status-pill strong { color: var(--text-primary); font-size: 12px; font-weight: 600; }

/* ── CHAT PAGE ── */
.conversation-page {
  flex: 1; overflow: hidden;
  display: flex; flex-direction: column; min-height: 0;
}
.chat-layout { flex: 1; display: flex; overflow: hidden; min-height: 0; }
.chat-panel  { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; min-width: 0; }

/* ── Mode bar (slim strip above messages) ── */
.mode-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  overflow-x: auto;
}
.mode-bar::-webkit-scrollbar { display: none; }
.mode-bar-label {
  font-size: 11px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  margin-right: 2px; white-space: nowrap; flex-shrink: 0;
}
.mode-chip {
  padding: 4px 11px; border-radius: 20px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); color: var(--text-muted); background: transparent;
  cursor: pointer; transition: all var(--transition); white-space: nowrap; flex-shrink: 0;
}
.mode-chip:hover { border-color: var(--border-mid); color: var(--text-secondary); }
.mode-chip[data-active] { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.mode-bar-spacer { flex: 1; min-width: 8px; }
.mode-bar .text-link { font-size: 11px; white-space: nowrap; flex-shrink: 0; }

/* ── Banners ── */
.banner {
  flex-shrink: 0;
  margin: 6px 16px;
  padding: 9px 12px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  animation: msgIn .2s var(--ease);
}
.banner[hidden] { display: none !important; }
.error-banner  { background: var(--red-dim); border: 1px solid rgba(248,113,113,.22); }
.error-banner strong { color: var(--red); font-size: 13px; font-weight: 700; }
.error-banner p      { color: var(--text-secondary); font-size: 12px; margin-top: 1px; }
.subtle-banner { background: var(--bg-overlay); border: 1px solid var(--border); }
.subtle-banner strong { font-size: 13px; font-weight: 600; }
.subtle-banner p      { color: var(--text-secondary); font-size: 12px; margin-top: 1px; }

/* ── Message scroll ── */
.message-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  scroll-behavior: smooth; display: flex; flex-direction: column;
}
.message-scroll::-webkit-scrollbar { width: 4px; }
.message-scroll::-webkit-scrollbar-track { background: transparent; }
.message-scroll::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }

/* ── Empty / intro state ── */
.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
}
.empty-card {
  width: 100%;
  max-width: var(--chat-max);
}
.intro-heading { margin-bottom: 8px; }
.intro-heading .eyebrow {
  font-size: 10px; font-weight: 600; color: var(--accent);
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px;
}
.intro-heading h1 {
  font-family: var(--font-serif);
  font-size: 22px; font-weight: 600;
  color: var(--text-primary); line-height: 1.25;
}
.intro-sub {
  color: var(--text-secondary); font-size: 13px;
  margin-bottom: 18px; margin-top: 5px;
}
.intro-chips {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px;
}
.intro-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px; background: var(--bg-overlay);
  border: 1px solid var(--border); border-radius: 20px; font-size: 11px;
}
.intro-chip span   { color: var(--text-muted); }
.intro-chip strong { color: var(--text-primary); font-weight: 600; }

.prompt-grid { display: flex; flex-direction: column; gap: 6px; }
.prompt-button {
  text-align: left; padding: 10px 14px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-overlay); color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}
.prompt-button:hover { border-color: var(--accent); background: var(--accent-glow); color: var(--text-primary); }
.prompt-button:active { opacity: .85; }

/* ── Message list ── */
.message-list {
  display: flex; flex-direction: column;
  padding: 20px 20px; gap: 2px;
  width: 100%; max-width: calc(var(--chat-max) + 40px);
  margin: 0 auto; align-self: center;
}

/* Group spacing: larger gap between turns, tight within same role */
.message { margin-bottom: 14px; }
.message:last-child { margin-bottom: 0; }

.message-wrap {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: msgIn .22s var(--ease);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message-avatar {
  width: 26px; height: 26px;
  border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; margin-top: 2px;
}
.message-user .message-avatar { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(192,132,252,.18); }
.message-ai   .message-avatar { background: var(--bg-overlay); color: var(--text-secondary); border: 1px solid var(--border-mid); }

.message-body    { flex: 1; min-width: 0; position: relative; }
.message-meta    { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.message-name    { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.message-time    { font-size: 11px; color: var(--text-muted); }
.message-text    { font-size: 14px; line-height: 1.7; color: var(--text-primary); }
.message-runtime { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.runtime-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.runtime-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 999px;
  background: var(--bg-overlay); border: 1px solid var(--border);
  font-size: 10px; line-height: 1.2;
}
.runtime-chip span { color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.runtime-chip strong { color: var(--text-primary); font-weight: 600; }
.runtime-chip-warn { border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.08); }
.runtime-hint { margin-top: 8px; font-size: 12px; color: var(--text-secondary); }
.runtime-details { margin-top: 8px; }
.runtime-details summary {
  color: var(--accent); font-size: 11px; font-weight: 600;
  cursor: pointer; list-style: none;
}
.runtime-details summary::-webkit-details-marker { display: none; }
.runtime-detail-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.runtime-detail-list > div { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; }
.runtime-detail-list dt { color: var(--text-muted); }
.runtime-detail-list dd { color: var(--text-primary); text-align: right; word-break: break-word; }

/* Bubble styling */
.message-ai .message-content {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px var(--radius-lg) var(--radius-lg) var(--radius-lg);
  padding: 11px 14px;
}
.message-user .message-content {
  background: var(--accent-dim);
  border: 1px solid rgba(192,132,252,.15);
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
  padding: 10px 14px;
}
.message-user .message-name { color: rgba(192,132,252,.8); }

/* Copy action */
.message-copy-btn {
  position: absolute;
  top: 6px; right: 8px;
  opacity: 0;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: opacity var(--transition), color var(--transition);
  pointer-events: none;
}
.message-wrap:hover .message-copy-btn { opacity: 1; pointer-events: all; }
.message-copy-btn:hover { color: var(--text-primary); }
.message-copy-btn.copied { color: var(--green); border-color: rgba(52,211,153,.3); }

.message-ai .message-text code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--bg-overlay); padding: 1px 5px;
  border-radius: 4px; border: 1px solid var(--border);
}

/* ── Typing indicator ── */
.typing-indicator { display: flex; gap: 4px; align-items: center; padding: 3px 0; }
.typing-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted);
  animation: typingPulse 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typingPulse {
  0%,60%,100% { opacity:.25; transform:scale(.82); }
  30%         { opacity:1;   transform:scale(1); }
}

/* ── Composer ── */
.composer {
  flex-shrink: 0;
  padding: 10px 16px 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.composer-inner-wrap {
  max-width: var(--chat-max);
  margin: 0 auto;
}
.composer-inner {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg-input); border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  padding: 10px 10px 10px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.composer-inner:focus-within {
  border-color: rgba(192,132,252,.32);
  box-shadow: 0 0 0 2px rgba(192,132,252,.06);
}
.composer-inner textarea {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-primary); font-family: var(--font-sans);
  font-size: 14px; line-height: 1.55; resize: none;
  max-height: 160px; overflow-y: auto; padding: 0;
}
.composer-inner textarea::placeholder { color: var(--text-muted); }
.composer-inner textarea::-webkit-scrollbar { width: 3px; }
.composer-inner textarea::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.composer-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.composer-actions .ghost-button {
  font-size: 11px; padding: 5px 9px;
  border-radius: var(--radius-sm); font-weight: 600;
}
.composer-actions .mode-active-btn {
  border-color: var(--accent); color: var(--accent); background: var(--accent-dim);
}

.send-button {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: #0d0d0f;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
}
.send-button:hover   { opacity: .9; transform: scale(1.04); box-shadow: 0 2px 12px rgba(192,132,252,.28); }
.send-button:active  { transform: scale(.97); }
.send-button:disabled { opacity: .25; cursor: not-allowed; transform: none; box-shadow: none; }
.send-button svg { width: 14px; height: 14px; }

/* Composer hint bar */
.composer-hint {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 5px; padding: 0 2px;
  font-size: 11px; color: var(--text-muted);
  max-width: var(--chat-max); margin-left: auto; margin-right: auto;
  min-height: 14px;
}
.char-counter { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.char-counter.warn { color: var(--yellow); }
.char-counter.over { color: var(--red); }
.hint-shortcut { opacity: .55; }

/* ── Drawer ── */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 50; opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease);
}
.drawer-overlay[data-open] { opacity: 1; pointer-events: all; }

.drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 320px; max-width: 92vw;
  background: var(--bg-raised); border-left: 1px solid var(--border);
  z-index: 51; display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s var(--ease);
  box-shadow: -12px 0 40px rgba(0,0,0,.4);
}
.drawer[data-open] { transform: translateX(0); }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.drawer-header h3 { font-size: 14px; font-weight: 700; }
.drawer-close {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-overlay);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.drawer-close:hover { background: var(--bg-overlay); color: var(--text-primary); border-color: var(--border-mid); }
.drawer-body {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.drawer-body::-webkit-scrollbar { width: 3px; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--border); }

/* Mode card in drawer */
.drawer-mode-card {
  padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.drawer-mode-card:hover { border-color: var(--border-mid); background: var(--bg-overlay); }
.drawer-mode-card[data-active] { border-color: var(--accent); background: var(--accent-dim); }
.drawer-mode-card strong { display: block; font-size: 13px; color: var(--text-primary); margin-bottom: 2px; font-weight: 600; }
.drawer-mode-card[data-active] strong { color: var(--accent); }
.drawer-mode-card span { font-size: 12px; color: var(--text-secondary); }

/* ── Detail list ── */
.detail-list { display: flex; flex-direction: column; }
.detail-list > div {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.detail-list > div:last-child { border-bottom: none; }
.detail-list dt { color: var(--text-muted); flex-shrink: 0; }
.detail-list dd { color: var(--text-primary); font-weight: 600; text-align: right; word-break: break-all; }

.detail-block strong {
  display: block; font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px;
}
.detail-block pre {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary);
  background: var(--bg-overlay); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px;
}

/* Action rows */
.action-row   { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.action-stack { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

/* Toggle switch */
.preference-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.preference-row:last-child { border-bottom: none; }
.preference-row > div strong { display: block; font-size: 13px; font-weight: 600; }
.preference-row > div .small-copy { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
.switch { display: inline-flex; align-items: center; cursor: pointer; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  display: block; width: 38px; height: 22px; border-radius: 11px;
  background: var(--border-mid); position: relative;
  transition: background var(--transition);
}
.switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted);
  transition: transform var(--transition), background var(--transition);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); background: #0d0d0f; }

/* ── UTILITY PAGES ── */
.page.standard-page, .page.legal-page {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

/* Compact page header — NOT a hero */
.utility-hero {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.utility-hero .eyebrow {
  font-size: 10px; font-weight: 600; color: var(--accent);
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: 4px;
}
.utility-hero h1 {
  font-family: var(--font-serif); font-size: 20px; font-weight: 600;
  color: var(--text-primary); margin-bottom: 5px; line-height: 1.2;
}
.utility-hero .hero-copy { color: var(--text-secondary); font-size: 13px; max-width: 480px; }

/* Content grid */
.content-grid.two-up { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

.content-card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
}
.content-card .eyebrow { font-size: 10px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 5px; }
.content-card h2 { font-family: var(--font-serif); font-size: 16px; font-weight: 600; margin-bottom: 10px; line-height: 1.3; }
.content-card p  { color: var(--text-secondary); font-size: 13px; line-height: 1.6; }

.plain-list { display: flex; flex-direction: column; gap: 6px; }
.plain-list li { font-size: 13px; color: var(--text-secondary); padding-left: 14px; position: relative; line-height: 1.5; }
.plain-list li::before { content: '–'; position: absolute; left: 0; color: var(--text-muted); }

.faq-block { margin-bottom: 12px; }
.faq-block:last-child { margin-bottom: 0; }
.faq-block strong { display: block; font-size: 13px; color: var(--text-primary); font-weight: 600; margin-bottom: 3px; }
.faq-block p { font-size: 13px; color: var(--text-secondary); }

.small-copy { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.mono-line  { font-family: var(--font-mono); font-size: 11px; word-break: break-all; color: var(--text-secondary); }
.badge-row  { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.soft-badge { padding: 3px 9px; border-radius: 20px; background: var(--accent-dim); color: var(--accent); font-size: 11px; font-weight: 600; }

/* Legal */
.legal-card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 26px;
}
.legal-card h2 { font-size: 14px; font-weight: 700; color: var(--text-primary); margin: 18px 0 5px; }
.legal-card h2:first-child { margin-top: 0; }
.legal-card p  { font-size: 13px; color: var(--text-secondary); line-height: 1.7; }

/* Modes page */
.mode-page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.mode-full-card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  cursor: pointer; transition: border-color var(--transition), background var(--transition);
}
.mode-full-card:hover { border-color: var(--border-hi); background: var(--bg-overlay); }
.mode-full-card[data-active] { border-color: var(--accent); background: var(--accent-dim); }
.mode-full-card .eyebrow { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 5px; }
.mode-full-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 5px; }
.mode-full-card p  { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.mode-full-card[data-active] h3     { color: var(--accent); }
.mode-full-card[data-active] .eyebrow { color: var(--accent); }

/* Pricing */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.pricing-card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.pricing-card.featured { border-color: var(--accent); background: var(--accent-dim); }
.pricing-card .eyebrow { font-size: 10px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .1em; }
.pricing-card h2 { font-family: var(--font-serif); font-size: 26px; font-weight: 600; line-height: 1; }
.pricing-card h2 span { font-size: 14px; color: var(--text-muted); font-family: var(--font-sans); }
.pricing-card > p { font-size: 13px; color: var(--text-secondary); }
.pricing-card .plain-list { flex: 1; }
.pricing-card .secondary-button, .pricing-card .primary-button { margin-top: auto; }

/* ── Shared ── */
.eyebrow { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.section-headline { display: flex; align-items: center; justify-content: space-between; }
.section-headline strong { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .app-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .25s var(--ease);
    z-index: 40; width: 240px;
  }
  body[data-page]:not([data-page="chat"]) .app-sidebar { position: fixed; }
  .app-sidebar[data-open] { transform: translateX(0); }

  .header-mobile-brand { display: flex; align-items: center; }
  .brand-sidebar { display: none; }
  .nav-toggle { display: flex; }

  .content-grid.two-up { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  .mode-page-grid { grid-template-columns: 1fr 1fr; }
  .page.standard-page, .page.legal-page { padding: 20px 16px 40px; }
  .intro-chips { display: none; }
  .message-list { padding: 16px 12px; }
}

@media (max-width: 480px) {
  :root { --sidebar-w: 200px; }
  .mode-page-grid { grid-template-columns: 1fr; }
  .intro-heading h1 { font-size: 20px; }
}
