/* ============================================================
   ECHO MASTER STYLESHEET
   Path: E:\rookery.rp\echo\assets\css\echo.css
   URL:  /echo/assets/css/echo.css

   Linked by every Echo page. Single source of truth for the
   Rookery Isles palette (wine + gold + cream, eyedroppered
   from rookeryisles.com), shared layout, and components.
   Page-specific styles stay inline in each page.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   1. TOKENS
   ============================================================ */
:root {
  /* Wine / plum surfaces (eyedroppered from Rookery Isles splash) */
  --bg:        #1a0e14;
  --surface:   #2a1620;
  --surface-2: #3a1f2c;
  --surface-3: #4a2d3e;
  --input-bg:  #140810;

  /* Borders */
  --border:    #3d2230;
  --border-2:  #6a4830;

  /* Text (cream range) */
  --text:   #f4ead2;
  --muted:  #b8a888;
  --dim:    #786860;
  --ghost:  #5a4840;

  /* Primary (warm gold — never yellow) */
  --primary:    #c8a878;
  --primary-h:  #d8bc8c;
  --primary-d:  #8a6b40;
  --primary-bg: rgba(200, 168, 120, 0.10);

  /* Danger (wine-flushed red, matches Rookery status-offline) */
  --danger:    #a84b5a;
  --danger-h:  #c25867;
  --danger-bg: rgba(168, 75, 90, 0.12);

  /* Warning (warm amber that sits between gold and wine) */
  --warn:    #d8a050;
  --warn-h:  #e8b060;
  --warn-bg: rgba(216, 160, 80, 0.10);

  /* Info (misty plum — pairs with gold without competing) */
  --info:    #9a7ba8;
  --info-h:  #b095bd;
  --info-bg: rgba(154, 123, 168, 0.10);

  /* Layout */
  --sidebar-w: 210px;
  --topbar-h:  52px;

  /* Geometry (Rookery scale) */
  --radius:    8px;
  --radius-sm: 4px;
  --radius-lg: 16px;

  /* Shadows (Rookery) */
  --shadow:    0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.65);

  /* Fonts (Cinzel + EB Garamond, lifted from rookeryisles.com) */
  --font-body:    'EB Garamond', 'Garamond', 'Georgia', serif;
  --font-display: 'Cinzel', 'Trajan Pro', 'Times New Roman', serif;
  --font-label:   'Cinzel', 'Trajan Pro', 'Times New Roman', serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', Consolas, ui-monospace, monospace;
}

/* ============================================================
   2. RESET / BASE
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.55;
}

a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-h); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-3); }

img { display: block; max-width: 100%; }
button, input, textarea, select { font-family: inherit; }

/* ============================================================
   3. LAYOUT SHELL
   Used on every page that has sidebar + content (everything
   except the login page).
   ============================================================ */
.layout {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

.content-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.main {
  flex: 1;
  min-height: 0;
  padding: 22px 26px;
  overflow-y: auto;
}

/* ============================================================
   4. SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.sb-brand {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.sb-brand .brand-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.25em;
  color: var(--text);
  line-height: 1;
}
.sb-brand .brand-sub {
  font-family: var(--font-label);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 4px;
}

.sb-nav {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  font-family: var(--font-label);
  font-size: 0.78rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
  user-select: none;
  text-decoration: none;
}
.nav:hover {
  color: var(--text);
  background: var(--surface-2);
}
.nav.active {
  color: var(--primary);
  background: var(--primary-bg);
  border-left-color: var(--primary);
}
.nav svg { flex-shrink: 0; opacity: 0.65; }
.nav.active svg { opacity: 1; }

.nav-dot {
  margin-left: auto;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 6px rgba(216, 160, 80, 0.6);
  flex-shrink: 0;
}

.sidebar-spacer { flex: 1; }

.sb-stats {
  padding: 12px 18px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sb-stats-head {
  font-family: var(--font-label);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 2px;
}
.sb-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
}
.sb-stat-lbl { color: var(--dim); width: 32px; flex-shrink: 0; }
.sb-stat-val { color: var(--text); width: 42px; flex-shrink: 0; text-align: right; }
.sb-stat-bar {
  flex: 1;
  height: 4px;
  background: var(--input-bg);
  border-radius: 2px;
  overflow: hidden;
}
.sb-stat-bar > div {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width .4s, background .3s;
}
.sb-stat-bar > div.warn   { background: var(--warn); }
.sb-stat-bar > div.danger { background: var(--danger); }

.sb-stat-up {
  display: flex;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 2px;
}

.sidebar-foot {
  padding: 10px 18px 14px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--dim);
  line-height: 1.7;
}
.sf-lbl { color: var(--ghost); }

/* ============================================================
   4b. VOICE DOCK (sidebar mini voice panel)
   Auto-injected by /echo/js/voice-dock.js into every page's
   sidebar (except chat, which has its own composer controls).
   Uses VoiceSession from voice.js. Keep IDs in sync with what
   VoiceSession looks for: vadBtn, muteBtn (.vad-label child),
   ttsRpBtn, vbDot, vbText, vbStop. The wrapper itself is
   id="voiceBar" so VoiceSession's .active toggle still works.
   Sits between the nav (pushed by .sidebar-spacer) and the
   .sb-stats system block at the bottom of the sidebar.
   ============================================================ */
.voice-dock {
  margin: 6px 12px 10px;
  padding: 10px 11px 11px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: border-color .18s, box-shadow .18s;
}
.voice-dock::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 6px; height: 6px;
  border-top: 1px solid var(--primary);
  border-left: 1px solid var(--primary);
  border-top-left-radius: var(--radius-sm);
  opacity: 0.55;
  pointer-events: none;
}
.voice-dock::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 6px; height: 6px;
  border-bottom: 1px solid var(--primary);
  border-right: 1px solid var(--primary);
  border-bottom-right-radius: var(--radius-sm);
  opacity: 0.55;
  pointer-events: none;
}
.voice-dock.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary-bg) inset,
              0 0 12px rgba(200, 168, 120, 0.08);
}
.voice-dock.active::before,
.voice-dock.active::after { opacity: 1; }

.voice-dock .vd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.voice-dock .vd-label {
  font-family: var(--font-label);
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
}
.voice-dock .vd-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.voice-dock .vb-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border-2);
  flex-shrink: 0;
  transition: background .15s, box-shadow .15s;
}
.voice-dock .vb-dot.listening { background: var(--primary); box-shadow: 0 0 6px var(--primary); }
.voice-dock .vb-dot.hearing   { background: var(--info);    box-shadow: 0 0 6px var(--info); }
.voice-dock .vb-dot.thinking  { background: var(--warn);    box-shadow: 0 0 6px var(--warn);   animation: vdPulse 1.2s ease-in-out infinite; }
.voice-dock .vb-dot.speaking  { background: var(--info);    box-shadow: 0 0 6px var(--info);   animation: vdPulse 1.2s ease-in-out infinite; }
.voice-dock .vb-dot.muted     { background: var(--danger);  box-shadow: 0 0 6px var(--danger); }
@keyframes vdPulse {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.45; }
}
.voice-dock .vb-text { color: var(--text); }

.voice-dock .vd-row {
  display: flex;
  gap: 6px;
}
.voice-dock .vd-btn {
  flex: 1;
  font-family: var(--font-label);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--muted);
  padding: 6px 4px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s, transform .08s;
  min-width: 0;
  line-height: 1;
}
.voice-dock .vd-btn:hover   { border-color: var(--primary); color: var(--primary); background: var(--surface-2); }
.voice-dock .vd-btn:active  { transform: translateY(1px); }
.voice-dock .vd-btn.active  { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.voice-dock .vd-btn.vd-tts  { font-size: 0.6rem; letter-spacing: 0.10em; }

.voice-dock .vd-stop {
  font-family: var(--font-label);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  padding: 6px 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
  display: none;  /* VoiceSession shows during thinking/speaking */
  line-height: 1;
}
.voice-dock .vd-stop:hover { background: var(--danger); color: var(--bg); }

.voice-dock .vd-mini {
  margin-top: 2px;
  padding: 7px 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.68rem;
  line-height: 1.4;
  max-height: 116px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.voice-dock .vd-mini-empty {
  color: var(--dim);
  font-style: italic;
  font-size: 0.6rem;
  text-align: center;
  padding: 4px 0;
  letter-spacing: 0.02em;
}
.voice-dock .vd-mini-line {
  color: var(--text);
  word-break: break-word;
}
.voice-dock .vd-mini-line .vd-who {
  font-family: var(--font-label);
  font-size: 0.55rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-weight: 700;
  margin-right: 5px;
}
.voice-dock .vd-user .vd-who { color: var(--info); }
.voice-dock .vd-echo .vd-who { color: var(--primary); }

/* ============================================================
   5. TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand .brand-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.22em;
  color: var(--text);
  line-height: 1;
}
.brand .brand-sub {
  font-family: var(--font-label);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

.crumb {
  font-family: var(--font-label);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 12px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}
.crumb b { color: var(--text); font-weight: 600; }

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

.hbtn {
  background: none;
  border: 1px solid var(--border-2);
  color: var(--muted);
  font-family: var(--font-label);
  font-size: 0.68rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: border-color .15s, color .15s, background .15s;
}
.hbtn:hover {
  border-color: var(--text);
  color: var(--text);
  background: var(--surface-2);
}
.hbtn.danger { border-color: var(--danger); color: var(--danger); }
.hbtn.danger:hover { background: var(--danger-bg); border-color: var(--danger-h); color: var(--danger-h); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-label);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.user-av {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  object-fit: cover;
}

/* ============================================================
   6. PAGE TITLE
   ============================================================ */
.page-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  letter-spacing: 0.18em;
  color: var(--text);
  margin: 4px 0 6px;
  line-height: 1;
}
.page-sub {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}

/* ============================================================
   7. CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.card-title {
  font-family: var(--font-label);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}
.card-sub {
  font-family: var(--font-label);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.card-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.card-body {
  padding: 18px;
}

/* ============================================================
   8. BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  font-family: var(--font-label);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  user-select: none;
  text-decoration: none;
}
.btn:hover { background: var(--surface-3); border-color: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #1a0e14;
}
.btn-primary:hover {
  background: var(--primary-h);
  border-color: var(--primary-h);
}
.btn-primary:active { background: var(--primary-d); }

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #f4ead2;
}
.btn-danger:hover {
  background: var(--danger-h);
  border-color: var(--danger-h);
}

.btn-warn {
  background: var(--warn);
  border-color: var(--warn);
  color: #1a0e14;
}
.btn-warn:hover {
  background: var(--warn-h);
  border-color: var(--warn-h);
}

.btn-ghost {
  background: none;
  border-color: var(--border-2);
  color: var(--muted);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-sm { padding: 5px 10px; font-size: 0.66rem; }
.btn-lg { padding: 11px 20px; font-size: 0.82rem; }

/* ============================================================
   9. FORM ELEMENTS
   ============================================================ */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: var(--font-label);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 5px;
}

.input,
input.input,
textarea.input,
select.input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.88rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.input:focus,
textarea.input:focus,
select.input:focus { border-color: var(--primary); background: var(--bg); }
.input::placeholder, textarea.input::placeholder { color: var(--ghost); }

textarea.input { resize: vertical; min-height: 70px; }

select.input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

/* ============================================================
   10. STATUS PILLS / DOTS
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-label);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--muted);
}
.pill-ok    { background: var(--primary-bg); color: var(--primary); }
.pill-err   { background: var(--danger-bg);  color: var(--danger); }
.pill-warn  { background: var(--warn-bg);    color: var(--warn); }
.pill-info  { background: var(--info-bg);    color: var(--info); }
.pill-off   { background: var(--surface-2);  color: var(--dim); }

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ghost);
  flex-shrink: 0;
  transition: background .3s, box-shadow .3s;
}
.dot.ok    { background: var(--primary); box-shadow: 0 0 6px rgba(200, 168, 120, 0.5); }
.dot.err   { background: var(--danger);  box-shadow: 0 0 6px rgba(168, 75, 90, 0.5); }
.dot.warn  { background: var(--warn);    box-shadow: 0 0 6px rgba(216, 160, 80, 0.5); }
.dot.info  { background: var(--info);    box-shadow: 0 0 6px rgba(154, 123, 168, 0.5); }
.dot.pulse { animation: dotPulse 1.4s ease-in-out infinite; }
@keyframes dotPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ============================================================
   11. TABS (sub-tabs inside cards)
   ============================================================ */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--input-bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  width: fit-content;
}
.tab {
  background: none;
  border: none;
  padding: 6px 14px;
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface-2); color: var(--text); }

/* ============================================================
   12. STATS GRID
   ============================================================ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 18px;
}
.stat {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.stat-label {
  font-family: var(--font-label);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 6px;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  color: var(--text);
  line-height: 1;
}
.stat-value.ok   { color: var(--primary); }
.stat-value.err  { color: var(--danger); }
.stat-value.warn { color: var(--warn); }
.stat-sub {
  font-family: var(--font-label);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-top: 4px;
}
.stat-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.stat-bar > div {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width .4s, background .3s;
}
.stat-bar > div.warn   { background: var(--warn); }
.stat-bar > div.danger { background: var(--danger); }

/* ============================================================
   13. TABLES
   ============================================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.table th {
  text-align: left;
  font-family: var(--font-label);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--input-bg);
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.table tr:hover td { background: var(--surface-2); }
.table tr:last-child td { border-bottom: none; }

/* ============================================================
   14. TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  font-family: var(--font-label);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  padding: 9px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; }
.toast.ok  { border-color: var(--primary); color: var(--primary); }
.toast.err { border-color: var(--danger);  color: var(--danger); }

/* ============================================================
   15. MODAL
   ============================================================ */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: calc(100% - 40px);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.modal-head {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: var(--font-label);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}
.modal-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 6px;
  line-height: 1;
  transition: color .15s;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px; font-size: 1.15rem; line-height: 1.6; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   16. CHAT MESSAGES
   Used on chat.html and inside the voice dock transcript.
   ============================================================ */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 28px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 880px;
  animation: msgIn .2s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-label);
  font-size: 0.62rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  user-select: none;
}
.msg-name { font-weight: 600; }
.msg.echo .msg-name { color: var(--primary); }
.msg.user .msg-name { color: var(--info); }
.msg-time { color: var(--dim); }
.msg-text {
  font-size: 1.38rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  cursor: text;
}
.msg-img {
  max-width: 320px;
  max-height: 240px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: block;
  margin-top: 6px;
}

.typing-row {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 4px 0;
}
.typing-row span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: typingDot 1.2s infinite;
}
.typing-row span:nth-child(2) { animation-delay: 0.2s; }
.typing-row span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40%           { opacity: 1; transform: scale(1); }
}

.idle-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  user-select: none;
  color: var(--dim);
}
.idle-label {
  font-family: var(--font-label);
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
}
.idle-bar {
  width: 60px;
  height: 2px;
  background: var(--border);
  overflow: hidden;
  position: relative;
}
.idle-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 30%;
  height: 100%;
  background: var(--primary);
  animation: idleSlide 2.4s ease-in-out infinite;
}
@keyframes idleSlide {
  0%   { left: -30%; }
  100% { left: 100%; }
}

/* ============================================================
   17. CHAT COMPOSER
   ============================================================ */
.composer {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px 14px;
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  transition: border-color .15s;
}
.composer-row:focus-within { border-color: var(--primary); }

textarea.composer-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.38rem;
  line-height: 1.55;
  resize: none;
  min-height: 32px;
  max-height: 200px;
  padding: 4px;
}
textarea.composer-input::placeholder { color: var(--ghost); }

.composer-btn {
  width: 34px;
  height: 34px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, border-color .15s, color .15s;
}
.composer-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.composer-send {
  width: 34px;
  height: 34px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #1a0e14;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.composer-send:hover { background: var(--primary-h); }
.composer-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* VAD/MUTE pill buttons in chat composer */
.vad-btn {
  height: 34px;
  padding: 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  font-family: var(--font-label);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, border-color .15s, color .15s;
}
.vad-btn:hover { background: var(--surface-3); }
.vad-btn.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
  animation: vadPulse 1.5s ease-in-out infinite;
}
.vad-btn.muted {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}
@keyframes vadPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(200, 168, 120, 0); }
  50%      { box-shadow: 0 0 12px rgba(200, 168, 120, 0.5); }
}
.vad-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.live-transcript {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--warn);
  min-height: 0;
  max-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 6px;
  opacity: 0;
  transition: opacity .2s;
}
.live-transcript.active { opacity: 1; }

/* Voice session status bar (above messages on chat) */
.voice-bar {
  flex-shrink: 0;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  background: var(--primary-bg);
  border-bottom: 1px solid var(--primary);
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.voice-bar.active { display: flex; }
.voice-bar .vb-text { color: var(--text); flex: 1; }
.voice-bar .vb-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ghost);
  flex-shrink: 0;
  transition: background .3s, box-shadow .3s;
}
.voice-bar .vb-dot.listening { background: var(--primary); box-shadow: 0 0 8px rgba(200, 168, 120, 0.6); animation: dotPulse 1.4s ease-in-out infinite; }
.voice-bar .vb-dot.hearing   { background: var(--info);    box-shadow: 0 0 8px rgba(154, 123, 168, 0.6); }
.voice-bar .vb-dot.thinking  { background: var(--warn);    box-shadow: 0 0 8px rgba(216, 160, 80, 0.6); }
.voice-bar .vb-dot.speaking  { background: var(--warn);    box-shadow: 0 0 8px rgba(216, 160, 80, 0.6); animation: dotPulse 0.8s ease-in-out infinite; }
.voice-bar .vb-dot.muted     { background: var(--danger);  box-shadow: 0 0 8px rgba(168, 75, 90, 0.6); }
.voice-bar .vb-end {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-family: var(--font-label);
  font-size: 0.62rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.voice-bar .vb-end:hover { background: var(--danger-bg); }

/* Drop overlay (drag-and-drop file attach) */
.drop-overlay {
  position: absolute;
  inset: 0;
  background: var(--primary-bg);
  border: 2px dashed var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-label);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 5;
}
.drop-overlay.active { opacity: 1; pointer-events: all; }

/* Listen overlay (full-area pulsing ring while VAD live) */
.listen-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 14, 20, 0.93);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 20;
}
.listen-overlay.active { display: flex; }
.listen-ring {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 1px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: listenRing 2.2s ease-in-out infinite;
}
@keyframes listenRing {
  0%, 100% { box-shadow: 0 0 16px rgba(200, 168, 120, 0.3); }
  50%      { box-shadow: 0 0 48px rgba(200, 168, 120, 0.6); }
}
.listen-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.30em;
  color: var(--text);
}
.listen-sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}
.listen-cancel {
  background: none;
  border: 1px solid var(--border-2);
  color: var(--muted);
  font-family: var(--font-label);
  font-size: 0.66rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.listen-cancel:hover { border-color: var(--danger); color: var(--danger); }

/* Staged file/image previews above composer input */
.staged {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0;
}
.staged-item {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.staged-item img {
  height: 50px;
  width: auto;
  max-width: 80px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: block;
}
.staged-item.file-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 24px 5px 10px;
  font-family: var(--font-label);
  font-size: 0.7rem;
  color: var(--muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.staged-item button {
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--danger);
  border: none;
  color: #fff;
  font-size: 0.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Plus menu (attach / inject memory / run command) */
.plus-wrap { position: relative; }
.plus-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
}
.plus-menu.open { display: flex; }
.pm-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  font-family: var(--font-label);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background .12s, color .12s;
}
.pm-item:hover { background: var(--primary-bg); color: var(--primary); }
.pm-item.off { color: var(--dim); cursor: default; }
.pm-item.off:hover { background: none; color: var(--dim); }
.pm-dash {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--ghost);
  margin-left: auto;
}

/* ============================================================
   18. (Reserved) Floating voice dock removed.
   The voice controls live in the sidebar now; see section 4b
   (.voice-dock) near the top of this file, injected into the
   sidebar by /echo/js/voice-dock.js.
   ============================================================ */

/* ============================================================
   19. EMPTY / LOADING STATES
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--dim);
}
.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  opacity: 0.4;
}
.empty-state-title {
  font-family: var(--font-label);
  font-size: 0.85rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.empty-state-sub {
  font-size: 1.05rem;
  color: var(--dim);
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--surface-2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   20. UTILITIES
   ============================================================ */
.row     { display: flex; gap: 10px; align-items: center; }
.col     { display: flex; flex-direction: column; gap: 10px; }
.spacer  { flex: 1; }
.hidden  { display: none !important; }
.text-c  { text-align: center; }
.text-r  { text-align: right; }
.text-mono  { font-family: var(--font-mono); }
.text-muted { color: var(--muted); }
.text-dim   { color: var(--dim); }
.text-ok    { color: var(--primary); }
.text-err   { color: var(--danger); }
.text-warn  { color: var(--warn); }

/* ============================================================
   21. RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar { width: 56px; }
  .sb-brand .brand-name,
  .sb-brand .brand-sub,
  .sb-stats,
  .sidebar-foot { display: none; }
  .nav { justify-content: center; padding: 9px 0; gap: 0; }
  .nav-text, .nav span:not(.nav-dot) { display: none; }
  .crumb { display: none; }
}

@media (max-width: 600px) {
  .main { padding: 14px; }
  .stats { grid-template-columns: 1fr; }
}

/* ============================================================
   END OF FILE
   ============================================================ */
