/* 个人工作台 · 蓝白科技风 */
:root {
  --bg: #F4F7FB; --card: #FFFFFF; --ink: #1C2430; --muted: #7A8699;
  --line: #E4EAF2; --blue: #2F6FED; --blue-soft: #EAF1FE; --blue-deep: #1E4FC4;
  --red: #E5484D; --orange: #F5A623; --green: #2FA36B;
  --shadow: 0 1px 3px rgba(28, 36, 48, .06), 0 4px 14px rgba(28, 36, 48, .05);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { background: var(--bg); color: var(--ink); font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; font-size: 14.5px; display: flex; min-height: 100vh; }

/* ---- 侧栏 ---- */
.side { width: 200px; flex: none; background: var(--card); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; padding: 4px 8px 18px; }
.brand .logo { width: 26px; height: 26px; border-radius: 8px; background: var(--blue); display: inline-block; position: relative; }
.brand .logo::after { content: "✓"; color: #fff; position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; }
.brand em { font-style: normal; font-size: 11px; color: var(--blue); background: var(--blue-soft); border-radius: 10px; padding: 1px 7px; }
#nav { display: flex; flex-direction: column; gap: 4px; }
#nav button { text-align: left; border: none; background: transparent; padding: 10px 12px; border-radius: 9px; font-size: 14.5px; color: var(--muted); cursor: pointer; }
#nav button:hover { background: var(--bg); color: var(--ink); }
#nav button.active { background: var(--blue-soft); color: var(--blue-deep); font-weight: 600; }
.side-foot { margin-top: auto; }
.ghost-btn { width: 100%; border: 1px dashed var(--line); background: var(--bg); color: var(--muted); border-radius: 9px; padding: 9px; cursor: pointer; font-size: 13px; }
.ghost-btn:hover { color: var(--blue); border-color: var(--blue); }

/* ---- 主区 ---- */
.wrap { flex: 1; min-width: 0; padding: 16px 22px 40px; max-width: 1060px; margin: 0 auto; }
.topbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
#searchBox { flex: 1; border: 1.5px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 14px; font-size: 14px; outline: none; color: var(--ink); }
#searchBox:focus { border-color: var(--blue); }
.today-chip { font-size: 13px; color: var(--muted); white-space: nowrap; }
.search-panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); margin: -10px 0 14px; padding: 8px; max-height: 50vh; overflow: auto; }
.search-panel .sec { font-size: 12px; color: var(--muted); padding: 6px 8px 2px; }
.search-panel .item { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.search-panel .item:hover { background: var(--blue-soft); }

/* ---- 通用卡片 ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
h2.page { font-size: 20px; margin-bottom: 4px; }
p.sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.btn { border: none; background: var(--blue); color: #fff; border-radius: 9px; padding: 9px 16px; font-size: 14px; cursor: pointer; }
.btn:hover { background: var(--blue-deep); }
.btn.plain { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }
.btn.danger { background: var(--card); color: var(--red); border: 1.5px solid var(--red); }
.mini { border: 1px solid var(--line); background: var(--card); border-radius: 7px; padding: 4px 9px; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.mini:hover { color: var(--blue); border-color: var(--blue); }
.empty { text-align: center; color: var(--muted); padding: 46px 0; font-size: 14px; }
.hidden { display: none !important; }

/* ---- 总览 ---- */
.hero { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 0 14px; }
.hero h2 { font-size: 22px; }
.hero .quote { color: var(--muted); font-size: 12.5px; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { text-align: left; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .num small { font-size: 13px; font-weight: 400; color: var(--muted); }
.stat .lab { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat.important .num { color: var(--red); }
.stat.done .num { color: var(--green); }
.stat.progress .num { color: var(--blue); }
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; align-items: start; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 16px 2px 8px; }
.sec-head h3 { font-size: 15px; }
.sec-head a { font-size: 12.5px; color: var(--blue); cursor: pointer; text-decoration: none; }
.bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--blue); }

/* ---- 任务行 ---- */
.task { display: flex; gap: 10px; align-items: flex-start; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: none; }
.ck { width: 19px; height: 19px; border-radius: 6px; border: 2px solid #C6CFDC; flex: none; margin-top: 1px; cursor: pointer; background: var(--card); }
.ck.done { background: var(--blue); border-color: var(--blue); position: relative; }
.ck.done::after { content: "✓"; color: #fff; font-size: 12px; position: absolute; inset: 0; display: grid; place-items: center; }
.t-main { flex: 1; min-width: 0; }
.t-title { font-size: 14.5px; line-height: 1.45; word-break: break-word; }
.task.is-done .t-title { color: var(--muted); text-decoration: line-through; }
.t-meta { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; align-items: center; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 5px; }
.tag.high { background: #FDECEC; color: var(--red); }
.tag.mid { background: #FFF4E0; color: #B26E00; }
.tag.low { background: var(--blue-soft); color: var(--blue-deep); }
.tag.proj { background: var(--bg); color: var(--muted); border-left: 3px solid var(--blue); }
.tag.due { background: var(--bg); color: var(--muted); }
.tag.due.over { background: #FDECEC; color: var(--red); font-weight: 600; }
.tag.pinned { background: #FFF8E6; color: #B26E00; }
.t-act { display: flex; gap: 5px; opacity: 0; transition: .12s; }
.task:hover .t-act { opacity: 1; }
.filters { display: flex; gap: 6px; margin: 12px 0; }
.filters button { border: 1px solid var(--line); background: var(--card); border-radius: 20px; padding: 6px 14px; font-size: 13px; color: var(--muted); cursor: pointer; }
.filters button.active { background: var(--blue); border-color: var(--blue); color: #fff; }
/* ---- 待办页项目分组 ---- */
.pgroup { border: 1px solid var(--line); border-radius: 14px; background: var(--card); margin-bottom: 12px; overflow: hidden; }
.pgroup-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #F7FAFD; cursor: pointer; user-select: none; }
.pgroup-head:hover { background: var(--blue-soft); }
button.pgroup-head { width: 100%; border: 0; color: inherit; font: inherit; text-align: left; }
button.pgroup-head:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.pgroup-head .arrow { font-size: 11px; color: var(--muted); transition: transform .18s ease; flex: none; }
.pgroup.folded .arrow { transform: rotate(-90deg); }
.pgroup-head .pname { font-weight: 600; font-size: 14px; flex: none; }
.pgroup-head .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.pgroup-preview { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; text-align: right; }
.pgroup-head .gb { display: flex; gap: 6px; margin-left: auto; flex: none; }
.gbadge { font-size: 11px; padding: 2px 9px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.gbadge.sched { background: var(--blue-soft); color: var(--blue-deep); }
.gbadge.unsched { background: #EFEEE9; color: #5F5E5A; }
.gbadge.done { background: #E5F3EC; color: var(--green); }
.pgroup-body { padding: 4px 10px 10px; }
.pgroup.folded .pgroup-body { display: none; }
.subttl { font-size: 12px; font-weight: 600; margin: 10px 4px 6px; }
.subttl.sched { color: var(--blue-deep); }
.subttl.unsched { color: #888780; }
.unsched-zone .task { border: 1px dashed var(--line); background: var(--bg); }
.tag.unsched { background: #EFEEE9; color: #5F5E5A; }

/* ---- 项目 ---- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 16px; }
.proj-card { position: relative; padding: 20px 22px 14px; border-radius: 16px; overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.proj-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--pc-color, var(--blue)); }
.proj-card:hover { transform: translateY(-3px); border-color: #CBD8EC; box-shadow: 0 10px 28px rgba(28, 36, 48, .10), 0 2px 8px rgba(28, 36, 48, .05); }
.proj-card .name { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.proj-card .name .pname-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.proj-card .dot { width: 12px; height: 12px; border-radius: 4px; }
.pc-top { display: flex; align-items: flex-start; gap: 12px; }
.proj-card .pct { margin-left: auto; font-size: 30px; font-weight: 800; line-height: 1; color: var(--pc-color, var(--blue)); font-variant-numeric: tabular-nums; flex: none; letter-spacing: -.5px; }
.proj-card .pct small { font-size: 14px; font-weight: 700; margin-left: 1px; }
.proj-card .desc { color: var(--muted); font-size: 13px; margin: 10px 0 12px; min-height: 18px; line-height: 1.55; }
.proj-card .desc .ph { opacity: .55; }
.proj-card .bar { height: 10px; border-radius: 999px; background: #EDF2F9; overflow: hidden; }
.proj-card .bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--pc-color, var(--blue)), color-mix(in srgb, var(--pc-color, var(--blue)) 60%, #fff)); transition: width .45s ease; }
.pc-stats { display: flex; align-items: center; gap: 8px; margin-top: 13px; flex-wrap: wrap; }
.pc-stats .stat { font-size: 12.5px; line-height: 1; padding: 5px 11px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pc-stats .stat.done { color: #1E7A4F; background: #EAF7F0; border-color: #CFEBDC; }
.pc-stats .stat.doing { color: var(--blue-deep); background: var(--blue-soft); border-color: #D3E2FC; }
.proj-card .nums { display: flex; justify-content: flex-end; margin-top: 13px; padding-top: 11px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); }
.proj-card .name input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; flex: none; }
.proj-card.batch { cursor: pointer; }
.proj-card.batch:hover { border-color: var(--blue); }
.proj-card.batch.sel { outline: 2px solid var(--blue); }
.batch-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 10px 14px; background: var(--blue-soft); border-radius: 10px; font-size: 13.5px; flex-wrap: wrap; }
.batch-bar .mini.danger:hover { border-color: var(--red); color: var(--red); }
.folder-row { display: flex; align-items: center; gap: 8px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.folder-row:last-child { border-bottom: none; }
.folder-row .f-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog menu button.danger { background: var(--red); border-color: var(--red); color: #fff; }
dialog menu button.danger:hover { background: #C93A3F; }

/* ---- BOM（物料清单） ---- */
.dlg-wide { width: min(96vw, 940px); }
.bom-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.bom-head h3 { margin: 0; }
.bom-status { font-size: 12px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; white-space: nowrap; }
.bom-tools { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; align-items: center; }
.bom-tools input, .bom-tools select { display: inline-block; width: auto; margin-top: 0; border: 1px solid var(--line); border-radius: 7px; padding: 5px 9px; font-size: 12.5px; background: var(--card); color: var(--ink); outline: none; }
.bom-tools select { max-width: 200px; }
.bom-tools input:focus, .bom-tools select:focus { border-color: var(--blue); }
.bom-tools .mini:disabled { opacity: .45; cursor: not-allowed; }
.bom-wrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.bom-cols, .bom-row { display: grid; grid-template-columns: minmax(0, 1fr) 58px 84px 84px 224px; gap: 6px; align-items: center; }
.bom-cols { font-size: 12px; color: var(--muted); padding: 7px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.bom-tree { max-height: 56vh; overflow: auto; }
.bom-row { padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 13px; background: var(--card); }
.bom-row:last-child { border-bottom: none; }
.bom-row:hover { background: #F5F8FE; }
.bom-row .bc-c { text-align: center; color: var(--muted); font-size: 12.5px; }
.bom-row .bc-strong { font-weight: 700; color: var(--ink); }
.bc-loss { display: block; font-size: 10.5px; color: var(--orange); }
.bc-name { display: flex; align-items: center; gap: 6px; min-width: 0; padding-left: calc(4px + var(--depth, 0) * 20px); }
.bc-tw { width: 14px; flex: none; cursor: pointer; color: var(--muted); text-align: center; font-size: 11px; user-select: none; }
.bc-tw.leaf { cursor: default; }
.bc-code { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; color: var(--blue-deep); background: var(--blue-soft); padding: 1px 6px; border-radius: 5px; flex: none; }
.bc-nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-spec { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-act { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.bc-ro { font-size: 11px; color: var(--muted); }
.bif-row { display: flex; gap: 10px; }
.bif-row label { flex: 1; }
.bom-diff-sel { display: flex; gap: 12px; margin-bottom: 10px; }
.bom-diff-sel label { flex: 1; }
.bom-diff-body { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.7; }
.bom-diff-body .sec { font-weight: 500; margin: 8px 0 3px; }
.bom-diff-body .add, .bom-diff-body .add.sec { color: var(--green); }
.bom-diff-body .del, .bom-diff-body .del.sec { color: var(--red); }
.bom-diff-body .chg, .bom-diff-body .chg.sec { color: #A8760B; }
.bom-empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 13px; }
@media (max-width: 760px) {
  .bom-wrap, .bom-tree { overflow-x: auto; }
  .bom-cols, .bom-row { min-width: 620px; }
}

/* ---- 日历 ---- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .wd { text-align: center; font-size: 12px; color: var(--muted); padding: 6px 0; }
.cal .cell { min-height: 74px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; cursor: pointer; }
.cal .cell:hover { border-color: var(--blue); }
.cal .cell.out { opacity: .35; }
.cal .cell.today { border-color: var(--blue); background: var(--blue-soft); }
.cal .cell.sel { outline: 2px solid var(--blue); }
.cal button.cell { text-align: left; color: var(--ink); display: flex; flex-direction: column; align-items: flex-start; }
.cal button.cell:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.cal .d { font-size: 13px; font-weight: 600; }
.cal .dots { display: flex; gap: 3px; margin-top: 6px; flex-wrap: nowrap; min-height: 7px; }
.cal .dot-i, .calendar-legend .dot-i { display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.cal .dot-i.late, .calendar-legend .dot-i.late { background: var(--red); }
.cal .dot-i.done, .calendar-legend .dot-i.done { background: var(--green); }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.overview-reminder-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; }
.overview-reminder-row strong { overflow-wrap: anywhere; }
.overview-reminder-row small { display: block; color: var(--muted); }
.overview-reminder-row button { flex-shrink: 0; }

/* ---- AI 助理 ---- */
.mode-chip { font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 12px; padding: 3px 10px; margin-left: auto; }
.mode-chip.llm { color: var(--green); background: #E8F5EE; }
.ai-wrap { display: flex; flex-direction: column; height: calc(100vh - 190px); min-height: 420px; padding: 0; overflow: hidden; }
.ai-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.msg .bubble { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.msg.bot .bubble { background: var(--bg); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.user .bubble { background: var(--blue); color: #fff; border-top-right-radius: 4px; }
.ai-actions { margin-top: 8px; padding: 7px 10px; background: #E8F5EE; color: var(--green); border-radius: 8px; font-size: 12.5px; }
.mode-tag { float: right; font-size: 10.5px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0 6px; margin: 6px 0 0 8px; }
.ai-chips { display: flex; gap: 6px; padding: 8px 12px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.ai-chips button { border: 1px solid var(--line); background: var(--card); border-radius: 18px; padding: 6px 12px; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.ai-chips button:hover { border-color: var(--blue); color: var(--blue); }
.ai-input { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.ai-input input { flex: 1; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 13px; font-size: 14px; outline: none; background: var(--bg); color: var(--ink); }
.ai-input input:focus { border-color: var(--blue); background: var(--card); }
.ai-input textarea { flex: 1; resize: none; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 13px; font-size: 14px; outline: none; background: var(--bg); color: var(--ink); font-family: inherit; line-height: 1.5; max-height: 140px; }
.ai-input textarea:focus { border-color: var(--blue); background: var(--card); }
/* V2.0 会话条 / 附件 / Markdown */
.ai-sessions { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; flex-wrap: wrap; }
.ai-sessions select { flex: 1; min-width: 200px; max-width: 340px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: 12.5px; background: var(--card); color: var(--ink); }
.ai-sessions .mini.danger:hover { border-color: var(--red); color: var(--red); }
.att { margin-bottom: 8px; }
.att img { max-width: 220px; max-height: 160px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.att.doc { font-size: 12.5px; color: var(--muted); background: var(--blue-soft); border-radius: 8px; padding: 6px 10px; display: inline-block; }
.att-chip { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink); margin: 8px 12px -2px; padding: 7px 11px; background: var(--blue-soft); border: 1px solid #D3E2FC; border-radius: 8px; box-shadow: 0 1px 3px rgba(31,80,166,.08); }
.att-chip .att-name { font-weight: 600; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-chip .att-size, .aiw-att .att-size { color: var(--muted); font-size: 11.5px; background: rgba(255,255,255,.7); border-radius: 9px; padding: 1px 7px; }
.att-chip button, .aiw-att button { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 13px; }
.att-chip button:hover, .aiw-att button:hover { color: var(--red); }
.md-table { border-collapse: collapse; margin: 6px 0; font-size: 13px; max-width: 100%; display: block; overflow-x: auto; }
.md-table th, .md-table td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; }
.md-table th { background: var(--blue-soft); font-weight: 600; }
.md-h { font-weight: 700; margin: 8px 0 2px; }
.md-gap { height: 6px; }
.bubble ul { margin: 2px 0 2px 18px; }
.bubble code { background: var(--blue-soft); border-radius: 4px; padding: 1px 5px; font-size: 12.5px; }
.dlg-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; line-height: 1.6; }
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.preset-row .mini { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.preset-row .mini:hover { border-color: var(--blue); color: var(--blue); }
.ok-text { color: #2FA36B; }
.err-text { color: #E5484D; }

/* ---- 弹层/浮提示 ---- */
/* 显式居中：全局 * { margin:0 } 会覆盖浏览器对 dialog 的 margin:auto 默认居中 */
dialog { position: fixed; inset: 0; margin: auto; height: fit-content; max-height: calc(100dvh - 24px); overflow: auto; border: none; border-radius: 16px; background: var(--card); padding: 20px; width: min(94vw, 440px); box-shadow: 0 10px 40px rgba(28,36,48,.18); }
dialog::backdrop { background: rgba(28,36,48,.35); }
dialog h3 { margin-bottom: 14px; font-size: 16px; }
dialog label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 11px; }
dialog input, dialog select, dialog textarea { display: block; width: 100%; margin-top: 4px; border: 1.5px solid var(--line); border-radius: 9px; padding: 9px 11px; font-size: 14px; background: var(--bg); color: var(--ink); font-family: inherit; outline: none; }
dialog input:focus, dialog textarea:focus { border-color: var(--blue); background: var(--card); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
dialog menu { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
dialog menu button { border: 1.5px solid var(--line); background: var(--card); border-radius: 9px; padding: 8px 18px; cursor: pointer; font-size: 14px; }
dialog menu button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 30px; background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 10px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); }
.fab { position: fixed; right: 22px; bottom: 26px; width: 52px; height: 52px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 24px; border: none; box-shadow: 0 6px 18px rgba(47,111,237,.4); cursor: pointer; z-index: 30; }

/* ---- AI 助理悬浮窗（右下角，可最小化） ---- */
#aiWidget { position: fixed; right: 20px; bottom: 20px; z-index: 55; }
#aiwFab { display: block; width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer; padding: 0; background: transparent; box-shadow: 0 6px 20px rgba(80,110,255,.38), 0 0 0 4px rgba(255,255,255,.55); transition: transform .18s ease, box-shadow .18s ease; }
#aiwFab:hover { transform: scale(1.08); box-shadow: 0 8px 26px rgba(80,110,255,.5), 0 0 0 4px rgba(255,255,255,.65); }
#aiwFab:active { transform: scale(.96); }
#aiwFab svg { width: 100%; height: 100%; display: block; border-radius: 50%; }
.aiw-panel { position: absolute; right: 0; bottom: 72px; width: min(92vw, 372px); height: min(62vh, 500px); background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(28,36,48,.22); display: flex; flex-direction: column; overflow: hidden; opacity: 0; transform: translateY(16px) scale(.95); transform-origin: bottom right; pointer-events: none; transition: opacity .22s ease, transform .22s ease; }
#aiWidget.open .aiw-panel { opacity: 1; transform: none; pointer-events: auto; }
.aiw-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #F6F9FF, #EFF2FF); cursor: grab; touch-action: none; user-select: none; }
.aiw-head:active { cursor: grabbing; }
.aiw-title { font-weight: 700; font-size: 15px; background: linear-gradient(90deg, #2F6FED, #8A6BFF); -webkit-background-clip: text; background-clip: text; color: transparent; }
#aiwMin, #aiwClear { border: 1px solid var(--line); background: var(--card); border-radius: 7px; width: 26px; height: 26px; cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1; display: grid; place-items: center; }
#aiwMin:hover, #aiwClear:hover { color: var(--blue); border-color: var(--blue); }
/* 全方位缩放感应条：四边 + 四角（贴面板内侧，悬停微高亮） */
.aiw-edge { position: absolute; z-index: 7; touch-action: none; }
.aiw-edge[data-dir="n"] { top: 0; left: 10px; right: 10px; height: 7px; cursor: ns-resize; }
.aiw-edge[data-dir="s"] { bottom: 0; left: 10px; right: 10px; height: 7px; cursor: ns-resize; }
.aiw-edge[data-dir="w"] { left: 0; top: 10px; bottom: 10px; width: 7px; cursor: ew-resize; }
.aiw-edge[data-dir="e"] { right: 0; top: 10px; bottom: 10px; width: 7px; cursor: ew-resize; }
.aiw-edge[data-dir="nw"] { top: 0; left: 0; width: 18px; height: 18px; cursor: nwse-resize; border-radius: 16px 0 0 0; }
.aiw-edge[data-dir="ne"] { top: 0; right: 0; width: 18px; height: 18px; cursor: nesw-resize; border-radius: 0 16px 0 0; }
.aiw-edge[data-dir="sw"] { bottom: 0; left: 0; width: 18px; height: 18px; cursor: nesw-resize; border-radius: 0 0 0 16px; }
.aiw-edge[data-dir="se"] { bottom: 0; right: 0; width: 18px; height: 18px; cursor: nwse-resize; border-radius: 0 0 16px 0; }
.aiw-edge:hover { background: rgba(47, 111, 237, .14); }
body.aiw-resizing { user-select: none !important; }
body.aiw-resizing * { user-select: none !important; }
.aiw-panel.dragover { outline: 2px dashed var(--blue); outline-offset: -6px; }
.aiw-panel.dragover::before { content: "松开即可上传给 AI 助理"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(234,241,254,.88); color: var(--blue-deep); font-size: 14px; font-weight: 600; z-index: 6; pointer-events: none; }
#aiwFab { touch-action: none; }
.folder-row .fr-input { flex: 1; min-width: 0; border: 1.5px solid var(--blue); border-radius: 7px; padding: 4px 8px; font-size: 13.5px; background: var(--card); color: var(--ink); outline: none; font-family: inherit; }
.swatch-row { display: flex; gap: 8px; margin-top: 6px; }
.swatch { width: 27px; height: 27px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; box-shadow: var(--shadow); }
/* ---- 任务操作历史 ---- */
details.hist { margin: 4px 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg, #FAFBFD); overflow: hidden; }
details.hist summary { cursor: pointer; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--ink); user-select: none; }
details.hist[open] summary { border-bottom: 1px solid var(--line); }
#tf-hist { max-height: 180px; overflow: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; }
.hist-item { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; line-height: 1.5; }
.h-tag { flex: none; font-size: 11px; padding: 1px 7px; border-radius: 20px; background: #E6F1FB; color: #185FA5; font-weight: 600; }
.h-tag.update { background: #FAEEDA; color: #854F0B; }
.h-time { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.h-chg { color: var(--ink); word-break: break-all; }
.swatch.active { border-color: var(--ink); transform: scale(1.1); }
.aiw-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.aiw-log .msg { display: flex; }
.aiw-log .msg.user { justify-content: flex-end; }
.aiw-log .bubble { max-width: 84%; padding: 8px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.aiw-log .msg.bot .bubble { background: var(--bg); border: 1px solid var(--line); border-top-left-radius: 4px; }
.aiw-log .msg.user .bubble { background: var(--blue); color: #fff; border-top-right-radius: 4px; }
.aiw-log .bubble ul { margin: 2px 0 2px 16px; }
.aiw-mode-tag { float: right; font-size: 10.5px; color: var(--muted); margin: 6px 0 0 8px; }
.aiw-chips { display: flex; gap: 6px; padding: 7px 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.aiw-chips button { border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: 5px 10px; font-size: 12px; color: var(--ink); cursor: pointer; }
.aiw-chips button:hover { border-color: var(--blue); color: var(--blue); }
.aiw-input { display: flex; gap: 8px; padding: 9px 10px 11px; border-top: 1px solid var(--line); align-items: flex-end; flex-wrap: wrap; }
.aiw-att { flex-basis: 100%; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink); background: var(--blue-soft); border: 1px solid #D3E2FC; border-radius: 8px; padding: 5px 10px; margin-bottom: 2px; box-shadow: 0 1px 3px rgba(31,80,166,.08); }
.aiw-att .att-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aiw-att button { margin-left: auto; border: none; background: transparent; cursor: pointer; color: var(--muted); font-size: 12px; }
.aiw-att button:hover { color: var(--red); }
textarea.dragover { border-color: var(--blue) !important; background: var(--blue-soft) !important; }
.aiw-input textarea { flex: 1; resize: none; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 11px; font-size: 13.5px; background: var(--bg); color: var(--ink); font-family: inherit; line-height: 1.5; max-height: 96px; outline: none; }
.aiw-input textarea:focus { border-color: var(--blue); background: var(--card); }
.aiw-input button { border: none; background: var(--blue); color: #fff; border-radius: 10px; padding: 8px 14px; font-size: 13.5px; cursor: pointer; }
.aiw-input button:hover { background: var(--blue-deep); }

/* ---- 版本与更新日志 ---- */
.cl-item { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.cl-item:last-child { border-bottom: none; padding-bottom: 2px; }
.cl-v { font-weight: 700; color: var(--blue-deep); font-size: 14px; margin-bottom: 4px; }
.cl-v small { color: var(--muted); font-weight: 400; margin-left: 8px; font-size: 11.5px; }
.cl-item ul { margin-left: 16px; }
.cl-item li { font-size: 13px; color: var(--muted); line-height: 1.75; }

/* ---- 移动端 ---- */
@media (max-width: 760px) {
  body { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 12px; border-right: none; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 8px 0 0; }
  #nav { flex-direction: row; overflow-x: auto; flex: 1; gap: 2px; }
  #nav button { padding: 7px 10px; white-space: nowrap; font-size: 13px; }
  .side-foot { display: none; }
  .wrap { padding: 12px 12px 80px; }
  .proj-card { padding: 16px 16px 12px; }
  .proj-card .name { font-size: 15.5px; }
  .proj-card .pct { font-size: 24px; }
  .proj-card .pct small { font-size: 12px; }
  .pc-stats .stat { font-size: 11.5px; padding: 4px 9px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .cols { grid-template-columns: 1fr; }
  .cal .cell { min-height: 56px; }
  #aiWidget { right: 12px; bottom: 12px; }
  #aiwFab { width: 52px; height: 52px; }
  .aiw-panel { width: calc(100vw - 24px); height: min(58vh, 460px); bottom: 66px; }
}
