/* Clyde design system: tokens first, components second. Light and dark themes share the same structure. */
:root {
  /* Neutral grey and black, light by default. The app follows the operating-system theme unless the user picks one. */
  --bg: #f5f5f4; --surface: #ffffff; --surface-2: #efeeec; --surface-3: #e4e3e0; --border: #e0dfdc; --border-strong: #c8c7c3;
  --text: #1f1e1d; --text-2: #44423f; --muted: #6c6a65; --accent: #262625; --accent-hover: #3c3b39; --accent-soft: #e9e8e5; --accent-contrast: #fafaf9;
  --danger: #b3382d; --danger-soft: #f8e6e3; --warn: #8f5a12; --warn-soft: #f6ecd9; --ok: #2f6f4b; --ok-soft: #e1f0e7; --focus: #262625;
  --code-bg: #f1f0ee; --diff-add: #dff0e5; --diff-del: #f6e0dd; --shadow: 0 1px 2px rgba(20,20,18,.06), 0 8px 24px rgba(20,20,18,.08);
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; --mono: ui-monospace, "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  --tok-keyword: #8a3f9a; --tok-string: #2f6f3a; --tok-comment: #8a8883; --tok-number: #a35a0b; --tok-function: #2a5aa8; --tok-type: #17706b;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1c1c1b; --surface: #262624; --surface-2: #2e2e2c; --surface-3: #393937; --border: #3a3a37; --border-strong: #4d4d49;
  --text: #ecebe7; --text-2: #cfcdc7; --muted: #99978f; --accent: #e9e7e1; --accent-hover: #ffffff; --accent-soft: #34342f; --accent-contrast: #1c1c1b;
  --danger: #ee8c82; --danger-soft: #3d2623; --warn: #e2b062; --warn-soft: #3a3020; --ok: #7fc29c; --ok-soft: #1f3328; --focus: #e9e7e1;
  --code-bg: #1f1f1e; --diff-add: #1f3326; --diff-del: #3b2321; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.5);
  --tok-keyword: #d7a0e6; --tok-string: #95cf9d; --tok-comment: #7c7a74; --tok-number: #e3a866; --tok-function: #86b4f0; --tok-type: #72d0c8;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 650; letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; } h4 { font-size: .9rem; }
p { margin: 0 0 .75rem; } a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); z-index: 100; }
.skip-link:focus { left: 8px; }
kbd { font: .75rem var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; }

/* Buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 13px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 550; transition: background .12s, border-color .12s, transform .05s; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--muted); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; } .btn.danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.small { padding: 4px 9px; font-size: .82rem; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; position: relative; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); } .icon-btn.active { color: var(--accent); background: var(--accent-soft); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
input, select, textarea { width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
input[aria-invalid="true"] { border-color: var(--danger); }
textarea { resize: vertical; min-height: 60px; }
.field { margin-bottom: 14px; } .field label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: 4px; } .field-error { color: var(--danger); font-size: .8rem; min-height: 0; margin-top: 3px; } .field-error:empty { display: none; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row.tight { gap: 6px; } .grow { flex: 1; min-width: 0; } .spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px; margin-bottom: 14px; }
.card > h3:first-child, .card > h2:first-child { margin-bottom: 12px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; } .badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; } .badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.alert { padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 12px; font-size: .9rem; }
.alert.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); } .alert.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); } .alert.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; } .empty h3 { color: var(--text-2); }
.table-wrap { overflow-x: auto; margin: 8px 0; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; } th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; } th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; }
td.c, th.c { text-align: center; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 9px 14px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; white-space: nowrap; }
.tab:hover { color: var(--text); } .tab[aria-selected="true"] { color: var(--accent); border-color: var(--accent); }
.bar { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; } .bar.hot > i { background: var(--warn); } .bar.full > i { background: var(--danger); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -3px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-sm); height: 14px; margin: 8px 0; }
@keyframes spin { to { transform: rotate(360deg); } } @keyframes shimmer { to { background-position: -200% 0; } }

/* App shell */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px; font-weight: 750; font-size: 1.15rem; letter-spacing: -.02em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; display: block; flex: none; object-fit: contain; }
.auth-brand { font-size: 1.5rem; gap: 12px; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text-2); text-decoration: none; border: 0; background: transparent; cursor: pointer; font-weight: 550; text-align: left; width: 100%; }
.nav a:hover, .nav button:hover { background: var(--surface-2); } .nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav .count { margin-left: auto; font-size: .72rem; background: var(--accent); color: var(--accent-contrast); border-radius: 999px; padding: 0 6px; min-width: 18px; text-align: center; }
.side-section { padding: 10px 16px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.convlist { flex: 1; overflow-y: auto; padding: 4px 10px 10px; min-height: 0; }
.conv { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: var(--r-sm); cursor: pointer; color: var(--text-2); border: 0; background: transparent; width: 100%; text-align: left; }
.conv:hover, .conv.active { background: var(--surface-2); } .conv.active { color: var(--text); font-weight: 600; }
.conv .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .conv .actions { display: none; } .conv:hover .actions, .conv:focus-within .actions { display: flex; }
.userbox { border-top: 1px solid var(--border); padding: 10px 14px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); min-height: 56px; }
.page { overflow-y: auto; padding: 28px 32px 60px; flex: 1; } .page-inner { max-width: 980px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; } .page-head p { margin: 0; color: var(--muted); }
.menu-btn { display: none; }

/* Auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow); }
.auth-card .brand { padding: 0 0 14px; }

/* Model picker */
.picker { position: relative; }
.picker-btn { display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 6px 12px; min-width: 230px; max-width: 330px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); cursor: pointer; gap: 0; }
.picker-btn:hover { border-color: var(--muted); } .picker-btn .n { font-weight: 650; display: flex; align-items: center; gap: 6px; } .picker-btn .d { font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.picker-menu { position: absolute; top: calc(100% + 6px); left: 0; width: min(420px, 92vw); max-height: min(70vh, 560px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px; z-index: 40; }
.opt { padding: 9px 11px; border-radius: var(--r-sm); cursor: pointer; border: 1px solid transparent; } .opt:hover:not([aria-disabled="true"]), .opt:focus-visible { background: var(--surface-2); }
.opt[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); } .opt[aria-disabled="true"] { cursor: not-allowed; color: var(--muted); }
.opt .r { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 650; } .opt .d { font-size: .8rem; color: var(--muted); } .opt .w { font-size: .78rem; color: var(--warn); margin-top: 2px; }
.group-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 8px 4px; font-weight: 650; }

/* Chat */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 24px 16px 8px; scroll-behavior: smooth; }
.messages-inner { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 100%; } .msg.user { align-items: flex-end; }
.msg .who { font-size: .75rem; color: var(--muted); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.bubble { padding: 10px 14px; border-radius: var(--r-lg); max-width: 100%; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--accent); color: var(--accent-contrast); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant .bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble > :last-child { margin-bottom: 0; } .bubble ul, .bubble ol { margin: 0 0 .75rem; padding-left: 1.4rem; } .bubble blockquote { margin: 0 0 .75rem; padding-left: 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.bubble .md-h { margin-top: .6rem; } .inline-code { font: .86em var(--mono); background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.msg-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; } .msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; } .msg-actions .icon-btn { width: 28px; height: 28px; }
.notice { align-self: center; max-width: 90%; font-size: .82rem; color: var(--warn); background: var(--warn-soft); border-radius: var(--r-sm); padding: 6px 12px; }
.notice.error { color: var(--danger); background: var(--danger-soft); } .notice .row { margin-top: 6px; }
.tool-card { border: 1px dashed var(--border-strong); border-radius: var(--r-sm); padding: 8px 12px; font-size: .84rem; background: var(--surface-2); align-self: flex-start; max-width: 100%; }
.tool-card code { font-family: var(--mono); }
.codeblock { border: 1px solid var(--border); border-radius: var(--r-sm); margin: 0 0 .75rem; overflow: hidden; background: var(--code-bg); }
.codeblock-head { display: flex; align-items: center; justify-content: space-between; padding: 3px 6px 3px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: .74rem; color: var(--muted); }
.codeblock pre { margin: 0; padding: 12px 14px; overflow-x: auto; font: .84rem/1.5 var(--mono); tab-size: 2; }
.tok-keyword { color: var(--tok-keyword); } .tok-string { color: var(--tok-string); } .tok-comment { color: var(--tok-comment); font-style: italic; } .tok-number { color: var(--tok-number); } .tok-function { color: var(--tok-function); } .tok-type { color: var(--tok-type); }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; } .typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite both; } .typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { border-top: 1px solid var(--border); background: var(--surface); padding: 12px 16px 14px; }
.composer-inner { max-width: 780px; margin: 0 auto; }
.composer-box { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: 8px 8px 8px 14px; background: var(--surface); } .composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea { border: 0; box-shadow: none !important; padding: 6px 0; resize: none; max-height: 200px; min-height: 28px; background: transparent; } .composer textarea:focus { box-shadow: none; }
.composer-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.send-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-contrast); display: grid; place-items: center; cursor: pointer; flex: none; } .send-btn:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; } .send-btn.stop { background: var(--text); color: var(--bg); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); font-size: .78rem; cursor: pointer; } .chip:hover { background: var(--surface-2); } .chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.popover { position: absolute; bottom: calc(100% + 6px); left: 0; width: min(360px, 92vw); max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; z-index: 30; }
.starter { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-top: 18px; text-align: left; } .starter button { text-align: left; padding: 12px 14px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--r); cursor: pointer; } .starter button:hover { border-color: var(--accent); }

/* Dialogs, toasts */
.backdrop { position: fixed; inset: 0; background: rgba(8,10,14,.5); display: grid; place-items: center; z-index: 60; padding: 16px; }
.dialog { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); width: min(480px, 100%); max-height: 90vh; display: flex; flex-direction: column; border: 1px solid var(--border); } .dialog.wide { width: min(860px, 100%); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px 20px; } .dialog-head h2 { margin: 0; } .dialog-body { padding: 8px 20px 12px; overflow-y: auto; } .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; }
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 80; max-width: min(380px, calc(100vw - 36px)); }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--r-sm); box-shadow: var(--shadow); font-size: .88rem; animation: rise .2s ease-out; } .toast.error { background: var(--danger); color: #fff; } .toast.ok { background: var(--ok); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* Clyde Code */
.code-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr) 340px; height: 100%; min-height: 0; } .code-shell.no-right { grid-template-columns: 250px minmax(0, 1fr) 0; } .code-shell.no-left { grid-template-columns: 0 minmax(0, 1fr) 340px; } .code-shell.no-left.no-right { grid-template-columns: 0 minmax(0,1fr) 0; }
.code-left, .code-right { background: var(--surface); display: flex; flex-direction: column; min-height: 0; overflow: hidden; } .code-left { border-right: 1px solid var(--border); } .code-right { border-left: 1px solid var(--border); }
.code-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pane-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 650; font-size: .82rem; } .pane-body { overflow-y: auto; flex: 1; min-height: 0; padding: 8px; }
.tree { list-style: none; margin: 0; padding: 0; font-size: .86rem; } .tree li { margin: 0; } .tree .node { display: flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 4px; cursor: pointer; width: 100%; border: 0; background: transparent; text-align: left; color: var(--text-2); } .tree .node:hover { background: var(--surface-2); } .tree .node.active { background: var(--accent-soft); color: var(--accent); } .tree .node .dirty { color: var(--warn); margin-left: auto; }
.editor-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--surface); overflow-x: auto; min-height: 36px; }
.etab { display: flex; align-items: center; gap: 6px; padding: 7px 10px 7px 14px; border-right: 1px solid var(--border); cursor: pointer; font-size: .84rem; border: 0; background: transparent; color: var(--muted); white-space: nowrap; } .etab[aria-selected="true"] { background: var(--bg); color: var(--text); box-shadow: inset 0 -2px var(--accent); } .etab .x { opacity: .5; } .etab:hover .x { opacity: 1; }
.editor { position: relative; flex: 1; min-height: 0; background: var(--code-bg); display: flex; }
.editor .gutter { width: 46px; padding: 12px 6px 12px 0; text-align: right; color: var(--muted); font: .84rem/1.5 var(--mono); overflow: hidden; user-select: none; border-right: 1px solid var(--border); background: var(--surface-2); white-space: pre; }
.editor .layer { position: relative; flex: 1; min-width: 0; }
.editor pre, .editor textarea { position: absolute; inset: 0; margin: 0; padding: 12px 14px; font: .84rem/1.5 var(--mono); tab-size: 2; white-space: pre; overflow: auto; border: 0; border-radius: 0; background: transparent; } .editor pre { pointer-events: none; color: var(--text); } .editor textarea { color: transparent; caret-color: var(--text); resize: none; box-shadow: none !important; } .editor textarea::selection { background: rgba(140,140,135,.35); }
.statusbar { display: flex; gap: 14px; align-items: center; padding: 5px 12px; border-top: 1px solid var(--border); background: var(--surface); font-size: .76rem; color: var(--muted); flex-wrap: wrap; }
.panel-bottom { border-top: 1px solid var(--border); background: var(--surface); max-height: 38%; display: flex; flex-direction: column; min-height: 0; }
.term-out { font: .8rem/1.45 var(--mono); background: var(--code-bg); padding: 10px 12px; overflow: auto; white-space: pre-wrap; margin: 0; flex: 1; min-height: 60px; } .term-out .err { color: var(--danger); }
.diff { font: .8rem/1.45 var(--mono); border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; margin-bottom: 12px; } .diff-head { padding: 6px 10px; background: var(--surface-2); font-family: var(--font); font-weight: 650; font-size: .82rem; display: flex; gap: 8px; align-items: center; }
.diff .hunk { padding: 2px 10px; background: var(--accent-soft); color: var(--accent); font-size: .74rem; } .diff .ln { display: block; padding: 0 10px; white-space: pre-wrap; word-break: break-all; } .diff .ln.add { background: var(--diff-add); } .diff .ln.del { background: var(--diff-del); } .diff .ln::before { content: attr(data-sign) " "; opacity: .6; }
.assist-log { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 0; } .assist-msg { font-size: .88rem; } .assist-msg .bubble { padding: 8px 12px; } .provenance { font-size: .74rem; color: var(--muted); margin-top: 4px; }
.progress-line { height: 2px; background: var(--surface-3); overflow: hidden; position: relative; } .progress-line.active::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 35%; background: var(--accent); animation: slide 1.1s infinite ease-in-out; } @keyframes slide { from { left: -35%; } to { left: 100%; } }

/* Developer + settings */
.settings-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; } .settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; align-self: start; } .settings-nav button { text-align: left; padding: 8px 12px; border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer; color: var(--text-2); font-weight: 550; } .settings-nav button[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: .9rem; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.plan-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* Responsive */
@media (max-width: 1100px) { .code-shell, .code-shell.no-left { grid-template-columns: 220px minmax(0, 1fr) 0; } .code-right { position: fixed; right: 0; top: 0; bottom: 0; width: min(360px, 92vw); z-index: 50; box-shadow: var(--shadow); } .code-right.hidden { display: none; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; } .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: 55; transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow); } .sidebar.open { transform: none; }
  .menu-btn { display: inline-grid; } .page { padding: 18px 14px 50px; } .settings-grid { grid-template-columns: 1fr; } .settings-nav { flex-direction: row; overflow-x: auto; position: static; } .kv { grid-template-columns: 1fr; }
  .code-shell, .code-shell.no-left { grid-template-columns: minmax(0, 1fr); } .code-left { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: 50; box-shadow: var(--shadow); } .code-left.hidden { display: none; }
  .picker-btn { min-width: 0; max-width: 56vw; } .msg-actions { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
