/* ============================================================================
 * MyKonos design system v1 — Night theme (default)
 * Locked from MYKONOS_DESIGN_v1.md (2026-05-01).
 * Mobile-first 375px. Component CSS lands in Chunks B + C.
 * ========================================================================== */

/* === @font-face — self-hosted, latin subset, font-display: swap ============ */

@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/cinzel-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/cinzel-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/cinzel-700.woff2') format('woff2');
}

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-500-italic.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/static/fonts/inter-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/inter-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/inter-500.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/jetbrains-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/jetbrains-mono-500.woff2') format('woff2');
}

/* === Design tokens ======================================================= */

:root {
  /* Palette (locked) */
  --bg-deep: #0F1012;
  --bg-elevated: #1A1B1E;
  --bg-card: #23252A;
  --accent: #4FD1C5;
  --accent-bright: #7AE5DB;
  --accent-muted: #3BA89E;
  --glow: #4FD1C5;
  --secondary: #7B5FBA;
  --bone: #EBE5D6;
  --ash: #9098A3;
  --energy: #D4467E;
  --structure: #B0B5BD;

  /* Typography stacks */
  --font-display: 'Cinzel', Georgia, serif;
  --font-editorial: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  /* Type scale (px to keep wordmark spec exact) */
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-14: 14px;
  --fs-15: 15px;
  --fs-17: 17px;
  --fs-20: 20px;
  --fs-24: 24px;
  --fs-32: 32px;
  --fs-48: 48px;
  --fs-72: 72px;

  /* Spacing scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 80px;
  --space-10: 96px;
  --space-11: 112px;
  --space-12: 128px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  /* Borders */
  --border-soft: 1px solid rgba(176, 181, 189, 0.20);
  --border-strong: 1px solid rgba(176, 181, 189, 0.40);

  /* Glow primitive (memory-active) */
  --shadow-memory: -2px 0 12px rgba(79, 209, 197, 0.3);

  /* Motion */
  --easing-standard: cubic-bezier(0.16, 1, 0.3, 1);
  --easing-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --easing-pulse: ease-in-out;
  --duration-fast: 150ms;
  --duration-base: 300ms;
  --duration-slow: 600ms;

  /* Touch target floor */
  --touch-min: 44px;
}

/* === Base reset ========================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-15);
  line-height: 1.5;
  background: var(--bg-deep);
  color: var(--bone);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: env(safe-area-inset-bottom);
}

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; padding: 0; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
::selection { background: var(--accent); color: var(--bg-deep); }

/* === Locked animations (per spec) ======================================== */

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 209, 197, 0.6); }
  50%      { box-shadow: 0 0 0 8px rgba(79, 209, 197, 0); }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
  50% { opacity: 0; }
}
@keyframes shimmer {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.7; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* === Components — Chunk B-1 ============================================== */

/* Wordmark — stacked MY/KONOS, classical, Cinzel face. */
.wordmark {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  font-family: var(--font-display);
  text-transform: uppercase;
  max-width: 100%;
}
.wordmark-my {
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.4em;
  margin-right: -0.4em;
  transform: translateX(0.15em);
}
.wordmark-konos {
  font-weight: 700;
  color: var(--bone);
  letter-spacing: 0.18em;
  margin-right: -0.18em;
}

/* AntennaBolt — single-color glyph, accent default, optional glow. */
.antenna-bolt {
  color: var(--accent);
}
.antenna-bolt-glow {
  filter: drop-shadow(0 0 4px var(--glow));
}

/* Button — 4 variants. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background var(--duration-fast) var(--easing-standard),
              color var(--duration-fast) var(--easing-standard),
              border-color var(--duration-fast) var(--easing-standard);
  min-height: var(--touch-min);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* Primary — bone bg, dark text. OAuth providers, decisive moments. */
.btn-primary {
  background: var(--bone);
  color: var(--bg-deep);
  border: 1px solid var(--bone);
}
.btn-primary:hover:not(:disabled) {
  background: #fff;
}
/* Accent — cyan bg, dark text. In-app primary actions. */
.btn-accent {
  background: var(--accent);
  color: var(--bg-deep);
  border: 1px solid var(--accent);
}
.btn-accent:hover:not(:disabled) {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
}
/* Ghost — transparent, bone border. Secondary actions. */
.btn-ghost {
  background: transparent;
  color: var(--bone);
  border: 1px solid rgba(176, 181, 189, 0.4);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--bone);
}
/* Tertiary — transparent, accent text. Inline links. */
.btn-tertiary {
  background: transparent;
  color: var(--accent);
  border: none;
  padding: var(--space-2) var(--space-3);
  min-height: auto;
}
.btn-tertiary:hover:not(:disabled) {
  color: var(--accent-bright);
}

/* Input — single line, dark surface, accent focus ring. */
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  color: var(--bone);
  border: 1px solid rgba(176, 181, 189, 0.2);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  min-height: var(--touch-min);
  transition: border-color var(--duration-fast) var(--easing-standard);
}
.input::placeholder {
  color: var(--ash);
}
.input:focus {
  border-color: var(--accent);
  outline: none;
}

/* Card — elevated surface with structured padding. */
.card {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
}

/* === Components — Chunk B-2 ============================================== */

/* MemoryDot — the moat-visible cyan pulse + optional uppercase label. */
.memory-dot-wrap {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.memory-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--glow);
  display: inline-block;
}
.memory-dot.pulse-glow {
  animation: pulse-glow 2s var(--easing-pulse) infinite;
}
.memory-dot-label {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--glow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

/* MessageBubble — chat message, role-asymmetric corners, memory-active glow. */
.msg {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 85%;
  animation: fade-up var(--duration-slow) var(--easing-standard) forwards;
  opacity: 0;
}
.msg-user {
  align-self: flex-end;
  max-width: 78%;
}
.msg-assistant {
  align-self: flex-start;
  max-width: 88%;
}
.msg-bubble {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
}
.msg-user .msg-bubble {
  border-radius: var(--radius-md) var(--radius-md) 2px var(--radius-md);
}
.msg-assistant .msg-bubble {
  border-radius: 2px var(--radius-md) var(--radius-md) var(--radius-md);
}
.msg-memory-active .msg-bubble {
  border-left: 2px solid var(--glow);
  box-shadow: var(--shadow-memory);
}
.msg-caption {
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: 13px;
  color: var(--ash);
  padding: 0 var(--space-4);
}

/* StatusBadge — small dot + uppercase label, replaces decorative icons. */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-verified { color: var(--glow); }
.status-verified .status-dot { background: var(--glow); }
.status-not-connected { color: var(--ash); }
.status-not-connected .status-dot { background: var(--ash); }
.status-invalid,
.status-warning { color: var(--energy); }
.status-invalid .status-dot,
.status-warning .status-dot { background: var(--energy); }
.status-expired { color: var(--ash); }
.status-expired .status-dot { background: var(--ash); }

/* SectionHeader — Cinzel uppercase, accent-colored chapter heading. */
.section-header {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}

/* Toast — fixed bottom-center, three variants, fades up. */
.toast {
  position: fixed;
  bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  z-index: 100;
  animation: fade-up var(--duration-slow) var(--easing-standard);
  max-width: calc(100% - var(--space-8));
}
.toast-success { background: var(--bg-elevated); color: var(--accent); border: 1px solid var(--accent); }
.toast-error { background: var(--bg-elevated); color: var(--energy); border: 1px solid var(--energy); }
.toast-info { background: var(--bg-elevated); color: var(--bone); border: 1px solid var(--structure); }

/* === Pages — Chunk B-3 =================================================== */

/* Sign-in — wordmark hero, two soft radial bg glows, provider buttons. */
.signin-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  position: relative;
  overflow: hidden;
}
.signin-bg-glow {
  display: none;
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(60px);
}
.signin-content {
  position: relative;
  text-align: center;
  max-width: 360px;
  width: 100%;
}
.signin-tagline {
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: 17px;
  color: var(--bone);
  margin-top: var(--space-8);
  margin-bottom: var(--space-2);
  letter-spacing: 0.02em;
}
.signin-subtagline {
  font-size: 13px;
  color: var(--ash);
  margin-bottom: var(--space-12);
}
.signin-providers {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.signin-provider-link {
  width: 100%;
  text-decoration: none;
}
.signin-footer {
  font-size: 11px;
  color: var(--ash);
  margin-top: var(--space-8);
  letter-spacing: 0.05em;
}

/* === Pages — Chunk B-4 (settings) ======================================== */

.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--bg-elevated);
}
.topbar-back {
  color: var(--ash);
  font-size: 14px;
  text-decoration: none;
  min-width: var(--touch-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topbar-title {
  font-family: var(--font-display);
  color: var(--bone);
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 500;
  flex: 1;
}
.topbar-trigger {
  cursor: pointer;
  user-select: none;
}

.settings-page {
  padding: var(--space-6) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  max-width: 600px;
  margin: 0 auto;
}
.settings-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}
.key-row-empty { opacity: 0.55; }
.key-row-name { color: var(--bone); font-size: 13px; font-weight: 500; }
.key-row-suffix {
  color: var(--ash);
  font-size: 12px;
  font-family: var(--font-mono);
  margin-top: 2px;
}

.builder-list { display: flex; flex-direction: column; gap: var(--space-2); }
.builder-option {
  background: var(--bg-elevated);
  border: 1px solid transparent;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--bone);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--duration-fast) var(--easing-standard),
              border-color var(--duration-fast) var(--easing-standard);
  min-height: var(--touch-min);
  text-align: left;
}
.builder-option:hover { background: var(--bg-card); }
.builder-option-active {
  background: var(--bg-card);
  border-color: var(--accent);
  color: var(--accent-bright);
}
.builder-check { color: var(--accent); font-size: 14px; }

.theme-toggle {
  display: flex;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}
.theme-option {
  flex: 1;
  padding: var(--space-3);
  background: transparent;
  color: var(--ash);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-transform: capitalize;
}
.theme-option-active {
  background: var(--bg-card);
  color: var(--accent-bright);
}
.theme-option:disabled { opacity: 0.4; cursor: not-allowed; }

.dev-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}
.switch {
  width: 40px;
  height: 24px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid rgba(176, 181, 189, 0.2);
  position: relative;
  cursor: pointer;
  padding: 0;
  min-height: auto;
}
.switch-knob {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ash);
  position: absolute;
  left: 2px;
  top: 2px;
  transition: left var(--duration-fast) var(--easing-standard),
              background var(--duration-fast) var(--easing-standard);
}
.switch-on { background: var(--accent); border-color: var(--accent); }
.switch-on .switch-knob { left: 18px; background: var(--bg-deep); }

.settings-microcopy {
  color: var(--ash);
  font-size: 11px;
  font-style: italic;
  text-align: center;
  font-family: var(--font-editorial);
  margin-top: var(--space-4);
}
.settings-danger { margin-top: var(--space-8); }

/* === Pages — Chunk C-1 (chat) ============================================ */

.chat-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 600px;
  margin: 0 auto;
}
.topbar-chat {
  justify-content: space-between;
  flex-shrink: 0;
}
.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-muted), var(--accent));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--bg-deep);
  text-decoration: none;
}

.chat-thread {
  flex: 1;
  padding: var(--space-6) var(--space-5);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-empty-prompt {
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: 22px;
  color: var(--ash);
}

.chat-input-bar {
  flex-shrink: 0;
  padding: var(--space-4) var(--space-5);
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--bg-elevated);
  background: var(--bg-deep);
}
.chat-input-form {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 4px 4px 4px var(--space-5);
  border: 1px solid rgba(176, 181, 189, 0.2);
}
.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 14px;
  padding: var(--space-2) 0;
  min-height: var(--touch-min);
}
.chat-input::placeholder { color: var(--ash); }
.chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-deep);
  cursor: pointer;
  min-height: auto;
  flex-shrink: 0;
}
.chat-send:hover { background: var(--accent-bright); }

.chat-indicator {
  display: none;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: 13px;
  color: var(--ash);
}
.htmx-request .chat-indicator,
.htmx-request.chat-indicator { display: inline-flex; }

.msg-memory-indicator { align-self: flex-start; }
.chat-error {
  align-self: center;
  padding: var(--space-3) var(--space-4);
  background: rgba(212, 70, 126, 0.1);
  border: 1px solid var(--energy);
  border-radius: var(--radius-sm);
  color: var(--energy);
  font-size: 13px;
}

/* === Pages — Chunk C-2 (add-key subpage) ================================= */

.addkey-page {
  padding: var(--space-6) var(--space-5);
  max-width: 480px;
  margin: 0 auto;
}
.addkey-blurb {
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: 15px;
  color: var(--ash);
  margin-bottom: var(--space-6);
}
.addkey-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.addkey-result {
  min-height: var(--space-5);
}
.addkey-help {
  margin-top: var(--space-6);
  font-size: 12px;
  color: var(--ash);
}
.addkey-help a {
  color: var(--ash);
  text-decoration: underline;
  text-decoration-color: rgba(176, 181, 189, 0.4);
}
.addkey-help a:hover { color: var(--accent); }

/* === More page styles in Chunk C-3 ====================================== */

/* === Icon color helpers — Chunk 2D ====================================== */
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.icon-cyan { color: var(--accent); }
.icon-bone { color: var(--bone); }
.icon-ash  { color: var(--ash); opacity: 0.85; }
.icon-energy { color: var(--energy); }

/* === AntennaBolt color (was hard-coded; use currentColor now) =========== */
.antenna-bolt { color: var(--accent); }
.antenna-bolt-glow { filter: drop-shadow(0 0 4px rgba(79, 209, 197, 0.6)); }

/* === Topbar back button uses Icon now ================================== */
.topbar-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--accent);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}
.topbar-back:hover { background: rgba(79, 209, 197, 0.08); }

/* === Topbar brand wraps AntennaBolt + Wordmark ========================= */
.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

/* === Settings key rows now have leading icon =========================== */
.key-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid rgba(176, 181, 189, 0.08);
}
.key-row:last-child { border-bottom: none; }
.key-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  flex-shrink: 0;
}
.key-row-body { flex: 1; min-width: 0; }
.key-row-name { color: var(--bone); font-size: 14px; }
.key-row-suffix {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ash);
  margin-top: 2px;
  letter-spacing: 0.05em;
}

/* === Builder option icons ============================================== */
.builder-option {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid rgba(176, 181, 189, 0.1);
  border-radius: var(--radius-md);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}
.builder-option:hover { border-color: rgba(79, 209, 197, 0.3); }
.builder-option-active {
  border-color: var(--accent);
  background: rgba(79, 209, 197, 0.05);
}
.builder-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  flex-shrink: 0;
}
.builder-option-label { flex: 1; }
.builder-check { color: var(--accent); font-size: 16px; }

/* === Theme toggle icons ================================================ */
.theme-option {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.theme-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* === Dev mode toggle ================================================== */
.dev-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
}
.dev-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--bone);
  font-size: 14px;
}

/* === Generic settings row (Sign out, etc.) ============================ */
.settings-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  text-decoration: none;
  color: var(--bone);
  border-bottom: 1px solid rgba(176, 181, 189, 0.08);
  transition: background 0.15s ease;
}
.settings-row:hover { background: rgba(79, 209, 197, 0.04); }
.settings-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  flex-shrink: 0;
}
.settings-row-label { flex: 1; font-size: 14px; }

/* === AddKey hero icon ================================================= */
.addkey-hero {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-6);
  margin-top: var(--space-4);
}

/* === Chat attach button =============================================== */
.chat-attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
}
.chat-attach[disabled] { opacity: 0.4; cursor: not-allowed; }

/* === Chat send button (replaces inline SVG) =========================== */
.chat-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: var(--bg-deep);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.chat-send:hover { background: var(--accent-bright); }
.chat-send .icon { color: currentColor; }

/* === Streaming chat — Chunk 2D-stream =================================== */
.msg-cursor {
  display: inline-block;
  margin-left: 2px;
  color: var(--accent);
  animation: cursor-blink 1s step-end infinite;
  font-weight: 400;
}
@keyframes cursor-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
.msg-streaming { /* hook for future flair if needed */ }

/* HTMX indicator no longer needed — streaming cursor replaces it */

/* === Chat header actions cluster ====================================== */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.topbar-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--accent);
  transition: background 0.15s ease;
}
.topbar-action:hover { background: rgba(79, 209, 197, 0.08); }
button.topbar-action {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

/* === Conversation drawer ============================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.drawer-backdrop.drawer-open {
  opacity: 1;
  pointer-events: auto;
}
.drawer {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  height: 100dvh;
  width: min(85vw, 380px);
  background: var(--bg-elevated);
  border-right: 1px solid rgba(176, 181, 189, 0.3);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.25s var(--easing-standard);
  display: flex;
  flex-direction: column;
}
.drawer.drawer-open { transform: translateX(0); }
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid rgba(176, 181, 189, 0.15);
  flex-shrink: 0;
  min-height: 56px;
}
.drawer-header .section-header { margin-bottom: 0; }
.drawer-close {
  background: transparent;
  border: 0;
  padding: var(--space-2);
  cursor: pointer;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transform: rotate(0deg);
  transition: background 0.15s ease;
}
.drawer-close:hover { background: rgba(79, 209, 197, 0.08); }
.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) 0;
}
.drawer-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  color: var(--bone);
  border-bottom: 1px solid rgba(176, 181, 189, 0.1);
  transition: background 0.15s;
}
.drawer-row:hover { background: rgba(79, 209, 197, 0.06); }
.drawer-row-active { background: rgba(79, 209, 197, 0.05); }
.drawer-row-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  text-decoration: none;
  color: var(--bone);
  min-width: 0;
}
.drawer-row-title {
  color: var(--bone);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-row-untitled {
  font-family: var(--font-editorial);
  font-style: italic;
  color: var(--ash);
}
.drawer-row-date {
  color: var(--ash);
  font-size: 11px;
}
.drawer-row-delete {
  background: transparent;
  border: 0;
  padding: var(--space-2);
  color: var(--ash);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease;
}
.drawer-row-delete:hover { background: rgba(176, 181, 189, 0.08); }
.drawer-row-confirming {
  background: rgba(212, 70, 126, 0.1);
}
.drawer-row-confirming .drawer-row-delete {
  color: var(--energy);
}
.drawer-row-error {
  width: 100%;
  margin-top: var(--space-2);
  font-family: var(--font-editorial);
  font-style: italic;
  color: var(--energy);
  font-size: 12px;
}
.drawer-empty {
  padding: var(--space-5);
  font-family: var(--font-editorial);
  font-style: italic;
  color: var(--ash);
  text-align: center;
}

/* === Memory view (Settings) =========================================== */
.memory-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.memory-count {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ash);
  margin-bottom: var(--space-2);
}
.memory-row {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.memory-row-subject {
  color: var(--bone);
  font-size: 14px;
  font-weight: 500;
}
.memory-row-claim {
  color: var(--bone);
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.memory-row-date {
  color: var(--ash);
  font-size: 11px;
}
.memory-truncated {
  color: var(--ash);
  font-size: 11px;
  font-style: italic;
  font-family: var(--font-editorial);
  padding: var(--space-2);
  text-align: center;
}
.memory-loading {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  color: var(--ash);
  font-size: 13px;
  padding: var(--space-3) 0;
}
.memory-dot-pulse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: memory-pulse 1.6s ease-in-out infinite;
}
@keyframes memory-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.memory-empty,
.memory-error {
  padding: var(--space-5);
  font-family: var(--font-editorial);
  font-style: italic;
  color: var(--ash);
  text-align: center;
}
