/* auth-ui — 设计系统（落地自设计稿 proto/styles.css，布局对齐 proto/*.jsx）
   ────────────────────────────────────────────────────────────────
   主题两维度，由 flow.js 按 localStorage 注入 <html>，无 JS 也有完整默认：
     · data-mode  light | dark      —— 不设则 @media 跟随系统
     · --accent   主色，flow.js 用 CSSOM 注入（不受 CSP style-src 限制）
   设计方向固定「柔和」（2026-07 用户拍板：a 经典 / c 紧凑变体已退役）。
   默认 = 主色 #2a6fdb + 跟随系统深浅。 */

:root {
  --accent: #2a6fdb;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;

  /* 几何 / 密度（默认柔和：大圆角宽留白） */
  --r-card: 26px;
  --r-row: 12px;
  --r-ctl: 999px;
  --r-fld: 10px;
  --pad-card: 28px;
  --pad-row: 16px;
  --h-ctl: 42px;
  --h-topbar: 64px;
  --w-nav: 264px;
  --fw-head: 480;

  /* 浅色（默认）。柔和方向：着色背景 + 卡片无边框（--hairline 透明） */
  --ink: #1d212b;
  --muted: #5d6573;
  --bg: oklch(96.5% 0.012 250);
  --surface: #ffffff;
  --surface-2: oklch(95% 0.014 250);
  --line: #dde1e8;          /* 线框色（经典/紧凑方向用） */
  --hairline: transparent;  /* 卡片描边：柔和方向透明 */
  --sep: oklch(92% 0.014 250); /* 行分隔线 */
  --accent-ui: var(--accent);
  --on-accent: #ffffff;
  --danger: #c5333b;
  --success: #1d7d4f;
  --warn: #9a6700;
  --scrim: rgb(25 28 35 / 0.45);

  /* 派生色（随上面变量动态重算） */
  --accent-soft: color-mix(in oklab, var(--accent-ui) 13%, var(--surface));
  --accent-softer: color-mix(in oklab, var(--accent-ui) 8%, var(--surface));
  --accent-strong: color-mix(in oklab, var(--accent-ui) 88%, var(--ink));
  --danger-soft: color-mix(in oklab, var(--danger) 13%, var(--surface));
  --success-soft: color-mix(in oklab, var(--success) 14%, var(--surface));
  --warn-soft: color-mix(in oklab, var(--warn) 16%, var(--surface));
  --focus-ring: color-mix(in oklab, var(--accent-ui) 30%, transparent);
}

/* 深色 token（系统深色且未强制浅色，或用户强制深色） */
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) {
    --ink: #e8eaef;
    --muted: #99a0ac;
    --bg: #11141b;
    --surface: #1c2029;
    --surface-2: #252a36;
    --line: #343945;
    --hairline: transparent;
    --sep: #2b303c;
    --accent-ui: color-mix(in oklab, var(--accent) 62%, #dce6ff);
    --on-accent: #10131c;
    --danger: #ff7a80;
    --success: #5ecb96;
    --warn: #e3b341;
    --scrim: rgb(0 0 0 / 0.55);
  }
}
html[data-mode="dark"] {
  --ink: #e8eaef;
  --muted: #99a0ac;
  --bg: #11141b;
  --surface: #1c2029;
  --surface-2: #252a36;
  --line: #343945;
  --hairline: transparent;
  --sep: #2b303c;
  --accent-ui: color-mix(in oklab, var(--accent) 62%, #dce6ff);
  --on-accent: #10131c;
  --danger: #ff7a80;
  --success: #5ecb96;
  --warn: #e3b341;
  --scrim: rgb(0 0 0 / 0.55);
}

/* ───────── 基础 ───────── */
* { box-sizing: border-box; }
html, body { margin: 0; }
/* 预留滚动条槽位：短页（无滚动条）与长页（有滚动条)切换时，
   居中内容不再左右跳动（经典滚动条系统可见；overlay 滚动条本就零宽）。 */
html { scrollbar-gutter: stable; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}
h1, h2, h3 { margin: 0; font-weight: var(--fw-head); letter-spacing: 0.005em; text-wrap: balance; }
/* 日文正文按词组断行（Chromium 119+，不支持的浏览器忽略）。 */
:lang(ja) { word-break: auto-phrase; line-break: strict; } /* strict：小假名（ィ ッ）与长音符不出现在行首 */
/* 标题用普通断行 + 上面的 text-wrap: balance 均分各行（桌面排版保持不变）；单栏（≤ 920px）
   的窄屏标题改回 auto-phrase，见下方响应式段——普通断行会在片假名词里断开（「アカ／ウント」）。 */
:lang(ja) :is(h1, h2, h3) { word-break: normal; }
a { color: var(--accent-ui); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ───────── 品牌标 ───────── */
.mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent-ui), color-mix(in oklab, var(--accent-ui) 55%, #9fc3ff));
  color: var(--on-accent);
  font-weight: 800;
  font-size: 15px;
  flex: none;
}
.mark-lg { width: 44px; height: 44px; border-radius: 13px; font-size: 22px; }
/* 运行期上传的品牌图（general.logo）：沿用 .mark 的盒子，去掉字母标的渐变底；
   主题变量不参与（图片自带配色），亮/暗两套下盒子一致。 */
.mark-logo { background: none; object-fit: contain; }
.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; color: var(--ink); }
.wordmark:hover { text-decoration: none; }
.wordmark .muted { font-weight: 400; color: var(--muted); }

/* ───────── 认证壳（设计稿 AuthLayout：900px 双栏卡，头左 · 表单右） ───────── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px 16px;
}
.auth-card {
  width: 100%;
  max-width: 1040px;
  min-height: 402px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--r-card) + 8px);
  padding: 36px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}
.auth-card.narrow {
  max-width: 460px;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  min-height: 0;
}
.auth-card.narrow .auth-head { margin-bottom: 22px; }
.auth-head { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.auth-head h1 { font-size: 32px; line-height: 1.25; }
.auth-head .sub { margin: 0; color: var(--muted); font-size: 15px; }
.auth-body { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.auth-card:not(.narrow) .auth-body { padding-top: 81px; }
.auth-card:not(.narrow) .auth-body > .flow-form { flex: 1; }
.auth-foot {
  width: 100%;
  max-width: 1040px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12.5px;
  padding: 0 8px;
  gap: 8px 12px;
  flex-wrap: wrap;
}
.auth-foot .links { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.auth-foot .links > span { white-space: nowrap; }
.auth-foot a { color: var(--muted); }

/* 账号 chip（授权页等显示当前账号） */
.acct-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  overflow-wrap: anywhere;
  gap: 8px;
  padding: 4px 12px 4px 5px;
  border: 1px solid var(--sep);
  border-radius: 999px;
  font-size: 13.5px;
  background: transparent;
  color: var(--ink);
}
.acct-chip .avatar { width: 22px; height: 22px; font-size: 11px; }

/* ───────── 表单（render/form.html 唯一表单） ───────── */
.flow-form { display: flex; flex-direction: column; gap: 16px; }

/* 浮动 label：input 在前 + placeholder=" "，label 在后靠 :placeholder-shown 联动 */
.fld { position: relative; display: flex; flex-direction: column; }
.fld > input {
  appearance: none;
  font-family: var(--font);
  width: 100%;
  height: 54px;
  padding: 20px 14px 6px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-fld);
  background: transparent;
  color: var(--ink);
  font-size: 15.5px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.fld > input { border-color: var(--sep); background: var(--surface-2); }
.fld.has-trail > input { padding-right: 46px; }
.fld > .fld-label {
  position: absolute;
  left: 14px;
  top: 16px;
  color: var(--muted);
  font-size: 15px;
  pointer-events: none;
  transition: top 0.13s ease, font-size 0.13s ease, color 0.13s ease;
}
.fld > input:focus + .fld-label,
.fld > input:not(:placeholder-shown) + .fld-label { top: 6px; font-size: 11.5px; }
.fld > input:focus + .fld-label { color: var(--accent-ui); }
.fld > input:focus { outline: none; border-color: var(--accent-ui); box-shadow: 0 0 0 3px var(--focus-ring); }
.fld > input:disabled { opacity: 0.6; cursor: not-allowed; }
.fld.field-invalid > input { border-color: var(--danger); }
.fld.field-invalid > .fld-label { color: var(--danger); }
.fld-label em { color: var(--danger); font-style: normal; margin-left: 2px; }
/* Select (the traits.locale language choice): same box as an input, label always raised. */
.fld > select {
  appearance: none;
  font-family: var(--font);
  width: 100%;
  height: 54px;
  padding: 20px 14px 6px;
  border: 1px solid var(--sep);
  border-radius: var(--r-fld);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 15.5px;
}
.fld > select:focus { outline: none; border-color: var(--accent-ui); box-shadow: 0 0 0 3px var(--focus-ring); }
.fld-select > .fld-label { top: 6px; font-size: 11.5px; }
.fld.field-invalid > select { border-color: var(--danger); }

/* 显隐密码按钮（flow.js 注入，eye 图标） */
.fld .trail {
  position: absolute;
  right: 8px;
  top: 27px;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font);
}
.fld .trail:hover { background: var(--surface-2); color: var(--ink); }

/* 字段级提示 / 错误 */
.field-message { font-size: 12.5px; margin-top: 5px; }
.field-message.error { color: var(--danger); }
.field-message.info { color: var(--muted); }
.field-message.success { color: var(--success); }

/* 分格验证码输入（flow.js 渐进增强，无 JS 回退普通输入框） */
/* 六格按行宽均分、最宽 48px：宽屏仍是 48px × 6，窄屏（≤ 360 px 的卡片）收缩到 ≥ 36px 而不撑破卡片。 */
.code-row { display: flex; gap: var(--code-gap, 10px); }
.code-caption { margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.code-cell {
  flex: 1 1 0;
  min-width: 0;
  max-width: 48px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  border: 1px solid var(--sep);
  border-radius: var(--r-fld);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font);
}
.code-cell:focus { outline: none; border-color: var(--accent-ui); box-shadow: 0 0 0 3px var(--focus-ring); }

/* 复选框 */
.checkbox { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink); }
.checkbox input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent-ui); flex: none; }

/* ───────── 按钮（自适应宽度胶囊，不全宽） ───────── */
.btn {
  appearance: none;
  font-family: var(--font);
  height: var(--h-ctl);
  padding: 0 24px;
  border-radius: var(--r-ctl);
  border: none;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent-ui); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-outline { background: transparent; color: var(--ink); border: 1px solid var(--sep); }
.btn-outline:hover { background: var(--surface-2); }
.btn-text { background: transparent; color: var(--accent-ui); padding: 0 14px; }
.btn-text:hover { background: var(--accent-softer); }
.btn-danger-text { background: transparent; color: var(--danger); padding: 0 14px; }
.btn-danger-text:hover { background: var(--danger-soft); }
.btn-sm { height: 34px; padding: 0 16px; font-size: 13.5px; }
.btn svg { flex: none; }

.btn-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn-row.split { justify-content: space-between; }
.btn-row.end { justify-content: flex-end; }
/* 认证页操作行（Google 实测几何）：贴底右对齐成组，按钮间距 24 */
.flow-form > .btn-row.actions { margin-top: auto; justify-content: flex-end; gap: 24px; padding-top: 24px; }
.flow-form > .btn-row.actions > .btn-row { gap: 24px; }
/* DOM 里主按钮组在前（回车默认提交 = 第一个 submit），视觉上仍在右：order 把它排到最后。
   JS 插入的向导「上一步」（order 0）因此仍在次要组之前。 */
.flow-form > .btn-row.actions > .actions-primary { order: 1; }

/* 辅助登录方式：小胶囊横排（设计稿 alt-row） */
.alt-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.alt-row .btn { height: 36px; padding: 0 16px; font-size: 13px; font-weight: 500; color: var(--ink); }
.alt-row .btn svg { color: var(--accent-ui); }

/* 「使用其他平台登录」选择屏（整屏切换：点入口 → 隐藏主列、铺开平台选项 + 返回） */
.flow-form.alt-open > *:not([data-alt-screen]) { display: none; }
.alt-screen { display: flex; flex-direction: column; gap: 10px; }
.alt-screen-title { margin: 0 0 4px; font-size: 14px; color: var(--muted); }
.alt-back { align-self: flex-start; padding: 0; height: auto; font-size: 13px; }
.alt-choice { justify-content: flex-start; height: 48px; padding: 0 16px; font-size: 14.5px; font-weight: 500; gap: 12px; color: var(--ink); }
.alt-choice svg { color: var(--accent-ui); }

/* 注册向导：姓名屏的「姓 / 名」并排 */
.name-pair { display: flex; gap: 12px; }
.name-pair .fld { flex: 1; }
.name-pair .fld > input {
  height: 54px; padding: 20px 14px 6px; border-radius: var(--r-fld);
  border: 1px solid var(--sep); background: var(--surface-2);
  color: var(--ink); font-size: 15.5px; font-family: var(--font); width: 100%;
}
.name-pair .fld > input:focus { outline: none; border-color: var(--accent-ui); box-shadow: 0 0 0 3px var(--focus-ring); }

/* 注册方法选择卡（单选；渐进增强：无 JS 时 .js-only 隐藏、直接展示完整表单） */
.js-only { display: none; }
.reg-hidden { display: none !important; }
.choice-cards { display: flex; flex-direction: column; gap: 12px; border: none; margin: 0; padding: 0; }
.choice-cards.js-only { display: none; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--sep);
  border-radius: var(--r-fld);
  background: var(--surface-2);
  font-size: 14.5px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.choice input[type="radio"] { width: 17px; height: 17px; accent-color: var(--accent-ui); flex: none; }
.choice .ci { display: grid; place-items: center; color: var(--accent-ui); flex: none; }
.choice:has(input:checked) { border-color: var(--accent-ui); background: var(--accent-softer); }
.choice-cards .btn-row.actions { justify-content: flex-end; padding-top: 12px; }

/* 表单内小字链接 / 触发器（忘记密码、通行密钥入口） */
.link-btn, .flow-anchor {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  align-self: flex-start;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--accent-ui);
  cursor: pointer;
  text-decoration: none;
}
.link-btn:hover, .flow-anchor:hover { text-decoration: underline; }

/* ───────── 分隔线 / 横幅 ───────── */
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--sep); }

.banner {
  padding: 10px 14px;
  border-radius: var(--r-row);
  font-size: 13.5px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.banner-error { background: var(--danger-soft); color: var(--danger); }
.banner-info { background: var(--accent-softer); color: var(--ink); }
.banner-success { background: var(--success-soft); color: var(--success); }
.banner a { color: inherit; text-decoration: underline; }
.banner svg { flex: none; margin-top: 2px; }

/* ───────── 徽章 / 头像 ───────── */
.badge { font-style: normal; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.badge-accent { background: var(--accent-soft); color: var(--accent-ui); }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-ui);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  flex: none;
  user-select: none;
  overflow: hidden;
}
.avatar-lg { width: 84px; height: 84px; font-size: 36px; }
.avatar-md { width: 48px; height: 48px; font-size: 20px; }
.avatar-xl { width: 180px; height: 180px; font-size: 72px; }
img.avatar { object-fit: cover; }

/* 头像卡（Google 形态）：可点大头像 + 相机徽章 + 右侧说明/入口 */
.avatar-card { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.avatar-card h2 { font-size: 17px; }
.avatar-card .desc { margin: 3px 0 10px; color: var(--muted); font-size: 13px; }
.avatar-edit {
  position: relative;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  flex: none;
}
.avatar-edit .avatar { display: block; }
/* 字母头像要保持网格居中（块级 grid，不留 inline 行距）；上面的 block 只给 <img>。 */
.avatar-edit span.avatar { display: grid; }
.avatar-badge {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--sep);
  display: grid;
  place-items: center;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.15);
}
.avatar-edit:hover .avatar-badge { background: var(--surface-2); }
.avatar-side { display: flex; flex-direction: column; align-items: flex-start; }
/* JS 就绪（html.js-on）后隐藏无 JS 回退表单 */
html.js-on .avatar-plain { display: none; }
.avatar-plain { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.avatar-actions { display: flex; flex-direction: column; gap: 10px; }
.avatar-actions form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }
.avatar-actions input[type="file"] { font-size: 13px; color: var(--muted); max-width: 300px; }

/* 头像对话框 */
.avatar-dlg { align-items: center; text-align: center; }
.avatar-dlg .dlg-head { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left; }
.avatar-stage { padding: 8px 0; }
.avatar-stage .avatar { display: block; }
.avatar-stage span.avatar { display: grid; }
.avatar-dlg p.avatar-hint { font-size: 12.5px; }
.avatar-dlg form { margin: 0; }
.avatar-dlg [hidden], .dlg [hidden] { display: none; }
.dlg-actions { justify-content: center; }

/* ───────── 账户中心壳（设计稿 AppShell） ───────── */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: var(--h-topbar);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .spacer { flex: 1; }
.iconbtn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-family: var(--font);
  padding: 0;
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }

/* 账号弹出菜单（<details> 实现，无额外 JS 依赖；flow.js 补外点关闭） */
.acct-menu { position: relative; }
.acct-menu > summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; }
.acct-menu > summary::-webkit-details-marker { display: none; }
.acct-menu > summary:hover { background: var(--surface-2); }
.acct-pop {
  position: absolute;
  top: 48px;
  right: 0;
  z-index: 45;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 22px 22px 16px;
  width: 264px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 0 14px 50px rgb(0 0 0 / 0.22);
}
.acct-pop .who { text-align: center; line-height: 1.35; }
.acct-pop .who .nm { font-weight: 600; }
.acct-pop .who .em { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.acct-pop .theme-ctl { margin-top: 4px; }

.layout { flex: 1; display: flex; min-height: 0; }
/* 侧导航钉在 topbar 下不随页滚；仅自身超出视口时才在内部滚动。
   sticky 在 flex 容器内必须配 align-self: flex-start（默认 stretch 会拉满行高使 sticky 失效）。 */
.navrail {
  width: var(--w-nav);
  flex: none;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: var(--h-topbar);
  align-self: flex-start;
  max-height: calc(100vh - var(--h-topbar));
  overflow-y: auto;
}
.navrail > * { flex: none; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  height: 44px;
  border-radius: var(--r-ctl);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ui); font-weight: 600; }
.nav-item .ni { width: 20px; display: grid; place-items: center; opacity: 0.85; flex: none; }
.nav-sep { height: 1px; background: var(--sep); margin: 10px 16px; border: none; }

.main { flex: 1; min-width: 0; padding: 28px 24px 64px; }
.content { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.page-head h1 { font-size: 26px; }
.page-head .sub { margin: 0; color: var(--muted); font-size: 14px; text-wrap: pretty; }
.page-head.centered { align-items: center; text-align: center; gap: 12px; padding: 16px 0 8px; }
.page-head.centered h1 { font-size: 30px; }

/* ───────── 分组卡片 / 列表行（设计稿 GCard / GRow） ───────── */
.gcard { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card); overflow: hidden; display: flex; flex-direction: column; }
.gcard-head { padding: var(--pad-card) var(--pad-card) 8px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.gcard-head h2 { font-size: 17px; }
.gcard-head .desc { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.gcard-pad { padding: var(--pad-card); }
.gcard-foot { margin-top: auto; padding: 10px var(--pad-card) calc(var(--pad-card) - 8px); }
.gcard-empty { padding: var(--pad-card); color: var(--muted); font-size: 14px; }

.grow {
  display: flex;
  align-items: center;
  gap: var(--grow-gap);
  --grow-gap: 16px;
  --gicon: 38px;
  --gl-w: 132px;
  --grow-indent: calc(var(--gicon) + var(--grow-gap));
  padding: var(--pad-row) var(--pad-card);
  width: 100%;
  text-align: left;
  font-family: var(--font);
  font-size: 14.5px;
  color: var(--ink);
  border-top: 1px solid var(--sep);
}
.grow:first-child, .gcard-head + .grow, .gcard-head + * > .grow:first-child { border-top: none; }
a.grow, button.grow, summary.grow { cursor: pointer; text-decoration: none; border-left: none; border-right: none; border-bottom: none; background: transparent; }
a.grow:hover, button.grow:hover, summary.grow:hover { background: var(--surface-2); text-decoration: none; }
.grow .gl { width: var(--gl-w); flex: none; color: var(--muted); font-size: 13px; }
.grow .gv { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.grow .gv .primary { font-weight: 500; overflow-wrap: anywhere; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grow .gv .secondary { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.grow .chev { color: var(--muted); flex: none; }
.grow-long { display: grid; grid-template-columns: var(--gl-w) minmax(0, 1fr); align-items: center; column-gap: var(--grow-gap); row-gap: 6px; }
.grow-long > .gl { width: auto; }
.grow-long > .gmeta { grid-column: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.grow-long .verify-link { margin-left: 0; }
.grow .when { color: var(--muted); font-size: 12.5px; flex: none; white-space: nowrap; }
.grow .gicon { width: var(--gicon); height: var(--gicon); flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--ink); }
.grow form { flex: none; margin: 0; }

/* 设置页凭证分组：<details> 展开行（summary = GRow，展开 = inline-edit） */
details.sec > summary.grow { list-style: none; }
details.sec > summary.grow::-webkit-details-marker { display: none; }
details.sec > summary .chev { transition: transform 0.15s ease; }
details.sec[open] > summary .chev { transform: rotate(90deg); }

.cards-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: stretch; }

.inline-edit {
  padding: 4px var(--pad-card) var(--pad-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 1px solid var(--sep);
  background: var(--accent-softer);
}
.inline-edit .flow-text { font-size: 13px; }
.inline-edit img { background: #fff; border-radius: 8px; align-self: flex-start; }

/* consent scope 列表 */
.scope-rows { display: flex; flex-direction: column; border: 1px solid var(--hairline); border-radius: var(--r-row); overflow: hidden; background: var(--surface-2); }
.scope-row { display: flex; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--sep); align-items: flex-start; }
.scope-row:first-child { border-top: none; }
.scope-row .scol { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.scope-row .sname { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; color: var(--accent-ui); }
.scope-row .sdesc { font-size: 13.5px; }

/* 安全活动时间线日期分隔 */
.tl-date { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 14px var(--pad-card) 2px; }

/* 通用文案 */
.flow-text { margin: 0; color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.flow-caption { margin: 0; font-size: 13.5px; font-weight: 600; }
.flow-image { display: block; margin: 4px 0; background: #fff; border-radius: 8px; max-width: 100%; height: auto; }
.muted { color: var(--muted); }
.subtitle { margin: 0; color: var(--muted); font-size: 14.5px; }
.alt-action { margin: 0; color: var(--muted); font-size: 13.5px; }
.verify-link { margin-left: 6px; font-weight: 600; color: var(--accent-ui); }
.fine-print { margin: 0; font-size: 12.5px; color: var(--muted); }

/* ───────── 主题切换控件（flow.js 注入构建） ───────── */
.theme-ctl { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; }
.theme-row { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.theme-ctl button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 12.5px;
  padding: 4px 8px;
  border-radius: 8px;
  white-space: nowrap;
}
.theme-ctl button:hover { background: var(--surface-2); color: var(--ink); }
.theme-ctl button.on { color: var(--accent-ui); background: var(--accent-softer); }
.theme-swatch { width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--sep); padding: 0; }

/* Locale switcher (templates/locale_switcher.html): plain form, no script. */
.locale-ctl { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12.5px; color: var(--muted); }
.locale-ctl label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.locale-ctl .btn { white-space: nowrap; }
.locale-ctl select {
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--sep);
  border-radius: 8px;
  padding: 3px 6px;
}
.locale-ctl .btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }

/* ───────── 对话框 / 错误详情 ───────── */
.dlg-scrim { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 50; padding: 20px; }
.dlg-scrim[hidden] { display: none; }
.dlg { width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--r-card); padding: var(--pad-card); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgb(0 0 0 / 0.3); }
.dlg h2 { font-size: 18px; }
.dlg p { margin: 0; color: var(--muted); font-size: 14px; }

.error-detail { font-size: 13px; color: var(--muted); }
.error-detail summary { cursor: pointer; }
.error-detail pre { background: var(--surface-2); padding: 12px 14px; border-radius: var(--r-fld); overflow: auto; font-size: 12px; margin: 8px 0 0; }
.error-detail code, .alt-action code, .fine-print code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* ───────── 响应式 ───────── */
.nav-scrim { display: none; }
.nav-toggle { visibility: hidden; }
@media (max-width: 920px) {
  .nav-toggle { visibility: visible; }
  .auth-card { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 32px 24px; max-width: 460px; min-height: 0; }
  /* 单栏后表单紧随标题块（行距即上面的 gap）；双栏时用来与标题对齐的 81px 顶部偏移不再适用。 */
  .auth-card:not(.narrow) .auth-body { padding-top: 0; }
  /* 日文标题按词组断行；词组比行宽还长时 overflow-wrap: anywhere 才允许词内断开（兜底，标题
     不溢出卡片）；≤ 360px 的标题字号让最长的词组（「メールアドレスの」）放得进一行。不支持
     auto-phrase 的引擎沿用普通断行 + text-wrap: balance（可能在词内断，但不溢出）。 */
  :lang(ja) :is(h1, h2, h3) { word-break: auto-phrase; overflow-wrap: anywhere; }
  .auth-foot { max-width: 460px; }
  .navrail {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    max-height: none;
    align-self: auto;
    background: var(--surface);
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    padding-top: 20px;
  }
  .navrail.open { transform: none; box-shadow: 0 0 40px rgb(0 0 0 / 0.18); }
  .nav-scrim.show { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 35; }
  .cards-2 { grid-template-columns: 1fr; }
  .grow { --gl-w: 96px; }
}
/* 窄屏：带时间列/行尾操作的行（.grow-stack）让标题列占满首行余宽，时间与操作落到标题下方。 */
@media (max-width: 480px) {
  .grow-long { grid-template-columns: minmax(0, 1fr); }
  .grow-long > .gmeta { grid-column: 1; }
  .grow-stack { flex-wrap: wrap; row-gap: 4px; }
  .grow-stack > .gv { flex: 1 1 calc(100% - var(--grow-indent)); }
  .grow-stack > .when { margin-left: var(--grow-indent); }
  .grow-stack > .btn { margin-left: calc(var(--grow-indent) - 16px); } /* .btn-sm 的左内边距：文字与标题左对齐 */
}
/* 超窄屏：卡片内边距随 --pad-card 收小，列表行标签列变窄，值列不再被挤成逐字换行；
   页脚居中换行；验证码六格的间距收紧（格宽由 .code-cell 的 flex 自适应，见上）。 */
@media (max-width: 480px) {
  :root { --pad-card: 20px; }
  .main { padding: 20px 16px 48px; }
  .grow { --gl-w: 84px; --grow-gap: 12px; }
  :lang(ja) .grow { --gl-w: 96px; }
  .auth-foot { justify-content: center; }
  .code-row { --code-gap: 8px; }
}
@media (max-width: 360px) {
  :root { --pad-card: 16px; }
  .main { padding-inline: 12px; }
  .auth-shell { padding: 16px 12px; }
  .auth-card { padding: 28px 18px; }
  :lang(ja) .auth-head h1 { font-size: 28px; }
  .code-row { --code-gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
/* 凭证方式屏自动前进时整页隐藏，防闪现 */
html.reg-advancing body { visibility: hidden; }

/* ───────── CAPTCHA slots (A9; render/form.html, js/captcha.js) ─────────
   Turnstile draws inside its own iframe. The ALTCHA widget is themed through its custom
   properties: vendor/altcha/altcha.css derives several of them from others on :root (border,
   input, spinner), so those are set here directly instead of relying on the base values. */
.captcha {
  display: grid;
  gap: 8px;
}
.captcha-slot[data-provider="turnstile"] {
  display: flex;
  justify-content: flex-start;
}
.captcha-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.captcha altcha-widget {
  display: block;
  --altcha-color-primary: var(--accent-ui);
  --altcha-color-primary-content: var(--on-accent);
  --altcha-color-base: var(--surface);
  --altcha-color-base-content: var(--ink);
  --altcha-color-neutral: var(--line);
  --altcha-color-neutral-content: var(--muted);
  --altcha-color-success: var(--success);
  --altcha-color-error: var(--danger);
  --altcha-border-color: var(--line);
  --altcha-border-radius: var(--r-fld);
  --altcha-checkbox-border-color: var(--line);
  --altcha-input-background-color: var(--surface);
  --altcha-input-color: var(--ink);
  --altcha-spinner-color: var(--ink);
  --altcha-popover-color: var(--line);
  --altcha-max-width: 100%;
}
