/* ============ MediaXi Design System — dark + light, glass + neon ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root[data-theme="dark"] {
  --bg: #0a0d14;
  --bg-2: #0e1320;
  --panel: rgba(255,255,255,0.035);
  --panel-solid: #121827;
  --border: rgba(255,255,255,0.09);
  --text: #e8ecf4;
  --text-dim: #8b94a7;
  --accent: #6d5cff;
  --accent-2: #00e5c3;
  --accent-3: #ff5c8a;
  --warn: #ffb84d;
  --ok: #2fd67b;
  --err: #ff5c5c;
  --glow: 0 0 24px rgba(109,92,255,0.35);
  --shadow: 0 8px 32px rgba(0,0,0,0.45);
  --chip: rgba(109,92,255,0.14);
}
:root[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-2: #ffffff;
  --panel: rgba(255,255,255,0.75);
  --panel-solid: #ffffff;
  --border: rgba(15,23,42,0.10);
  --text: #101828;
  --text-dim: #5b6478;
  --accent: #5b4be0;
  --accent-2: #009e88;
  --accent-3: #e0447a;
  --warn: #b97a12;
  --ok: #158f4e;
  --err: #d43d3d;
  --glow: 0 0 18px rgba(91,75,224,0.18);
  --shadow: 0 8px 28px rgba(16,24,40,0.10);
  --chip: rgba(91,75,224,0.10);
}

html, body { height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text);
  background-image: radial-gradient(1200px 600px at 85% -10%, rgba(109,92,255,0.16), transparent 60%),
                    radial-gradient(900px 500px at -10% 110%, rgba(0,229,195,0.10), transparent 55%);
  background-attachment: fixed;
}
:root[data-theme="light"] body {
  background-image: radial-gradient(1200px 600px at 85% -10%, rgba(91,75,224,0.10), transparent 60%),
                    radial-gradient(900px 500px at -10% 110%, rgba(0,158,136,0.08), transparent 55%);
}

.app { display: flex; min-height: 100vh; }

/* ============ Sidebar ============ */
.sidebar {
  width: 236px; flex-shrink: 0; display: flex; flex-direction: column;
  padding: 20px 14px; border-right: 1px solid var(--border);
  background: var(--bg-2); position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; position: relative; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; font-size: 18px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: var(--glow);
}
.brand-text { display: flex; flex-direction: column; justify-content: center; min-width: 122px; }
/* Both rows of the wordmark are forced to the same visual width via SVG
   textLength, so MEDIA lines up under SORENXI by glyph width instead of
   letter-spacing hacks. */
.brand-wordmark { width: 122px; height: 44px; display: block; overflow: visible; }
.brand-wordmark text {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 950;
  fill: var(--text);
  text-transform: uppercase;
  dominant-baseline: alphabetic;
}
.brand-wordmark-top { font-size: 18px; letter-spacing: 0.3px; }
.brand-wordmark-xi { fill: var(--accent); }
.brand-wordmark-bottom { font-size: 23px; letter-spacing: 0.15px; }
.brand-sub { font-size: 10.5px; color: var(--text-dim); letter-spacing: 0.8px; text-transform: uppercase; margin-top: 4px; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  background: none; border: 1px solid transparent; border-radius: 10px;
  color: var(--text-dim); font-size: 14px; font-weight: 600; cursor: pointer;
  text-align: left; transition: all .15s;
}
.nav-item:hover { color: var(--text); background: var(--panel); }
.nav-item.active { color: var(--text); background: var(--chip); border-color: var(--border); box-shadow: inset 2px 0 0 var(--accent); }
.ni { width: 20px; text-align: center; }
.mic-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--err); margin-left: auto; display: none; animation: pulse 1s infinite; }
.mic-dot.on { display: block; }

.sidebar-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.theme-toggle {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-weight: 600; font-size: 13px;
}
.ai-pill { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-dim); padding: 0 6px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; flex-shrink: 0; }
.pulse.bad { background: var(--warn); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ============ Main / topbar ============ */
.main { flex: 1; padding: 22px 28px 60px; max-width: 1400px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.topbar h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.3px; }
.topbar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.niche-input { width: 240px; }

/* ============ Panels & layout ============ */
.view { display: none; animation: fadein .25s ease; }
.view.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 20px; margin-bottom: 18px; backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { font-size: 16px; font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1050px) { .grid-2, .composer-grid, .coach-grid { grid-template-columns: 1fr !important; } }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--text-dim); font-size: 12.5px; }
.subhead { font-size: 13px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.6px; margin: 16px 0 8px; }

/* ============ Buttons / inputs ============ */
.btn {
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border);
  font-size: 13.5px; font-weight: 700; cursor: pointer; transition: all .15s;
  background: var(--panel); color: var(--text);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #8f5cff); color: #fff; border: none; box-shadow: var(--glow); }
.btn-secondary { background: var(--chip); color: var(--accent); border-color: var(--accent); }
:root[data-theme="dark"] .btn-secondary { color: #b3a8ff; }
.btn-ghost { background: transparent; }
.btn-mini { padding: 5px 11px; font-size: 12px; border-radius: 8px; background: var(--chip); border: none; color: var(--accent); cursor: pointer; font-weight: 700; }
:root[data-theme="dark"] .btn-mini { color: #b3a8ff; }
.btn[disabled] { opacity: 0.5; cursor: wait; transform: none !important; }

.input, .textarea, select.input {
  width: 100%; padding: 10px 13px; border-radius: 10px; font-size: 14px;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--border);
  outline: none; font-family: inherit; transition: border .15s;
}
.input:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109,92,255,0.15); }
.input-inline { width: auto; }
.textarea { resize: vertical; margin-top: 10px; line-height: 1.55; }
#postTitle { margin-bottom: 2px; }
.field-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-dim); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.check { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-dim); cursor: pointer; }

/* ============ Stats ============ */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; backdrop-filter: blur(14px); position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: 0.7; }
.stat-num { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.stat-label { font-size: 12px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* ============ Trend & post lists ============ */
.trend-list, .post-list { display: flex; flex-direction: column; gap: 8px; }
.trend-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); text-decoration: none; color: var(--text); transition: all .15s; }
.trend-item:hover { border-color: var(--accent); transform: translateX(3px); }
.trend-rank { font-weight: 800; color: var(--accent); font-size: 15px; width: 24px; text-align: center; flex-shrink: 0; }
.trend-title { font-size: 13.5px; font-weight: 600; flex: 1; }
.trend-meta { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.trend-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }

.post-item { padding: 11px 13px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); }
.post-item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 5px; }
.post-body-preview { font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.status-chip { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; padding: 3px 9px; border-radius: 20px; }
.status-draft { background: rgba(139,148,167,0.18); color: var(--text-dim); }
.status-scheduled { background: rgba(255,184,77,0.15); color: var(--warn); }
.status-posted { background: rgba(47,214,123,0.15); color: var(--ok); }
.status-failed { background: rgba(255,92,92,0.15); color: var(--err); }
.status-assisted { background: var(--chip); color: var(--accent); }

/* ============ Tips / playbook ============ */
.tip-card { background: var(--bg-2); border: 1px solid var(--border); border-left: 3px solid var(--accent-2); border-radius: 10px; padding: 14px 16px; font-size: 13.5px; line-height: 1.6; }
.playbook { display: flex; flex-direction: column; gap: 8px; max-height: 520px; overflow-y: auto; }
.pb-item { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px; font-size: 13px; line-height: 1.5; }
.pb-topic { font-size: 10.5px; font-weight: 800; color: var(--accent-2); text-transform: uppercase; letter-spacing: 0.6px; }

/* ============ Provider grids / key vault ============ */
.provider-mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prov-mini { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.off { background: rgba(139,148,167,0.4); }
.key-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.key-row { display: flex; align-items: center; gap: 10px; padding: 10px 13px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); font-size: 13px; }
.key-row .kname { font-weight: 700; min-width: 110px; }
.key-row .kmask { color: var(--text-dim); font-family: Consolas, monospace; font-size: 12px; flex: 1; }
/* multi-key vault: keys grouped by provider, one ● (active) per group */
.vault-hint { font-size: 12px; margin: 8px 0 0; }
.key-group { display: flex; flex-direction: column; gap: 6px; }
.key-group-head { font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); padding: 2px 2px 0; }
.key-row.active-key { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2) inset; }
.key-active-btn { background: none; border: none; cursor: pointer; font-size: 15px; line-height: 1; color: var(--text-dim); padding: 2px 4px; }
.key-row.active-key .key-active-btn { color: var(--accent-2); }
.key-active-btn:hover { color: var(--accent); }
.vault-add { margin-bottom: 4px; }
.vault-add .input:not(.input-inline) { flex: 1; }

/* ============ Platform grid ============ */
.platform-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.plat-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px; padding: 15px 16px; transition: all .15s; }
.plat-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.plat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.plat-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 15px; flex-shrink: 0; }
.plat-name { font-weight: 700; font-size: 14px; }
.plat-region { font-size: 11px; color: var(--text-dim); }
.plat-tips { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin: 6px 0 10px; }
.plat-foot { display: flex; justify-content: space-between; align-items: center; }

/* ============ Composer ============ */
.composer-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.platform-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.pp-chip { padding: 7px 13px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg-2); font-size: 12.5px; font-weight: 700; cursor: pointer; color: var(--text-dim); transition: all .12s; user-select: none; }
.pp-chip.sel { background: var(--chip); color: var(--accent); border-color: var(--accent); }
:root[data-theme="dark"] .pp-chip.sel { color: #b3a8ff; }
.char-meters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.cm { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); color: var(--text-dim); }
.cm.over { color: var(--err); border-color: var(--err); }
.composer-actions { display: flex; gap: 9px; margin-top: 18px; flex-wrap: wrap; align-items: center; }
.media-strip { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-height: 44px; }
.media-thumb { position: relative; width: 74px; height: 74px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-thumb .rm { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 11px; padding: 1px 5px; }

/* ============ Rating ============ */
.rate-empty { color: var(--text-dim); font-size: 13.5px; line-height: 1.7; padding: 20px 4px; }
.score-ring { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
.ring { width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; position: relative; flex-shrink: 0; }
.ring-inner { width: 88px; height: 88px; border-radius: 50%; background: var(--panel-solid); display: grid; place-items: center; flex-direction: column; }
.ring-num { font-size: 30px; font-weight: 800; }
.tier-badge { font-size: 15px; font-weight: 800; }
.rate-section { margin-top: 12px; }
.rate-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 6px; }
.rate-section ul { margin-left: 18px; font-size: 13px; line-height: 1.7; }
.pp-scores { display: flex; flex-direction: column; gap: 6px; }
.pp-score-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.pp-score-row .bar { flex: 1; height: 7px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.pp-score-row .fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s ease; }
.improved-box { background: var(--chip); border: 1px dashed var(--accent); border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.6; margin-top: 8px; white-space: pre-wrap; }

/* ============ Pipeline ============ */
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.pipe-col { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; min-height: 130px; }
.pipe-col h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); margin-bottom: 10px; display: flex; justify-content: space-between; }
.pipe-card { background: var(--panel-solid); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 12.5px; }
.pipe-card .when { font-size: 11px; color: var(--warn); font-weight: 700; margin-bottom: 3px; }
.pipe-card .acts { display: flex; gap: 6px; margin-top: 7px; }

/* ============ Studio ============ */
.gen-result { margin-top: 14px; min-height: 40px; }
.gen-result img, .gen-result video { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); }
.gen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gen-cell { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); aspect-ratio: 1; background: var(--bg-2); }
.gen-cell img, .gen-cell video { width: 100%; height: 100%; object-fit: cover; }
.gen-cell .attach { position: absolute; bottom: 6px; right: 6px; }

/* ============ Consultant: 2-column stage layout ============ */
.coach-2col { display: grid; grid-template-columns: 1.9fr 1fr; gap: 18px; align-items: stretch; }
.stage-col { display: flex; flex-direction: column; height: 680px;
  background: linear-gradient(135deg, var(--panel), var(--chip)); }
.history-col { display: flex; flex-direction: column; height: 680px; }

/* stage header: orb + status + live/interrupt controls, all on one row */
.stage-header { display: flex; align-items: center; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.stage-head-mid { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.stage-toggles { flex-wrap: wrap; }
.stage-head-actions { display: flex; gap: 8px; align-items: center; }
/* ---- living orb: layered rings + audio-reactive --level (0..1) ----
   Idle = calm breathing · Listening = ear/pulse rings + mic-reactive scale ·
   Speaking = audio-reactive glow rings · Thinking = quick shimmer. */
.mentor-orb { --level: 0; position: relative; width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, var(--accent-2), var(--accent) 60%, #2a1b6e);
  box-shadow: 0 0 26px rgba(109,92,255,0.5);
  transform: scale(calc(1 + var(--level) * 0.14)); transition: transform .08s linear, box-shadow .2s; }
.mentor-orb .orb-core { font-size: 22px; font-weight: 800; color: #fff; text-shadow: 0 0 14px rgba(255,255,255,0.6); z-index: 2; }
.mentor-orb .orb-rings { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; }
.mentor-orb .orb-rings span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent-3); opacity: 0; }
/* idle: gentle breathing, rings quiet */
.mentor-orb.idle { animation: orbBreathe 3.6s ease-in-out infinite; }
@keyframes orbBreathe { 0%,100% { box-shadow: 0 0 20px rgba(109,92,255,0.35); } 50% { box-shadow: 0 0 30px rgba(109,92,255,0.55); } }
/* listening: green, expanding pulse rings (no static ear/mic icon) + mic-reactive scale */
.mentor-orb.listening { background: radial-gradient(circle at 35% 30%, #7ef0b0, #24c07a 60%, #0c6b45); box-shadow: 0 0 calc(30px + var(--level) * 40px) rgba(46,204,120,0.7); }
.mentor-orb.listening .orb-rings span { border-color: #2ecc78; animation: orbRing 1.6s ease-out infinite; }
.mentor-orb.listening .orb-rings span:nth-child(2) { animation-delay: .5s; }
.mentor-orb.listening .orb-rings span:nth-child(3) { animation-delay: 1s; }
@keyframes orbRing { 0% { opacity: .55; transform: scale(1); } 100% { opacity: 0; transform: scale(1.9); } }
/* speaking: audio-reactive glow rings (procedural when --level stays 0, e.g. browser TTS) */
.mentor-orb.speaking { box-shadow: 0 0 calc(28px + var(--level) * 46px) rgba(109,92,255,0.8); animation: orbTalk .5s ease-in-out infinite alternate; }
.mentor-orb.speaking .orb-rings span { border-color: var(--accent-2); animation: orbRing 1.3s ease-out infinite; }
.mentor-orb.speaking .orb-rings span:nth-child(2) { animation-delay: .45s; }
.mentor-orb.speaking .orb-rings span:nth-child(3) { animation-delay: .9s; }
@keyframes orbTalk { from { transform: scale(calc(1 + var(--level) * 0.14)); } to { transform: scale(calc(1.06 + var(--level) * 0.14)); } }
/* thinking: quick shimmer */
.mentor-orb.thinking { animation: orbThink .9s linear infinite; }
@keyframes orbThink { 0% { box-shadow: 0 0 22px rgba(109,92,255,0.4); } 50% { box-shadow: 0 0 40px rgba(160,120,255,0.8); } 100% { box-shadow: 0 0 22px rgba(109,92,255,0.4); } }
@media (prefers-reduced-motion: reduce) { .mentor-orb, .mentor-orb .orb-rings span { animation: none !important; } }

/* ---- radar-style conversation status: colour + icon + text ---- */
.convo-status { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 800; border: 1px solid var(--border); background: var(--bg-2); }
.convo-status .cs-radar { width: 9px; height: 9px; border-radius: 50%; position: relative; flex-shrink: 0; }
.convo-status .cs-radar::after { content: ""; position: absolute; inset: 0; border-radius: 50%; animation: csPing 1.8s ease-out infinite; }
@keyframes csPing { 0% { box-shadow: 0 0 0 0 currentColor; opacity: .5; } 100% { box-shadow: 0 0 0 9px transparent; opacity: 0; } }
.convo-status.idle { color: #e0a92e; } .convo-status.idle .cs-radar { background: #e6b428; }
.convo-status.live { color: #2ecc78; } .convo-status.live .cs-radar { background: #2ecc78; }
.convo-status.text { color: #5a96ff; } .convo-status.text .cs-radar { background: #5a96ff; }
.current-prov { font-size: 11.5px; color: var(--text-dim); margin-top: 6px; }
.current-prov a { color: var(--accent); text-decoration: none; font-weight: 700; }
.mentor-status { font-size: 12.5px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.8px; }
/* Consult/End: the single live-voice toggle. End state is red (active session stop). */
#consultBtn.consult-live { background: var(--err); border-color: var(--err); color: #fff; animation: pulse 1.6s infinite; }
.stage-interrupt { border-color: var(--err); color: var(--err); }

/* the stage screen holds the live chat OR a deployed showcase */
.stage-screen { flex: 1; position: relative; background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; overflow: hidden; }
.stage-showcase { position: absolute; inset: 0; background: var(--bg-2); border-radius: 14px; padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.stage-showcase[hidden] { display: none; }
.showcase-back { align-self: flex-start; }
.showcase-body { flex: 1; display: grid; place-items: center; text-align: center; font-size: 15px; line-height: 1.7; }
.showcase-body img, .showcase-body video { max-width: 100%; max-height: 460px; border-radius: 10px; }
.showcase-body h1, .showcase-body h2, .showcase-body h3 { margin: 10px 0 6px; }
.showcase-body strong { color: var(--accent-2); }
.demo-media-holder { display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 46px; color: var(--text-dim); }
.demo-media-holder div { font-size: 15px; text-align: center; color: var(--text); }
@media (max-width: 1050px) { .coach-2col { grid-template-columns: 1fr; } .stage-col, .history-col { height: auto; min-height: 520px; } }

/* ---- independent provider controls bar ---- */
.provider-bar { margin-bottom: 12px; }
.pb-toggle { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; font-size: 12px; font-weight: 700; color: var(--text-dim); cursor: pointer; }
.pb-toggle.on { color: var(--accent); border-color: var(--accent); }
.pb-caret { font-size: 10px; }
.pb-controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
.pb-controls[hidden] { display: none; }
.pb-field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px; }
.input-mini { width: 100%; font-size: 12px; padding: 6px 8px; }
@media (max-width: 720px) { .pb-controls { grid-template-columns: repeat(2, 1fr); } }

/* ---- draft → publish card (Consultant workflow) ---- */
.stage-draft { position: absolute; inset: 0; background: var(--bg-2); border-radius: 14px; padding: 16px 18px; overflow-y: auto; }
.stage-draft[hidden] { display: none; }
.draft-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.draft-head b { font-size: 15px; }
.draft-hint { margin-left: auto; font-size: 11.5px; }
.draft-media { display: flex; flex-wrap: wrap; gap: 8px; min-height: 20px; margin-bottom: 8px; }
.draft-media-controls { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.draft-platforms { display: flex; flex-wrap: wrap; gap: 7px; }
.draft-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.draft-gate { font-size: 12px; text-align: right; margin-top: 8px; min-height: 14px; }
/* Stepped draft wizard (Draft → Media → Publish) — progressive reveal on the stage. */
.draft-steps { display: flex; align-items: center; gap: 8px; margin: 10px 0 14px; flex-wrap: wrap; }
.dstep { font-size: 12px; font-weight: 700; color: var(--text-dim); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-2); }
.dstep.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.dstep.done { color: var(--accent); border-color: var(--accent); }
.dstep-sep { color: var(--text-dim); font-size: 12px; }
.draft-summary { display: flex; align-items: flex-start; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.draft-summary-text { flex: 1; white-space: pre-wrap; font-size: 13.5px; line-height: 1.45; }
.plat-more { display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent); text-decoration: none; padding: 7px 4px; align-self: center; }
.plat-empty { display: block; margin: 4px 0; }

/* ranked provider-preference lists (Key Vault) */
.pref-jobs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .pref-jobs { grid-template-columns: 1fr; } }
.pref-job-head { font-size: 12px; font-weight: 800; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.pref-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.pref-item { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 9px; padding: 6px 9px; font-size: 12.5px; }
.pref-item.unusable { opacity: .5; }
.pref-rank { width: 18px; height: 18px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-size: 10.5px; font-weight: 800; flex-shrink: 0; }
.pref-name { flex: 1; font-weight: 600; }
.pref-primary { font-size: 9.5px; font-weight: 800; color: var(--ok, #2ecc71); border: 1px solid currentColor; border-radius: 5px; padding: 0 4px; margin-left: 4px; text-transform: uppercase; }
.pref-off { font-size: 11px; color: var(--warn, #e6b428); }
.pref-moves { display: flex; gap: 3px; }
.pref-mv { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; width: 22px; height: 22px; font-size: 10px; cursor: pointer; color: var(--text); }
.pref-mv:disabled { opacity: .3; cursor: default; }
.auto-fallback { margin: 14px 0 4px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* chat history (right column) */
.history-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.history-empty { color: var(--text-dim); font-size: 13.5px; line-height: 1.7; padding: 8px 2px; }
.history-item { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.5; cursor: default; }
.history-item .h-role { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-dim); }

/* ============ Consultant chat bubbles (rendered on the stage) ============ */
.chat-scroll { position: absolute; inset: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; }
.chat-msg { max-width: 85%; padding: 12px 15px; border-radius: 14px; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; }
.chat-msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--accent), #8f5cff); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant { align-self: flex-start; background: var(--bg-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-msg.thinking { color: var(--text-dim); font-style: italic; }
.chat-msg .prov { display: block; margin-top: 6px; font-size: 10px; color: var(--text-dim); font-style: normal; }
.chat-inputrow { display: flex; gap: 8px; margin-top: 12px; }
.chat-inputrow .input { flex: 1; }

/* ============ Trends ideas ============ */
.idea-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.idea-card h4 { font-size: 14px; margin-bottom: 4px; }
.idea-angle { font-size: 12.5px; color: var(--accent-2); margin-bottom: 8px; }
.idea-draft { font-size: 13px; color: var(--text-dim); background: var(--panel-solid); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; line-height: 1.55; }
.idea-foot { display: flex; gap: 8px; margin-top: 9px; align-items: center; }

/* ============ Logs ============ */
.log-table { font-family: Consolas, monospace; font-size: 12px; display: flex; flex-direction: column; gap: 4px; max-height: 640px; overflow-y: auto; }
.log-row { display: flex; gap: 12px; padding: 7px 11px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--border); align-items: baseline; }
.log-time { color: var(--text-dim); white-space: nowrap; }
.log-level { font-weight: 800; text-transform: uppercase; font-size: 10px; width: 42px; flex-shrink: 0; }
.log-level.info { color: var(--accent-2); } .log-level.warn { color: var(--warn); } .log-level.error { color: var(--err); }
.log-msg { flex: 1; word-break: break-word; }

/* ============ Toasts & modal ============ */
.toast-host { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 9px; z-index: 300; }
.toast { padding: 12px 18px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 13.5px; font-weight: 600; animation: slidein .25s ease; max-width: 380px; }
.toast.ok { border-left: 3px solid var(--ok); } .toast.err { border-left: 3px solid var(--err); } .toast.info { border-left: 3px solid var(--accent); }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.modal-host { position: fixed; inset: 0; display: none; place-items: center; background: rgba(0,0,0,0.55); z-index: 200; backdrop-filter: blur(4px); }
.modal-host.open { display: grid; }
.modal { background: var(--panel-solid); border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px; width: min(560px, 92vw); max-height: 86vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal h3 { margin-bottom: 14px; }
.modal .field-label:first-of-type { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
/* modal header row: title + "How to connect" help toggle in the upper-right */
.modal-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head-row h3 { margin-bottom: 0; }
.modal-help.on { background: var(--accent); color: #fff; border-color: var(--accent); }
/* "How to connect" beginner guide panel */
.connect-guide { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.cg-head { font-weight: 800; font-size: 13.5px; margin-bottom: 10px; }
.cg-steps { margin: 0 0 6px 18px; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.cg-steps li { font-size: 13px; line-height: 1.5; color: var(--text); }
.cg-shot { display: none; } /* screenshot slot — reveal + style when images are added */
.cg-perms { font-size: 12.5px; color: var(--text-dim); background: var(--panel); border-radius: 8px; padding: 8px 10px; margin: 10px 0; line-height: 1.45; }
.cg-link { display: inline-block; margin-top: 4px; }

/* provider hint line under AI-Studio selectors (Instant vs Premium framing) */
.prov-hint { font-size: 12px; color: var(--text-dim); margin: 8px 0 2px; line-height: 1.45; }
.tier-pill { display: inline-block; font-weight: 800; font-size: 10.5px; padding: 2px 7px; border-radius: 999px; margin-right: 6px; letter-spacing: .3px; vertical-align: middle; }
.tier-instant { background: rgba(52,199,120,0.16); color: var(--ok, #2ecc71); }
.tier-local { background: rgba(230,180,40,0.16); color: var(--warn, #e6b428); }
.tier-premium { background: rgba(90,150,255,0.16); color: var(--accent, #5a96ff); }
/* provider badge on each media-library cell (labels who actually made it) */
.gen-prov { position: absolute; left: 6px; bottom: 6px; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 6px; background: rgba(0,0,0,0.62); color: #fff; letter-spacing: .3px; pointer-events: none; }

/* skeleton shimmer for loading */
.skeleton-host:empty::before { content: ""; display: block; height: 120px; border-radius: 12px;
  background: linear-gradient(100deg, var(--bg-2) 40%, var(--panel) 50%, var(--bg-2) 60%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ BRUSHED METAL SKIN (overrides) ============ */
:root[data-theme="dark"] {
  --bg: #101214; --bg-2: #1a1d21; --panel-solid: #1e2126;
  --accent: #7e97b8; --accent-2: #9fb4c7; --accent-3: #b0885e;
  --border: rgba(255,255,255,0.10); --chip: rgba(126,151,184,0.14);
  --glow: 0 0 18px rgba(126,151,184,0.25);
}
:root[data-theme="light"] {
  --bg: #dfe3e8; --bg-2: #f2f4f7; --panel-solid: #f7f8fa;
  --accent: #45688f; --accent-2: #32798a; --accent-3: #9a6a34;
  --border: rgba(20,30,45,0.16); --chip: rgba(69,104,143,0.10);
  --glow: 0 0 14px rgba(69,104,143,0.18);
}
body { background-image: none; }
:root[data-theme="dark"] body {
  background: linear-gradient(160deg, #131518 0%, #0e1012 55%, #15181c 100%);
}
:root[data-theme="light"] body {
  background: linear-gradient(160deg, #e8ebef 0%, #d8dde3 55%, #eceef1 100%);
}
.panel, .mentor-stage {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.012) 45%, rgba(0,0,0,0.05)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.014) 0 1px, transparent 1px 3px),
    var(--panel-solid);
  border-top-color: rgba(255,255,255,0.16);
}
:root[data-theme="light"] .panel, :root[data-theme="light"] .mentor-stage {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.4) 45%, rgba(150,160,175,0.14)),
    repeating-linear-gradient(90deg, rgba(90,105,125,0.05) 0 1px, transparent 1px 3px),
    var(--panel-solid);
}
.sidebar {
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border);
}
.btn-primary { background: linear-gradient(180deg, #59799c, #3d5c7e); border: 1px solid rgba(255,255,255,0.18); box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 2px 8px rgba(0,0,0,0.3); }
.brand-mark { background: linear-gradient(160deg, #6d87a8, #3c5a7c); box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 2px 10px rgba(0,0,0,0.35); }
.mentor-orb { background: radial-gradient(circle at 35% 30%, #b9c8d8, #61799a 55%, #2c3e55); box-shadow: inset 0 2px 6px rgba(255,255,255,0.35), 0 0 30px rgba(126,151,184,0.35); }
.stat-card::after { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ============ Phone layout (≤720px) ============
   The sidebar (fixed 236px column) becomes a compact top bar with a
   horizontally scrollable nav; panels stack. Without this the app was
   unusable below tablet width — the voice consultant is exactly the thing
   you want working from a phone. */
@media (max-width: 720px) {
  .app { flex-direction: column; }
  .sidebar {
    position: static; width: 100%; height: auto;
    padding: 10px 12px 8px; border-right: none; border-bottom: 1px solid var(--border);
  }
  .brand { padding-bottom: 8px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; scrollbar-width: thin; }
  .nav-item { flex: 0 0 auto; padding: 8px 11px; font-size: 13px; }
  .nav-item.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .sidebar-foot { flex-direction: row; align-items: center; justify-content: space-between; padding-top: 8px; }
  .main { padding: 14px 14px 40px; }
  .topbar h1 { font-size: 22px; }
  .niche-input { width: 100%; order: 3; }
  .stage-header { flex-wrap: wrap; gap: 10px; }
  .stage-head-actions { width: 100%; display: flex; gap: 8px; }
  .chat-inputrow { flex-wrap: nowrap; }
  .modal { width: calc(100vw - 32px) !important; max-height: 86vh; overflow-y: auto; }
}

/* ==========================================================================
   Living Consultant stage — idle XI hero orb + premium bubbles + media review
   (external audit pass, session 8, 2026-07-10, Eli Soren account). Purely
   additive: new element (#stageHero, another absolutely-positioned sibling of
   #chatScroll/#stageShowcase/#stageDraft, matching the existing stage-screen
   pattern) + new BEM classes on the chat bubble + a media-review action bar
   inside the existing #stageShowcase. Does not touch .mentor-orb (the small
   66px header orb) or the Consult/End/radar system — those stay as-is.
   ========================================================================== */
:root {
  --xi-purple: #7c3cff;
  --xi-purple-bright: #a86cff;
  --xi-magenta: #e34bbf;
  --xi-pink: #ff9edf;
  --xi-cyan: #77e7ff;
  --xi-white: #fffaff;
  --xi-listening: #62f5c5;
  --xi-speaking: #ff76d6;
  --xi-level: 0;
}
.stage-screen[data-surface="hero"] { padding: 0; }

/* ---- idle hero orb (shown only while the stage has no conversation/media/draft) ---- */
.stage-hero { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; align-content: center; gap: 20px; padding: 26px; text-align: center; overflow: hidden; }
.stage-hero[hidden] { display: none; }
.xi-orb {
  --orb-scale: calc(1 + (var(--xi-level) * .035));
  --orb-glow: calc(.78 + (var(--xi-level) * .22));
  position: relative; width: 220px; height: 220px; display: grid; place-items: center;
  transform: scale(var(--orb-scale)); transition: transform 90ms linear, filter 180ms ease;
  filter: saturate(1.05) brightness(var(--orb-glow));
}
.xi-orb__halo { position: absolute; inset: 26px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,158,223,.30) 0%, rgba(168,108,255,.22) 28%, rgba(124,60,255,.10) 56%, transparent 73%);
  filter: blur(11px); animation: xi-halo-breathe 4.8s ease-in-out infinite; }
.xi-orb__ring { position: absolute; border-radius: 50%; border: 1px dotted rgba(214,181,255,.5);
  box-shadow: 0 0 14px rgba(124,60,255,.2), inset 0 0 10px rgba(227,75,191,.08); opacity: calc(.55 + (var(--xi-level) * .25)); }
.xi-orb__ring--one { width: 198px; height: 198px; animation: xi-spin 18s linear infinite; }
.xi-orb__ring--two { width: 166px; height: 166px; border-style: dashed; opacity: .4; animation: xi-spin-reverse 13s linear infinite; }
.xi-orb__ring--three { width: 134px; height: 134px; border-color: rgba(255,118,214,.26); animation: xi-spin 9s linear infinite; }
.xi-orb__core { position: relative; z-index: 4; width: 98px; height: 98px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, rgba(255,255,255,.95) 0 4%, rgba(255,190,238,.86) 13%, rgba(184,93,255,.92) 38%, rgba(94,35,205,.95) 69%, rgba(29,10,68,.98) 100%);
  border: 1px solid rgba(255,255,255,.34);
  box-shadow: inset 0 3px 10px rgba(255,255,255,.4), inset 0 -12px 22px rgba(29,10,68,.55), 0 0 24px rgba(168,108,255,.68), 0 0 58px rgba(227,75,191,.32);
  animation: xi-core-breathe 3.6s ease-in-out infinite; }
.xi-orb__core span { font-size: 30px; line-height: 1; font-weight: 900; letter-spacing: .07em; color: var(--xi-white);
  text-shadow: 0 0 9px rgba(255,255,255,.94), 0 0 20px rgba(255,158,223,.8); }
.xi-orb__wave { position: absolute; z-index: 3; width: 190px; height: 42px; overflow: visible; opacity: calc(.5 + (var(--xi-level) * .3)); filter: drop-shadow(0 0 5px rgba(119,231,255,.44)); }
.xi-orb__wave path { fill: none; stroke: var(--xi-cyan); stroke-width: 1.4; stroke-linecap: round; stroke-dasharray: 5 7; animation: xi-wave-drift 5s linear infinite; }
.xi-orb__particles { position: absolute; inset: 0; animation: xi-spin 26s linear infinite; }
.xi-orb__particles i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: var(--xi-pink); box-shadow: 0 0 8px var(--xi-pink); animation: xi-particle-float 3.2s ease-in-out infinite alternate; }
.xi-orb__particles i:nth-child(1) { left: 12%; top: 48%; }
.xi-orb__particles i:nth-child(2) { left: 22%; top: 16%; animation-delay: -.8s; }
.xi-orb__particles i:nth-child(3) { left: 48%; top: 4%; animation-delay: -1.4s; background: var(--xi-cyan); }
.xi-orb__particles i:nth-child(4) { right: 20%; top: 16%; animation-delay: -2.1s; }
.xi-orb__particles i:nth-child(5) { right: 8%; top: 44%; animation-delay: -.4s; background: var(--xi-cyan); }
.xi-orb__particles i:nth-child(6) { right: 15%; bottom: 20%; animation-delay: -1.8s; }
.xi-orb__particles i:nth-child(7) { left: 49%; bottom: 4%; animation-delay: -.9s; }
.xi-orb__particles i:nth-child(8) { left: 17%; bottom: 18%; animation-delay: -2.5s; background: var(--xi-cyan); }
.xi-orb__floor { position: absolute; z-index: 0; left: 50%; bottom: 2px; width: 184px; height: 34px; transform: translateX(-50%) perspective(100px) rotateX(64deg);
  border-radius: 50%; background: radial-gradient(ellipse, rgba(227,75,191,.4), rgba(124,60,255,.17) 42%, transparent 72%); filter: blur(7px); animation: xi-floor-breathe 4.8s ease-in-out infinite; }
.stage-hero__copy { max-width: 560px; position: relative; z-index: 5; }
.stage-kicker { margin: 0 0 5px; font-size: 10px; font-weight: 800; letter-spacing: .22em; color: var(--xi-pink); }
.stage-hero__copy h2 { margin: 0 0 6px; font-size: clamp(19px, 2.6vw, 27px); color: var(--xi-white); }
.stage-hero__copy p { margin: 0 auto; max-width: 500px; color: rgba(241,232,255,.68); line-height: 1.6; font-size: 13px; }
.stage-hero__badges { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.stage-hero__badges span { padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(184,139,255,.2); background: rgba(124,60,255,.08); color: rgba(245,238,255,.74); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; }

.xi-orb[data-state="listening"] { filter: saturate(1.08) drop-shadow(0 0 14px rgba(98,245,197,.32)); }
.xi-orb[data-state="listening"] .xi-orb__ring { border-color: rgba(98,245,197,.6); }
.xi-orb[data-state="listening"] .xi-orb__wave path { stroke: var(--xi-listening); animation-duration: 1.8s; }
.xi-orb[data-state="speaking"] .xi-orb__wave path { stroke: var(--xi-speaking); animation-duration: 1.2s; }
.xi-orb[data-state="speaking"] .xi-orb__core { animation-duration: .78s; }
.xi-orb[data-state="thinking"] .xi-orb__ring--one { animation-duration: 7s; }
.xi-orb[data-state="thinking"] .xi-orb__ring--two { animation-duration: 5s; }

@keyframes xi-spin { to { transform: rotate(360deg); } }
@keyframes xi-spin-reverse { to { transform: rotate(-360deg); } }
@keyframes xi-halo-breathe { 0%,100% { transform: scale(.94); opacity: .56; } 50% { transform: scale(1.06); opacity: .9; } }
@keyframes xi-core-breathe { 0%,100% { transform: scale(.985); } 50% { transform: scale(1.035); } }
@keyframes xi-floor-breathe { 0%,100% { opacity: .48; transform: translateX(-50%) perspective(100px) rotateX(64deg) scaleX(.88); } 50% { opacity: .8; transform: translateX(-50%) perspective(100px) rotateX(64deg) scaleX(1.06); } }
@keyframes xi-particle-float { from { transform: translateY(-3px) scale(.85); opacity: .4; } to { transform: translateY(5px) scale(1.35); opacity: 1; } }
@keyframes xi-wave-drift { to { stroke-dashoffset: -72; } }

/* ---- premium chat bubbles (role label + timestamp, replaces bare text) ---- */
.chat-msg { display: flex; flex-direction: column; gap: 5px; }
.chat-msg__meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-msg__role { font-size: 9px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-3, #ff9edf); opacity: .8; }
.chat-msg.user .chat-msg__role { color: #fff; opacity: .85; }
.chat-msg__time { font-size: 9px; color: var(--text-dim); white-space: nowrap; opacity: .7; }
.chat-msg__body { font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; }
.chat-msg__provider { font-size: 10px; color: var(--text-dim); }
.chat-msg__actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 2px; }
.chat-msg__action { appearance: none; border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; background: var(--panel); color: var(--text); font: inherit; font-size: 10.5px; font-weight: 700; cursor: pointer; }
.chat-msg__action:hover { border-color: var(--accent); color: var(--accent); }
.chat-msg.thinking .chat-msg__body { font-style: italic; color: var(--text-dim); }
.chat-msg.stopped { opacity: .62; }
.chat-msg.stopped .chat-msg__role::after { content: " · STOPPED"; color: var(--warn); letter-spacing: .1em; }
.chat-msg.error { border-color: rgba(255,92,92,.4) !important; }

/* ---- media review (approve/revise/regenerate before it enters the draft) ---- */
.media-review { display: grid; gap: 12px; text-align: left; width: 100%; }
.media-review__frame { display: grid; place-items: center; }
.media-review__frame img, .media-review__frame video { max-width: 100%; max-height: 420px; border-radius: 12px; }
.media-review__meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text-dim); }
.media-review__provider { font-weight: 800; color: var(--accent-2); text-transform: uppercase; font-size: 10.5px; letter-spacing: .05em; }
.media-review__actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  .xi-orb * { animation: none !important; }
  .xi-orb { transition: none; }
}
