/* ============================================================
   public/styles.css —— 零构建 / 零外部依赖 / 日夜间双主题

   分区索引（改动只在自己的分区内，禁止跨区追加）
     0  文件头与索引              1  Tokens
     2  基础重置与 [hidden]       3  骨架（shell / sidebar / topbar / content）
     4  通用组件（btn/input/badge/search/seg/alert/skeleton/empty/toast/dlg）
     5  KPI                       6  账号页
     7  日志页                    8  设置页
     9  认证页                    10 响应式（1100 / 900 / 700 / 560 / 380）
     11 动效与 reduced-motion
   ============================================================ */

/* ============ 1. Tokens（:root = 暗色兜底；light 覆盖） ============ */

:root {
  color-scheme: dark;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 14px;
  --sidebar-w: 232px;
  --dur: 160ms;

  --bg: #070a0d;
  --panel: #0e141a;
  --panel-2: #131b22;
  --panel-3: #19232c;
  --border: #1d2833;
  --border-strong: #2b3947;
  --text: #e6eef6;
  --text-2: #9dadbb;
  /* 5.55:1 on #0e141a —— 次级文字（.hint/.dim/.kpi-foot/.log-time small）按 WCAG AA 4.5 留足余量 */
  --muted: #7d8f9e;

  --primary: #2fe3a6;
  --primary-hover: #55eeb9;
  --primary-ink: #04140e;
  /* 专门用于「用主色写字」（如 .plan.pro 徽标）：亮色下 --primary 直接当文字只有 3.4:1，
     而它同时是按钮填充色不能动，所以文字另给一个更深的同色系 token。 */
  --primary-text: #2fe3a6;
  --primary-soft: rgba(47, 227, 166, .11);
  --primary-ring: rgba(47, 227, 166, .32);

  --danger: #ff6f61;
  --danger-soft: rgba(255, 111, 97, .12);
  --danger-line: rgba(255, 111, 97, .30);

  --warn: #f2b544;
  --warn-soft: rgba(242, 181, 68, .12);
  --warn-line: rgba(242, 181, 68, .32);

  --ok: #3fdc9c;
  --ok-soft: rgba(63, 220, 156, .12);
  --ok-line: rgba(63, 220, 156, .28);

  --info: #7fa9ff;
  --info-soft: rgba(127, 169, 255, .12);
  --info-line: rgba(127, 169, 255, .28);

  --mute-soft: rgba(255, 255, 255, .05);

  --shadow: 0 1px 2px rgba(0, 0, 0, .5);
  --grid-line: #18222c;
  --sidebar-bg: #0a0f14;
  --overlay: rgba(4, 8, 15, .66);
  --ring: 0 0 0 3px rgba(47, 227, 166, .30);
  --panel-glass: rgba(10, 15, 20, .86);

  /* 自绘下拉箭头：stroke 颜色写死在 data-URI 里，不跟随 currentColor，因此按主题各写一条 */
  --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'><path d='M2.8 4.4L6 7.6L9.2 4.4' fill='none' stroke='%237d8f9e' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}

html[data-theme="light"] {
  color-scheme: light;

  --bg: #f6f8fa;
  --panel: #ffffff;
  --panel-2: #f1f4f7;
  --panel-3: #e9eef3;
  --border: #dbe2e8;
  --border-strong: #c5ced8;
  --text: #0f1519;
  --text-2: #4a5763;
  /* 5.45:1 on #ffffff / 5.12:1 on #f6f8fa —— 满足 WCAG AA 4.5 */
  --muted: #5f6b76;

  --primary: #0d9373;
  --primary-hover: #0a7a5f;
  --primary-ink: #ffffff;
  --primary-text: #0a7a5f;
  --primary-soft: rgba(13, 147, 115, .10);
  --primary-ring: rgba(13, 147, 115, .28);

  --danger: #c92b1f;
  --danger-soft: rgba(207, 47, 35, .09);
  --danger-line: rgba(207, 47, 35, .26);

  --warn: #a05405;
  --warn-soft: rgba(168, 90, 6, .10);
  --warn-line: rgba(168, 90, 6, .26);

  --ok: #06734d;
  --ok-soft: rgba(6, 115, 77, .10);
  --ok-line: rgba(6, 115, 77, .24);

  --info: #175cd3;
  --info-soft: rgba(23, 92, 211, .09);
  --info-line: rgba(23, 92, 211, .24);

  --mute-soft: rgba(15, 21, 25, .04);

  --shadow: 0 1px 2px rgba(16, 24, 32, .05), 0 1px 3px rgba(16, 24, 32, .04);
  --grid-line: #e7ecf1;
  --sidebar-bg: #ffffff;
  --overlay: rgba(16, 24, 32, .42);
  --ring: 0 0 0 3px rgba(13, 147, 115, .24);
  --panel-glass: rgba(255, 255, 255, .88);

  --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'><path d='M2.8 4.4L6 7.6L9.2 4.4' fill='none' stroke='%235f6b76' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}

/* ============ 2. 基础重置与 [hidden] ============ */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* 唯一真相：所有显隐一律走 hidden 属性，禁止用 class 控制可见性。
   !important 让「类选择器里的 display:grid|flex」永远不会盖掉 [hidden]。 */
[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
p { margin: 0; }

button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--panel-3);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--text-2);
}

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.warn-text { color: var(--warn); font-size: 12.5px; }

/* 流程状态行（OAuth 授权：等待 / 成功 / 过期 / 出错）：默认次要色，靠修饰类换色 */
.status-line { margin: 0; font-size: 11.5px; line-height: 1.55; color: var(--muted); }
.status-line.is-ok { color: var(--ok); }
.status-line.is-warn { color: var(--warn); }
.status-line.is-bad { color: var(--danger); }

/* 图标：尺寸由上下文覆盖 */
.ic { width: 14px; height: 14px; flex: none; }
.log-chevron .ic { width: 12px; height: 12px; }
.nav-item .ic { width: 15px; height: 15px; }
.kpi-label .ic { width: 12px; height: 12px; }
.set h3 .ic { width: 13px; height: 13px; color: var(--muted); }
.search .ic { width: 13px; height: 13px; opacity: .7; }
.view-toggle .ic { width: 15px; height: 15px; }

/* 静态精灵容器：不占位、不拦截点击 */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ============ 3. 骨架 ============ */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 0 0 12px;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 18px;
}

.side-brand-text { display: flex; flex-direction: column; min-width: 0; }

.brand-name {
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -.01em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .03em;
  margin-top: 1px;
}

.logo {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex: none;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--primary), #0b6b55);
  color: var(--primary-ink);
  box-shadow: 0 0 0 1px var(--primary-ring) inset;
}

.logo .ic { width: 15px; height: 15px; }

.nav-group { padding: 0 8px 6px; }

.nav-label {
  font-size: 10.5px;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 8px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13px;
  border: 1px solid transparent;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}

.nav-item .ic { opacity: .8; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.is-active {
  background: var(--primary-soft);
  color: var(--text);
  border-color: var(--primary-ring);
  font-weight: 560;
}
.nav-item.is-active .ic { opacity: 1; color: var(--primary); }

.nav-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 导航文字（≤700 变成底部 Tab 的图标 + 文字两行结构时靠它撑开） */
.nav-t { display: block; }

.side-foot {
  margin-top: auto;
  padding: 12px 12px 0;
  border-top: 1px solid var(--border);
}

.side-stat {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  padding: 3px 4px;
}

.side-stat b {
  color: var(--text-2);
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 52px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

/* 渐进增强：支持 backdrop-filter 才用半透明玻璃，否则保留上面的不透明底色 */
@supports (backdrop-filter: blur(6px)) {
  .topbar {
    background: var(--panel-glass);
    backdrop-filter: blur(10px);
  }
}

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  min-width: 0;
}

.crumb b { color: var(--text); font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb .crumb-path { white-space: nowrap; }
.crumb .sep { opacity: .5; }
.brand-m { display: none; font-size: 13.5px; font-weight: 650; letter-spacing: -.02em; color: var(--text); }

.top-right { display: flex; align-items: center; gap: 6px; flex: none; margin-left: auto; }

.content {
  padding: 22px 22px 72px;
  max-width: 1240px;
  width: 100%;
}

/* 栏目（分页） */
.page { animation: page-in 170ms ease-out; }

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding: 2px 0 18px;
}

.page-head .ph-text { min-width: 0; }

.page-head h1 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -.028em;
  line-height: 1.35;
}

.page-head p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.ph-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.section { margin-bottom: 26px; }

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px;
}

.section-head h2 { font-size: 14.5px; font-weight: 620; }
.section-head .sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.section-head .right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============ 4. 通用组件 ============ */

/* ---- 按钮 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 520;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur), border-color var(--dur), color var(--dur), transform var(--dur);
}

.btn:hover:not(:disabled) { background: var(--panel-2); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-2); color: var(--text); border-color: transparent; }

/* ⚠ .btn-primary 必须排在 .btn-ghost 之后：两者同为单类选择器特异性，
   排在 ghost 前面时 `btn btn-ghost … btn-primary` 组合（如列表展开区的「测试签到」）
   会被 ghost 的 background: transparent / color: var(--text-2) 覆盖，
   实心主按钮退化成 ghost。hover 规则同理（同为 :hover:not(:disabled) 特异性）。 */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-icon { width: 32px; padding: 0; }
.btn-sm { height: 27px; padding: 0 8px; font-size: 12px; }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
/* 暗色下 --danger 是亮珊瑚 #ff6f61，白字压上去只有 2.73:1（低于 AA）。
   这里单独把实心按钮换成深红，白字达到 5.86:1；令牌本身不动，
   否则浅底上的红色错误文字会一起变暗。 */
[data-theme="dark"] .btn-danger { background: #b8352a; border-color: #b8352a; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.06); }
.btn-danger-ghost { color: var(--danger); border-color: transparent; }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }

.btn-block { width: 100%; justify-content: center; }

/* busy 态：按钮文案不变 + 内部 spinner（禁止替换 innerHTML） */
.btn.is-busy { cursor: progress; }
.btn.is-busy > .ic { display: none; }
.btn.is-busy::before {
  content: "";
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin .7s linear infinite;
}

/* ---- 输入 ---- */
.input {
  height: 30px;
  width: 100%;
  padding: 0 8px;
  font-family: var(--font);
  font-size: 12.5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: 0;
  transition: border-color var(--dur), box-shadow var(--dur);
}

.input:focus { border-color: var(--primary); box-shadow: var(--ring); }
.input::placeholder { color: var(--muted); }
.input-sm { height: 27px; font-size: 12px; }
.input-mono { font-family: var(--mono); letter-spacing: .02em; }

/* 所有下拉统一 appearance:none + 自绘箭头（箭头颜色按主题给在 --select-arrow 里） */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 5px center;
  background-size: 10px;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  background-color: var(--bg);
}

select:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
select:disabled { opacity: .45; cursor: not-allowed; }

/* 签到时间下拉：卡片视图与列表视图共用同一个类名，焦点守卫才能一次覆盖两处 */
.acc-hour-select {
  height: 22px;
  padding: 0 18px 0 6px;
  font-size: 11px;
  width: auto;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--dur), color var(--dur);
}
.acc-hour-select:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }

/* ---- 表单排版 ---- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-tight { display: flex; flex-direction: column; gap: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12.5px; color: var(--text-2); }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.check input { width: 15px; height: 15px; accent-color: var(--primary); }
.row-inline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.inline { display: flex; gap: 6px; }
.inline .input { flex: 1; min-width: 0; }

.form-error {
  margin: 0;
  font-size: 12px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: var(--r-sm);
  padding: 7px 9px;
}

/* ---- 徽标（含设计稿 .pill 的视觉） ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 7px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-ok { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-line); }
.badge-info { color: var(--info); background: var(--info-soft); border-color: var(--info-line); }
.badge-bad { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }
.badge-warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.badge-mute { color: var(--muted); background: var(--mute-soft); border-color: var(--border); }

/* ---- 搜索框 ---- */
.search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 9px;
  margin-left: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--muted);
  width: 240px;
  flex: none;
  transition: border-color var(--dur), box-shadow var(--dur);
}

.search:focus-within { border-color: var(--primary); box-shadow: var(--ring); }

.search input {
  border: 0;
  background: transparent;
  outline: 0;
  color: var(--text);
  font-size: 12.5px;
  width: 100%;
  min-width: 0;
  font-family: var(--font);
}

.search input::placeholder { color: var(--muted); }

/* 页内搜索（日志页）：不吃 margin-left:auto，宽度收窄 */
.search-inline { margin-left: 0; width: 190px; }

/* ---- 分段控件 ---- */
.seg-inline {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  height: 32px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.seg-inline .btn { height: 26px; border: 0; background: transparent; box-shadow: none; }
.seg-inline .btn.is-on { background: var(--panel); box-shadow: var(--shadow); color: var(--text); }

/* 等宽两段（账号弹窗的「OAuth 授权 / Token 录入」切换）：撑满一行，两个标签各占一半 */
.seg-block { display: flex; width: 100%; }
.seg-block .btn { flex: 1 1 0; justify-content: center; }

/* ---- 提示条 ---- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 22px;
  background: var(--danger-soft);
  border-bottom: 1px solid var(--danger-line);
  color: var(--danger);
  font-size: 12.5px;
  position: sticky;
  top: 52px;
  z-index: 19;
}

.alert-text { flex: 1; word-break: break-word; }

.alert-close {
  appearance: none;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

/* ---- 骨架 ---- */
.skeleton-list { display: flex; flex-direction: column; gap: 8px; }

.skeleton-row {
  height: 42px;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2));
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

/* ---- 空态 ---- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
}

/* ---- Toast ---- */
.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--info);
  border-radius: var(--r-md);
  padding: 9px 12px;
  font-size: 12.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  color: var(--text);
  word-break: break-word;
  animation: toast-in .18s ease-out;
}

.toast.is-ok { border-left-color: var(--ok); }
.toast.is-bad { border-left-color: var(--danger); }
.toast.is-warn { border-left-color: var(--warn); }
.toast.is-info { border-left-color: var(--info); }

/* ---- 弹窗 ---- */
.dlg {
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  background: var(--panel);
  color: var(--text);
  padding: 0;
  width: min(460px, calc(100vw - 28px));
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.dlg::backdrop { background: var(--overlay); }
.dlg-sm { width: min(400px, calc(100vw - 28px)); }

.dlg-body { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.dlg-body h2 { font-size: 15px; font-weight: 640; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ============ 5. KPI ============ */

.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 13px 13px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.kpi-label {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-value {
  font-size: 23px;
  font-weight: 640;
  letter-spacing: -.03em;
  margin-top: 5px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-value small {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
  margin-left: 3px;
  letter-spacing: 0;
}

.kpi-foot {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ 6. 账号页 ============ */

/* 视图切换（胶囊 + 图标） */
.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  margin-left: 4px;
  flex: none;
}

.view-toggle button {
  width: 30px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
}

.view-toggle button:hover { color: var(--text-2); }
.view-toggle button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.view-toggle button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--primary-ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .18);
}

/* ---- 列表视图（数据表） ---- */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* 桌面端六列。⚠ 行内直接子元素必须恰好 6 个且顺序固定：
   1 .acc-cell  2 状态  3 签到时间  4 .money  5 .dim  6 .row-actions
   ≤1100px 用 nth-child 映射 grid-area，包一层 wrapper 就会整体错位。 */
.t-row {
  display: grid;
  align-items: center;
  gap: 12px;
  grid-template-columns: minmax(200px, 1.7fr) 96px 92px 112px 116px 134px;
  padding: 0 14px;
}

.t-head {
  height: 34px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.t-head .t-act { text-align: right; }

.t-body .t-row {
  min-height: 52px;
  border-bottom: 1px solid var(--grid-line);
}

.t-body > .t-row:last-of-type { border-bottom: 0; }
.t-body .t-row.is-clickable { cursor: pointer; }
.t-body .t-row.is-clickable:hover { background: var(--panel-2); }
.t-row.is-open { background: var(--panel-2); }

.acc-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 650;
  background: var(--panel-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  text-transform: uppercase;
}

.acc-cell-id,
.acc-card-id { min-width: 0; }

.nm {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 560;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tk {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .03em;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  background: var(--panel-2);
  flex: none;
}

.plan.pro { color: var(--primary-text); border-color: var(--primary-ring); background: var(--primary-soft); }

/* 状态徽章（方案 A）：轻量胶囊 —— 小圆点 + 文字 + soft 底色 + inset 描边，替代原描边徽标。
   statusBadge 产出的 badge badge-* 类名被 frontend-badge-schedule.test.mjs 锁定，
   所以只在账号页作用域（卡片头 / 列表行）内重皮，不影响日志页的 .badge。 */
.acc-card-head .badge,
.t-row .badge {
  gap: 6px;
  height: auto;
  padding: 3.5px 11px 3.5px 9px;
  border: 0;
  border-radius: 99px;
}

.acc-card-head .badge::before,
.t-row .badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  flex: none;
}

.acc-card-head .badge-ok, .t-row .badge-ok { box-shadow: inset 0 0 0 1px var(--ok-line); }
.acc-card-head .badge-warn, .t-row .badge-warn { box-shadow: inset 0 0 0 1px var(--warn-line); }
.acc-card-head .badge-bad, .t-row .badge-bad { box-shadow: inset 0 0 0 1px var(--danger-line); }
.acc-card-head .badge-info, .t-row .badge-info { box-shadow: inset 0 0 0 1px var(--info-line); }
.acc-card-head .badge-mute, .t-row .badge-mute { box-shadow: inset 0 0 0 1px var(--border); }

.money {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.money small { font-size: 11px; color: var(--muted); font-weight: 450; margin-left: 2px; }
.dim { color: var(--muted); font-size: 12px; white-space: nowrap; }

.row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-content: flex-end;
}

.row-actions .btn-icon { width: 26px; height: 26px; }

.row-chev {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 20px;
  height: 24px;
  padding: 0;
  margin-left: 4px;
  transition: transform var(--dur), color var(--dur);
}

.row-chev:hover { color: var(--text); }
.row-chev:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; border-radius: 4px; }
.t-row.is-open .row-chev { transform: rotate(90deg); }

/* 展开明细（方案 B）：指标磁贴行 + 双进度卡 + 底栏（UID 芯片 + 操作按钮） */
.detail {
  border-bottom: 1px solid var(--grid-line);
  background: var(--panel-2);
  padding: 4px 14px 16px;
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.detail-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 9px 11px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.tile-k {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.tile-v {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* 积分主值：等宽放大 + tabular-nums，明细区的核心视觉 */
.tile-v.num {
  font-family: var(--mono);
  font-size: 17px;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}

.tile-v .unit { font-size: 11px; font-weight: 400; color: var(--muted); }
/* Token 语气配色（复用 tokenValueClass 的类名口径，与 .acc-line .v 一致） */
.tile-v.good { color: var(--ok); }
.tile-v.warn-t { color: var(--warn); }
.tile-v.bad { color: var(--danger); }

/* 磁贴里的签到时间下拉：占满磁贴宽度，和主值同一视觉线 */
.tile-v .acc-hour-select { width: 100%; max-width: none; height: 26px; }

.tile-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pcard {
  min-width: 0;
  padding: 9px 11px 11px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.pcard-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.pcard-head .bar-name { flex: 1; min-width: 0; }

/* 大号剩余百分比：配色档位与进度条填充同源 */
.pcard-pct {
  flex: none;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pcard-pct.plan-c { color: var(--primary-text); }
.pcard-pct.bonus-c { color: var(--info); }
.pcard-pct.warn-c { color: var(--warn); }

.pcard .bar-track { margin-top: 8px; }

.pcard-cap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pcard-cap b { color: var(--text-2); font-weight: 600; }

.detail-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.detail-foot .btn {
  flex: 0 0 auto;
  height: 29px;
  padding: 0 13px;
  font-size: 11.5px;
}

/* UID 芯片：等宽截断 + 常显复制按钮（触屏没有 hover，不做浮出） */
.uid-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 46%;
  padding: 4px 6px 4px 9px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.uid-chip .k { flex: none; font-size: 11px; color: var(--muted); }

.uid-chip .mono-v {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uid-chip .copy {
  flex: none;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--dur), color var(--dur);
}

.uid-chip .copy:hover { color: var(--text); background: var(--panel-3); }
.uid-chip .copy:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.uid-chip .copy svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.detail-foot .spacer { flex: 1; min-width: 8px; }

/* ---- 卡片视图 ---- */
.acc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 10px;
}

.acc-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  transition: border-color var(--dur);
}

.acc-card:hover { border-color: var(--border-strong); }

.acc-card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 13px 10px;
}

/* 头部图标按钮（方案 A）：无边框、hover 浮出 panel-2 底（与设计稿 .icon-btn 同语义） */
.acc-card-head .btn-icon {
  width: 27px;
  height: 27px;
  border-radius: 7px;
  color: var(--muted);
}
.acc-card-head .btn-icon:hover:not(:disabled) { color: var(--text); }
/* 删除按钮 hover 用 danger 红（底色由 .btn-danger-ghost 的 hover 给 danger-soft） */
.acc-card-head .btn-danger-ghost:hover:not(:disabled) { color: var(--danger); }

/* 卡片头像放大到 34px + 渐变底；列表行保持基础 28px */
.acc-card-head .avatar {
  width: 34px;
  height: 34px;
  font-size: 14px;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--panel-3), var(--panel-2));
}

.acc-card-head .spacer { margin-left: auto; display: flex; align-items: center; gap: 4px; flex: none; }

.acc-card-b {
  padding: 0 13px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* meta 两列网格：UID / Token / 签到时间 / 上次签到（方案 A 紧凑双列） */
.acc-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 18px;
  padding: 12px 0 4px;
  min-width: 0;
}

.acc-line {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  font-size: 11.5px;
  min-width: 0;
}

.acc-line .k { color: var(--muted); flex: none; width: 52px; }

.acc-line .v {
  color: var(--text-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acc-line .v.mono { font-family: var(--mono); font-size: 10.5px; }
.acc-line .v.bad { color: var(--danger); }
.acc-line .v.good { color: var(--ok); }
.acc-line .v.warn-t { color: var(--warn); }

/* UID 复制按钮：hover / 键盘聚焦时浮出（触屏没有 hover，靠 focus-visible 兜底常显） */
.acc-line .copy {
  flex: none;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity var(--dur), background var(--dur), color var(--dur);
}

.acc-line:hover .copy,
.acc-line .copy:focus-visible { opacity: 1; }
.acc-line .copy:hover { color: var(--text); background: var(--panel-3); }
.acc-line .copy:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.acc-line .copy svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.acc-card-foot {
  display: flex;
  gap: 8px;
  padding: 12px 13px 14px;
  border-top: 1px solid var(--grid-line);
  margin-top: 8px;
}

.acc-card-foot .btn {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-md);
  font-size: 12px;
}

/* ---- 积分 Hero 面板（方案 A 视觉核心，卡片与列表明细共用） ---- */
.credit-block {
  display: flex;
  flex-direction: column;
  padding: 13px 15px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 180% at 100% 0%, var(--primary-soft), transparent 55%),
    var(--panel-2);
  min-width: 0;
}

.credit-loading { color: var(--muted); font-size: 11.5px; padding: 2px 0; }
.credit-skeleton { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }

.credit-error {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--danger);
  font-size: 11.5px;
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: var(--r-sm);
  padding: 6px 8px;
}

.hero-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.hero-label {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.hero-live {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 5px var(--primary);
  flex: none;
}

.hero-num {
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-num .hero-unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
  letter-spacing: 0;
}

.hero-bars {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  min-width: 0;
}

.bar-name {
  font-size: 11px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-name .sw { width: 7px; height: 7px; border-radius: 2.5px; flex: none; }
.bar-name .sw.plan-c { background: var(--primary); }
.bar-name .sw.bonus-c { background: var(--info); }
.bar-name .sw.warn-c { background: var(--warn); }

.bar-val {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.bar-val b { color: var(--text-2); font-weight: 600; }

/* 轨道用半透明白覆盖层；日间主题下白轨道在浅底上不可读，换成半透明黑 */
.bar-track {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .10);
  overflow: hidden;
}

html[data-theme="light"] .bar-track { background: rgba(15, 21, 25, .10); }

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
}

/* 渐变起点用 color-mix 从 token 现调（不硬编码颜色，日间主题自动跟随 token） */
.bar-fill.plan-c { background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 55%, transparent), var(--primary)); }
.bar-fill.bonus-c { background: linear-gradient(90deg, color-mix(in srgb, var(--info) 55%, transparent), var(--info)); }
.bar-fill.warn-c { background: linear-gradient(90deg, color-mix(in srgb, var(--warn) 55%, transparent), var(--warn)); }

.bar-pct {
  grid-column: 1 / -1;
  text-align: right;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: -3px;
}

.bar-row .credit-expiry { grid-column: 1 / -1; }

.credit-expiry {
  align-self: start;
  justify-self: start;
  font-size: 9.5px;
  line-height: 15px;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 3px;
  padding: 0 4px;
  font-weight: 600;
}

/* ---- 方案 B 响应式（账号页专属规则随本分区维护，不动分区 10） ---- */
@media (max-width: 1100px) {
  .detail-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .acc-meta { grid-template-columns: 1fr; }
}

/* ============ 7. 日志页 ============ */

.logs {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.log-item { border-bottom: 1px solid var(--grid-line); }
.log-item:last-child { border-bottom: 0; }
.log-item.is-open { background: var(--panel-2); }

/* 顺序固定：时间 / 触发方式 / 摘要 / 箭头 */
.log-head {
  display: grid;
  grid-template-columns: 98px 92px minmax(0, 1fr) 20px;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.log-head:hover { background: var(--panel-2); }
.log-head:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.log-time { display: flex; flex-direction: column; line-height: 1.35; }
.log-time b { font-size: 12.5px; font-weight: 560; font-variant-numeric: tabular-nums; }
.log-time small { font-size: 11px; color: var(--muted); }

.trg { display: flex; align-items: center; }

.log-sum {
  font-size: 12.5px;
  color: var(--text-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* 只把「失败 N」染红，整行保持次级正文色（设计稿口径） */
.log-sum .bad { color: var(--danger); font-weight: 550; }

.log-chevron {
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: transform var(--dur);
}

.log-item.is-open .log-chevron { transform: rotate(90deg); }

.log-body {
  padding: 0 14px 12px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--grid-line);
}

.entry {
  display: grid;
  grid-template-columns: 124px 74px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 12px;
}

.entry:last-child { border-bottom: 0; }

.entry-name {
  font-weight: 560;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-msg { color: var(--text-2); word-break: break-word; }

.entry-sub {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ============ 8. 设置页 ============ */

.settings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.set {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.set h3 {
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.set p {
  font-size: 11.5px;
  color: var(--muted);
  margin: 5px 0 10px;
  line-height: 1.6;
}

.keybox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  margin-bottom: 9px;
  overflow: hidden;
}

.keybox > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keybox .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }
.keybox.is-off .dot { background: var(--muted); }

/* ============ 9. 认证页（首次设置 / 登录） ============ */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  /* 左右 16px：窄屏时卡片自然就是「视口 − 32px」，无需再写媒体查询 */
  padding: 24px 16px;
}

.auth-card {
  /* 380 而不是 420/300：1440 视口下不显得孤零零，也不至于宽到读不出「一屏一表单」的聚焦感 */
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.auth-brand { display: flex; flex-direction: column; min-width: 0; }
.auth-card .stack { margin-bottom: 12px; }

/* ============ 10. 响应式 ============ */

/* ---- 1100：六列表格放不下，整体降级为两行信息卡 ---- */
@media (max-width: 1100px) {
  .table-wrap { background: transparent; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
  .t-head { display: none; }
  .t-body { display: flex; flex-direction: column; gap: 8px; }

  .t-body .t-row {
    grid-template-columns: auto auto auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "acc acc acc acc acc act"
      "status hour money time . act";
    align-items: center;
    gap: 5px 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 11px 12px;
    min-height: 0;
    box-shadow: var(--shadow);
  }

  .t-body .t-row > *:nth-child(1) { grid-area: acc; }
  .t-body .t-row > *:nth-child(2) { grid-area: status; }
  .t-body .t-row > *:nth-child(3) { grid-area: hour; }
  .t-body .t-row > *:nth-child(4) { grid-area: money; }
  .t-body .t-row > *:nth-child(5) { grid-area: time; }
  .t-body .t-row > *:nth-child(6) { grid-area: act; }

  .t-body > .t-row:last-of-type { border-bottom: 1px solid var(--border); }

  .detail {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 12px 14px;
    margin-top: -4px;
    box-shadow: none;
  }

  .acc-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .settings { grid-template-columns: repeat(2, 1fr); }
}

/* ---- 900：侧栏横排到顶部，搜索框占整行 ---- */
@media (max-width: 900px) {
  /* 侧栏变成一行后必须显式给行高：否则默认 align-content:stretch 会把
     「侧栏行」和「主区行」各撑到一半高度，顶部露出一大块空白。 */
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: start;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .side-brand { padding: 0 8px 0 2px; }
  /* 只收起侧栏的副标题；认证卡片用的是同一套 .brand-sub，不能一起隐藏 */
  .side-brand .brand-sub { display: none; }
  .nav-group { display: flex; gap: 2px; padding: 0; }
  .nav-label, .side-foot { display: none; }
  .nav-item { padding: 7px 11px; font-size: 12.5px; }

  .topbar { height: auto; padding: 8px 12px; flex-wrap: nowrap; }
  .crumb { margin-right: auto; min-width: 0; }
  .alert { position: static; padding: 9px 12px; }

  .content { padding: 16px 12px 60px; }

  .page-head { flex-direction: column; align-items: stretch; gap: 12px; padding-bottom: 14px; }
  .page-head h1 { font-size: 17px; }
  .ph-actions { margin-left: 0; justify-content: flex-end; }

  .section-head { flex-wrap: wrap; }
  .section-head .right { width: auto; margin-left: auto; justify-content: flex-end; }

  .log-head { grid-template-columns: 80px 74px minmax(0, 1fr) 16px; gap: 8px; }
}

/* ---- 701~900：侧栏横排成第一行（品牌 + 导航），顶栏落到第二行 ----
   用户要求「刷新 / 主题 / 登出」在第一行最右上角，所以把它们抽出顶栏、浮到 .shell 上。
   为什么必须同时解掉 .topbar 的「包含块」身份：
   桌面端 .topbar 是 position: sticky，而 sticky 本身就是「已定位元素」，会成为绝对定位
   后代的包含块；更隐蔽的是它还有 backdrop-filter（玻璃底），filter/backdrop-filter
   不论 position 是什么都会创建包含块。只给 .top-right 加 absolute 的话，它的 top/right
   是相对第二行的顶栏算的——上一版补丁就是这样只把图标挪到第二行右边缘、实测无效。
   所以这里把 .topbar 降为 static 并关掉 backdrop-filter（不 sticky 就没有内容从下面穿过，
   玻璃底本来也没意义），包含块回落到 .shell（已 position: relative），图标才落到第一行。
   手机（≤700）不走这套——那时侧栏已经变成底部 Tab Bar；≥901 也不走（左侧栏布局）。 */
@media (min-width: 701px) and (max-width: 900px) {
  .shell { position: relative; }
  .topbar {
    position: static;
    background: var(--panel);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  /* 第一行高 52px（8px 内边距 + 35px 导航项 + 1px 下边框），图标浮层同高并垂直居中 */
  .top-right {
    position: absolute;
    top: 0;
    right: 10px;
    height: 52px;
    align-items: center;
    margin-left: 0;
    z-index: 5;
  }
  /* 侧栏是横向滚动行：右侧留出图标宽度（3×32px + 间距 + 内边距 ≈ 148px），
     否则导航项会被浮层压住 / 盖住 */
  .sidebar { min-height: 52px; padding-right: 148px; }
}

/* ---- 700：底部 Tab Bar + 精简顶栏 + 卡片单列 ---- */
@media (max-width: 700px) {
  /* 手机上日志搜索独占一行；平板/窄桌面保持 190px 与筛选同行 */
  .search-inline { width: 100%; }
  .shell { padding-bottom: 72px; }

  /* 侧栏变形为底部 Tab Bar：复用同一份 DOM，不新增节点 */
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 60;
    height: auto;
    flex-direction: row;
    align-items: stretch;
    border-right: 0;
    border-top: 1px solid var(--border);
    border-bottom: 0;
    background: var(--panel);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    overflow: visible;
  }

  @supports (backdrop-filter: blur(6px)) {
    .sidebar {
      background: var(--panel-glass);
      backdrop-filter: blur(14px);
    }
  }

  .side-brand, .nav-label, .side-foot { display: none; }
  .nav-group { display: flex; width: 100%; gap: 4px; padding: 0; }

  .nav-item {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    justify-content: center;
    padding: 6px 4px;
    font-size: 10.5px;
    border: 0;
    border-radius: 9px;
    min-height: 48px;
    color: var(--muted);
  }

  .nav-item .ic { width: 18px; height: 18px; }
  .nav-item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; border: 0; }
  .nav-item.is-active .ic { color: var(--primary); }
  .nav-count { display: none; }

  /* 顶栏只留品牌 + 三个图标，搜索收起（移动端用页面内搜索） */
  .topbar { height: 46px; padding: 0 10px 0 14px; flex-wrap: nowrap; gap: 2px; }
  .crumb .crumb-path, .crumb .sep { display: none; }
  .crumb .brand-m { display: block; }
  .crumb b { display: none; }
  .topbar .btn-icon { width: 34px; height: 34px; }

  .content { padding: 12px 12px 28px; }

  .page-head { flex-direction: column; align-items: stretch; gap: 10px; padding: 0 0 12px; }
  .page-head h1 { font-size: 18px; }
  .page-head p { font-size: 12px; line-height: 1.55; white-space: normal; }
  .ph-actions { margin-left: 0; gap: 6px; justify-content: flex-end; }
  .ph-actions .btn { height: 36px; padding: 0 12px; font-size: 12.5px; }

  .kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
  .kpi { padding: 10px 11px 11px; }
  .kpi-value { font-size: 20px; margin-top: 3px; }
  .kpi-foot { font-size: 10.5px; line-height: 1.45; white-space: normal; }

  .section-head { gap: 8px; }
  .section-head h2 { font-size: 13.5px; }
  .view-toggle button { width: 32px; height: 28px; }
  .section-head .right .btn { height: 28px; }

  .acc-grid { grid-template-columns: 1fr; }
  .acc-cell .tk { display: none; }
  .acc-cell .nm { font-size: 13.5px; }
  .row-actions .btn-icon { width: 32px; height: 32px; }
  .t-body .t-row > *:nth-child(5) { display: none; }
  .t-body .t-row { grid-template-areas: "acc acc acc acc acc act" "status hour money . . act"; }
  .acc-hour-select { min-width: 70px; max-width: 84px; height: 30px; font-size: 11.5px; }
  .detail { padding: 12px; }

  /* 窄屏明细：进度卡单列；底栏 UID 芯片独占一行，按钮等宽铺满 */
  .detail-bars { grid-template-columns: 1fr; }
  .detail-foot { flex-wrap: wrap; }
  .uid-chip { flex: 1 1 100%; max-width: none; }
  .detail-foot .btn { flex: 1 1 0; height: 36px; padding: 0 10px; }

  .acc-card-foot .btn { height: 42px; font-size: 12px; }

  .log-head { padding: 11px 12px; }
  .settings { grid-template-columns: 1fr; gap: 8px; }
  .set { padding: 13px; }
  .set .input { height: 34px; }
  .set .btn { height: 34px; }

  .toast-host { bottom: 78px; }
}

/* ---- 560：日志行两行布局 ---- */
@media (max-width: 560px) {
  .log-head {
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas:
      "time trg chev"
      "sum sum sum";
    row-gap: 5px;
    column-gap: 8px;
    padding: 10px 12px;
  }

  .log-time { grid-area: time; flex-direction: row; align-items: baseline; gap: 5px; }
  .log-time small { font-size: 10.5px; }
  .trg { grid-area: trg; }
  .log-sum { grid-area: sum; font-size: 12px; line-height: 1.5; white-space: normal; }
  .log-chevron { grid-area: chev; justify-self: end; }

  .entry { grid-template-columns: 1fr 62px; row-gap: 2px; }
  .entry-msg { grid-column: 1 / -1; }
  .entry-sub { grid-column: 1 / -1; }

  .ph-actions { justify-content: stretch; }
}

/* ---- 380：主操作独占一行 ---- */
@media (max-width: 380px) {
  .ph-actions .btn-primary { flex: 1 0 100%; }

  .t-body .t-row { gap: 4px 6px; padding: 10px; }
  .row-actions { gap: 0; }
  .row-actions .btn-icon { width: 28px; height: 28px; }
  .row-chev { width: 14px; height: 14px; }
  .money { font-size: 12px; }
  .money small { display: none; }
  .acc-hour-select { min-width: 78px; max-width: 78px; padding: 0 14px 0 4px; font-size: 10.5px; }
  .acc-cell .nm { font-size: 13px; }

  .acc-card-foot .btn { font-size: 11.5px; }
}

/* ============ 11. 动效 ============ */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes page-in { from { opacity: 0; transform: translateY(3px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
