:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --panel-alt: #eef1f3;
  --border: #d8dde2;
  --text: #182026;
  --muted: #66717b;
  --accent: #087f6d;
  --accent-dark: #056655;
  --danger: #ba3a32;
  --focus: #0b78d0;
  --topbar: 58px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.app-shell { width: 100%; height: 100%; }
.topbar { height: var(--topbar); display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 156px; }
.brand strong { font-size: 15px; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px; background: #17212a; color: #fff; font-size: 24px; font-weight: 700; }
.brand-mark.small { width: 30px; height: 30px; border-radius: 6px; font-size: 16px; }
.service-switch { display: flex; flex: 0 0 auto; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel-alt); }
.service-option { height: 31px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
.service-option i { width: 7px; height: 7px; border-radius: 50%; background: #99a2aa; }
.service-option.online i { background: #16a16f; }
.service-option.loading i { background: #d18b16; }
.service-option.offline i { background: var(--danger); }
.service-option.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.tabs { display: flex; align-self: stretch; gap: 2px; }
.tab { min-width: 68px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; }
.tab:hover { color: var(--text); background: var(--bg); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 650; }
.top-actions { position: relative; margin-left: auto; display: flex; align-items: center; gap: 8px; }
.status-wrap { position: relative; }
.model-status { min-height: 40px; display: inline-flex; align-items: center; gap: 9px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--muted); white-space: nowrap; }
.model-status:hover { background: var(--bg); }
.model-status i { width: 8px; height: 8px; border-radius: 50%; background: #99a2aa; }
.model-status.online i { background: #16a16f; }
.model-status.loading i { background: #d18b16; }
.model-status.offline i { background: var(--danger); }
.model-status-copy { display: grid; gap: 1px; text-align: left; }
.model-status-copy b { color: var(--text); font-size: 11px; line-height: 1.15; }
.model-status-copy small { color: var(--muted); font-size: 11px; line-height: 1.15; }
.model-status.online .model-status-copy small { color: var(--accent-dark); }
.model-status.loading .model-status-copy small { color: #9a650e; }
.model-status.offline .model-status-copy small { color: var(--danger); }
.status-popover { position: absolute; z-index: 18; top: calc(100% + 8px); right: 0; width: min(310px, calc(100vw - 24px)); padding: 15px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel); box-shadow: 0 14px 36px rgba(20, 30, 36, .16); }
.status-popover-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.status-badge { padding: 3px 7px; border-radius: 4px; background: var(--panel-alt); color: var(--muted); font-size: 11px; font-weight: 700; }
.status-badge.online { background: #e1f3ed; color: var(--accent-dark); }
.status-badge.loading { background: #fff0cf; color: #8a5909; }
.status-badge.offline { background: #fbe6e4; color: var(--danger); }
.status-details { margin: 0 0 14px; }
.status-details div { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 8px; padding: 7px 0; border-top: 1px solid #edf0f2; }
.status-details dt { color: var(--muted); font-size: 12px; }
.status-details dd { margin: 0; overflow-wrap: anywhere; color: var(--text); font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; text-align: right; }
.icon-button { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-size: 19px; }
.icon-button:hover { color: var(--text); border-color: var(--border); background: var(--bg); }
.icon-button.compact { width: 26px; height: 26px; font-size: 17px; }
.workspace { height: calc(100% - var(--topbar)); display: grid; grid-template-columns: 276px minmax(0, 1fr); }
.sidebar { min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: #f1f3f4; overflow: hidden; }
.sidebar-section { padding: 13px 12px; border-bottom: 1px solid var(--border); min-height: 0; }
.sidebar-section.grow { flex: 1; overflow: auto; }
.conversations-section { max-height: 34%; overflow: auto; border-bottom: 0; }
.section-heading { min-height: 28px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
select, input, textarea { border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); }
select, input { height: 36px; padding: 0 10px; }
#projectSelect { width: 100%; }
.root-path { margin-top: 7px; overflow: hidden; color: var(--muted); font: 11px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.file-tree { font-size: 13px; }
.tree-list { margin: 0; padding: 0 0 0 14px; list-style: none; }
.file-tree > .tree-list { padding-left: 0; }
.tree-folder > summary { cursor: pointer; padding: 4px 5px; border-radius: 4px; color: #35414a; }
.tree-folder > summary:hover, .tree-file:hover { background: #e2e7ea; }
.tree-file { width: 100%; min-height: 28px; padding: 4px 5px 4px 19px; overflow: hidden; border: 0; border-radius: 4px; background: transparent; color: #35414a; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.tree-file.active { color: var(--accent-dark); background: #dcebe7; font-weight: 650; }
.conversation-list { display: flex; flex-direction: column; gap: 3px; }
.conversation { position: relative; }
.conversation-main { width: 100%; min-height: 32px; padding: 5px 30px 5px 7px; overflow: hidden; border: 0; border-radius: 5px; background: transparent; color: #3d4850; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.conversation-main:hover, .conversation.active .conversation-main { background: #e2e7ea; color: var(--text); }
.conversation-delete { position: absolute; top: 3px; right: 2px; width: 27px; height: 27px; border: 0; background: transparent; color: var(--muted); visibility: hidden; }
.conversation:hover .conversation-delete { visibility: visible; }
.main-panel { min-width: 0; min-height: 0; background: var(--panel); }
.view { display: none; width: 100%; height: 100%; min-height: 0; }
.active-view { display: flex; }
#chatView { flex-direction: column; }
.messages { flex: 1; min-height: 0; overflow: auto; padding: 28px max(24px, calc((100% - 900px) / 2)); scroll-behavior: smooth; }
.empty-state { min-height: 55%; display: grid; place-content: center; gap: 7px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--text); font-size: 20px; }
.message { max-width: 860px; margin: 0 auto 20px; }
.message-role { margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.message-content { padding: 13px 15px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel); font: 14px/1.65 ui-sans-serif, system-ui, sans-serif; overflow-wrap: anywhere; white-space: pre-wrap; }
.message.user .message-content { border-color: #c9ddd8; background: #eff8f5; }
.message.assistant .message-content { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.activity { max-width: 900px; width: calc(100% - 48px); margin: 0 auto 8px; color: var(--accent-dark); font-size: 12px; }
.composer { width: min(900px, calc(100% - 48px)); margin: 0 auto 20px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); box-shadow: 0 8px 28px rgba(25, 36, 44, .08); }
.composer textarea { width: 100%; min-height: 54px; max-height: 180px; padding: 14px 15px 6px; resize: none; border: 0; background: transparent; line-height: 1.5; }
.composer textarea:focus { outline: none; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; padding: 7px 8px; }
.segmented { display: flex; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel-alt); }
.mode { height: 29px; padding: 0 11px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 12px; }
.mode.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.composer-actions, .toolbar-actions { display: flex; align-items: center; gap: 8px; }
.primary, .secondary { min-height: 34px; padding: 0 15px; border-radius: 6px; font-weight: 650; }
.primary { border: 1px solid var(--accent); background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.secondary { border: 1px solid var(--border); background: var(--panel); color: var(--text); }
.secondary:hover { background: var(--panel-alt); }
.wide { width: 100%; min-height: 40px; }
#filesView, #progressView, #accountView, #videoView { flex-direction: column; }
.panel-toolbar { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.panel-toolbar > div:first-child { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.panel-toolbar strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.muted { color: var(--muted); font-size: 12px; }
.file-editor { flex: 1; width: 100%; min-height: 0; padding: 20px; resize: none; border: 0; border-radius: 0; background: #fbfcfc; font: 13px/1.62 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 2; }
.file-editor:focus { outline: none; }
.progress-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(280px, 34%) minmax(0, 1fr); overflow: hidden; }
.summary-section, .tasks-section { padding: 22px; overflow: auto; }
.summary-section { border-right: 1px solid var(--border); background: #fafbfb; }
.summary-section label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.summary-section textarea { width: 100%; padding: 10px; resize: vertical; line-height: 1.5; }
.progress-counts { display: flex; gap: 16px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.progress-counts strong { display: block; color: var(--text); font-size: 22px; }
.task-add { display: flex; gap: 8px; margin-bottom: 16px; }
.task-add input { flex: 1; min-width: 0; }
.progress-items { display: flex; flex-direction: column; gap: 8px; }
.progress-item { display: grid; grid-template-columns: 100px minmax(0, 1fr) 32px; align-items: start; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 7px; }
.progress-item select, .progress-item input { width: 100%; }
.progress-item textarea { grid-column: 2 / 3; width: 100%; min-height: 54px; padding: 8px; resize: vertical; }
.delete-task { grid-column: 3; grid-row: 1; width: 32px; height: 32px; border: 0; background: transparent; color: var(--danger); font-size: 18px; }
.account-content { flex: 1; min-height: 0; overflow: auto; padding: 32px max(22px, calc((100% - 680px) / 2)); background: #fafbfb; }
.account-form { display: grid; grid-template-columns: 160px minmax(0, 1fr); align-items: center; gap: 16px 22px; }
.account-form label { color: var(--muted); font-size: 13px; font-weight: 700; }
.account-form input { width: 100%; }
.account-submit, .account-form .form-error { grid-column: 2; justify-self: start; }
.video-service-meta { display: flex; align-items: center; gap: 10px; }
.video-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(340px, 430px) minmax(0, 1fr); overflow: hidden; }
.video-controls { min-height: 0; padding: 20px; overflow: auto; border-right: 1px solid var(--border); background: #fafbfb; }
.video-field { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.video-field textarea { width: 100%; min-height: 172px; padding: 11px; resize: vertical; color: var(--text); font-weight: 400; line-height: 1.55; }
.video-field select, .video-field input { width: 100%; color: var(--text); font-weight: 400; }
.video-settings { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(84px, .75fr) minmax(105px, 1fr); gap: 10px; margin-top: 16px; }
.reference-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.reference-input { position: relative; aspect-ratio: 16 / 8; min-height: 104px; display: grid; place-content: center; gap: 3px; overflow: hidden; border: 1px dashed #b7c0c7; border-radius: 6px; background: var(--panel); color: var(--muted); text-align: center; cursor: pointer; }
.reference-input:hover { border-color: var(--accent); background: #f4faf8; }
.reference-input > span { position: absolute; top: 8px; left: 9px; z-index: 2; padding: 2px 5px; border-radius: 4px; background: rgba(255,255,255,.88); color: var(--text); font-size: 11px; font-weight: 700; }
.reference-input > strong { font-size: 24px; font-weight: 400; }
.reference-input > small { font-size: 10px; font-weight: 500; }
.reference-input input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.reference-input.has-image > strong, .reference-input.has-image > small { display: none; }
.reference-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.reference-uploading::after { content: "上传中"; position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: rgba(255,255,255,.8); color: var(--accent-dark); font-size: 12px; font-weight: 700; }
.install-progress { margin-top: 16px; padding: 10px; border: 1px solid #edd9aa; border-radius: 6px; background: #fff9eb; }
.install-progress div { display: flex; justify-content: space-between; margin-bottom: 7px; color: #77530e; font-size: 11px; }
.install-progress progress { width: 100%; height: 7px; accent-color: #c88713; }
.video-submit-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.video-results { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 20px; overflow: auto; }
.video-preview { flex: 0 0 min(56%, 520px); min-height: 260px; display: grid; place-items: center; overflow: hidden; border-radius: 7px; background: #11171b; color: #d4dadd; }
.video-preview .empty-state { min-height: 0; }
.empty-state.compact strong { color: #fff; font-size: 17px; }
.video-preview video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-running { display: grid; place-items: center; gap: 9px; text-align: center; }
.video-running i { width: 28px; height: 28px; border: 3px solid #52616a; border-top-color: #3ec0a5; border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.history-heading { min-height: 48px; display: flex; align-items: center; justify-content: space-between; margin-top: 7px; }
.video-jobs { display: flex; flex-direction: column; gap: 7px; }
.video-job { min-height: 72px; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel); }
.video-job::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #99a2aa; }
.video-job.running::before, .video-job.queued::before { background: #d18b16; }
.video-job.complete::before { background: #16a16f; }
.video-job.error::before, .video-job.cancelled::before { background: var(--danger); }
.video-job-copy { min-width: 0; display: grid; gap: 4px; }
.video-job-copy strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.video-job-copy small { color: var(--muted); font-size: 10px; }
.video-job-actions { display: flex; gap: 6px; }
.video-job-actions button { min-height: 30px; padding: 0 9px; }
.login-layer { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: #edf0f2; }
.login-panel { width: min(380px, 100%); padding: 30px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); box-shadow: 0 18px 50px rgba(20, 28, 34, .12); }
.login-panel .brand-mark { margin-bottom: 20px; }
.login-panel h1 { margin: 0 0 6px; font-size: 22px; }
.login-panel p { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.login-panel label { display: grid; gap: 6px; margin-bottom: 14px; color: var(--muted); font-size: 12px; font-weight: 650; }
.form-error { min-height: 18px; margin-top: 10px; color: var(--danger); font-size: 12px; }
.form-error.success { color: var(--accent-dark); }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 30; max-width: min(360px, calc(100% - 36px)); padding: 10px 14px; border-radius: 6px; background: #17212a; color: #fff; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s ease; }
.toast.show { opacity: 1; transform: none; }
.sidebar-backdrop, .mobile-only { display: none; }
@media (max-width: 760px) {
  :root { --topbar: 100px; }
  .topbar { flex-wrap: wrap; align-content: center; gap: 5px 7px; padding: 5px 7px 0; }
  .mobile-only { display: grid; }
  .brand { display: none; }
  .service-switch { margin-right: auto; }
  .service-option { padding: 0 8px; }
  .tabs { order: 5; width: 100%; height: 42px; margin: 0; overflow-x: auto; }
  .tab { min-width: 58px; flex: 1 0 auto; padding: 0 6px; }
  .top-actions { margin-left: 0; gap: 2px; }
  .model-status { min-height: 36px; gap: 6px; padding: 4px 7px; }
  .model-status-copy b { display: none; }
  .status-popover { position: fixed; top: calc(var(--topbar) + 6px); right: 7px; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 12; top: var(--topbar); bottom: 0; left: 0; width: min(310px, 88vw); transform: translateX(-101%); transition: transform .2s ease; box-shadow: 12px 0 30px rgba(20,30,36,.16); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { position: fixed; z-index: 11; inset: var(--topbar) 0 0; border: 0; background: rgba(20, 28, 34, .38); }
  .sidebar.open + .sidebar-backdrop { display: block; }
  .messages { padding: 20px 14px; }
  .composer { width: calc(100% - 20px); margin-bottom: max(10px, env(safe-area-inset-bottom)); }
  .panel-toolbar { padding: 9px 12px; }
  .toolbar-actions .muted { display: none; }
  .file-editor { padding: 13px; }
  .progress-layout { display: block; overflow: auto; }
  .summary-section, .tasks-section { overflow: visible; padding: 16px; }
  .summary-section { border-right: 0; border-bottom: 1px solid var(--border); }
  .progress-item { grid-template-columns: 92px minmax(0, 1fr) 32px; }
  .account-content { padding: 22px 16px; }
  .account-form { grid-template-columns: 1fr; gap: 7px; }
  .account-form input { margin-bottom: 8px; }
  .account-submit, .account-form .form-error { grid-column: 1; }
  .video-toolbar .muted { display: none; }
  .video-layout { display: block; overflow: auto; }
  .video-controls, .video-results { overflow: visible; padding: 15px; border-right: 0; }
  .video-controls { border-bottom: 1px solid var(--border); }
  .video-settings { grid-template-columns: 1fr 1fr; }
  .video-settings .video-field:last-child { grid-column: 1 / -1; }
  .reference-input { min-height: 94px; }
  .video-preview { min-height: 220px; height: min(58vw, 320px); }
}
/* Agent attachments, skills and observable execution */
.attachment-tools{display:flex;align-items:center;gap:12px;margin-bottom:10px;flex-wrap:wrap}.attachment-tray{display:flex;gap:8px;flex-wrap:wrap}.attachment-chip{display:flex;align-items:center;gap:8px;padding:7px 10px;background:#eef2f5;border-radius:10px;margin-bottom:10px;font-size:12px;max-width:100%}.attachment-chip span{overflow-wrap:anywhere}.attachment-chip img{width:48px;height:48px;object-fit:cover;border-radius:6px}.attachment-chip button{border:0;background:transparent;cursor:pointer;font-size:20px}.skill-picker{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:10px;font-size:12px}.skill-picker label{display:flex;align-items:center;gap:5px}.skill-picker input{width:auto}.execution-panel{margin:0 24px 10px;border:1px solid #dfe5ec;border-radius:10px;background:#fafbfc;padding:10px;font-size:12px;max-height:220px;overflow:auto}.execution-panel summary{cursor:pointer}.execution-row{white-space:pre-wrap;overflow-wrap:anywhere;padding:8px;border-bottom:1px solid #e8ecf0;font-family:monospace}.execution-row.failed{color:#a32727}.approval-panel{margin:0 24px 12px;border:1px solid #e2c981;background:#fff9e8;border-radius:12px;padding:14px}.approval-panel pre{white-space:pre-wrap;overflow-wrap:anywhere}.approval-panel button{margin-right:10px}.skills-content{padding:24px;overflow:auto}#skillLibrary{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:16px}.skill-card{padding:20px;border:1px solid #e0e5eb;border-radius:14px;background:#fff}.skill-card p{font-size:13px;line-height:1.7}.skill-preview{white-space:pre-wrap;overflow-wrap:anywhere;padding:18px;background:#f0f3f6;border-radius:12px}.attachment-link{display:block;font-size:12px;margin-top:8px;color:#356b96}.message-content{overflow-wrap:anywhere}#skillsView.active-view{display:flex;flex-direction:column}#uploadStatus{font-size:12px}@media(max-width:700px){.execution-panel,.approval-panel{margin-left:10px;margin-right:10px}.attachment-tools{gap:6px}.skill-picker{gap:8px}.skills-content{padding:12px}.composer{max-height:55vh;overflow:auto}}

.message-image{display:block;max-width:min(100%,380px);max-height:300px;object-fit:contain;border-radius:10px;margin-top:10px}
