/* ============================================================
   个人工作台 · 样式表
   ------------------------------------------------------------
   设计约定：
   1. 颜色一律走语义变量，禁止在组件里写死色值 —— 这是深色模式能
      一次生效、不留死角的前提。
   2. 所有 :hover 规则收进 @media (hover: hover)，否则触屏设备上
      点击后会残留 hover 态（"粘滞高亮"）。
   3. 断点三档：>=1025 桌面 / 768–1024 平板(图标栏) / <768 手机
      （手机端侧栏转为 off-canvas，底部启用 tab 导航）。
   ============================================================ */

/* ============================================================
   1. 主题变量
   ============================================================ */
:root {
  /* 表面 */
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-2: #fbfcfe;
  --panel-3: #f7f8fa;

  /* 描边 */
  --line: #e5e8ee;
  --line-soft: #eef0f4;
  --line-strong: #d2d8e0;

  /* 文字 */
  --text: #1b1f26;
  --text-2: #59616f;
  --text-3: #8a93a1;
  --text-4: #aab2bf;

  /* 交互态 */
  --hover: #f1f3f7;
  --hover-strong: #e7eaf0;

  /* 品牌 */
  --brand: #2f6fed;
  --brand-soft: #e9f0fe;
  --brand-deep: #1b52c4;
  --brand-line: #c3d7fb;
  --grad-brand: linear-gradient(135deg, #3b7bf5 0%, #2456cf 100%);

  /* 优先级 */
  --p0: #d93025;
  --p1: #e8710a;
  --p2: #2f6fed;
  --p3: #7b8494;

  /* 语义色 */
  --ok: #188038;
  --ok-soft: #e5f4ea;
  --warn: #e8710a;
  --warn-soft: #fdefe2;
  --danger: #d93025;
  --danger-soft: #fce9e7;
  --purple: #8430ce;
  --purple-soft: #f3e9fd;

  /* 组件专用 */
  --chip-bg: #eff1f5;
  --track: #e9edf2;
  --col-bg: #eaedf3;
  --code-bg: #f6f8fb;
  --code-fg: #23282f;
  --toast-bg: #1b1f26;
  --toast-fg: #ffffff;
  --login-grad: linear-gradient(165deg, #f8fafd 0%, #eef3fa 55%, #e6eefb 100%);
  --scroll-thumb: #d3d9e2;
  --scroll-thumb-hover: #b9c1cd;
  --sk-base: #eef1f5;
  --sk-hi: #f8fafc;

  /* 形状 */
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 4px 16px rgba(16, 24, 40, .07);
  --shadow-lg: 0 20px 52px rgba(16, 24, 40, .16);

  /* 尺寸 */
  --side-w: 234px;
  --topbar-h: 62px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

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

  color-scheme: light;
}

/* ---------- 深色主题 ---------- */
:root[data-theme="dark"] {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1c2128;
  --panel-3: #21262e;

  --line: #272e37;
  --line-soft: #222831;
  --line-strong: #39424e;

  --text: #e7eaf0;
  --text-2: #a9b2c0;
  --text-3: #7c8695;
  --text-4: #626c7a;

  --hover: #212730;
  --hover-strong: #2a313b;

  --brand: #5c8ef7;
  --brand-soft: rgba(92, 142, 247, .16);
  --brand-deep: #8fb0ff;
  --brand-line: #2f4a7d;
  --grad-brand: linear-gradient(135deg, #4c7ff0 0%, #2f5fd0 100%);

  --p0: #f2565c;
  --p1: #f0893f;
  --p2: #5c8ef7;
  --p3: #8b94a3;

  --ok: #46c05c;
  --ok-soft: rgba(70, 192, 92, .15);
  --warn: #f0893f;
  --warn-soft: rgba(240, 137, 63, .15);
  --danger: #f2565c;
  --danger-soft: rgba(242, 86, 92, .15);
  --purple: #a878f5;
  --purple-soft: rgba(168, 120, 245, .16);

  --chip-bg: #232a33;
  --track: #262d36;
  --col-bg: #151a21;
  --code-bg: #12161b;
  --code-fg: #cfd6e0;
  --toast-bg: #e7eaf0;
  --toast-fg: #14181e;
  --login-grad: linear-gradient(165deg, #12161b 0%, #141a22 55%, #161e2a 100%);
  --scroll-thumb: #333b46;
  --scroll-thumb-hover: #45505e;
  --sk-base: #1e242c;
  --sk-hi: #262e38;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .32);
  --shadow: 0 4px 16px rgba(0, 0, 0, .38);
  --shadow-lg: 0 20px 52px rgba(0, 0, 0, .58);

  color-scheme: dark;
}

/* ============================================================
   2. 基础
   ============================================================ */
* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 移动端：禁止横向滚动与双击缩放抖动 */
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body { transition: background .18s ease, color .18s ease; }

.hidden { display: none !important; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--brand-soft); color: var(--brand-deep); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ============================================================
   2.5 图标系统
   ------------------------------------------------------------
   全部图标来自内联 SVG sprite（见 public/icons.js），统一 24×24 网格。
   设计约定：
     · 尺寸 = 1em —— 图标自动跟随所在元素的字号，无需逐个指定像素值；
     · 颜色 = currentColor —— 自动继承文字色，深浅主题无需各写一套；
     · 描边 1.75（在 24 网格上）—— 比 2 略细，小尺寸下更精致、不糊；
     · 继承式着色：fill/stroke 都由 .ic 下发到 <use> 的影子树，
       个别需要实心的图形（星标、圆点）在 symbol 内用内联属性覆盖即可。
   ============================================================ */
.ic {
  width: 1em; height: 1em; flex: none;
  display: inline-block;
  /* 视觉居中：字形基线偏下，线性图标需要轻微上提才与文字对齐 */
  vertical-align: -0.135em;
  fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  overflow: visible;
}
/* 实心态（收藏星标、圆点等） */
.ic.solid { fill: currentColor; }
/* 动态流里代表 agent 的操作者标记 */
.ic-actor-agent { color: var(--purple); display: inline-flex; margin-right: 5px; }

/* 特殊容器里的尺寸微调：这些地方图标不随字号走，需单独给量 */
.card-title > .ic { width: 15px; height: 15px; color: var(--text-3); }
.sec-title > .ic { width: 14px; height: 14px; color: var(--text-3); }
.empty .e-icon > .ic { width: 34px; height: 34px; stroke-width: 1.4; }
.res-icon > .ic { width: 17px; height: 17px; }
.star-btn > .ic { width: 15px; height: 15px; }
.btn-new .btn-fallback > .ic { width: 20px; height: 20px; stroke-width: 2; }

/* ============================================================
   3. 登录
   ============================================================ */
.login-layer {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--login-grad); z-index: 100; padding: 20px; overflow: hidden;
}
.login-glow {
  position: absolute; width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 111, 237, .16) 0%, rgba(47, 111, 237, 0) 68%);
  top: -190px; right: -160px; pointer-events: none;
}
.login-glow::after {
  content: ''; position: absolute; width: 440px; height: 440px; border-radius: 50%;
  background: radial-gradient(circle, rgba(132, 48, 206, .11) 0%, rgba(132, 48, 206, 0) 70%);
  left: -420px; top: 620px;
}
.login-card {
  position: relative; z-index: 1;
  width: 372px; max-width: 100%; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-xl); padding: 38px 32px 32px; box-shadow: var(--shadow-lg); text-align: center;
}
.login-brand { display: flex; align-items: center; justify-content: center; gap: 11px; }
/* 品牌标：渐变底 + 白色线性图标，与 PWA 图标（public/icon.svg）同一套几何 */
.login-logo {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--grad-brand); color: #fff;
  box-shadow: 0 3px 10px rgba(31, 82, 190, .3), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.login-logo > .ic { width: 25px; height: 25px; stroke-width: 1.9; }
.login-card h1 { font-size: 20px; margin: 0; letter-spacing: .4px; font-weight: 660; }
.login-sub { color: var(--text-3); font-size: 12.5px; margin: 9px 0 24px; }
.login-card input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); margin-bottom: 12px; outline: none;
  background: var(--panel-2); transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { border-color: var(--brand); background: var(--panel); box-shadow: 0 0 0 3px var(--brand-soft); }
.login-error { color: var(--danger); font-size: 12.5px; margin: 12px 0 0; }

/* ============================================================
   4. 布局框架
   ============================================================ */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* ============================================================
   5. 侧栏
   ============================================================ */
.sidebar {
  width: var(--side-w); flex: 0 0 var(--side-w);
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 12px 12px;
  padding-top: calc(16px + var(--safe-t));
  z-index: 70;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px;
  display: grid; place-items: center;
  background: var(--grad-brand); color: #fff;
  box-shadow: 0 2px 7px rgba(31, 82, 190, .28), inset 0 1px 0 rgba(255, 255, 255, .26);
}
.brand-logo > .ic { width: 19px; height: 19px; stroke-width: 1.9; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.brand-text strong { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 660; }
.brand-text small { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 用后代选择器提升特异性：.icon-btn 在后文定义 display:inline-flex，
   单类选择器会被其覆盖，导致桌面端误显示关闭按钮 */
.sidebar .side-close { display: none; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: none; background: transparent; border-radius: 9px;
  color: var(--text-2); text-align: left; font-size: 13.5px;
  transition: background .13s, color .13s; position: relative;
}
.nav-item .ni { font-size: 15px; width: 18px; text-align: center; flex: 0 0 18px; }
.nav-item .nl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: 620; }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 17px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-item .badge {
  margin-left: auto; font-size: 11px; background: var(--chip-bg); color: var(--text-2);
  border-radius: 20px; padding: 1px 7px; font-weight: 620; min-width: 20px; text-align: center;
  flex: 0 0 auto;
}
.nav-item .badge.alert { background: var(--danger-soft); color: var(--danger); }
.nav-item .badge:empty { display: none; }

.side-foot { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 8px; }
.side-cmd {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text-3); font-size: 12.5px; transition: border-color .13s, color .13s;
}
.side-cmd .sc-text { flex: 1; text-align: left; }
.side-cmd kbd {
  font-family: var(--mono); font-size: 10.5px;
  background: var(--chip-bg); border-radius: 4px; padding: 1px 5px; color: var(--text-2);
}
.side-meta { font-size: 11px; color: var(--text-3); padding: 9px 4px 0; line-height: 1.55; }
.side-meta b { color: var(--text-2); font-weight: 620; }
.side-mask {
  position: fixed; inset: 0; background: rgba(10, 14, 20, .42);
  opacity: 0; pointer-events: none; transition: opacity .22s; z-index: 65;
  backdrop-filter: blur(1.5px);
}
.side-mask.show { opacity: 1; pointer-events: auto; }

/* ============================================================
   6. 底部导航（手机端）
   ============================================================ */
.tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(58px + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
  align-items: stretch;
}
.tabbar-item {
  flex: 1; border: none; background: transparent; color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; position: relative; padding: 0; transition: color .15s;
}
.tabbar-item .ti-icon { font-size: 18px; line-height: 1; opacity: .68; transition: opacity .15s, transform .15s; }
.tabbar-item .ti-label { font-size: 10.5px; font-weight: 550; letter-spacing: .2px; }
.tabbar-item.active { color: var(--brand); }
.tabbar-item.active .ti-icon { opacity: 1; }
.tabbar-item.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--brand);
}
.tabbar-item:active .ti-icon { transform: scale(.88); }
.ti-badge {
  position: absolute; top: 5px; left: 50%; margin-left: 4px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9px;
  background: var(--text-3); color: var(--panel);
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.ti-badge.alert { background: var(--danger); color: #fff; }
.ti-badge:empty { display: none; }

/* ============================================================
   7. 顶栏
   ============================================================ */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; padding-right: max(20px, calc(20px + env(safe-area-inset-right))); gap: 16px;
  z-index: 20;
}
.tb-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.topbar h2 { font-size: 17px; margin: 0; font-weight: 660; letter-spacing: -.2px; white-space: nowrap; }
.tb-desc { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-right { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
/* 同理：.btn / .icon-btn 后文定义的 display 会覆盖单类选择器 */
.topbar .tb-menu { display: none; }
/* 移动端专属的检索入口；桌面端侧栏已有「全局检索」，不重复 */
#btnSearchM { display: none; }
.btn-fallback { display: none; }
/* 按钮里「图标 + 文字」的组合：用 flex + gap 保证间距精确，不依赖空格 */
.btn-txt { display: inline-flex; align-items: center; gap: 5px; }

.content {
  flex: 1; overflow-y: auto; padding: 20px 22px 60px;
  -webkit-overflow-scrolling: touch; scroll-behavior: smooth;
}

/* ============================================================
   8. 按钮
   ============================================================ */
.btn {
  padding: 7px 13px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--text); font-size: 13px;
  transition: background .13s, border-color .13s, transform .08s, box-shadow .13s;
  white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.btn:active { transform: scale(.975); }
.btn-primary {
  background: var(--grad-brand); border-color: transparent; color: #fff; font-weight: 580;
  box-shadow: 0 1px 2px rgba(31, 82, 190, .28);
}
.btn-danger { color: var(--danger); border-color: var(--line-strong); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.icon-btn {
  background: transparent; border: none; color: var(--text-3); font-size: 15px;
  padding: 5px 8px; border-radius: 8px; line-height: 1; transition: background .13s, color .13s;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:active { background: var(--hover); }

/* ============================================================
   9. 卡片 / KPI
   ============================================================ */
.grid { display: grid; gap: 14px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* 总览页的非等宽双栏 */
.split-a { grid-template-columns: 1.35fr 1fr; }
.split-b { grid-template-columns: 1fr 1.35fr; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 13px; font-weight: 660; color: var(--text-2); margin: 0 0 12px;
  display: flex; align-items: center; gap: 7px;
}
.card-title .more { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--brand); cursor: pointer; }

.kpi { display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden; }
.kpi-rule {
  position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand);
}
.kpi.accent-danger .kpi-rule { background: var(--danger); }
.kpi.accent-warn .kpi-rule { background: var(--warn); }
.kpi.accent-ok .kpi-rule { background: var(--ok); }
.kpi-label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.kpi-value {
  font-size: 27px; font-weight: 690; letter-spacing: -.6px; line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.kpi-foot { font-size: 11.5px; color: var(--text-3); }
.kpi-value.danger { color: var(--danger); }
.kpi-value.warn { color: var(--warn); }
.kpi-value.ok { color: var(--ok); }

/* ============================================================
   10. 事项行
   ============================================================ */
.item-list { display: flex; flex-direction: column; gap: 8px; }
.item-row {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: flex; align-items: flex-start; gap: 12px;
  cursor: pointer; transition: box-shadow .15s, border-color .15s, transform .1s;
  position: relative;
}
.item-row:active { transform: scale(.995); }
.item-row.done { opacity: .58; }
.item-row.pinned { border-left: 3px solid var(--brand); }

.pri {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px;
  color: #fff; letter-spacing: .3px; margin-top: 2px;
}
.pri-P0 { background: var(--p0); }
.pri-P1 { background: var(--p1); }
.pri-P2 { background: var(--p2); }
.pri-P3 { background: var(--p3); }

.item-main { flex: 1; min-width: 0; }
.item-title {
  font-size: 14px; font-weight: 580; margin-bottom: 3px;
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.item-title .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.item-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text-3);
}
.item-detail-preview {
  font-size: 12.5px; color: var(--text-2); margin-top: 4px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2;
}

/* ---------- chip ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 3px; font-size: 11px; padding: 1.5px 7px;
  border-radius: 20px; background: var(--chip-bg); color: var(--text-2); white-space: nowrap;
  line-height: 1.7;
}
.chip-outline { background: transparent; border: 1px solid var(--line-strong); }
.chip-danger { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.chip-warn { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.chip-ok { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.chip-purple { background: var(--purple-soft); color: var(--purple); }
.chip-brand { background: var(--brand-soft); color: var(--brand-deep); }

/* ---------- 进度条 ---------- */
.progress-wrap { flex: 0 0 118px; text-align: right; }
.progress-num { font-size: 12.5px; font-weight: 660; font-variant-numeric: tabular-nums; }
.progress-bar { height: 5px; background: var(--track); border-radius: 4px; overflow: hidden; margin-top: 5px; }
.progress-fill {
  height: 100%; background: var(--grad-brand); border-radius: 4px;
  transition: width .35s cubic-bezier(.32, .72, 0, 1);
}
.progress-fill.ok { background: var(--ok); }
.progress-fill.warn { background: var(--warn); }
.progress-fill.danger { background: var(--danger); }
.progress-sub { font-size: 10.5px; color: var(--text-3); margin-top: 4px; }

/* ============================================================
   11. 看板
   ============================================================ */
.board {
  display: grid; grid-template-columns: repeat(6, minmax(210px, 1fr));
  gap: 12px; overflow-x: auto; padding-bottom: 10px;
}
.bcol {
  background: var(--col-bg); border-radius: var(--radius); padding: 10px; min-height: 200px;
  display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line);
}
.bcol-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; font-weight: 660; padding: 0 2px 4px;
}
.bcol-head .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.bcol-head .n {
  background: var(--panel); border-radius: 20px; padding: 0 7px; font-size: 11px; color: var(--text-2);
}
.bcard {
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px;
  cursor: pointer; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s, border-color .15s;
}
.bcard:active { transform: scale(.985); }
.bcard-title { font-size: 13px; font-weight: 570; margin-bottom: 6px; line-height: 1.45; }
.bcard-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--text-3); }

/* ============================================================
   12. 资源
   ============================================================ */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap; background: var(--panel);
  border: 1px solid var(--line); padding: 4px; border-radius: 11px;
}
.tab {
  padding: 6px 12px; border-radius: 8px; border: none; background: transparent;
  color: var(--text-2); font-size: 12.5px; white-space: nowrap; transition: background .13s, color .13s;
  display: inline-flex; align-items: center; gap: 5px;
}
.tab > .ic { color: var(--text-3); transition: color .13s; }
.tab.active > .ic { color: var(--brand); }
.tab.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: 630; }
.tab .n { opacity: .6; margin-left: 3px; font-size: 11px; }

.input {
  padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--panel); outline: none; min-width: 180px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 12px; }
.res-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 15px; cursor: pointer; transition: box-shadow .15s, border-color .15s, transform .15s;
  position: relative;
}
.res-card:active { transform: scale(.99); }
.res-head { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 7px; padding-right: 22px; }
.res-icon { font-size: 17px; line-height: 1.3; }
.res-name { font-size: 13.5px; font-weight: 620; flex: 1; min-width: 0; word-break: break-word; }
.res-summary {
  font-size: 12.5px; color: var(--text-2); margin: 6px 0 9px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-clamp: 3;
}
.res-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.res-foot {
  font-size: 11px; color: var(--text-3); display: flex; align-items: center;
  justify-content: space-between; gap: 8px;
}
.star-btn {
  position: absolute; top: 8px; right: 8px; background: none; border: none;
  color: inherit; opacity: .32; padding: 4px 6px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: opacity .15s, transform .12s, color .15s;
}
.star-btn.on { opacity: 1; color: var(--warn); }
.star-btn.on > .ic { fill: currentColor; }
.star-btn:active { transform: scale(.85); }

/* ============================================================
   13. 时间线
   ============================================================ */
.tl-day { margin-bottom: 22px; }
.tl-date {
  font-size: 12px; font-weight: 660; color: var(--text-2); margin-bottom: 10px;
  display: flex; align-items: center; gap: 9px;
}
.tl-date .line { flex: 1; height: 1px; background: var(--line); }
.tl-date .n { font-weight: 400; color: var(--text-3); font-size: 11.5px; }
.tl-items {
  border-left: 2px solid var(--line); margin-left: 6px; padding-left: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.tl-item { position: relative; }
.tl-item::before {
  content: ''; position: absolute; left: -25px; top: 6px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--panel); border: 2px solid var(--brand);
}
.tl-item.is-done::before { border-color: var(--ok); }
.tl-item.is-warn::before { border-color: var(--warn); }
.tl-body { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 10px 13px; }
.tl-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 3px; flex-wrap: wrap; }
.tl-link { color: var(--brand); font-weight: 620; cursor: pointer; }
.tl-content { font-size: 13px; color: var(--text); }
.tl-time { font-size: 11px; color: var(--text-3); margin-left: auto; font-variant-numeric: tabular-nums; }

/* ============================================================
   14. 收集箱
   ============================================================ */
.note-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 13px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
}
.note-row.done { opacity: .55; }
.note-row.done .note-text { text-decoration: line-through; }
.note-text { flex: 1; font-size: 13px; min-width: 0; word-break: break-word; }
.note-time { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.note-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); flex: 0 0 auto; }
.nr-check { margin-top: 4px; }

/* ============================================================
   15. 表格
   ============================================================ */
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tbl th {
  text-align: left; font-weight: 620; color: var(--text-2); font-size: 11.5px;
  padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap;
}
table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.tbl tr:last-child td { border-bottom: none; }
.mono { font-family: var(--mono); font-size: 12px; }

/* ============================================================
   16. 代码块
   ============================================================ */
.code {
  font-family: var(--mono); font-size: 12px; background: var(--code-bg); border: 1px solid var(--line);
  border-radius: 9px; padding: 11px 13px; overflow-x: auto; white-space: pre;
  color: var(--code-fg); line-height: 1.68; -webkit-overflow-scrolling: touch;
}
.code .k { color: var(--brand-deep); font-weight: 600; }

/* ============================================================
   17. 表单
   ============================================================ */
.form-row { margin-bottom: 13px; }
.form-row label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; font-weight: 560; }
.form-row .input, .form-row textarea, .form-row select { width: 100%; }
.form-row textarea {
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 9px;
  outline: none; resize: vertical; min-height: 74px; background: var(--panel-2);
  transition: border-color .15s, box-shadow .15s;
}
.form-row textarea:focus, .form-row select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: var(--panel); }
.form-row select { padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--panel); outline: none; }
.form-hint { font-size: 11px; color: var(--text-3); margin-top: 4px; line-height: 1.6; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.chips-input { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chips-input .chip .x { cursor: pointer; opacity: .55; margin-left: 2px; padding: 0 2px; }

input[type=range] {
  width: 100%; accent-color: var(--brand); height: 22px;
}
input[type=date] { min-height: 38px; }
input[type=checkbox] { accent-color: var(--brand); }

/* ============================================================
   18. 抽屉
   ============================================================ */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 92vw);
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateX(102%); transition: transform .26s cubic-bezier(.32, .72, 0, 1);
  z-index: 60; display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; padding-top: var(--safe-t);
  height: calc(58px + var(--safe-t)); flex: 0 0 calc(58px + var(--safe-t));
  border-bottom: 1px solid var(--line);
}
.drawer-head h3 {
  margin: 0; font-size: 15px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 620;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 18px; -webkit-overflow-scrolling: touch; }
.drawer-mask {
  position: fixed; inset: 0; background: rgba(10, 14, 20, .34); opacity: 0; pointer-events: none;
  transition: opacity .26s; z-index: 55;
}
.drawer-mask.show { opacity: 1; pointer-events: auto; }

.sec-title {
  font-size: 12px; font-weight: 660; color: var(--text-2); margin: 20px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.sec-title:first-child { margin-top: 0; }
.sec-title .line { flex: 1; height: 1px; background: var(--line); }

.kv { display: grid; grid-template-columns: 84px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); font-size: 12.5px; }
.kv dd { margin: 0; word-break: break-word; }

/* 抽屉里的下拉（优先级 / 状态），窄屏下自动等分收缩 */
.drawer-sel { min-width: 96px; }
.drawer-sel.wide { min-width: 108px; }

.log-composer {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 14px;
}
.log-composer textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; padding: 10px 12px;
  min-height: 62px; resize: vertical; outline: none; background: var(--panel); margin-bottom: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.log-composer textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.log-entry { display: flex; gap: 12px; padding: 11px 0; border-top: 1px dashed var(--line); }
.log-entry:first-child { border-top: none; }
.log-rail { flex: 0 0 54px; text-align: right; }
.log-pct { font-size: 13px; font-weight: 690; font-variant-numeric: tabular-nums; }
.log-delta { font-size: 10.5px; color: var(--ok); font-weight: 600; }
.log-content { flex: 1; font-size: 13px; min-width: 0; }
.log-foot {
  font-size: 11px; color: var(--text-3); margin-top: 4px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}

/* ============================================================
   19. 弹窗
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(10, 14, 20, .38); z-index: 80;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px 16px; overflow-y: auto;
}
.modal {
  width: min(620px, 100%); background: var(--panel); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: 88vh;
  animation: modalIn .22s cubic-bezier(.32, .72, 0, 1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15.5px; flex: 1; font-weight: 630; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ============================================================
   20. 命令面板
   ============================================================ */
.cmdk-mask {
  position: fixed; inset: 0; background: rgba(10, 14, 20, .38); z-index: 90;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh 16px;
}
.cmdk {
  width: min(680px, 100%); background: var(--panel); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column;
  max-height: 70vh; animation: modalIn .2s cubic-bezier(.32, .72, 0, 1);
}
.cmdk-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.cmdk-input-row input { flex: 1; border: none; outline: none; font-size: 15px; background: transparent; min-width: 0; }
.cmdk-results { overflow-y: auto; padding: 6px; }
.cmdk-group-title { font-size: 11px; color: var(--text-3); padding: 8px 12px 4px; font-weight: 620; }
.cmdk-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; cursor: pointer; font-size: 13.5px;
}
.cmdk-item.active { background: var(--brand-soft); }
.cmdk-item .ci { font-size: 14px; }
.cmdk-item .ct { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item .cs { font-size: 11.5px; color: var(--text-3); }
.cmdk-empty { padding: 30px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ============================================================
   21. Toast
   ============================================================ */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--toast-bg); color: var(--toast-fg); padding: 10px 18px; border-radius: 10px;
  font-size: 13px; z-index: 120; box-shadow: var(--shadow-lg); max-width: 86vw;
  animation: toastIn .22s cubic-bezier(.32, .72, 0, 1);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* ============================================================
   22. 空态 / 骨架屏
   ============================================================ */
.empty { text-align: center; padding: 52px 20px; color: var(--text-3); }
.empty .e-icon { font-size: 34px; display: block; margin-bottom: 10px; opacity: .5; }
.empty .e-title { font-size: 14px; color: var(--text-2); margin-bottom: 5px; font-weight: 560; }
.empty .e-hint { font-size: 12.5px; }

.sk-wrap { display: flex; flex-direction: column; gap: 14px; }
.sk {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--sk-base) 25%, var(--sk-hi) 37%, var(--sk-base) 63%);
  background-size: 400% 100%;
  animation: skShimmer 1.5s ease-in-out infinite;
}
@keyframes skShimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.sk-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.sk-card { height: 96px; border-radius: var(--radius-lg); }
.sk-line { height: 13px; }
.sk-block { height: 132px; border-radius: var(--radius-lg); }

/* ============================================================
   23. 工具类
   ============================================================ */
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
.flex { display: flex; } .between { justify-content: space-between; } .center { align-items: center; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap6 { gap: 6px; }
.wrap { flex-wrap: wrap; }
/* 把元素推到筛选栏右端；手机上取消，让控件自然铺满 */
.spacer { margin-left: auto; }
/* 「仅看未完成」这类内联 checkbox 胶囊 */
.chip-toggle { cursor: pointer; padding: 6px 10px; user-select: none; -webkit-user-select: none; }
.chip-toggle input[type=checkbox] { margin-right: 5px; accent-color: var(--brand); }

/* ============================================================
   24. 滚动条
   ============================================================ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb); border-radius: 6px;
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-track { background: transparent; }
/* ============================================================
   25. 悬停态（仅精确指针设备）
   ============================================================ */
@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration: underline; }
  ::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); background-clip: content-box; }
  .nav-item:hover { background: var(--hover); color: var(--text); }
  .nav-item.active:hover { background: var(--brand-soft); color: var(--brand-deep); }
  .side-cmd:hover { border-color: var(--line-strong); color: var(--text-2); }
  .btn:hover { background: var(--hover); border-color: var(--line-strong); }
  .btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
  .btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
  .btn-ghost:hover { background: var(--hover); }
  .icon-btn:hover { background: var(--hover); color: var(--text); }
  .item-row:hover { box-shadow: var(--shadow); border-color: var(--line-strong); }
  .bcard:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
  .res-card:hover { box-shadow: var(--shadow); border-color: var(--line-strong); }
  .res-card:hover .star-btn { opacity: .7; }
  .star-btn:hover { opacity: 1 !important; }
  .tab:hover { background: var(--hover); }
  .tab.active:hover { background: var(--brand-soft); }
  table.tbl tr:hover td { background: var(--panel-2); }
  .cmdk-item:hover { background: var(--brand-soft); }
  .chips-input .chip .x:hover { opacity: 1; }
  .card-title .more:hover { text-decoration: underline; }
  .tl-link:hover { text-decoration: underline; }
}

/* ============================================================
   26. 响应式 · 平板（图标侧栏）
   ============================================================ */
@media (max-width: 1400px) {
  .board { grid-template-columns: repeat(3, minmax(210px, 1fr)); }
}
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) and (min-width: 768px) {
  :root { --side-w: 64px; }
  .sidebar { padding: 16px 10px 12px; align-items: center; }
  .brand { justify-content: center; padding: 4px 0 16px; }
  .brand-text { display: none; }
  .nav { width: 100%; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .nav-item .nl { display: none; }
  .nav-item.active::before { left: -10px; }
  .nav-item .badge {
    position: absolute; top: 4px; right: 6px; margin: 0; min-width: 17px;
    padding: 0 4px; font-size: 10px; line-height: 16px;
  }
  .side-cmd { justify-content: center; padding: 9px 0; }
  .side-cmd .sc-text, .side-cmd kbd { display: none; }
  .side-meta { display: none; }
  .tb-desc { display: none; }
  .content { padding: 16px 16px 60px; }
  .split-a, .split-b { grid-template-columns: 1fr; }
}

/* ============================================================
   27. 响应式 · 手机（底部导航 + off-canvas 侧栏）
   ============================================================ */
@media (max-width: 767px) {
  :root { --topbar-h: 56px; }

  /* --- 侧栏转为抽屉 --- */
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(280px, 84vw);
    padding-top: calc(14px + var(--safe-t));
    padding-bottom: calc(14px + var(--safe-b));
    transform: translateX(-102%);
    transition: transform .27s cubic-bezier(.32, .72, 0, 1);
    box-shadow: var(--shadow-lg); border-right: none;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar .side-close { display: inline-flex; }
  .nav-item { padding: 11px 10px; font-size: 14.5px; }
  .nav-item.active::before { display: none; }
  .nav-item.active { background: var(--brand-soft); }

  /* --- 顶栏 --- */
  .topbar { padding: 0 12px; padding-top: var(--safe-t); height: calc(56px + var(--safe-t)); flex-basis: calc(56px + var(--safe-t)); gap: 8px; }
  .topbar h2 { font-size: 16px; }
  .tb-desc { display: none; }
  .topbar .tb-menu { display: inline-flex; margin-left: -6px; font-size: 17px; }
  .tb-left { gap: 8px; align-items: center; }
  .tb-right { gap: 4px; }
  #btnSearchM { display: inline-flex; }
  .tb-soft { display: none; }
  .btn-new { padding: 8px 13px; border-radius: 11px; font-size: 15px; }
  .btn-new .btn-txt { display: none; }
  .btn-new .btn-fallback { display: inline-flex; align-items: center; justify-content: center; }
  .tb-icon { padding: 8px 10px; font-size: 16px; }

  /* --- 底部导航占用空间 --- */
  .tabbar { display: flex; }
  .content { padding: 14px 12px calc(74px + var(--safe-b)); }
  .toast { bottom: calc(74px + var(--safe-b)); }

  /* --- 栅格单列 --- */
  .g-4, .g-3, .g-2 { grid-template-columns: 1fr !important; }
  .form-2, .form-3 { grid-template-columns: 1fr; }
  .sk-row { grid-template-columns: 1fr 1fr; }

  /* KPI 是短数字卡，两列比整行更省纵向空间；特异性高于 .g-4 故需并列 !important */
  .grid.kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .kpi-grid .card { padding: 12px 13px; }
  .kpi-grid .kpi-rule { top: 11px; bottom: 11px; }
  .kpi-grid .kpi-value { font-size: 23px; }
  .kpi-grid .kpi-foot { font-size: 11px; line-height: 1.45; }

  /* --- 事项行：进度下沉为独立一行 --- */
  .item-row { flex-wrap: wrap; gap: 8px 10px; padding: 12px 13px; }
  .item-main { flex: 1 1 auto; }
  .item-title { font-size: 14.5px; }
  .progress-wrap {
    flex: 1 0 100%; display: flex; align-items: center; gap: 10px;
    text-align: left; padding-top: 2px;
  }
  .progress-num { flex: 0 0 auto; min-width: 40px; font-size: 13px; }
  .progress-bar { flex: 1 1 auto; height: 6px; margin-top: 0; }
  .progress-sub { flex: 0 0 auto; margin-top: 0; font-size: 11px; }
  .item-detail-preview { -webkit-line-clamp: 2; line-clamp: 2; }

  /* --- 看板：横向滑动 + 吸附 --- */
  .board {
    display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity;
    padding-bottom: 14px; margin: 0 -12px; padding-left: 12px; padding-right: 12px;
    -webkit-overflow-scrolling: touch;
    /* 各列独立高度：否则短列会被拉齐到最长列，在纵向本就紧张的手机上白占屏 */
    align-items: flex-start;
  }
  .board::-webkit-scrollbar { display: none; }
  .bcol { flex: 0 0 78vw; scroll-snap-align: start; min-height: 160px; }
  .bcol-head { position: sticky; top: 0; }

  /* --- 筛选控件：横向可滑，避免挤成多行 --- */
  .filters { gap: 7px; }
  .filters .input { min-width: 0; flex: 1 1 132px; font-size: 16px; }
  .filters > .input:first-child { flex: 1 1 100%; }
  .tabs {
    flex-wrap: nowrap; overflow-x: auto; max-width: 100%; width: 100%;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 8px 13px; flex: 0 0 auto; }

  /* --- 资源卡单列 --- */
  .res-grid { grid-template-columns: 1fr; }
  .res-card { padding: 14px; }

  /* --- 表格 → 卡片（需 data-th 属性） --- */
  table.tbl.tbl-cards { border-collapse: separate; }
  table.tbl.tbl-cards thead { display: none; }
  table.tbl.tbl-cards tbody, table.tbl.tbl-cards tr, table.tbl.tbl-cards td { display: block; width: 100%; }
  table.tbl.tbl-cards tr {
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 10px 13px; margin-bottom: 8px; background: var(--panel);
  }
  table.tbl.tbl-cards td {
    padding: 3px 0; border: none; display: flex; align-items: center;
    justify-content: space-between; gap: 12px;
  }
  table.tbl.tbl-cards td::before {
    content: attr(data-th); color: var(--text-3); font-size: 11.5px; font-weight: 500; flex: 0 0 auto;
  }
  table.tbl.tbl-cards td:first-child {
    font-size: 14px; font-weight: 580; color: var(--text);
    justify-content: flex-start; padding-bottom: 7px; margin-bottom: 5px;
    border-bottom: 1px dashed var(--line);
  }
  table.tbl.tbl-cards td:first-child::before { display: none; }
  table.tbl:not(.tbl-cards) { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

  /* --- 抽屉全屏 --- */
  .drawer {
    width: 100%; max-width: 100%; border-left: none;
  }
  .drawer-body { padding: 16px 14px calc(24px + var(--safe-b)); }
  .log-composer { padding: 11px; }
  .log-rail { flex: 0 0 46px; }
  .kv { grid-template-columns: 78px 1fr; }
  .drawer-sel { flex: 1 1 0; min-width: 0; }
  .drawer-sel.wide { flex: 1.15 1 0; }

  /* 收集箱条目：窄屏改为堆叠，五个控件挤一行会不可点 */
  .note-row { flex-wrap: wrap; gap: 8px; }
  .note-time { margin-left: auto; }
  .note-text { flex: 1 1 100%; order: 3; }
  .note-row .btn-sm { order: 4; flex: 0 0 auto; }
  .note-row .icon-btn { order: 5; margin-left: auto; }

  /* --- 弹窗：底部对齐的 sheet --- */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%; max-width: 100%; max-height: 90dvh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: sheetIn .26s cubic-bezier(.32, .72, 0, 1);
  }
  @keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .modal.wide { width: 100%; }
  .modal-head { padding: 15px 16px; position: relative; }
  .modal-head::before {
    content: ''; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
    width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong);
  }
  .modal-body { padding: 16px; }
  .modal-foot {
    padding: 13px 16px calc(13px + var(--safe-b)); gap: 10px;
    position: sticky; bottom: 0; background: var(--panel);
  }
  .modal-foot .btn { flex: 1; padding: 11px 14px; font-size: 14px; }

  /* --- 命令面板占满 --- */
  .cmdk-mask { padding: calc(8px + var(--safe-t)) 8px 8px; align-items: flex-start; }
  .cmdk { max-height: calc(100dvh - 24px - var(--safe-t)); width: 100%; }
  .cmdk-input-row input { font-size: 16px; }
  .cmdk-item { padding: 12px 12px; }

  /* --- 触摸目标放大：iOS 推荐 >= 44px --- */
  .btn { min-height: 38px; }
  .btn-sm { min-height: 34px; padding: 7px 12px; font-size: 12.5px; }
  .icon-btn { min-width: 40px; min-height: 40px; padding: 8px; font-size: 16px; }
  .tab { min-height: 36px; }
  .star-btn { min-width: 40px; min-height: 40px; top: 6px; right: 6px; font-size: 17px; }
  .note-row .btn-sm { flex: 0 0 auto; }
  .nav-item { min-height: 44px; }
  .chip-toggle { min-height: 38px; padding: 0 12px; }
  /* 筛选栏右对齐元素在换行后失去意义，改为自然流 */
  .spacer { margin-left: 0; }

  /* --- iOS 防自动缩放：输入控件字号必须 >= 16px --- */
  input, textarea, select, .input { font-size: 16px; }
  .form-row label { font-size: 12.5px; }
  .login-card input { font-size: 16px; }

  /* --- 卡片内边距收紧 --- */
  /* 只读进度条与滑块在小屏上形成「双条」歧义；只留滑块，其填充色已按风险着色 */
  .drawer-bar { display: none; }

  /* 时间线：时间戳钉在右上角，避免长标题把它挤到单独一行 */
  .tl-head { position: relative; padding-right: 46px; }
  .tl-time { position: absolute; top: 1px; right: 0; margin-left: 0; }

  .card { padding: 14px; border-radius: var(--radius-lg); }
  .card-title { font-size: 13.5px; margin-bottom: 11px; }
  .kpi-value { font-size: 25px; }
  .empty { padding: 40px 16px; }
  .sec-title { margin: 17px 0 9px; }
  .code { font-size: 11.5px; padding: 10px 11px; }
  .tl-items { padding-left: 15px; }
  .tl-item::before { left: -22px; }
}

/* 超窄屏（iPhone SE 等 320–360px）进一步收紧 */
@media (max-width: 360px) {
  .content { padding-left: 10px; padding-right: 10px; }
  .tabbar-item .ti-label { font-size: 10px; }
  .item-title { font-size: 14px; }
  .card { padding: 12px; }
}

/* ============================================================
   28. 动效降级 & 打印
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
