:root {
  --bg: #03090d;
  --panel: #06151c;
  --panel-2: #0a1d27;
  --panel-3: #0d2834;
  --line: #17475a;
  --line-soft: #103441;
  --accent: #35dcff;
  --accent-soft: rgba(53,220,255,.12);
  --ivory: #edf8fa;
  --text: #d5e9ee;
  --muted: #789ba7;
  --faint: #4d7481;
  --error: #ff776f;
  --display: Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); overflow: hidden; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.auth-check, .login-shell { min-height: 100%; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-card { width: min(420px, calc(100vw - 32px)); padding: 38px; border: 1px solid var(--line); background: rgba(6,21,28,.96); box-shadow: 0 28px 100px #000; }
.login-logo { width: 48px; height: 48px; margin-bottom: 24px; }
.eyebrow { color: var(--accent); font: 700 .72rem var(--mono); letter-spacing: .22em; margin: 0 0 8px; }
h1 { font: 600 2.2rem/1.05 var(--display); color: var(--ivory); margin: 0 0 12px; }
.muted { color: var(--muted); line-height: 1.55; margin-bottom: 28px; }
.login-card label { display: grid; gap: 8px; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.login-card input { width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text); padding: 13px; outline: none; }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.primary, .send { border: 1px solid var(--accent); background: var(--accent); color: #021116; font-weight: 800; cursor: pointer; }
.primary { width: 100%; margin-top: 16px; padding: 13px; }
.error { color: var(--error); font-size: .85rem; }
.app-shell { height: 100%; display: flex; flex-direction: column; min-height: 0; background: radial-gradient(circle at 72% 20%, rgba(28,142,173,.16), transparent 35%), var(--bg); }
.topbar { height: 72px; flex: 0 0 72px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; background: rgba(3,9,13,.92); }
.brand { display: flex; gap: 11px; align-items: center; }
.brand img { width: 38px; height: 38px; }
.brand div { display: grid; }
.brand span { color: var(--accent); font: 700 .64rem var(--mono); letter-spacing: .2em; }
.brand strong { color: var(--ivory); font: 600 1.15rem var(--display); }
.top-actions { display: flex; align-items: center; gap: 9px; }
.status-dot { font: 700 .68rem var(--mono); color: var(--accent); letter-spacing: .08em; padding: 8px 10px; border: 1px solid var(--line); }
.status-dot i { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.ghost { border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 8px 11px; text-decoration: none; cursor: pointer; }
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(430px, 1fr) 310px 360px; }
.column { min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: rgba(6,21,28,.72); }
.column:last-child { border-right: 0; }
.column-title { flex: 0 0 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line-soft); color: var(--ivory); font: 700 .73rem var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.column-title small { color: var(--faint); font: 500 .67rem var(--mono); letter-spacing: 0; text-transform: none; }
.thread { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 22px max(18px, 5vw); display: flex; flex-direction: column; gap: 18px; }
.empty { margin: auto; max-width: 380px; color: var(--faint); text-align: center; line-height: 1.6; }
.empty.compact { margin: 20px; font-size: .84rem; }
.message { display: grid; gap: 7px; min-width: 0; max-width: min(780px, 94%); }
.message.user { align-self: flex-end; justify-items: end; }
.message.assistant { align-self: flex-start; }
.message-meta { color: var(--faint); font: 600 .64rem var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.bubble { min-width: 0; max-width: 100%; border: 1px solid var(--line); background: var(--panel-2); padding: 13px 15px; line-height: 1.55; font-size: .93rem; overflow-wrap: anywhere; }
.user .bubble { background: var(--accent-soft); border-color: #1b7088; }
.bubble p { margin: 0 0 10px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble pre { min-width: 0; max-width: 100%; overflow: auto; background: #020608; border: 1px solid var(--line); padding: 12px; color: #cdeef5; font: .78rem/1.5 var(--mono); }
.bubble code { font-family: var(--mono); color: var(--accent); }
.bubble a { color: var(--accent); }
.message-actions { display: flex; gap: 7px; }
.mini { border: 0; background: none; color: var(--faint); padding: 2px; cursor: pointer; font-size: .73rem; }
.mini:hover { color: var(--accent); }
.mini:disabled { opacity: .65; cursor: wait; }
.audio-stop { color: #ffaaa5; }
.message-images { display: flex; flex-wrap: wrap; gap: 7px; min-width: 0; max-width: 100%; overflow: hidden; }
.message-images img { width: 92px; height: 92px; object-fit: cover; border: 1px solid var(--line); }
.pending-bubble { color: var(--muted); font-style: italic; }
.error-bubble { border-color: #6b302d; color: #ffaaa5; }
.composer { flex: 0 0 auto; display: flex; align-items: flex-end; gap: 8px; padding: 13px; border-top: 1px solid var(--line); background: var(--panel); }
.composer textarea { flex: 1; min-height: 44px; max-height: 150px; resize: none; border: 1px solid var(--line); background: var(--bg); color: var(--text); padding: 11px 12px; outline: none; line-height: 1.4; }
.composer textarea:focus { border-color: #24a9c8; }
.icon-button, .send { height: 44px; min-width: 44px; border-radius: 0; cursor: pointer; }
.icon-button { border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 1.1rem; }
.icon-button.active { border-color: var(--error); color: var(--error); animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255,119,111,0); background: rgba(255,119,111,.13); } }
.send { padding: 0 18px; }
.send:disabled { opacity: .4; cursor: wait; }
.reply-preview, .attachment-preview { flex: 0 0 auto; background: var(--panel-3); border-top: 1px solid var(--line); padding: 8px 14px; color: var(--muted); font-size: .77rem; }
.reply-preview { display: flex; justify-content: space-between; }
.reply-preview button { border: 0; background: none; color: var(--muted); cursor: pointer; }
.attachment-preview { display: flex; gap: 8px; overflow-x: auto; }
.attachment-chip { border: 1px solid var(--line); padding: 5px 8px; white-space: nowrap; }
.task-list, .activity { min-height: 0; overflow: auto; padding: 10px; }
.task-card { border: 1px solid var(--line-soft); background: var(--panel-2); padding: 11px; margin-bottom: 8px; }
.task-card.active { border-color: #1c7891; box-shadow: inset 2px 0 var(--accent); }
.task-state { color: var(--accent); font: 700 .62rem var(--mono); text-transform: uppercase; }
.task-title { color: var(--text); margin: 7px 0; font-size: .82rem; line-height: 1.35; }
.task-time { color: var(--faint); font: .64rem var(--mono); }
.activity-line { border-bottom: 1px dashed var(--line-soft); padding: 7px 3px; color: #92b5bf; font: .72rem/1.4 var(--mono); overflow-wrap: anywhere; }
.activity-line:last-child { color: var(--accent); }
.drawer-button, .mobile-drawer, .drawer-scrim { display: none; }
.full { width: calc(100% - 20px); margin: 10px; }
.voice-launch, .recording-overlay { display: none; }

@media (max-width: 1050px) and (min-width: 701px) {
  .workspace { grid-template-columns: minmax(400px, 1fr) 280px; }
  .activity-column { display: none; }
}
@media (max-width: 700px) {
  .mobile-view body, body.mobile-view { height: 100dvh; }
  .topbar { height: 60px; flex-basis: 60px; padding: env(safe-area-inset-top) 10px 0; }
  .brand img { width: 30px; height: 30px; }
  .brand strong { font-size: 1rem; }
  .brand span { font-size: .55rem; }
  .desktop-only, .top-actions .ghost:not(#logout) { display: none; }
  .status-dot { padding: 6px; font-size: .58rem; }
  .workspace { display: block; position: relative; min-height: 0; }
  .conversation-column { position: absolute; inset: 0; border: 0; }
  .task-column, .activity-column { display: none; }
  .thread { padding: 14px 12px; gap: 14px; }
  .voice-launch { display: flex; flex: 0 0 auto; align-items: center; gap: 15px; margin: 12px 12px 0; padding: 20px 18px; min-height: 104px; border: 0; border-radius: 20px; background: linear-gradient(135deg,#7eeecb,#35dcff); color: #021116; text-align: left; cursor: pointer; box-shadow: 0 12px 30px rgba(53,220,255,.14); }
  .voice-launch-icon { flex: 0 0 45px; font-size: 2.1rem; text-align: center; }
  .voice-launch span:last-child { display: grid; gap: 5px; }
  .voice-launch strong { font-size: 1.15rem; line-height: 1.15; }
  .voice-launch small { font-size: .83rem; line-height: 1.3; opacity: .78; }
  .message { min-width: 0; max-width: 94%; }
  .bubble { font-size: .9rem; padding: 11px 12px; }
  .composer { padding: 9px calc(9px + env(safe-area-inset-right)) calc(9px + env(safe-area-inset-bottom)) calc(9px + env(safe-area-inset-left)); }
  .composer textarea { min-width: 0; }
  .composer .mic { display: none; }
  .send { padding: 0 11px; }
  .drawer-button { display: block; border: 1px solid var(--line); background: transparent; color: var(--accent); padding: 5px 8px; font: .65rem var(--mono); }
  .mobile-drawer { display: flex; position: fixed; z-index: 20; top: 0; right: 0; bottom: 0; width: min(88vw, 360px); transform: translateX(102%); transition: transform .2s ease; background: var(--panel); flex-direction: column; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); box-shadow: -20px 0 60px #000; }
  .mobile-drawer.open { transform: none; }
  .mobile-drawer .task-list, .mobile-drawer .activity { flex: 1; }
  .drawer-head { min-height: 54px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 14px; color: var(--ivory); font-family: var(--display); }
  .drawer-head button { border: 0; background: none; color: var(--muted); font-size: 1.5rem; }
  .drawer-scrim { position: fixed; display: block; inset: 0; z-index: 19; background: rgba(0,0,0,.65); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .drawer-scrim.open { opacity: 1; pointer-events: auto; }
  .login-card { padding: 28px; }
  .recording-overlay { position: fixed; display: grid; inset: 0; z-index: 50; place-items: center; padding: max(24px,env(safe-area-inset-top)) 24px max(24px,env(safe-area-inset-bottom)); background: rgba(2,8,11,.97); }
  .recording-panel { width: min(100%,430px); display: flex; align-items: center; flex-direction: column; text-align: center; }
  .recording-mic { width: 132px; height: 132px; display: grid; place-items: center; border: 2px solid var(--accent); border-radius: 50%; background: rgba(53,220,255,.1); box-shadow: 0 0 0 18px rgba(53,220,255,.08); font-size: 3.2rem; }
  .recording-overlay.listening .recording-mic { animation: listening-pulse 1.45s ease-in-out infinite; }
  .recording-kicker { margin: 50px 0 8px; color: var(--accent); font: 700 .78rem var(--mono); letter-spacing: .12em; text-transform: uppercase; }
  .recording-panel h2 { margin: 0; color: var(--ivory); font: 600 2.15rem/1.1 var(--display); }
  .recording-help { min-height: 48px; margin: 14px 0 28px; color: var(--muted); line-height: 1.45; }
  .recording-finish { width: min(100%,330px); min-height: 66px; border: 0; border-radius: 999px; background: var(--accent); color: #021116; font-weight: 850; font-size: 1.08rem; cursor: pointer; }
  .recording-finish:disabled { opacity: .45; cursor: wait; }
  .recording-cancel { margin-top: 24px; padding: 12px 24px; border: 0; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
  .recording-overlay.processing .recording-cancel { visibility: hidden; }
}
@keyframes listening-pulse { 50% { box-shadow: 0 0 0 28px rgba(53,220,255,.035); transform: scale(1.025); } }
