:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --panel: #ffffff;
  --line: #dbe0e5;
  --text: #1b252c;
  --muted: #6d7780;
  --accent: #137c5a;
  --accent-dark: #0e6548;
  --blue: #286fbe;
  --warning: #b46a10;
  --danger: #b73c3c;
  --shadow: 0 8px 28px rgba(18, 30, 38, .10);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 "Segoe UI", Arial, sans-serif; color: var(--text); background: var(--bg); }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.app-shell { display: grid; grid-template-columns: 280px minmax(520px, 1fr) 300px; height: 100vh; overflow: hidden; }
.sidebar, .inspector { background: var(--panel); padding: 20px; overflow: auto; }
.sidebar { border-right: 1px solid var(--line); }
.inspector { border-left: 1px solid var(--line); }
.workspace { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.mobile-shell-bar, .mobile-panel-head, .mobile-scrim { display: none; }

.brand-row { display: flex; gap: 11px; align-items: center; margin-bottom: 22px; }
.brand-row strong { display: block; font-size: 17px; }
.brand-row span { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; background: #173c34; color: white; border-radius: 6px; font-weight: 700; }

.primary, .secondary { min-height: 38px; border-radius: 6px; border: 1px solid transparent; padding: 8px 14px; font-weight: 600; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-dark); }
.primary:disabled { opacity: .55; cursor: default; }
.secondary { background: white; border-color: var(--line); color: var(--text); }
.stop-button { min-height: 38px; border-radius: 6px; border: 1px solid #d9a8a8; padding: 8px 14px; background: #fff4f4; color: var(--danger); font-weight: 700; }
.stop-button:hover { background: #fbe6e6; }
.stop-button:disabled { opacity: .55; cursor: default; }
.full { width: 100%; }
.section-label { margin: 24px 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.task-section-head { margin: 20px 0 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.task-section-head .compact { min-height: 30px; padding: 4px 9px; font-size: 12px; text-transform: none; }
.task-section-actions { display: flex; gap: 5px; }
.project-heading { padding: 12px 10px 4px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.account-row { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: stretch; flex-direction: column; gap: 8px; }
.account-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.account-row .secondary { min-height: 32px; padding: 5px 9px; }
.account-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.task-list { display: grid; gap: 4px; }
.task-item { width: 100%; border: 0; background: transparent; text-align: left; padding: 10px; border-radius: 6px; color: var(--text); }
.task-item:hover, .task-item.active { background: #edf3f1; }
.task-item strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-item span { display: flex; justify-content: space-between; color: var(--muted); margin-top: 4px; font-size: 12px; }
.task-item span > i:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-status { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; padding: 2px 6px; border-radius: 4px; background: #e9edf0; color: #4d5961; font-style: normal; }
.task-status.completed { background: #dff1e9; color: #126347; }
.task-status.waiting_input { background: #fff1c9; color: #765500; }
.task-status.failed { background: #f7e4e4; color: #9b3030; }
.task-status.canceled { background: #eceff1; color: #59656d; }
.task-status.active-process { background: #e1ecf8; color: #245f9d; }
.task-status.active-process::before { content: ""; width: 9px; height: 9px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: task-spin .8s linear infinite; }
@keyframes task-spin { to { transform: rotate(360deg); } }

.workspace-header { min-height: 84px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 17px 24px; display: flex; align-items: center; justify-content: space-between; }
.workspace-header h1 { margin: 0; font-size: 20px; }
.workspace-header p { margin: 4px 0 0; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 6px; background: white; font-size: 20px; line-height: 1; }
.icon-button:hover { background: #f1f3f4; }
.icon-button.danger { color: var(--danger); }

.empty-state { margin: auto; max-width: 470px; text-align: center; padding: 32px; }
.empty-state h2 { margin: 12px 0 7px; }
.empty-state p { color: var(--muted); margin: 0 0 20px; }
.empty-icon { width: 56px; height: 56px; border-radius: 8px; display: grid; place-items: center; margin: auto; background: #dcece6; color: var(--accent); font-size: 30px; }

.task-view { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.timeline { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; overscroll-behavior: contain; padding: 24px max(24px, calc((100% - 850px)/2)); display: flex; flex-direction: column; gap: 16px; }
.chat-turn { flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px; }
.chat-message { max-width: min(82%, 760px); padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.user-message { align-self: flex-end; background: #e5f1eb; border-color: #c7ddd2; }
.assistant-message { align-self: flex-start; background: var(--panel); box-shadow: 0 2px 8px rgba(18,30,38,.04); }
.assistant-message.active { border-color: #bfd3e8; }
.assistant-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.message-text { white-space: pre-wrap; line-height: 1.55; }
.message-meta { margin-top: 8px; color: var(--muted); font-size: 11px; }
.user-message .message-meta { text-align: right; }
.assistant-details { margin-top: 12px; border-top: 1px solid var(--line); }
.assistant-details > summary { padding-top: 10px; color: var(--muted); cursor: pointer; font-weight: 600; }
.assistant-details-content { padding-top: 8px; }
.run-card { flex: 0 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 2px 8px rgba(18,30,38,.04); overflow: hidden; }
.run-head { padding: 12px 15px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.run-head strong { overflow-wrap: anywhere; }
.run-body { padding: 15px; }
.run-section + .run-section { margin-top: 14px; }
.run-label { color: var(--muted); text-transform: uppercase; font-weight: 700; font-size: 11px; margin-bottom: 5px; }
.run-text, pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
pre { font: 13px/1.5 Consolas, monospace; padding: 11px; background: #f5f7f8; border: 1px solid #e4e8eb; border-radius: 5px; max-height: 380px; overflow: auto; }
.agent-trace { border-top: 1px solid var(--line); }
.agent-trace > summary { padding: 12px 0 4px; color: var(--accent-dark); font-weight: 700; cursor: pointer; }
.agent-trace-content { padding-top: 6px; }
.agent-step { padding: 12px 0; }
.agent-step + .agent-step { border-top: 1px solid #edf0f2; }
.agent-step-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.agent-step-head strong { overflow-wrap: anywhere; }
.agent-step-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.agent-step pre { margin-top: 7px; max-height: 280px; }
.live-progress { margin-top: 12px; padding: 11px; border: 1px solid #d6e4df; border-radius: 6px; background: #f5faf8; }
.live-progress-title { margin-bottom: 8px; color: var(--accent-dark); font-size: 12px; font-weight: 700; }
.live-progress-list { display: grid; gap: 8px; }
.live-progress-item { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 8px; align-items: start; }
.live-progress-marker { width: 9px; height: 9px; margin-top: 4px; border: 2px solid #7a9b8e; border-radius: 50%; background: white; }
.live-progress-item.finished .live-progress-marker { border-color: #1e8b63; background: #1e8b63; }
.live-progress-item.error .live-progress-marker, .live-progress-item.skipped .live-progress-marker { border-color: #ba5555; background: #ba5555; }
.live-progress-item.running .live-progress-marker { border-color: #477cac; animation: progress-pulse 1.2s ease-in-out infinite; }
.live-progress-item strong { display: block; font-size: 13px; line-height: 1.35; }
.live-progress-item small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.35; }
@keyframes progress-pulse { 50% { opacity: .35; } }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 4px; background: #e9edf0; color: #4d5961; font-size: 12px; white-space: nowrap; }
.status.completed { background: #dff1e9; color: #126347; }
.status.waiting_input { background: #fff1c9; color: #765500; }
.status.failed { background: #f7e4e4; color: #9b3030; }
.status.canceled { background: #eceff1; color: #59656d; }
.status.running, .status.preparing, .status.analyzing { background: #e1ecf8; color: #245f9d; }
.status.planning, .status.learning { background: #eee8f7; color: #694596; }

.composer { border-top: 1px solid var(--line); background: var(--panel); padding: 16px 24px; }
.composer textarea, dialog textarea, dialog input, dialog select, .composer select { width: 100%; border: 1px solid #cbd2d8; border-radius: 6px; padding: 10px; background: white; color: var(--text); resize: vertical; }
.composer textarea:focus, dialog textarea:focus, dialog input:focus, dialog select:focus { outline: 2px solid rgba(19,124,90,.18); border-color: var(--accent); }
.composer-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; }
.composer-actions { display: flex; gap: 8px; }
.composer-options { position: relative; color: var(--muted); }
.composer-options > summary { min-height: 38px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.composer-options-panel { position: absolute; left: 0; bottom: 44px; z-index: 3; display: flex; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: white; box-shadow: var(--shadow); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-button { min-height: 38px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; background: white; font-weight: 600; cursor: pointer; }
.file-button:hover { background: #f1f3f4; }
.file-field input { border: 0; padding: 4px 0; }
.attachment-selection { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 8px; }
.attachment-selection:empty { display: none; }
.attachment-preview { position: relative; min-width: 0; height: 64px; display: grid; grid-template-columns: 54px minmax(0, 1fr) 28px; align-items: center; gap: 8px; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: #f8faf9; }
.attachment-preview-visual { width: 54px; height: 52px; display: grid; place-items: center; overflow: hidden; border-radius: 4px; background: white; border: 1px solid #e2e7e4; color: var(--muted); font-size: 10px; font-weight: 700; }
.attachment-preview-visual img { width: 100%; height: 100%; object-fit: cover; }
.attachment-preview-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.attachment-preview-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.attachment-preview-info small { color: var(--muted); font-size: 11px; }
.attachment-remove { width: 28px; height: 28px; border: 0; border-radius: 4px; background: transparent; color: #7b858b; font-size: 22px; line-height: 1; cursor: pointer; }
.attachment-remove:hover { color: #a12f2f; background: #f6e7e7; }
.attachment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.attachment-card { min-width: 0; display: flex; flex-direction: column; gap: 5px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); text-decoration: none; background: #fafbfb; }
.attachment-card:hover { border-color: #aab7b1; background: #f4f8f6; }
.attachment-card img { width: 100%; height: 110px; object-fit: contain; background: white; border-radius: 4px; }
.attachment-card strong { overflow-wrap: anywhere; }
.attachment-card small { color: var(--muted); }
.run-messages { display: grid; gap: 7px; }
.run-message { margin-left: auto; max-width: min(78%, 620px); padding: 9px 11px; border-radius: 6px; background: #e7f2ed; border: 1px solid #c8dfd5; }
.run-message div { white-space: pre-wrap; overflow-wrap: anywhere; }
.run-message small { display: block; margin-top: 4px; color: var(--muted); text-align: right; }
.composer select { width: 150px; }
.segmented { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.segmented button { border: 0; background: white; padding: 7px 11px; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.active { background: #e3eee9; color: var(--accent-dark); font-weight: 600; }

.inspector-header { display: flex; align-items: center; justify-content: space-between; }
.inspector-header h2 { font-size: 17px; margin: 0; }
.agent-summary { color: var(--muted); margin: 7px 0 14px; font-size: 12px; }
.agent-list { display: grid; gap: 7px; }
.agent-item { border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.agent-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agent-item strong { overflow-wrap: anywhere; }
.agent-item p { color: var(--muted); margin: 5px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #aab2b8; flex: 0 0 auto; }
.dot.online { background: #22a06b; }
.dot.stale { background: #d58726; }
.config-note { margin-top: 18px; padding: 10px; background: #f5f7f8; border-left: 3px solid var(--blue); color: var(--muted); font-size: 12px; }

dialog { width: min(540px, calc(100vw - 32px)); border: 0; border-radius: 8px; box-shadow: var(--shadow); padding: 0; }
dialog::backdrop { background: rgba(17,27,33,.46); }
dialog form { padding: 20px; }
.dialog-header, .dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-header h2 { margin: 0; }
.dialog-footer { justify-content: flex-end; margin-top: 18px; }
.dialog-footer.split-actions { justify-content: space-between; flex-wrap: wrap; }
dialog label { display: grid; gap: 5px; margin-top: 14px; font-weight: 600; }
dialog label input, dialog label textarea, dialog label select { font-weight: 400; }
.knowledge-dialog { width: min(980px, calc(100vw - 32px)); }
.knowledge-panel { padding: 20px; }
.knowledge-panel .dialog-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.knowledge-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.knowledge-columns h3 { margin: 0 0 8px; font-size: 14px; }
.knowledge-list { max-height: min(570px, 65vh); overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.knowledge-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; }
.knowledge-row + .knowledge-row { border-top: 1px solid var(--line); }
.knowledge-row strong, .knowledge-row small { display: block; overflow-wrap: anywhere; }
.knowledge-row small { margin-top: 4px; color: var(--muted); line-height: 1.35; }
.danger-text-button { border: 0; background: transparent; color: var(--danger); font-weight: 600; cursor: pointer; }
.secondary.compact { min-height: 32px; padding: 5px 9px; }
.profile-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.profile-panel { padding: 20px; }
.profile-panel .dialog-header p { margin: 4px 0 0; color: var(--muted); }
.profile-section { padding: 18px 0; border-top: 1px solid var(--line); }
.profile-section:first-of-type { margin-top: 18px; }
.profile-section:last-child { padding-bottom: 0; }
.profile-section h3 { margin: 0 0 10px; font-size: 15px; }
.profile-section p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.profile-section-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.token-result { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; margin-top: 12px; }
.token-result label, .console-package label, .password-form label { margin: 0; }
.console-package { display: grid; grid-template-columns: minmax(180px, 1fr) auto; align-items: end; gap: 8px; margin-top: 10px; }
.password-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; padding: 0; }
.password-form button { min-height: 38px; grid-column: 3; justify-self: end; }
.artifact-list { border-top: 1px solid var(--line); }
.artifact-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.artifact-row strong, .artifact-row small { display: block; }
.artifact-row small { margin-top: 3px; color: var(--muted); }
.download-link { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 6px 10px; text-decoration: none; }
.download-link[aria-disabled="true"] { opacity: .45; cursor: default; }
.instruction-fieldset { border: 0; padding: 0; margin: 14px 0 0; }
.instruction-fieldset legend { padding: 0; font-weight: 600; }
.instruction-fieldset p, .dialog-note { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.instruction-picker { margin-top: 6px; border: 1px solid #cbd2d8; border-radius: 6px; max-height: 150px; overflow: auto; background: white; }
.instruction-picker-large { max-height: min(460px, 55vh); margin-top: 16px; }
.instruction-option { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: center; margin: 0; padding: 8px 10px; font-weight: 400; cursor: pointer; }
.instruction-option + .instruction-option { border-top: 1px solid #edf0f2; }
.instruction-option:hover { background: #f5f8f7; }
.instruction-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.instruction-option span { min-width: 0; overflow-wrap: anywhere; }
.instruction-option small { color: var(--muted); white-space: nowrap; }
.instruction-empty { padding: 12px; color: var(--muted); }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 420px; padding: 12px 15px; background: #26343b; color: white; border-radius: 6px; box-shadow: var(--shadow); }
.login-overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(243,245,247,.96); }
.login-panel { width: min(390px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: var(--shadow); }
.login-panel h1 { margin: 14px 0 4px; font-size: 22px; }
.login-panel p { margin: 0 0 20px; color: var(--muted); }
.login-panel label { display: grid; gap: 5px; margin-top: 12px; font-weight: 600; }
.login-panel input { width: 100%; padding: 10px; border: 1px solid #cbd2d8; border-radius: 6px; }
.login-panel button { width: 100%; margin-top: 18px; }
.login-error { min-height: 20px; margin-top: 8px; color: var(--danger); font-size: 12px; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 240px 1fr; }
  .inspector { display: none; }
}
@media (max-width: 720px) {
  body { overflow: hidden; }
  body.mobile-panel-visible { touch-action: none; }
  .app-shell { display: block; width: 100%; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .workspace { width: 100%; height: 100%; min-height: 0; background: var(--bg); }

  .mobile-shell-bar { flex: 0 0 auto; min-height: 56px; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: max(8px, env(safe-area-inset-top)) 12px 8px; border-bottom: 1px solid var(--line); background: var(--panel); }
  .mobile-shell-bar .icon-button { width: 40px; height: 40px; }
  .mobile-brand { min-width: 0; }
  .mobile-brand strong, .mobile-brand span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-brand strong { font-size: 15px; }
  .mobile-brand span { color: var(--muted); font-size: 11px; }
  .mobile-agents-button { min-height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; }

  .sidebar, .inspector { position: fixed; inset-block: 0; z-index: 32; display: flex; flex-direction: column; width: min(88vw, 340px); max-width: 100%; padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom)); overflow: hidden; border: 0; box-shadow: 0 0 30px rgba(17,27,33,.18); transition: transform .22s ease; }
  .sidebar { left: 0; transform: translateX(-105%); }
  .inspector { right: 0; transform: translateX(105%); }
  .tasks-open .sidebar, .agents-open .inspector { transform: translateX(0); }
  .mobile-panel-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; min-height: 42px; margin-bottom: 10px; }
  .mobile-panel-head strong { font-size: 17px; }
  .sidebar .brand-row { display: none; }
  .sidebar .section-label { margin-top: 20px; }
  .task-list, .agent-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; align-content: start; }
  .task-list { flex: 1 1 auto; max-height: none; }
  .account-row { flex: 0 0 auto; }
  .inspector-header h2 { display: none; }
  .inspector-header { justify-content: flex-end; }
  .agent-summary { margin-top: -28px; padding-right: 44px; }
  .config-note { flex: 0 0 auto; }
  .mobile-scrim { position: fixed; inset: 0; z-index: 31; width: 100%; height: 100%; border: 0; background: rgba(17,27,33,.42); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .tasks-open .mobile-scrim, .agents-open .mobile-scrim { display: block; opacity: 1; pointer-events: auto; }

  .workspace-header { flex: 0 0 auto; min-height: 0; padding: 10px 12px; align-items: flex-start; gap: 8px; }
  .workspace-header > div:first-child { min-width: 0; }
  .workspace-header h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
  .workspace-header p { display: -webkit-box; overflow: hidden; font-size: 11px; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .header-actions { flex: 0 0 auto; gap: 5px; }
  .header-actions .secondary, .header-actions .stop-button { min-height: 34px; padding: 6px 9px; font-size: 12px; }
  .header-actions .icon-button { width: 34px; height: 34px; }

  .empty-state { padding: 24px 20px; }
  .task-view { flex: 1 1 auto; min-height: 0; }
  .timeline { padding: 14px 10px; gap: 12px; scrollbar-gutter: auto; }
  .chat-message { max-width: 94%; padding: 10px 11px; }
  .run-head, .run-body { padding: 11px; }
  .agent-step-head { flex-direction: column; gap: 3px; }
  .agent-step-meta { white-space: normal; }
  pre { max-height: 260px; font-size: 12px; }
  .attachment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .composer { flex: 0 0 auto; padding: 9px 10px max(9px, env(safe-area-inset-bottom)); box-shadow: 0 -3px 14px rgba(18,30,38,.06); }
  .composer textarea { min-height: 54px; max-height: 120px; padding: 9px; resize: none; }
  .composer-footer { align-items: center; flex-direction: row; margin-top: 7px; }
  .composer-options > summary { min-height: 36px; font-size: 12px; }
  .composer-options-panel { position: absolute; left: 0; bottom: 41px; width: min(320px, calc(100vw - 20px)); flex-wrap: wrap; }
  .composer-actions { margin-left: auto; }
  .file-button, .composer-actions .primary { min-height: 36px; padding: 7px 11px; }
  .attachment-selection { grid-template-columns: 1fr; max-height: 146px; overflow-y: auto; }

  .knowledge-columns { grid-template-columns: 1fr; }
  .profile-section-head { align-items: stretch; flex-direction: column; }
  .token-result, .console-package, .password-form { grid-template-columns: 1fr; }
  .password-form button { grid-column: 1; justify-self: stretch; }
  dialog, .knowledge-dialog, .profile-dialog { width: 100%; max-width: none; max-height: 94vh; margin: auto 0 0; border-radius: 8px 8px 0 0; overflow: auto; }
  dialog form, .knowledge-panel, .profile-panel { padding: 16px; }
  .knowledge-list { max-height: 38vh; }
  .dialog-footer { position: sticky; bottom: 0; padding-top: 12px; background: white; }
  .toast { right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); left: 12px; max-width: none; }
  .login-overlay { padding: 12px; }
  .login-panel { padding: 22px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .task-status.active-process::before { animation: none; border-right-color: currentColor; }
}
