/* Implemented from the 界面 task: task desk + conversation + gallery. */
:root{color-scheme:light;--bg:#f4f6f3;--paper:#fff;--ink:#1f332c;--muted:#64736a;--line:#e1e8e2;--green:#23664b;--green-dark:#1f332c;--mint:#e6f0e8;--lime:#fff;--warm:#fcf1d9;--warning:#886014;--blue:#315c8e;--blue-soft:#e9eff8;--chat-bg:#f8f9fc;--gallery-bg:#f8f7f3}
.app-shell{height:100dvh;min-height:0;max-width:1800px}
.topbar{height:64px;padding:10px 24px;background:var(--bg)}
.brand{font-size:15px;gap:9px}.brand small{display:none}.brand-mark{width:30px;height:30px;border-radius:9px;background:var(--green);color:#fff}.brand-mark svg{width:18px;height:18px}
.connection-area{gap:10px}.connection-badge{font-size:12px;color:var(--green)}
.icon-button{width:44px;height:44px;color:var(--muted);border-radius:12px}.icon-button:hover{background:var(--mint)}
.text-button{font-size:13px}.task-sidebar{width:340px;padding:24px 20px 0;background:var(--bg)}
.sidebar-heading{margin-bottom:20px;gap:10px}.sidebar-heading .eyebrow{display:none}.sidebar-heading h1{font-size:28px;line-height:1.25;margin:0;font-weight:650;letter-spacing:-1px}.sidebar-heading .count{display:none}
.sidebar-subtitle{font-size:12px;color:var(--muted);line-height:1.6;margin-top:9px}
.sidebar-actions{gap:2px}.new-chat-button{width:44px;height:44px;min-width:44px;padding:0;border-radius:14px;background:var(--green);color:#fff;border:0}.new-chat-button svg{width:20px;height:20px}.new-chat-button span{display:none}
.sidebar-modes{display:flex;gap:6px;margin:0 0 16px;padding:4px;border:1px solid var(--line);border-radius:12px;background:var(--paper)}
.sidebar-mode{flex:1;min-height:36px;border-radius:8px;font-size:13px;color:var(--muted)}.sidebar-mode[aria-pressed=true]{background:var(--mint);color:var(--green);font-weight:600}
.search-box{min-height:44px;background:var(--paper);border-color:var(--line);border-radius:12px;padding:0 12px;gap:9px}.search-box input{font-size:16px;min-height:44px;color:var(--ink);outline:0}.search-box:focus-within{outline:2px solid var(--green);outline-offset:2px}.search-box kbd{display:none}
.task-filters{gap:4px;padding:16px 0;border:0}.filter{justify-content:center;flex:1;min-height:44px;padding:8px 5px;font-size:12px;border-radius:10px;color:var(--ink);gap:4px}.filter.active{background:var(--ink);color:var(--paper);font-weight:600}.filter span{font-size:12px;opacity:1}
.task-overview{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding-bottom:18px;scrollbar-width:thin}
.overview-section-heading{display:flex;align-items:center;justify-content:space-between;color:var(--muted);font-size:12px;margin:20px 0 7px;font-weight:400;gap:8px}
.task-row{display:flex;align-items:flex-start;gap:12px;width:100%;text-align:left;padding:17px 0;border-bottom:1px solid var(--line);min-height:90px}
.task-row .task-row-symbol{width:38px;height:38px;display:grid;place-items:center;background:var(--mint);color:var(--green);border-radius:12px;flex:none}
.task-row .task-row-symbol.waiting{background:var(--warm);color:var(--warning)}.task-row .task-row-symbol.failed{color:var(--danger)}
.task-row-body{flex:1;min-width:0}.task-row h3{font-size:15px;font-weight:600;line-height:1.55;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.task-row-meta{font-size:12px;color:var(--muted);line-height:1.7;margin-top:7px;display:flex;gap:5px;flex-wrap:wrap}.task-row-meta .status-label{font-size:12px}.task-row-meta .task-row-project{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:170px}.task-row-stamp{font-size:11px;color:var(--muted);margin-top:3px;line-height:1.6}
.task-row>.task-row-arrow{width:15px;height:15px;margin-top:5px;transform:rotate(180deg);color:var(--muted);flex:none}
.task-row:hover,.task-row.selected{background:var(--mint)}.task-row.selected{border-radius:12px;padding-left:10px;padding-right:10px}
.attention-task{display:flex;flex-direction:column;align-items:flex-start;text-align:left;width:100%;padding:16px;border-radius:16px;background:var(--warm);gap:10px;margin:0 0 10px}
.attention-flag{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:600;color:var(--warning)}.attention-flag svg{width:16px;height:16px}
.attention-task h3{font-size:15px;line-height:1.55;overflow-wrap:anywhere;font-weight:600;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.attention-task p{font-size:12px;line-height:1.65;color:var(--warning)}.attention-action{display:flex;align-items:center;justify-content:space-between;width:100%;font-size:12px;color:var(--warning);min-height:28px}.attention-action svg{width:16px;height:16px}
.attention-more{width:100%;min-height:44px;text-align:left;color:var(--warning);font-size:13px}
.thread-list{margin:0 -5px;padding:0 5px 18px}.project-heading-row{gap:4px;border-bottom:1px solid var(--line)}.project-heading-row .project-heading{border:0}
.project-heading,.tree-section-heading{min-height:48px;font-size:14px;padding-top:10px;padding-bottom:10px}.project-heading{gap:8px}.project-name{white-space:normal;line-height:1.6}.project-count{font-size:12px}.project-running,.project-waiting{font-size:10px;padding:3px 5px}.project-new-chat{width:44px;min-width:44px;height:44px;color:var(--green);background:var(--mint);border-radius:12px}
.tree-thread h3{font-size:14px;line-height:1.65;-webkit-line-clamp:2}.tree-thread .status-label,.tree-thread .thread-timestamp{font-size:11px}.tree-thread{padding:12px 10px}.tree-section-heading{color:var(--muted)}.project-empty{font-size:12px;color:var(--muted);line-height:1.7}
.sidebar-foot{font-size:11px;padding:14px 0;line-height:1.5;color:var(--muted)}.sidebar-foot svg{width:14px;height:14px}
.detail-panel{margin:16px 20px;border-color:var(--line);border-radius:18px;background:var(--paper)}
.detail-header{padding:14px 22px 0;background:var(--paper);border-color:var(--line)}.detail-title-row{gap:6px;min-height:44px}.detail-title-block h2{font-size:17px;line-height:1.5;margin:0}.detail-title-toggle{min-height:30px}.detail-eyebrow{font-size:11px;gap:7px;line-height:1.5}.detail-eyebrow .status-label{font-size:11px}.detail-title-toggle>svg{width:11px;height:11px}
.detail-context{font-size:11px;line-height:1.6;color:var(--muted);margin-top:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.detail-tools{display:flex;align-items:center;flex:none;gap:0}.detail-tools .icon-button{width:38px}.detail-tools svg{width:18px;height:18px}
.detail-tabs{margin-top:10px;gap:24px;height:42px}.detail-tab{font-size:13px;min-height:42px;padding:0 0 9px;align-items:center}.detail-tab>svg{display:none}.detail-tab>span{font-size:10px;padding:2px 5px}.last-sync{font-size:10px;align-self:center;padding-bottom:8px;color:var(--muted)}
.interrupt-button{align-self:center;margin:0;min-height:36px;max-width:76px;flex:none}.interrupt-button span{font-size:10px}
.app-shell[data-detail-view=messages] .detail-panel{--green:var(--blue);--mint:var(--blue-soft);background:var(--chat-bg)}
.messages{padding:22px 24px 12px;background:var(--chat-bg);overflow:auto;overscroll-behavior:contain}
.message-log,.questions-panel{max-width:780px;margin-left:auto;margin-right:auto;width:100%}.message{margin-bottom:23px}.message-header{gap:7px;margin-bottom:8px;font-size:12px;color:var(--blue)}.avatar{width:24px;height:24px;border-radius:7px;font-size:11px}.avatar.assistant{background:var(--blue);color:#fff}.avatar svg{width:14px;height:14px}.message-name{font-size:12px}.message-time,.message-channel{font-size:10px;color:var(--muted)}.message-channel{background:var(--blue-soft);padding:2px 6px;border:0}
.message-content{font-size:15px;line-height:1.9;color:var(--ink);overflow-wrap:anywhere}.message-content p{margin-bottom:10px}.message.user{display:flex;align-items:flex-end;flex-direction:column}.message.user .message-header{justify-content:flex-end;margin-bottom:5px}.message.user .avatar,.message.user .message-name{display:none}.message.user .message-content{width:fit-content;max-width:88%;background:var(--blue-soft);border:0;padding:12px 15px;border-radius:15px 15px 4px 15px;font-size:14px;line-height:1.8}.message.user .message-content p:last-child{margin-bottom:0}
.message-content pre{background:var(--paper);border:1px solid var(--line);border-radius:12px}.message-content a{color:var(--blue)}
.questions-panel{max-height:none;overflow:visible;background:transparent;border:0;padding:4px 0 12px;flex:initial}.question-card{padding:16px;margin-bottom:12px;border:1px solid var(--line);border-radius:16px;background:var(--paper)}.question-card .eyebrow{font-size:12px;letter-spacing:0;color:var(--warning)}.question-card h3{font-size:15px;line-height:1.7;margin:8px 0 14px}.question-options{gap:9px}.question-option{border-color:var(--line);min-height:48px;padding:11px 12px;font-size:14px;border-radius:11px;align-items:flex-start}.question-option input{margin:2px 0 0;accent-color:var(--blue);width:18px;height:18px}.question-option:has(input:checked){background:var(--blue-soft);border-color:var(--blue)}.question-custom{font-size:16px;border-color:var(--line);border-radius:10px;color:var(--ink);background:var(--paper);min-height:45px;max-height:160px}.question-card .primary-button{width:100%;background:var(--blue);min-height:44px;border-radius:11px;font-size:14px}.question-answer{color:var(--muted);font-size:13px;line-height:1.8}.resolved-questions{color:var(--muted);font-size:12px}.resolved-questions>summary{min-height:44px;display:flex;align-items:center;cursor:pointer}.resolved-questions .question-card{margin-top:8px}
.reply-form{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"files files" "text text" "tools send";gap:3px 8px;margin:0 20px 0;padding:10px 12px;border:1px solid var(--line);border-radius:16px;background:var(--paper);box-shadow:none;flex:none}
.reply-form textarea{grid-area:text;min-height:40px;max-height:120px;padding:5px 1px;font-size:16px;line-height:1.6;background:transparent;color:var(--ink)}.reply-form .attachment-list{grid-area:files;margin:0 0 5px;max-height:100px}.attachment-toolbar{grid-area:tools;border:0;margin:0;padding:0;gap:4px;min-width:0;flex-wrap:nowrap}.attachment-toolbar>span{display:none}.attachment-toolbar button{font-size:12px;gap:5px;min-height:44px;padding:0 7px;color:var(--muted)}.attachment-toolbar svg{width:16px;height:16px}.reply-form .compose-footer{grid-area:send;display:flex;margin:0;padding:0;align-items:center}.send-button{min-width:44px;width:44px;height:44px;min-height:44px;padding:0;border-radius:14px;background:var(--blue);color:#fff}.send-button span{display:none}.send-button svg{width:20px;height:20px}.compose-status{flex:none;margin:0;padding:8px 20px 12px;text-align:center;font-size:10px;line-height:1.5;min-height:26px;color:var(--muted)}
.artifacts-view{background:var(--gallery-bg);padding:23px 24px}.gallery-heading{margin-bottom:15px}.gallery-heading h2{font-size:25px;line-height:1.3;letter-spacing:-.8px}.gallery-heading p{margin-top:7px;font-size:12px;line-height:1.7;color:var(--muted);overflow-wrap:anywhere}
.artifacts-toolbar{display:block;margin:0 0 16px;overflow:visible}.artifact-filters{display:flex;gap:4px}.artifact-filter{min-height:44px;padding:8px 5px;flex:1;font-size:12px;border-radius:10px;white-space:nowrap;color:var(--ink)}.artifact-filter.active{background:var(--ink);color:var(--paper)}.artifact-total{display:block;margin:8px 0 0;font-size:11px;color:var(--muted)}
.artifact-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}.artifact-card{background:var(--paper);border:1px solid var(--line);border-radius:16px;overflow:hidden;box-shadow:none;min-width:0;position:relative}.artifact-card:hover{border-color:var(--green);transform:none;box-shadow:none}.artifact-card.featured{grid-column:1 / -1}.artifact-thumb{height:140px;background:var(--mint);position:relative}.artifact-thumb.document,.artifact-thumb.pdf,.artifact-thumb.spreadsheet{background:var(--mint)}.artifact-thumb>svg{height:45px;width:45px;color:var(--green);stroke-width:1.2}.artifact-thumb.model{background:radial-gradient(ellipse at 50% 25%,var(--paper),var(--mint))}.artifact-thumb.model>svg{width:88px;height:88px;color:var(--green);transform:rotate(-7deg)}.featured .artifact-thumb{height:225px}.featured .artifact-thumb>svg{width:90px;height:90px}.artifact-thumb img{object-fit:cover}.artifact-ext{position:absolute;right:auto;max-width:calc(100% - 24px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;left:12px;top:12px;bottom:auto;background:var(--paper);color:var(--green);border-radius:7px;font-size:10px;padding:5px 7px}.artifact-open-hint{position:absolute;bottom:13px;left:0;right:0;text-align:center;font-size:12px;color:var(--green)}.artifact-info{padding:13px 12px}.artifact-info h3{font-size:13px;line-height:1.6;white-space:normal;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.featured .artifact-info h3{font-size:15px}.artifact-info p{font-size:11px;color:var(--muted);margin-top:6px;gap:5px}.artifact-info p svg{width:14px;height:14px}.artifact-footnote{color:var(--muted);font-size:11px;line-height:1.8;margin-top:20px}.gallery-return{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:64px;text-align:left;margin-top:20px;border-top:1px solid var(--line);padding:15px 0;font-size:13px;color:var(--green)}.gallery-return>span{display:grid;gap:5px;min-width:0}.gallery-return small{font-size:11px;color:var(--muted);font-weight:400}.gallery-return strong{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
.health-notice,.notice{background:var(--warm);color:var(--warning);border-color:var(--line);font-size:12px;line-height:1.6}.health-notice{padding:9px 20px;flex:none}
.preview-dialog,.desktop-dialog,.help-dialog,.new-chat-dialog,.login-card{background:var(--paper);color:var(--ink);border-color:var(--line)}.preview-header,.preview-footer,.desktop-header,.help-header{border-color:var(--line)}.preview-body{background:var(--bg)}.preview-footer,.help-muted{color:var(--muted)}.text-preview,.sheet-preview,.desktop-controls,.help-content{color:var(--ink);background:var(--paper)}.new-chat-form input,.new-chat-form textarea,.new-chat-form select,.token-field{background:var(--paper);color:var(--ink);border-color:var(--line)}.new-chat-path,.new-chat-hint{color:var(--muted)}.primary-button{background:var(--green);color:#fff}.toast{background:var(--ink);color:var(--paper);font-size:13px;z-index:100}
.question-other{font-size:12px;color:var(--muted)}.question-other>summary{min-height:40px;padding:10px 0;cursor:pointer}.question-other .question-custom{margin-top:0}.question-card .primary-button{justify-content:center}.artifact-info p span{min-width:0;overflow-wrap:anywhere}.new-chat-form label,.help-content strong,.sheet-title{color:var(--ink)}.sheet-table td,.sheet-table th{border-color:var(--line)}.sheet-table th,.sheet-table tr:first-child td{background:var(--mint);color:var(--ink)}
@media(min-width:1100px){.task-sidebar{width:370px;padding-left:24px;padding-right:24px}.artifact-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.artifact-card.featured{grid-column:span 2;grid-row:span 2}.featured .artifact-thumb{height:300px}.messages{padding-left:32px;padding-right:32px}}
@media(max-width:760px),(max-width:1000px) and (max-height:500px){
  .app-shell,.app-shell:not([data-mobile-view=tasks]){height:100dvh;min-height:0;padding-bottom:calc(64px + env(safe-area-inset-bottom))}
  .topbar{display:flex;height:auto;min-height:calc(50px + env(safe-area-inset-top));padding:3px 16px;padding-top:calc(3px + env(safe-area-inset-top));gap:7px}.topbar .brand{font-size:12px;gap:6px}.topbar .brand>span:last-child{display:block}.topbar .brand-mark{display:none}.brand>span:last-child::before{content:""}.brand>span:last-child{white-space:nowrap}.topbar .connection-area{gap:0}.connection-badge{font-size:10px;gap:5px;max-width:150px;margin-left:auto}.connection-area .icon-button,.desktop-button{width:36px;min-width:36px;min-height:44px;height:44px;padding:0}.connection-area .icon-button svg,.desktop-button svg{height:18px;width:18px}.connection-area #logout-button{display:none}
  .app-shell[data-mobile-view=messages] .topbar,.app-shell[data-mobile-view=artifacts] .topbar{display:none}
  .app-shell[data-mobile-view=messages] .detail-header,.app-shell[data-mobile-view=artifacts] .detail-header{padding-top:calc(8px + env(safe-area-inset-top))}
  .app-shell .task-sidebar{padding:20px 20px 0;display:none;width:100%;border:0;flex:1;min-height:0}.app-shell[data-mobile-view=tasks] .task-sidebar,.app-shell[data-mobile-view=projects] .task-sidebar{display:flex}
  .app-shell .detail-panel{display:flex;margin:0;border:0;border-radius:0;min-height:0}.app-shell[data-mobile-view=tasks] .detail-panel,.app-shell[data-mobile-view=projects] .detail-panel{display:none}
  .sidebar-heading{margin-bottom:20px}.sidebar-heading h1{font-size:29px}.sidebar-actions #refresh-button{display:none}.sidebar-subtitle{font-size:12px;margin-top:9px}.sidebar-modes{display:none}.task-filters{padding:16px 0 19px}.task-overview{padding-bottom:12px}.sidebar-foot{padding:13px 0;min-height:40px}.sidebar-foot>svg{display:none}
  .mobile-navigation,.app-shell:not([data-mobile-view=tasks]) .mobile-navigation{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));position:fixed;left:0;bottom:0;right:0;z-index:20;height:calc(64px + env(safe-area-inset-bottom));padding:4px 10px env(safe-area-inset-bottom);align-items:start;background:var(--paper);border-top:1px solid var(--line);backdrop-filter:none}
  .mobile-nav{display:flex;min-height:54px;align-items:center;justify-content:center;flex-direction:column;gap:4px;padding:5px 0;font-size:11px;color:var(--muted);border-radius:0}.mobile-nav svg{height:20px;width:20px}.mobile-nav.active{color:var(--green);background:none;font-weight:600}
  .mobile-back{display:flex;min-width:36px;width:36px;height:44px;margin:0 3px 0 -7px}.mobile-back svg{width:18px;height:18px}.detail-header{padding:8px 16px 0}.detail-title-row{min-height:45px;gap:0}.detail-title-block h2{font-size:15px;line-height:1.5;margin:0}.detail-eyebrow{display:none}.detail-context{font-size:11px;margin-top:3px}.detail-tabs{height:39px;margin-top:6px;gap:23px}.detail-tab{height:39px;min-height:39px;padding:0 0 8px;font-size:13px}.last-sync{font-size:9px;line-height:1.5;padding-bottom:8px}.detail-tools .icon-button{width:34px;min-width:34px;height:44px}.interrupt-button{max-width:50px;padding:5px}.interrupt-button span{display:none}.interrupt-button svg{width:15px;height:15px}
  .messages{padding:20px 20px 12px}.message-content{font-size:14px;line-height:1.9}.message.user .message-content{max-width:90%;font-size:14px}.message-header{margin-bottom:9px}.message{margin-bottom:22px}.questions-panel{padding:4px 0 6px;max-height:none}.question-card{padding:15px}.question-card h3{font-size:15px}.question-option{font-size:13px;min-height:47px}.question-card .primary-button{font-size:13px}
  .reply-form{margin:0 13px;padding:10px 12px;border-radius:16px;gap:3px 5px}.reply-form textarea{min-height:40px;max-height:100px;line-height:1.6;padding:5px 1px}.attachment-toolbar button{font-size:12px;min-height:44px;padding:0 6px}.send-button{width:44px;height:44px;border-radius:14px;min-width:44px}.compose-status{font-size:10px;padding:7px 16px 10px;line-height:1.5}
  .artifacts-view{padding:20px}.gallery-heading h2{font-size:26px}.artifact-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.artifact-card.featured{grid-column:1 / -1;grid-row:auto}.artifact-thumb{height:120px}.featured .artifact-thumb{height:210px}.artifact-info h3{font-size:13px}.artifact-total{font-size:11px}.artifact-footnote{font-size:10px}.gallery-return{margin-top:20px}
  .health-notice{padding:8px 16px;font-size:11px;max-height:90px;overflow:auto}.toast,#app[data-mobile-view=tasks]~.toast{bottom:calc(78px + env(safe-area-inset-bottom));max-width:calc(100% - 32px)}
}
@media(max-width:360px){.task-sidebar,.app-shell .task-sidebar{padding-left:16px;padding-right:16px}.messages{padding-left:15px;padding-right:15px}.artifacts-view{padding-left:16px;padding-right:16px}.connection-badge{font-size:9px;max-width:125px}.topbar .brand{font-size:11px}.topbar{padding-left:16px;padding-right:8px}.question-card{padding:13px}.reply-form{margin-left:10px;margin-right:10px}.detail-header{padding-left:12px;padding-right:12px}.last-sync{font-size:8px}.detail-tools .icon-button{width:32px;min-width:32px}}
@media(prefers-color-scheme:dark){:root{color-scheme:dark;--bg:#171d1a;--paper:#222b25;--ink:#edf3ef;--muted:#a7b7ad;--line:#39483e;--green:#90d4ae;--green-dark:#1b3528;--mint:#2d4536;--warm:#443b25;--warning:#e9c47a;--blue:#9ebfe7;--blue-soft:#293b50;--chat-bg:#18212c;--gallery-bg:#22231e;--danger:#f2a59b}.brand-mark,.new-chat-button,.primary-button{color:#163323}.avatar.assistant,.send-button,.question-card .primary-button{color:#18212c}.task-row:hover,.thread-item:hover{background:var(--mint)}.thread-item.selected{background:var(--paper);border-color:var(--line)}.model-controls button{background:var(--paper);color:var(--ink)}.login-screen{background:var(--bg)}.preview-dialog::backdrop,.desktop-dialog::backdrop,.help-dialog::backdrop,.new-chat-dialog::backdrop{background:#0008}.question-option:has(input:checked){color:var(--ink)}.message.user .message-content{color:var(--ink)}}
