:root {
  color-scheme: light;
  --ink: #172942;
  --text: #344b66;
  --muted: #5d7089;
  --line: #dbe5f1;
  --blue: #1859c9;
  --blue-dark: #1246a1;
  --tint: #eaf2ff;
  --surface: #fff;
  --page: #f4f7fc;
  --radius: 14px;
  font: 14px/1.55 "DM Sans", system-ui, "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--page); color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, input, textarea { color: inherit; }
a { color: var(--blue); }
:focus-visible { outline: 2px solid #246df0; outline-offset: 3px; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.error { color: #ad3328; }
.form-error { margin: 8px 0 0; color: #ad3328; font-size: 12.5px; line-height: 1.5; }
.eyebrow { color: var(--blue); font-size: 12px; font-weight: 650; }

.app-shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar {
  display: flex; flex-direction: column; gap: 10px;
  width: 244px; flex: 0 0 auto; padding: 22px 16px 14px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.brand, .side-bottom { display: flex; align-items: center; gap: 11px; }
.brand { padding: 2px 4px 9px; }
.brand strong, .brand small, .account b, .account small { display: block; }
.brand strong { font-size: 16px; letter-spacing: -.025em; }
.brand small, .account small { font-size: 11px; color: var(--muted); }
.brand-mark, .avatar {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 45px; height: 45px; border-radius: 12px;
  color: white; background: var(--blue); font-size: 21px; font-weight: 720;
}
.brand-mark.small { width: 38px; height: 38px; font-size: 19px; }
.avatar { width: 33px; height: 33px; font-size: 11px; color: var(--blue); background: var(--tint); }
.new-task, .primary, .send-btn {
  border: 0; border-radius: 10px; color: white; background: var(--blue); font-weight: 650;
}
.new-task, .primary { min-height: 42px; padding: 9px 13px; }
.new-task { text-align: left; margin-bottom: 7px; }
.new-task:hover, .primary:hover, .send-btn:hover:not(:disabled) { background: var(--blue-dark); }
.side-label { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; font-weight: 620; }
.side-label button, .icon-btn { border: 0; padding: 5px 7px; background: transparent; color: var(--muted); border-radius: 7px; }
.side-label button:hover, .icon-btn:hover { background: var(--tint); color: var(--blue); }
#task-filter { min-width: 0; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--page); font-size: 13px; }
.task-list { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; }
.task-item {
  display: block; width: 100%; text-align: left; margin: 2px 0; padding: 8px 9px;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text);
}
.task-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.task-item small { display: flex; align-items: center; gap: 5px; margin-top: 3px; color: var(--muted); font-size: 11px; }
.task-item:hover, .task-item.active { background: var(--tint); border-color: #d7e5ff; }
.task-item.active { color: var(--blue-dark); }
.live-dot, .task-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 100%; background: #8798ad; }
.live-dot, .task-dot.completed { background: #2a8a61; }
.task-dot.running, .task-dot.media_waiting { background: #246ce1; }
.task-dot.failed { background: #b95043; }
.task-list-empty { font-size: 12px; color: var(--muted); padding: 2px 8px; }
.side-bottom { border-top: 1px solid var(--line); padding: 10px 3px 2px; }
.account { flex: 1; min-width: 0; }
#logout { font-size: 12px; }

.main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 0 24px; flex: 0 0 57px;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.topbar-title { font-weight: 650; }
.connection-status { display: flex; align-items: center; gap: 7px; margin-left: auto; color: var(--muted); font-size: 12px; }
.mobile-only, .mobile-new, .sidebar-backdrop { display: none; }
.content {
  display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%;
  max-width: 1540px; margin: 0 auto; padding: 0 24px;
}
.welcome { flex: 1; min-height: 0; overflow: auto; display: grid; align-content: center; width: min(100%, 760px); margin: 0 auto; padding: 20px 2px; }
.welcome h1 { font-size: clamp(26px, 3.5vw, 44px); line-height: 1.2; letter-spacing: -.035em; margin: 0 0 9px; }
.welcome p { margin: 0; }
.suggestions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.suggestion {
  text-align: left; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); min-width: 0;
}
.suggestion .suggestion-title, .suggestion small { display: block; }
/* 图标容器自己负责居中，别被上面的 display:block 顶掉 */
.suggestion .suggestion-icon { display: grid; place-items: center; flex: none; }
.suggestion-icon svg { display: block; }
.suggestion span { font-weight: 650; }
.suggestion small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.suggestion:hover { border-color: #91b5ef; background: #f8fbff; }
.suggestion { grid-column: span 2; }
.suggestion:is([data-workflow="media"],[data-workflow="wechat"]) { grid-column: span 3; background: #edf5ff; border-color: #c6dcfa; }
.suggestion:is([data-workflow="media"],[data-workflow="wechat"]):hover { background: #e5f0ff; border-color: #91b5ef; }
.welcome-tools, .idea-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.welcome-tools .outline { flex-shrink: 0; }
.article-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 9px 12px; background: #f4f8ff; border-bottom: 1px solid #d9e5f6; }
.article-actions span { color: var(--muted); font-size: 12px; }
.article-actions button:disabled { opacity: .62; }
:is(#ideas-dialog, #presentation-dialog) { width: min(550px, calc(100% - 32px)); max-height: 80dvh; padding: 18px; border: 1px solid #d0def1; border-radius: 14px; color: inherit; background: #fff; }
:is(#ideas-dialog, #presentation-dialog)::backdrop { background: #10284760; }
.idea-heading h2 { margin: 0; font-size: 20px; }
.presentation-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 17px; }
.presentation-choices label { display: block; font-weight: 650; margin-bottom: 6px; }
.presentation-choices p { line-height: 1.55; margin: 7px 0 12px; font-size: 13px; }
.presentation-choices select, #presentation-versions { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--text); font: inherit; }
#presentation-versions { width: auto; max-width: 100%; font-size: 12px; }
.presentation-swatches { display: flex; gap: 5px; margin-top: 9px; height: 12px; }
.presentation-swatches span { width: 24px; border: 1px solid #17365d26; border-radius: 3px; }
#presentation-form .send-btn { margin-top: 8px; }
#presentation-context { margin: 2px 0 6px; color: var(--blue-dark); }
#idea-form { display: grid; gap: 8px; margin-top: 15px; }
#idea-form textarea { width: 100%; min-height: 78px; resize: vertical; padding: 9px; border: 1px solid #c6d6ed; border-radius: 8px; font: inherit; }
#idea-form button { justify-self: start; }
.idea-list { list-style: none; padding: 0; margin: 12px 0 0; }
.idea-list li { border-top: 1px solid #e1eaf7; padding: 10px 0; }
.idea-list p { margin: 0 0 7px; white-space: pre-wrap; overflow-wrap: anywhere; }
.idea-list .outline { margin-right: 5px; }

.composer-wrap { width: 100%; padding: 0 0 max(16px, env(safe-area-inset-bottom)); }
.welcome:not(.hidden) ~ .composer-wrap { max-width: 760px; margin: 0 auto; }
.composer { padding: 11px 13px 9px; border: 1px solid #c9d8eb; border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 14px #173c6810; }
.composer:focus-within, .composer.dragging { border-color: #729fe9; box-shadow: 0 0 0 3px #c9dcfc85; }
.composer.dragging { background: #f3f8ff; }
.composer textarea { display: block; width: 100%; min-height: 48px; max-height: 32vh; padding: 2px; border: 0; outline: 0; background: transparent; resize: none; line-height: 1.6; overflow-y: hidden; }
.composer textarea::placeholder { color: #657d98; }
.composer-footer, .composer-footer > div { display: flex; align-items: center; gap: 8px; }
.composer-footer { justify-content: space-between; margin-top: 5px; }
.composer-footer > div { flex-wrap: wrap; }
.attach-btn, .outline, .workflow-selection, .preview-actions button, .preview-actions a, .task-switcher button {
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--blue-dark); padding: 6px 9px; font-size: 12px; text-decoration: none;
}
.attach-btn:hover, .outline:hover, .preview-actions :is(button,a):hover { background: var(--tint); }
.keyboard-hint { font-size: 11px; color: var(--muted); }
.workflow-selection { background: var(--tint); }
.media-model { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--blue-dark); padding: 6px 8px; font: inherit; font-size: 12px; max-width: 210px; }
.send-btn { min-height: 36px; padding: 5px 13px; flex: 0 0 auto; }
.send-btn:disabled { opacity: .52; }
.composer-status { margin: 6px 0 0; font-size: 12px; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 5px; max-height: 70px; overflow: auto; }
.attachment-list:not(:empty) { margin: 3px 0 6px; }
.attachment-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; border-radius: 6px; padding: 3px 7px; background: var(--tint); color: var(--blue-dark); font-size: 12px; }
.attachment-chip.error { color: #ad3328; background: #fff1ee; }
.attachment-chip button { border: 0; padding: 0 2px; color: inherit; background: transparent; }

.task-view { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-height: 0; padding: 16px 0; }
.task-view.has-artifacts { grid-template-columns: minmax(260px, .9fr) minmax(0, 1.1fr); }
.task-view.preview-expanded { grid-template-columns: minmax(0, 1fr); }
.task-view.preview-expanded .task-left { display: none; }
.task-left { overflow: auto; min-height: 0; min-width: 0; padding: 2px 2px 10px; scrollbar-width: thin; }
.task-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.task-heading h2 { font-size: clamp(19px, 2.2vw, 25px); line-height: 1.3; margin: 3px 0; overflow-wrap: anywhere; }
.status-pill {
  flex: 0 0 auto; padding: 4px 9px; border-radius: 999px; background: #eef1f5;
  color: var(--text); font-size: 12px; font-weight: 650;
}
.status-pill.running, .status-pill.media_waiting { background: var(--tint); color: var(--blue-dark); }
.status-pill.completed { background: #e8f7ee; color: #236c48; }
.status-pill.failed { background: #fff0eb; color: #993b2f; }
.overall-progress { margin: 12px 0 8px; }
.progress-caption { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.progress-caption b { color: var(--blue-dark); }
.progress-track { height: 7px; background: #e1eaf6; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--blue); border-radius: inherit; transition: width .25s ease; }
.task-activity, .learning-summary { margin: 6px 0; padding: 7px 9px; border-radius: 7px; color: var(--text); background: #eaf1fb; font-size: 12px; overflow-wrap: anywhere; }
.task-activity.needs-check { color: #864516; background: #fff2de; }
.learning-summary { background: transparent; padding: 2px 0; color: var(--muted); }
.result-card, .plan-card, .execution-details { margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.result-card { display: flex; align-items: flex-start; gap: 9px; padding: 12px; }
.result-body { min-width: 0; flex: 1; }
.result-bar { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.result-bar button { flex: none; }
.result-icon { flex: 0 0 25px; display: grid; place-items: center; height: 25px; background: #e8f7ee; border-radius: 50%; color: #236c48; font-weight: 700; }
.result-card.failed .result-icon { background: #fff0eb; color: #993b2f; }
.result-heading, .plan-card h3 { margin: 0 0 5px; font-size: 14px; font-weight: 650; }
.result-summary { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.plan-card { padding: 10px 12px; }
.plan-card ol { list-style: none; margin: 0; padding: 0; }
.plan-card li { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; padding: 6px 0; color: var(--text); font-size: 13px; }
.plan-card li + li { border-top: 1px solid #edf2f8; }
.plan-card li > small { margin-left: auto; flex: 0 0 auto; color: var(--muted); }
.step-copy { min-width: 0; overflow-wrap: anywhere; }
.step-state { flex: 0 0 16px; color: var(--muted); }
.step-completed .step-state { color: #236c48; }
.step-running .step-state { color: var(--blue); }
.step-failed .step-state { color: #993b2f; }
.step-evidence { display: block; color: var(--muted); font-size: 12px; }
.execution-details { padding: 9px 12px; }
.execution-details summary { cursor: pointer; color: var(--text); font-size: 12px; font-weight: 600; }
.timeline { padding: 4px 0 0; }
.event { position: relative; border-left: 1px solid var(--line); margin-left: 3px; padding: 4px 8px 5px 14px; color: var(--text); font-size: 12px; overflow-wrap: anywhere; }
.event::before { content: ""; position: absolute; left: -4px; top: 10px; width: 7px; height: 7px; border-radius: 100%; background: #688ab9; }
.event.tool_error::before { background: #ae601d; }
.event.artifact::before, .event.incident_resolved::before { background: #2a8a61; }
.event time { display: block; color: var(--muted); font-size: 11px; }
.event-detail { margin-top: 3px; }
.event-detail summary { font-weight: 450; color: var(--blue-dark); }
.event pre { padding: 6px 8px; margin: 3px 0; max-height: 180px; overflow: auto; background: var(--page); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; }
.task-switcher { display: none; }

.preview-pane {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.preview-heading { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 10px 11px; border-bottom: 1px solid var(--line); }
.preview-heading > div:first-child { min-width: 0; }
.preview-heading h3 { font-size: 14px; margin: 0; }
.preview-heading p { margin: 2px 0 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.preview-actions { display: flex; flex: 0 0 auto; gap: 5px; align-items: center; }
.artifact-list { display: flex; flex-wrap: wrap; align-content: flex-start; flex: 0 0 auto; gap: 6px; padding: 7px 9px; overflow-x: hidden; overflow-y: auto; max-height: 232px; border-bottom: 1px solid var(--line); }
.artifact-row { display: flex; flex: 0 0 auto; max-width: 240px; border: 1px solid var(--line); border-radius: 8px; }
.artifact-row.active { background: var(--tint); border-color: #9ebbe8; }
.artifact-select { display: flex; align-items: center; gap: 6px; padding: 5px 7px; min-width: 0; background: transparent; border: 0; text-align: left; }
.artifact-badge { display: grid; place-items: center; min-width: 26px; padding: 2px 4px; border-radius: 5px; background: var(--tint); color: var(--blue-dark); font-size: 10px; font-weight: 700; }
.artifact-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.artifact-name small { display: block; color: var(--muted); font-size: 10px; }
.artifact-download { display: grid; place-items: center; min-width: 30px; border-left: 1px solid var(--line); text-decoration: none; }
/* 结果区按轮次分组：左侧对话记录只保留进度与文字，交付文件集中到右侧。 */
.artifact-group { flex: 0 0 100%; margin: 2px 0 0; color: var(--muted); font-size: 11px; font-weight: 600; }
.artifact-group:first-child { margin-top: 0; }
.artifact-preview { flex: 1; min-height: 0; overflow: auto; background: #edf2f9; }
.preview-frame, .preview-image, .preview-video { display: block; width: 100%; height: 100%; border: 0; }
.preview-image, .preview-video { object-fit: contain; }
.preview-video { background: #111c2f; }
.preview-empty { display: grid; place-items: center; height: 100%; padding: 16px; color: var(--muted); text-align: center; }

.login-shell { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 18px; background: radial-gradient(ellipse at 50% 0, #dbe9ff 0, var(--page) 62%); }
.login-card { display: flex; flex-direction: column; width: min(100%, 410px); padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 11px 36px #1a40741c; }
.login-card h1 { margin: 4px 0; font-size: 26px; }
.login-card label { font-size: 13px; }
.password-wrap { display: flex; align-items: center; gap: 2px; margin: 5px 0 12px; padding-right: 4px; border: 1px solid #dfe9f5; border-radius: 11px; background: #fbfdff; transition: box-shadow .14s ease, border-color .14s ease, background .14s ease; }
.password-wrap:focus-within { border-color: #9dc0f5; background: #fff; box-shadow: var(--ring); }
.password-wrap input { flex: 1; min-width: 0; width: 100%; padding: 10px 12px; border: 0; outline: 0; border-radius: 11px; background: transparent; box-shadow: none; }
.password-wrap input:focus { outline: 0; border: 0; background: transparent; box-shadow: none; }
.password-wrap button { flex: 0 0 auto; min-height: 34px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--blue); font-size: 12.5px; }
.password-wrap button:hover { background: var(--tint); }
.primary.full { width: 100%; }
.secure-note { color: var(--muted); font-size: 11px; padding-top: 14px; }

#skills-dialog {
  width: min(580px, 94vw); max-height: 78vh; padding: 14px 15px;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink);
}
#skills-dialog::backdrop { background: #10284760; }
.skills-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.skills-heading h2 { font-size: 18px; margin: 0; }
#skill-filter {
  width: 100%; margin: 10px 0 3px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--page);
}
#skills-results article { padding: 8px 1px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#skills-results p { margin: 3px 0; color: var(--muted); font-size: 12px; }
#skills-results small { display: block; color: #864516; }

@media (max-width: 1000px) {
  .content { padding-inline: 14px; }
  .task-view.has-artifacts { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .task-view.has-artifacts .task-switcher { display: flex; gap: 7px; }
  .task-switcher button { flex: 1; min-height: 36px; }
  .task-switcher button[aria-pressed="true"] { border-color: #9ebbe8; background: var(--tint); }
  #mobile-preview-count:not(:empty) { margin-left: 3px; font-weight: 650; }
  .task-view:not(.show-deliverables) .preview-pane, .task-view.show-deliverables .task-left { display: none; }
  .task-view:not(.show-deliverables) .task-left { display: block; }
  #expand-preview { display: none; }
}
@media (max-width: 760px) {
  .sidebar {
    position: fixed; z-index: 5; inset: 0 auto 0 0; width: min(84vw, 290px);
    transform: translateX(-101%); visibility: hidden; transition: transform .18s ease, visibility .18s;
  }
  .sidebar.open { transform: none; visibility: visible; }
  .sidebar-open .sidebar-backdrop { display: block; position: fixed; z-index: 4; inset: 0; border: 0; background: #132c4e52; }
  .mobile-only, .mobile-new { display: inline-flex; }
  .topbar { flex-basis: 49px; padding-inline: 12px; gap: 8px; }
  .topbar-title { display: none; }
  .content { padding-inline: 10px; }
  .welcome { align-content: safe center; }
  .suggestions { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; gap: 7px; }
  .suggestion, .suggestion:is([data-workflow="media"],[data-workflow="wechat"]) { grid-column: span 1; }
  .suggestion { padding: 10px; }
  .keyboard-hint { display: none; }
  .task-view { padding: 9px 0; gap: 8px; }
  .composer-wrap { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
@media (max-width: 480px) {
  .presentation-choices { grid-template-columns: minmax(0, 1fr); gap: 5px; }
}
.turn-list { list-style: none; margin: 0; padding: 0 10px 8px; max-height: 210px; overflow: auto; }
.turn-list li { padding: 8px 0; border-top: 1px solid var(--line); }
.turn-list p { margin: 4px 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.turn-list small, #turn-context { color: var(--muted); }
.turn-list button[aria-current="true"] { border-color: #397bcb; background: var(--tint); }
/* 历史轮次交付的文件：缩略图直接点开，不用回到最新一轮才能看图。 */
.turn-artifacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.turn-thumb { display: flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); cursor: pointer; max-width: 100%; font: inherit; font-size: 11px; color: var(--blue-dark); }
.turn-thumb:hover { border-color: #397bcb; }
.turn-thumb img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; display: block; }
.turn-thumb-badge { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 6px; background: var(--tint); font-size: 10px; font-weight: 650; }
.turn-thumb span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .turn-thumb { min-height: 44px; }
  .turn-thumb span { max-width: 96px; }
}

/* ── 代码画布：语法高亮、复制/下载、可切明暗配色、横向滚动不撑破布局 ── */
:root, [data-code-theme="light"] {
  --code-bg: #f7f9fc;
  --code-bar: #eef3fa;
  --code-line: #d9e3f0;
  --code-fg: #22344d;
  --tok-kw: #1246a1;
  --tok-str: #0b6b4f;
  --tok-num: #8a4a00;
  --tok-com: #6b7c92;
  --tok-fn: #7b2f9e;
  --tok-tag: #a03030;
  --tok-attr: #0d5a9e;
  --tok-key: #0b6b4f;
  --tok-op: #3d5a80;
  --tok-add: #dff3e6;
  --tok-del: #fbe3e1;
}
[data-code-theme="dark"] {
  --code-bg: #10161f;
  --code-bar: #18212d;
  --code-line: #26313f;
  --code-fg: #e6edf6;
  --tok-kw: #7aa2ff;
  --tok-str: #7fd6a9;
  --tok-num: #f4b26a;
  --tok-com: #7d8b9c;
  --tok-fn: #d5a0ff;
  --tok-tag: #ff8f8f;
  --tok-attr: #8ec8ff;
  --tok-key: #7fd6a9;
  --tok-op: #b6c6da;
  --tok-add: #17301f;
  --tok-del: #351b1b;
}
#code-theme { white-space: nowrap; font-size: 12px; padding: 4px 9px; }
.clipboard-target { position: fixed; left: -9999px; }
.code-canvas {
  margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--code-bg); max-width: 100%; min-width: 0;
}
.code-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5px 9px; background: var(--code-bar); border-bottom: 1px solid var(--line);
}
.code-lang { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .02em; }
.code-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.code-btn {
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--blue-dark);
  padding: 3px 9px; font-size: 12px; line-height: 1.35; min-height: 26px;
}
.code-btn:hover { border-color: #9ebbe8; background: var(--tint); }
.code-btn.ok { border-color: #2f8f5b; color: #2f8f5b; background: transparent; }
[data-code-theme="dark"] .code-btn { background: #1d2836; border-color: var(--code-line); color: #cfe0f5; }
[data-code-theme="dark"] .code-btn:hover { background: #253244; border-color: #3a4a5f; }
[data-code-theme="dark"] .code-btn.ok { color: #7fd6a9; border-color: #2f8f5b; background: transparent; }
.code-scroll {
  margin: 0; padding: 10px 12px; max-width: 100%; overflow-x: auto; overflow-y: hidden;
  background: var(--code-bg); color: var(--code-fg);
  font: 12.5px/1.6 "JetBrains Mono", "Cascadia Code", Consolas, "Microsoft YaHei", monospace;
  tab-size: 2; -webkit-overflow-scrolling: touch;
}
.code-scroll code, .code-body { display: block; white-space: pre; min-width: max-content; font: inherit; }
.code-line { display: block; }
.code-plain { white-space: pre; }
.code-preview { min-width: 0; }
.result-summary, .turn-result { min-width: 0; overflow-wrap: anywhere; }
.result-summary { white-space: normal; }
.result-summary p, .turn-result p { margin: 0 0 .55em; white-space: pre-wrap; }
.result-summary p:last-child, .turn-result p:last-child { margin-bottom: 0; }
.turn-result { font-size: 13px; color: var(--text); }
.turn-result .code-canvas { margin: 6px 0; }
.result-summary code:not(.code-body), .turn-result code:not(.code-body) {
  background: var(--code-bar); border-radius: 4px; padding: 1px 5px; font-size: .92em;
  font-family: "JetBrains Mono", Consolas, monospace;
}
.tok-kw { color: var(--tok-kw); font-weight: 600; }
.tok-str { color: var(--tok-str); }
.tok-num { color: var(--tok-num); }
.tok-com { color: var(--tok-com); font-style: italic; }
.tok-fn { color: var(--tok-fn); }
.tok-tag { color: var(--tok-tag); }
.tok-attr { color: var(--tok-attr); }
.tok-key { color: var(--tok-key); }
.tok-op { color: var(--tok-op); }
.tok-var { color: var(--code-fg); }
.tok-add { background: var(--tok-add); }
.tok-del { background: var(--tok-del); }
@media (max-width: 760px) {
  .code-scroll { padding: 9px 10px; font-size: 12px; }
  #code-theme { font-size: 11px; padding: 3px 7px; }
}
@media (max-width: 480px) {
  #code-theme .theme-label { display: none; }
}

/* ── 连接状态与轻量按钮 ── */
#connection.offline { color: #b4453c; font-weight: 650; }
.link-button {
  border: 0; padding: 0; background: transparent; color: var(--blue); font: inherit;
  text-decoration: underline; cursor: pointer;
}
.preview-empty a { color: var(--blue); }
.preview-empty .link-button { margin-top: 6px; }

/* ── 手机端触控目标不小于 44px，避免误触 ── */
@media (max-width: 760px) {
  .artifact-download, .artifact-select { min-height: 44px; }
  .artifact-download { min-width: 40px; }
  .preview-actions .outline, #code-theme, .code-btn, .suggestion { min-height: 40px; }
  .turn-list button[data-turn] { min-height: 40px; }
  .password-wrap button { min-height: 38px; }
  #toggle-pass { min-width: 48px; }
}

/* 图片放大查看：覆盖整个视口；适应屏幕时居中，放大后从左上角开始滚动。 */
.lightbox { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; background: #0b1017; }
.lightbox[hidden] { display: none; }
.lightbox-bar { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: #121b26; border-bottom: 1px solid #1f2b3a; color: #e8eef7; font-size: 12px; }
.lightbox-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-hint { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8ea4bd; font-size: 11px; }
.lightbox-actions { display: flex; flex: 0 0 auto; gap: 6px; align-items: center; }
.lightbox-actions .outline { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .28); color: #eaf1fa; padding: 5px 10px; border-radius: 8px; text-decoration: none; font-size: 13px; line-height: 1.4; }
#lightbox-zoom-in, #lightbox-zoom-out { min-width: 34px; font-size: 16px; font-weight: 600; }
.lightbox-actions .outline:hover { background: rgba(255, 255, 255, .2); }
.lightbox-stage { display: flex; flex: 1; min-height: 0; padding: 0 14px 14px; overflow: auto; }
.lightbox-stage.zoomed { align-items: flex-start; justify-content: flex-start; cursor: grab; }
.lightbox-stage.panning { cursor: grabbing; }
.lightbox-stage img { display: block; flex: 0 0 auto; max-width: 100%; max-height: 100%; margin: auto; cursor: zoom-in; }
.lightbox-stage img.zoomed { cursor: zoom-out; user-select: none; -webkit-user-drag: none; }
body.lightbox-open { overflow: hidden; }
@media (max-width: 760px) {
  .lightbox-bar { flex-wrap: nowrap; gap: 8px; }
  .lightbox-hint { display: none; }
  .lightbox-actions .outline { min-height: 40px; }
}
/* ---------------- 账号、套餐与平台界面 ---------------- */
.login-tabs { display: flex; gap: 6px; margin: 4px 0 14px; padding: 4px; background: var(--tint); border-radius: 10px; }
.login-tab { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.login-tab.active { background: var(--surface); color: var(--blue-dark); font-weight: 650; box-shadow: 0 1px 3px rgba(20, 40, 80, .12); }
.login-card label { display: block; margin: 10px 0 5px; font-size: 12px; color: var(--muted); }
.login-card input[type="text"], .login-card input[type="tel"], .login-card input:not([type]) { width: 100%; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.code-row button { white-space: nowrap; min-width: 104px; }
.agree-row { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 4px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.agree-row input { margin-top: 3px; }
.agree-row .link-button { padding: 0; font-size: 12px; }
.account-chip { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-menu { position: absolute; z-index: 60; min-width: 168px; display: flex; flex-direction: column; padding: 6px; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(20, 40, 80, .18); }
.chip-menu button { border: 0; background: transparent; text-align: left; font: inherit; font-size: 13px; color: var(--ink); padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.chip-menu button:hover { background: var(--tint); color: var(--blue-dark); }
.quota-banner {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 12px; padding: 7px 10px 7px 14px;
  border: 1px solid #dbe9fb; border-radius: 999px;
  background: linear-gradient(120deg, #f7fbff, #eef6ff 60%, #eaf3ff);
  box-shadow: var(--shadow-sm); color: #2b4a76; font-size: 12.5px;
}
.quota-banner .quota-text {
  flex: 1 1 auto; min-width: 0; line-height: 1.5; color: #3a5a86;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.quota-banner .quota-text b { color: #17457e; font-weight: 650; }
.quota-banner .quota-sep { padding: 0 6px; color: #9bb4d2; }
.quota-banner .quota-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.quota-banner .small { font-size: 12px; padding: 5px 10px; }
.quota-banner .quota-close {
  border: 0; background: transparent; color: #6b86a8; font-size: 16px; line-height: 1;
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
}
.quota-banner .quota-close:hover { background: #dfeaf8; color: #17457e; }
.quota-banner .quota-actions button { flex: 0 0 auto; }

@media (max-width: 760px) {
  .quota-banner { flex-wrap: wrap; border-radius: 14px; padding: 9px 12px; gap: 8px; }
  .quota-banner .quota-text { flex: 1 1 100%; -webkit-line-clamp: 3; }
  .quota-banner .quota-actions { width: 100%; }
  .quota-banner .quota-actions button:not(.quota-close) { flex: 1; }
  .quota-banner .quota-close { margin-left: auto; }
}

.preview-pane, .task-left { border-radius: 16px; }
.artifact-list { background: #fbfdff; }
.artifact-row { border-radius: 12px; border: 1px solid #e4edf8; background: #fff; box-shadow: var(--shadow-sm); }
.artifact-row[aria-current="true"] { border-color: #a9c8f0; box-shadow: 0 0 0 3px #2563eb1a; background: #f5faff; }
.sheet-panel { border-radius: 20px; box-shadow: var(--shadow-lg); border: 1px solid #e6eef8; }
.sheet-mask { background: #0f1b2d80; backdrop-filter: blur(3px); }
.agreement-tab, .chip { border-radius: 999px; }
.agreement-tab.active, .chip.active { background: var(--grad-blue); border-color: transparent; color: #fff; box-shadow: 0 6px 14px #2563eb2e; }
.stat-card, .chart-card, .plan-card {
  border-radius: 14px; border: 1px solid #e4edf8; background: #fff; box-shadow: var(--shadow-sm);
}
.result-card { border-radius: 16px; border: 1px solid #dcebd9; background: linear-gradient(150deg, #f7fdf6, #eef9ee); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #cdd9e8; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #b3c4d9; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }
@media (max-width: 760px) {
  .suggestion { border-radius: 14px; padding: 13px 14px; }
  .welcome h1 { font-size: 30px; }
}

/* ═══════════ 视觉升级：弹窗与登录页 ═══════════ */
.login-shell {
  background:
    radial-gradient(680px 380px at 18% 12%, #dbe9ff 0%, transparent 60%),
    radial-gradient(620px 380px at 84% 84%, #e2f3ff 0%, transparent 62%),
    linear-gradient(160deg, #f7faff 0%, #eef4fc 100%);
}
.login-card {
  border: 1px solid #e7effa; border-radius: 24px; background: #ffffffee;
  box-shadow: 0 30px 70px #17325c1f, 0 2px 8px #17325c14;
  backdrop-filter: blur(6px);
}
.login-card h1 { letter-spacing: -.035em; }
.login-tabs { background: #f1f6fd; border-radius: 999px; padding: 3px; }
.login-tab { border-radius: 999px; border: 0; background: transparent; }
.login-tab.active { background: #fff; box-shadow: var(--shadow-sm); color: var(--blue-dark); }
#sms-phone, #sms-code {
  border-radius: 11px; border: 1px solid #dfe9f5; background: #fbfdff; padding: 10px 12px;
  transition: box-shadow .14s ease, border-color .14s ease, background .14s ease;
}
#sms-phone:focus, #sms-code:focus { outline: 0; background: #fff; border-color: #9dc0f5; box-shadow: var(--ring); }
#password { width: 100%; }
#sms-send { border-radius: 11px; }
.secure-note { color: #6d8099; font-size: 11.5px; }

.sheet-head { padding: 16px 20px 12px; border-bottom: 1px solid #eaf1fa; }
.sheet-head strong, .sheet-head h3 { font-size: 16px; letter-spacing: -.02em; }
.sheet-body { padding: 14px 20px 18px; }
.sheet-foot { border-top: 1px solid #eaf1fa; padding: 12px 20px 14px; }
.sheet-mask { background: #0d1a2c9c; backdrop-filter: blur(4px); }
.guide-block {
  padding: 12px 14px; margin: 0 0 10px; border: 1px solid #e6eef8; border-radius: 13px;
  background: linear-gradient(150deg, #ffffff, #f8fbff);
}
.guide-block b { display: block; margin-bottom: 4px; font-size: 13.5px; color: #12335e; }
.guide-block p { margin: 0; font-size: 13px; line-height: 1.72; color: #40587a; }
.guide-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.guide-links a {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  border: 1px solid #dbe8f8; background: #fff; font-size: 12px; text-decoration: none;
}
.guide-links a:hover { border-color: #a9c8f0; background: #f5faff; }
.key-card {
  border: 1px solid #e6eef8; border-radius: 14px; background: linear-gradient(160deg, #fff, #f9fcff);
  box-shadow: var(--shadow-sm);
}
.plan-card { transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.plan-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #b9d4f7; }
.plan-card.featured { border-color: #a9c8f0; box-shadow: 0 14px 30px #2563eb1f; }
.plan-price { letter-spacing: -.03em; }
.stat-card { background: linear-gradient(160deg, #fff, #f8fbff); }
.chart-card { background: #fff; }
.analytics-toolbar { background: #f8fbff; border: 1px solid #e9f1fa; border-radius: 12px; padding: 8px 10px; }
.chip { border: 1px solid #dde8f6; background: #fff; padding: 5px 12px; font-size: 12px; }
.chip:hover { border-color: #a9c8f0; background: #f7fbff; }
.alert-mask { background: #0d1a2c8c; backdrop-filter: blur(3px); }

/* 轻提示：不遮屏，从顶部滑入后自动消失 */
.toast-stack {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 120; display: flex; flex-direction: column; gap: 8px;
  width: min(92vw, 520px); pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px 11px 14px; border-radius: 12px;
  background: #ffffff; color: var(--ink);
  border: 1px solid var(--line); border-left: 4px solid var(--blue);
  box-shadow: 0 12px 30px rgba(23, 48, 84, .16);
  font-size: 13px; line-height: 1.55; pointer-events: auto;
  animation: toast-in .18s ease-out;
}
.toast.warn { border-left-color: #d97706; }
.toast.error { border-left-color: #dc2626; }
.toast-text { flex: 1 1 auto; }
.toast-close {
  flex: 0 0 auto; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--muted); font-size: 15px; line-height: 1;
}
.toast-close:hover { background: var(--tint); color: var(--ink); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
@media (max-width: 760px) {
  .toast-stack { top: 58px; width: calc(100vw - 16px); }
  .toast { font-size: 12.5px; padding: 10px 10px 10px 12px; }
  .toast-close { width: 26px; height: 26px; }
}
.modal-alert { border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid #e6eef8; }

@media (max-width: 760px) {
  .welcome-tools { flex-direction: column; align-items: flex-start; gap: 10px; }
  .welcome-tools .outline { align-self: flex-start; }
  .welcome { padding-bottom: 26px; }
  .suggestion { gap: 7px; }
  .suggestion-icon { width: 30px; height: 30px; border-radius: 10px; }
  .suggestion-icon svg { width: 16px; height: 16px; }
}

/* 面板内的包裹层也要参与 flex，否则正文区不会被约束、也就滚不动 */
.sheet-panel > div:first-child {
  display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto;
}
.sheet-panel > div:first-child > .sheet-body { flex: 1 1 auto; min-height: 0; }

.key-note { min-height: 16px; margin: 6px 0 0; font-size: 12px; }
.key-note.good { color: #157a4b; }
.key-note.bad { color: #ad3328; }
.key-actions { display: flex; gap: 8px; align-items: center; }

/* ========== 视觉细化（重建）==========
   之前一次批量替换误删了这一段的原始规则，这里按最终视觉目标重写并补齐设计令牌。 */
:root {
  --radius-lg: 18px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(26, 58, 105, .05), 0 6px 18px rgba(26, 58, 105, .05);
  --shadow-md: 0 8px 24px rgba(26, 58, 105, .10);
  --shadow-lg: 0 20px 48px rgba(20, 40, 80, .16);
}

/* 顶栏与侧栏的层次 */
.topbar { background: rgba(255, 255, 255, .86); backdrop-filter: saturate(1.2) blur(10px); }
.side { background: linear-gradient(180deg, #ffffff 0%, #f7faff 60%, #eef4fd 100%); }

/* 欢迎区标题 */
.welcome h1 {
  background: linear-gradient(120deg, #12365f 0%, #1859c9 62%, #2f7bf0 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* 常用流程卡片 */
.suggestion {
  border-radius: 16px; padding: 15px 16px 14px; border-color: #e3ecf7;
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.suggestion:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #b9d3f5; }
.suggestion-icon {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(140deg, #e8f1ff, #dbeafe); color: #1d4ed8;
  box-shadow: 0 1px 0 #ffffff inset, 0 2px 6px #2563eb1a;
}
.suggestion-icon svg { width: 18px; height: 18px; display: block; }

/* 左下角账号入口（点手机号进模型 Key / 使用说明） */
.side-bottom { gap: 8px; }
.side-account {
  display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0;
  padding: 7px 8px; border: 1px solid transparent; border-radius: 12px;
  background: transparent; text-align: left; color: inherit; cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}
.side-account:hover { background: var(--tint); border-color: var(--line); }
.side-account:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.side-account .avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 650;
  color: #1d4ed8; background: linear-gradient(140deg, #e8f1ff, #dbeafe);
}
.side-account .account { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.side-account .account b {
  font-size: 13px; font-weight: 650; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-account .account small {
  font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 输入区与弹窗的收口 */
.composer { box-shadow: var(--shadow-sm); }
.sheet-mask { backdrop-filter: blur(3px); background: rgba(19, 39, 66, .34); }

@media (max-width: 760px) {
  .suggestion { padding: 12px 13px; border-radius: 14px; }
  .suggestion-icon { width: 30px; height: 30px; border-radius: 10px; }
  .suggestion-icon svg { width: 16px; height: 16px; }
  .side-account .avatar { width: 32px; height: 32px; }
  .side-account .account b { font-size: 12.5px; }
}

/* 侧栏底部：账号入口占满剩余宽度，退出按钮不被挤成竖排 */
.side-bottom { display: flex; align-items: center; gap: 8px; }
.side-bottom .side-account { flex: 1 1 auto; min-width: 0; }
#logout {
  flex: 0 0 auto; white-space: nowrap; padding: 6px 8px;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted);
  font-size: 12px;
}
#logout:hover { background: var(--tint); color: var(--blue-dark); border-color: var(--line); }
/* ========== 组件基础样式（重建）==========
   弹窗/表格/图表等基础规则在之前的批量替换里被一并删掉了，这里补回。 */
.sheet-mask {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.sheet-panel {
  width: min(760px, 100%); max-height: min(88vh, 920px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
}
.sheet-panel.wide { width: min(1080px, 100%); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex: 0 0 auto; }
.sheet-head h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.sheet-close {
  flex: 0 0 auto; width: 32px; height: 32px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); font-size: 20px; line-height: 1;
}
.sheet-close:hover { background: var(--tint); color: var(--ink); }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 0 0 auto; }
.sheet-input {
  width: 100%; padding: 9px 12px; border: 1px solid #dfe9f5; border-radius: 10px; background: #fbfdff;
}
.sheet-input:focus { outline: 0; border-color: #9dc0f5; background: #fff; box-shadow: 0 0 0 3px #2563eb1f; }
.small-input { width: auto; padding: 5px 8px; font-size: 12px; }

.alert-mask {
  position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-alert { width: min(420px, 100%); padding: 20px 22px; background: #fff; border-radius: 18px; }
.modal-alert h3 { margin: 0 0 8px; font-size: 16px; }
.modal-alert p { margin: 0 0 16px; font-size: 13.5px; line-height: 1.7; color: var(--text); }
.modal-alert > button { width: 100%; }
.alert-actions { display: flex; gap: 8px; }
.alert-actions button { flex: 1; }

.agreement-wrap { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.agreement-tabs { display: flex; gap: 6px; padding: 12px 20px 0; flex-wrap: wrap; }
.agreement-tab {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 6px 14px; font-size: 12.5px; border-radius: 999px;
}
.agreement-tab.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.agreement-body {
  padding: 14px 20px; overflow-y: auto; min-height: 0; max-height: 56vh;
  font-size: 13px; line-height: 1.8; color: var(--text);
}
.agreement-section h4 { margin: 14px 0 6px; font-size: 13.5px; color: #12335e; }
.agreement-section p { margin: 0 0 6px; }

.sheet-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.sheet-table th {
  text-align: left; font-weight: 600; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.sheet-table td { padding: 8px 10px; border-bottom: 1px solid #eef4fb; color: var(--text); vertical-align: top; }
.sheet-table tr:hover td { background: #fafcff; }

.pill {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  background: #eef4fd; color: #41628e; font-size: 11px; font-weight: 600;
}
.pill.ok { background: #e7f7ee; color: #14804a; }

.key-card { padding: 14px 16px; margin-bottom: 10px; }
.key-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.key-head strong { font-size: 14px; }
.key-head .link-button { margin-left: auto; }
.key-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 14px; }
.plan-head { display: flex; align-items: center; gap: 6px; }
.plan-price { display: flex; align-items: baseline; gap: 4px; margin: 6px 0 8px; }
.plan-price b { font-size: 20px; }
.plan-features { list-style: none; margin: 0 0 10px; padding: 0; font-size: 12px; color: var(--text); }
.plan-features li { padding: 3px 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat-card { padding: 12px 14px; }
.stat-card span { display: block; }
.stat-card b { display: block; font-size: 22px; letter-spacing: -.02em; margin-top: 2px; }

.chart-card { padding: 14px 16px; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.analytics-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; margin: 12px 0; }
.analytics-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar-group { display: flex; align-items: center; gap: 6px; }
.analytics-detail { margin-top: 14px; }

.bar-list { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 40px; align-items: center; gap: 8px; font-size: 12px; }
.bar-label { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; border-radius: 999px; background: #eef3fa; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; }
.bar-value { text-align: right; color: var(--muted); }

.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.donut { width: 140px; height: 140px; flex: 0 0 auto; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.legend b { margin-left: auto; font-weight: 600; }
.legend.inline { display: flex; gap: 14px; margin-top: 8px; }
.legend.inline span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.legend.inline i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.line-wrap { display: block; }
.line-chart { width: 100%; height: auto; display: block; }

.feedback-card { border: 1px solid #e6eef8; border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.feedback-card p { margin: 6px 0 10px; font-size: 13px; color: var(--text); }

@media (max-width: 900px) {
  .analytics-grid { grid-template-columns: 1fr; }
  .stat-grid.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .sheet-mask { padding: 12px; }
  .sheet-panel { max-height: 92vh; border-radius: 16px; }
  .stat-grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-row { grid-template-columns: 74px 1fr 34px; }
  .agreement-body { max-height: 50vh; }
}

/* Key 卡片：按钮不要离输入框太远 */
.key-card { padding-bottom: 10px; }
.key-actions { margin-top: 2px; }
.key-note:empty { display: none; }

/* 窄屏：让弹窗正文横向滚动，表格保持 table 布局（列不会错位） */
.sheet-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sheet-table { min-width: 100%; }
.sheet-table th, .sheet-table td { white-space: nowrap; }

/* 窄屏触控目标：按钮/下拉/勾选都至少 32px 高，手指点得准 */
@media (max-width: 760px) {
  #menu.icon-btn { width: 40px; height: 40px; padding: 0; }
  .quota-banner .quota-close { width: 32px; height: 32px; font-size: 18px; }
  .agree-row .link-button { padding: 7px 3px; font-size: 12.5px; }
  .quota-banner { padding-right: 6px; }
  .composer select, #media-model, #media-style { min-height: 38px; font-size: 13px; }
  .outline.small, .primary.small { min-height: 36px; padding: 8px 12px; }
  .link-button { padding: 7px 2px; }
  .agree-row { gap: 8px; padding: 6px 0; }
  .agree-row input { width: 20px; height: 20px; }
  .side-account { min-height: 48px; }
  .side-bottom #logout { min-height: 40px; padding: 8px 10px; }
  .artifact-chip, .deliver-chip, .thumb { min-height: 36px; }
  .preview-empty a, .preview-empty .link-button { min-height: 36px; display: inline-flex; align-items: center; }
  .chip { min-height: 34px; padding: 6px 11px; font-size: 12.5px; }
  .toolbar-group { gap: 6px; }
  .turn-list button[data-turn] { min-height: 40px; }

}
