/* 服务端网页：设计 token + 组件补充（保持语义化 HTML，不引入构建链）
 *
 * 视觉参照 agentctxsync：单一蓝灰 accent + 中性灰、白卡 + 极淡阴影、大圆角卡片 / 小圆角控件、
 * pill 状态、柔和表格行、四级排版。**同一套配色贯穿公开页与控制台**（品牌色只在 `:root` 定义一次，
 * `.landing` 与控制台引用同一批变量）。这些**全部是设计 token**，与是否用 Tailwind 无关，
 * 因此在这里用手写 CSS 实现 —— CSP 仍是 `style-src 'self'`（禁内联样式）。
 *
 * 关键一件事：Pico 在 ≥1280px 把 `--pico-font-size` 提到 125%（基准字号 20px），
 * 输入框会长到 63px、正文 20px —— 那是"页面显旧"的最大来源。第一件事就是把它钉回 100%。
 *
 * 选择器必须写成 `:root:not([data-theme="dark"])`：Pico 的浅色调色板就在这个选择器下（0,2,0），
 * 单写 `:root`（0,1,0）会被它压掉 —— 表现是"改了 CSS 却像没生效"，很难查。
 */
:root,
:root:not([data-theme="dark"]) {
  /* 字体与排版 */
  --pico-font-size: 100%;              /* 关掉 Pico 的响应式放大（≥1280px 会到 125%） */
  --pico-line-height: 1.55;
  --pico-font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --pico-text-selection-color: rgba(91, 125, 155, .18);

  /* 品牌：单一 accent（蓝灰 #5b7d9b），其余一律中性。
     这一批数值与控制台、落地页/公开表单页（`.landing`）**共用同一份定义** ——
     登录后的系统与首页必须是同一个产品的观感，所以品牌色只在这里定义一次，
     `.landing` 里引用同一批变量，两边不会再各自漂移。 */
  --brand: #5b7d9b;
  --brand-dark: #4a6888;    /* hover / 深一档 */
  --brand-deep: #33506b;    /* 选中态文字（同族最深） */
  --brand-tint: #e6eef5;    /* 淡底：选中行 / 品牌方块 */
  --pico-primary: var(--brand-dark);
  --pico-primary-background: var(--brand);
  --pico-primary-hover-background: var(--brand-dark);
  --pico-primary-hover: var(--brand-dark);
  --pico-primary-focus: rgba(91, 125, 155, .25);
  --pico-primary-inverse: #fff;
  --pico-primary-underline: rgba(91, 125, 155, .45);
  --pico-secondary: #64717f;
  --pico-secondary-background: #fff;
  --pico-secondary-hover-background: #f4f7f9;
  --pico-secondary-inverse: #1f2328;

  /* 面：页面底色比卡片低一档，卡片白 + 发丝边 + 极淡阴影。
     数值与落地页完全一致（页面 #f5f7f9、发丝边 #e3e9ef、卡片阴影同一条）。 */
  --pico-background-color: #f5f7f9;
  --pico-color: #2b3440;
  /* 墨色（正文/控件文字）：与 `--pico-color` 同值，但**不会被 Pico 改写**。
     Pico 会把变量设在按钮元素自身：`button, [role=button] { --pico-color: var(--pico-primary-inverse) }`
     也就是白色。所以在按钮里写 `color: var(--pico-color)` 解析出来是白字 ——
     浅底按钮立刻变成"白底白字、只有 hover 才看得见"。凡是我们自己定颜色的按钮/
     控件文字，一律用这个变量，不要用 `--pico-color`。 */
  --ink: #2b3440;
  --pico-muted-color: #64717f;
  --pico-muted-border-color: #e3e9ef;
  --hairline: #e3e9ef;
  --pico-card-background-color: #fff;
  --pico-card-border-color: var(--hairline);
  --pico-card-box-shadow: 0 1px 3px 0 rgba(30, 20, 60, .06), 0 8px 24px -8px rgba(30, 20, 60, .08);
  --pico-card-sectioning-background-color: #f8fafb;
  --pico-box-shadow: 0 1px 3px 0 rgba(30, 20, 60, .06), 0 12px 30px -12px rgba(30, 20, 60, .1);
  --shadow-card: var(--pico-card-box-shadow);

  /* 控件与圆角 */
  --pico-border-radius: 8px;
  --radius-card: 14px;
  --radius-control: 8px;
  --radius-pill: 999px;
  --pico-form-element-background-color: #fff;
  --pico-form-element-border-color: #d5dde5;
  --pico-form-element-active-border-color: var(--brand);
  --pico-form-element-focus-color: rgba(91, 125, 155, .18);
  --pico-form-element-spacing-vertical: .5rem;    /* 输入框高度 = 2×此值 + 行高 ≈ 42px（原为 63px） */
  --pico-form-element-spacing-horizontal: .75rem;
  --pico-form-element-color: var(--pico-color);
  --pico-form-element-placeholder-color: #9fa8b3;

  /* 语义色（提示条 / 标签） */
  --ok: #0f7b3f;
  --ok-tint: #e9f9ef;
  --warn: #a15c00;
  --warn-tint: #fff7e6;
  --err: #c0392b;
  --err-tint: #fdecec;

  /* 表格 */
  --pico-table-border-color: var(--hairline);
}

/* 排版层级：标题收紧（Pico 的 h1 2rem 在中文界面显得过大） */
h1, h2, h3, h4 { font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.0625rem; }
hgroup h2 + p, hgroup p.muted { margin-top: .25rem; font-size: .875rem; }
small, .muted { font-size: .8125rem; }

main { padding-block: 1.5rem; }

/* 布局容器宽度：
   - 控制台 / 运营后台（`.shell` 之内）铺满窗口、内容靠左 —— 表格类页面在宽屏下不该被
     挤进 1200px 的居中列；
   - 公开页（落地页 / 登录 / 注册 …）保持 Pico 原本的居中定宽列：营销页与表单页居中更像样。 */
.shell .main > .container {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding-inline: clamp(1rem, 2.2vw, 2.5rem);
}

/* 页面底色：Pico 的 background-color 变量只影响它自己声明的元素，body 实际是透明的 */
body { background: var(--pico-background-color); }
/* landing 页（首页/公开表单页）与控制台同底色（token 里就是同一个值），此处只是显式声明 */ 
body:has(.landing) { background: var(--pico-background-color); }

/* 表单标签：13px 中等字重（参照方案的"标签比正文小一档"），别和卡片标题抢重量 */
label { font-size: .8125rem; font-weight: 550; color: #344054; }
/* Pico 让按钮 `width: 100%`；表格行内的动作按钮要贴内容宽度 */
td.actions button, td.actions [role="button"] { width: auto; }
/* 引导段落的行宽：整屏宽的中文/英文混排读起来很累 */
.main hgroup p { max-width: 72ch; }

/* 卡片：大圆角 + 发丝边 + 极淡阴影（Pico 的 article 默认只有 8px 圆角） */
article { border-radius: var(--radius-card); }
article header { border-bottom: 1px solid var(--hairline); }
article footer { border-top: 1px solid var(--hairline); }
/* 控制台/后台里的每个 section 就是一张白卡（参照方案："白卡 + 柔和列表行"）。
   只作用于侧栏外壳之内：公开页（落地页/登录/注册）保持它们自己的排版。 */
.shell .main section:not(.stats) {
  padding: 1rem 1.15rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--pico-card-background-color);
  box-shadow: var(--shadow-card);
}
/* 分段区块标题：小号深色，和统计卡标签同族 */
section > h3 { font-size: .9375rem; font-weight: 650; letter-spacing: 0; margin-bottom: .5rem; }
section + section { margin-top: 1rem; }
/* 正文链接：品牌色 + hover 才加下划线（默认下划线在中文字号下太吵） */
a { text-decoration: none; }
main a:hover, article a:hover { text-decoration: underline; }
/* 主按钮/次按钮的高度与圆角统一（Pico 靠变量，这里只收紧内边距） */
button, [role="button"], input[type="submit"] { font-size: .875rem; }

.muted { color: var(--pico-muted-color); }
.inline { display: inline; margin: 0; }
/* 行内表单里的按钮一律**不吃满整行**（Pico 的 `button { width: 100% }` 会让它撑满单元格）。
   至于紧凑尺寸（更小的内边距/字号），只给"没自己表态过"的按钮 —— `.btn-ghost` 自带一套，
   压过它就会出现"同一行里按钮高矮不一"（策略表操作列踩过：锚点 33.3px / 表单按钮 29.8px）。 */
.inline button { width: auto; }
.inline button:not(.btn-ghost) { padding: .25rem .6rem; font-size: .8rem; }

/* 提示条：淡底 + 同色文字 + 发丝边（比"左侧色条"更接近产品化观感） */
.flash {
  padding: .6rem .85rem;
  margin-bottom: 1rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 10px;
  background: #fff;
  font-size: .875rem;
}
.flash.ok { border-color: #bfe7cd; background: var(--ok-tint); color: var(--ok); }
.flash.err { border-color: #f3c8c3; background: var(--err-tint); color: var(--err); }

/* 表格：柔和行 + 发丝分隔，表头只是"小号灰字"，不画粗线 */
table { font-size: .875rem; margin-bottom: .75rem; }
thead th {
  padding: .5rem .6rem; border-bottom: 1px solid var(--pico-muted-border-color);
  font-size: .75rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
  color: var(--pico-muted-color);
}
tbody td { padding: .625rem .6rem; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f8fafb; }
td.actions { white-space: nowrap; }
td.actions form { display: inline; }

/* 状态标签：pill + 淡底（默认中性，语义色各自成对） */
.tag {
  display: inline-block;
  padding: .1rem .5rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--radius-pill);
  background: #f2f5f7;
  color: #5a6672;
  font-size: .6875rem;
  line-height: 1.5;
}
.tag.member, .tag.active { border-color: #bfe7cd; background: var(--ok-tint); color: var(--ok); }
.tag.suspended, .tag.deleted { border-color: #f3c8c3; background: var(--err-tint); color: var(--err); }

.filters { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; }
.filters label { margin: 0; font-size: .8125rem; }
.filters input, .filters select { margin: 0; }
/* Pico 默认把表单里的按钮撑满整行；筛选条里要贴内容宽度 */
.filters button, .filters a[role="button"] { width: auto; margin: 0; padding: .45rem .9rem; }
/* 非主要动作（保存/更新）不必占满整行 */
button.narrow, .narrow[role="button"] { width: auto; padding-inline: 1.25rem; }

.pager { display: flex; gap: .5rem; align-items: center; margin-top: 1rem; font-size: .875rem; }

/* 内联编辑行：HTMX 局部替换的目标 */
dialog article { min-width: 22rem; }
.field-row { display: flex; gap: .5rem; align-items: center; }
.field-row input { margin: 0; }

/* 统计卡：小号灰标签 + 大号数字（四级排版里的"卡片标签 / 数字"） */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; }
.stats article {
  margin: 0;
  padding: .7rem .9rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--pico-card-background-color);
  box-shadow: var(--shadow-card);
}
.stats article p { margin: 0; }
.stats article > p.muted {
  min-height: 2.4em;                     /* 标签换行时也把数字压在同一条基线上 */
  font-size: .6875rem; letter-spacing: .03em; text-transform: uppercase;
}
.stats .num { margin-top: .15rem; font-size: 1.375rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; }
.stats small { display: inline-block; margin-top: .05rem; font-size: .75rem; }

/* 行内的机器值（格式、审计 action）统一成小 chip —— 生 enum 串看起来像没做完 */
table code {
  display: inline-block; padding: .05rem .4rem;
  border: 1px solid var(--hairline); border-radius: 6px; background: #f2f5f7;
  color: #5a6672; font-size: .75rem;
}

/* ---- 表单卡片宽度 ----
   这些宽度**必须**写在外部样式表里：本服务 CSP 为 `style-src 'self'`（禁内联），
   模板里的 style="max-width: …" 会被浏览器直接丢弃 —— 卡片于是撑满容器、显得过宽。
   历史上登录/注册页正是这样"看起来太宽"的。 */
.form-card { margin-inline: auto; max-width: 28rem; }   /* 登录 / 注册 / 密码重置 / 管理端登录 */
.form-card.roomy { max-width: 30rem; }                 /* 激活结果页：文案较长 */
.form-card.wide { max-width: 32rem; }                  /* 错误页 */
/* 错误提示里的"重发"表单 */
.flash form { margin-top: .5rem; }

/* ============================================================
   首页（landing）：仿 agentctxsync 落地页的自定义整页。
   本页不走 Pico 外壳，`index.html` 在 <body class="landing"> 下自绘布局。
   样式全部收在本作用域里（CSP `style-src 'self'`，模板内不得有 <style>/内联样式）。
   配色沿用文件顶部设计 token（--brand / --brand-tint / --hairline …）。
   ============================================================ */
.landing { background: var(--pico-background-color); color: var(--pico-color); font-family: var(--pico-font-family); line-height: 1.7; -webkit-font-smoothing: antialiased; min-height: 100vh; }
.landing * { box-sizing: border-box; }
.landing .wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.landing a { color: inherit; text-decoration: none; }

/* ---------- 导航（sticky，毛玻璃） ---------- */
.landing .lp-nav { position: sticky; top: 0; z-index: 100; display: flex; background: rgba(255, 255, 255, .86); backdrop-filter: blur(14px); border-bottom: 1px solid var(--pico-muted-border-color); }
.landing .lp-nav .wrap { flex: 1 1 auto; display: flex; align-items: center; justify-content: space-between; height: 62px; }
/* Pico 会给 `<nav>` 内的元素加垂直 margin（如 `.lang-switch` 的 `margin-bottom:16px`），
   把顶栏子项顶得不是居中。这里统一归零，交给 `.wrap` 的 `align-items:center` 对齐。 */
.landing .lp-nav .wrap > *,
.landing .lp-nav .nav-links a,
.landing .lp-nav .nav-right,
.landing .lp-nav .nav-cta,
.landing .lp-nav .lang-switch,
.landing .lp-nav .lang-switch a { margin: 0; }
.landing .logo { font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 10px; color: var(--pico-color); }
/* 顶栏里放大的品牌方块（基座样式见 `.brand-mark`）：与侧栏同一枚图形，只是大一号 */
.landing .logo .brand-mark { width: 32px; height: 32px; border-radius: 9px; box-shadow: 0 4px 10px rgba(91, 125, 155, .3); }
.landing .logo .brand-mark svg { width: 18px; height: 18px; }
.landing .nav-links { display: flex; gap: 26px; font-size: 14px; }
.landing .nav-links a { color: var(--pico-muted-color); transition: color .15s; }
.landing .nav-links a:hover { color: var(--brand); }
.landing .nav-right { display: flex; align-items: center; gap: 14px; }
.landing .nav-cta {
  display: inline-flex; align-items: center; height: 34px; padding: 0 18px; line-height: 1;
  font-size: 13px; border-radius: 9px; box-sizing: border-box; white-space: nowrap; flex-shrink: 0;
  background: var(--brand); color: #fff; font-weight: 500; transition: background .15s, box-shadow .15s;
}
.landing .nav-cta:hover { background: var(--brand-dark); box-shadow: 0 6px 18px rgba(91, 125, 155, .3); }
.landing .lang-switch { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--pico-muted-border-color); background: #fff; border-radius: 999px; }
.landing .lang-switch a { padding: 4px 12px; border-radius: 999px; font-size: 12px; color: var(--pico-muted-color); transition: color .15s, background .15s; white-space: nowrap; }
.landing .lang-switch a:hover { color: var(--brand); }
.landing .lang-switch a.active { background: var(--brand-tint); color: var(--brand); font-weight: 600; }

/* flash（注册/登录跳转后） */
.landing .flash-wrap { padding-top: 1rem; }

/* ---------- Hero ---------- */
.landing .hero { padding: 96px 0 76px; text-align: center; position: relative; overflow: hidden; }
.landing .hero::before {
  content: ""; position: absolute; inset: -50% -30% auto; height: 110%; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 55% at 50% 0%, rgba(91, 125, 155, .14), transparent 62%),
    radial-gradient(ellipse 35% 40% at 82% 8%, rgba(66, 133, 244, .08), transparent 60%);
}
.landing .hero::after {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: linear-gradient(rgba(91, 125, 155, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 125, 155, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 75%);
}
.landing .hero .wrap { position: relative; }
.landing .hero .badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; padding: 7px 18px; border-radius: 999px;
  border: 1px solid rgba(91, 125, 155, .28); color: var(--brand); background: rgba(255, 255, 255, .75);
  margin-bottom: 28px; font-weight: 500; box-shadow: 0 2px 10px rgba(91, 125, 155, .08);
}
.landing .hero .badge .dot { width: 7px; height: 7px; border-radius: 50%; background: #34a853; box-shadow: 0 0 0 3px rgba(52, 168, 83, .18); }
.landing .hero h1 { font-size: 40px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.16; color: var(--pico-color); }
.landing .hero .sub { color: var(--pico-muted-color); font-size: 17.5px; max-width: 660px; margin: 22px auto 0; }
.landing .hero .sub code { font-family: "SF Mono", "JetBrains Mono", Consolas, "Courier New", monospace; font-size: 14px; background: var(--brand-tint); color: var(--brand-dark); padding: 2px 7px; border-radius: 5px; }
.landing .hero .actions { display: flex; gap: 14px; justify-content: center; margin-top: 36px; flex-wrap: wrap; }
.landing .btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 30px; border-radius: 11px; font-size: 15px;
  font-weight: 500; transition: all .15s;
}
.landing .btn-primary { background: var(--brand); color: #fff; box-shadow: 0 10px 26px rgba(91, 125, 155, .3); }
.landing .btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); }
.landing .btn-ghost { border: 1px solid var(--pico-muted-border-color); color: var(--ink); background: rgba(255, 255, 255, .7); }
.landing .btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.landing .hero .hint { margin-top: 22px; font-size: 13px; color: var(--pico-muted-color); font-family: "SF Mono", "JetBrains Mono", Consolas, monospace; }

/* ---------- 终端演示（深色对比焦点） ---------- */
.landing .terminal {
  max-width: 780px; margin: 54px auto 0; background: #222f3d; border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px; text-align: left; box-shadow: 0 24px 60px rgba(34, 58, 74, .35);
}
.landing .terminal .bar { display: flex; align-items: center; gap: 8px; padding: 13px 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.landing .terminal .bar i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.landing .terminal .bar i:nth-child(1) { background: #ff5f57; }
.landing .terminal .bar i:nth-child(2) { background: #febc2e; }
.landing .terminal .bar i:nth-child(3) { background: #28c840; }
.landing .terminal .bar span { margin-left: 10px; font-size: 12px; color: #93a5b6; font-family: "SF Mono", "JetBrains Mono", Consolas, monospace; }
.landing .terminal .term-shot-wrap {
  position: relative; display: block; width: 100%; padding: 0; margin: 0;
  border: 0; background: none; cursor: zoom-in; text-align: left; border-radius: 0 0 14px 14px;
}
.landing .terminal .term-shot { display: block; width: 100%; height: auto; border-radius: 0 0 14px 14px; }
.landing .zoom-hint {
  position: absolute; right: 14px; bottom: 14px; padding: 4px 10px; border-radius: 999px;
  background: rgba(34, 58, 74, .72); color: #fff; font-size: 12px; font-weight: 500;
  opacity: 0; transition: opacity .15s; pointer-events: none;
}
.landing .term-shot-wrap:hover .zoom-hint,
.landing .term-shot-wrap:focus-visible .zoom-hint { opacity: 1; }

/* 灯箱遮罩：JS 挂到 <body>（.landing 之外），故用全局选择器。
   CSP 禁内联样式，背景/居中/缩放全在这份外部样式表里。 */
.lightbox {
  position: fixed; inset: 0; z-index: 1000; display: none;
  align-items: center; justify-content: center;
  background: rgba(10, 8, 20, .88); padding: 24px;
}
.lightbox.open { display: flex; }
.lightbox img {
  display: block; max-width: 100%; max-height: 100%; width: auto; height: auto;
  border-radius: 8px; box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
  background: #fff;
}
.lightbox .lb-close {
  position: absolute; top: 18px; right: 22px; width: 40px; height: 40px; border: 0;
  border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer; transition: background .15s;
}
.lightbox .lb-close:hover { background: rgba(255, 255, 255, .28); }

/* ---------- 通用区块 ---------- */
.landing .section { padding: 84px 0; }
.landing .section.alt { background: #eef2f5; border-top: 1px solid var(--pico-muted-border-color); border-bottom: 1px solid var(--pico-muted-border-color); }
.landing .section-head { text-align: center; margin-bottom: 54px; }
.landing .section-head .tag { color: var(--brand); font-size: 13px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase; }
.landing .section-head h2 { font-size: 33px; font-weight: 800; letter-spacing: -.5px; margin-top: 10px; color: var(--pico-color); }
.landing .section-head p { color: var(--pico-muted-color); max-width: 580px; margin: 14px auto 0; font-size: 15.5px; }

/* ---------- 特性 ---------- */
.landing .features { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 20px; }
.landing .feat {
  background: #fff; border: 1px solid var(--pico-muted-border-color); border-radius: 1rem; padding: 28px;
  box-shadow: 0 1px 3px 0 rgba(30, 20, 60, .06), 0 8px 24px -8px rgba(30, 20, 60, .08);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.landing .feat:hover { transform: translateY(-4px); border-color: rgba(91, 125, 155, .4); box-shadow: 0 16px 36px -12px rgba(91, 125, 155, .18); }
.landing .feat .icon {
  width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--brand-tint), #eaf0f6);
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--brand);
}
.landing .feat h3 { font-size: 17.5px; margin: 16px 0 8px; color: var(--pico-color); font-weight: 650; }
.landing .feat p { color: var(--pico-muted-color); font-size: 14px; margin: 0; }

/* ---------- 计划（深色区块） ---------- */
.landing .plan-dark {
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(91, 125, 155, .25), transparent 60%), #1c2733;
  color: #e8eef4;
}
.landing .plan-dark .section-head h2 { color: #fff; }
.landing .plan-dark .section-head p { color: #a9b8c6; }
.landing .plan-dark .section-head .tag { color: #8fa9c2; }
.landing .plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.landing .plan {
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .09); border-radius: 14px;
  padding: 24px; text-align: center; transition: background .18s, border-color .18s, transform .18s;
}
.landing .plan:hover { background: rgba(255, 255, 255, .08); border-color: rgba(143, 169, 194, .4); transform: translateY(-3px); }
.landing .plan .k { font-size: 15.5px; font-weight: 650; color: #fff; margin: 0; }
.landing .plan .num { font-size: 34px; font-weight: 800; color: #8fa9c2; margin: 8px 0; }
.landing .plan p:last-child { color: #a9b8c6; font-size: 13.5px; margin: 0; }

/* ---------- 支持格式（multicolor pills） ---------- */
.landing .formats { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 42px; }
.landing .fmt-pill {
  display: inline-flex; align-items: center; gap: 9px; position: relative;
  padding: 10px 20px; border-radius: 999px; font-size: 14px; font-weight: 650;
  box-shadow: 0 1px 3px 0 rgba(30, 20, 60, .06), 0 8px 24px -8px rgba(30, 20, 60, .08);
}
.landing .fmt-pill .f-icon { flex-shrink: 0; }
.landing .fmt-pill .now-tag {
  position: absolute; top: -8px; right: -6px;
  background: linear-gradient(135deg, #eb5757, #f2994a); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .5px; padding: 2px 8px; border-radius: 999px;
  box-shadow: 0 3px 8px rgba(235, 87, 87, .35);
}
.landing .fmt-pill.f-hermes { background: var(--brand-tint); color: var(--brand-dark); }
.landing .fmt-pill.f-teal { background: #f0fdfa; color: #0d9488; }
.landing .fmt-pill.f-blue { background: #eef1ff; color: #4d6bfe; }
.landing .fmt-pill.f-pink { background: #fdf2f8; color: #d63384; }
.landing .fmt-pill.f-more { background: var(--pico-background-color); color: #93a0ae; border: 1px dashed var(--pico-form-element-border-color); }

/* ---------- 快速开始 ---------- */
.landing .steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; counter-reset: step; }
.landing .step {
  background: #fff; border: 1px solid var(--pico-muted-border-color); border-radius: 1rem; padding: 28px; position: relative;
  box-shadow: 0 1px 3px 0 rgba(30, 20, 60, .06), 0 8px 24px -8px rgba(30, 20, 60, .08);
}
.landing .step::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: -14px; left: 22px; width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  box-shadow: 0 4px 12px rgba(91, 125, 155, .35);
}
.landing .step h3 { font-size: 16px; margin-bottom: 8px; color: var(--pico-color); font-weight: 650; }
.landing .step p { color: var(--pico-muted-color); font-size: 13.5px; margin: 0; }
.landing .step code { font-family: "SF Mono", "JetBrains Mono", Consolas, monospace; font-size: 12px; background: var(--brand-tint); color: var(--brand); padding: 2px 7px; border-radius: 5px; }

/* ---------- 开源 ---------- */
.landing .os { text-align: center; }
.landing .os .big { font-size: 20px; font-weight: 650; margin-bottom: 8px; color: var(--pico-color); }
.landing .os-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 42px; }
.landing .os-item { background: #fff; border: 1px solid var(--pico-muted-border-color); border-radius: 14px; padding: 24px; box-shadow: 0 1px 3px 0 rgba(30, 20, 60, .06), 0 8px 24px -8px rgba(30, 20, 60, .08); }
.landing .os-item .num { font-size: 28px; font-weight: 800; color: var(--brand); background: linear-gradient(92deg, var(--brand), #42638a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.landing .os-item .lbl { color: var(--pico-muted-color); font-size: 13px; margin-top: 4px; }

/* ---------- CTA ---------- */
.landing .cta-band {
  background: linear-gradient(135deg, rgba(91, 125, 155, .12), rgba(66, 99, 138, .06));
  border: 1px solid rgba(91, 125, 155, .3); border-radius: 1rem; padding: 56px 32px;
  text-align: center; margin: 24px 0 84px; position: relative; overflow: hidden;
}
.landing .cta-band h2 { font-size: 30px; font-weight: 800; letter-spacing: -.5px; color: var(--pico-color); }
.landing .cta-band p { color: var(--pico-muted-color); margin: 12px auto 28px; max-width: 540px; }
.landing .cta-band .btn { margin-top: 4px; }

/* ---------- 公开页表单（登录/注册/密码重置/激活，与首页同款淡雅风格） ---------- */
.landing .auth-main { padding: 64px 0 84px; }
.landing .auth-main .form-card {
  max-width: 28rem; margin-inline: auto; padding: 32px 28px;
  background: #fff; border: 1px solid var(--pico-muted-border-color); border-radius: 1rem;
  box-shadow: 0 1px 3px 0 rgba(30, 20, 60, .06), 0 8px 24px -8px rgba(30, 20, 60, .08);
}
.landing .form-card header { padding: 0; background: none; border: 0; margin-bottom: 6px; }
.landing .form-card header strong { font-size: 22px; font-weight: 750; letter-spacing: -.01em; color: var(--pico-color); }
.landing .form-card > p { color: var(--pico-muted-color); font-size: 14px; margin: 10px 0 0; }
.landing .form-card form { margin-top: 18px; }
.landing .form-card label { font-size: 13px; font-weight: 550; color: #344054; display: block; margin-bottom: 14px; }
.landing .form-card input[type="email"],
.landing .form-card input[type="password"],
.landing .form-card input[type="text"] {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  font-size: 14px; line-height: 1.4; color: var(--pico-color);
  background: #fff; border: 1px solid var(--pico-form-element-border-color); border-radius: 8px;
}
.landing .form-card input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91, 125, 155, .18); }
.landing .form-card .muted small,
.landing .form-card small.muted { font-size: 12.5px; color: var(--pico-muted-color); line-height: 1.6; }
.landing .form-card footer { padding: 14px 0 0; border: 0; background: none; }
.landing .form-card footer a { color: var(--brand); }
.landing .form-card footer a:hover { text-decoration: underline; }
.landing .auth-main button[type="submit"] {
  width: 100%; margin-top: 4px; padding: 11px 16px; border: 0; border-radius: 9px;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.landing .auth-main button[type="submit"]:hover { background: var(--brand-dark); }
.landing .auth-main button[disabled] { opacity: .5; cursor: not-allowed; }
/* 重发激活/次要按钮 */
.landing .form-card button.outline {
  width: auto; padding: 7px 14px; margin-top: 10px; border: 1px solid var(--pico-form-element-border-color);
  background: transparent; color: var(--brand-dark); border-radius: 8px; font-size: 13px; cursor: pointer;
}
.landing .form-card button.outline:hover { border-color: var(--brand); color: var(--brand); }
/* 错误提示条（landing 淡雅版） */
.landing .form-card .flash.err,
.landing .form-card article.flash.err {
  border: 1px solid #f3c8c3; background: #fdecec; color: #c0392b;
  border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px;
}
.landing .flash-wrap { padding-top: 1rem; }

/* ---------- 页脚 ---------- */
.landing footer { border-top: 1px solid var(--pico-muted-border-color); padding: 38px 0; text-align: center; background: rgba(255, 255, 255, .5); }
.landing footer .links { display: flex; gap: 22px; justify-content: center; font-size: 13px; margin-bottom: 14px; }
.landing footer .links a { color: var(--pico-muted-color); }
.landing footer .links a:hover { color: var(--brand); }
.landing footer p { color: var(--pico-muted-color); font-size: 12px; margin: 0 0 10px; }
.landing footer .footnote { display: flex; align-items: center; justify-content: center; gap: 8px; }
.landing footer .footnote a { display: inline-flex; align-items: center; color: var(--pico-muted-color); font-size: 12px; }
.landing footer .footnote a:hover { color: var(--brand); }
/* 分隔点与两侧链接同号同色（备案号那一行） */
.landing footer .footnote .sep { color: var(--pico-muted-color); font-size: 12px; line-height: 1; }

@media (max-width: 720px) {
  .landing .hero h1 { font-size: 28px; }
  .landing .nav-links { display: none; }
  .landing .hero { padding: 64px 0 54px; }
  .landing .section { padding: 64px 0; }
}

/* ---- 云端文件页（/account/files）：面包屑、层级列表与行内操作 ----
   同前：宽度/间距一律写在这里 —— CSP 为 `style-src 'self'`，模板里的内联样式会被丢弃。 */
/* 面包屑：一行小字，与下方两栏只留一档间距。
   注意 Pico 的 `nav li` 内边距（顶栏那套）会落到每一段上，把一行面包屑撑成 54px；
   连同 `nav ul` 的 typography 下边距一起归零。 */
.crumbs { margin-bottom: 1rem; padding: 0; }
.crumbs ul { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; list-style: none; font-size: .875rem; }
.crumbs li { display: flex; align-items: center; gap: .35rem; margin: 0; padding: 0; }
.crumbs li + li::before { content: "/"; color: var(--pico-muted-color); }
.crumbs a { text-decoration: none; }
.crumbs a[aria-current="page"] { color: var(--pico-color); font-weight: 600; }

/* 新建目录：输入框吃掉剩余宽度，提示语单独占一行 */
.files-create { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.files-create input[name="path"] { flex: 1 1 18rem; margin: 0; }
.files-create button { width: auto; margin: 0; }
.files-create small { flex-basis: 100%; }

.files .folder-name { font-weight: 600; text-decoration: none; }
.files .folder-name:hover { text-decoration: underline; }
.files .tag { margin-left: .4rem; }

/* 行内操作：三个表单并排，控件都贴内容宽度（Pico 默认撑满整行） */
.row-forms { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.row-forms form { display: flex; gap: .25rem; align-items: center; margin: 0; }
.row-forms input[type="text"] {
  /* Pico 给输入框定了固定高度（约 3.9rem）；行内重命名不需要那么高，
     但要与旁边的按钮**等高**，否则一行里控件参差。
     宽度也用 rem 的绝对值：本页 rem 在 ≥1280px 曾被 Pico 放大到 20px。 */
  height: 2.25rem; margin: 0; padding: .25rem .5rem;
  font-size: .8125rem; width: 6.5rem;
}
.row-forms button { width: auto; height: 2.25rem; margin: 0; padding: 0 .6rem; font-size: .8rem; }
/* 宽屏下让"重命名/移动/删除"占一行：列宽由表格自动分配，挤的是别的列。
   窄屏（侧栏收起、目录树在列表上方）反而需要换行，否则表格会横向溢出。 */
@media (min-width: 900px) {
  .files .row-forms { flex-wrap: nowrap; }
}

/* 文件名：中文默认可以在任意字之间断行，"说/明.md" 这种断法很难认。
   先按"不拆词"排，实在放不下再退让断行。 */
.files td:first-child { word-break: keep-all; overflow-wrap: break-word; }

/* ---- 云端文件：左目录树 + 右当前层列表 ----
   缩进、宽度一律走类：CSP 为 `style-src 'self'`，模板里的内联样式会被丢弃。
   左卡是"文件管理器侧栏"：外卡随行高（与右列同一起点），内层**一开始就占满一屏**，
   目录超出时在卡片内部滚动（而不是把整页撑长），页面滚动时它保持可见。 */
.files-layout { display: grid; grid-template-columns: 19rem minmax(0, 1fr); gap: 1.5rem; align-items: stretch; }
.files-layout.no-tree { grid-template-columns: minmax(0, 1fr); }
.files-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
/* 右列最后一张卡（文件列表）撑满剩余高度 → 与左树卡片**底边对齐**。
   间距统一交给 flex gap：`section` 自带的下边距在 flex 列里不会折叠，
   留着会让最后一张卡的底边比容器高 16px（就"对不齐"了）。 */
.files-main > section { margin-top: 0; margin-bottom: 0; }
.files-main > section:last-of-type { flex: 1 1 auto; }
/* 表格最小宽度可能超过列宽（行内重命名输入框 + 三个按钮）：让它在卡片内横向滚动，
   而不是把整页顶出横向滚动条。 */
.table-scroll { overflow-x: auto; }
@media (max-width: 1100px) {
  /* 窄屏树在上、列表在下：并排会让两者都窄得没法用（1100 是列表还能放下表格的边界） */
  .files-layout { grid-template-columns: minmax(0, 1fr); }
  /* 堆叠时树不再是"侧栏"：不吸顶、按内容高、最多占四成屏 */
  .folder-tree-inner { position: static; height: auto; max-height: 40vh; }
}

/* ---- 目录树（侧栏导航与"移动到"对话框共用）----
   视觉参照桌面端的 TreeView：**固定缩进、不画连接线**，整行 hover / 选中，
   箭头只负责展开收起，名字才是链接；行尾给"空目录 / N 个文档"。
   尺寸一律用 px 而不是 rem：本页 rem = 20px（Pico 的根字号），1rem 的缩进/行高会明显过大。 */
.folder-tree {
  /* Pico 给 `nav` 设了 `display: flex`（顶栏那套）；这里必须还原成块级，
     否则内层 ul 变成 shrink-to-fit 的 flex item，行宽只包住文字，hover/选中盖不满一行。 */
  display: flex; flex-direction: column;
  padding: .85rem 1rem;
  border: 1px solid var(--hairline); border-radius: var(--radius-card);
  background: var(--pico-card-background-color);
  box-shadow: var(--shadow-card);
}
/* 树区：从一开头就占满一屏（不是"贴内容、下面留白"），目录超出时才出现滚动条；
   sticky 让它在长文件列表里保持可见（内层高度 < 卡片高度，所以 sticky 真的生效）。 */
.folder-tree-inner {
  position: sticky; top: 1rem;
  flex: 0 0 auto;
  height: calc(100vh - 12rem);
  min-height: 18rem;
  overflow-y: auto;
  /* 滚动条：Win11 默认是"覆盖式、悬停才显现"的系统行为（Chromium 此时会忽略下面的
     ::-webkit-scrollbar 定制，见实测），所以这里只做两件事：
     ① `scrollbar-gutter: stable` 预留条带 —— 出现/消失时行宽不跳；
     ② 给"经典滚动条"的浏览器（关掉系统自动隐藏、Firefox）把条的颜色调成页面色系。 */
  scrollbar-gutter: stable;
}
.folder-tree-inner::-webkit-scrollbar { width: 8px; }
.folder-tree-inner::-webkit-scrollbar-track { background: #f2f1f7; border-radius: 8px; }
.folder-tree-inner::-webkit-scrollbar-thumb { background: #cfcbdd; border-radius: 8px; }
.folder-tree-inner::-webkit-scrollbar-thumb:hover { background: #b9b3cf; }
@supports not selector(::-webkit-scrollbar) {
  .folder-tree-inner { scrollbar-width: thin; scrollbar-color: #cfcbdd transparent; }
}
/* 面板标题：与统计卡标签同一族（小号灰字），让这块和页面其它卡片是一套语言 */
.folder-tree-title {
  margin: 0 0 .4rem; padding: 0 .5rem;
  font-size: .6875rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--pico-muted-color);
}
.tree, .tree ul { margin: 0; padding: 0; list-style: none; }
/* Pico 把 `ul li` 设成 `list-style: square`、`ul` 带 -8px 负边距，另外
   `nav li` 给每个 li 加上内边距（顶栏那套）、`details[open] > summary` 带 16px 下边距。
   这几条的特异性都比 `.tree …` 高，会直接穿透进来：表现为左侧莫名小方块、
   行距忽大忽小、缩进偏移。逐项压掉（用同样高的特异性，而不是 !important）。 */
.tree li, .folder-tree li { list-style: none; margin: 0; padding: 0; }
/* Pico 还有 `nav ul:first-of-type { margin-left: -8px }`（顶栏贴边的做法，特异性 0,1,2）——
   它会把每层缩进吃掉 8px，看起来"缩进没生效"。用带 :first-of-type 的选择器同级别压掉。 */
.tree ul, .tree ul:first-of-type, .tree ul:last-of-type { margin-left: 0; margin-right: 0; }
.tree details, .tree summary,
.tree details > summary,
.tree details[open] > summary { margin: 0; }
/* Pico 把 `nav ul` 设成 flex（顶栏那套），目录树在 `<nav class="folder-tree">` 里 ——
   不还原成块级的话，每行宽度会缩成内容宽，hover/选中的底色只盖住文字。 */
.folder-tree ul, .folder-tree li { display: block; }
.tree ul { padding-left: 18px; }

.tree-row {
  display: flex; align-items: center; gap: 8px;
  min-height: 32px; padding: 0 10px;
  border-radius: var(--radius-control); font-size: .875rem; color: var(--pico-color);
}
.tree-row:hover { background: #f4f7f9; }
/* 当前目录 = 选中态：淡蓝灰底 + 深蓝灰字 + 图标同色（整行，不只是文字变色） */
.tree-row.is-current { background: var(--brand-tint); color: var(--brand-deep); box-shadow: inset 0 0 0 1px rgba(91, 125, 155, .18); }
.tree-row.is-current .tree-label { font-weight: 600; }
.tree-row.is-current .tree-meta { color: var(--brand-dark); opacity: .9; }
.tree-row.is-current .tree-icon { color: var(--brand-deep); opacity: 1; }

/* 目录/文档图标（components/icons.html）：展开/收起两种形态、空目录淡显，颜色走 currentColor。
   同一套图标在目录树与文件列表里都用，免得同一种东西两处长得不一样。 */
.tree-icon { display: inline-block; flex: 0 0 auto; width: 1rem; height: 1rem; fill: currentColor; vertical-align: -.15em; }
.tree-icon.is-folder { color: var(--brand); }
.tree-icon.is-file { color: #98a2b3; }
.tree-icon.is-empty { opacity: .42; }
.tree-icon .ic-open { display: none; }
.tree details[open] > summary .tree-icon .ic-open { display: block; }
.tree details[open] > summary .tree-icon .ic-closed { display: none; }
/* 列表首列：图标在前、名字在后，与树的读法一致 */
.files td:first-child .tree-icon { margin-right: 6px; }

/* summary 默认带三角标记，这里换成自己的箭头（并去掉 marker 占位）。
   尺寸与 .tree-row 保持一致：summary 本身也带 tree-row 类，两条规则必须同值。 */
.tree summary {
  display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 10px;
  cursor: pointer; list-style: none;
}
.tree summary::-webkit-details-marker { display: none; }
.tree summary::marker { content: ""; }
/* Pico 的 accordion 会给 `details summary` 塞一个右浮动箭头（::after, 20px + 10px 外边距）：
   我们的箭头是行首那个 .tree-caret —— 不去掉的话行尾会多一个"展开"图标，计数也被挤歪。 */
.tree summary::after, .tree summary::before { content: none; display: none; }

.tree-label {
  /* Pico 的 `nav li :where(a, [role=link])` 给"顶栏链接"加了负外边距与行内块（它靠那套做
     spacer/hover），目录树是 `<nav>` 内的 `<li>`，会原样吃到 —— 于是标签左移 10px、
     行尾计数对不齐。这里显式归零。 */
  display: block; margin: 0; padding: 0;
  flex: 0 1 auto; min-width: 0; overflow: hidden;
  font-size: .875rem; color: inherit; text-decoration: none; text-overflow: ellipsis; white-space: nowrap;
}
/* 计数贴到行尾：靠 auto 外边距而不是靠标签长大 —— 各家 flex 分配下都稳定对齐成一列 */
.tree-meta { flex: 0 0 auto; margin-left: auto; font-size: .75rem; color: var(--pico-muted-color); white-space: nowrap; }

.tree-caret { display: grid; flex: 0 0 auto; place-items: center; width: 14px; height: 14px; }
.tree-caret::before {
  content: ""; width: 6px; height: 6px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform .12s ease;
}
.tree details[open] > summary .tree-caret::before { transform: rotate(45deg); }
.tree-caret.is-leaf::before { content: none; }   /* 叶子也占位，名字才能与可展开的目录对齐 */

/* 对话框里的单选行：radio 就是行首标记，不需要箭头 */
.tree-pick-row { cursor: pointer; }
.tree-pick-row input[type="radio"] { flex: 0 0 auto; margin: 0; }
.tree-pick-row input:disabled ~ .tree-label { color: var(--pico-muted-color); }
/* 不可选的行整体压暗：只靠 radio 的小圆点，用户看不出这一行根本点不动 */
.tree-pick-row:has(input:disabled) { opacity: .5; }
/* 选中的目标目录：整行选中态（否则"选了哪个"只剩一个小圆点） */
.tree-pick-row:has(input:checked) { background: var(--brand-tint); color: var(--brand-deep); box-shadow: inset 0 0 0 1px rgba(91, 125, 155, .18); }
.tree-pick-row:has(input:checked) .tree-label { font-weight: 600; }
.tree-pick-row:has(input:checked) .tree-icon { color: var(--brand-deep); opacity: 1; }
.tree .tag { font-size: 10px; }

/* ---- "移动到"对话框（app.js 负责开合与禁用无效目标） ---- */
.move-dialog article { width: min(30rem, 92vw); margin: 0; }
/* 上游变更的弹窗要宽得多：里面是「别名 × 上游模型」的表格式配对，30rem 会把表格挤到溢出。
   `max-width` 必须显式写：Pico 有 `@media(min-width:768px) dialog article{max-width:700px}`，
   只给 `width` 会被它钳在 700px（实测 article=700 宽，56rem 根本没生效）。
   高度上限 + 内容区滚动同样是必须的 —— 否则页脚（取消 / 创建为草稿）会被挤出视口。 */
.move-dialog.wide article { width: min(56rem, 94vw); max-width: min(56rem, 94vw); max-height: 86vh; overflow: auto; }
/* 内容区滚动容器：模板复用了既有的 `.tree-pick`，它的 16rem 上限对这张配对表太矮（要翻三屏） */
.move-dialog.wide .tree-pick { max-height: 70vh; }
.move-dialog header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.move-dialog header .close {
  width: auto; margin: 0; padding: 0 .35rem;
  border: 0; background: none; font-size: 1.25rem; line-height: 1;
}
.move-dialog .tree-pick {
  max-height: 16rem; overflow-y: auto;
  padding: .35rem; border: 1px solid var(--pico-muted-border-color); border-radius: .5rem;
}
.move-dialog footer { display: flex; justify-content: flex-end; gap: .5rem; }
.move-dialog footer button { width: auto; margin: 0; }

/* ---- 侧栏外壳（用户控制台 / 运营后台共用）----
   参照 agentctxsync：白底侧栏、品牌方块 + 名称、导航项 hover 淡灰、**选中 = 淡蓝灰底 + 深蓝灰字**
   （不是实心主色块），分组标题是小号灰字 eyebrow。
   同前：CSP 为 `style-src 'self'`，动态尺寸靠语义元素（如 <progress>），模板里不得有内联样式。 */
.shell { display: flex; align-items: stretch; min-height: 100vh; }
.main { flex: 1 1 auto; min-width: 0; padding-block: 0; }
.main > .container { padding-block: 1.75rem; }

.sidebar {
  flex: 0 0 15rem; width: 15rem;
  display: flex; flex-direction: column; gap: .75rem;
  padding: 1rem .75rem;
  border-right: 1px solid var(--pico-muted-border-color);
  background: var(--pico-card-background-color);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: .45rem;
  padding: .25rem; font-size: .875rem; font-weight: 650; line-height: 1.25;
  color: var(--pico-color); text-decoration: none;
}
/* 品牌方块（components/brand.html 的 mark 宏）：蓝灰渐变圆角方 + 首页那枚图形。
   首页/公开页顶栏与控制台、后台侧栏用的是**同一个方块**，只有尺寸不同：
   这里给侧栏尺寸（28px），顶栏那处由 `.landing .logo .brand-mark` 放大到 32px。
   图形本身是内联 SVG（零请求、CSP 下可用），尺寸靠 CSS 给，模板里不写 style。 */
.brand-mark {
  display: grid; flex: 0 0 auto; place-items: center;
  width: 1.75rem; height: 1.75rem; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 2px 8px rgba(91, 125, 155, .32);
}
.brand-mark svg { display: block; width: 16px; height: 16px; }

/* ---- 侧栏账户区（user area + 向上弹出的菜单）：形态对齐 agentctxsync ----
   一行"头像 + 名字/邮箱 + 退出图标"；菜单向上弹出，展开条件有三个：
   鼠标悬停、键盘聚焦（`:focus-within`）、以及 app.js 打的 `data-open`（触屏点击）。
   `.user-dropdown` 自带一段下内边距当作"桥"：鼠标从那一行移向菜单的途中不会穿过空隙而收起。 */
.user-menu { position: relative; }
.user-row { display: flex; align-items: center; gap: .35rem; }
.user-card {
  display: flex; flex: 1 1 auto; align-items: center; gap: .6rem; min-width: 0;
  width: auto; margin: 0; padding: .3rem .4rem;
  border: 0; border-radius: var(--radius-control); background: none;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.user-card:hover { background: #f4f7f9; }
.user-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
/* 头像：品牌渐变圆 + 首字母白字（与 agentctxsync 的圆形头像同款） */
.avatar {
  display: grid; flex: 0 0 auto; place-items: center;
  width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; font-size: .8125rem; font-weight: 650;
}
.user-meta { display: flex; min-width: 0; flex-direction: column; line-height: 1.3; }
.user-name { overflow: hidden; font-size: .8125rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.user-email {
  overflow: hidden; font-size: .6875rem; color: var(--pico-muted-color);
  text-overflow: ellipsis; white-space: nowrap;
}
/* 退出图标按钮：Pico 会把它撑满整行、加上内边距，这里全部压回"贴内容的图标" */
.user-logout { flex: 0 0 auto; margin: 0; }
.user-logout button {
  display: grid; place-items: center; width: auto; margin: 0; padding: .35rem;
  border: 0; border-radius: var(--radius-control); background: none;
  color: var(--pico-muted-color); cursor: pointer;
}
.user-logout button:hover { background: #f4f7f9; color: var(--brand); }
.user-logout svg { width: 1.15rem; height: 1.15rem; }

.user-dropdown { display: none; position: absolute; left: 0; right: 0; bottom: 100%; z-index: 60; padding-bottom: .35rem; }
.user-menu:hover .user-dropdown,
.user-menu:focus-within .user-dropdown,
.user-menu[data-open="open"] .user-dropdown { display: block; }
.user-panel {
  padding: .3rem 0;
  border: 1px solid var(--pico-muted-border-color); border-radius: 12px; background: #fff;
  box-shadow: 0 10px 25px -5px rgba(30, 20, 60, .12), 0 8px 10px -6px rgba(30, 20, 60, .08);
}
.menu-heading {
  margin: 0; padding: .3rem .75rem;
  font-size: .6875rem; letter-spacing: .07em; text-transform: uppercase; color: var(--pico-muted-color);
}
.menu-item {
  display: block; padding: .35rem .75rem;
  font-size: .8125rem; color: var(--pico-color); text-decoration: none;
}
.menu-item:hover { background: #f4f7f9; color: var(--brand-deep); }
.menu-item.is-active { background: var(--brand-tint); color: var(--brand-deep); font-weight: 600; }
.menu-sep { margin: .3rem 0; border-top: 1px solid var(--hairline); }

/* Pico 给 `nav` 设了 `justify-content: space-between`（顶栏那套：左右两组）——
   侧栏里会变成"导航项被均匀摊到整条高度"，看起来像布局坏了。必须显式压回 flex-start。 */
.sidebar-nav { display: flex; flex: 1 1 auto; flex-direction: column; justify-content: flex-start; gap: .125rem; }
/* 分组标题（侧栏 eyebrow）：导航分组与账户菜单分组的字号/字重共用一套 */
.nav-heading {
  margin: .85rem .6rem .2rem; font-size: .6875rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--pico-muted-color);
}
.nav-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .45rem .6rem; border-radius: var(--radius-control);
  font-size: .875rem; color: var(--pico-color); text-decoration: none;
}
.nav-item:hover { background: #f4f7f9; }
.nav-item[aria-current="page"] {
  background: var(--brand-tint); color: var(--brand-deep); font-weight: 600;
}
.nav-item .nav-icon { flex: 0 0 auto; width: 1rem; height: 1rem; color: var(--pico-muted-color); }
.nav-item[aria-current="page"] .nav-icon { color: var(--brand); }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item.sub { padding-left: 1.9rem; font-size: .8125rem; color: var(--pico-muted-color); }
.nav-item.sub[aria-current="page"] { color: var(--brand-deep); }
.nav-divider { margin: .6rem .25rem; border-top: 1px solid var(--hairline); }

.sidebar-footer {
  display: flex; flex-direction: column; gap: .65rem;
  padding-top: .75rem; border-top: 1px solid var(--hairline);
}
.quota p { margin: 0; font-size: .75rem; }
.quota-line { display: flex; justify-content: space-between; gap: .5rem; }
.quota progress {
  display: block; width: 100%; height: .3rem; margin: .35rem 0 0;
  /* Pico 的轨道色几乎与白底同色，进度条看着像一条孤零零的下划线 —— 给个淡蓝灰轨道 */
  background-color: var(--brand-tint);
}
.quota-plan { margin-top: .25rem; }

/* ---- 表格行内的折叠详情（成本表的「历史」：改价留痕，看一眼不用换页）----
   原生 `<details>`：无 JS 也能展开。符号用 `::before` 画，避免依赖浏览器默认三角。 */
.row-detail > summary {
  cursor: pointer; list-style: none;
  font-size: .75rem; font-weight: 600; color: var(--brand-deep); white-space: nowrap;
}
.row-detail > summary::-webkit-details-marker { display: none; }
.row-detail > summary::marker { content: ""; }
.row-detail > summary::before { content: "▸ "; }
.row-detail[open] > summary::before { content: "▾ "; }
.row-detail-body {
  margin-top: .45rem; padding: .55rem .7rem;
  border: 1px solid var(--hairline); border-radius: var(--radius-control); background: #fbfcfd;
  text-align: left; white-space: normal;
}
.row-detail-body .kv { grid-template-columns: auto minmax(0, 1fr); gap: .3rem 1rem; }

/* ---- 用户侧额度告警（侧栏 + 账户页共用）----
   原来侧栏只有"剩余 / 总额度"两个数字，**快用完了没有任何提示，用完了用户才知道**。
   阈值 ≥80% 琥珀、≥95% 红；两个数同时写进 `title` —— 颜色必须自带解释，
   只给颜色不给原因是缺陷，不是简洁。 */
.quota progress.is-warn::-webkit-progress-value { background: var(--warn); }
.quota progress.is-warn::-moz-progress-bar { background: var(--warn); }
.quota progress.is-bad::-webkit-progress-value { background: var(--err); }
.quota progress.is-bad::-moz-progress-bar { background: var(--err); }
.quota-line .amt.is-warn { color: var(--warn); font-weight: 600; }
.quota-line .amt.is-bad { color: var(--err); font-weight: 600; }
/* 就近告警：不弹窗、不打断，但看得见。`<small>` 上的 is-warn/is-bad 也走同一组颜色。 */
.quota-alert {
  margin: .4rem 0 0; padding: .3rem .45rem;
  border-radius: var(--radius-control);
  background: var(--warn-tint); color: var(--warn);
  font-size: .6875rem; line-height: 1.45;
}
.quota-alert.is-bad { background: var(--err-tint); color: var(--err); }
small.is-warn { color: var(--warn); font-weight: 600; }
small.is-bad { color: var(--err); font-weight: 600; }

/* ---- 额度堆叠条（已用 / 在途 / 还剩）----
   为什么是 SVG：要**逐段**给宽度，`<progress>` 只有一根填充；
   而 `x`/`width` 是几何属性、不是样式，CSP `style-src 'self'` 管不到它们。 */
.stack { display: block; width: 100%; height: .55rem; }
.stack-seg { stroke: #fff; stroke-width: .4; }
.stack-seg.is-used { fill: var(--brand-deep); }
.stack-seg.is-granted { fill: #6f9bc0; }
.stack-seg.is-avail { fill: #dfe7ee; }
.stack-legend {
  display: flex; flex-wrap: wrap; gap: .3rem .75rem;
  margin: .4rem 0 0; font-size: .75rem; color: var(--pico-muted-color);
}
.stack-legend i {
  display: inline-block; width: .55rem; height: .55rem; margin-right: .3rem;
  border-radius: 2px; vertical-align: -.05em;
}
.stack-legend i.is-used { background: var(--brand-deep); }
.stack-legend i.is-granted { background: #6f9bc0; }
.stack-legend i.is-avail { background: #dfe7ee; }

/* ---- 「额度怎么算」的四条口径（C4 / C6 / C7）----
   左列是短标签、右列是解释；行间虚线分隔，读起来是一张清单而不是一段话。 */
.rules { margin: .6rem 0 0; padding: 0; list-style: none; }
.rules li {
  display: flex; gap: .55rem; align-items: flex-start;
  padding: .5rem 0; font-size: .8125rem; line-height: 1.55;
}
.rules li + li { border-top: 1px dashed var(--hairline); }
.rules .rk {
  flex: 0 0 auto; min-width: 4.5rem;
  font-weight: 600; color: var(--pico-color);
}
.rules .rv { flex: 1 1 auto; min-width: 0; color: var(--pico-muted-color); }

/* 窄屏：侧栏变抽屉，靠 app.js 切 data-nav（CSP 禁内联 onclick） */
.topbar {
  display: none; align-items: center; gap: .6rem;
  padding: .6rem 1rem; border-bottom: 1px solid var(--pico-muted-border-color);
  background: var(--pico-card-background-color);
}
.topbar-brand { font-size: .9375rem; font-weight: 650; }
.nav-toggle {
  width: auto; margin: 0; padding: .35rem .5rem;
  border: 1px solid var(--pico-muted-border-color); border-radius: var(--radius-control); background: none;
}
/* 汉堡图标画在 ::before/::after 上（Pico 的按钮规则管不到伪元素），
   用 `--ink` 而不是 `--pico-color`：后者在 button 上被 Pico 改写成白色，图标会隐形。 */
.nav-toggle-icon, .nav-toggle-icon::before, .nav-toggle-icon::after {
  display: block; width: 1.1rem; height: 2px; background: var(--ink); content: "";
}
.nav-toggle-icon { position: relative; }
.nav-toggle-icon::before { position: absolute; top: -5px; }
.nav-toggle-icon::after { position: absolute; top: 5px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.scrim { display: none; }

@media (max-width: 900px) {
  .topbar { display: flex; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 20; height: 100vh;
    transform: translateX(-100%); transition: transform .18s ease-out;
  }
  .shell[data-nav="open"] .sidebar { transform: none; }
  /* 遮罩只覆盖正文一侧：整屏遮罩的中心点会落在侧栏底下，点它其实点到侧栏，
     看上去"遮罩点不关"。留出侧栏宽度，点击目标才与视觉一致。 */
  .shell[data-nav="open"] .scrim {
    display: block; position: fixed; inset: 0 0 0 15rem; z-index: 15; background: rgba(0, 0, 0, .4);
  }
}

/* ============================================================
   AI 目录（/admin/ai/**）专用组件层
   ------------------------------------------------------------
   设计目标（按运营的真实读法排）：
   ① 一眼知道"线上是谁、健不健康" → KPI 砖 + 24h 时序图；
   ② "这个别名指向谁、按什么顺序回退" → 别名卡片 + 链节点（不再是一张 10 列宽表）；
   ③ "改一行不必离开视线" → 右侧抽屉（drawer），编辑时源卡片/行保持高亮；
   ④ "现在该做哪一步、哪一步危险" → 步骤条 + 分步面板，回滚/退役收进折叠区。

   三条硬约束（沿用全局约定，别踩）：
   · CSP 是 `style-src 'self'`：**模板里不得出现 style=""**，动态宽度只能靠
     `<progress value>`（原生）或 SVG 几何属性；
   · 无 JS 必须能走完：tabs 是真链接、抽屉降级为整页表单、步骤面板默认全部可见；
   · 品牌色只在文件顶部 `:root` 定义一次，这里只引用 token，不再出现新的色值常量。
   ============================================================ */

/* ---- 页头：标题在左、主动作在右 ----
   Pico 的 hgroup 是块级、会把按钮挤到下一行；运营页的主按钮应当与标题同一条基线。 */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: .75rem; margin-bottom: 1.25rem;
}
.page-head hgroup { flex: 1 1 20rem; min-width: 0; margin: 0; }
.page-head h2 { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.page-actions button, .page-actions a[role="button"] { width: auto; margin: 0; }

/* ---- tabs：下划线式导航（不是一排按钮）----
   旧实现复用 `.filters` + `a[role=button]`，视觉上像四个并排的操作按钮 —— 读不出
   "这是同一个页面的四个视图"。这里换成真 tab 条：一条底边 + 当前项的品牌色短杠。
   仍用 `<a href>` 而不是 JS 切换：可收藏、可分享、无 JS 也能走完。 */
.ai-tabs {
  display: flex; align-items: stretch; gap: .25rem;
  margin-bottom: 1.25rem; padding: 0;
  border-bottom: 1px solid var(--hairline);
  overflow-x: auto; scrollbar-width: none;
}
.ai-tabs::-webkit-scrollbar { height: 0; }
.ai-tab {
  position: relative; flex: 0 0 auto;
  padding: .6rem .9rem .7rem;
  border-radius: var(--radius-control) var(--radius-control) 0 0;
  font-size: .875rem; font-weight: 550; color: var(--pico-muted-color);
  text-decoration: none; white-space: nowrap;
  transition: color .15s, background .15s;
}
.ai-tab:hover { color: var(--brand-deep); background: #f4f7f9; text-decoration: none; }
.ai-tab[aria-current="page"] { color: var(--brand-deep); font-weight: 650; }
.ai-tab[aria-current="page"]::after {
  content: ""; position: absolute; left: .55rem; right: .55rem; bottom: -1px; height: 2px;
  border-radius: 2px 2px 0 0; background: var(--brand);
}
.ai-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
/* 计数角标：tab 上直接给出"有几个进行中"，不必点进去才知道 */
.ai-tab .tab-count {
  display: inline-block; margin-left: .4rem; padding: .05rem .4rem;
  border-radius: var(--radius-pill); background: var(--brand-tint);
  color: var(--brand-deep); font-size: .6875rem; font-weight: 650; line-height: 1.6;
}
.ai-tabs .tabs-tail {
  display: flex; align-items: center; margin-left: auto; padding-left: 1rem;
  font-size: .75rem; color: var(--pico-muted-color); white-space: nowrap;
}

/* ---- 摘要条：一行回答"现在线上是谁" ---- */
.ai-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem;
  margin: 0 0 1.25rem; padding: .55rem .85rem;
  border: 1px solid var(--hairline); border-radius: var(--radius-card);
  background: linear-gradient(180deg, #fbfcfd, #f7f9fb);
  font-size: .8125rem; color: var(--pico-muted-color);
}
.ai-summary strong { color: var(--pico-color); font-weight: 650; }
.ai-summary .sep { color: var(--pico-muted-border-color); }

/* ---- KPI 砖 + 同一行里的柱状图（总览）----
   与 dashboard 的 `.stats` 同族，但多两件事：一行副信息（口径/对比）与内嵌 health 条。
   `.stats` 的 `section` 排除规则只认 `:not(.stats)`，所以这里用 div 承载、不再套 section。

   `.is-row4` = "一行四份"：两个数字各占 1、柱状图占 2 —— 柱状图是同一个窗口
   （近 24h 请求量）的时序展开，跟那两个数字是**同一件事的三种画法**，所以放在一行里。
   卡片外观（边框/圆角/底色/阴影/左侧色条）由 `.kpi` 与 `.chart` **共用一份声明**：
   以前是各写一份、靠人肉同步，视觉上也就总有细微差别。 */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: .85rem; margin-bottom: 1.25rem;
}
.kpi-grid.is-row4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi,
.kpi-grid .chart {
  position: relative; overflow: hidden;
  padding: .8rem .95rem;
  border: 1px solid var(--hairline); border-radius: var(--radius-card);
  background: var(--pico-card-background-color); box-shadow: var(--shadow-card);
}
/* 行高由最高的那块（柱状图）决定，数字砖把内容居中，而不是顶着上沿留一片空白 */
.kpi { display: flex; flex-direction: column; justify-content: center; }
.kpi::before,
.kpi-grid .chart::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--brand-tint);
}
.kpi.is-good::before { background: var(--ok); }
.kpi.is-warn::before { background: var(--warn); }
.kpi.is-bad::before { background: var(--err); }
.kpi-grid .chart { grid-column: span 2; }
.kpi-label {
  margin: 0; font-size: .6875rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--pico-muted-color);
}
.kpi-num {
  margin: .2rem 0 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2;
  color: var(--pico-color);
  font-variant-numeric: tabular-nums;
}
.kpi-num .unit { margin-left: .15rem; font-size: .8125rem; font-weight: 550; color: var(--pico-muted-color); }
.kpi-sub { margin: .15rem 0 0; font-size: .75rem; color: var(--pico-muted-color); }
.kpi.is-good .kpi-num { color: var(--ok); }
.kpi.is-warn .kpi-num { color: var(--warn); }
.kpi.is-bad .kpi-num { color: var(--err); }

/* ---- health 条（`<progress>`）----
   成功率/配额这类"比例"必须能看出高低，光给 `99.8%` 三个数字眼睛要比大小。
   宽度交给原生 progress 的 value：CSP 禁内联样式，不能写 style="width:99%"。 */
.meter { display: block; width: 100%; height: .3rem; margin: .45rem 0 0; }
.meter::-webkit-progress-bar { background: #edf1f4; border-radius: var(--radius-pill); }
.meter::-webkit-progress-value { background: var(--brand); border-radius: var(--radius-pill); }
.meter::-moz-progress-bar { background: var(--brand); border-radius: var(--radius-pill); }
.meter.is-good::-webkit-progress-value { background: var(--ok); }
.meter.is-good::-moz-progress-bar { background: var(--ok); }
.meter.is-warn::-webkit-progress-value { background: var(--warn); }
.meter.is-warn::-moz-progress-bar { background: var(--warn); }
.meter.is-bad::-webkit-progress-value { background: var(--err); }
.meter.is-bad::-moz-progress-bar { background: var(--err); }
/* 链抽屉里的卡网格：**按实测需求**定最小宽度，而不是拍一个数。
   实测（链抽屉内）：最长的一行链信息 361px、序号 22、两个 10px 间距、卡片左右内边距 32
   ⇒ 冻结版一张卡要 ≈435px；草稿右侧那列操作图标实测 191px ⇒ **≈709px**（取 45rem=720px 留余量）。
   旧值 23rem=368px 低于需求，卡片因此总被压窄、链上那行「供应商 · 费率 · 上限」被挤。
   抽屉宽度 96rem/96vw：在 1500–1600 宽的屏上正好排两张不换行的卡（624×2 + 间距 14 + 内边距 32 ≈ 1294），
   更宽的屏由 auto-fill 自动补第三列。 */
.drawer-body .card-grid { grid-template-columns: repeat(auto-fill, minmax(45rem, 1fr)); }

/* 行内的小比例条（测试进度 N/M）：窄、贴着数字，不抢表格行的视觉重量 */
.meter.meter-mini { width: 4.5rem; height: .25rem; margin: 0 0 0 .5rem; vertical-align: middle; }
.meter.meter-mini::-webkit-progress-bar { background: #edf1f4; }
.meter.meter-mini::-webkit-progress-value { background: var(--brand); }
.meter.meter-mini::-moz-progress-bar { background: var(--brand); }
.test-cell { display: inline-flex; align-items: center; font-variant-numeric: tabular-nums; }

/* ---- 24h 时序图（内联 SVG，零依赖）----
   柱高与颜色由模板算好写进 SVG 几何属性（`height` / `y` 是属性不是样式，CSP 不管）。
   `<title>` 给原生 hover 提示：不需要 JS 也能读到具体数值。
   卡片外观（边框/圆角/底色/阴影/左侧色条）来自上面的 `.kpi, .kpi-grid .chart` 共用声明 ——
   这一条只管图自己的排版。 */
.chart-svg { display: block; width: 100%; height: auto; margin-top: .2rem; }
.chart-bar { fill: var(--brand); transition: fill .15s; }
.chart-bar.is-good { fill: #3f9d68; }
.chart-bar.is-warn { fill: #d9a13c; }
.chart-bar.is-bad { fill: #d2685a; }
.chart-bar:hover { fill: var(--brand-deep); }
.chart-grid { stroke: var(--hairline); stroke-width: 1; }
.chart-axis { fill: var(--pico-muted-color); font-size: 9px; font-family: inherit; }
.chart-empty { margin: .2rem 0 0; font-size: .75rem; color: var(--pico-muted-color); }
.chart-legend { display: flex; flex-wrap: wrap; gap: .75rem; margin: .5rem 0 0; font-size: .75rem; color: var(--pico-muted-color); }
.chart-legend i {
  display: inline-block; width: .55rem; height: .55rem; margin-right: .3rem;
  border-radius: 2px; background: var(--brand); vertical-align: -.05em;
}
.chart-legend i.is-good { background: #3f9d68; }
.chart-legend i.is-warn { background: #d9a13c; }
.chart-legend i.is-bad { background: #d2685a; }

/* 一行四份的降级：窄屏先变两列（图整行），再变单列（图归位）——
   4 份等宽会把"近 24 小时成功率"这种标签挤到换行，图也会被压成一条缝。 */
@media (max-width: 60rem) {
  .kpi-grid.is-row4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 34rem) {
  .kpi-grid.is-row4 { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid .chart { grid-column: auto; }
}

/* ---- 表格里的完整链（总览的别名表）----
   一行一个候选、按**选路顺序**排（序号 0 起 = fallback 顺序）：上游模型 + 供应商 + 徽章 + 费率。
   只读视图 —— 换位/编辑/删除都在链页（从策略列表「打开」进抽屉）。 */
.chain-inline { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .2rem; }
.chain-inline li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem; font-size: .8125rem; }
.chain-inline li.is-off { opacity: .55; }
.chain-inline .idx {
  display: inline-grid; place-items: center; width: 1.1rem; height: 1.1rem; flex: 0 0 auto;
  border-radius: var(--radius-pill); background: var(--brand-tint); color: var(--brand-deep);
  font-size: .6875rem; font-variant-numeric: tabular-nums;
}
.chain-inline code { font-size: .8125rem; }

/* ---- 卡片网格（供应商 / 别名共用一套骨架）---- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(23rem, 1fr)); gap: .9rem; }
.card-grid.is-single { grid-template-columns: minmax(0, 1fr); }

.obj-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--hairline); border-radius: var(--radius-card);
  background: var(--pico-card-background-color); box-shadow: var(--shadow-card);
  transition: border-color .15s, box-shadow .15s;
}
.obj-card:hover { border-color: rgba(91, 125, 155, .38); }
/* 左侧状态色条：主力 = 品牌实色，后备 = 淡色，停用/退役 = 灰。
   用 ::before 而不是 border-left：border 会参与盒模型，改颜色时行宽会跳。 */
.obj-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--hairline);
}
.obj-card.is-main::before { background: var(--brand); }
.obj-card.is-standby::before { background: #9fb6ca; }
.obj-card.is-off::before { background: #dfe4e9; }
.obj-card.is-off { background: #fcfdfd; }
.obj-card.is-off .obj-title { color: var(--pico-muted-color); }
/* 正在抽屉里编辑的那一张：品牌色描边 + 极淡底 —— 抽屉关掉后一眼能找回原位 */
/* 正在抽屉里编辑的那一张：品牌色描边 + 极淡底 —— 抽屉关掉后一眼能找回原位。
   两种源都要盖：供应商/别名卡片是 `.obj-card`，而**候选**的源是链节点 `.chain-node`
   （抽屉从行尾的铅笔图标打开，源就是那一行）。漏掉后者会让"编辑候选"没有高亮反馈。 */
.obj-card[data-editing="true"] {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(91, 125, 155, .14), var(--shadow-card);
  background: #fbfdfe;
}
.chain-node[data-editing="true"] {
  background: #f5f9fc;
  box-shadow: inset 2px 0 0 var(--brand);
}
.chain-node[data-editing="true"] .chain-model code { border-color: var(--brand); color: var(--brand-deep); }
/* 第三种源：**表格行**（档位列表的「编辑」）。上面两条分别盖卡片与链节点，都盖不到 `<tr>` ——
   少了这条，"点了哪一行"在列表页上零反馈（而抽屉正好挡住右半边，更需要这一行做锚点）。 */
tr[data-editing="true"] > td { background: #f5f9fc; }
tr[data-editing="true"] > td:first-child { box-shadow: inset 2px 0 0 var(--brand); }
/* "定位到这一张"（?provider_id= / ?model_pk= 进来时）：短暂的品牌色脉冲，
   1.6s 后由 app.js 摘掉类。用 box-shadow 而不是 border，避免改变盒模型引起布局跳动。 */
@keyframes obj-flash {
  0% { box-shadow: 0 0 0 0 rgba(91, 125, 155, .45); }
  70% { box-shadow: 0 0 0 10px rgba(91, 125, 155, 0); }
  100% { box-shadow: 0 0 0 0 rgba(91, 125, 155, 0); }
}
.obj-card.is-flash { border-color: var(--brand); animation: obj-flash 1.5s ease-out; }
.obj-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem;
  padding: .85rem 1rem .6rem 1.1rem;
}
.obj-title { margin: 0; font-size: .9375rem; font-weight: 650; letter-spacing: -.01em; color: var(--pico-color); }
.obj-sub { margin: .2rem 0 0; font-size: .75rem; color: var(--pico-muted-color); }
.obj-badges { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: .3rem; }
.obj-body { padding: 0 1rem .75rem 1.1rem; }
.obj-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
  margin-top: auto; padding: .6rem 1rem .7rem 1.1rem;
  border-top: 1px solid var(--hairline); background: #fbfcfd;
}
.obj-foot .grow { flex: 1 1 auto; }

/* ---- kv 网格：机器值（Base URL / 密钥掩码 / 优先级 …）----
   定义列表而不是表格：卡片里塞表格会把边框和表头一起带进来，显得像"页面里嵌了页面"。 */
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .3rem .75rem; margin: 0; font-size: .8125rem; }
.kv dt { color: var(--pico-muted-color); white-space: nowrap; }
.kv dd { margin: 0; min-width: 0; color: var(--pico-color); overflow-wrap: anywhere; }
.kv dd code { font-size: .75rem; }

/* ---- 候选链：编号节点 + 连接线 ----
   这一列的语义就是"故障转移顺序"，所以视觉上必须**读得出顺序** —— 圆号 + 竖线，
   而不是一张没有行序暗示的宽表。 */
.chain { list-style: none; margin: .15rem 0 0; padding: 0; }
.chain-node { position: relative; display: flex; gap: .65rem; padding: .5rem 0; }
.chain-node + .chain-node { border-top: 1px dashed var(--hairline); }
.chain-idx {
  display: grid; flex: 0 0 auto; place-items: center;
  width: 1.35rem; height: 1.35rem; margin-top: .05rem;
  border: 1px solid var(--pico-muted-border-color); border-radius: 50%;
  background: #fff; color: var(--pico-muted-color);
  font-size: .6875rem; font-weight: 650; font-variant-numeric: tabular-nums;
}
.chain-node.is-first .chain-idx {
  border-color: var(--brand); background: var(--brand-tint); color: var(--brand-deep);
}
.chain-node.is-off .chain-idx { background: #f2f5f7; color: #9fa8b3; }
.chain-main { flex: 1 1 auto; min-width: 0; }
.chain-line1 { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem; font-size: .8125rem; }
.chain-model { font-weight: 600; color: var(--pico-color); }
.chain-line2 { margin-top: .15rem; font-size: .75rem; color: var(--pico-muted-color); }
.chain-line2 .sep { margin-inline: .3rem; color: var(--pico-muted-border-color); }
.chain-side { display: flex; flex: 0 0 auto; align-items: flex-start; gap: .3rem; }

/* ---- 步骤条（变更单详情）----
   旧实现是一排 `.tag` 徽章，读不出"流程"；也看不出"上线"这一步现在能不能点。
   这里换成带连接线的五步：完成 = 实心勾，当前 = 品牌环，未到 = 灰圈。 */
.steps { list-style: none; display: flex; align-items: flex-start; gap: 0; margin: 0 0 1.25rem; padding: 0; }
.step { position: relative; flex: 1 1 0; min-width: 0; padding: 0 .35rem; text-align: center; }
/* 连接线：只画在节点之间（第一个不画左、最后一个不画右） */
.step::before, .step::after {
  content: ""; position: absolute; top: .8rem; height: 2px; background: var(--hairline);
}
.step::before { left: 0; right: 50%; margin-right: .8rem; }
.step::after { left: 50%; right: 0; margin-left: .8rem; }
.step:first-child::before, .step:last-child::after { display: none; }
.step.is-done::after, .step.is-done::before, .step.is-now::before { background: var(--brand); }
.step-dot {
  position: relative; z-index: 1;
  display: grid; place-items: center;
  width: 1.6rem; height: 1.6rem; margin: 0 auto .35rem;
  border: 2px solid var(--pico-muted-border-color); border-radius: 50%;
  background: #fff; color: var(--pico-muted-color);
  font-size: .6875rem; font-weight: 700;
}
.step.is-done .step-dot { border-color: var(--brand); background: var(--brand); color: #fff; }
.step.is-now .step-dot { border-color: var(--brand); color: var(--brand-deep); box-shadow: 0 0 0 4px rgba(91, 125, 155, .16); }
.step-label { display: block; font-size: .75rem; font-weight: 550; color: var(--pico-muted-color); }
.step.is-now .step-label { color: var(--brand-deep); font-weight: 650; }
.step.is-done .step-label { color: var(--pico-color); }
.step-meta { display: block; margin-top: .1rem; font-size: .6875rem; color: var(--pico-muted-color); }

/* ---- 分步面板：只让"当前该做的那一步"显眼 ---- */
.panel + .panel { margin-top: .9rem; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.panel-head h3 { margin: 0; }
.panel-head .grow { flex: 1 1 auto; }
/* 已完成的步骤压暗：不是不能看，是不该抢注意力 */
.panel.is-done { opacity: .78; }
.panel.is-done:hover { opacity: 1; }
.panel.is-locked { opacity: .6; }
.panel.is-locked .panel-head h3 { color: var(--pico-muted-color); }

/* ---- 危险区：回滚 / 退役默认折叠 ----
   这两个动作会**立刻**改变线上选路。让它们常驻同屏（旧版就是）等于把误触概率
   放到最大；折叠起来后，想做的人仍然两次点击就能到。 */
.danger { margin-top: .9rem; border: 1px solid #f0d9d5; border-radius: var(--radius-card); background: #fffdfc; }
.danger > summary {
  padding: .6rem .9rem; cursor: pointer; list-style: none;
  font-size: .8125rem; font-weight: 600; color: var(--err);
}
.danger > summary::-webkit-details-marker { display: none; }
.danger > summary::marker { content: ""; }
.danger > summary::before { content: "▸ "; }
.danger[open] > summary::before { content: "▾ "; }
.danger > summary:hover { background: #fdf6f5; }
.danger-body { padding: 0 .9rem .8rem; }
.danger-body form + form { margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed #f0d9d5; }

/* ---- 抽屉（右侧滑出编辑面板）----
   这是本次交互重做的核心：编辑不再"跳到页面底部的表单"，而是从右侧滑出，
   源卡片保持高亮 —— 改完关掉，视线没有离开过原来那一行。
   用原生 <dialog> + showModal()（app.js 调用）：遮罩、焦点陷阱、Esc 关闭全都白拿。
   无 JS 降级：链接指向不带 `?modal=1` 的同一 URL，服务端渲整页表单。 */
.drawer-dialog { align-items: stretch; justify-content: flex-end; padding: 0; border: 0; }
/* 只作用于**抽屉自己的**那层 article（app.js 包的那层）。写成后代选择器会把片段里的
   每个 <article>（提示条 `.flash`、卡片…）都套上 height:100vh + 34rem 宽度 ——
   表现为抽屉里一大块空白、内容被挤到看不见（候选链抽屉第一次踩到）。 */
.drawer-dialog > article {
  display: flex; flex-direction: column;
  width: min(34rem, 100vw); max-width: min(34rem, 100vw);
  height: 100vh; max-height: 100vh; margin: 0; padding: 0;
  border: 0; border-left: 1px solid var(--hairline); border-radius: 0;
  background: var(--pico-card-background-color);
  box-shadow: -24px 0 60px -30px rgba(30, 20, 60, .4);
  overflow: hidden;
}
/* 表单占满 header 与 footer 之间的全部高度（body 滚动、footer 常驻） */
.drawer-dialog article > form { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
/* 宽抽屉 = 链视图（一版里所有别名的卡 + 每张卡内的编号链）。
   56rem 时卡网格只有 2 列、链上的"供应商 · 费率 · 上限"要挤成一行，读起来憋；
   84rem 在常见宽屏上能排 3 列，窄屏由下面的媒体查询接管（96vw / 100vw）。 */
/* 只作用在抽屉自己那层 article 上（同上面的 `.drawer-dialog > article`）：写成**后代**选择器会把片段里的每个
   <article>（别名卡、供应商卡…）都撑成抽屉宽度 —— 表现为卡片互相遮挡、横向溢出（这个坑踩过两次）。 */
.drawer-dialog.wide > article { width: min(96rem, 96vw); max-width: min(96rem, 96vw); }
@keyframes drawer-in { from { transform: translateX(1.5rem); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-dialog[open] article { animation: drawer-in .18s ease-out both; }
.drawer-head {
  display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: .5rem;
  padding: .9rem 1rem; border-bottom: 1px solid var(--hairline); background: #fbfcfd;
}
.drawer-head h3 { margin: 0; font-size: .9375rem; }
.drawer-head p { margin: .2rem 0 0; font-size: .75rem; color: var(--pico-muted-color); }
.drawer-close {
  flex: 0 0 auto; width: auto; margin: 0; padding: .2rem .45rem;
  border: 1px solid transparent; border-radius: var(--radius-control);
  background: none; font-size: 1.1rem; line-height: 1; color: var(--pico-muted-color);
}
.drawer-close:hover { border-color: var(--hairline); background: #f4f7f9; color: var(--brand-deep); }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: .9rem 1rem 1.25rem; }
.drawer-body .grid { gap: .75rem; }
.drawer-foot {
  display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; gap: .5rem;
  padding: .7rem 1rem; border-top: 1px solid var(--hairline); background: #fbfcfd;
}
/* 页脚按钮不许换行、不许被左侧文字挤压 —— 曾出现「保存」被挤成竖排两行 */
.drawer-foot button, .drawer-foot a[role="button"] { width: auto; margin: 0; flex: 0 0 auto; white-space: nowrap; }
/* 同一条页脚里的按钮**必须一样高**：`.contrast`（主按钮）走 Pico 的默认间距与 16px 字号，
   `.btn-ghost`（次按钮）是 13px 那一档 —— 并排就一个高一个矮（实测 42.8 vs 33.3）。
   这里只统一"尺寸"（内边距/字号/圆角），颜色仍各按各的角色走：主按钮实色、次按钮描边。 */
.drawer-foot button, .drawer-foot a[role="button"] {
  padding: .35rem .75rem; font-size: .8125rem; border-radius: var(--radius-control); line-height: 1.35;
}
.drawer-foot .grow { flex: 1 1 auto; min-width: 0; font-size: .75rem; color: var(--pico-muted-color); }
/* 抽屉里的表单：标签在上、控件在下，分组标题用小号灰字（与侧栏 eyebrow 同族） */
/* 无 JS 降级版的表单动作行（"保存"是 .narrow 按钮、"取消"是描边链接）：与抽屉页脚同一条规矩 ——
   并排的两个控件必须一样高，只让颜色表达主次。 */
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.form-actions button, .form-actions a[role="button"] {
  width: auto; margin: 0; flex: 0 0 auto; padding: .35rem .75rem; font-size: .8125rem;
  border-radius: var(--radius-control); line-height: 1.35;
}

.drawer-body form { margin: 0; }
.drawer-body label { display: block; margin-bottom: .7rem; }
.drawer-body input, .drawer-body select { margin-top: .3rem; margin-bottom: 0; }

/* 字段说明（`<small>`）要待在输入框**下面**，不能压进去。
   Pico 有一条这样的规则：

     :where(input,select,textarea,fieldset,.grid) + small {
       display: block; width: 100%;
       margin-top: calc(var(--pico-spacing) * -.75);   ← 负值
     }

   它的前提是输入框保留下方的 `--pico-spacing` 底边距，负的 -0.75 正好把它收成
   紧凑但不重叠的间距。上面 `.drawer-body input { margin-bottom: 0 }` 把底边距清零后，
   这个负边距没有东西可抵消 —— 说明文字直接被拉进输入框，看起来"文字跑到框里了"。
   这里改成正向间距，并把行高拉开一点（中文两行的说明挤在一起很难读）。
   选择器用 `.ai-form`（三个 AI 表单的根），抽屉与无 JS 整页降级两条路一起生效。 */
.ai-form :where(input, select, textarea, .grid) + small,
.ai-form label > small {
  display: block;
  width: 100%;
  margin: .32rem 0 0;
  line-height: 1.5;
}
/* 勾选行的外观：选择器带 `.ai-form`（不只是 `.drawer-body`）——
   同一份表单模板要跑**抽屉**与**无 JS 整页降级**两条路，只写在 `.drawer-body` 下
   会让整页版看起来像另一个控件（曾经就是这样）。 */
.drawer-body .check,
.ai-form .check {
  display: flex; align-items: flex-start; gap: .45rem;
  padding: .4rem .55rem; margin-bottom: .4rem;
  border: 1px solid var(--hairline); border-radius: var(--radius-control); background: #fbfcfd;
  font-size: .8125rem; font-weight: 500;
}
/* 勾选框**不要**写 `width: auto`（曾经就写错过）：Pico 的 checkbox 是 `appearance: none`
   + 固定 `width/height: 1.25em`，改 auto 后它没有内在尺寸，只剩左右各 2px 边框
   ⇒ 计算宽度 4px（探针实测），看起来就是"勾选框没了、左边只剩一条色条"。
   用 `flex: 0 0 auto` 让它不被 flex 收缩，尺寸交回 Pico。
   选择器带 `.ai-form`：抽屉与无 JS 整页降级是两条路，只写在 `.drawer-body` 下就只修好一条。 */
.drawer-body .check input,
.ai-form .check input {
  flex: 0 0 auto;
  width: 1.25em;
  height: 1.25em;
  margin: .15rem 0 0;
}
.drawer-group { margin: 1rem 0 .5rem; font-size: .6875rem; letter-spacing: .05em; text-transform: uppercase; color: var(--pico-muted-color); }
.drawer-group:first-child { margin-top: 0; }
/* 高级项默认折叠：User-Agent / 鉴权方式 / API 版本这类极少动的字段不该与主字段平铺 */
.drawer-adv { border: 1px solid var(--hairline); border-radius: var(--radius-control); background: #fbfcfd; }
.drawer-adv > summary {
  padding: .5rem .7rem; cursor: pointer; list-style: none;
  font-size: .8125rem; font-weight: 550; color: var(--pico-muted-color);
}
.drawer-adv > summary::-webkit-details-marker { display: none; }
.drawer-adv > summary::marker { content: ""; }
.drawer-adv > summary::before { content: "▸ "; }
.drawer-adv[open] > summary::before { content: "▾ "; }
.drawer-adv > summary:hover { color: var(--brand-deep); }
.drawer-adv-body { padding: .6rem .7rem .2rem; }
.drawer-adv[open] > summary { border-bottom: 1px solid var(--hairline); }

/* ---- 动作组：行内/卡片底部的小按钮 ---- */
.seg { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.seg form { display: inline; margin: 0; }
.seg button, .seg a[role="button"] {
  width: auto; margin: 0; padding: .3rem .65rem;
  font-size: .75rem; line-height: 1.5;
}
.icon-btn {
  display: grid; place-items: center; width: auto; margin: 0; padding: .3rem;
  border: 1px solid transparent; border-radius: var(--radius-control);
  background: none; color: var(--pico-muted-color); cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.icon-btn:hover { border-color: var(--hairline); background: #f4f7f9; color: var(--brand-deep); }
.icon-btn svg { display: block; width: .95rem; height: .95rem; }
.icon-btn[disabled] { opacity: .45; cursor: not-allowed; }
/* 主/次/危险三档文本按钮：抽屉与卡片底部共用。
   文字色用 `--ink` 而不是 `--pico-color`（后者在按钮上被 Pico 改写成白色，见 :root 注释）。 */
.btn-ghost {
  width: auto; margin: 0; padding: .35rem .75rem;
  border: 1px solid var(--pico-form-element-border-color); border-radius: var(--radius-control);
  background: #fff; font-size: .8125rem; color: var(--ink); cursor: pointer;
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-deep); text-decoration: none; }
.btn-danger { border-color: #f0d9d5; background: #fff; color: var(--err); }
.btn-danger:hover { border-color: var(--err); background: var(--err-tint); color: var(--err); }

/* ---- 表格单元格里的按钮：**必须不换行** ----
   列宽一紧，Pico 的 `button` 会把中文按字断行 —— 截图里实测到"删除"两个字竖着排成
   一列，既难认又撑高整行。`white-space: nowrap` 让按钮保持"一个控件"的形态
   （同理：单元格里的 `<a role="button">`）。 */
td > button,
td > a[role="button"],
td > form > button { white-space: nowrap; }

/* ---- 状态标签的补充档位 ----
   原有 `.tag` 只有中性/绿/红；"后备""已验证"这类中间态需要一个琥珀档，
   否则只能借用中性灰，读起来像"没状态"。 */
.tag.warn { border-color: #f0dfb8; background: var(--warn-tint); color: var(--warn); }
.tag.brand { border-color: rgba(91, 125, 155, .35); background: var(--brand-tint); color: var(--brand-deep); }
.tag .dot {
  display: inline-block; width: .4rem; height: .4rem; margin-right: .3rem;
  border-radius: 50%; background: currentColor; vertical-align: .05em;
}

/* ---- 空态 ---- */
.empty { display: grid; place-items: center; gap: .4rem; padding: 2.25rem 1rem; text-align: center; }
.empty svg { width: 2rem; height: 2rem; color: #c3ccd6; }
.empty p { margin: 0; font-size: .875rem; color: var(--pico-muted-color); }
.empty .empty-hint { font-size: .75rem; }

/* ---- 工具条：搜索 / 筛选 / 计数 ----
   客户端过滤只是渐进增强：服务端总是渲染全部行，JS 只做隐藏 ——
   禁掉 JS 时看到的是"没有筛选框的全量列表"，而不是一个坏掉的页面。 */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .9rem; }
.toolbar .grow { flex: 1 1 auto; }
.toolbar-search { position: relative; flex: 1 1 14rem; max-width: 22rem; }
.toolbar-search input { width: 100%; margin: 0; padding-left: 2rem; }
.toolbar-search svg {
  position: absolute; top: 50%; left: .6rem; width: .9rem; height: .9rem;
  transform: translateY(-50%); color: var(--pico-muted-color); pointer-events: none;
}
.toolbar-count { font-size: .75rem; color: var(--pico-muted-color); white-space: nowrap; }
.toolbar select { width: auto; margin: 0; }
/* JS 隐藏行/卡片用 hidden 属性（不是 class）：语义正确，且不需要额外 CSS。
   `!important` 是必要的 —— grid/flex 子项的 display 值特异性高于 `[hidden]` 的默认 `none`，
   不加就会"hidden 了但还占着一格"。 */
[data-filterable][hidden] { display: none !important; }
/* 空态提示本身也用 hidden 切换（JS 过滤后一个都不剩时才显示）；
   `.empty` 是 `display: grid`，同样要显式压过。 */
[hidden] { display: none !important; }

/* ---- 表格密度：宽表仍需存在（变更单列表、测试记录），但要比旧版更紧 ---- */
.dense table { font-size: .8125rem; margin-bottom: 0; }
.dense thead th { padding: .4rem .55rem; font-size: .6875rem; }
.dense tbody td { padding: .5rem .55rem; }
/* 行内动作：图标化后仍然要保留文字（无障碍 + 中文用户不需要猜图标） */
td.actions .seg { flex-wrap: nowrap; }

/* ---- 新建变更：向导 ----
   三步（新上游 → 拉取模型 → 挂候选）本来就是线性的，旧版把三步堆在一个滚动区里，
   看不出"我在第几步、下一步是什么"。这里给它一个迷你步骤条 + 每步一个面板。 */
.wizard-steps { display: flex; align-items: center; gap: .5rem; margin: 0 0 .9rem; padding: 0; list-style: none; }
.wizard-steps li {
  display: flex; align-items: center; gap: .4rem;
  font-size: .75rem; color: var(--pico-muted-color);
}
.wizard-steps li .wnum {
  display: grid; place-items: center; width: 1.25rem; height: 1.25rem;
  border: 1px solid var(--pico-muted-border-color); border-radius: 50%;
  background: #fff; font-size: .6875rem; font-weight: 650;
}
.wizard-steps li.is-on { color: var(--brand-deep); font-weight: 600; }
.wizard-steps li.is-on .wnum { border-color: var(--brand); background: var(--brand); color: #fff; }
.wizard-steps li.is-done .wnum { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-deep); }
.wizard-steps li + li::before { content: "—"; margin-right: .1rem; color: var(--pico-muted-border-color); }
.wizard-panel { padding: .75rem .85rem; border: 1px solid var(--hairline); border-radius: var(--radius-control); background: #fbfcfd; }
.wizard-panel + .wizard-panel { margin-top: .75rem; }
.wizard-panel h4 { margin: 0 0 .5rem; font-size: .8125rem; }

/* ---- 窄屏：抽屉全屏、卡片单列、步骤条可横向滚动 ---- */
@media (max-width: 720px) {
  .drawer-dialog > article, .drawer-dialog.wide > article { width: 100vw; max-width: 100vw; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .steps { overflow-x: auto; padding-bottom: .35rem; }
  .step { flex: 0 0 6.5rem; }
  .page-head { flex-direction: column; }
  .page-actions { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .drawer-dialog[open] article { animation: none; }
  .obj-card, .ai-tab, .icon-btn { transition: none; }
}


/* ---- 策略横幅（链页 / 总览页共用）----
   一句话回答"现在生效的是谁 / 我正在看哪一版"，外加这一版能做的动作。
   零策略是**应急停机**的正当状态，但必须显眼（客户端此时拿不到任何别名），
   所以那种情况走 `article.flash.err`（既有样式），不在这里。 */
.policy-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  margin-bottom: .9rem; padding: .5rem .7rem;
  border: 1px solid var(--hairline); border-left: 3px solid var(--brand);
  border-radius: var(--radius-control); background: #fbfcfd;
  font-size: .8125rem;
}
.policy-banner.is-draft { border-left-color: var(--warn); }
.policy-banner .grow { flex: 1 1 auto; min-width: 0; }
.policy-banner .banner-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.policy-banner strong { font-weight: 600; color: var(--ink); }
.policy-banner form { display: inline; margin: 0; }

/* ---- 供应商卡片上的探针行（引入新上游时的验证步骤）----
   四个按钮一行；结果片段换入下面的容器（HTMX）。窄屏允许换行。 */
.probe-row { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }
.probe-row form { display: inline; margin: 0; }

/* ============================================================
   档位页（/admin/plans）：等宽数字列 + 容量条 + 口径脚注
   ============================================================ */

/* 等宽数字列（费率 / token / 金额 / 人数）：不对齐就没法竖着比大小。
   **只作用于表格单元格**：`.num` 早先被落地页与账户页当作"大号数字"用在 <p> 上
   （`.landing .plan .num` 等），一条全局 `.num` 会把那些段落一起右对齐。 */
th.num, td.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* 表格里的状态徽章不换行：窄列里 Pico 会按字断行，把「启用」竖着排成「启/用」。
   同 `td > button` 那条（见"表格单元格里的按钮"注释）—— 一句话的标签不该被拆成两行。 */
td .tag { white-space: nowrap; }

/* 容量条（每行一条）：底 = 月度上限，填充 = 已承诺额度。
   为什么用 SVG 而不是 <progress>：要画出 **80% 那道参考刻度** —— 而容量校验的全部意义
   就是"离那条线还有多远"。x/width 是几何属性不是样式（CSP `style-src 'self'` 不管它们）。 */
.cap-bar { display: block; width: 100%; height: .7rem; }
.cap-track { fill: #edf1f4; }
.cap-fill { fill: var(--ok); }
.cap-fill.is-warn { fill: var(--warn); }
.cap-fill.is-bad { fill: var(--err); }
.cap-tick { stroke: #fff; stroke-width: .5; }
.cap-tick.is-limit { stroke: var(--brand-deep); stroke-width: .7; }

/* 口径脚注：每张报表底部一句"这些数是怎么来的"（承诺上限/额度折算/颜色阈值都在这里解释）。
   颜色必须自带解释 —— 只给颜色不给原因是缺陷，不是简洁。 */
.foot-note {
  margin: .6rem 0 0; padding-top: .55rem;
  border-top: 1px solid var(--hairline);
  font-size: .75rem; line-height: 1.6; color: var(--pico-muted-color);
}
.foot-note code { font-size: .6875rem; }

