:root {
  color-scheme: dark;
  --bg: #090c17;
  --surface: #11162a;
  --surface-2: #171d35;
  --surface-3: #202843;
  --line: rgba(255,255,255,.09);
  --text: #f5f6fb;
  --muted: #98a1ba;
  --accent: #b9ff56;
  --accent-2: #70e1ff;
  --danger: #ff7b91;
  --warning: #ffc96c;
  --ok: #7ef0b8;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100dvh; overflow: hidden; }
button, input, textarea { font: inherit; }
button, label.file-button, label.command-file { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.is-hidden { display: none !important; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 20%, #26385c 0, var(--bg) 38%); }
.login-card { width: min(460px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 28px; background: rgba(17,22,42,.9); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.brand-mark { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 24px; border-radius: 18px; background: var(--accent); color: #111; font-size: 28px; font-weight: 900; transform: rotate(-4deg); box-shadow: 0 0 32px rgba(185,255,86,.22); }
.brand-mark.small { width: 38px; height: 38px; margin: 0; border-radius: 12px; font-size: 20px; }
.login-card h1 { margin: 0; font-size: clamp(28px, 6vw, 42px); line-height: 1.05; }
.login-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.7; }
label { font-size: 13px; font-weight: 700; }
.input-row { display: flex; gap: 10px; margin-top: 8px; }
input, textarea { width: 100%; color: var(--text); background: #0d1120; border: 1px solid var(--line); border-radius: 12px; outline: none; transition: border .2s, box-shadow .2s; }
input { height: 46px; padding: 0 14px; }
textarea { resize: none; padding: 13px 8px; background: transparent; border: 0; line-height: 1.5; max-height: 180px; }
input:focus, textarea:focus { border-color: rgba(185,255,86,.6); box-shadow: 0 0 0 3px rgba(185,255,86,.08); }
.primary, .secondary, .quiet { border: 0; border-radius: 12px; cursor: pointer; }
.primary { padding: 0 20px; background: var(--accent); color: #111; font-weight: 800; }
.secondary { min-height: 42px; padding: 0 16px; border: 1px solid var(--line); background: var(--surface-3); font-weight: 700; cursor: pointer; border-radius: 12px; }
.quiet { background: transparent; color: var(--muted); }
.form-error { min-height: 20px; color: var(--danger) !important; font-size: 13px; }
.login-help { width: 100%; margin-top: 5px; padding: 10px; border: 0; background: transparent; color: var(--accent-2); cursor: pointer; font-weight: 700; }
.app-shell { height: 100dvh; display: grid; grid-template-columns: 250px minmax(0,1fr); }
.sidebar { padding: 24px 16px; border-right: 1px solid var(--line); background: #0d1120; display: flex; flex-direction: column; overflow: hidden; }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 0 7px 26px; }
.brand-row strong, .brand-row span { display: block; }
.brand-row span { color: var(--muted); font-size: 12px; }
.new-task { width: 100%; padding: 13px 14px; border: 1px solid rgba(185,255,86,.24); border-radius: 13px; background: rgba(185,255,86,.08); color: var(--accent); font-weight: 800; text-align: left; cursor: pointer; }
.sidebar-label { margin: 28px 8px 10px; color: #68718a; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.session-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.session-item { padding: 11px 12px; border: 0; border-radius: 11px; background: transparent; text-align: left; cursor: pointer; }
.session-item strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.session-item span { color: var(--muted); font-size: 11px; }
.session-item.active { background: var(--surface-2); }
.sidebar-footer { margin-top: auto; display: grid; gap: 3px; }
.sidebar-help, .logout { padding: 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.sidebar-help { color: var(--accent-2); }
.main-panel { min-width: 0; display: grid; grid-template-rows: auto 1fr; overflow: hidden; background: radial-gradient(circle at 65% -10%, rgba(112,225,255,.07), transparent 32%), var(--bg); }
.topbar { min-height: 82px; padding: 18px 30px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: rgba(9,12,23,.84); backdrop-filter: blur(18px); }
.topbar h1 { max-width: 650px; margin: 0; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title-row { min-width: 0; }
.mobile-top-actions, .mobile-new-task, .mobile-help { display: none; }
.status-strip { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.status-pill { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.025); font-size: 10px; font-weight: 700; }
.status-pill.ok { color: var(--ok); border-color: rgba(126,240,184,.2); }
.status-pill.warn { color: var(--warning); border-color: rgba(255,201,108,.25); }
.status-pill.bad { color: var(--danger); border-color: rgba(255,123,145,.25); }
.view { display: none; min-height: 0; overflow-y: auto; padding: 28px clamp(20px,4vw,54px) 110px; }
.view.active { display: block; }
#view-chat.active { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.empty-state { width: min(820px, calc(100% - 40px)); margin: auto; padding: 60px 0 34px; text-align: center; }
.orb { width: 78px; height: 78px; margin: 0 auto 24px; padding: 1px; border-radius: 50%; background: conic-gradient(var(--accent), var(--accent-2), #8a7dff, var(--accent)); box-shadow: 0 0 60px rgba(112,225,255,.18); animation: breathe 4s ease-in-out infinite; }
.orb span { display: grid; place-items: center; width: 100%; height: 100%; border-radius: inherit; background: var(--surface); font-size: 28px; font-weight: 900; }
@keyframes breathe { 50% { transform: translateY(-5px); box-shadow: 0 12px 75px rgba(185,255,86,.2); } }
.empty-state h2 { margin: 0; font-size: clamp(26px, 5vw, 46px); letter-spacing: -.04em; }
.empty-state > p:not(.eyebrow) { max-width: 600px; margin: 15px auto 28px; color: var(--muted); line-height: 1.7; }
.starter-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.starter-grid button { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; cursor: pointer; }
.starter-grid b, .starter-grid span { display: block; }
.starter-grid span { margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.message-list { width: min(880px, calc(100% - 36px)); margin: 0 auto; padding: 30px 0 18px; overflow-y: auto; flex: 1; }
.message { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 12px; margin: 0 0 24px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--surface-3); color: var(--accent); font-size: 12px; font-weight: 900; }
.message.user .avatar { color: #111; background: var(--accent); }
.message-head { display: flex; gap: 9px; align-items: baseline; margin: 1px 0 7px; }
.message-head strong { font-size: 13px; }
.message-head span { color: var(--muted); font-size: 10px; }
.message-body { color: #e7e9f2; white-space: pre-wrap; line-height: 1.65; font-size: 14px; }
.message-meta { margin-top: 9px; color: var(--muted); font-size: 10px; }
#confirmation-area { width: min(880px, calc(100% - 36px)); margin: 0 auto; }
.confirmation-card { margin: 0 0 12px; padding: 15px; border: 1px solid rgba(255,201,108,.3); border-radius: 14px; background: rgba(255,201,108,.07); display: flex; gap: 12px; align-items: center; }
.confirmation-card div { flex: 1; }
.confirmation-card b { display: block; margin-bottom: 4px; color: var(--warning); }
.confirmation-card p { margin: 0; color: #d7d3c8; font-size: 12px; line-height: 1.5; }
.composer { width: min(880px, calc(100% - 36px)); margin: 0 auto 22px; padding: 10px; border: 1px solid var(--line); border-radius: 18px; background: rgba(17,22,42,.96); box-shadow: 0 20px 60px rgba(0,0,0,.26); }
.composer-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 2px 7px; }
.route-switch { display: flex; gap: 3px; }
.route-switch button { padding: 5px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
.route-switch button.selected { background: var(--surface-3); color: var(--text); }
.discussion-toggle { color: var(--muted); font-size: 10px; }
.discussion-toggle input { width: auto; height: auto; }
.compose-row { display: flex; align-items: flex-end; gap: 7px; }
.attach-button, .send-button { flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 12px; cursor: pointer; font-size: 20px; }
.attach-button { color: var(--muted); background: transparent; }
.send-button { color: #111; background: var(--accent); font-weight: 900; }
.composer-note { margin: 4px 8px 0 45px; color: #68718a; font-size: 9px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-heading h2 { margin: 0; font-size: 30px; }
.file-button { display: grid; place-items: center; min-height: 42px; cursor: pointer; }
.action-grid { display: grid; gap: 14px; }
.action-grid.two { grid-template-columns: repeat(2,1fr); }
.panel-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel-card h3 { margin: 0 0 7px; }
.panel-card p, .section-intro { color: var(--muted); font-size: 13px; line-height: 1.6; }
.panel-card input + button, .panel-card .check + button { width: 100%; margin-top: 10px; }
.check { display: block; margin-top: 10px; color: var(--muted); font-size: 11px; }
.check input { width: auto; height: auto; }
.section-subhead { margin: 30px 0 12px; display: flex; align-items: center; justify-content: space-between; }
.section-subhead h3 { margin: 0; }
.section-subhead span { color: var(--muted); font-size: 11px; }
.card-list { display: grid; gap: 8px; }
.data-card { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.file-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--surface-3); color: var(--accent-2); font-weight: 800; font-size: 10px; }
.data-card strong, .data-card span { display: block; }
.data-card strong { font-size: 13px; }
.data-card span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.data-card a { color: var(--accent); font-size: 11px; }
.timeline { position: relative; max-width: 800px; }
.timeline:before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1px; background: var(--line); }
.event { position: relative; padding: 0 0 22px 30px; }
.event:before { content: ""; position: absolute; left: 3px; top: 5px; width: 9px; height: 9px; border: 2px solid var(--bg); border-radius: 50%; background: var(--accent-2); }
.event b { font-size: 13px; }
.event time, .event p { color: var(--muted); font-size: 10px; }
.event p { margin: 5px 0 0; line-height: 1.5; }
.command-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.command-grid button, .command-file { min-height: 150px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-align: left; cursor: pointer; }
.command-grid span, .command-grid b, .command-grid small { display: block; }
.command-grid span { margin-bottom: 19px; color: var(--accent); font-size: 22px; }
.command-grid small { margin-top: 7px; color: var(--muted); line-height: 1.5; }
.settings-stack { display: grid; gap: 14px; max-width: 900px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.provider-list, .agent-list { display: grid; gap: 8px; }
.provider, .agent { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.provider:first-child, .agent:first-child { border-top: 0; }
.provider span, .agent span { color: var(--muted); font-size: 11px; }
.dot { display: inline-block !important; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--danger); }
.dot.on { background: var(--ok); }
.bottom-nav { display: none; }
.text-dialog { width: min(420px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 20px; color: var(--text); background: var(--surface); box-shadow: 0 28px 90px rgba(0,0,0,.6); }
.text-dialog::backdrop { background: rgba(3,5,12,.72); backdrop-filter: blur(5px); }
.text-dialog form { padding: 24px; }
.text-dialog h2 { margin: 0 0 20px; font-size: 20px; }
.text-dialog label { display: block; margin-bottom: 7px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.dialog-actions button { min-height: 42px; padding: 0 18px; cursor: pointer; }
.help-dialog { width: min(1040px, calc(100% - 32px)); height: min(900px, calc(100dvh - 32px)); max-width: none; max-height: none; padding: 0; border: 1px solid var(--line); border-radius: 22px; color: var(--text); background: var(--surface); box-shadow: 0 28px 90px rgba(0,0,0,.65); overflow: hidden; }
.help-dialog[open] { display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.help-dialog::backdrop { background: rgba(3,5,12,.78); backdrop-filter: blur(6px); }
.help-dialog-header, .help-dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; background: #0d1120; }
.help-dialog-header { border-bottom: 1px solid var(--line); }
.help-dialog-header h2 { margin: 0; font-size: 18px; }
.help-dialog-header button { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--text); font-size: 24px; cursor: pointer; }
.help-dialog iframe { width: 100%; height: 100%; border: 0; background: #f5f7ef; }
.help-dialog-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.help-dialog-footer a { color: var(--accent); font-weight: 800; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 22px; max-width: calc(100% - 36px); padding: 11px 15px; border: 1px solid var(--line); border-radius: 12px; background: #242c47; box-shadow: 0 14px 50px rgba(0,0,0,.4); opacity: 0; transform: translate(-50%,12px); pointer-events: none; transition: .25s; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
@media (max-width: 860px) {
  body { overflow: hidden; }
  .app-shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .sidebar { display: none; }
  .main-panel { min-height: 0; }
  .topbar { min-height: 74px; padding: 13px 16px; display: block; }
  .topbar .eyebrow { display: none; }
  .topbar h1 { font-size: 16px; }
  .topbar-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .topbar-title-row > div { min-width: 0; }
  .mobile-top-actions { display: flex; gap: 7px; }
  .mobile-new-task, .mobile-help { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 11px; font-size: 22px; cursor: pointer; }
  .mobile-new-task { border: 1px solid rgba(185,255,86,.25); background: rgba(185,255,86,.08); color: var(--accent); }
  .mobile-help { border: 1px solid rgba(112,225,255,.24); background: rgba(112,225,255,.07); color: var(--accent-2); font-size: 17px; font-weight: 900; }
  .status-strip { margin-top: 8px; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; }
  .status-pill { flex: 0 0 auto; }
  .view { padding: 22px 16px 95px; }
  #view-chat.active { padding: 0; }
  .empty-state { padding-top: 38px; }
  .starter-grid { grid-template-columns: 1fr; }
  .message-list { width: calc(100% - 24px); }
  #confirmation-area, .composer { width: calc(100% - 20px); }
  .composer { margin-bottom: 10px; }
  .composer-note { display: none; }
  .route-switch button { padding: 5px 6px; }
  .action-grid.two, .command-grid { grid-template-columns: 1fr; }
  .command-grid button, .command-file { min-height: 120px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5,1fr); padding: 7px 6px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(13,17,32,.97); backdrop-filter: blur(18px); }
  .bottom-nav button { border: 0; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
  .bottom-nav span { display: block; margin-bottom: 3px; font-size: 17px; }
  .bottom-nav button.active { color: var(--accent); }
  .setting-row { align-items: flex-start; flex-direction: column; }
  .help-dialog { width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .help-dialog-header, .help-dialog-footer { padding-left: 14px; padding-right: 14px; }
  .help-dialog-footer span { max-width: 70%; }
}
@media (max-width: 460px) {
  .login-card { padding: 28px 22px; }
  .input-row { flex-direction: column; }
  .input-row .primary { height: 46px; }
  .empty-state h2 { font-size: 29px; }
  .composer-tools { overflow-x: auto; }
  .discussion-toggle { white-space: nowrap; }
}
