/* @layer ui — 组件样式：卡片/横条、迷你日历、日历列表、弹窗、编辑器、命令面板、提示条、洞察。 */

/* ================================================================
   --on-fill：压在"日历色块"上的前景色
   ================================================================
   注意区分两种色块，它们的正确解法完全相反：

   a) 主题色块（--today / --danger / --success）——这些是 light-dark() 令牌，
      深色下会自己变浅，所以前景色必须跟着主题翻面。逐处写
      light-dark(hsl(var(--paper-h) 30% 99%), hsl(var(--paper-h) 35% 10%))。

   b) 日历色块（--chip-color / --cal-color）——这些是用户挑的日历色（见
      domain/palette.js），是**固定的 hex，浅深两套主题下是同一个值**。
      这里如果也用 light-dark() 翻面，等于把白字问题原样搬到深色：
      深字压在群青 #1e4fd8 上只有 2.76:1，比原来的 6.5:1 还差。
      正确的参照系是"这块颜色自己有多亮"，而不是"页面是浅是深"。

   所以 b) 用 OKLCH 的 L 分量做一次阈值判断：亮块（明黄 #e8a30c，
   L=0.763）配深字、暗块配浅字；两端各带 8% 的本色色度，落点是
   #f6fcff / #1e1a14 一类——既不是纯白也不是纯黑，白仍然"有倾向"，
   而且倾向来自这块颜色自己。深字的 L=0.22 正是 --text 的 OKLCH 明度。

   阈值是 **0.58**，这个数字不能拍脑袋，它是从 WCAG 反推的：
   白字与黑字对比度相等的翻转点在**相对亮度** Y ≈ 0.179
   （(1.05)/(Y+0.05) = (Y+0.05)/0.05 → Y = √0.0525 − 0.05）。
   但相对颜色语法里拿不到 Y，只能拿 OKLCH 的 L——L 是感知明度，
   同一个 L 在不同色相/彩度下的 Y 能差一倍（饱和黄 L=0.763 → Y=0.435；
   饱和蓝 L=0.623 → Y=0.233）。所以要挑一个最贴近 Y=0.179 那条线的 L。
   实测扫了 864 个色（24 色相 × 3 饱和 × 12 明度）：
     阈值 0.70 → 248 个不过 AA，其中 167 个是**选错了字**（最差 2.42:1）；
     阈值 0.58 → 85 个不过 AA，其中只有 4 个是选错，
                 另外 81 个两头都够不着 4.5——那是色本身的天花板，不是选法的错。
   0.56 / 0.60 都更差（选错的分别是 21 / 7 个），0.58 是最优点。

   为什么 0.70 是错的：它在"该配深字"的一段里仍然发浅字。活证据就在本仓库的
   data/calendar.json ——「个人」日历是 **#3b82f6**，并不在 palette.js 那十个色里
   （种子数据、Google 同步都会带进非调色板的颜色，所以只按十个色验收是不够的）：
   L=0.623 < 0.70 被判为浅字，实测只有 **3.55:1**，而深字是 4.69:1。
   十个调色板色在 0.58 与 0.70 下**选择完全相同**（除明黄外 L 都 < 0.58），
   所以调这个阈值对既有配色零改动，只把非调色板色救回来。

   乘数用 1e5 而不是 1e3：clamp 的斜坡越陡，"正好卡在阈值上"的色落进中灰的
   那条缝越窄（1e3 时缝宽约 0.0008 L，缝里的色最差只有 1.45:1）。
   老浏览器（不支持相对颜色语法）走 var() 的兜底值，即原来的近白。 */
@supports (color: oklch(from red l c h)) {
  .chip,
  .bar { --on-fill: oklch(from var(--chip-color) clamp(0.22, (0.58 - l) * 100000, 0.99) calc(c * 0.08) h); }
  .callist__box { --on-fill: oklch(from var(--cal-color) clamp(0.22, (0.58 - l) * 100000, 0.99) calc(c * 0.08) h); }
}

/* ---- 事件 chip / bar ----
   chip 是"点状事件"（有时间、在格子里排队），bar 是"跨天事件"（一条横过去的实体）。
   两者刻意做成不同的物质：chip 只有一枚色点 + 文字，bar 才是实心色块。
   如果都用实心，一个月视图会变成色卡。 */
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--chip-h);
  padding: 0 6px;
  border-radius: var(--radius-xs);
  font-size: var(--fs-small);
  line-height: 1;
  cursor: pointer;
  min-width: 0;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-press) var(--ease);
}
.chip:hover { background: color-mix(in srgb, var(--chip-color) 12%, transparent); }
.chip:active { transform: scale(0.98); }
.chip.is-selected { box-shadow: 0 0 0 1.5px var(--accent); }
/* 亮端在左上是对的，但混进去的必须是"光"而不是"面"：
   原来混的是 --surface，浅色下它近纯白、深色下它近黑，
   于是同一块色在深色主题里高光跑到了暗的一端，方向整个反过来。
   混纸的近白（不随主题变）才是一束固定方向的光。
   行程也从 10~12% 收到 6%：主题层给面定的规矩是"1% 明度行程的微渐变"，
   色块上 12% 的行程既超纲，又会把浅色墨在亮端的对比度拖到 3.7:1。 */
.chip.is-allday {
  background: linear-gradient(160deg, color-mix(in oklab, var(--chip-color) 94%, hsl(var(--paper-h) 30% 99%)) 0%, var(--chip-color) 100%);
  color: var(--on-fill, hsl(var(--paper-h) 30% 99%));
}
/* 全天 chip 的时间与重复标记也压在色块上，不能再用 --text-muted / --text-faint。
   ↻ 角标沿用 .bar__badge 既有的 0.78 减淡（它是装饰性符号，不是正文）。 */
.chip.is-allday .chip__time { color: inherit; }
.chip.is-allday .chip__badge { color: inherit; opacity: 0.78; }
/* 「办完了」在三个面必须是同一种表达。待办面早就定了：删除线 + 退一级墨
   （tasks.css 的 .task-card.is-done 是 --text-faint + line-through）。
   日历面这边原来是 opacity：chip 0.5、bar 0.55 —— 两个数不一样，而且都不合格。
   opacity 会把**文字和它自己的底一起**往页面色拉，比值随之塌掉，实测：
     .chip.is-done 0.5    → 3.30:1（浅色）
     全天 chip / bar 上的字压在自己的色块上，#3b82f6 满不透明时本来就只有 4.69:1，
     0.55/0.62/0.70/0.78 分别是 1.97 / 2.25 / 2.64 / 3.14 —— 只要减淡就不可能过。
   所以填充型的完成态**一点都不能淡**，信号全部交给删除线（bar 此前根本没有删除线，
   "办完了"只靠那 0.55 的淡，淡掉的同时也淡掉了这条信息本身）。
   非填充的 chip 走待办面那一套：--text-faint（6.13:1 / 6.09:1）+ 删除线。 */
.chip.is-done:not(.is-allday) { color: var(--text-faint); }
.chip.is-done .chip__title,
.bar.is-done .bar__title { text-decoration: line-through; text-decoration-thickness: 1px; }
.chip.is-dragging { box-shadow: var(--shadow-md); opacity: 0.9; }
.chip__dot { flex: none; width: 6px; height: 6px; border-radius: var(--mark-radius); background: var(--chip-color); }
.chip__time { flex: none; font-size: var(--fs-micro); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.chip__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip__badge { flex: none; font-size: var(--fs-micro); color: var(--text-faint); }
.chip.is-compact { font-size: var(--fs-tiny); gap: 5px; }

.bar {
  display: flex;
  align-items: center;
  gap: 5px;
  height: calc(var(--bar-h) - 2px);
  padding: 0 7px;
  border-radius: var(--radius-xs);
  background: linear-gradient(160deg, color-mix(in oklab, var(--chip-color) 94%, hsl(var(--paper-h) 30% 99%)) 0%, var(--chip-color) 100%);
  color: var(--on-fill, hsl(var(--paper-h) 30% 99%));
  font-size: var(--fs-tiny);
  font-weight: 550;
  line-height: 1;
  letter-spacing: var(--tracking-body);
  cursor: pointer;
  overflow: hidden;
  min-width: 0;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--chip-color) 30%, transparent);
  transition: filter var(--dur-fast) var(--ease), transform var(--dur-press) var(--ease);
}
.bar:hover { filter: brightness(1.06) saturate(1.05); }
.bar:active { transform: scale(0.99); }
.bar.is-selected { box-shadow: 0 0 0 1.5px var(--accent); }
.bar.is-continued-left { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bar.is-continued-right { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.bar__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.bar__badge { flex: none; opacity: 0.78; font-size: var(--fs-micro); }

/* ================================================================
   迷你月历
   它只有两个职责：告诉你"今天在哪"、让你跳到别处。
   所以只留三种状态：今天(实心)、光标(描边环)、有安排(一颗中性小点)。
   忙碌点刻意不用强调色——强调色留给"你正在看的那一天"。
   ================================================================ */
.minical { display: flex; flex-direction: column; gap: 6px; width: 100%; min-width: 0; }
.minical__head { display: flex; align-items: center; justify-content: space-between; gap: 2px; min-width: 0; }
.minical__title {
  flex: 1;
  min-width: 0;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: var(--tracking-title);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  transition: background var(--dur-fast) var(--ease);
}
.minical__title:hover { background: var(--surface-hover); }

.minical__weekdays, .minical__grid {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.minical__grid { row-gap: 2px; }
.minical__weekdays span {
  text-align: center;
  padding: 2px 0 4px;
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-caps);
  color: var(--text-faint);
}

.minical__day {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-tiny);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  border-radius: 50%;
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.minical__day:hover { background: var(--surface-hover); color: var(--text); }
/* 上/下月的日期是**能点的日期**，不是装饰：叠一层 opacity 0.55 之后
   实测只有 1.92:1（深色 2.14:1）—— 令牌再怎么修也救不回来，
   因为 opacity 是压在令牌之上的第二次减淡。层级交给色阶本身：
   本月是 --text-muted，外月是 --text-faint，一级之差，两者都过 AA。 */
.minical__day.is-outside { color: var(--text-faint); }

/* 光标：一圈环，不填色——这样"今天 + 光标"能同时看见 */
.minical__day.is-cursor {
  color: var(--text);
  font-weight: 620;
  box-shadow: inset 0 0 0 1px var(--accent-line);
  background: var(--accent-soft);
}
.minical__day.is-today {
  background: var(--today);
  /* --today 是 light-dark() 令牌，深色下变浅（#ff6f5e），近白前景压上去只有 2.7:1 */
  color: light-dark(hsl(var(--paper-h) 30% 99%), hsl(var(--paper-h) 35% 10%));
  font-weight: 620;
  box-shadow: 0 1px 4px color-mix(in srgb, var(--today) 42%, transparent);
}
.minical__day.is-today.is-cursor { box-shadow: 0 0 0 1px var(--accent-line), 0 1px 4px color-mix(in srgb, var(--today) 42%, transparent); }

.minical__day.has-events::after {
  content: '';
  position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 3px; height: 3px; border-radius: 50%;
  background: color-mix(in srgb, var(--text) 34%, transparent);
}
.minical__day.is-today.has-events::after { background: light-dark(hsl(var(--paper-h) 30% 99% / 0.85), hsl(var(--paper-h) 35% 10% / 0.85)); }
.minical__day.is-cursor.has-events::after { background: var(--accent); }

/* ================================================================
   日历列表
   包豪斯式的方形色块，不是圆点——几何形状本身承担识别功能。
   ================================================================ */
.callist { display: flex; flex-direction: column; }
.callist__item {
  display: flex; align-items: center; gap: 2px;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast) var(--ease);
}
.callist__item:hover { background: var(--surface-hover); }
.callist__toggle {
  flex: 1;
  display: flex; align-items: center; gap: 9px;
  padding: 6px 7px;
  min-width: 0;
  text-align: left;
}
.callist__box {
  flex: none;
  width: 13px; height: 13px;
  border-radius: var(--mark-radius);
  background: var(--cal-color);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 12%, transparent);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.callist__box::after {
  content: '';
  width: 6.5px; height: 3.5px;
  margin-top: -1.5px;
  border-left: 1.6px solid;
  border-bottom: 1.6px solid;
  /* 勾压在 --cal-color 上：跟色块自己的明度走，不跟主题走（见文件顶部 --on-fill） */
  border-color: var(--on-fill, hsl(var(--paper-h) 30% 99%));
  transform: rotate(-45deg);
  transition: opacity var(--dur-fast) var(--ease);
}
.callist__item.is-hidden .callist__box {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--cal-color) 55%, transparent);
}
.callist__item.is-hidden .callist__box::after { opacity: 0; }
.callist__item.is-hidden .callist__name { color: var(--text-faint); }
.callist__name {
  min-width: 0; flex: 1; display: flex; align-items: center; gap: 5px;
  font-size: var(--fs-body);
  letter-spacing: var(--tracking-body);
  white-space: nowrap;
}
.callist__name > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.callist__name > small {
  flex: none; color: var(--accent-ink); font-size: var(--fs-micro); font-weight: 600; letter-spacing: 0;
}
.callist__edit { opacity: 0; transition: opacity var(--dur-fast) var(--ease); }
.callist__item:hover .callist__edit,
.callist__edit:focus-visible { opacity: 1; }

/* ================================================================
   侧栏面板：接下来 / 本视图概览
   都不画框：一个数字大、其余小，靠字阶而不是边框建立层次。
   ================================================================ */
.insights { display: flex; flex-direction: column; gap: 10px; }
.insights__total {
  display: flex; align-items: baseline; gap: 6px;
  font-size: var(--fs-micro);
  color: var(--text-faint);
  letter-spacing: var(--tracking-micro);
}
.insights__total strong {
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: 600;
  line-height: 1;
  letter-spacing: var(--tracking-title);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.insights__bars { display: flex; flex-direction: column; gap: 6px; }
.insights__bar {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-micro);
}
.insights__name { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insights__track {
  height: 4px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  overflow: hidden;
}
.insights__fill { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--cal-color); }
.insights__value { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.insights__empty { color: var(--text-faint); font-size: var(--fs-small); }

/* 接下来：不用色块盒子，一枚方形色标 + 时间 + 标题，够了 */
.upnext { display: flex; flex-direction: column; }
/* 6px 与 .callist__toggle 同一个数：侧栏里两组紧挨着的列表行不该有两种行高节奏
   （实测 29.5 vs 32.3px）。横向本来就都是 7px。 */
.upnext__item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-width: 0;
  transition: background var(--dur-fast) var(--ease);
}
.upnext__item::before {
  content: '';
  flex: none;
  align-self: center;
  width: 6px; height: 6px;
  border-radius: var(--mark-radius);
  background: var(--chip-color);
}
.upnext__item:hover { background: var(--surface-hover); }
.upnext__time {
  flex: none;
  font-size: var(--fs-micro);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.upnext__title {
  font-size: var(--fs-small);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- 侧栏里的次要动作：默认中性，悬停才亮 ----
   "全部隐藏""添加日历"都是低频动作，一直染成强调色只会稀释强调色本身。 */
.side__header .link-btn,
.side__add-cal {
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-micro);
  color: var(--text-faint);
  transition: color var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.side__header .link-btn:hover,
.side__add-cal:hover { color: var(--accent-ink); opacity: 1; }

/* ---- 弹窗 ---- */
/* 84vh → 84dvh 再减 --kb，两处理由不同，都要：
   1. vh（== lvh）在 iOS 上是"地址栏收起时"的高度。Safari 标签页里地址栏在场时，
      84vh 已经超过看得见的部分，弹窗底部那一排「取消 / 保存 / 删除」直接掉出屏幕，
      而弹窗自己 overflow: hidden、外面的 .scrim 又不滚 —— 够不着就是够不着。
      dvh 跟着当前实际可见高度走，永远不会超发。
   2. 弹窗现在装在一个已经被键盘顶短了的 .scrim 里（见 layout.css 的 inset）。
      max-height 量的却还是整屏，于是在事件编辑器里点标题唤起键盘时，
      弹窗仍按 84% 的**屏幕**高展开，超出 .scrim 的部分被键盘吞掉。
   写两行：第一行是不认 dvh 的浏览器的兜底，行为与改动前完全一致。 */
.modal {
  position: relative;
  width: min(640px, 100%);
  max-height: min(84vh, 780px);
  max-height: min(calc(84dvh - var(--kb)), 780px);
  display: flex;
  flex-direction: column;
  background: var(--surface-grad);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in var(--dur) var(--ease-spring);
}
/* 顶部一条极细的渐变高光，模拟自上而下的光落在卡片边缘。
   深色分支必须走 light-dark()：主题为 auto 时根元素上没有 data-theme，
   挂在 [data-theme='dark'] 上的覆盖跟随系统进深色时不会命中，
   70% 的白就会原样留在弹窗顶边变成一道亮线。 */
.modal::before {
  content: '';
  position: absolute; top: 0; left: 12%; right: 12%; height: 1px;
  background: linear-gradient(90deg, transparent, light-dark(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.14)), transparent);
  pointer-events: none;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(-10px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal--sm { width: min(400px, 100%); }
.modal--palette { width: min(560px, 100%); }
.modal--quickadd { width: min(600px, 100%); }
.modal--event-detail { width: min(500px, 100%); }

.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px 13px;
  border-bottom: 1px solid var(--hairline);
}
.modal__head h2 {
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  font-weight: 620;
  letter-spacing: var(--tracking-title);
}
.modal__body { padding: 18px; overflow-y: auto; flex: 1; }
.modal__foot {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

/* ---- 日程详情 ---- */
.event-detail__head { justify-content: flex-start; gap: 10px; }
.event-detail__head h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-detail__mark { width: 10px; height: 10px; flex: none; border-radius: var(--mark-radius); background: var(--event-color); }
.event-detail { display: flex; flex-direction: column; gap: 16px; }
.event-detail__list { display: flex; flex-direction: column; gap: 0; margin: 0; }
/* 事实表（左标签右值、发丝线分行）在三个面各有一处：
   .chat-facts（对话）、这里（日历的详情卡）、.tasks-stats（待办的右栏）。
   9px 的上下内边距与 --hairline 三处本来就一致，只有**线的方向**不一致：
   另外两处是"每行上边一条 + 末行补下边一条"，这里是"每行下边一条 + 末行去掉"。
   渲染出来的差别看得见——另外两处的第一行**上面有线**，这里没有。
   归到多数派那一种。 */
.event-detail__row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--hairline);
}
.event-detail__row:last-of-type { border-bottom: 1px solid var(--hairline); }
.event-detail__row dt { color: var(--text-faint); font-size: var(--fs-micro); font-weight: 620; letter-spacing: var(--tracking-caps); }
.event-detail__row dd { min-width: 0; margin: 0; color: var(--text); font-size: var(--fs-body); line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }
.event-detail__calendar { display: inline-flex; align-items: center; gap: 7px; }
.event-detail__calendar > span { width: 9px; height: 9px; border-radius: var(--mark-radius); background: var(--event-color); }
.event-detail__tags { display: flex; flex-wrap: wrap; gap: 5px; }
.event-detail__tags span { padding: 1px 7px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-ink); font-size: var(--fs-tiny); }
.event-detail__status { margin-top: 6px; color: var(--success); font-size: var(--fs-tiny); font-weight: 600; }
.event-detail__confirm { padding: 12px; border: 1px solid color-mix(in srgb, var(--danger) 24%, var(--border)); border-radius: var(--radius); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.event-detail__confirm strong { color: var(--danger); font-size: var(--fs-small); }
.event-detail__confirm p { margin: 4px 0 10px; color: var(--text-muted); font-size: var(--fs-tiny); }

@media (max-width: 560px) {
  .event-detail__row { grid-template-columns: 1fr; gap: 3px; }
}

/* ---- 表单 / 编辑器 ---- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form__row { display: flex; flex-direction: column; gap: 6px; }
.form__row--inline { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
.form__grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form__spacer { flex: 1; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field__label {
  font-size: var(--fs-micro);
  font-weight: 620;
  color: var(--text-faint);
  letter-spacing: var(--tracking-caps);
}
.field__inputs { display: flex; gap: 6px; }

.calpick { display: flex; gap: 4px; flex-wrap: wrap; }
.calpick__item {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  font-size: var(--fs-tiny);
  color: var(--text-muted);
}
.calpick__item:hover { background: var(--surface-hover); }
.calpick__item.is-active { border-color: var(--cal-color); background: color-mix(in srgb, var(--cal-color) 13%, transparent); color: var(--text); font-weight: 500; }
.calpick__dot { width: 9px; height: 9px; border-radius: var(--mark-radius); background: var(--cal-color); }

.repeat { gap: 9px; padding: 11px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.repeat__line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.repeat__unit { font-size: var(--fs-small); color: var(--text-muted); }
.repeat__days { display: flex; gap: 4px; }
.repeat__day {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border-strong);
  font-size: var(--fs-tiny); color: var(--text-muted);
}
.repeat__day:hover { background: var(--surface-hover); }
.repeat__day.is-on {
  background: var(--accent-grad); border-color: transparent;
  color: var(--accent-text); font-weight: 620;
  box-shadow: var(--accent-glow);
}
.repeat__count { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-small); color: var(--text-muted); }
.repeat__summary { font-size: var(--fs-tiny); color: var(--text-faint); }

.scope { gap: 7px; }
.scope__opts { display: flex; gap: 6px; flex-wrap: wrap; }
.scope__opt {
  padding: 5px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); font-size: var(--fs-small); color: var(--text-muted);
}
.scope__opt:hover { background: var(--surface-hover); }
/* 字压在 --accent-soft 的选中底上，必须走 --accent-ink：--accent 是为"面"定的，
   当字压在自己的淡色底上实测浅色最差 3.98:1、深色 2.78:1（见 themes.css 的 --accent-ink）。 */
.scope__opt.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }

/* ---- 设置 ---- */
.settings { display: flex; flex-direction: column; gap: 3px; }
.settings__row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 0; }
.settings__row--block { flex-direction: column; align-items: stretch; gap: 8px; }
.settings__label { font-size: var(--fs-body); letter-spacing: var(--tracking-body); }
.settings__control { display: flex; align-items: center; justify-content: flex-end; }
.settings__control .input { width: auto; min-width: 130px; }
.settings-theme-seg { flex-wrap: wrap; justify-content: flex-end; max-width: 360px; }
.settings-theme-seg .seg__item { flex: 0 0 auto; }
.settings__sep { border: none; border-top: 1px solid var(--border); margin: 8px 0; }

.calmgr { display: flex; flex-direction: column; gap: 6px; }
.calmgr__item { display: flex; align-items: center; gap: 8px; }
.calmgr__dot { flex: none; width: 10px; height: 10px; border-radius: var(--mark-radius); background: var(--cal-color); }
.calmgr__source {
  flex: none; padding: 1px 5px; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent-ink); font-size: var(--fs-micro); font-weight: 600;
}
.calmgr__name { flex: 1; min-width: 80px; height: 28px; }
.calmgr__colors { display: flex; gap: 3px; flex-wrap: wrap; }
.calmgr__color { width: 15px; height: 15px; border-radius: 50%; background: var(--c); border: 2px solid transparent; }
.calmgr__color.is-active { border-color: var(--text); }
.calmgr__colors--big { margin-top: 10px; gap: 6px; }
.calmgr__colors--big .calmgr__color { width: 24px; height: 24px; }

/* ---- 命令面板 ---- */
.palette__search { display: flex; align-items: center; gap: 9px; padding: 13px 15px; border-bottom: 1px solid var(--border); }
.palette__icon { color: var(--text-faint); }
.palette__input { flex: 1; border: none; background: none; font-size: var(--fs-lead); outline: none; }
.palette__list { max-height: 400px; overflow-y: auto; padding: 6px; }
.palette__group {
  padding: 9px 10px 4px;
  font-size: var(--fs-micro);
  font-weight: 620;
  letter-spacing: var(--tracking-caps);
  color: var(--text-faint);
}
.palette__item { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.palette__item:hover { background: var(--surface-hover); }
.palette__item.is-active { background: var(--accent-soft); }
/* 命令面板里的日历色标与 .chip__dot / .callist__box 是同一个记号，此前是个圆点。 */
.palette__dot { width: 8px; height: 8px; border-radius: var(--mark-radius); background: var(--chip-color); flex: none; }
.palette__spacer { width: 8px; flex: none; }
.palette__title { flex: 1; font-size: var(--fs-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette__hint { font-size: var(--fs-tiny); color: var(--text-faint); font-variant-numeric: tabular-nums; }
/* 选中行的地被 --accent-soft 往强调色拉过一层，第三级墨压上去实测最低 4.13:1（深色）。
   命令面板的高亮行是键盘用户唯一的落点，那一行的快捷键必须读得出来——升一级到 muted
   （最差 6.19:1）。这是"退到后面去"与"必须读得出"打架时的通用解法：换级，不加透明度。 */
.palette__item.is-active .palette__hint { color: var(--text-muted); }
.palette__empty { padding: 22px; text-align: center; color: var(--text-faint); font-size: var(--fs-small); }

/* ---- 快速添加 ---- */
.quickadd__row { display: flex; align-items: center; gap: 9px; padding: 13px 15px; }
.quickadd__icon { color: var(--text-faint); }
.quickadd__input { flex: 1; border: none; background: none; font-size: var(--fs-lead); outline: none; }
.quickadd__examples { padding: 0 15px 14px; display: flex; flex-direction: column; gap: 5px; border-top: 1px solid var(--border); padding-top: 11px; }
.quickadd__examples .link-btn { text-align: left; color: var(--text-muted); }
.quickadd__examples .link-btn:hover { color: var(--accent-ink); }
.quickadd__preview { padding: 11px 15px 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 5px; background: var(--surface-2); }
.quickadd__title { font-size: var(--fs-body); }
.quickadd__detail { font-size: var(--fs-small); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.quickadd__chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.quickadd__chip { font-size: var(--fs-micro); padding: 1px 7px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-ink); }

/* ---- 快捷键表 ---- */
.shortcuts { display: flex; flex-direction: column; gap: 5px; }
.shortcuts__row { display: flex; align-items: center; gap: 11px; font-size: var(--fs-body); }
.shortcuts__row kbd { min-width: 58px; text-align: center; }

/* ---- 提示条 ---- */
.toast {
  display: flex; align-items: center; gap: 13px;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--text) 92%, transparent);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  color: var(--bg);
  font-size: var(--fs-body);
  box-shadow: var(--shadow-md);
  animation: toast-in var(--dur) var(--ease-spring);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }
.toast__text { min-width: 0; max-height: min(6em, 24dvh); overflow: auto; overflow-wrap: anywhere; line-height: 1.5; }
.toast--error { background: var(--danger-surface); border: 1px solid var(--danger-line); color: var(--danger-ink); box-shadow: var(--shadow-md), var(--shadow-inset); }
.toast__action { font-weight: 600; color: inherit; text-decoration: underline; opacity: 0.9; }
.toast__action:hover { opacity: 1; }

/* 内联 code 芯片：同步提示、AI 说明、引导提示里各写过一遍完全相同的声明。
   一处定义，三处共用；圆角走 --radius-xs 而不是自己发明的 4px。
   底色是 --surface-hover（明度梯里比纸暗一级），字沿用所在段落的墨——
   段落是 --text-faint 时它也是 faint，改了墨梯之后两者一起过 AA。 */
.sync__hint code,
.ai__note code,
.onb__hint code {
  font-family: var(--mono);
  font-size: var(--fs-micro);
  background: var(--surface-hover);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
}

/* ---- 同步状态面板 ---- */
.sync { display: flex; flex-direction: column; gap: 7px; }
.sync__row { display: flex; align-items: center; gap: 7px; font-size: var(--fs-small); }
.sync__dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--text-faint);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--text-faint) 22%, transparent);
}
.sync__dot.is-on {
  background: var(--success);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 25%, transparent);
}
.sync__label { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync__hint { font-size: var(--fs-tiny); color: var(--text-faint); line-height: 1.5; }
/* 这里原本还留着一条 .sync__hint code —— 与上面那条三处共用的内联 code 芯片
   逐字重复，是"合并了但没删干净"的残留。删掉，芯片只有一处定义。 */
.sync__btn { height: 28px; font-size: var(--fs-small); margin-top: 2px; }

/* ---- Google 账户日历：授权、选择、同步是三层状态，不再挤成一颗“连接”圆点 ---- */
.pia-calendar-card {
  display: grid; grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px; align-items: start;
  padding: 9px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.pia-calendar-card__mark {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--accent); color: var(--on-accent);
  font-family: var(--font-display); font-weight: 700;
}
.pia-calendar-card__copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pia-calendar-card__copy b { font-size: var(--fs-small); }
.pia-calendar-card__copy b em {
  margin-left: 5px; font-style: normal; color: var(--accent-ink); font-size: var(--fs-micro); font-weight: 600;
}
.pia-calendar-card__copy small { color: var(--text-muted); font-size: var(--fs-micro); }
.pia-calendar-card__copy p { color: var(--text-faint); font-size: var(--fs-micro); line-height: 1.4; }
.pia-calendar-card__actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; justify-self: start; }

.sync__account {
  width: 100%; min-width: 0;
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center; gap: 8px;
  padding: 7px;
  border-radius: var(--radius-sm);
  text-align: left;
  background: var(--surface-2);
  box-shadow: var(--shadow-inset), inset 0 0 0 1px var(--hairline);
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.sync__account:hover { background: var(--surface-hover); box-shadow: var(--shadow-inset), inset 0 0 0 1px var(--border); }
.sync__provider {
  width: 24px; height: 24px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-xs);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--accent-ink);
  font-family: var(--font-display); font-weight: 680;
}
.sync__account-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sync__account-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-small); }
.sync__account-copy small,
.sync-state { color: var(--text-faint); font-size: var(--fs-micro); font-weight: 500; }
.sync__chevron { color: var(--text-faint); font-size: var(--fs-lead); }
.sync-state.is-synced,
.gcal-row__copy small.is-synced { color: var(--success); }
.sync-state.is-syncing,
.sync-state.is-connecting,
.gcal-row__copy small.is-syncing,
.gcal-row__copy small.is-connecting { color: var(--accent-ink); }
.sync-state.is-ready,
.gcal-row__copy small.is-ready { color: var(--warning); }
.sync-state.is-error,
.sync-state.is-unconfigured,
.gcal-row__copy small.is-error,
.gcal-row__copy small.is-unconfigured { color: var(--danger); }
.sync__summary {
  display: flex; justify-content: space-between; gap: 8px;
  color: var(--text-faint); font-size: var(--fs-micro); line-height: 1.35;
}
.sync__summary span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync__summary span:last-child { flex: none; }
.sync__hint--error { color: var(--danger); }

.sync-sources {
  margin-top: 2px; padding-top: 7px;
  border-top: 1px solid var(--hairline);
  color: var(--text-muted); font-size: var(--fs-micro);
}
.sync-sources > summary { cursor: pointer; color: var(--text-muted); font-weight: 600; }
.sync-sources__list { display: flex; flex-direction: column; gap: 5px; margin-top: 7px; }
.sync-sources__list li { display: flex; align-items: center; justify-content: space-between; gap: 7px; min-width: 0; }
.sync-sources__list li > span { min-width: 0; display: flex; flex-direction: column; }
.sync-sources__list b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-micro); }
.sync-sources__list small { color: var(--text-faint); }
.sync-sources__list em { flex: none; font-style: normal; color: var(--text-faint); }
.sync-sources__list em.is-available { color: var(--success); }
.sync-sources > p { margin-top: 7px; color: var(--text-faint); line-height: 1.45; }

.gcal-list { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gcal-row { min-width: 0; border-radius: var(--radius-sm); }
.gcal-row__select {
  width: 100%; min-width: 0;
  display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 7px;
  padding: 7px;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.gcal-row__select:hover:not(:disabled) { background: var(--surface-hover); }
.gcal-row__select:disabled { opacity: 1; cursor: default; }
.gcal-row.is-selected .gcal-row__select { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.gcal-row__mark {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text-faint); font-size: var(--fs-micro);
  box-shadow: inset 0 0 0 1px var(--border);
}
.gcal-row.is-selected .gcal-row__mark { color: var(--accent-text); background: var(--accent); box-shadow: none; }
.gcal-row.is-readonly .gcal-row__mark { opacity: 0.62; }
.gcal-row__copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.gcal-row__copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-small); font-weight: 580; }
.gcal-row__copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-faint); font-size: var(--fs-micro); }
.gcal-list.is-compact .gcal-row__select { padding: 5px 6px; }
.gcal-list.is-compact .gcal-row__mark { width: 16px; height: 16px; }

.modal--google { width: min(680px, calc(100vw - 28px)); }
.gcal-modal { display: flex; flex-direction: column; gap: 14px; }
.gcal-modal__eyebrow {
  color: var(--accent-ink); font-size: var(--fs-micro); font-weight: 620;
  letter-spacing: var(--tracking-caps); text-transform: uppercase;
}
.gcal-modal__identity,
.gcal-modal__notice,
.gcal-modal__error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-small); line-height: 1.55;
}
.gcal-modal__identity { background: var(--accent-soft); color: var(--text-muted); }
.gcal-modal__notice { background: var(--surface-2); color: var(--text-muted); }
.gcal-modal__error { background: var(--danger-surface); border: 1px solid var(--danger-line); color: var(--danger-ink); }
.gcal-status-card {
  display: flex; align-items: center; gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-grad);
  box-shadow: var(--shadow-inset), inset 0 0 0 1px var(--border);
}
.gcal-status-card > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.gcal-status-card b { font-size: var(--fs-body); }
.gcal-status-card small { color: var(--text-faint); font-size: var(--fs-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcal-steps { display: flex; flex-direction: column; gap: 8px; }
.gcal-steps li { display: grid; grid-template-columns: 25px minmax(0, 1fr); gap: 9px; align-items: start; }
.gcal-steps li > span {
  width: 25px; height: 25px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--surface-2); color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px var(--border); font-size: var(--fs-small); font-weight: 620;
}
.gcal-steps p { display: flex; flex-direction: column; }
.gcal-steps small,
.gcal-modal__empty p { color: var(--text-muted); font-size: var(--fs-small); line-height: 1.5; }
.gcal-modal__empty { display: flex; flex-direction: column; gap: 5px; padding: 12px; background: var(--surface-2); border-radius: var(--radius); }
.gcal-modal__section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.gcal-modal__section-head h3 { font-size: var(--fs-body); }
.gcal-modal__section-head span { color: var(--text-faint); font-size: var(--fs-micro); }
.gcal-modal__calendars .gcal-list { max-height: min(36vh, 320px); overflow-y: auto; overscroll-behavior: contain; }
.gcal-modal__sync {
  display: flex; padding: 11px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hairline);
}
.gcal-modal__sync div { display: flex; flex-direction: column; }
.gcal-modal__sync small { color: var(--text-faint); font-size: var(--fs-small); }

/* ---- 快速添加里的 AI 结果 ---- */
.quickadd__ask {
  height: 30px; padding: 0 11px; font-size: var(--fs-small); white-space: nowrap;
  color: var(--text-faint);
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
/* AI 已接上：淡绿。没接上是灰的，鼠标悬停会说明原因。 */
.quickadd__ask.is-ready {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  background: color-mix(in srgb, var(--success) 8%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--success) 18%, transparent);
}
.quickadd__ask.is-ready:hover:not(:disabled) { background: color-mix(in srgb, var(--success) 15%, transparent); }
.quickadd__ask.is-busy { animation: spark-spin 0.9s linear infinite; }
@keyframes spark-spin { to { transform: rotate(360deg); } }

.qa__result {
  padding: 12px 15px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; flex-direction: column; gap: 8px;
}
.qa__result--error { color: var(--danger); font-size: var(--fs-small); }
.qa__result--busy { color: var(--text-muted); font-size: var(--fs-small); }
.qa__summary { font-size: var(--fs-small); font-weight: 500; margin: 0; }
.qa__answer { font-size: var(--fs-small); line-height: 1.6; margin: 0; white-space: pre-wrap; }
.qa__steps { margin: 0; padding-left: 16px; list-style: disc; font-size: var(--fs-tiny); color: var(--text-muted); line-height: 1.7; }
.qa__rejected { font-size: var(--fs-tiny); color: var(--text-faint); margin: 0; }
.qa__actions { display: flex; gap: 8px; justify-content: flex-end; }
.qa__actions .btn { height: 28px; font-size: var(--fs-small); }
.quickadd__preview--ai .quickadd__detail { color: var(--accent-ink); }

/* ---- 日期跳转 ---- */
.jumpdate__input-row { display: flex; align-items: center; gap: 9px; padding: 15px 18px 11px; }
.jumpdate__input-row > span { color: var(--accent-ink); font-size: var(--fs-lead); }
.jumpdate__input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--text); font-size: var(--fs-lead); }
.jumpdate__input::placeholder { color: var(--text-faint); }
.jumpdate__preview { min-height: 41px; display: flex; align-items: baseline; gap: 8px; padding: 0 18px 13px 46px; color: var(--text-faint); font-size: var(--fs-tiny); }
.jumpdate__preview strong { color: var(--text); font-size: var(--fs-small); font-weight: 600; }
.jumpdate__preview .is-error { color: var(--danger); }

/* ---- AI 配置面板 ---- */
.modal--ai { width: min(560px, 100%); }
.ai { display: flex; flex-direction: column; gap: 10px; }
.ai__intro {
  font-size: var(--fs-small); line-height: 1.8; color: var(--text-muted);
  padding: 11px 13px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border);
  margin-bottom: 14px;
}
.ai__intro b { color: var(--text); font-weight: 600; }
.ai__row { display: grid; grid-template-columns: 78px 1fr; align-items: center; gap: 10px; }
.ai__label { font-size: var(--fs-small); color: var(--text-muted); }
.ai__hint { font-size: var(--fs-tiny); color: var(--text-faint); padding-left: 88px; margin-top: -4px; }
.ai__loading { font-size: var(--fs-small); color: var(--text-muted); padding: 20px 0; text-align: center; }
.ai__actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.ai__actions .btn { height: 30px; font-size: var(--fs-small); }
.ai__status { font-size: var(--fs-tiny); color: var(--text-faint); display: flex; align-items: center; gap: 6px; }
.ai__status::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint);
}
.ai__status.is-unverified { color: var(--warning); }
.ai__status.is-unverified::before { background: var(--warning); box-shadow: 0 0 0 2px color-mix(in srgb, var(--warning) 25%, transparent); }
.ai__status.is-on { color: var(--success); }
.ai__status.is-on::before { background: var(--success); box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 25%, transparent); }
.ai__result { font-size: var(--fs-small); color: var(--success); margin: 0; }
.ai__result.is-error { color: var(--danger); }
.ai__note { font-size: var(--fs-tiny); color: var(--text-faint); line-height: 1.6; margin: 2px 0 0; }

.ai__probe {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 11px 13px; background: var(--surface-2);
  display: flex; flex-direction: column; gap: 7px;
}
.ai__probe.is-good { border-color: color-mix(in srgb, var(--success) 45%, transparent); background: color-mix(in srgb, var(--success) 7%, transparent); }
.ai__probe.is-ok { border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.ai__probe.is-weak { border-color: color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning) 8%, transparent); }
.ai__probe.is-bad { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 7%, transparent); }
.ai__probe-summary { font-size: var(--fs-small); font-weight: 560; margin: 0; }
.ai__probe-list { display: flex; flex-direction: column; gap: 3px; }
.ai__probe-item { display: flex; align-items: baseline; gap: 7px; font-size: var(--fs-tiny); color: var(--text-muted); }
.ai__probe-mark { color: var(--danger); font-weight: 700; width: 12px; }
.ai__probe-item.is-ok .ai__probe-mark { color: var(--success); }
.ai__probe-note { font-size: var(--fs-micro); color: var(--text-faint); }

.settings__note { font-size: var(--fs-tiny); color: var(--text-faint); line-height: 1.7; margin: 2px 0 0; }

/* PIA 说明不是营销页，而是一张可核验的能力清单：状态永远和说明挨在一起。 */
.modal--pia-info { width: min(720px, calc(100vw - 28px)); }
.pia-info__eyebrow { margin: 0 0 2px; color: var(--accent); font-size: var(--fs-micro); letter-spacing: .08em; text-transform: uppercase; }
.pia-info { display: grid; gap: 18px; }
.pia-info h3 { margin: 0; font-size: var(--fs-body); }
.pia-info__intro p, .pia-info__footnote { margin: 7px 0 0; color: var(--text-muted); font-size: var(--fs-small); line-height: 1.7; }
.pia-info__rule { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-sunken); font-size: var(--fs-small); }
.pia-info__rule span { color: var(--text-muted); }
.pia-info__section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.pia-info__section-head span { color: var(--text-faint); font-size: var(--fs-tiny); }
.pia-info__classes { display: grid; gap: 1px; list-style: none; margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--hairline); }
.pia-info__classes li { display: grid; grid-template-columns: 1fr max-content; gap: 14px; align-items: start; padding: 12px 14px; background: var(--surface); }
.pia-info__classes span { display: grid; gap: 3px; }
.pia-info__classes b { font-size: var(--fs-small); font-weight: 600; }
.pia-info__classes em { color: var(--text-muted); font-size: var(--fs-tiny); font-style: normal; line-height: 1.55; }
.pia-info__classes small { padding: 3px 7px; border-radius: var(--radius-pill); background: var(--surface-sunken); color: var(--text-faint); white-space: nowrap; }
.pia-info__classes .is-available small { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
@media (max-width: 540px) {
  .pia-info__rule { grid-template-columns: 1fr; gap: 3px; }
  .pia-info__rule span + b { margin-top: 8px; }
  .pia-info__classes li { grid-template-columns: 1fr; }
  .pia-info__classes small { justify-self: start; }
}
.settings__inline { display: flex; align-items: center; gap: 9px; }

/* ---- 首次引导向导 ---- */
/* 与 .modal 同一条理由（见该处），只是这一档给引导向导多留 2%。 */
.modal--onboarding { width: min(680px, 100%); max-height: min(88vh, 800px); }
.modal--onboarding { max-height: min(calc(88dvh - var(--kb)), 800px); }
.onb { padding: 0; }
.onb > * { padding: 28px 32px; }

.onb__hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 48px 42px 36px; }
.onb__eyebrow { margin: 0; color: var(--text-faint); font-size: var(--fs-micro); font-weight: 620; letter-spacing: .18em; }
.onb__title { font-size: var(--fs-title); font-weight: 620; margin: 0; }
.onb__title--brand { --preface-size: 21px; }
.onb__lead { max-width: 500px; font-size: var(--fs-small); color: var(--text-muted); line-height: 1.9; margin: 0; }
.onb__points { display: flex; flex-direction: column; gap: 0; margin-top: 12px; width: 100%; text-align: left; counter-reset: onb-point; }
.onb__points li {
  position: relative; font-size: var(--fs-small); color: var(--text-muted); line-height: 1.65;
  padding: 13px 6px; border-top: 1px solid var(--hairline);
}
.onb__points li:last-child { border-bottom: 1px solid var(--hairline); }
.onb__points--editorial li { padding-left: 38px; }
.onb__points--editorial li::before {
  counter-increment: onb-point; content: '0' counter(onb-point);
  position: absolute; left: 6px; top: 14px; color: var(--text-faint);
  font-family: var(--mono); font-size: var(--fs-micro); letter-spacing: .05em;
}
.onb__points b { color: var(--text); font-weight: 600; margin-right: 6px; }
.onb__points--done li { background: transparent; }
.onb__points kbd { margin: 0 2px; }

.onb__step { display: flex; flex-direction: column; gap: 14px; }
.onb__steptitle { font-size: var(--fs-lead); font-weight: 620; margin: 0; display: flex; align-items: center; gap: 8px; }
.onb__badge {
  font-size: var(--fs-micro); font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-text);
}
.onb__badge--soft { background: var(--surface-hover); color: var(--text-muted); }
.onb__desc { font-size: var(--fs-small); color: var(--text-muted); line-height: 1.8; margin: 0; }
.onb__desc b { color: var(--text); }

.onb__choices { display: flex; flex-direction: column; gap: 8px; }
.onb__entry-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.onb__entry {
  min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 11px 12px; text-align: left; border: 1.5px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer;
}
.onb__entry:hover { border-color: var(--border-strong); background: var(--surface-2); }
.onb__entry.is-active { border-color: var(--accent); background: var(--accent-soft); }
.onb__entry b { font-size: var(--fs-small); font-weight: 600; }
.onb__entry span { font-size: var(--fs-micro); line-height: 1.45; color: var(--text-muted); }
.onb__account-tabs { width: 100%; }
.onb__account-tabs .seg__item { flex: 1; }
.onb__code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.onb__account-card { align-items: flex-start; }
.onb__account-label { font-size: var(--fs-micro); color: var(--text-muted); }
.onb__account-id { font-family: var(--mono); font-size: var(--fs-small); overflow-wrap: anywhere; }
.onb__account-actions { display: flex; flex-wrap: wrap; gap: 7px; }
@media (max-width: 540px) {
  .onb__entry-actions { grid-template-columns: 1fr; }
}
.onb__choice {
  display: flex; flex-direction: column; gap: 5px; text-align: left;
  padding: 12px 14px; border-radius: var(--radius);
  border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.onb__choice:hover { border-color: var(--border-strong); background: var(--surface-2); }
.onb__choice.is-active { border-color: var(--accent); background: var(--accent-soft); }
.onb__choice-head { display: flex; align-items: center; gap: 8px; }
.onb__choice-title { font-size: var(--fs-body); font-weight: 600; }
.onb__choice-tag {
  font-size: var(--fs-micro); padding: 1px 7px; border-radius: var(--radius-pill);
  background: var(--surface-hover); color: var(--text-muted);
}
.onb__choice.is-active .onb__choice-tag { background: var(--surface); color: var(--accent-ink); }
.onb__choice-desc { font-size: var(--fs-tiny); color: var(--text-muted); line-height: 1.65; }

.onb__panel {
  padding: 14px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.onb__steps { display: flex; flex-direction: column; gap: 14px; counter-reset: step; }
.onb__substep { display: flex; gap: 11px; }
.onb__substep.is-locked { opacity: 0.45; pointer-events: none; }
.onb__substep-mark {
  flex: none; width: 21px; height: 21px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-micro); font-weight: 600;
  background: var(--surface-hover); color: var(--text-muted);
}
.onb__substep.is-done .onb__substep-mark { background: var(--success); color: light-dark(hsl(var(--paper-h) 30% 99%), hsl(var(--paper-h) 35% 10%)); }
.onb__substep-body { display: flex; flex-direction: column; gap: 7px; min-width: 0; flex: 1; }
.onb__substep-body strong { font-size: var(--fs-small); }
.onb__hint { font-size: var(--fs-tiny); color: var(--text-muted); line-height: 1.7; margin: 0; }
.onb__hint b { color: var(--text); }
.onb__fields { display: flex; flex-direction: column; gap: 6px; }
.onb__fields .input { height: 30px; font-size: var(--fs-small); }

.onb__callist { display: flex; flex-wrap: wrap; gap: 6px; }
.onb__cal {
  font-size: var(--fs-tiny); padding: 4px 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-muted); cursor: pointer;
}
.onb__cal:hover { background: var(--surface-hover); }
/* 同 .scope__opt.is-active：选中底是 --accent-soft，字只能用 --accent-ink。 */
.onb__cal.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }

.onb__url {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 11px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
}
.onb__url code { flex: 1; font-family: var(--mono); font-size: var(--fs-tiny); overflow-x: auto; white-space: nowrap; }
.onb__ok,
.onb__error { margin: 0; padding: 9px 11px; border-left: 2px solid currentColor; background: var(--surface); font-size: var(--fs-tiny); line-height: 1.6; }
.onb__ok { color: var(--success); }
.onb__ok.is-error,
.onb__error { color: var(--danger); }

.onb__details { font-size: var(--fs-tiny); }
.onb__details summary { cursor: pointer; color: var(--text-muted); padding: 4px 0; }
.onb__details summary:hover { color: var(--text); }
.onb__how { display: flex; flex-direction: column; gap: 6px; padding: 8px 0 0; }
.onb__how li { font-size: var(--fs-tiny); color: var(--text-muted); line-height: 1.6; }
.onb__how b { color: var(--text); }
.onb__connector-more { padding-top: 2px; }
.onb__connector-more[open] summary { color: var(--text); }
.onb__connector-more .onb__choices { margin-top: 10px; }

.onb__foot { display: flex; align-items: center; gap: 8px; padding-inline: 32px; }
.onb__progress { display: grid; grid-template-columns: auto auto; align-items: center; gap: 3px 10px; min-width: 150px; }
.onb__progress-count { grid-row: 1 / 3; color: var(--text); font-family: var(--mono); font-size: var(--fs-small); }
.onb__progress-label { color: var(--text-faint); font-size: var(--fs-micro); letter-spacing: .04em; }
.onb__dots { display: flex; gap: 5px; }
.onb__dot { width: 18px; height: 2px; border-radius: 1px; background: var(--border-strong); transition: background var(--dur-fast) var(--ease); }
.onb__dot.is-on { background: var(--accent); }

@media (max-width: 540px) {
  .onb > * { padding: 22px 20px; }
  .onb__hero { padding: 36px 20px 28px; }
  .onb__foot { padding-inline: 20px; }
  .onb__progress { min-width: 0; }
  .onb__progress-label { display: none; }
}

/* 智能服务商不是营销 Logo 墙，而是一张克制的“采购与配置索引”。名称在左，三个
   官方动作在右；继续沿用纸面、发丝线与文本链接，不创造新的彩色卡片角色。 */
.ai__guide,
.ai__temporary {
  display: flex; flex-direction: column; gap: 9px;
  padding: 13px 14px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2);
}
.ai__guide summary { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; }
.ai__guide summary::-webkit-details-marker { display: none; }
.ai__guide summary b { font-size: var(--fs-small); font-weight: 600; }
.ai__guide summary span { color: var(--text-faint); font-size: var(--fs-micro); }
.ai__guide[open] summary { padding-bottom: 9px; border-bottom: 1px solid var(--hairline); }
.ai__provider-links { display: flex; flex-direction: column; }
.ai__provider-link {
  display: grid; grid-template-columns: minmax(92px, .7fr) minmax(0, 1.8fr);
  gap: 12px; align-items: baseline; padding: 8px 0;
  border-top: 1px solid var(--hairline); font-size: var(--fs-tiny);
}
.ai__provider-link:first-child { border-top: 0; }
.ai__provider-link b { font-weight: 600; color: var(--text); }
.ai__provider-link span { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.ai__provider-link a { color: var(--accent-ink); text-decoration: none; }
.ai__provider-link a:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 540px) {
  .ai__provider-link { grid-template-columns: 1fr; gap: 5px; }
}

/* ================================================================
   侧栏「桌面」卡片
   这台电脑上除主窗口之外的两种形态：桌面浮窗、系统小组件。
   它是侧栏里唯一一张"有面"的卡——因为浮窗开关是最高频的操作。
   其余分区靠留白分组，不画框，才能让这一张被看见。
   图形全部用纯 CSS 几何画出（窗 = 描边方框 + 实心标题栏；
   小组件 = 一大两小的圆角瓦片），不用 emoji、不引图标库。
   ================================================================ */

.deskcard {
  display: flex;
  flex-direction: column;
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--surface-grad);
  box-shadow: var(--shadow-sm);
}

.deskcard__head {
  padding: 7px 9px 5px;
  font-size: var(--fs-micro);
  font-weight: 620;
  letter-spacing: var(--tracking-caps);
  color: var(--text-faint);
}

.deskrow {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  text-align: left;
  color: inherit;
  transition: background var(--dur-fast) var(--ease);
}
button.deskrow:hover { background: var(--surface-hover); }
button.deskrow:active { background: var(--surface-sunken); }

.deskrow__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.deskrow__title {
  font-size: var(--fs-small);
  font-weight: 550;
  letter-spacing: var(--tracking-body);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.deskrow.is-on .deskrow__sub { color: var(--text-muted); }
.deskrow__sub {
  font-size: var(--fs-micro);
  color: var(--text-faint);
  letter-spacing: var(--tracking-micro);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- 图标瓦片 ---- */
.deskrow__icon {
  position: relative;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  background: var(--sunken-grad);
  box-shadow: inset 0 0 0 1px var(--hairline);
  color: var(--text-faint);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
/* 开启时图标只染成"淡强调"，实心强调色留给开关一处——
   一行里出现两块饱和色就吵了。 */
.deskrow.is-on .deskrow__icon {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
  color: var(--accent-ink);
}

/* 浮窗 = 一扇带标题栏的小窗，左上角露出它"浮"在其上的那个面。
   下面这几处 2px / 3px 的圆角是**图标内部的几何**（一扇 9px 的小窗、一块 6px 的瓦片），
   不是界面圆角，所以不走 --radius-* 也不走 --mark-radius：
   它们和 currentColor 的 1.4px 描边是同一张图的笔画，改其中一个就要重画整张图。 */
.deskrow__icon--sticky::before {
  content: '';
  position: absolute;
  left: 5px; top: 5px;
  width: 9px; height: 9px;
  border-left: 1.4px solid currentColor;
  border-top: 1.4px solid currentColor;
  border-top-left-radius: 3px;
  opacity: 0.42;
}
.deskrow__icon--sticky::after {
  content: '';
  position: absolute;
  left: 9px; top: 9px; right: 5px; bottom: 5px;
  border: 1.4px solid currentColor;
  border-radius: 3px;
  box-shadow: inset 0 2.6px 0 currentColor;
}

/* 小组件 = 桌面上的一组瓦片：一块宽的 + 两块小的 */
.deskrow__icon--widget::before {
  content: '';
  position: absolute;
  left: 6px; top: 6px;
  width: 14px; height: 6px;
  border-radius: 2px;
  background: currentColor;
}
.deskrow__icon--widget::after {
  content: '';
  position: absolute;
  left: 6px; top: 14px;
  width: 6px; height: 6px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 8px 0 0 currentColor;
  opacity: 0.55;
}

/* ---- 开关：状态要一眼可辨，所以开时同时换轨道色、图标底色与旋钮位置 ---- */
.deskrow__switch {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: var(--sunken-grad);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.deskrow.is-on .deskrow__switch {
  background: var(--accent-grad);
  box-shadow: var(--accent-glow);
}
.deskrow__knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  /* 旋钮是"物件"，两种主题下都该是暖白；从纸的色相推出来，不写死 */
  background: hsl(var(--paper-h) 26% 98.5%);
  box-shadow: 0 1px 2px hsl(var(--paper-h) 20% 14% / 0.34);
  transition: transform var(--dur) var(--ease-spring);
}
.deskrow.is-on .deskrow__knob { transform: translateX(14px); }

/* ---- 层级分段：缩进到文字列，表示"属于上面那一行" ---- */
.deskcard__levels {
  display: flex;
  gap: 2px;
  margin: 2px 8px 6px 44px;
  padding: 2px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  box-shadow: inset 0 0 0 1px var(--hairline);
}
/* 26px = .seg--sm .seg__item 的高度。分段控件在本产品里只有两档
   （.seg__item 28、.seg--sm .seg__item 26），22 是第三个数，没有出处；
   而且 22 掉在 WCAG 2.5.8 的 24×24 之下。 */
.deskcard__level {
  flex: 1;
  height: 26px;
  border-radius: calc(var(--radius-sm) - 3px);
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-micro);
  /* 未选中的分段项在 .seg__item 与 .workspace-switch__item 上都是 --text-muted，
     只有这里是 --text-faint —— 同一个角色的第三种写法。归队。
     （顺带修掉一处 AA：faint 压在 --surface-sunken 的轨道上实测 3.46:1。） */
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.deskcard__level:hover { color: var(--text); }
.deskcard__level.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}

/* ---- 第二行是状态说明，不是按钮：一条内缩的发丝线把它和开关分开 ---- */
.deskrow--static { position: relative; margin-top: 3px; padding-top: 10px; }
.deskrow--static::before {
  content: '';
  position: absolute;
  left: 44px; right: 8px; top: 0;
  height: 1px;
  background: var(--hairline);
}
.deskrow--static .deskrow__icon { opacity: 0.72; }
.deskrow__hint {
  flex: none;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--hairline);
  font-size: var(--fs-micro);
  color: var(--text-faint);
  cursor: help;
}
