:root {
  font: 14px/1.55 "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  color: #182438;
  background: #f7f9fc;
  --ink: #182438;
  --muted: #53627a;
  --line: #dfe5ed;
  --surface: #fff;
  --canvas: #fbfcfe;
  --side: #f4f6fa;
  --soft: #edf2ff;
  --accent: #3458ca;
  --accent-dark: #2947a5;
  --warn: #a72f3b;
  --bar: 56px;
  --reading: 760px;
  --gutter: clamp(18px, 4vw, 44px);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
[hidden] { display: none !important; }
a { color: var(--accent-dark); }
button, input, textarea, select { font: inherit; }
button, .download {
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--ink); padding: 7px 12px; cursor: pointer;
}
button:hover:not(:disabled), .download:hover { background: var(--soft); border-color: #b5c3e0; }
button:disabled { opacity: .5; cursor: not-allowed; }
:is(button, a, input, select, textarea, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 650; }
.primary:hover:not(:disabled) { color: #fff; background: var(--accent-dark); border-color: var(--accent-dark); }
.danger { background: #bc3143; border-color: #bc3143; color: #fff; font-weight: 650; }
.danger:hover:not(:disabled) { background: #9f2334; border-color: #9f2334; }
.quiet { background: transparent; }
.icon-button { display: inline-grid; place-items: center; min-width: 32px; min-height: 32px; padding: 0 5px; border-color: transparent; background: transparent; font-size: 19px; }
.drawer-control { display: none; }
.topbar {
  height: var(--bar); display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.top-start, .top-actions, .brand { display: flex; align-items: center; }
.top-start { min-width: 0; gap: 8px; }
.brand { gap: 10px; color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 700; white-space: nowrap; }
.brand-mark { display: flex; align-items: flex-end; justify-content: center; gap: 2px; flex: none; width: 28px; height: 28px; padding-bottom: 7px; border-radius: 8px; background: #233b82; }
.brand-mark i { width: 3px; height: 7px; border-radius: 1px; background: #e9eeff; }
.brand-mark i:nth-child(2) { height: 12px; }
.brand-mark i:nth-child(3) { height: 9px; }
.top-actions { gap: 13px; white-space: nowrap; font-size: 13px; }
.top-actions a { color: var(--muted); text-decoration: none; }
.top-actions a:hover { color: var(--accent-dark); text-decoration: underline; }
.top-actions button { padding: 5px 10px; }
.sandbox, .status { display: inline-flex; align-items: center; width: fit-content; gap: 6px; border-radius: 20px; padding: 3px 9px; white-space: nowrap; font-size: 12px; font-weight: 600; }
.sandbox { background: #e8f5ef; color: #176346; }
.sandbox::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #24825b; }
.status { margin: 10px 0 0; background: var(--soft); color: var(--accent-dark); }
.status[data-status="running"], .status[data-status="completed"] { background: #e8f5ef; color: #176346; }
.status[data-status="paused"], .status[data-status="pending_close"] { background: #fff2d9; color: #754b14; }
.workspace { height: calc(100dvh - var(--bar)); display: grid; grid-template-columns: 238px minmax(0, 1fr); background: var(--canvas); }
.workspace.has-inspector { grid-template-columns: 238px minmax(0, 1fr) clamp(270px, 23vw, 328px); }
.sidebar, .conversation, .detail { min-width: 0; min-height: 0; }
.sidebar { display: flex; flex-direction: column; gap: 14px; padding: 17px 14px 13px; background: var(--side); border-right: 1px solid var(--line); }
.side-top { display: flex; align-items: center; gap: 8px; }
#new-session { flex: 1; text-align: left; min-height: 39px; }
#new-session span { margin-right: 4px; }
.side-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border-radius: 9px; background: #e9edf4; }
.side-tabs button { min-height: 32px; padding: 4px 6px; background: transparent; border-color: transparent; color: var(--muted); }
.side-tabs button[aria-pressed="true"] { background: #fff; color: var(--ink); border-color: var(--line); font-weight: 650; }
#order-count { font-size: 11px; }
.side-panel { flex: 1; display: flex; flex-direction: column; gap: 11px; min-height: 0; }
.session-filter { display: flex; align-items: center; gap: 9px; min-height: 36px; padding-left: 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.session-filter input { border: 0; padding: 7px 8px 7px 0; font-size: 13px; background: transparent; }
.session-filter:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.session-filter input:focus-visible { outline: none; }
.search-icon { position: relative; flex: none; width: 11px; height: 11px; border: 1.5px solid var(--muted); border-radius: 50%; }
.search-icon::after { content: ""; position: absolute; width: 5px; height: 1.5px; background: var(--muted); top: 8px; left: 7px; transform: rotate(45deg); }
.side-list { min-height: 0; overflow: auto; scrollbar-width: thin; display: grid; align-content: start; gap: 3px; }
.side-label, .side-empty { color: var(--muted); font-size: 12px; padding: 5px 8px; }
.side-label { margin-top: 6px; font-weight: 650; }
.side-row { display: grid; grid-template-columns: minmax(0, 1fr) 32px; align-items: center; border: 1px solid transparent; border-radius: 8px; }
.side-row:hover, .side-row:focus-within { background: #eaf0fa; }
.side-row.is-selected { background: var(--soft); border-color: #dae3ff; }
.side-item { min-width: 0; width: 100%; padding: 7px 8px; text-align: left; border-color: transparent; background: transparent; }
.side-row .side-item:hover:not(:disabled) { border-color: transparent; background: transparent; }
.side-item > span, .side-item > small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item > small { font-size: 11px; }
.side-item[aria-current="true"] { color: var(--accent-dark); }
.side-row.is-selected .side-item > span { font-weight: 650; }
#orders .side-item[aria-current="true"] { background: var(--soft); border-color: #dae3ff; }
.session-more { width: 30px; min-width: 30px; font-size: 17px; color: var(--muted); }
.session-menu { position: fixed; z-index: 9; width: 150px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 10px 28px #152b4b22; }
.session-menu button { display: block; width: 100%; text-align: left; border-color: transparent; }
.session-menu .delete-option { color: var(--warn); }
.side-todos { flex: none; border-top: 1px solid var(--line); padding-top: 9px; }
.side-todos summary { color: var(--muted); cursor: pointer; padding: 4px 6px; font-size: 13px; }
.side-todos .side-list { max-height: 160px; }
small, .muted { color: var(--muted); }
.conversation { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; }
.conversation-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  min-height: 59px; padding: 10px var(--gutter); border-bottom: 1px solid var(--line); background: #fff;
}
.conversation-name { min-width: 0; }
.conversation-bar h1 { overflow: hidden; margin: 0; font-size: 15px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.conversation-bar p { margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
#mobile-detail { flex: none; padding: 5px 9px; font-size: 12px; }
.notice { grid-row: 2; margin: 0; padding: 8px var(--gutter); background: #e9f5ee; color: #185d39; border-bottom: 1px solid #d4e8dd; }
.notice.error { background: #fff0f1; color: var(--warn); border-color: #f5d8dc; }
.timeline { grid-row: 3; min-height: 0; overflow: auto; scrollbar-width: thin; padding: 22px var(--gutter); }
.timeline-content { width: 100%; max-width: var(--reading); margin-inline: auto; }
.is-welcome { grid-template-rows: auto auto minmax(0, 1fr) auto minmax(18px, .55fr); }
.is-welcome .timeline { display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 15px; }
.is-welcome .timeline-content { flex: none; }
.intro { padding-bottom: 4px; }
.intro .brand-mark { width: 37px; height: 37px; border-radius: 11px; padding-bottom: 11px; }
.intro h2 { margin: 12px 0 2px; font-size: clamp(23px, 3vw, 33px); line-height: 1.3; letter-spacing: -.025em; }
.intro p { margin: 7px 0 17px; color: var(--muted); }
.prompt-list { display: flex; flex-wrap: wrap; gap: 8px; }
.prompt-list button { font-size: 13px; color: #394b70; padding: 7px 11px; text-align: left; }
.message { width: fit-content; max-width: 88%; margin: 0 0 16px; padding: 2px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.message.user { margin-left: auto; padding: 8px 13px; border-radius: 12px 12px 4px 12px; background: #ecf1ff; color: #263b72; }
.message small { display: block; font-size: 11px; font-weight: 650; margin-bottom: 4px; }
.card { margin: 3px 0 18px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; overflow-wrap: anywhere; }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.card p { margin: 7px 0; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 10px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 12px; }
.advanced-fields { margin-top: 12px; padding-top: 9px; border-top: 1px solid var(--line); }
.advanced-fields summary { width: fit-content; color: var(--accent-dark); cursor: pointer; font-size: 13px; }
.advanced-fields .fields { margin-top: 9px; }
label { display: grid; gap: 5px; color: #465570; font-size: 13px; }
input, textarea, select { width: 100%; border: 1px solid #cdd7e5; border-radius: 8px; padding: 8px 9px; color: var(--ink); min-width: 0; background: #fff; }
.error-line { display: block; color: var(--warn); margin: 7px 0 0; }
.composer-wrap { grid-row: 4; padding: 8px var(--gutter) 18px; background: var(--canvas); }
.composer { max-width: var(--reading); margin-inline: auto; display: grid; gap: 6px; padding: 10px 11px; border: 1px solid #cfd9ea; border-radius: 14px; background: #fff; box-shadow: 0 4px 14px #2033610b; }
.composer:focus-within { border-color: #8da4e6; }
.composer textarea { border: 0; background: transparent; resize: none; min-height: 52px; max-height: 140px; outline: none; padding: 4px 3px; }
.composer textarea:focus-visible { outline: none; }
.composer-actions { display: flex; justify-content: space-between; align-items: end; gap: 7px; }
.send-button { flex: none; min-height: 34px; padding: 5px 10px; }
.send-button span { margin-left: 3px; }
.send-actions { display: flex; flex: none; align-items: center; gap: 6px; }
.voice-button { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 5px 8px; color: var(--muted); font-size: 12px; }
.voice-button[aria-pressed="true"] { color: var(--warn); background: #fff1f3; border-color: #edbbc2; }
.microphone-mark { position: relative; display: inline-block; width: 15px; height: 16px; }
.microphone-mark::before { content: ""; position: absolute; top: 0; left: 5px; width: 5px; height: 9px; border-radius: 5px; background: currentColor; }
.microphone-mark::after { content: ""; position: absolute; top: 4px; left: 2px; width: 9px; height: 8px; border: 1.5px solid currentColor; border-top: 0; border-radius: 0 0 7px 7px; }
.voice-controls { display: flex; justify-content: space-between; align-items: start; gap: 8px; color: var(--muted); font-size: 12px; }
.voice-controls p { margin: 0; min-width: 0; max-height: 60px; overflow: auto; overflow-wrap: anywhere; padding: 3px 0 0; }
.voice-controls[data-error="true"] { color: var(--warn); }
.voice-controls button { flex: none; padding: 3px 7px; font-size: 12px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.quick-actions button { font-size: 12px; padding: 5px 8px; background: #f6f8fc; }
.detail { overflow: auto; scrollbar-width: thin; background: #fff; border-left: 1px solid var(--line); }
.detail-bar { position: sticky; top: 0; z-index: 1; display: flex; min-height: 59px; padding: 9px 14px 9px 16px; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); background: #fff; font-weight: 650; }
#order-detail { padding: 17px 15px; }
.detail h2 { margin: 0 0 4px; font-size: 19px; overflow-wrap: anywhere; }
.detail h3 { margin: 20px 0 8px; font-size: 14px; }
.detail p { overflow-wrap: anywhere; }
.detail .card-actions button { font-size: 12px; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.metric { min-width: 0; padding: 9px; border: 1px solid var(--line); background: #f8faff; border-radius: 9px; overflow-wrap: anywhere; }
.metric small, .metric strong { display: block; }
.metric strong { margin-top: 3px; font-size: 17px; }
.record { border-top: 1px solid var(--line); padding: 8px 0; }
.record small { display: block; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 11px; margin: 10px 0; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.download { display: inline-block; text-decoration: none; color: var(--accent-dark); font-weight: 650; }
.drawer-shade { position: fixed; inset: var(--bar) 0 0; z-index: 4; width: 100%; height: calc(100dvh - var(--bar)); border: 0; border-radius: 0; background: #19294255; }
.drawer-shade:hover:not(:disabled) { background: #19294255; }
.login-panel, dialog { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 42px #20336115; }
.login-panel { margin: clamp(30px, 12vh, 108px) auto; padding: 25px; max-width: min(calc(100vw - 34px), 410px); }
.login-panel h1, dialog h2 { margin: 0 0 8px; font-size: 20px; }
.login-panel p, dialog p { color: var(--muted); }
.login-form { display: grid; gap: 12px; }
#login-error, dialog .error-line { color: var(--warn); }
dialog { width: min(440px, calc(100vw - 32px)); padding: 23px; color: var(--ink); }
dialog::backdrop { background: #19294266; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 18px; }
.startup { margin: 25px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 1080px) {
  .workspace, .workspace.has-inspector { grid-template-columns: 208px minmax(0, 1fr); }
  .detail { position: fixed; z-index: 5; inset: var(--bar) 0 0 auto; width: min(340px, 92vw); box-shadow: -10px 0 30px #19294219; }
}
@media (max-width: 680px) {
  :root { --gutter: 13px; --bar: 52px; }
  .topbar { padding: 0 10px; gap: 5px; }
  .top-start { gap: 5px; }
  .top-actions { gap: 8px; font-size: 12px; }
  .top-actions button { padding-inline: 6px; }
  .top-actions a span { display: none; }
  .brand { font-size: 13px; gap: 6px; }
  .brand-mark { width: 24px; height: 24px; padding-bottom: 5px; }
  .workspace, .workspace.has-inspector { grid-template-columns: minmax(0, 1fr); }
  .drawer-control { display: inline-grid; }
  .menu-lines, .menu-lines::before, .menu-lines::after { width: 15px; height: 1.5px; background: currentColor; border-radius: 1px; }
  .menu-lines { position: relative; }
  .menu-lines::before, .menu-lines::after { content: ""; position: absolute; left: 0; }
  .menu-lines::before { top: -5px; }
  .menu-lines::after { top: 5px; }
  .sidebar { display: none; position: fixed; inset: var(--bar) auto 0 0; width: min(282px, 88vw); z-index: 5; box-shadow: 8px 0 25px #19294215; }
  .sidebar.is-open { display: flex; }
  .conversation-bar { min-height: 52px; }
  .timeline { padding-top: 16px; }
  .composer-wrap { padding-bottom: max(11px, env(safe-area-inset-bottom)); }
}
@media (max-width: 395px) {
  .top-actions { gap: 5px; }
  .sandbox { padding-inline: 6px; font-size: 11px; }
  .sandbox::before { display: none; }
  .top-start .brand-mark { display: none; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  #voice-input-label { display: none; }
}
@media (max-height: 620px) {
  .is-welcome { grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .is-welcome .timeline { display: block; }
}
