:root {
  --bg: #f4f7f1;
  --panel: #ffffff;
  --ink: #26352a;
  --ink2: #5d6f60;
  --ink3: #8fa092;
  --line: #e1e9dc;
  --green: #3f7d4e;
  --green2: #e6f1e1;
  --green3: #cfe3c6;
  --indoor: #4b7bb5;
  --indoor-bg: #eaf1fa;
  --outdoor: #c07a2c;
  --outdoor-bg: #fbf1e4;
  --red: #c4483e;
  --red-bg: #fbeceb;
  --amber: #b9851c;
  --amber-bg: #fbf4e0;
  --radius: 10px;
  --side: 212px;
  --shadow: 0 1px 2px rgba(30, 50, 30, .05), 0 4px 14px rgba(30, 50, 30, .05);
  --panel2: #fbfcfa;
  --panel-a: rgba(255, 255, 255, .6);
  --hover: #fafcf8;
  --soft: #f0f3ee;
  --today: #f0f7ec;
  --green-hover: #366c43;
  --green-ink: #2d5a37;
  --indoor-line: #d3e1f2;
  --outdoor-line: #f1dfc6;
  --red-line: #efcfcb;
  --amber-line: #f1e2b6;
  --amber-ink: #6f5413;
  --toast: #2f3d31;
  --scrim: rgba(20, 30, 20, .45);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
.boot { padding: 40vh 0 0; text-align: center; color: var(--ink2); }
[hidden] { display: none !important; }

/* ---------- 按钮与表单 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 14px;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s;
}
a.btn { text-decoration: none; }
.btn:hover { border-color: var(--green3); background: var(--hover); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-hover); }
.btn.danger { color: var(--red); border-color: var(--red-line); }
.btn.danger:hover { background: var(--red-bg); }
.btn.small { padding: 3px 10px; font-size: 13px; border-radius: 6px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--green2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; background: var(--panel); outline: none;
}
.input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green2); }
textarea.input { resize: vertical; min-height: 70px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--ink2); margin-bottom: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink2); }
.faint { color: var(--ink3); font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .06em; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { width: 18px; height: 18px; accent-color: var(--green); }

/* ---------- 登录页 ---------- */
.auth-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 28px 26px; border: 1px solid var(--line); }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.auth-logo img { width: 38px; height: 38px; }
.auth-logo h1 { font-size: 24px; }
.auth-sub { color: var(--ink2); margin: 0 0 18px; font-size: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--ink2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }
.code-row { display: flex; gap: 8px; }
.code-row .btn { flex: none; }

/* ---------- 整体布局 ---------- */
.layout { display: flex; min-height: 100%; }
.side {
  width: var(--side); flex: none; background: var(--panel2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; transition: width .2s;
}
.side-head { display: flex; align-items: center; gap: 9px; padding: 16px 16px 14px; }
.side-head img { width: 30px; height: 30px; flex: none; }
.side-head b { font-size: 18px; white-space: nowrap; }
.nav { flex: 1; padding: 4px 10px; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--ink);
  text-decoration: none; margin-bottom: 2px; white-space: nowrap;
}
.nav a:hover { background: var(--green2); }
.nav a.on { background: var(--green); color: #fff; }
.nav .ico { width: 22px; text-align: center; flex: none; font-size: 17px; }
.side-foot { padding: 10px; border-top: 1px solid var(--line); }
.side-user { display: flex; align-items: center; gap: 8px; padding: 6px 6px 8px; font-size: 13px; color: var(--ink2); overflow: hidden; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--green3); color: var(--green); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; font-size: 13px; }
.side.collapsed { width: 64px; }
.side.collapsed .lbl, .side.collapsed .side-head b, .side.collapsed .side-user span { display: none; }
.side.collapsed .nav a { justify-content: center; padding: 9px 0; }
.side.collapsed .side-foot .btn .lbl { display: none; }
.main { flex: 1; min-width: 0; }
.topbar { display: none; }
.page { max-width: 1080px; margin: 0 auto; padding: 24px 24px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; }
.page-head .sub { color: var(--ink2); font-size: 14px; margin-top: 2px; }
.crumb { font-size: 13px; color: var(--ink2); margin-bottom: 4px; }
.crumb a { text-decoration: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.card h3 { font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h3 .right { margin-left: auto; font-weight: 400; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; align-items: center; }
.kv dt { color: var(--ink2); font-size: 14px; }
.kv dd { margin: 0; }
.empty { text-align: center; color: var(--ink3); padding: 28px 10px; }
.notice { background: var(--amber-bg); color: var(--amber-ink); border: 1px solid var(--amber-line); border-radius: 8px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }
.notice.green { background: var(--green2); color: var(--green-ink); border-color: var(--green3); }

.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--green2); color: var(--green); white-space: nowrap; }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.gray { background: var(--soft); color: var(--ink2); }
.badge.blue { background: var(--indoor-bg); color: var(--indoor); }

/* ---------- 使用说明 ---------- */
.help { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: var(--panel2); }
.help summary { cursor: pointer; padding: 10px 14px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 6px; }
.help summary::-webkit-details-marker { display: none; }
.help summary::after { content: '▸'; margin-left: auto; color: var(--ink3); transition: transform .15s; }
.help[open] summary::after { transform: rotate(90deg); }
.help[open] summary { border-bottom: 1px solid var(--line); }
.help-body { padding: 10px 16px 12px; font-size: 14.5px; line-height: 1.8; }
.help-body ul, .help-body ol { margin: 0; padding-left: 20px; }
.help-body li { margin: 3px 0; }
.help-body i { color: var(--green); font-style: normal; background: var(--green2); padding: 0 4px; border-radius: 4px; }

/* ---------- 签到群卡片 ---------- */
.gcard { cursor: pointer; transition: transform .15s, border-color .15s; display: block; text-decoration: none; color: inherit; }
.gcard:hover { border-color: var(--green3); transform: translateY(-1px); }
.gcard h4 { font-size: 17px; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.gcard .desc { color: var(--ink2); font-size: 13px; min-height: 20px; margin-bottom: 10px; }
.gcard .meta { font-size: 13px; color: var(--ink2); display: grid; gap: 3px; }

/* ---------- 今日签到 ---------- */
.today-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.today-date { font-size: 18px; font-weight: 600; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sidebox { border-radius: var(--radius); padding: 12px; border: 1px solid; }
.sidebox.indoor { background: var(--indoor-bg); border-color: var(--indoor-line); }
.sidebox.outdoor { background: var(--outdoor-bg); border-color: var(--outdoor-line); }
.sidebox-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 600; }
.sidebox.indoor .sidebox-head { color: var(--indoor); }
.sidebox.outdoor .sidebox-head { color: var(--outdoor); }
.sidebox-head .cnt { margin-left: auto; font-weight: 400; font-size: 13px; color: var(--ink2); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.tile {
  position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--panel); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .fname { padding: 6px; font-size: 11px; text-align: center; word-break: break-all; color: var(--ink2); line-height: 1.3; }
.tile .fname .fi { display: block; font-size: 26px; margin-bottom: 2px; }
.tile .del { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 12px; line-height: 22px; padding: 0; }
.tile.add { border: 2px dashed var(--ink3); background: var(--panel-a); color: var(--ink2); flex-direction: column; font-size: 13px; }
.tile.add b { font-size: 26px; font-weight: 300; line-height: 1; }
.tile.add:hover { border-color: var(--green); color: var(--green); }
.tile.up { flex-direction: column; font-size: 12px; color: var(--ink2); }
.tile.up .bar { width: 70%; height: 5px; border-radius: 3px; background: var(--soft); overflow: hidden; margin-top: 6px; }
.tile.up .bar i { display: block; height: 100%; background: var(--green); width: 0; transition: width .2s; }
.sidebox .empty { padding: 18px 6px; font-size: 13px; }

/* ---------- 签到表 ---------- */
.sched { width: 100%; border-collapse: collapse; font-size: 14px; }
.sched th { text-align: left; font-weight: 500; color: var(--ink2); font-size: 13px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.sched td { padding: 7px 8px; border-bottom: 1px solid var(--soft); }
.sched tr.today td { background: var(--today); font-weight: 600; }
.sched tr.mine td:first-child { box-shadow: inset 3px 0 0 var(--green); }
.sched tr.past td { color: var(--ink2); }
.sched tr.cyc-start td { border-top: 2px solid var(--green3); }
.sched-wrap { max-height: 520px; overflow: auto; }
.order-list { list-style: none; margin: 0 0 12px; padding: 0; }
.order-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: var(--panel); }
.order-list li.off { opacity: .5; }
.order-list .no { width: 22px; height: 22px; border-radius: 50%; background: var(--green2); color: var(--green); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.changes { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.changes li { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.changes li:last-child { border-bottom: 0; }
.invite { display: inline-flex; align-items: center; gap: 8px; background: var(--green2); border-radius: 8px; padding: 4px 6px 4px 12px; }
.invite .mono { font-size: 17px; font-weight: 700; color: var(--green); }

/* ---------- 日志 ---------- */
.loglist { list-style: none; padding: 0; margin: 0; }
.logitem { display: flex; gap: 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--soft); cursor: pointer; }
.logitem:hover { background: var(--hover); }
.logdate { width: 92px; flex: none; }
.logdate b { display: block; font-size: 15px; }
.logdate span { font-size: 12px; color: var(--ink3); }
.logthumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.logthumbs img { width: 42px; height: 42px; object-fit: cover; border-radius: 5px; border: 2px solid transparent; }
.logthumbs img.indoor { border-color: var(--indoor-line); }
.logthumbs img.outdoor { border-color: var(--outdoor-line); }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 18px; min-width: 110px; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 13px; color: var(--ink2); }

/* ---------- 试验情况 ---------- */
.exp { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.datelist { list-style: none; margin: 0; padding: 0; max-height: 70vh; overflow: auto; }
.datelist a { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 14px; }
.datelist a:hover { background: var(--green2); }
.datelist a.on { background: var(--green); color: #fff; }
.datelist a.on .badge { background: rgba(255,255,255,.25); color: #fff; }
.strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.strip img { height: 76px; border-radius: 6px; cursor: pointer; flex: none; }
.md { line-height: 1.75; }
.md h1, .md h2, .md h3, .md h4 { margin: 18px 0 8px; font-size: 16px; color: var(--green); }
.md h3:first-child, .md h2:first-child { margin-top: 0; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.md pre { background: var(--soft); padding: 10px 12px; border-radius: 8px; overflow-x: auto; font-size: 13px; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; margin: 0 0 10px; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 4px 9px; }
.md blockquote { margin: 0 0 10px; padding: 4px 12px; border-left: 3px solid var(--green3); color: var(--ink2); }

/* ---------- AI 助手 ---------- */
.ai { display: grid; grid-template-columns: 220px 1fr; gap: 0; height: calc(100vh - 0px); }
.ai-list { border-right: 1px solid var(--line); background: var(--panel2); display: flex; flex-direction: column; min-height: 0; }
.ai-list .head { padding: 14px 12px 10px; }
.ai-list ul { list-style: none; margin: 0; padding: 0 8px 12px; overflow-y: auto; flex: 1; }
.ai-list li a { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 14px; }
.ai-list li a span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-list li a:hover { background: var(--green2); }
.ai-list li a.on { background: var(--green2); font-weight: 600; }
.ai-list li a .x { visibility: hidden; border: 0; background: none; color: var(--ink3); cursor: pointer; padding: 0 2px; }
.ai-list li a:hover .x { visibility: visible; }
.ai-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ai-top { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.ai-top select { width: auto; min-width: 200px; }
.ai-top b.grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai.nolist { grid-template-columns: 1fr; }
.ai.nolist .ai-list { display: none; }
.ai-set { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 18px 10px; border-bottom: 1px solid var(--line); background: var(--panel2); }
.ai-set label { display: flex; align-items: center; gap: 8px; }
.ai-set select { width: auto; min-width: 210px; padding: 5px 9px; }
#setBtn .lbl { font-size: 12.5px; }
@media (max-width: 820px) {
  .ai-top { gap: 4px; padding: 6px 8px; flex-wrap: nowrap; }
  .ai-top .lbl { display: none; }
  .ai.nolist .ai-list.show { display: flex; }
  .ai-set { padding: 8px 10px; gap: 8px; }
  .ai-set label { flex: 1 1 100%; }
  .ai-set select { flex: 1; min-width: 0; }
}
.ai-msgs { flex: 1; overflow-y: auto; padding: 20px 18px; }
.msg { display: flex; gap: 10px; margin-bottom: 18px; max-width: 860px; margin-left: auto; margin-right: auto; }
.msg .who { width: 30px; height: 30px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.msg.assistant .who { background: var(--green2); }
.msg.user { flex-direction: row-reverse; }
.msg.user .who { background: var(--green); color: #fff; font-size: 13px; font-weight: 700; }
.bubble { padding: 10px 14px; border-radius: 12px; max-width: calc(100% - 50px); overflow-wrap: anywhere; }
.msg.assistant .bubble { background: var(--panel); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.user .bubble { background: var(--green); color: #fff; border-top-right-radius: 4px; white-space: pre-wrap; }
.msg.user .bubble img { max-width: 160px; max-height: 160px; border-radius: 6px; display: block; margin-top: 6px; }
.acts { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.act { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--green2); color: var(--green); }
.act.w { background: var(--amber-bg); color: var(--amber); }
.act.err { background: var(--red-bg); color: var(--red); }
.files { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-top: 10px; }
.filecard { min-width: 0; max-width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); text-decoration: none; color: var(--ink); }
.filecard:hover { border-color: var(--green); background: var(--green2); }
.filecard .fi { font-size: 24px; }
.filecard .grow { display: flex; flex-direction: column; min-width: 0; }
.filecard .grow b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.filecard .dl { color: var(--green); font-size: 18px; }
.filecard.deleted { opacity: .55; cursor: default; }
.filecard.deleted:hover { border-color: var(--line); background: var(--panel2); }
.flist { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.flist li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.flist li .fi { font-size: 22px; }
.flist li .grow { display: flex; flex-direction: column; min-width: 0; }
.flist li .grow b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.flist .fchk { width: 17px; height: 17px; accent-color: var(--green); flex: none; }
@media (max-width: 820px) { .flist li { flex-wrap: wrap; } .flist li .grow { flex-basis: calc(100% - 70px); } }
.thinking { color: var(--ink2); }
.thinking i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin: 0 2px; animation: blink 1.2s infinite; }
.thinking i:nth-child(2) { animation-delay: .2s; }
.thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.ai-input { border-top: 1px solid var(--line); padding: 12px 18px 16px; background: var(--panel); }
.ai-input .box { max-width: 860px; margin: 0 auto; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--panel); }
.ai-input .box:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px var(--green2); }
.ai-input textarea { border: 0; outline: none; width: 100%; resize: none; min-height: 44px; max-height: 200px; background: transparent; }
.ai-input .tools { display: flex; align-items: center; gap: 6px; }
.ai-input .att { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.ai-input .att span { position: relative; }
.ai-input .att img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; }
.ai-input .att button { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); font-size: 10px; cursor: pointer; padding: 0; }
.att-file { display: inline-flex !important; align-items: center; gap: 8px; max-width: 260px; padding: 6px 26px 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); color: var(--ink); }
.att-file .fi { font-size: 20px; }
.att-file .grow { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.att-file b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file .faint { font-size: 11.5px; }
.ai-input .att .att-file button { top: 50%; right: 5px; transform: translateY(-50%); }
.msg.user .bubble .att { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.ai-input .box.drop { border-color: var(--green); background: var(--green2); }
.ai-list .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 6px; vertical-align: middle; animation: blink 1.2s infinite; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 16px; padding: 5px 13px; cursor: pointer; font-size: 13.5px; }
.chip:hover { border-color: var(--green); color: var(--green); }
.ai-welcome { text-align: center; padding: 8vh 10px 0; color: var(--ink2); }
.ai-welcome .big { font-size: 40px; }
.ai-welcome h3 { color: var(--ink); font-size: 20px; margin: 6px 0; }

/* ---------- 弹窗、提示 ---------- */
.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); background: var(--toast); color: #fff; padding: 9px 18px; border-radius: 8px; z-index: 1000; box-shadow: var(--shadow); max-width: 90vw; font-size: 14px; }
.toast.err { background: var(--red); }
.modal { position: fixed; inset: 0; background: var(--scrim); z-index: 900; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal-box { background: var(--panel); border-radius: 14px; width: 100%; max-width: 760px; position: relative; padding: 22px 22px 18px; }
.modal-box.narrow { max-width: 420px; }
.modal-x { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--ink2); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 1100; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 94vw; max-height: 86vh; object-fit: contain; }
.lb-cap { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #ddd; font-size: 13px; }
.lightbox button { position: absolute; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 26px; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; }
.lb-prev { left: 14px; top: 50%; } .lb-next { right: 14px; top: 50%; } .lb-x { right: 14px; top: 14px; font-size: 18px !important; }

/* ---------- 手机 ---------- */
@media (max-width: 820px) {
  .side { position: fixed; z-index: 800; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; width: 230px !important; box-shadow: 4px 0 20px rgba(0,0,0,.1); }
  .side.open { transform: none; }
  .side.collapsed .lbl, .side.collapsed .side-head b, .side.collapsed .side-user span { display: initial; }
  .side.collapsed .nav a { justify-content: flex-start; padding: 9px 12px; }
  .side-collapse { display: none !important; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 790; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
  .topbar b { font-size: 16px; }
  .page { padding: 16px 14px 50px; }
  .grid2, .sides, .exp { grid-template-columns: 1fr; }
  .ai { grid-template-columns: 1fr; height: calc(100vh - 53px); }
  .ai-list { display: none; }
  .ai-list.show { display: flex; position: fixed; inset: 53px 0 0 0; z-index: 60; }
  .card { padding: 14px 14px; }
  .kv { grid-template-columns: 76px 1fr; }
  .logdate { width: 74px; }
  .ai-msgs { padding: 14px 10px; }
  .ai-input { padding: 10px; }
}
@media (min-width: 821px) { .ai-only-mobile { display: none !important; } }

/* ---------- 深色模式：跟随系统，或在个人中心手动选择 ---------- */
:root[data-theme="dark"] {
  --bg: #141a16;
  --panel: #1d2520;
  --panel2: #18201b;
  --panel-a: rgba(255, 255, 255, .04);
  --hover: #232d26;
  --soft: #26302a;
  --today: #213326;
  --ink: #e3ebe4;
  --ink2: #a9b8ac;
  --ink3: #7b8b7e;
  --line: #2e3a32;
  --green: #5fae72;
  --green-hover: #6fbe82;
  --green2: #22362a;
  --green3: #335a3f;
  --green-ink: #a9dbb4;
  --indoor: #86b0e6;
  --indoor-bg: #1b2633;
  --indoor-line: #2c3f55;
  --outdoor: #e0a564;
  --outdoor-bg: #2e2418;
  --outdoor-line: #4d3a22;
  --red: #ef7f74;
  --red-bg: #3a2220;
  --red-line: #5a302c;
  --amber: #e3b75a;
  --amber-bg: #33291a;
  --amber-line: #574522;
  --amber-ink: #ecd193;
  --toast: #3a4a3e;
  --scrim: rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141a16;
    --panel: #1d2520;
    --panel2: #18201b;
    --panel-a: rgba(255, 255, 255, .04);
    --hover: #232d26;
    --soft: #26302a;
    --today: #213326;
    --ink: #e3ebe4;
    --ink2: #a9b8ac;
    --ink3: #7b8b7e;
    --line: #2e3a32;
    --green: #5fae72;
    --green-hover: #6fbe82;
    --green2: #22362a;
    --green3: #335a3f;
    --green-ink: #a9dbb4;
    --indoor: #86b0e6;
    --indoor-bg: #1b2633;
    --indoor-line: #2c3f55;
    --outdoor: #e0a564;
    --outdoor-bg: #2e2418;
    --outdoor-line: #4d3a22;
    --red: #ef7f74;
    --red-bg: #3a2220;
    --red-line: #5a302c;
    --amber: #e3b75a;
    --amber-bg: #33291a;
    --amber-line: #574522;
    --amber-ink: #ecd193;
    --toast: #3a4a3e;
    --scrim: rgba(0, 0, 0, .6);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
/* 深色下，主色按钮和选中菜单的文字用深色更清楚 */
:root[data-theme="dark"] .btn.primary, :root[data-theme="dark"] .nav a.on, :root[data-theme="dark"] .msg.user .bubble,
:root[data-theme="dark"] .msg.user .who, :root[data-theme="dark"] .datelist a.on { color: #0f1a12; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary, :root:not([data-theme="light"]) .nav a.on, :root:not([data-theme="light"]) .msg.user .bubble,
  :root:not([data-theme="light"]) .msg.user .who, :root:not([data-theme="light"]) .datelist a.on { color: #0f1a12; }
}
