@import "tailwindcss";

/* ─────────────────────────────────────────────────────────────────────
   MissionMate — themeable design system
   Source tokens live on :root (base = Aurora, the default theme). Each
   :root[data-theme="…"] block below overrides ONLY the source tokens;
   every alias derives via var() and the whole UI recolours.
   Typography, paper-grain backdrop, and component primitives follow.
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* Source tokens — Aurora palette (default; matches Luke's email brand) */
  --bg-deep:    #0a0613;
  --bg-mid:     #140b24;
  --bg-card:    #170e30;
  --bg-elev:    #1f1440;

  --cream:      #f4eeff;
  --cream-soft: #d9cff0;
  --cream-dim:  #c9bee8;
  --cream-mute: #8a7db0;

  --gold:       #f5b829;
  --gold-soft:  #ffd36b;
  --gold-deep:  #c99418;

  --emerald:    #45d19a;
  --emerald-dim:#2c9d72;
  --plum:       #f0398b;
  --rust:       #a855f7;

  --line:       rgba(245, 184, 41, 0.16);
  --line-soft:  rgba(244, 238, 255, 0.06);
  --line-deep:  rgba(244, 238, 255, 0.03);

  --shadow-1: 0 1px 0 color-mix(in srgb, var(--cream) 3%, transparent), 0 8px 24px rgba(0,0,0,0.5);
  --shadow-2: 0 2px 0 color-mix(in srgb, var(--cream) 4%, transparent), 0 20px 60px rgba(0,0,0,0.55);

  /* Backwards-compat aliases — existing components reference these. We remap
     them onto the source tokens so nothing visibly breaks while we refresh. */
  --bg: var(--bg-deep);
  --bg-2: var(--bg-mid);
  --panel: color-mix(in srgb, var(--bg-card) 65%, transparent);
  --panel-border: var(--line-soft);
  --panel-border-hot: var(--line);
  --fg: var(--cream);
  --fg-dim: var(--cream-soft);
  --fg-dimmer: var(--cream-dim);

  --accent-cyan: var(--emerald);
  --accent-violet: var(--gold);
  --accent-pink: var(--plum);
  --accent-lime: var(--emerald);
  --accent-amber: var(--gold);
  --accent-red: var(--plum);

  --claude: var(--rust);
  --openclaw: var(--plum);
  --hermes: var(--gold-soft);

  --grid: rgba(245, 184, 41, 0.04);
  --glow: 0 0 40px 0;
}

/* ─────────────────────────────────────────────────────────────────────
   Themes — each block overrides ONLY the source tokens above.
   Applied via document.documentElement.dataset.theme (see ThemeSwitcher +
   the pre-paint script in layout.tsx). No data-theme = Aurora.
   ───────────────────────────────────────────────────────────────────── */

:root[data-theme="aurora"] {
  --bg-deep:    #0a0613;
  --bg-mid:     #140b24;
  --bg-card:    #170e30;
  --bg-elev:    #1f1440;
  --cream:      #f4eeff;
  --cream-soft: #d9cff0;
  --cream-dim:  #c9bee8;
  --cream-mute: #8a7db0;
  --gold:       #f5b829;
  --gold-soft:  #ffd36b;
  --gold-deep:  #c99418;
  --emerald:    #45d19a;
  --emerald-dim:#2c9d72;
  --plum:       #f0398b;
  --rust:       #a855f7;
  --line:       rgba(245, 184, 41, 0.16);
  --line-soft:  rgba(244, 238, 255, 0.06);
  --line-deep:  rgba(244, 238, 255, 0.03);
  --grid:       rgba(245, 184, 41, 0.04);
}

:root[data-theme="neon"] {
  --bg-deep:    #0a0a0f;
  --bg-mid:     #111119;
  --bg-card:    #16161f;
  --bg-elev:    #1d1d29;
  --cream:      #f4f5fb;
  --cream-soft: #cfd1e0;
  --cream-dim:  #aeb0c2;
  --cream-mute: #6b6d82;
  --gold:       #22d3ee;
  --gold-soft:  #67e8f9;
  --gold-deep:  #0e9fbb;
  --emerald:    #a3e635;
  --emerald-dim:#6fae1f;
  --plum:       #f43f8e;
  --rust:       #a78bfa;
  --line:       rgba(255, 255, 255, 0.08);
  --line-soft:  rgba(255, 255, 255, 0.04);
  --line-deep:  rgba(255, 255, 255, 0.025);
  --grid:       rgba(34, 211, 238, 0.05);
}

:root[data-theme="obsidian"] {
  --bg-deep:    #0b0b0d;
  --bg-mid:     #121214;
  --bg-card:    #17171a;
  --bg-elev:    #1f1f23;
  --cream:      #f3ebda;
  --cream-soft: #d8cdb3;
  --cream-dim:  #c3b79c;
  --cream-mute: #7d7461;
  --gold:       #d4af37;
  --gold-soft:  #e8cd7a;
  --gold-deep:  #a8842a;
  --emerald:    #8fb08a;
  --emerald-dim:#5f7d5a;
  --plum:       #c97c5e;
  --rust:       #b0663f;
  --line:       rgba(212, 175, 55, 0.16);
  --line-soft:  rgba(243, 235, 218, 0.05);
  --line-deep:  rgba(243, 235, 218, 0.03);
  --grid:       rgba(212, 175, 55, 0.035);
}

:root[data-theme="ion"] {
  --bg-deep:    #080d1a;
  --bg-mid:     #0c1426;
  --bg-card:    #101a30;
  --bg-elev:    #16233f;
  --cream:      #eef4ff;
  --cream-soft: #c4d3ef;
  --cream-dim:  #a9bce0;
  --cream-mute: #6577a0;
  --gold:       #3b82f6;
  --gold-soft:  #60a5fa;
  --gold-deep:  #2563eb;
  --emerald:    #34d399;
  --emerald-dim:#10b981;
  --plum:       #22d3ee;
  --rust:       #38bdf8;
  --line:       rgba(59, 130, 246, 0.18);
  --line-soft:  rgba(255, 255, 255, 0.05);
  --line-deep:  rgba(255, 255, 255, 0.03);
  --grid:       rgba(59, 130, 246, 0.05);
}

@theme inline {
  --color-background: var(--bg-deep);
  --color-foreground: var(--cream);
  --font-sans: 'Manrope', var(--font-geist-sans);
  --font-mono: 'JetBrains Mono', var(--font-geist-mono);
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg-deep);
  color: var(--cream);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

body {
  background: var(--bg-deep);
  min-height: 100vh;
  position: relative;
}

/* Paper-grain overlay — fixed, low-opacity, blended for a printed-page feel.
   Neutral noise (data URIs can't read CSS vars) so it sits cleanly on every theme. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.92  0 0 0 0 0.92  0 0 0 0 0.92  0 0 0 0.035 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.55;
  mix-blend-mode: overlay;
}

/* Ambient gradients sitting beneath everything — driven by the theme's
   accent tokens so each theme keeps its own tasteful glow */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 65% 45% at 12% 6%, color-mix(in srgb, var(--gold) 9%, transparent), transparent 60%),
    radial-gradient(ellipse 55% 40% at 88% 22%, color-mix(in srgb, var(--rust) 7%, transparent), transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 95%, color-mix(in srgb, var(--plum) 6%, transparent), transparent 60%);
}

/* Lift real chrome above the overlays */
main, header, aside, nav, .surface { position: relative; z-index: 2; }

/* ─────────────────────────────────────────────────────────────────────
   Typography primitives
   ───────────────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--cream);
}

code, pre, kbd, samp, .mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* Hand-script accent for numerals, roman numerals, emphasis */
.hand,
.hand-num,
em.hand,
[data-hand="true"] {
  font-family: 'Caveat', cursive;
  font-style: normal;
  font-weight: 500;
  color: var(--gold);
}

/* In headings, <em> automatically becomes the hand-script accent */
h1 em, h2 em, h3 em, h4 em, h5 em, h6 em,
.page-title em, .vital-tile .v em, .status-meta em {
  font-family: 'Caveat', cursive;
  font-style: normal;
  font-weight: 500;
  color: var(--gold);
  font-size: 1.4em;
  line-height: 0.9;
}

/* ─────────────────────────────────────────────────────────────────────
   Eyebrow — `I. ─── Chapter Label` pattern
   ───────────────────────────────────────────────────────────────────── */

.eyebrow {
  display: inline-flex; align-items: center; gap: 14px;
  color: var(--cream-dim); margin-bottom: 18px;
}
.eyebrow .num {
  font-family: 'Caveat', cursive; font-weight: 500;
  font-size: 1.4rem; color: var(--gold); line-height: 0.9;
}
.eyebrow .line {
  width: 32px; height: 1px; background: var(--gold); opacity: 0.6;
}
.eyebrow .label {
  font-family: 'Manrope', sans-serif; font-weight: 600;
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--cream-dim);
}

.page-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 500; font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  line-height: 1.05; letter-spacing: -0.03em; color: var(--cream);
  margin: 0;
}
.page-subtitle {
  font-family: 'Manrope', sans-serif; font-weight: 400;
  font-size: 1rem; color: var(--cream-dim); margin-top: 12px; line-height: 1.55;
  max-width: 720px;
}

/* ─────────────────────────────────────────────────────────────────────
   Status row (`● Active   28 days remaining`)
   ───────────────────────────────────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'Manrope', sans-serif; font-weight: 600;
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--emerald);
}
.status-pill::before {
  content: "●"; color: var(--emerald);
  text-shadow: 0 0 8px var(--emerald);
}
.status-meta {
  font-family: 'Manrope', sans-serif; font-weight: 500;
  font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--cream-dim);
}

/* ─────────────────────────────────────────────────────────────────────
   Mission progress bar
   ───────────────────────────────────────────────────────────────────── */
.pbar {
  width: 100%; height: 4px;
  background: color-mix(in srgb, var(--cream) 5%, transparent);
  border-radius: 999px; overflow: hidden;
}
.pbar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  border-radius: 999px;
  box-shadow: 0 0 8px color-mix(in srgb, var(--gold) 30%, transparent);
  transition: width 0.4s ease;
}
.pbar-value {
  font-family: 'Caveat', cursive;
  font-size: 1.3rem; color: var(--gold); font-weight: 500;
}

/* ─────────────────────────────────────────────────────────────────────
   Action cards (Mission Control + most surfaces) — generic .surface-card too
   ───────────────────────────────────────────────────────────────────── */
.action-card,
.surface-card {
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow-1);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.action-card:hover,
.surface-card:hover {
  border-color: var(--line);
  background: var(--bg-elev);
  transform: translateY(-2px);
}
.action-card.active {
  border-color: var(--gold);
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 4%, transparent), var(--bg-card));
}

.action-num {
  font-family: 'Caveat', cursive; font-weight: 500;
  font-size: 2.4rem; color: var(--gold); line-height: 0.9;
}
.action-tag {
  font-family: 'Manrope', sans-serif; font-weight: 700;
  font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--cream-mute);
}
.action-tag.up-next { color: var(--gold); }
.action-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 500; font-size: 1.25rem;
  letter-spacing: -0.015em; color: var(--cream);
}
.action-desc { color: var(--cream-soft); font-size: 0.98rem; line-height: 1.6; }

/* COPY button */
.copy-btn {
  background: var(--gold);
  color: var(--bg-deep);
  font-family: 'Manrope', sans-serif;
  font-weight: 700; font-size: 0.78rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.copy-btn:hover {
  background: var(--gold-soft);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--gold) 35%, transparent);
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────────────────────────────────
   Sidebar
   ───────────────────────────────────────────────────────────────────── */
.sidebar-section-label {
  font-family: 'Manrope', sans-serif; font-weight: 700;
  font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--cream-mute);
}
.sidebar-item {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 500; font-size: 0.95rem;
  color: var(--cream-soft);
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
}
.sidebar-item:hover { background: color-mix(in srgb, var(--gold) 4%, transparent); color: var(--cream); }
.sidebar-item.active {
  background: var(--bg-elev);
  border-left-color: var(--gold);
  color: var(--cream);
}
.sidebar-badge {
  font-family: 'Caveat', cursive; font-weight: 500;
  font-size: 1.1rem; color: var(--gold);
}

/* ─────────────────────────────────────────────────────────────────────
   Vital tiles (Mission Control row)
   ───────────────────────────────────────────────────────────────────── */
.vital-tile {
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 20px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow-1);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.vital-tile:hover { border-color: var(--line); transform: translateY(-1px); }
.vital-tile .k {
  font-family: 'Manrope', sans-serif; font-weight: 700;
  font-size: 0.66rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--cream-mute);
}
.vital-tile .v {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 500; font-size: 1.05rem;
  letter-spacing: -0.01em; color: var(--cream);
}
.vital-tile .v em {
  font-family: 'Caveat', cursive; font-style: normal;
  color: var(--gold); font-size: 1.4em; font-weight: 500;
}
.vital-tile .sub {
  font-family: 'JetBrains Mono', monospace; font-size: 0.7rem;
  color: var(--cream-dim);
}

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}
.status-dot.ok { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }
.status-dot.warn { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.status-dot.err { background: var(--plum); box-shadow: 0 0 8px var(--plum); }
.status-dot.info { background: var(--gold-soft); box-shadow: 0 0 8px var(--gold-soft); }

/* ─────────────────────────────────────────────────────────────────────
   Pull quotes
   ───────────────────────────────────────────────────────────────────── */
blockquote {
  margin: 48px 0; padding: 0 0 0 28px;
  border-left: 2px solid var(--gold);
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 300; font-size: 1.55rem;
  line-height: 1.42; color: var(--cream);
  letter-spacing: -0.018em;
}
blockquote cite {
  display: block; margin-top: 18px;
  font-family: 'Manrope', sans-serif; font-weight: 600;
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold); font-style: normal;
}

/* ─────────────────────────────────────────────────────────────────────
   ✦ Section dividers between major page blocks
   ───────────────────────────────────────────────────────────────────── */
.divider {
  display: flex; align-items: center; justify-content: center;
  margin: 70px 0; gap: 24px;
}
.divider .ornament {
  color: var(--gold); opacity: 0.7;
  font-family: 'Caveat', cursive; font-size: 1.6rem;
}
.divider .rule { flex: 1; height: 1px; background: var(--line); max-width: 160px; }

/* ─────────────────────────────────────────────────────────────────────
   Mascot card (Athena/Owl portrait holder)
   ───────────────────────────────────────────────────────────────────── */
.mascot-wrap {
  position: relative;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--gold) 12%, transparent), transparent 60%);
  padding: 8px;
}
.mascot-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0; overflow: hidden;
  box-shadow: var(--shadow-2);
}
.mascot-card img { width: 100%; height: auto; display: block; }

/* ─────────────────────────────────────────────────────────────────────
   Glass `.panel` (reused everywhere) — surfaces + accent from the theme
   ───────────────────────────────────────────────────────────────────── */
.panel {
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 85%, transparent), color-mix(in srgb, var(--bg-mid) 70%, transparent));
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 60% at 0% 0%, color-mix(in srgb, var(--gold) 6%, transparent), transparent 60%);
  pointer-events: none;
}
.panel-hot { border-color: var(--line); }
.panel-hover { transition: border-color .25s ease, transform .25s ease; }
.panel-hover:hover { border-color: var(--line); transform: translateY(-1px); }

/* ─────────────────────────────────────────────────────────────────────
   Pills — small status chips
   ───────────────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px; border-radius: 999px;
  font-size: 10.5px; letter-spacing: 0.16em;
  background: color-mix(in srgb, var(--cream) 4%, transparent);
  border: 1px solid var(--line-soft);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.pill-ok   { color: var(--emerald);   border-color: color-mix(in srgb, var(--emerald) 30%, transparent);   background: color-mix(in srgb, var(--emerald) 6%, transparent); }
.pill-warn { color: var(--gold);      border-color: color-mix(in srgb, var(--gold) 30%, transparent);      background: color-mix(in srgb, var(--gold) 6%, transparent); }
.pill-err  { color: var(--plum);      border-color: color-mix(in srgb, var(--plum) 30%, transparent);      background: color-mix(in srgb, var(--plum) 6%, transparent); }
.pill-info { color: var(--gold-soft); border-color: color-mix(in srgb, var(--gold-soft) 30%, transparent); background: color-mix(in srgb, var(--gold) 6%, transparent); }

/* ─────────────────────────────────────────────────────────────────────
   Heartbeat dot + metric numerals
   ───────────────────────────────────────────────────────────────────── */
.heartbeat {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 10px currentColor;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.7); opacity: 0.4; }
}

.metric {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Minimal scrollbar */
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--gold) 18%, transparent); border-radius: 4px; }
.scroll::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--gold) 32%, transparent); }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* Agent glow utility — keeps existing class names alive */
.glow-c { color: var(--rust);     text-shadow: 0 0 18px color-mix(in srgb, var(--rust) 50%, transparent); }
.glow-o { color: var(--plum);     text-shadow: 0 0 18px color-mix(in srgb, var(--plum) 50%, transparent); }
.glow-h { color: var(--gold-soft);text-shadow: 0 0 18px color-mix(in srgb, var(--gold-soft) 50%, transparent); }

/* Heading strip used by Panel.tsx header */
.heading-strip {
  position: relative;
  padding-left: 12px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.heading-strip::before {
  content: "";
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 2px; border-radius: 2px;
  background: var(--gold);
  opacity: 0.85;
  box-shadow: 0 0 10px var(--gold);
}

/* Command palette */
.cmdk-input {
  background: transparent; outline: none; border: none;
  width: 100%; padding: 16px 18px; color: var(--cream);
  font-family: 'Manrope', sans-serif; font-size: 15px;
}
.cmdk-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 6px;
  cursor: pointer; color: var(--cream-soft);
}
.cmdk-item[data-selected="true"] {
  background: color-mix(in srgb, var(--gold) 8%, transparent);
  color: var(--cream);
}

/* Activity stream fade */
.stream-fade {
  mask-image: linear-gradient(to bottom, transparent, black 8%, black 92%, transparent);
}

/* Live tick bars */
.tick {
  display: inline-block;
  width: 4px; height: 12px; margin: 0 1px;
  background: currentColor; border-radius: 1px;
  opacity: 0.4;
}
.tick.live { animation: tick 1.4s ease-in-out infinite; }
@keyframes tick {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* Aurora element exists in layout — silence it; the design system uses
   ambient gradients on body::after instead */
.aurora { display: none !important; }

/* Fusion Boardroom — deliberating animations */
@keyframes fusionShimmer { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
.fusion-shimmer { animation: fusionShimmer 1.3s ease-in-out infinite; }
@keyframes fusionBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.fusion-caret { animation: fusionBlink 1s step-end infinite; color: var(--gold); }

/* Hermes / agent chat — render markdown replies tightly inside the bubble
   (fixes raw ** asterisks, lists, code, headings showing as plain text) */
.chat-md > :first-child { margin-top: 0; }
.chat-md > :last-child { margin-bottom: 0; }
.chat-md p { margin: 0 0 0.5em; }
.chat-md strong { font-weight: 700; color: var(--fg); }
.chat-md em { font-style: italic; }
.chat-md ul, .chat-md ol { margin: 0.3em 0 0.6em; padding-left: 1.25em; }
.chat-md li { margin: 0.15em 0; }
.chat-md li > p { margin: 0; }
.chat-md h1, .chat-md h2, .chat-md h3, .chat-md h4 {
  font-weight: 700; line-height: 1.25; margin: 0.7em 0 0.35em; color: var(--fg);
}
.chat-md h1 { font-size: 1.15em; }
.chat-md h2 { font-size: 1.1em; }
.chat-md h3, .chat-md h4 { font-size: 1.02em; }
.chat-md a { color: var(--accent-cyan, #00ccff); text-decoration: underline; }
.chat-md code {
  font-family: var(--font-geist-mono, ui-monospace), monospace; font-size: 0.92em;
  background: rgba(255,255,255,0.08); padding: 0.08em 0.36em; border-radius: 5px;
}
.chat-md pre {
  background: rgba(0,0,0,0.35); border: 1px solid var(--panel-border, rgba(255,255,255,0.1));
  border-radius: 10px; padding: 10px 12px; margin: 0.5em 0; overflow-x: auto;
}
.chat-md pre code { background: none; padding: 0; font-size: 0.86em; }
.chat-md blockquote {
  border-left: 3px solid var(--panel-border, rgba(255,255,255,0.2));
  margin: 0.5em 0; padding-left: 0.8em; color: var(--fg-dim);
}
.chat-md table { border-collapse: collapse; margin: 0.5em 0; font-size: 0.95em; }
.chat-md th, .chat-md td { border: 1px solid var(--panel-border, rgba(255,255,255,0.12)); padding: 4px 9px; }
.chat-md hr { border: 0; border-top: 1px solid var(--panel-border, rgba(255,255,255,0.12)); margin: 0.7em 0; }

/* ─────────────────────────────────────────────────────────────────────
   Home dashboard helpers — focus rings, loading skeletons, motion respect
   ───────────────────────────────────────────────────────────────────── */
.focus-ring:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 8px;
}

.skeleton {
  background: color-mix(in srgb, var(--cream) 6%, transparent);
  border-radius: 6px;
  animation: skeletonPulse 1.6s ease-in-out infinite;
}
@keyframes skeletonPulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton, .heartbeat, .tick.live, .hermes-pet { animation: none; }
}

/* Hermes pet — animated petdex sprite that mirrors the agent's live state.
   6-frame horizontal cycle per state row; row is set inline per state. */
@keyframes petBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.hermes-pet {
  image-rendering: pixelated;
  pointer-events: none;
  display: block;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.45));
  animation: petBob 2.4s ease-in-out infinite;
}
.hermes-pet-dock {
  position: absolute; right: 18px; bottom: 92px; z-index: 5;
  width: fit-content; height: fit-content;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.hermes-pet-dock .pet-state {
  font-family: var(--font-geist-mono, ui-monospace), monospace;
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-dim); opacity: 0.75;
}
