/* 序流 11.5.0：统一、简洁、响应式的单一设计系统 */
:root {
  --blue: #1467c9;
  --blue-strong: #0b55ad;
  --blue-soft: #eaf3ff;
  --text: #172033;
  --text-secondary: #667085;
  --text-tertiary: #98a2b3;
  --line: #e4e9f0;
  --line-strong: #d7dee8;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --page: #f3f6fa;
  --danger: #d92d20;
  --danger-soft: #fff1f0;
  --success: #16805b;
  --warning: #b54708;
  --radius: 8px;
  --control: 40px;
  --side: 216px;
  --ai: 360px;
  --row-scale: 1;
  --shadow-dialog: 0 24px 70px rgba(16, 24, 40, .18);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--page);
  font: 14px/1.5 "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button, input, select, textarea { outline: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  box-shadow: 0 0 0 3px rgba(20, 103, 201, .16);
}
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }

/* 顶部栏 */
.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  height: 60px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand, .top-actions, .login-brand, .account-summary { display: flex; align-items: center; }
.brand { gap: 10px; min-width: 132px; }
.brand-mark {
  width: 32px;
  height: 32px;
  padding: 7px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  flex: 0 0 auto;
  color: #fff;
  background: var(--blue);
  border-radius: 8px;
}
.brand-mark span { width: 3px; display: block; border-radius: 2px; background: currentColor; }
.brand-mark span:nth-child(1) { height: 7px; }
.brand-mark span:nth-child(2) { height: 16px; }
.brand-mark span:nth-child(3) { height: 11px; }
.brand strong, .login-brand strong { display: block; font-size: 17px; line-height: 22px; font-weight: 700; letter-spacing: .04em; }
.brand small, .login-brand small { display: block; margin-top: 1px; color: var(--text-tertiary); font-size: 9px; line-height: 12px; letter-spacing: .11em; }
.top-actions { justify-content: flex-end; gap: 8px; min-width: 0; }

/* 通用控件 */
.btn, .icon-text, .mobile-menu, .account-button, .model-select {
  min-height: var(--control);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
}
.btn, .icon-text, .mobile-menu { padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-strong); border-color: var(--blue-strong); }
.btn-ghost, .icon-text, .mobile-menu { color: #475467; background: #fff; border-color: var(--line-strong); }
.btn-ghost:hover, .icon-text:hover, .mobile-menu:hover { color: var(--text); background: var(--surface-soft); }
.btn-ai { color: var(--blue-strong); background: var(--blue-soft); border-color: #d7e8fc; }
.btn-ai:hover { background: #dfeeff; }
.spark { font-size: 15px; }
.model-select {
  width: clamp(210px, 19vw, 280px);
  min-width: 210px;
  max-width: 280px;
  padding: 0 30px 0 11px;
  overflow: hidden;
  color: #475467;
  background: #fff;
  border-color: var(--line-strong);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-button {
  height: var(--control);
  padding: 0 10px 0 6px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #344054;
  background: #fff;
  border-color: var(--line-strong);
}
.account-button:hover { background: var(--surface-soft); }
.account-avatar {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--blue-strong);
  background: var(--blue-soft);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}
.account-avatar.large { width: 42px; height: 42px; font-size: 15px; }
.account-name { font-size: 13px; }

/* 主布局 */
.workspace {
  min-height: calc(100vh - 60px);
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
}
.workspace.ai-open { grid-template-columns: var(--side) minmax(0, 1fr) var(--ai); }
.sidebar {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  min-height: calc(100vh - 60px);
  padding: 22px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: #fff;
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.sidebar .categories { min-height: 0; overflow-y: auto; }
.side-label {
  padding: 0 10px 6px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
}
.nav-item {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  margin: 2px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #475467;
  background: transparent;
  border: 0;
  border-radius: 7px;
  text-align: left;
  font-size: 13px;
}
.nav-item:hover { background: var(--surface-soft); }
.nav-item.active { color: var(--blue-strong); background: var(--blue-soft); font-weight: 600; }
.nav-item b {
  min-width: 24px;
  padding: 1px 7px;
  color: var(--text-secondary);
  background: #eef1f5;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}
.nav-item.active b { color: var(--blue-strong); background: #d8e9fd; }
.category-dot { width: 7px; height: 7px; margin-right: 8px; display: inline-block; border-radius: 50%; }
.side-note {
  margin-top: auto;
  padding: 12px 10px 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
}
.side-note strong, .side-note small { display: block; }
.side-note strong { font-size: 11px; font-weight: 600; }
.side-note small { color: var(--text-tertiary); font-size: 10px; }
.pulse { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #20b486; }

.content {
  width: min(100%, 1020px);
  margin: 0 auto;
  padding: 32px clamp(20px, 4vw, 48px) 80px;
  overflow: hidden;
}
.content-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0 0 5px; color: var(--text-secondary); font-size: 12px; line-height: 18px; }
.content h1 { margin: 0; color: var(--text); font-size: 28px; line-height: 38px; font-weight: 700; letter-spacing: -.02em; }
.mobile-menu { display: none; }

/* 快速新增 */
.quick-add {
  height: 48px;
  margin: 24px 0 18px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.quick-add:focus-within { border-color: #8ab9ee; box-shadow: 0 0 0 3px rgba(20, 103, 201, .10); }
.quick-add > span { color: var(--blue); font-size: 20px; text-align: center; }
.quick-add input { width: 100%; height: 100%; padding: 0 6px 0 0; color: var(--text); background: transparent; border: 0; font-size: 14px; }
.quick-add input::placeholder { color: var(--text-tertiary); }
.quick-add button { height: 34px; margin-right: 6px; padding: 0 14px; color: #fff; background: var(--blue); border: 0; border-radius: 6px; font-size: 13px; font-weight: 600; }
.quick-add button:hover { background: var(--blue-strong); }
.smart-capture { margin: 0 0 20px; padding: 14px; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: var(--radius); }
.smart-capture-head, .smart-capture-head > div, .smart-capture-foot { display: flex; align-items: center; }
.smart-capture-head { justify-content: space-between; gap: 14px; }
.smart-capture-head > div { min-width: 0; gap: 8px; }
.smart-capture-head strong { flex: 0 0 auto; font-size: 13px; }
.smart-capture-head small { overflow: hidden; color: var(--text-secondary); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.smart-mark { width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 auto; color: var(--blue); background: var(--blue-soft); border-radius: 6px; }
.history-link { padding: 4px 0; flex: 0 0 auto; color: var(--blue-strong); background: transparent; border: 0; font-size: 11px; }
.smart-capture textarea { width: 100%; min-height: 74px; margin: 11px 0 9px; padding: 10px 11px; resize: vertical; color: var(--text); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 7px; font-size: 13px; line-height: 1.6; }
.smart-capture textarea:focus { background: #fff; border-color: #8ab9ee; }
.smart-capture-foot { justify-content: space-between; gap: 12px; }
.smart-capture-foot > span { color: var(--text-tertiary); font-size: 10px; }
.smart-capture-foot .btn { min-height: 34px; }
.list-summary { height: 28px; display: flex; align-items: flex-start; justify-content: space-between; color: var(--text-secondary); font-size: 12px; }
.drag-tip { color: var(--text-tertiary); }

/* 任务列表 */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-row {
  position: relative;
  min-height: calc(64px * var(--row-scale));
  padding: 8px 52px 8px 6px;
  display: grid;
  grid-template-columns: 44px 22px minmax(0, 1fr) 120px 70px 34px;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  touch-action: pan-y;
}
.task-row:hover { border-color: #cbd5e1; box-shadow: 0 3px 12px rgba(16, 24, 40, .05); }
.task-row > .tag { display: none; }
.drag-handle {
  height: 42px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  color: var(--text-tertiary);
  border-radius: 6px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.drag-handle:hover { color: var(--text-secondary); background: var(--surface-soft); }
.drag-handle:active { cursor: grabbing; }
.grip-dots { display: grid; grid-template-columns: repeat(2, 3px); gap: 2px; }
.grip-dots i { width: 3px; height: 3px; display: block; background: currentColor; border-radius: 50%; }
.row-rank { color: var(--text-tertiary); font-size: 9px; line-height: 10px; font-weight: 500; }
.check {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--blue);
  cursor: pointer;
}
.task-main { min-width: 0; padding: 3px 0; cursor: default; }
.task-title { overflow: hidden; color: var(--text); font-size: 14px; line-height: 22px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.task-title.done { color: var(--text-tertiary); font-weight: 500; text-decoration: line-through; }
.task-meta { margin-top: 2px; display: flex; align-items: center; gap: 0; overflow: hidden; color: var(--text-secondary); font-size: 11px; line-height: 16px; white-space: nowrap; }
.task-meta span { overflow: hidden; text-overflow: ellipsis; }
.task-meta span + span::before { content: "·"; margin: 0 6px; color: #c0c7d1; }
.task-meta span:last-child { max-width: 240px; }
.pin { color: #e78926; font-size: 10px; }
.lock { margin-left: 4px; padding: 1px 5px; color: var(--text-secondary); background: #eef1f5; border-radius: 4px; font-size: 9px; font-weight: 500; vertical-align: 1px; }
.batch, .due, .priority { min-width: 0; font-size: 11px; white-space: nowrap; }
.batch { width: 100%; overflow: hidden; color: #6941c6; text-overflow: ellipsis; text-align: left; }
.batch-empty { visibility: hidden; }
.due { width: 100%; color: var(--text-secondary); text-align: right; }
.due.overdue { color: var(--danger); }
.priority { width: 34px; padding: 3px 5px; color: #475467; background: #eef1f5; border-radius: 5px; text-align: center; font-weight: 700; }
.priority.p0, .priority.p1 { color: #b42318; background: var(--danger-soft); }
.priority.p2 { color: var(--blue-strong); background: var(--blue-soft); }
.more {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 20px;
  line-height: 1;
  transform: translateY(-50%);
}
.more:hover { color: var(--text); background: var(--surface-soft); }
.empty-state { padding: 64px 24px; display: grid; place-items: center; color: var(--text-secondary); text-align: center; }
.empty-state b { color: var(--text); font-size: 16px; }
.empty-state span { margin-top: 4px; font-size: 13px; }

/* 拖拽状态 */
.task-placeholder { min-height: 64px; border: 1px dashed #8ab9ee; border-radius: var(--radius); background: var(--blue-soft); }
.task-row.drag-source { opacity: 0; }
.drag-ghost {
  position: fixed;
  z-index: 1000;
  margin: 0;
  pointer-events: none;
  border-color: #9fc5ef;
  box-shadow: 0 14px 35px rgba(16, 24, 40, .18);
  transform-origin: center;
  will-change: transform;
  transition: none;
}
.drag-ghost.dropping {
  opacity: .7;
  transition: transform .16s cubic-bezier(.2,.8,.2,1), opacity .16s ease;
}
.drop-settle { animation: settle .28s ease; }
@keyframes settle { 0% { background: var(--blue-soft); } 100% { background: #fff; } }

/* AI 面板 */
.ai-panel {
  min-width: 0;
  min-height: calc(100vh - 60px);
  display: none;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid var(--line);
}
.workspace.ai-open .ai-panel { display: flex; }
.panel-head {
  height: 66px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.panel-head > div { display: flex; align-items: center; gap: 10px; }
.panel-head strong, .panel-head small { display: block; }
.panel-head strong { font-size: 14px; }
.panel-head small { color: var(--text-tertiary); font-size: 10px; }
.ai-orb { width: 32px; height: 32px; display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); border-radius: 8px; }
#closeAi, .dialog-close {
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 22px;
  line-height: 1;
}
#closeAi:hover, .dialog-close:hover { color: var(--text); background: var(--surface-soft); }
.ai-intro, .ai-command { margin: 16px 16px 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.ai-intro span, .ai-command label { color: var(--text-secondary); font-size: 11px; font-weight: 600; }
.ai-intro p { margin: 6px 0 0; color: #344054; font-size: 13px; }
.ai-command textarea { width: 100%; min-height: 66px; margin-top: 8px; padding: 9px 10px; resize: vertical; color: var(--text); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.prompt-chips { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.prompt-chips button { min-height: 28px; padding: 0 9px; color: var(--text-secondary); background: #fff; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; }
.prompt-chips button:hover { color: var(--blue-strong); border-color: #aacbf0; }
.ai-warning { margin: 12px 16px 0; padding: 10px 12px; color: var(--warning); background: #fffaeb; border: 1px solid #fedf89; border-radius: 6px; font-size: 12px; }
.ai-result { padding: 12px 16px 90px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.ai-item { padding: 11px 12px; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 9px; border: 1px solid var(--line); border-radius: var(--radius); }
.ai-rank { width: 22px; height: 22px; display: grid; place-items: center; color: var(--blue-strong); background: var(--blue-soft); border-radius: 5px; font-size: 11px; font-weight: 700; }
.ai-item strong { display: block; font-size: 13px; }
.ai-item p { margin: 3px 0 0; color: var(--text-secondary); font-size: 11px; }
.ai-item em { margin-top: 5px; display: block; color: #6941c6; font-size: 10px; font-style: normal; }
.panel-actions { position: sticky; bottom: 0; margin-top: auto; padding: 12px 16px; display: flex; justify-content: flex-end; gap: 7px; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); }
.panel-actions .btn { padding-inline: 10px; }

/* 弹窗与表单 */
dialog {
  width: min(600px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 0;
  color: var(--text);
  background: #fff;
  border: 0;
  border-radius: 10px;
  box-shadow: var(--shadow-dialog);
  overflow: auto;
}
dialog::backdrop { background: rgba(24, 34, 48, .42); backdrop-filter: blur(3px); }
dialog form { padding: 22px; }
.dialog-head { margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-head small { color: var(--text-tertiary); font-size: 11px; }
.dialog-head h2 { margin: 2px 0 0; font-size: 20px; line-height: 28px; }
.field { display: grid; gap: 7px; color: #344054; font-size: 13px; font-weight: 600; }
.field > span { line-height: 18px; }
.field > small { color: var(--text-tertiary); font-size: 10px; font-weight: 400; }
.char-counter { display: block; margin-top: 2px; text-align: right; }
.char-counter.over-limit { color: var(--danger); font-weight: 500; }
.form-error { margin-top: -5px; padding: 9px 11px; color: var(--danger); background: var(--danger-soft); border: 1px solid #f6c5c0; border-radius: 7px; font-size: 12px; line-height: 1.45; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: var(--control);
  padding: 9px 11px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 400;
}
.field textarea { min-height: 84px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-tertiary); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #8ab9ee; }
.field-wide { grid-column: 1 / -1; }
.form-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.check-field { min-height: var(--control); display: flex; align-items: center; gap: 8px; color: #344054; font-size: 13px; }
.check-field input { width: 16px; height: 16px; accent-color: var(--blue); }
.task-option {
  padding: 0 11px;
  justify-content: space-between;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 600;
  cursor: pointer;
}
.task-options { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.task-option:hover { background: #f1f5f9; border-color: var(--line-strong); }
.task-option input { margin: 0; flex: 0 0 auto; }
.advanced-toggle { margin-top: 12px; padding: 0; color: var(--blue-strong); background: transparent; border: 0; font-size: 12px; }
.dialog-actions { margin-top: 22px; padding-top: 16px; display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; border-top: 1px solid var(--line); }
.danger-link { padding: 0 10px; color: var(--danger); background: transparent; border: 0; border-radius: 6px; font-size: 12px; }
.danger-link:hover { background: var(--danger-soft); }
.btn-danger-subtle { color: var(--danger); background: #fff; border-color: #f0b7b2; }
.btn-danger-subtle:hover { color: #b42318; background: var(--danger-soft); border-color: #e99a93; }
.parse-review-dialog { width: min(820px, calc(100vw - 32px)); }
.parse-review-dialog form { padding-bottom: 18px; }
.parse-review-note { margin-bottom: 12px; padding: 11px 12px; display: flex; justify-content: space-between; gap: 12px; background: var(--surface-soft); border-radius: 7px; }
.parse-review-note strong { font-size: 13px; }
.parse-review-note small { color: var(--text-secondary); font-size: 11px; }
.parse-review-dialog .ai-warning { margin: 0 0 12px; }
.parse-review-items { max-height: min(520px, calc(100vh - 250px)); display: grid; gap: 9px; overflow: auto; }
.parse-review-item { padding: 12px; display: grid; grid-template-columns: 58px minmax(0,1fr); gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.parse-review-item.is-duplicate { border-color: #f0b38a; background: #fffaf7; }
.parse-duplicate-warning { padding: 6px 8px; color: var(--warning); background: #fff4e8; border-radius: 5px; font-size: 10px; }
.parse-select { min-height: var(--control); display: flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 11px; }
.parse-select input { width: 16px; height: 16px; accent-color: var(--blue); }
.parse-item-fields { display: grid; gap: 8px; }
.parse-item-fields > input, .parse-item-fields > textarea, .parse-item-grid input, .parse-item-grid select { width: 100%; min-height: 36px; padding: 7px 9px; color: var(--text); background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 12px; }
.parse-item-fields > input { font-weight: 600; }
.parse-item-fields > textarea { min-height: 52px; resize: vertical; }
.parse-item-grid { display: grid; grid-template-columns: 1fr 145px 110px 110px; gap: 7px; }
.parse-actions { grid-template-columns: auto 1fr auto auto; position: sticky; bottom: -18px; background: #fff; }
.parse-history-dialog { width: min(620px, calc(100vw - 32px)); }
.parse-history-list, .parse-admin-list { display: grid; gap: 8px; }
.parse-history-row, .parse-admin-row { min-height: 56px; padding: 9px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.parse-history-row > div, .parse-admin-row > div { min-width: 0; }
.parse-history-row strong, .parse-history-row small, .parse-admin-row strong, .parse-admin-row small { display: block; }
.parse-history-row strong, .parse-admin-row strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.parse-history-row small, .parse-admin-row small { margin-top: 3px; color: var(--text-secondary); font-size: 10px; }
.parse-history-row .btn { min-height: 32px; padding-inline: 10px; flex: 0 0 auto; font-size: 11px; }
.parse-history-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.history-delete { min-height: 32px; padding: 0 7px; color: var(--danger); background: transparent; border: 0; font-size: 10px; }
.history-delete:hover { background: var(--danger-soft); border-radius: 5px; }
.parse-status { padding: 3px 7px; flex: 0 0 auto; color: var(--text-secondary); background: #eef1f5; border-radius: 5px; font-size: 10px; }
.parse-status.confirmed { color: var(--success); background: #ecfdf3; }
.parse-status.cancelled, .parse-status.failed { color: var(--danger); background: var(--danger-soft); }

/* 登录 */
.auth-dialog { width: min(380px, calc(100vw - 32px)); }
.auth-dialog form { padding: 28px; display: grid; gap: 16px; }
.login-brand { margin-bottom: 4px; gap: 11px; }
.login-brand .brand-mark { width: 36px; height: 36px; }
.login-brand strong { font-size: 19px; }
.login-brand small { color: var(--text-secondary); font-size: 11px; letter-spacing: 0; }
.login-submit { width: 100%; margin-top: 2px; }

/* 账号设置 */
.account-dialog { width: min(660px, calc(100vw - 32px)); }
.settings-tabs { margin: -4px 0 20px; display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.settings-tabs button { min-width: max-content; min-height: 38px; padding: 0 12px; flex: 0 0 auto; color: var(--text-secondary); background: transparent; border: 0; border-bottom: 2px solid transparent; font-size: 13px; line-height: 1; white-space: nowrap; word-break: keep-all; writing-mode: horizontal-tb; }
.settings-tabs button.active { color: var(--blue-strong); border-bottom-color: var(--blue); font-weight: 600; }
.settings-section { display: none; }
.settings-section.active { display: grid; gap: 16px; }
.account-summary { gap: 10px; padding: 12px; background: var(--surface-soft); border-radius: var(--radius); }
.account-summary strong, .account-summary small { display: block; }
.account-summary strong { font-size: 14px; }
.account-summary small { color: var(--text-secondary); font-size: 11px; }
.settings-status-row, .model-discovery-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.settings-status-row strong, .settings-status-row small, .model-discovery-row strong, .model-discovery-row small { display: block; }
.settings-status-row strong, .model-discovery-row strong { font-size: 13px; }
.settings-status-row small, .model-discovery-row small { color: var(--text-secondary); font-size: 11px; }
.connection-status { padding: 3px 8px; color: var(--text-secondary); background: #eef1f5; border-radius: 5px; font-size: 11px; }
.connection-status.ready { color: var(--success); background: #ecfdf3; }
.model-choice-list { display: flex; flex-wrap: wrap; gap: 7px; }
.model-choice { min-height: 34px; padding: 0 10px; display: inline-flex; align-items: center; gap: 7px; color: #344054; background: #fff; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.model-choice:has(input:checked) { color: var(--blue-strong); background: var(--blue-soft); border-color: #a9ccef; }
.model-choice input { width: 14px; height: 14px; accent-color: var(--blue); }
.model-empty { width: 100%; margin: 0; padding: 14px; color: var(--text-secondary); background: var(--surface-soft); border: 1px dashed var(--line-strong); border-radius: 7px; font-size: 12px; }
.inline-actions { display: flex; justify-content: flex-end; }
.parse-prompt-settings { gap: 16px; }
.parse-prompt-settings textarea { min-height: 86px; line-height: 1.65; font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
.parse-prompt-settings #parseInstruction { min-height: 260px; }
.parse-prompt-settings .readonly-prompt { min-height: 360px; color: var(--text); background: #f5f7fb; border-color: #d8dee9; cursor: default; }
.parse-prompt-settings code { padding: 1px 4px; color: var(--blue-strong); background: var(--blue-soft); border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.toast {
  position: fixed;
  z-index: 1000;
  inset: max(16px, env(safe-area-inset-top)) auto auto 50%;
  width: max-content;
  height: auto;
  margin: 0;
  left: 50%;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  color: #fff;
  background: #202939;
  border: 0;
  border-radius: 7px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, .2);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity .16s ease, transform .16s ease;
}
.toast::backdrop { background: transparent; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.mobile-nav { display: none; }

/* 平板 */
@media (max-width: 1100px) {
  .workspace.ai-open { grid-template-columns: var(--side) minmax(0, 1fr); }
  .ai-panel {
    position: fixed;
    z-index: 40;
    top: 60px;
    right: 0;
    bottom: 0;
    width: min(var(--ai), calc(100vw - var(--side)));
    min-height: 0;
    box-shadow: -12px 0 35px rgba(16, 24, 40, .12);
  }
  .content { padding-inline: 28px; }
  .model-select { width: 190px; min-width: 190px; }
  .task-row { grid-template-columns: 44px 22px minmax(0, 1fr) 70px 34px; }
  .task-row .batch { display: none; }
  .task-meta span:last-child { max-width: 180px; }
  #taskDialog.mobile-task-surface {
    position: fixed;
    inset: 60px 0 0;
    width: 100vw;
    max-width: none;
    height: auto;
    max-height: none;
    margin: 0;
    padding: 0;
    border-radius: 0;
    overflow: hidden;
  }
  #taskDialog.mobile-task-surface::backdrop { background: transparent; backdrop-filter: none; }
  #taskDialog.mobile-task-surface form {
    height: 100%;
    min-height: 0;
    padding: max(14px, env(safe-area-inset-top)) 28px 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #taskDialog.mobile-task-surface .dialog-head { min-height: 58px; margin: 0 -28px 16px; padding: 0 28px; flex: 0 0 auto; align-items: center; background: #fff; border-bottom: 1px solid var(--line); }
  #taskDialog.mobile-task-surface .dialog-head h2 { font-size: 19px; line-height: 26px; }
  #taskDialog.mobile-task-surface .dialog-close { width: 40px; height: 40px; flex: 0 0 auto; font-size: 25px; }
  #taskDialog.mobile-task-surface .task-form-scroll { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 18px; }
  #taskDialog.mobile-task-surface .advanced-fields { padding-bottom: 16px; }
  #taskDialog.mobile-task-surface .advanced-toggle { min-height: 40px; margin: 12px 0 10px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; color: var(--text); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 7px; font-size: 13px; font-weight: 600; text-align: left; }
  #taskDialog.mobile-task-surface .advanced-toggle::after { content: '›'; color: var(--text-tertiary); font-size: 20px; line-height: 1; transform: rotate(90deg); }
  #taskDialog.mobile-task-surface .advanced-toggle[aria-expanded="true"]::after { transform: rotate(-90deg); }
  #taskDialog.mobile-task-surface .advanced-fields .form-grid { margin-top: 14px; }
  #taskDialog.mobile-task-surface .task-dialog-actions { position: sticky; bottom: 0; z-index: 2; margin: auto -28px 0; padding: 10px 28px max(10px, env(safe-area-inset-bottom)); flex: 0 0 auto; display: grid; grid-template-columns: 1fr; background: rgba(255,255,255,.97); box-shadow: 0 -8px 18px rgba(16,24,40,.06); }
  #taskDialog.mobile-task-surface .task-dialog-actions > span, #taskDialog.mobile-task-surface .task-dialog-actions #cancelTask { display: none; }
  #taskDialog.mobile-task-surface .task-dialog-actions #saveTask { grid-column: 1; grid-row: 1; width: 100%; min-height: 44px; }
  #taskDialog.mobile-task-surface .task-dialog-actions #deleteTask { grid-column: 1; grid-row: 2; min-height: 34px; margin-top: 2px; }
}

/* 手机 */
@media (max-width: 720px) {
  :root { --control: 40px; }
  body { padding-bottom: 58px; }
  .topbar { height: 56px; padding: 0 12px; gap: 10px; }
  .brand { min-width: auto; }
  .brand-mark { width: 30px; height: 30px; }
  .brand strong { font-size: 16px; }
  .brand small, .account-name, .model-select, .top-actions .btn-ai { display: none; }
  .top-actions { gap: 6px; }
  .account-button { width: 36px; height: 36px; min-height: 36px; padding: 3px; border: 0; }
  .icon-text { height: 36px; min-height: 36px; padding: 0 9px; font-size: 12px; }
  .workspace, .workspace.ai-open { min-height: calc(100vh - 56px); display: block; }
  .sidebar {
    position: fixed;
    z-index: 50;
    top: 56px;
    bottom: 58px;
    left: 0;
    width: min(280px, 84vw);
    height: auto;
    min-height: 0;
    transform: translateX(-102%);
    transition: transform .2s ease;
    box-shadow: 14px 0 35px rgba(16, 24, 40, .14);
  }
  .sidebar.open { transform: translateX(0); }
  .content { width: 100%; padding: 22px 12px 28px; }
  .content-head { align-items: center; }
  .content h1 { font-size: 22px; line-height: 30px; }
  .eyebrow { margin-bottom: 2px; font-size: 11px; }
  .mobile-menu { min-height: 36px; padding: 0 11px; display: inline-flex; }
  .quick-add { height: 46px; margin: 18px 0 15px; grid-template-columns: 32px minmax(0, 1fr) auto; }
  .quick-add button { padding-inline: 11px; }
  .smart-capture { padding: 12px; }
  .smart-capture-head small { display: none; }
  .smart-capture-foot { align-items: flex-end; }
  .smart-capture-foot > span { max-width: 190px; }
  .drag-tip { display: none; }
  .task-list { gap: 7px; }
  .task-row {
    min-height: 62px;
    padding: 7px 42px 7px 2px;
    grid-template-columns: 38px 20px minmax(0, 1fr) 34px;
    gap: 8px;
  }
  .task-row .batch, .task-row .due { display: none; }
  .drag-handle { height: 40px; }
  .task-title { font-size: 13px; }
  .task-meta { font-size: 10px; }
  .task-meta span:nth-child(n+4) { display: none; }
  .more { right: 5px; width: 30px; height: 30px; }
  .ai-panel {
    top: 56px;
    bottom: 58px;
    left: 0;
    width: 100%;
    min-height: 0;
    background: var(--page);
    box-shadow: none;
  }
  .panel-head { height: 58px; flex: 0 0 auto; background: #fff; }
  .ai-intro, .ai-command { margin-inline: 12px; background: #fff; }
  .ai-result { min-height: 0; flex: 1 1 auto; padding: 12px 12px 16px; }
  .panel-actions { position: sticky; bottom: 0; padding: 10px 12px max(10px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 0 0 auto; }
  .panel-actions .btn { width: 100%; }
  .panel-actions #undoAi { grid-column: 1 / -1; grid-row: 2; }
  .mobile-nav {
    position: fixed;
    z-index: 45;
    right: 0;
    bottom: 0;
    left: 0;
    height: 58px;
    padding: 5px max(8px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    background: rgba(255, 255, 255, .97);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(12px);
  }
  .mobile-nav button { color: var(--text-secondary); background: transparent; border: 0; border-radius: 6px; font-size: 11px; }
  .mobile-nav button.active { color: var(--blue-strong); background: var(--blue-soft); font-weight: 600; }
  dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); border-radius: 9px; }
  dialog form { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; gap: 13px; }
  .task-options { grid-template-columns: 1fr; gap: 13px; }
  .dialog-actions { grid-template-columns: auto 1fr auto; }
  .dialog-actions .btn-ghost { display: none; }
  .parse-review-item { grid-template-columns: 1fr; }
  .parse-select { min-height: 24px; }
  .parse-item-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .parse-actions { grid-template-columns: 1fr 1fr; }
  .parse-actions > span { display: none; }
  .parse-actions .btn { display: inline-flex !important; width: 100%; }
  .parse-actions #confirmParsedTasks { grid-column: 1 / -1; grid-row: 1; }
  .auth-dialog { width: min(380px, calc(100vw - 24px)); }
  .auth-dialog form { padding: 24px 20px; }
  #taskDialog.mobile-task-surface {
    position: fixed;
    inset: 60px 0 58px;
    width: 100vw;
    max-width: none;
    height: auto;
    max-height: none;
    margin: 0;
    padding: 0;
    border-radius: 0;
    overflow: hidden;
  }
  #taskDialog.mobile-task-surface::backdrop { background: transparent; backdrop-filter: none; }
  #taskDialog.mobile-task-surface form {
    height: 100%;
    min-height: 0;
    padding: max(14px, env(safe-area-inset-top)) 16px 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #taskDialog.mobile-task-surface .dialog-head {
    min-height: 58px;
    margin: 0 -16px 16px;
    padding: 0 16px;
    flex: 0 0 auto;
    align-items: center;
    background: #fff;
    border-bottom: 1px solid var(--line);
  }
  #taskDialog.mobile-task-surface .dialog-head h2 { font-size: 18px; line-height: 24px; }
  #taskDialog.mobile-task-surface .dialog-close { width: 40px; height: 40px; flex: 0 0 auto; font-size: 25px; }
  #taskDialog.mobile-task-surface .task-form-scroll { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 18px; }
  #taskDialog.mobile-task-surface .advanced-fields {
    padding-bottom: 16px;
  }
  #taskDialog.mobile-task-surface .advanced-toggle {
    min-height: 40px;
    margin: 12px 0 10px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
  }
  #taskDialog.mobile-task-surface .advanced-toggle::after { content: '›'; color: var(--text-tertiary); font-size: 20px; line-height: 1; transform: rotate(90deg); }
  #taskDialog.mobile-task-surface .advanced-toggle[aria-expanded="true"]::after { transform: rotate(-90deg); }
  #taskDialog.mobile-task-surface .advanced-fields .form-grid { margin-top: 14px; }
  #taskDialog.mobile-task-surface .task-dialog-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin: auto -16px 0;
    padding: 10px 16px max(10px, env(safe-area-inset-bottom));
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    background: rgba(255,255,255,.97);
    box-shadow: 0 -8px 18px rgba(16,24,40,.06);
  }
  #taskDialog.mobile-task-surface .task-dialog-actions > span,
  #taskDialog.mobile-task-surface .task-dialog-actions #cancelTask { display: none; }
  #taskDialog.mobile-task-surface .task-dialog-actions #saveTask { grid-column: 1; grid-row: 1; width: 100%; min-height: 44px; }
  #taskDialog.mobile-task-surface .task-dialog-actions #deleteTask { grid-column: 1; grid-row: 2; min-height: 34px; margin-top: 2px; }
  .settings-status-row, .model-discovery-row { align-items: flex-start; flex-direction: column; }
  .model-discovery-row .btn { width: 100%; }
  .account-dialog form { padding: 18px 16px; }
  .settings-tabs { margin: -2px -16px 18px; padding: 0 16px; gap: 2px; }
  .settings-tabs button { min-height: 42px; padding-inline: 11px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* v10 权限与用量管理 */
.admin-section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.admin-section-head strong, .admin-section-head small { display: block; }
.admin-section-head strong { font-size: 14px; }
.admin-section-head small { margin-top: 3px; color: var(--text-secondary); font-size: 11px; }
.user-list { display: grid; gap: 8px; }
.user-row { min-height: 56px; padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.user-row-main, .user-row-actions { display: flex; align-items: center; gap: 9px; min-width: 0; }
.user-row-main > div { min-width: 0; }
.user-row-main strong, .user-row-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row-main strong { font-size: 13px; }
.user-row-main small { margin-top: 2px; color: var(--text-secondary); font-size: 10px; }
.user-status { padding: 3px 7px; color: var(--text-secondary); background: #eef1f5; border-radius: 5px; font-size: 10px; }
.user-status.is-active { color: var(--success); background: #ecfdf3; }
.user-row .btn { min-height: 32px; padding-inline: 10px; font-size: 11px; }
.compact-select { min-height: 34px; padding: 0 9px; color: var(--text-secondary); background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 12px; }
.usage-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.usage-summary > div { padding: 10px; background: var(--surface-soft); border-radius: 7px; }
.usage-summary strong, .usage-summary small { display: block; }
.usage-summary strong { font-size: 18px; line-height: 22px; }
.usage-summary small { margin-top: 3px; color: var(--text-secondary); font-size: 10px; }
.usage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.settings-section h3 { margin: 0 0 8px; color: var(--text-secondary); font-size: 11px; font-weight: 600; }
.usage-table { display: grid; gap: 6px; }
.usage-line { min-height: 34px; padding: 7px 9px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface-soft); border-radius: 6px; font-size: 11px; }
.usage-line span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-line span small { display: block; margin-top: 2px; color: var(--text-tertiary); font-size: 9px; }
.usage-line b { flex: 0 0 auto; color: var(--text-secondary); font-size: 10px; font-weight: 600; }
.usage-ok { color: var(--success) !important; }
.usage-fail { color: var(--danger) !important; }
.user-dialog { width: min(420px, calc(100vw - 32px)); }
.user-dialog form { display: grid; gap: 16px; }
@media (max-width: 720px) {
  .usage-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .usage-grid { grid-template-columns: 1fr; gap: 14px; }
  .user-row { align-items: flex-start; }
  .user-row-actions { flex-direction: column; align-items: flex-end; gap: 5px; }
  .admin-section-head { align-items: flex-start; }
}

/* 11.5.0：多选批量管理、本周视图 */
.head-actions { display: flex; align-items: center; gap: 8px; }
.row-select { display: none; width: 44px; height: 42px; place-items: center; cursor: pointer; }
.row-select-box { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); cursor: pointer; }
body.selecting .row-select { display: grid; }
body.selecting .drag-handle { display: none; }
body.selecting .task-row { cursor: pointer; }
body.selecting .task-row.is-selected { border-color: var(--blue); background: var(--blue-soft); }
.bulk-bar {
  position: fixed; left: 50%; bottom: 18px; z-index: 1200;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: #0f172a; color: #fff;
  border-radius: 14px; box-shadow: 0 10px 30px rgba(16, 24, 40, .32);
  font-size: 13px;
}
.bulk-bar[hidden] { display: none; }
.bulk-count { padding: 0 2px; font-weight: 600; }
.bulk-bar button { padding: 6px 12px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .14); color: #fff; font-size: 13px; cursor: pointer; }
.bulk-bar button:hover { background: rgba(255, 255, 255, .26); }
.bulk-bar button.primary { background: var(--blue); }
.bulk-bar button.primary:hover { background: var(--blue-strong); }
.bulk-bar button.danger { background: var(--danger); }
.bulk-bar button.danger:hover { background: #b42318; }
@media (max-width: 720px) {
  .bulk-bar { width: calc(100vw - 24px); max-width: 420px; justify-content: center; flex-wrap: wrap; bottom: 76px; }
  .head-actions .btn { padding: 0 10px; min-height: 36px; }
}
