:root {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-raised: #20201f;
  --surface-hover: #272726;
  --border: rgba(255,255,255,.10);
  --text: #f0efec;
  --text-secondary: #c3c2b7;
  --muted: #898781;
  --accent: #3987e5;
  --accent-soft: rgba(57,135,229,.14);
  --anthropic: #d95926;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --radius: 14px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text); font-size: 14px; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { border: 0; background: none; }
.app-shell { display: grid; grid-template-columns: 272px minmax(0,1fr) 320px; height: 100dvh; overflow: hidden; }
.sidebar, .inspector { background: var(--surface); min-height: 0; }
.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--border); padding: 18px 14px 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: white; font-size: 19px; font-weight: 750; }
.brand strong { display: block; font-size: 16px; letter-spacing: -.01em; }
.brand div span { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.preview-badge { margin-left: auto; align-self: flex-start; padding: 3px 5px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); font-size: 8px; letter-spacing: .08em; }
.new-chat, .primary-button { display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; background: var(--accent); color: white; font-weight: 650; padding: 11px 14px; }
.new-chat { width: 100%; margin-bottom: 12px; }
.new-chat span { font-size: 19px; font-weight: 400; }
.primary-button:hover, .new-chat:hover, .send-button:hover { filter: brightness(1.1); }
.search-box { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 9px; color: var(--muted); background: var(--page); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; }
.search-box input::placeholder { color: var(--muted); }
.search-box kbd { font-size: 9px; white-space: nowrap; font-family: inherit; }
.section-label { margin: 12px 9px 7px; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.project { display: flex; align-items: center; width: 100%; gap: 10px; text-align: left; padding: 10px 9px; border-radius: 10px; }
.project:hover, .project.active { background: var(--surface-hover); }
.project > span:nth-child(2) { flex: 1; min-width: 0; }
.project strong, .recent strong { display: block; overflow: hidden; font-size: 12px; font-weight: 580; text-overflow: ellipsis; white-space: nowrap; }
.project small, .recent small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.project-dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.project-dot.blue { background: var(--accent); }.project-dot.orange { background: var(--anthropic); }.project-dot.aqua { background: #199e70; }
.chevron { color: var(--muted); font-size: 18px; }
.recent-block { min-height: 0; overflow-y: auto; flex: 1; }
.recent { display: flex; align-items: flex-start; width: 100%; gap: 8px; padding: 10px 9px; border-radius: 10px; text-align: left; }
.recent:hover, .recent.active { background: var(--accent-soft); }
.recent.active { box-shadow: inset 2px 0 var(--accent); }
.recent > span:last-child { min-width: 0; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); margin-top: 7px; flex: 0 0 auto; }
.recent.active .status-dot { background: var(--accent); }
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 10px; }
.sidebar-footer button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px; text-align: left; border-radius: 10px; }
.sidebar-footer button:hover { background: var(--surface-hover); }
.sidebar-footer button > span:nth-child(2) { flex: 1; }
.sidebar-footer small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--page); }
.topbar { z-index: 3; display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 22px; border-bottom: 1px solid var(--border); background: rgba(13,13,13,.94); backdrop-filter: blur(12px); }
.chat-heading { min-width: 0; flex: 1; }
.chat-heading strong { display: block; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.chat-heading > span { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: var(--muted); font-size: 10px; }
.online-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.provider-picker { display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 9px; padding: 6px 8px; background: var(--surface); }
.provider-picker select { max-width: 190px; border: 0; outline: 0; color: var(--text-secondary); background: transparent; font-size: 11px; }
.provider-picker option { background: var(--surface); color: var(--text); }
.provider-mark { display: inline-grid; place-items: center; width: 26px; height: 26px; flex: 0 0 auto; border-radius: 8px; background: var(--accent); color: white; font-size: 12px; font-weight: 750; }
.provider-mark.anthropic { background: var(--anthropic); }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 9px; color: var(--text-secondary); background: var(--surface); font-size: 18px; }
.icon-button:hover { background: var(--surface-hover); color: var(--text); }
.view { flex: 1; min-height: 0; overflow-y: auto; padding: 26px clamp(18px,3vw,44px); }
.view[hidden] { display: none !important; }
#view-chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 30px clamp(18px,4vw,56px) 20px; }
.message { display: flex; margin-bottom: 26px; }
.user-message { flex-direction: column; align-items: flex-end; }
.bubble { max-width: min(620px,88%); padding: 13px 16px; border-radius: 16px 16px 4px 16px; background: var(--accent); color: white; line-height: 1.55; }
.message-time { margin-top: 5px; color: var(--muted); font-size: 10px; }
.assistant-message { align-items: flex-start; gap: 12px; }
.assistant-avatar { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-weight: 750; }
.assistant-content { max-width: 760px; min-width: 0; line-height: 1.65; color: var(--text-secondary); }
.assistant-content p { margin: 10px 0; }
.assistant-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.assistant-meta strong { color: var(--text); font-size: 12px; }
.assistant-meta span { color: var(--muted); font-size: 10px; }
.tool-card { margin: 16px 0; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.tool-heading { display: flex; align-items: center; gap: 8px; padding: 11px 12px; font-size: 12px; }
.tool-icon { color: var(--accent); }
.status { font-size: 10px; font-weight: 550; }
.status.success { color: var(--good); }
.tool-heading .status { margin-left: auto; }
.tool-details { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 9px 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; }
.tool-details code { color: var(--text-secondary); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.composer-wrap { padding: 10px clamp(18px,4vw,56px) 18px; }
.composer { max-width: 900px; margin: 0 auto; padding: 9px 10px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); box-shadow: 0 8px 32px rgba(0,0,0,.2); }
.composer textarea { display: block; width: 100%; max-height: 140px; resize: none; border: 0; outline: 0; padding: 5px 42px 6px 5px; color: var(--text); background: transparent; line-height: 1.5; }
.composer textarea::placeholder { color: var(--muted); }
.attach-button { float: left; width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); font-size: 19px; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.composer-bottom > span { color: var(--muted); font-size: 9px; }
.send-button { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: white; font-size: 18px; }
.mobile-nav { display: none; }
.inspector { overflow-y: auto; border-left: 1px solid var(--border); padding: 16px 14px; }
.inspector-header { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 14px; }
.inspector-header strong { font-size: 15px; }
.inspector section { margin-bottom: 24px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.section-heading h2 { margin: 0; color: var(--text-secondary); font-size: 11px; font-weight: 650; }
.text-button { padding: 0; color: var(--accent); font-size: 10px; }
.text-button:hover { text-decoration: underline; }
.quota-card { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-raised); }
.quota-card + .quota-card { margin-top: 10px; }
.quota-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.quota-heading > div { flex: 1; min-width: 0; }
.quota-heading strong { display: block; font-size: 12px; }
.quota-heading small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.quota-state { color: var(--muted); font-size: 9px; }
.quota-state.active { color: var(--good); }
.meter-label { display: flex; justify-content: space-between; margin: 8px 0 5px; color: var(--text-secondary); font-size: 10px; }
.meter-label strong { font-weight: 600; }
.meter { height: 5px; overflow: hidden; border-radius: 5px; background: #184f95; }
.meter span { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.disconnected { border-style: dashed; }
.muted { color: var(--muted); font-size: 10px; line-height: 1.5; }
.secondary-button { padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px; color: var(--text-secondary); background: var(--surface); font-size: 11px; }
.secondary-button:hover { background: var(--surface-hover); color: var(--text); }
.full-width { width: 100%; }
.mini-task, .download-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 2px; text-align: left; }
.mini-task > div, .download-row > span:nth-child(2) { flex: 1; min-width: 0; }
.mini-task strong, .download-row strong { display: block; overflow: hidden; font-size: 11px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.mini-task small, .download-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.mini-task > span:last-child { color: var(--muted); font-size: 10px; }
.pulse-dot, .done-dot { width: 7px; height: 7px; border-radius: 50%; }
.pulse-dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.done-dot { background: var(--good); }
.download-row { border-radius: 9px; }
.download-row:hover { background: var(--surface-hover); }
.download-row .file-icon { width: 26px; height: 26px; }
.inspector-footer { padding-top: 12px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 10px; }
.inspector-footer small { margin-left: 5px; color: var(--muted); }
.view-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; max-width: 1050px; margin: 0 auto 24px; }
.view-header h1 { margin: 3px 0 5px; font-size: 24px; letter-spacing: -.02em; }
.view-header p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 12px; }
.eyebrow { margin: 0; color: var(--accent); font-size: 10px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(300px,1fr)); gap: 12px; max-width: 1050px; margin: 0 auto; }
.file-card { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.file-card > div { flex: 1; min-width: 0; }
.file-card strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.file-card div span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.file-card button { padding: 6px 8px; color: var(--accent); font-size: 10px; }
.file-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 700; }
.file-icon.android { background: rgba(25,158,112,.15); color: #199e70; }
.file-icon.windows { background: var(--accent-soft); color: var(--accent); }
.file-icon.apple { background: rgba(201,133,0,.16); color: #c98500; }
.file-icon.doc { background: rgba(144,133,233,.15); color: #9085e9; }
.task-list { display: grid; gap: 12px; max-width: 900px; margin: 0 auto; }
.task-card { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.task-card.running { border-color: rgba(57,135,229,.4); }
.task-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.task-status { color: var(--accent); font-weight: 600; }
.task-status.done { color: var(--good); }
.task-status.queued { color: var(--muted); }
.task-card h2 { margin: 10px 0 5px; font-size: 15px; }
.task-card p { margin: 0 0 12px; color: var(--muted); font-size: 11px; }
.task-card small { color: var(--text-secondary); font-size: 10px; }
.task-progress { height: 5px; margin: 12px 0; border-radius: 5px; background: #184f95; }
.task-progress span { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.settings-grid { display: grid; gap: 14px; max-width: 850px; margin: 0 auto; }
.settings-card { padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.settings-card h2 { margin: 0 0 15px; font-size: 14px; }
.connection-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.connection-row + .connection-row { border-top: 1px solid var(--border); }
.connection-row > div { flex: 1; }
.connection-row strong { display: block; font-size: 12px; }
.connection-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 10px 0; cursor: pointer; }
.toggle-row > span strong { display: block; font-size: 12px; }
.toggle-row > span small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.toggle-row input { position: absolute; opacity: 0; }
.toggle-row i { position: relative; width: 36px; height: 20px; border-radius: 20px; background: var(--surface-hover); transition: .2s; }
.toggle-row i::after { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-secondary); content: ""; transition: .2s; }
.toggle-row input:checked + i { background: var(--accent); }
.toggle-row input:checked + i::after { left: 19px; background: white; }
.danger-zone p { color: var(--muted); font-size: 11px; line-height: 1.6; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 8; background: rgba(0,0,0,.62); backdrop-filter: blur(2px); }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; max-width: calc(100vw - 32px); padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-raised); color: var(--text-secondary); box-shadow: 0 8px 32px rgba(0,0,0,.35); font-size: 11px; opacity: 0; pointer-events: none; transform: translate(-50%,12px); transition: .2s; }
.toast.visible { opacity: 1; transform: translate(-50%,0); }
.mobile-only { display: none; }
@media (max-width: 1240px) {
  .app-shell { grid-template-columns: 240px minmax(0,1fr) 285px; }
  .provider-picker select { max-width: 155px; }
}
@media (max-width: 1050px) {
  .app-shell { grid-template-columns: minmax(0,1fr) 300px; }
  .sidebar { position: fixed; z-index: 10; inset: 0 auto 0 0; width: 280px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 10px 0 30px rgba(0,0,0,.3); }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: inline-grid; }
}
@media (max-width: 780px) {
  .app-shell { display: block; }
  .main { height: 100dvh; }
  .inspector { position: fixed; z-index: 10; inset: 0 0 0 auto; width: min(340px,90vw); transform: translateX(100%); transition: transform .2s ease; box-shadow: -10px 0 30px rgba(0,0,0,.3); }
  .inspector.open { transform: translateX(0); }
  .topbar { gap: 8px; padding: 8px 10px; }
  .chat-heading strong { font-size: 12px; }
  .provider-picker { padding: 4px; }
  .provider-picker select { width: 108px; font-size: 10px; }
  .provider-picker .provider-mark { width: 23px; height: 23px; font-size: 10px; }
  .view { padding: 20px 14px 86px; }
  .chat-scroll { padding: 22px 14px 14px; }
  .composer-wrap { padding: 8px 10px 72px; }
  .composer-bottom > span { max-width: 200px; }
  .mobile-nav { position: absolute; z-index: 4; right: 0; bottom: 0; left: 0; display: flex; justify-content: space-around; padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: rgba(26,26,25,.98); backdrop-filter: blur(12px); }
  .mobile-nav button { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 60px; padding: 4px 8px; color: var(--muted); font-size: 9px; }
  .mobile-nav button span { font-size: 18px; }
  .mobile-nav button.active { color: var(--accent); }
  .view-header { align-items: flex-start; }
  .view-header h1 { font-size: 21px; }
  .view-header .primary-button, .view-header .secondary-button { flex-shrink: 0; padding: 8px; font-size: 10px; }
  .file-grid { grid-template-columns: 1fr; }
  .file-card strong { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 420px) {
  .provider-picker select { width: 88px; }
  .topbar-actions { gap: 5px; }
  .icon-button { width: 31px; height: 31px; }
  .assistant-meta { flex-direction: column; gap: 2px; }
  .bubble { max-width: 94%; }
  .view-header { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
