:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
  color: #342d27;
  background: #f6f3ed;
  --canvas: #f6f3ed;
  --surface: #fffefa;
  --raised: #f4efe6;
  --border: #e3dace;
  --text: #342d27;
  --secondary: #66584c;
  --accent: #9f4d36;
  --accent-light: #f5e5dc;
  --danger: #a0392f;
  --ok: #3e6b38;
  --serif: Georgia, "Noto Serif SC", "Songti SC", SimSun, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { border: 0; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.brand { display: flex; align-items: center; gap: 9px; font: 700 1.24rem/1 var(--serif); letter-spacing: -.03em; white-space: nowrap; }
.brand-mark { width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid #af5b44; border-radius: 8px; background: #efddd0; }
.brand-mark::before { content: ""; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; box-shadow: 5px -5px 0 -2px var(--accent); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 clamp(14px, 2.9vw, 44px); height: 60px; border-bottom: 1px solid var(--border); background: #faf7f1; }
.top-actions, .heading-actions, .send-group { display: flex; align-items: center; gap: 6px; }
.connection { display: inline-flex; align-items: center; gap: 7px; color: var(--secondary); font-size: .86rem; padding: 5px 8px; white-space: nowrap; }
.connection i { width: 7px; height: 7px; border-radius: 50%; background: #a89a8b; }
.connection.online i { background: #55764b; }
.connection.offline i { background: var(--danger); }
.resource-button { display: inline-flex; align-items: center; gap: 6px; }
.resource-button i { width: 12px; height: 11px; border-bottom: 1px solid currentColor; background: linear-gradient(currentColor,currentColor) left bottom/2px 4px no-repeat, linear-gradient(currentColor,currentColor) center bottom/2px 7px no-repeat, linear-gradient(currentColor,currentColor) right bottom/2px 10px no-repeat; }
.resource-button.limited { background: var(--accent-light); color: var(--danger); }
.quiet, .new, .primary, .stop, .switch-button, .steer { padding: 7px 11px; min-height: 34px; border-radius: 8px; font-size: .88rem; font-weight: 600; white-space: nowrap; }
.mini-btn { padding: 4px 8px; min-height: 28px; font-size: .82rem; }
.quiet { background: transparent; color: var(--secondary); }
.quiet:hover, .new:hover, .framed:hover { background: #eee5d8; color: var(--text); }
.new, .framed { background: var(--surface); border: 1px solid #dacebf; color: var(--text); }
.primary { background: var(--accent); color: #fffdfa; }
.primary:hover { background: #853c29; }
.stop { background: var(--accent-light); color: #8d3727; }
.stop:hover { background: #f0d5c8; }
.app { height: 100dvh; min-height: 450px; display: flex; flex-direction: column; }
.layout { display: grid; grid-template-columns: minmax(320px, var(--split-left, 58%)) 14px minmax(260px, 1fr); gap: 0; padding: 16px clamp(14px, 2.9vw, 44px) 18px; width: 100%; max-width: 1840px; margin: 0 auto; flex: 1; min-height: 0; }
.layout.no-desktop { grid-template-columns: minmax(0, 960px); justify-content: center; }
.layout.no-desktop .desktop, .layout.no-desktop .splitter { display: none; }
.splitter { position: relative; cursor: col-resize; display: grid; place-items: center; touch-action: none; user-select: none; }
.splitter::before { content: ""; width: 4px; height: 42px; border-radius: 99px; background: #d6c8b6; transition: background .15s, height .15s; }
.splitter:hover::before, .splitter.dragging::before { background: var(--accent); height: 64px; }
body.resizing { cursor: col-resize; user-select: none; }
.panel { min-height: 0; min-width: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; box-shadow: 0 4px 18px #5a392108; }
.chat, .desktop { display: flex; flex-direction: column; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; min-height: 64px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.heading-group { display: flex; min-width: 0; align-items: center; gap: 11px; flex: 1; }
.heading-group > div { min-width: 0; flex: 1; }
.title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-heading h1, .panel-heading h2 { font-size: 1rem; font-weight: 650; line-height: 1.25; }
.token-pill { padding: 2px 8px; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--raised); border: 1px solid var(--border); color: var(--secondary); font-variant-numeric: tabular-nums; }
.token-pill:hover { border-color: var(--accent); color: var(--accent); }
.token-pill.high { background: var(--accent-light); color: var(--danger); border-color: #d7a695; }
.path, .subhead { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--secondary); font-size: .82rem; line-height: 1.4; }
.path { display: block; text-align: left; padding: 1px 0; background: none; }
.path:hover { color: var(--accent); }
.panel-icon { position: relative; display: grid; place-items: center; width: 33px; height: 33px; flex: 0 0 33px; border-radius: 8px; color: var(--accent); background: #f5ebe4; }
.terminal-icon::before { content: ">_"; font: 700 15px Consolas, monospace; }
.monitor-icon::before { content: ""; width: 15px; height: 10px; border: 1.6px solid currentColor; border-radius: 2px; transform: translateY(-1px); }
.monitor-icon::after { content: ""; position: absolute; width: 7px; height: 1.6px; bottom: 9px; background: currentColor; }

/* History drawer */
.history { padding: 12px 16px; background: #fbf8f2; border-bottom: 1px solid var(--border); max-height: 42%; overflow: auto; }
.history-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.history-bar h2 { font-size: .91rem; }
.history-bar-actions { display: flex; align-items: center; gap: 6px; flex: 1; justify-content: end; min-width: 170px; }
.history-search { max-width: 220px; min-height: 30px !important; padding: 3px 9px !important; font-size: .84rem; }
.history-item { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.history-item:hover, .history-item.active { background: #efe4d6; }
.history-row { flex: 1; min-width: 0; border-radius: 7px; text-align: left; display: block; padding: 7px 9px; background: transparent; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.history-item-actions { display: flex; gap: 2px; padding-right: 4px; opacity: .75; }
.history-item:hover .history-item-actions { opacity: 1; }
.history-item-actions button { padding: 3px 6px; border-radius: 6px; background: transparent; color: var(--secondary); font-size: .78rem; }
.history-item-actions button:hover { background: #e3d4c2; color: var(--text); }
.history-empty { font-size: .88rem; color: var(--secondary); padding: 4px 0; }

/* Feed & Messages */
.feed { min-height: 0; flex: 1; overflow: auto; scroll-padding: 20px; padding: 20px clamp(14px, 3vw, 32px); }
.welcome { height: 100%; min-height: fit-content; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; max-width: 540px; margin: 0 auto; padding: 20px 0 34px; }
.hero-mark { width: 47px; height: 47px; display: flex; justify-content: center; align-items: center; gap: 3px; border: 1px solid #e6cabc; background: #f7ebe1; border-radius: 50%; margin-bottom: 16px; transform: rotate(-28deg); }
.hero-mark i { width: 4px; height: 10px; border-radius: 3px; background: #bc7d68; }
.hero-mark i:nth-child(2) { height: 22px; background: var(--accent); }
.hero-mark i:nth-child(3) { height: 15px; background: #ba7058; }
.welcome h2 { font: 600 clamp(1.9rem, 3.8vw, 2.85rem)/1.16 var(--serif); letter-spacing: -.05em; }
.welcome p, .preview-empty p, .lock p, dialog p { color: var(--secondary); line-height: 1.6; margin-top: 10px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.suggestions button { border: 1px solid var(--border); background: #fbf8f2; border-radius: 9px; padding: 8px 11px; color: var(--secondary); font-size: .88rem; }
.suggestions button:hover { border-color: var(--accent); color: var(--accent); }

.messages { display: flex; flex-direction: column; gap: 11px; max-width: 840px; margin: 0 auto; }
.message { min-width: 0; overflow-wrap: anywhere; line-height: 1.62; }
.message.user { align-self: end; max-width: 92%; border-radius: 13px 13px 5px 13px; padding: 10px 14px; background: #f1e8dc; color: var(--text); white-space: pre-wrap; }
.user-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.user-img-thumb { max-width: 180px; max-height: 140px; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; object-fit: cover; background: var(--surface); }
.message.agent { padding: 4px 0; }
.message-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.message-label { color: var(--secondary); font-size: .82rem; font-weight: 600; }
.msg-copy { padding: 2px 7px; border-radius: 6px; background: transparent; color: var(--secondary); font-size: .78rem; }
.msg-copy:hover { background: #eee5d8; color: var(--text); }

/* Markdown elements */
.md-p { margin: 6px 0; color: #362d27; }
.md-p:first-child { margin-top: 0; }
.md-heading { margin: 12px 0 6px; font-weight: 700; line-height: 1.3; color: #2b231d; }
h2.md-heading { font-size: 1.15rem; }
h3.md-heading { font-size: 1.04rem; }
h4.md-heading { font-size: .96rem; }
.md-list { margin: 6px 0; padding-left: 22px; }
.md-list li { margin: 3px 0; }
.md-quote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--accent); background: #faf5ed; color: var(--secondary); border-radius: 0 6px 6px 0; white-space: pre-wrap; }
.md-hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }
.inline-code { padding: 1px 5px; border-radius: 4px; background: #efe7dc; font: .86em Consolas, monospace; color: #7c3523; }
.message a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md-table-wrap { overflow-x: auto; margin: 8px 0; }
.md-table { border-collapse: collapse; width: 100%; font-size: .88rem; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 6px 9px; text-align: left; }
.md-table th { background: var(--raised); font-weight: 650; }
.code-block { margin: 8px 0; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: #f6f0e7; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 10px; background: #ede4d8; font-size: .78rem; color: var(--secondary); }
.code-lang { font-family: Consolas, monospace; text-transform: lowercase; }
.code-copy { padding: 2px 7px; border-radius: 5px; background: transparent; color: var(--secondary); font-size: .76rem; font-weight: 600; }
.code-copy:hover { background: #dfd3c3; color: var(--text); }
.code-block pre { margin: 0; padding: 10px 12px; overflow: auto; font: .84rem/1.55 Consolas, monospace; background: transparent; white-space: pre; }

/* Activities, Thinking, Plan, Diffs */
.activity { border: 1px solid var(--border); border-radius: 10px; font-size: .88rem; min-width: 0; background: #fdfaf4; }
.activity.thinking { background: #faf6ef; border-style: dashed; }
.activity summary { padding: 8px 11px; cursor: pointer; color: var(--secondary); overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; }
.activity summary:hover { color: var(--text); }
.activity pre, .approval-card pre { margin: 0 8px 8px; background: #f3ede3; padding: 9px 11px; border-radius: 6px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: .83rem/1.5 Consolas, monospace; }
.approval-card pre { margin: 6px 0 0; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; background: #a89a8b; }
.status-dot.running { background: var(--accent); animation: pulse 1.2s infinite; }
.status-dot.ok { background: var(--ok); }
.status-dot.err { background: var(--danger); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.plan-card { border: 1px solid #dfd2c0; border-radius: 10px; background: #fbf7ef; padding: 10px 12px; font-size: .88rem; }
.plan-title { font-weight: 650; color: var(--text); margin-bottom: 6px; font-size: .86rem; }
.plan-explain { color: var(--secondary); font-size: .83rem; margin-bottom: 6px; }
.plan-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.plan-list li { display: flex; gap: 7px; align-items: flex-start; color: var(--secondary); }
.plan-list li.done { color: var(--ok); text-decoration: line-through; opacity: .82; }
.plan-list li.active { color: var(--accent); font-weight: 600; }

.file-change-list { padding: 0 8px 8px; display: grid; gap: 8px; }
.file-change-item { border: 1px solid var(--border); border-radius: 7px; overflow: hidden; background: var(--surface); }
.file-change-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 9px; background: var(--raised); font-size: .82rem; }
.file-change-path { font-family: Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { padding: 1px 6px; border-radius: 4px; font-size: .74rem; font-weight: 650; flex-shrink: 0; }
.badge-add { background: #e3f1df; color: #2b6625; }
.badge-del { background: #f8e2df; color: #9c2f25; }
.badge-mod { background: #f3e8d7; color: #7f511c; }
.diff-view { max-height: 300px; overflow: auto; font: .8rem/1.45 Consolas, monospace; background: #fdfbf7; }
.diff-line { padding: 0 9px; white-space: pre; }
.diff-add { background: #e8f5e5; color: #1f531a; }
.diff-del { background: #fbe8e6; color: #8c231a; }
.diff-hunk { background: #f2ebe1; color: #6a5644; font-weight: 600; }
.diff-meta { color: var(--secondary); font-weight: 600; }

.turn-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: -4px; }
.turn-actions button { padding: 2px 7px; border-radius: 6px; background: transparent; color: var(--secondary); font-size: .76rem; }
.turn-actions button:hover { background: #eee5d8; color: var(--text); }

/* Approvals, notices, composer */
.notice { padding: 7px 18px 0; color: var(--danger); font-size: .86rem; overflow-wrap: anywhere; }
.resource-hint { padding: 7px 18px 0; color: #825026; font-size: .86rem; }
.approvals { overflow: auto; max-height: 35%; padding: 0 14px; }
.approval-card { border: 1px solid #d0b68f; background: #fbf2df; border-radius: 9px; padding: 10px 12px; margin-bottom: 8px; }
.approval-card > p { margin: 6px 0; font-size: .9rem; }
.approval-card label { display: block; margin: 9px 0 4px; color: var(--secondary); }
.approval-card select, .approval-card input:not([type="checkbox"]) { width: 100%; }
.approval-actions { display: flex; justify-content: end; gap: 6px; margin-top: 7px; }

.composer { position: relative; margin: 10px 14px 14px; padding: 10px 12px; border: 1px solid #d5c8b8; border-radius: 13px; background: #fffdf8; box-shadow: 0 3px 9px #5a39210d; }
.composer:focus-within { border-color: #b97d65; }
.composer.dragover { border-color: var(--accent); background: #fcf3ec; }
.drop-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: #fff7f0e6; border-radius: 12px; color: var(--accent); font-weight: 650; z-index: 4; pointer-events: none; }
.suggest-pop { position: absolute; left: 10px; right: 10px; bottom: calc(100% + 6px); max-height: 220px; overflow: auto; background: var(--surface); border: 1px solid #d4c5b2; border-radius: 10px; box-shadow: 0 10px 28px #3c261522; z-index: 5; padding: 4px; }
.suggest-row { width: 100%; text-align: left; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 7px 9px; border-radius: 7px; background: transparent; font-size: .86rem; }
.suggest-row:hover, .suggest-row.active { background: #f2e6d8; }
.suggest-row small { color: var(--secondary); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.attachments-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px 8px; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px; background: var(--raised); border: 1px solid var(--border); font-size: .8rem; max-width: 240px; }
.att-chip img { width: 24px; height: 24px; border-radius: 4px; object-fit: cover; }
.att-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-chip button { padding: 0 4px; border-radius: 4px; background: transparent; color: var(--secondary); font-weight: 700; }
.att-chip button:hover { color: var(--danger); }

textarea { display: block; width: 100%; resize: vertical; min-height: 46px; max-height: 180px; padding: 4px 6px 6px; background: transparent; border: 0; outline: none; line-height: 1.46; }
textarea:focus-visible { outline: none; }
textarea::placeholder { color: #796c60; }
.composer-footer { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding-top: 5px; }
.controls { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; align-items: center; }
.icon-btn { padding: 6px 9px; font-size: .95rem; border: 1px solid var(--border); background: #fbf8f2; }
.pill-toggle { border: 1px solid var(--border); background: #fbf8f2; font-size: .82rem; padding: 6px 9px; }
.pill-toggle[aria-pressed="true"] { background: var(--accent-light); border-color: #c8856d; color: var(--accent); }
.select-wrap { position: relative; display: inline-flex; min-width: 0; }
.select-wrap::after { content: ""; position: absolute; width: 6px; height: 6px; border-bottom: 1px solid currentColor; border-right: 1px solid currentColor; color: var(--secondary); transform: rotate(45deg); pointer-events: none; right: 10px; top: calc(50% - 5px); }
select { min-height: 34px; min-width: 0; appearance: none; border: 1px solid var(--border); background: #fbf8f2; border-radius: 7px; padding: 6px 24px 6px 9px; font-size: .85rem; max-width: 170px; text-overflow: ellipsis; }
.permission { border: 1px solid var(--border); color: var(--text); background: #fbf8f2; }
.send, .stop, .steer { min-width: 58px; }

/* Desktop preview & remote control */
.desktop-head-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: end; }
.switch-button { display: inline-flex; align-items: center; gap: 7px; color: var(--secondary); background: transparent; }
.switch-button:hover { color: var(--text); }
.switch { display: inline-flex; align-items: center; width: 31px; height: 17px; padding: 3px; border-radius: 20px; background: #c4b6a5; }
.switch::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: #fffdf7; }
.switch-button[aria-checked="true"] .switch { background: var(--accent); justify-content: end; }
.desktop-frame { display: grid; place-items: center; flex: 1; min-height: 0; margin: 12px; border: 1px solid var(--border); border-radius: 11px; background: radial-gradient(ellipse at 46% 42%, #f8f2e6, #f0e7da 76%); overflow: hidden; outline: none; }
.desktop-frame:has(#screen:not([hidden])) { background: #28221d; }
.desktop-frame.controlling { border: 2px solid var(--accent); box-shadow: 0 0 0 3px #9f4d361f; }
.desktop-frame.controlling #screen { cursor: crosshair; touch-action: none; user-select: none; }
.preview-empty { display: grid; justify-items: center; text-align: center; padding: 15px; }
.preview-empty p { margin: 5px 0 15px; font-size: .92rem; }
.screen-mark { width: 72px; height: 49px; border: 1.5px solid #b68f77; border-radius: 8px; box-shadow: inset 0 0 0 5px #f9f2e8; background: #efe1d1; margin-bottom: 18px; display: grid; place-items: center; position: relative; }
.screen-mark span { width: 12px; height: 12px; border: 1.5px solid #a46650; border-radius: 50%; }
.screen-mark::after { content: ""; position: absolute; width: 35px; height: 1.5px; bottom: -8px; background: #b68f77; border-radius: 5px; }
#screen { width: 100%; height: 100%; object-fit: contain; min-height: 0; align-self: stretch; }
.desktop-controls { border-top: 1px solid var(--border); background: #faf7f1; padding: 9px 12px 11px; display: grid; gap: 7px; flex-shrink: 0; }
.desktop-text-row { display: flex; gap: 6px; align-items: center; }
.desktop-text-row input { min-height: 32px !important; padding: 4px 9px !important; font-size: .85rem; }
.desktop-keys { display: flex; flex-wrap: wrap; gap: 5px; }
.desktop-keys .mini-btn { font-size: .78rem; padding: 3px 7px; min-height: 26px; }

/* Lock & Dialogs */
.mobile-nav { display: none; }
.lock { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 45% 44%, #eee1d2, var(--canvas) 70%); }
.lock-card { width: min(100%, 410px); padding: clamp(22px, 5vw, 38px); background: var(--surface); border: 1px solid var(--border); border-radius: 17px; box-shadow: 0 18px 60px #5a392115; }
.lock-card .brand { margin-bottom: 26px; }
.lock-card h1 { font: 600 1.95rem/1.18 var(--serif); letter-spacing: -.04em; }
.lock form { margin-top: 20px; display: grid; gap: 9px; }
.lock label, dialog label { color: var(--secondary); font-size: .92rem; }
input:not([type="radio"], [type="checkbox"]) { display: block; width: 100%; min-height: 39px; border: 1px solid #d7cabc; border-radius: 8px; background: #fdfbf6; padding: 6px 10px; }
.lock form .primary { margin-top: 6px; min-height: 42px; }
.lock .error { color: var(--danger); margin-top: 0; font-size: .88rem; }
dialog { width: min(92vw, 450px); max-height: 86dvh; overflow: auto; padding: 20px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 13px; }
dialog.wide-dialog { width: min(94vw, 580px); }
dialog::backdrop { background: #30221566; }
dialog h2 { font-size: 1.18rem; }
dialog p { margin: 7px 0 12px; font-size: .92rem; }
.dialog-head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dialog-actions { margin-top: 16px; display: flex; justify-content: end; gap: 7px; }
fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 14px 0 11px; }
fieldset legend { color: var(--secondary); font-size: .88rem; }
fieldset label { display: flex; align-items: flex-start; gap: 7px; margin: 9px 0; cursor: pointer; color: var(--text); }
fieldset input { accent-color: var(--accent); }
fieldset small { display: block; color: var(--secondary); margin-top: 2px; font-size: .82rem; }
.approval-choice { display: block; margin-bottom: 5px; }
.resource-stats { display: grid; grid-template-columns: .9fr 1.25fr .9fr; gap: 7px; margin: 14px 0 10px; }
.resource-stats div { padding: 9px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--raised); }
.resource-stats dt { color: var(--secondary); font-size: .83rem; }
.resource-stats dd { margin: 4px 0 0; font-weight: 650; font-variant-numeric: tabular-nums; font-size: .91rem; }

/* Visual FS browser */
.fs-path-row { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.fs-list { max-height: 290px; overflow: auto; border: 1px solid var(--border); border-radius: 9px; background: #fbf8f2; padding: 4px; display: grid; gap: 2px; }
.fs-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 9px; border-radius: 6px; background: transparent; text-align: left; font-size: .87rem; }
.fs-row:hover { background: #efe4d6; }
.fs-row small { color: var(--secondary); font-size: .78rem; flex-shrink: 0; }

/* Capabilities dialog */
.cap-body { display: grid; gap: 12px; }
.cap-section h3 { font-size: .92rem; color: var(--secondary); margin-bottom: 6px; }
.cap-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.cap-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 8px; background: var(--raised); border: 1px solid var(--border); font-size: .82rem; }
.cap-pill.clickable:hover { border-color: var(--accent); color: var(--accent); }
.cap-list { display: grid; gap: 5px; }
.cap-item { padding: 7px 10px; border-radius: 8px; background: #fbf8f2; border: 1px solid var(--border); font-size: .84rem; }
.cap-item strong { display: block; margin-bottom: 2px; }
.cap-item small { color: var(--secondary); }
.cua-actions { margin-top: 8px; }

.lightbox-dialog { width: min(94vw, 900px); text-align: center; }
#lightbox-img { max-width: 100%; max-height: 74dvh; border-radius: 8px; }

@media (max-width: 820px) {
  .desktop-layout { display: none; }
  .mobile-nav { display: flex; gap: 5px; padding: 7px 11px 0; }
  .mobile-nav button { padding: 7px 12px; min-height: 36px; border-radius: 8px; background: transparent; color: var(--secondary); font-size: .93rem; }
  .mobile-nav button.active { color: #883d2a; background: var(--accent-light); }
  .layout, .layout.no-desktop { grid-template-columns: minmax(0, 1fr); padding: 8px 10px max(8px, env(safe-area-inset-bottom)); }
  .layout .desktop, .layout .splitter { display: none; }
  .layout.mobile-desktop .desktop { display: flex; }
  .layout.mobile-desktop .chat { display: none; }
  .topbar { height: 52px; }
  .feed { padding: 15px 12px; }
  .panel-heading { min-height: 60px; padding: 10px; }
  .composer { margin: 7px; }
  .composer .controls select { font-size: .92rem; max-width: 118px; }
  .top-actions { gap: 2px; }
}
@media (max-width: 390px) {
  .heading-actions { gap: 2px; }
  .heading-actions button, .top-actions button, .composer .permission { padding-right: 6px; padding-left: 6px; }
  .connection { padding-left: 0; padding-right: 0; font-size: .78rem; }
  .controls { gap: 4px; }
  .composer .controls select { max-width: 100px; font-size: .86rem; }
}
