/* 服务端网页：设计 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-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; }
.inline button { padding: .25rem .6rem; font-size: .8rem; width: auto; }

/* 提示条：淡底 + 同色文字 + 发丝边（比"左侧色条"更接近产品化观感） */
.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(--pico-color); 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 a { display: inline-flex; align-items: center; color: var(--pico-muted-color); font-size: 12px; }
.landing footer .footnote a:hover { color: var(--brand); }

@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; }
.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(--pico-color); 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; }

/* 窄屏：侧栏变抽屉，靠 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;
}
.nav-toggle-icon, .nav-toggle-icon::before, .nav-toggle-icon::after {
  display: block; width: 1.1rem; height: 2px; background: var(--pico-color); 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);
  }
}

