:root {
  color-scheme: dark;
  --bg: #0b0d13;
  --panel: #131826;
  --panel-2: #1a2235;
  --border: #2a3652;
  --text: #eef2ff;
  --muted: #a6b1c8;
  --accent: #8b5cf6;
  --good: #22c55e;
  --bad: #ef4444;
  --composer-space: 190px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; }
.centered { width: min(420px, calc(100vw - 28px)); margin: 7vh auto; padding: 20px; }
.app-shell { height: 100vh; display: grid; grid-template-rows: auto 1fr auto auto; }
.topbar { padding: 10px 12px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.topbar h1 { margin: 0; font-size: 18px; text-transform: lowercase; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
#workingText { color: #a78bfa; font-weight: 600; }
#quotaText { color: #93c5fd; font-weight: 600; }
.topbar-actions { display: flex; gap: 6px; }
.messages { overflow: auto; padding: 12px; padding-bottom: calc(var(--composer-space) + 20px); display: flex; flex-direction: column; gap: 8px; }
.message:last-child { scroll-margin-bottom: calc(var(--composer-space) + 16px); }
.approvals-stack { position: fixed; left: 10px; right: 10px; bottom: 170px; display: flex; flex-direction: column; gap: 8px; z-index: 20; pointer-events: none; }
.approval-item { pointer-events: auto; background: #2f2631; border: 1px solid #5a3d67; border-radius: 12px; padding: 10px; }
.composer-wrap { position: fixed; left: 0; right: 0; bottom: 54px; padding: 8px 10px 10px; background: linear-gradient(180deg, transparent, rgba(11,13,19,.95) 25%); z-index: 15; }
.composer { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.composer textarea { min-height: 64px; max-height: 180px; }
.composer-actions { display: flex; justify-content: flex-end; gap: 6px; padding-left: 10px; }
.left-actions-space { flex: 1; }
.dock { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1px; background: var(--border); z-index: 30; }
.dock-btn { border-radius: 0; border: 0; background: var(--panel); padding: 12px; font-weight: 600; }
.panel-sheet { position: fixed; left: 0; right: 0; bottom: 54px; max-height: 68vh; overflow: auto; background: #101523; border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; padding: 12px; z-index: 40; box-shadow: 0 -20px 40px rgba(0,0,0,.35); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.panel-head h2 { margin: 0; font-size: 16px; text-transform: lowercase; }
.thread-list, .setting-group { display: flex; flex-direction: column; gap: 8px; }
.thread-item, .message { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px; text-align: left; }
.thread-item.active { outline: 2px solid var(--accent); }
.thread-item.newly-created { border-color: #7c3aed; box-shadow: 0 0 0 1px rgba(139,92,246,.5) inset; }
.thread-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.thread-actions { display: flex; align-items: center; gap: 6px; }
.thread-actions .mini { font-size: 11px; padding: 5px 8px; border-radius: 8px; }
.new-pill { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #d8b4fe; background: rgba(124,58,237,.22); border: 1px solid rgba(167,139,250,.5); border-radius: 999px; padding: 2px 7px; }
.thread-preview { margin-top: 4px; color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thread-time { color: var(--muted); font-size: 11px; }
.message.user { border-left: 3px solid #38bdf8; }
.message.agent { border-left: 3px solid var(--accent); }
.message.command { border-left: 3px solid #f59e0b; }
.message.system { border-left: 3px solid #64748b; }
.message.command details { margin-top: 4px; }
.message.command summary { cursor: pointer; color: #f8cc7a; }
.message.command.collapsed pre { max-height: 90px; overflow: auto; }
.message small, .muted { color: var(--muted); }
input, select, textarea, button { font: inherit; color: var(--text); }
input, select, textarea { width: 100%; border: 1px solid var(--border); background: var(--panel-2); border-radius: 10px; padding: 10px; }
button { border: 0; border-radius: 10px; padding: 10px 12px; background: var(--accent); cursor: pointer; }
button.ghost { background: #27344f; }
button.approve { background: var(--good); }
button.decline { background: var(--bad); }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.row-buttons { display: flex; gap: 8px; margin: 4px 0 8px; }
.row-buttons > button { flex: 1; }
.folder-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.folder-name { font-weight: 600; }
summary { cursor: pointer; font-weight: 700; margin-bottom: 8px; }
.error { color: #fca5a5; min-height: 20px; }
pre { white-space: pre-wrap; word-break: break-word; margin: 6px 0 0; }
