:root {
  --bg: #f8f8f7;
  --sidebar: #ebebea;
  --card: #ffffff;
  --card-2: #f4f4f3;
  --pill: #ededeb;
  --pill-hover: #e3e3e1;
  --text: #34322d;
  --text-2: #5e5d59;
  --muted: #858481;
  --faint: #b9b8b4;
  --border: #e5e5e3;
  --border-strong: #d6d6d3;
  --accent: #1a1a19;
  --accent-text: #ffffff;
  --blue: #0081f2;
  --green: #25ba3b;
  --red: #d9453b;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --term-bg: #f7f7f6;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --serif: "Libre Baskerville", ui-serif, Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #272728; --sidebar: #212122; --card: #363537; --card-2: #2f2f30; --pill: #3a3a3c; --pill-hover: #444446;
    --text: #dadada; --text-2: #b5b5b5; --muted: #8e8e8e; --faint: #5f5f60; --border: #3d3d3f; --border-strong: #4a4a4c;
    --accent: #f1f1f0; --accent-text: #1a1a19; --term-bg: #2c2c2d;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.3); --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #272728; --sidebar: #212122; --card: #363537; --card-2: #2f2f30; --pill: #3a3a3c; --pill-hover: #444446;
  --text: #dadada; --text-2: #b5b5b5; --muted: #8e8e8e; --faint: #5f5f60; --border: #3d3d3f; --border-strong: #4a4a4c;
  --accent: #f1f1f0; --accent-text: #1a1a19; --term-bg: #2c2c2d;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.3); --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
code { font-family: var(--mono); font-size: 0.9em; }
[hidden] { display: none !important; }

#app { display: flex; height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 300px; flex: none; background: var(--sidebar); display: flex; flex-direction: column;
  padding: 12px 8px 10px; transition: margin-left .2s ease; border-right: 1px solid transparent;
}
.sidebar.collapsed { margin-left: -300px; }
.sb-top { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; }
.sb-top-right { display: flex; gap: 2px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--pill-hover); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; }
.new-task {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; margin: 0 4px 8px;
  background: var(--card); border-radius: 10px; box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  font-weight: 500; color: var(--text);
}
.new-task:hover { background: var(--card-2); }
.new-task kbd { margin-left: auto; font: 11px var(--mono); color: var(--muted); background: var(--card-2); border-radius: 5px; padding: 1px 6px; }
.nt-icon { display: inline-flex; }
.sb-search { padding: 0 4px 8px; }
.sb-search input { width: 100%; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); padding: 0 10px; outline: none; }
.task-list { flex: 1; overflow-y: auto; padding: 0 4px; display: flex; flex-direction: column; gap: 2px; }
.task-item {
  display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; cursor: pointer; position: relative; text-align: left;
}
.task-item:hover { background: var(--pill-hover); }
.task-item.active { background: var(--card); box-shadow: var(--shadow-sm); }
.ti-icon {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border); color: var(--text-2); position: relative;
}
.task-item.active .ti-icon { background: var(--card-2); }
.ti-icon .run-dot { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); border: 2px solid var(--sidebar); }
.ti-main { min-width: 0; flex: 1; }
.ti-row { display: flex; align-items: baseline; gap: 6px; }
.ti-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.ti-time { font-size: 12px; color: var(--muted); flex: none; }
.ti-preview { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ti-del { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); opacity: 0; background: var(--card); width: 26px; height: 26px; }
.task-item:hover .ti-del { opacity: 1; }
.task-item:hover .ti-time { visibility: hidden; }
.sb-empty { color: var(--muted); font-size: 13px; padding: 24px 12px; text-align: center; }
.sb-footer { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 0; border-top: 1px solid var(--border); margin-top: 6px; }
.sb-brand { display: flex; align-items: center; gap: 8px; }
.logo-mark { display: inline-flex; width: 22px; height: 22px; }
.logo-mark svg { width: 100%; height: 100%; }
.wordmark { font-family: var(--serif); font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.model-tag { font-size: 11.5px; color: var(--muted); background: var(--pill); border-radius: 999px; padding: 2px 8px; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; position: relative; display: flex; }
.sb-open { position: absolute; top: 12px; left: 12px; z-index: 5; display: none; }
.sidebar.collapsed + .main .sb-open { display: inline-flex; }

/* Home */
.home { flex: 1; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 0 16px; }
.home-inner { width: 100%; max-width: 768px; padding-top: 22vh; }
.greeting {
  font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.35; margin: 0 0 28px; letter-spacing: -0.01em;
}
.greeting span { color: var(--muted); }
.key-warning { background: #fff4e5; color: #8a5300; border: 1px solid #f5d9a8; border-radius: 10px; padding: 8px 12px; margin-bottom: 20px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; justify-content: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card); color: var(--text-2); font-size: 13.5px;
}
.chip:hover { background: var(--card-2); color: var(--text); }
.chip svg.i { width: 16px; height: 16px; }

/* Composer */
.composer {
  background: var(--card); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow);
  padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s;
}
.composer:focus-within { border-color: var(--border-strong); }
.composer textarea {
  border: 0; outline: none; resize: none; background: transparent; min-height: 46px; max-height: 240px;
  padding: 2px 6px; font-size: 15px; line-height: 1.5;
}
.composer textarea::placeholder { color: var(--faint); }
.cmp-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px; }
.cmp-file { display: inline-flex; align-items: center; gap: 6px; background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px 6px 4px 10px; font-size: 12.5px; }
.cmp-file button { color: var(--muted); display: inline-flex; }
.cmp-row { display: flex; align-items: center; gap: 6px; }
.cmp-row .spacer { flex: 1; }
.round-btn {
  width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); color: var(--text-2);
}
.round-btn:hover { background: var(--card-2); }
.model-pick { position: relative; }
.model-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-2); font-size: 13px;
}
.model-btn:hover { background: var(--card-2); }
.model-btn svg.i { width: 14px; height: 14px; }
.model-btn svg.i.sm { width: 12px; height: 12px; color: var(--muted); }
.model-menu {
  position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 40; width: 300px; background: var(--card);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 6px;
}
.home .model-menu { bottom: auto; top: calc(100% + 8px); }
.mm-head { font-size: 12px; color: var(--muted); padding: 4px 10px 6px; }
.mm-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px; }
.mm-item:hover { background: var(--card-2); }
.mm-main { flex: 1; min-width: 0; }
.mm-name { font-weight: 500; display: flex; align-items: baseline; gap: 8px; }
.mm-price { font-size: 11.5px; color: var(--muted); font-weight: 400; font-family: var(--mono); }
.mm-desc { font-size: 12.5px; color: var(--muted); }
.mm-check { width: 16px; color: var(--blue); display: inline-flex; }
.mm-check svg.i { width: 16px; height: 16px; }
.mm-foot { font-size: 11px; color: var(--faint); padding: 6px 10px 2px; border-top: 1px solid var(--border); margin-top: 4px; }
.send-btn { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--pill); color: var(--faint); transition: background .15s; }
.send-btn.ready { background: var(--accent); color: var(--accent-text); }
.send-btn.stop { background: var(--accent); color: var(--accent-text); }
.send-btn svg.i { width: 16px; height: 16px; stroke-width: 2.2; }

/* Task view */
.task { flex: 1; display: flex; min-width: 0; gap: 0; }
.chat-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task-header { height: 56px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 16px 0 20px; gap: 12px; }
.sidebar.collapsed + .main .task-header { padding-left: 56px; }
.task-title { font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-actions { display: flex; gap: 4px; align-items: center; flex: none; }
.ghost-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; color: var(--text-2); font-size: 13px; }
.ghost-btn:hover { background: var(--pill-hover); }
.ghost-btn .ic { display: inline-flex; }
.ghost-btn svg.i { width: 16px; height: 16px; }
.timeline-scroll { flex: 1; overflow-y: auto; padding: 0 16px; }
.timeline { max-width: 768px; margin: 0 auto; padding: 8px 0 24px; display: flex; flex-direction: column; gap: 18px; }
.bottom { flex: none; padding: 0 16px 16px; }
.bottom > * { max-width: 768px; margin-left: auto; margin-right: auto; }
.bottom .composer { border-radius: 20px; }
.bottom .composer textarea { min-height: 24px; }

/* Messages */
.msg-user { align-self: flex-end; max-width: 80%; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg-user .bubble {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px;
  white-space: pre-wrap; word-wrap: break-word;
}
.msg-user .att { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.msg-time { font-size: 12px; color: var(--faint); }

.agent { display: flex; flex-direction: column; gap: 12px; }
.agent-head { display: flex; align-items: center; gap: 8px; height: 24px; }
.agent-head .logo-mark { width: 22px; height: 22px; }
.agent-head .wordmark { font-size: 16px; }
.agent-head .badge { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; }

.md { word-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4 { margin: 18px 0 8px; line-height: 1.35; font-weight: 600; }
.md h1 { font-size: 20px; } .md h2 { font-size: 17px; } .md h3 { font-size: 15px; } .md h4 { font-size: 14px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md a { color: var(--blue); text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md code { background: var(--pill); border-radius: 4px; padding: 1px 5px; }
.md pre { background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.55; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 10px; padding: 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.md img { max-width: 100%; border-radius: 8px; }
.table-wrap { overflow-x: auto; margin: 0 0 12px; border: 1px solid var(--border); border-radius: 10px; }
.md table { border-collapse: collapse; width: 100%; font-size: 13px; }
.md th, .md td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.md th { background: var(--card-2); font-weight: 600; }
.md tr:last-child td { border-bottom: 0; }

.step { display: flex; flex-direction: column; }
.step-head { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 2px 0; user-select: none; }
.step-head .st-title { font-weight: 500; flex: 1; }
.step-head .chev { color: var(--muted); transition: transform .15s; display: inline-flex; }
.step.collapsed .chev { transform: rotate(-90deg); }
.st-icon { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.st-icon.done { color: var(--green); }
.st-icon.pending { color: var(--faint); }
.st-icon.running { color: var(--blue); }
.step-body { margin: 6px 0 0 8px; padding: 2px 0 2px 18px; border-left: 1px dashed var(--border-strong); display: flex; flex-direction: column; gap: 10px; }
.step.collapsed .step-body { display: none; }
.step-body .md { color: var(--text-2); font-size: 13.5px; }

.tool-pill {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; align-self: flex-start;
  background: var(--pill); border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 13px; color: var(--text-2);
  cursor: pointer; transition: background .15s; border: 1px solid transparent;
}
.tool-pill:hover { background: var(--pill-hover); }
.tool-pill.selected { border-color: var(--border-strong); }
.tool-pill svg.i { width: 15px; height: 15px; }
.tool-pill .tp-label { flex: none; }
.tool-pill .tp-arg { font-family: var(--mono); font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tool-pill.running .tp-icon { animation: pulse 1.2s ease-in-out infinite; }
.tool-pill.error { color: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }

.thinking { align-self: flex-start; }
.thinking-head { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; cursor: pointer; }
.thinking-head .chev { display: inline-flex; transition: transform .15s; transform: rotate(-90deg); }
.thinking.open .thinking-head .chev { transform: none; }
.thinking-body { display: none; margin-top: 6px; padding-left: 12px; border-left: 2px solid var(--border); color: var(--muted); font-size: 13px; white-space: pre-wrap; }
.thinking.open .thinking-body { display: block; }
.thinking.live .thinking-head span.lbl { background: linear-gradient(90deg, var(--muted) 30%, var(--faint) 50%, var(--muted) 70%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.notice { color: var(--muted); font-size: 13px; }
.error-box { color: var(--red); background: color-mix(in srgb, var(--red) 8%, transparent); border: 1px solid color-mix(in srgb, var(--red) 25%, transparent); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.completed { display: flex; align-items: center; gap: 6px; color: var(--green); font-size: 13.5px; font-weight: 500; }
.working { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--blue); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.file-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; text-align: left; min-width: 0;
}
.file-card:hover { background: var(--card-2); }
.fc-icon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: none; color: #fff; font: 600 10px var(--mono); }
.fc-main { min-width: 0; }
.fc-name { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-meta { font-size: 12px; color: var(--muted); }
.files-all { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; }
.files-all:hover { color: var(--text); }

/* Plan card */
.plan-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; margin-bottom: 10px; box-shadow: var(--shadow-sm); overflow: hidden; }
.plan-summary { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.plan-summary .ps-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-summary .ps-count { color: var(--muted); font-size: 13px; flex: none; }
.plan-summary .chev { color: var(--muted); display: inline-flex; transition: transform .15s; }
.plan-card.open .plan-summary .chev { transform: rotate(180deg); }
.plan-list { display: none; padding: 2px 14px 12px; flex-direction: column; gap: 6px; }
.plan-card.open .plan-list { display: flex; }
.plan-item { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.plan-item.pending { color: var(--muted); }
.plan-item.done span:last-child { color: var(--text-2); }

/* Computer panel */
.computer {
  width: min(50%, 720px); flex: none; margin: 12px 12px 12px 0; background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; padding: 16px; min-width: 0;
}
.cp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cp-title { font-weight: 600; font-size: 16px; }
.cp-status { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-height: 40px; }
.cp-app { width: 40px; height: 40px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-2); flex: none; }
.cp-app svg.i { width: 20px; height: 20px; }
.cp-status-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cp-using { font-size: 13px; color: var(--muted); }
.cp-using b { color: var(--text-2); font-weight: 500; }
.cp-action { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); background: var(--pill); border-radius: 999px; padding: 1px 10px; max-width: 100%; align-self: flex-start; }
.cp-action code { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cp-window { flex: 1; min-height: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; background: var(--term-bg); }
.cp-window-bar { min-height: 36px; flex-wrap: wrap; flex: none; display: flex; align-items: center; justify-content: center; padding: 0 12px; border-bottom: 1px solid var(--border); background: var(--card-2); font-size: 12.5px; color: var(--muted); gap: 8px; min-width: 0; }
.cp-window-bar .url { flex: 1; background: var(--card); border: 1px solid var(--border); border-radius: 7px; padding: 2px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 11.5px; }
.cp-window-bar .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-body { flex: 1; overflow: auto; min-height: 0; }
.cp-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 13px; padding: 24px; text-align: center; }
.term { font: 12.5px/1.6 var(--mono); padding: 12px 14px; white-space: pre-wrap; word-break: break-word; color: var(--text); }
.term .prompt { color: var(--green); }
.term .cmd { color: var(--text); font-weight: 600; }
.term .out { color: var(--text-2); }
.editor { font: 12.5px/1.6 var(--mono); padding: 10px 0; display: grid; grid-template-columns: auto 1fr; }
.editor .ln { color: var(--faint); text-align: right; padding: 0 12px 0 14px; user-select: none; white-space: pre; }
.editor .code { white-space: pre-wrap; word-break: break-word; padding-right: 14px; color: var(--text); }
.editor-md { padding: 16px 20px; }
.shot { display: block; width: 100%; height: auto; }
.search-results { padding: 8px 14px; display: flex; flex-direction: column; }
.sr { padding: 10px 0; border-bottom: 1px solid var(--border); }
.sr:last-child { border-bottom: 0; }
.sr a { color: var(--blue); text-decoration: none; font-weight: 500; font-size: 14px; }
.sr a:hover { text-decoration: underline; }
.sr .sr-url { font-size: 12px; color: var(--green); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fetch-text { padding: 14px 18px; font-size: 13px; color: var(--text-2); white-space: pre-wrap; }
.cp-controls { display: flex; align-items: center; gap: 4px; margin-top: 12px; }
.cp-controls input[type=range] { flex: 1; margin: 0 8px; accent-color: var(--blue); height: 4px; }
.live-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); }
.live-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.live-btn.on { color: var(--text-2); }
.live-btn.on .dot { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px; }
.modal-card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); width: min(1000px, 100%); height: min(86vh, 900px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--border); gap: 12px; }
.modal-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-actions { display: flex; gap: 4px; flex: none; }
.modal-body { flex: 1; overflow: auto; min-height: 0; }
.modal-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.modal-body .md { padding: 24px 32px; max-width: 860px; margin: 0 auto; }
.modal-body pre.raw { margin: 0; padding: 16px 20px; font: 12.5px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; }
.modal-body img.full { max-width: 100%; display: block; margin: 16px auto; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--border); cursor: pointer; }
.file-row:hover { background: var(--card-2); }

/* Responsive */
@media (max-width: 1000px) {
  .computer { position: fixed; inset: 8px; width: auto; margin: 0; z-index: 20; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; z-index: 30; height: 100%; box-shadow: var(--shadow); }
  .greeting { font-size: 26px; }
  .home-inner { padding-top: 14vh; }
}

.tabstrip { display: flex; gap: 4px; flex-basis: 100%; overflow-x: auto; padding-top: 6px; }
.tabstrip .tab { flex: none; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 10px; border-radius: 7px 7px 0 0; background: var(--pill); color: var(--muted); font-size: 11.5px; }
.tabstrip .tab.active { background: var(--card); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.cp-window-bar .url { margin: 4px 0; }
.live-badge { display: inline-flex; align-items: center; gap: 5px; font: 700 10.5px var(--mono); color: var(--red); flex: none; }
.live-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: pulse 1.2s ease-in-out infinite; }

.btn { display: inline-flex; align-items: center; justify-content: center; height: 34px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border-strong); font-weight: 500; font-size: 13.5px; }
.btn:hover { background: var(--card-2); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { opacity: .88; }
.btn.sm { height: 26px; padding: 0 12px; font-size: 12px; flex: none; }
.ask-card { border: 1px solid var(--border-strong); border-radius: 14px; padding: 12px 14px; background: var(--card); display: flex; flex-direction: column; gap: 8px; }
.ask-card.pending { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent); }
.ask-head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.ask-head svg.i { width: 18px; height: 18px; color: var(--blue); }
.ask-note { height: 34px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-2); padding: 0 12px; outline: none; }
.ask-actions { display: flex; gap: 8px; }
.ask-hint { font-size: 12.5px; color: var(--muted); }
.ask-result { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.ask-result.yes { color: var(--green); } .ask-result.no { color: var(--red); }
.ask-result svg.i { width: 16px; height: 16px; }
img.interactive { cursor: pointer; outline: none; }
img.interactive:focus { box-shadow: inset 0 0 0 2px var(--blue); }
.computer.takeover { width: min(78%, 980px); }
@media (max-width: 1000px) { .computer.takeover { width: auto; } }
.chat-col { min-width: 340px; }
.computer.takeover { flex: 0 1 auto; }
@media (max-width: 1000px) { .chat-col { min-width: 0; } }

.sb-foot-right { display: flex; align-items: center; gap: 4px; }
.cred-form { display: flex; flex-direction: column; gap: 8px; }
.cred-form input { height: 36px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-2); padding: 0 12px; outline: none; }
.cred-form input:focus { border-color: var(--border-strong); }
.ask-hint svg.i { width: 13px; height: 13px; vertical-align: -2px; }
