/* ==========================================================================
   院系共青团总支工作台 · 样式表 v2
   依据：_LOOP/STYLE.md（设计规范 v1）
   基调：白纸黑字，一枚红印 —— 大面积中性，文字用墨色，红色只当印章。

   本文件的两条硬纪律：
   1) 全站色值只来自下方 :root 的 token，不出现规范外的十六进制色值；
   2) 普通卡片一律 1px 边框，不用软阴影（阴影只给浮层）。
   ========================================================================== */
:root {
  /* ---- 品牌（印）：只用于品牌标记、当前导航项、章节小标记 ---- */
  --brand: #B4232A;
  --brand-dark: #931C22;
  --brand-soft: #FBEDEE;

  /* ---- 主操作（墨）：全站主按钮只用它 ---- */
  --ink: #1B2434;
  --ink-hover: #2C3A4F;

  /* ---- 文字 ---- */
  --text: #1B2434;
  --text-2: #5A6B85;
  --text-3: #8C9AB0;          /* 仅时间戳、脚注。对比度 2.85:1，禁用于正文 */
  --text-3-strong: #667590;   /* 需要达标的弱信息（表头、说明），4.65:1 */

  /* ---- 结构 ---- */
  --line: #E4E9F1;
  --line-strong: #D3DBE8;
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --hover: #F7F9FC;

  /* ---- 语义 ---- */
  --success: #17A673;
  --warning: #E08A00;         /* 2.69:1，只做指示条/边框，不当文字 */
  --warning-ink: #956400;     /* 提醒文字用色，4.62:1 */
  --danger: #D92D20;
  --info: #2F6FED;            /* 降级为纯信息用途：说明、链接、图表 */

  /* ---- 标签四组（低饱和底 + 深字，色盲可辨：文字本身即状态） ---- */
  --tone-neutral-bg: #F1F1EF;
  --tone-neutral-ink: #5C6570;
  --tone-ok-bg: #EDF3EC;
  --tone-ok-ink: #346538;
  --tone-warn-bg: #FBF3DB;
  --tone-warn-ink: #956400;
  --tone-bad-bg: #FDEBEC;
  --tone-bad-ink: #9F2F2D;

  /* appearance.css owns theme palettes; these aliases preserve base-only rendering. */
  --on-primary: var(--card);
  --on-brand: var(--card);
  --on-success: var(--card);
  --on-danger: var(--card);
  --on-neutral: var(--card);
  --line-soft: var(--line);
  --event-outline: var(--line-strong);
  --loading-mask: rgba(255, 255, 255, .5);

  /* ---- 圆角只留两档 ---- */
  --radius: 10px;
  --radius-sm: 8px;

  /* ---- 阴影只给浮起来的东西 ---- */
  --shadow: 0 1px 3px rgba(20, 30, 50, .08), 0 6px 16px rgba(20, 30, 50, .06);
  --shadow-lg: 0 12px 40px rgba(20, 30, 50, .18);
  --mask: rgba(20, 30, 50, .45);

  --sidebar-w: 232px;
  --tabbar-h: 56px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
               "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", sans-serif;
  font-size: 14px;
  line-height: 22px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 2px; }
.hidden { display: none !important; }
.muted { color: var(--text-3-strong); font-size: 13px; }
.dim { color: var(--text-3); }
.center { text-align: center; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.spacer { margin-left: auto; }

/* 系统设置：访问范围、时间与日志都使用普通表单和文本。 */
.system-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.system-tab-current { color: var(--brand); background: var(--brand-soft); border-color: var(--brand); }
.access-mode-options { min-width: 0; padding: 0; margin: 12px 0; border: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.access-mode-options legend { padding: 0; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.access-choice { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.access-mode-options .access-choice { padding: 0 12px; }
.access-choice input { flex: 0 0 auto; }
.access-choice span { overflow-wrap: anywhere; }
.access-range { margin: 8px 0; overflow-wrap: anywhere; }
.access-window-summary { margin-bottom: 12px; }
.access-save-error { min-height: 20px; margin-top: 8px; }
.access-health-title { margin-top: 16px; font-size: 14px; }
.access-health { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; margin: 12px 0 0; }
.access-health dt { color: var(--text-2); }
.access-health dd { margin: 0; overflow-wrap: anywhere; }
.access-log-card { min-width: 0; }
.access-log-note { margin-bottom: 16px; }
.access-log-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.access-log-filters .field { min-width: 0; }
.access-log-filters .access-choice { margin-bottom: 12px; }
.access-log-card > .muted { margin-top: 12px; }
.access-log-lines { display: block; width: 100%; max-width: 100%; min-width: 0; max-height: 480px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; margin: 12px 0 0; padding: 12px; font-size: 12px; line-height: 20px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }

@media (max-width: 767px) {
  .access-log-filters { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .access-log-lines { max-height: 360px; }
  .access-mode-options .access-choice { flex: 1; }
}

/* 数字一律表格化对齐：工时、条数、金额、百分比 */
.num, .stat .v, .bar-line .value, .pager, .kv .num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* 图标（内联 SVG） */
.icon { width: 20px; height: 20px; flex: 0 0 20px; display: inline-block; vertical-align: -3px; }
.icon-sm { width: 16px; height: 16px; flex: 0 0 16px; vertical-align: -2px; }
.icon-btn .icon, .nav-item .icon, .tab-item .icon { pointer-events: none; }

/* =========================================================== 登录页
   登录页是唯一允许居中的地方（规范：非宣传页禁止居中大标题） */
.login-wrap {
  min-height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.login-card {
  width: 100%; max-width: 384px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px 20px;
}
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.login-brand h1 { font-size: 20px; line-height: 28px; }
.login-brand p { font-size: 13px; color: var(--text-3-strong); }
.login-foot { margin-top: 14px; text-align: center; }
.login-foot .muted { font-size: 12px; }

/* 品牌标记：一枚红印 */
.brand-mark {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 18px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.brand-mark.small { width: 32px; height: 32px; flex: 0 0 32px; font-size: 15px; }

/* =========================================================== 表单 */
.field { display: block; margin-bottom: 12px; }
.field > span {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); margin-bottom: 6px; line-height: 18px;
}
.field > span .req { color: var(--danger); }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  min-height: 38px;
  font: inherit; font-size: 14px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft);
}
textarea { resize: vertical; min-height: 84px; line-height: 22px; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; }
input:disabled, select:disabled, textarea:disabled { background: var(--hover); color: var(--text-3-strong); }
.field-error { color: var(--danger); font-size: 12.5px; margin-top: 4px; display: block; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }

/* =========================================================== 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 7px 14px;
  font: inherit; font-weight: 500; font-size: 13.5px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
/* 主按钮：墨色实底 + 白字。每屏最多一个 */
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--on-primary); font-weight: 600; }
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-danger { background: var(--card); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--tone-bad-bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-success { background: var(--tone-ok-ink); border-color: var(--tone-ok-ink); color: var(--on-success); }
.btn-success:hover { filter: brightness(1.08); }
.btn-sm { min-height: 30px; padding: 3px 9px; font-size: 12.5px; }
.btn-block { width: 100%; min-height: 44px; font-size: 15px; margin-top: 4px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.icon-btn {
  border: none; background: transparent; cursor: pointer;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* =========================================================== 布局骨架 */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 16px 14px 12px; }
.brand-text { display: flex; flex-direction: column; overflow: hidden; }
.brand-text strong { font-size: 14.5px; line-height: 20px; }
.brand-text small { color: var(--text-3-strong); font-size: 11.5px; line-height: 16px; }

.nav { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }
.nav-group {
  font-size: 12px; font-weight: 600;
  color: var(--text-3-strong); padding: 14px 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  min-height: 38px; padding: 8px 10px; margin-bottom: 1px;
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-2); font-weight: 400; font-size: 13.5px;
  border: none; background: transparent; width: 100%; text-align: left; font-family: inherit;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
/* 当前导航项：品牌红的用武之地之一 */
.nav-item.active {
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--brand);
}
.nav-item .badge { margin-left: auto; }

.sidebar-foot { padding: 10px; border-top: 1px solid var(--line); }
.me-card { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark);
  font-weight: 600; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.me-info { overflow: hidden; flex: 1; }
.me-info strong { display: block; font-size: 13px; line-height: 18px; }
.me-info small { color: var(--text-3-strong); font-size: 11.5px; line-height: 16px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px 12px;
  background: var(--bg);
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--line);
}
.topbar-title { min-width: 0; flex: 0 1 auto; }
.topbar-title h2 {
  font-size: 20px; line-height: 28px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-title p { font-size: 13px; line-height: 20px; color: var(--text-3-strong); }
.topbar-actions {
  margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  min-width: 0;
}

/* 次要操作折叠区：桌面平铺成一排，手机收进「更多」菜单。
   由 enhancePage() 在每页渲染后把排在第一位的按钮之后的所有内容搬进来。 */
.topbar-more {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  position: relative;
}
.topbar-more > button { display: none; }        /* 「更多」菜单按钮，桌面隐藏 */
.topbar-more > button .icon-sm { transform: rotate(90deg); }   /* 右箭头朝下 */
.topbar-more-list { display: contents; }        /* 桌面：融进父级 flex 行 */
/* 手机：收成真正的下拉菜单 */
@media (max-width: 767px) {
  .topbar { gap: 8px; }
  .topbar-more > button { display: inline-flex; }
  .topbar-more-list {
    display: none;
    position: absolute; right: 0; top: calc(100% + 6px);
    flex-direction: column; align-items: stretch; gap: 6px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 8px; min-width: 168px; z-index: 40;
  }
  .topbar-more.open .topbar-more-list { display: flex; }
  .topbar-more-list > .btn,
  .topbar-more-list > button { width: 100%; justify-content: flex-start; }
}

/* 内容区：桌面最大 1120 居中 */
.page {
  padding: 16px 24px 40px;
  width: 100%; max-width: 1120px; margin: 0 auto;
}
.announce {
  margin: 12px auto 0; width: 100%; max-width: 1120px;
  padding: 10px 14px;
  background: var(--tone-warn-bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--warning);
  color: var(--tone-warn-ink);
  border-radius: var(--radius-sm);
  font-size: 13px; line-height: 20px;
  display: flex; gap: 9px; align-items: flex-start;
}
.announce .x { margin-left: auto; cursor: pointer; }

/* =========================================================== 卡片 / 栅格 */
.grid { display: grid; gap: 16px; }
/* 栅格子项必须允许收缩到内容宽度以下，否则内部的 .table-wrap
   即使写了 overflow-x: auto 也不会出现滚动条 —— 表格会把整列撑宽，
   右侧几列被裁掉（R2.1.2 报告 P1：1440/1600/1920 下排行榜只显示前半张表）。 */
.grid.side > *, .grid.side-r > * { min-width: 0; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.grid.side-r { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }

/* 卡片是分组容器，不是装饰：1px 边框，无软阴影 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card-head { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 16px; line-height: 24px; font-weight: 600; }
.card-head .sub { font-size: 13px; color: var(--text-3-strong); }
.card.flush { padding: 0; overflow: hidden; }
.card-section { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }

/* 指标块：大数字只用在真正需要一眼看到的地方 */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .k { font-size: 13px; line-height: 20px; color: var(--text-3-strong); }
.stat .v { font-size: 24px; font-weight: 600; line-height: 30px; }
.stat .v small { font-size: 13px; font-weight: 400; color: var(--text-3-strong); margin-left: 2px; }
.stat.accent .v { color: var(--brand); }
.stat.ok .v { color: var(--tone-ok-ink); }
.stat.warn .v { color: var(--warning-ink); }
.stat.dim .v { color: var(--text-2); }
.stat .hint { font-size: 12.5px; line-height: 18px; color: var(--text-3-strong); }

/* =========================================================== 表格（台账的核心） */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tb th, table.tb td {
  padding: 9px 12px; min-height: 40px;
  text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
table.tb th {
  font-size: 12.5px; font-weight: 600; color: var(--text-3-strong);
  background: var(--card); white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
  border-bottom: 1px solid var(--line-strong);
}
table.tb tbody tr:hover { background: var(--hover); }
table.tb tbody tr:last-child td { border-bottom: none; }
table.tb td.num, table.tb th.num { text-align: right; }
table.tb td.mid, table.tb th.mid { text-align: center; }
table.tb .content-cell { max-width: 520px; }
table.tb td strong { font-weight: 600; }

/* 列宽工具类：中文表格最容易出的问题是「姓名被逐字折成三行」
   （R2 报告 P2-c），所以姓名列固定不折，长文本列用省略号 + title 提示。

   同时要盯住**整体宽度**：姓名列一旦 nowrap 就不能再压缩，若同一张表里
   还有别的 nowrap 列，整张表会撑破卡片、右侧几列被裁掉
   （R2.1.1 报告 P2-A：1280px 下排行榜 672px > 卡片 388px，工时/条数/类别三列被挤出）。
   所以只让姓名列 nowrap，其余长列一律 ellipsis，并给每列一个宽度上限。 */
table.tb .col-name { white-space: nowrap; min-width: 64px; max-width: 132px;
  overflow: hidden; text-overflow: ellipsis; }
table.tb .col-tight { white-space: nowrap; }
table.tb .col-text {
  max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 标签列：胶囊排成一行、不换行，超出省略。
   否则 4 行胶囊会把行高从 40px 撑到 100px+（R2.1.1 报告 P2-B）。
   注意用 flex + nowrap 让胶囊自己缩不掉、由容器裁切，
   这样行高只由这一行决定，不会随内容行数变化。 */
table.tb .col-tags {
  max-width: 190px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
table.tb .col-tags > .tag {
  display: inline-flex; vertical-align: middle;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
/* 姓名后面跟的身份小标签 */
table.tb .col-tag-inline { margin-left: 6px; }
table.tb .col-tag-inline + .col-tag-inline { margin-left: 4px; }
/* 数字列给个下限，避免被内容挤成竖排 */
table.tb th.num, table.tb td.num { min-width: 56px; }
table.tb th:first-child, table.tb td:first-child { white-space: nowrap; }

/* =========================================================== 状态标签
   浅底 + 深字 + 小圆点；文字本身就是状态，不靠颜色单独表意 */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap;
  background: var(--tone-neutral-bg); color: var(--tone-neutral-ink);
}
.tag::before {
  content: ""; width: 5px; height: 5px; border-radius: 999px;
  background: currentColor; flex: 0 0 5px; opacity: .85;
}
.tag.plain::before { display: none; }
.tag.green, .tag.ok { background: var(--tone-ok-bg); color: var(--tone-ok-ink); }
.tag.amber, .tag.warn { background: var(--tone-warn-bg); color: var(--tone-warn-ink); }
.tag.red, .tag.bad { background: var(--tone-bad-bg); color: var(--tone-bad-ink); }
.tag.gray, .tag.neutral { background: var(--tone-neutral-bg); color: var(--tone-neutral-ink); }
/* 蓝色降级为纯信息用途 */
.tag.blue, .tag.info { background: var(--tone-neutral-bg); color: var(--tone-neutral-ink); }

.badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--brand); color: var(--on-brand);
  font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.badge.gray { background: var(--tone-neutral-ink); color: var(--on-neutral); }

/* =========================================================== 列表 */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; gap: 11px; padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 13.5px; line-height: 20px; }
.list-item .li-meta { color: var(--text-3-strong); font-size: 12.5px; line-height: 18px; margin-top: 2px; }
.li-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* 空状态：一句话 + 一个行动入口 */
.empty {
  padding: 28px 16px; text-align: center; color: var(--text-3-strong); font-size: 13.5px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty .icon-empty { width: 28px; height: 28px; flex: 0 0 28px; color: var(--text-3); }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* 品牌提示卡：顶部一条红边（刻意不用「卡片左侧彩色竖条」——规范第 4 项禁止） */
.card-brand { border-top: 2px solid var(--brand); }

/* =========================================================== 表单行 */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; }
.inline-form .field.grow { flex: 1; min-width: 180px; }

.quick { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.quick-row { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; align-items: flex-end; }
.quick-row .field { margin: 0; }

/* 快速记录独立布局：内容通栏，日期、工时、任务与提交在下一行对齐。 */
.quick .quick-record-grid { display: grid; grid-template-columns: 160px 112px minmax(0, 1fr) auto; gap: 12px 16px; margin-top: 12px; align-items: end; }
.quick .quick-record-grid > .field { margin-bottom: 0; min-width: 0; }
.quick .quick-record-content { grid-column: 1 / -1; }
.quick .quick-record-grid input, .quick .quick-record-grid select { width: 100%; max-width: 100%; min-width: 0; height: 44px; min-height: 44px; }
.quick .quick-record-content textarea { width: 100%; max-width: 100%; min-width: 0; min-height: 88px; }
.quick .quick-actions { min-width: 0; align-self: end; }
.quick .quick-actions .btn { height: 44px; min-height: 44px; white-space: nowrap; }

@media (max-width: 1023px) {
  .quick .quick-record-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick .quick-actions .btn { width: 100%; }
}
@media (max-width: 767px) {
  .quick .quick-record-task, .quick .quick-actions { grid-column: 1 / -1; }
}

/* 筛选 chip：选中 = 品牌浅底 + 品牌字 + 1px 边框 */
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center;
  min-height: 30px; padding: 3px 11px; border-radius: 999px; cursor: pointer;
  background: var(--card); color: var(--text-2); font-size: 12.5px;
  border: 1px solid var(--line); user-select: none;
}
.chip:hover { background: var(--hover); border-color: var(--line-strong); }
.chip.on { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); font-weight: 600; }

/* =========================================================== 图表 */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
/* 柱体默认墨色，只有「当前月」标红——红是印章，不是墙纸（规范 2.1） */
.chart .bar { fill: var(--ink); }
.chart .bar:hover { opacity: .8; }
.chart .bar.current { fill: var(--brand); }
.chart .bar.dim { fill: var(--line-strong); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .lbl { font-size: 10px; fill: var(--text-3-strong); }
.chart .val { font-size: 10px; fill: var(--text-2); font-weight: 600; }

/* 进度：高 8px，底 --line，填充 --brand，右侧配数字 */
.bar-line { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-line .name { width: 78px; flex: 0 0 78px; font-size: 12.5px; color: var(--text-2); }
.bar-line .track { flex: 1; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar-line .fill { height: 100%; background: var(--brand); border-radius: 4px; }
/* 语义色只作为辅助：数字本身已经说明了高低 */
.bar-line .fill.ok { background: var(--success); }
.bar-line .fill.warn { background: var(--warning); }
.bar-line .fill.bad { background: var(--danger); }
.bar-line .value { width: 76px; flex: 0 0 76px; text-align: right; font-size: 12.5px; }

/* 进度条（独立组件） */
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }
.progress-row .num { width: 86px; flex: 0 0 86px; text-align: right; font-size: 12.5px; color: var(--text-2); }

.rank-no {
  width: 20px; height: 20px; border-radius: var(--radius-sm); flex: 0 0 20px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 600;
  background: var(--tone-neutral-bg); color: var(--tone-neutral-ink);
}
.rank-no.top1 { background: var(--tone-warn-bg); color: var(--tone-warn-ink); }
.rank-no.top2, .rank-no.top3 { background: var(--tone-neutral-bg); color: var(--tone-neutral-ink); }

/* =========================================================== 热力图 */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 11px); gap: 3px; }
.heat i { width: 11px; height: 11px; border-radius: 2px; background: var(--line); display: block; }
.heat i.l0 { background: var(--line); }
.heat i.l1 { background: var(--brand-soft); }
.heat i.l2 { background: color-mix(in srgb, var(--brand) 40%, var(--card)); }
.heat i.l3 { background: color-mix(in srgb, var(--brand) 70%, var(--card)); }
.heat i.l4 { background: var(--brand); }
@supports not (background: color-mix(in srgb, red, blue)) {
  .heat i.l2 { background: var(--brand); opacity: .45; }
  .heat i.l3 { background: var(--brand); opacity: .75; }
}
.heat-legend { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-3-strong); margin-top: 8px; }
.heat-legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }

/* =========================================================== 浮层 */
.modal-root { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-mask { position: absolute; inset: 0; background: var(--mask); }
.modal {
  position: relative; z-index: 1;
  width: 100%; max-width: 620px; max-height: 88vh;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modalIn 180ms ease-out;
}
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; line-height: 24px; flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 18px; border-top: 1px solid var(--line); background: var(--card);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* =========================================================== 提示 */
.alert {
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 20px; margin-bottom: 12px;
  border: 1px solid var(--line);
  display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap;
}
.alert-error { background: var(--tone-bad-bg); color: var(--tone-bad-ink); border-color: var(--danger); }
.alert-info { background: var(--card); color: var(--text-2); }
.alert-ok { background: var(--tone-ok-bg); color: var(--tone-ok-ink); }
.alert-warn { background: var(--tone-warn-bg); color: var(--tone-warn-ink); }

.toast-root { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--on-primary);
  font-size: 13.5px; box-shadow: var(--shadow-lg);
  max-width: 340px; animation: toastIn 180ms ease-out;
}
.toast.ok { background: var(--tone-ok-ink); color: var(--on-success); }
.toast.err { background: var(--tone-bad-ink); color: var(--on-danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* 加载态：顶部细条 + 遮罩，避免整屏转圈 */
.loading { position: fixed; inset: 0; z-index: 300; background: var(--loading-mask); display: flex; align-items: center; justify-content: center; }
.spinner {
  width: 28px; height: 28px; border-radius: 999px;
  border: 2.5px solid var(--line-strong); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 0 0; font-size: 13px; }
.pager .muted { margin-right: auto; }

/* 附件 */
.att-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.att {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; background: var(--hover); border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text-2);
}
.att:hover { background: var(--brand-soft); border-color: var(--brand); text-decoration: none; }
.drop {
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  padding: 14px; text-align: center; color: var(--text-3-strong); font-size: 13px;
  cursor: pointer;
}
.drop:hover, .drop.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }

/* 只读描述块 */
.kv { display: grid; grid-template-columns: 84px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--text-3-strong); }
.kv dd { margin: 0; }

/* 分隔线 */
.hr { height: 1px; background: var(--line); border: 0; margin: 16px 0; }

/* =========================================================== 移动端导航
   底部 tab：最常用的 4 项常驻；其余进汉堡抽屉 */
.tabbar { display: none; }
.tabbar-inner {
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: var(--tabbar-h);
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 11px; line-height: 14px;
  color: var(--text-3-strong); padding: 0; min-height: 44px;
  position: relative;
}
.tab-item.active { color: var(--brand-dark); font-weight: 600; }
.tab-item .icon { width: 22px; height: 22px; flex: 0 0 22px; }
.tab-item .badge { position: absolute; top: 4px; right: 50%; margin-right: -22px; }

/* 抽屉里的当前用户与退出 */
.sidebar-foot .btn-row { margin-top: 8px; }

.scrim {
  position: fixed; inset: 0; z-index: 55; background: var(--mask);
}

.only-mobile { display: none; }

/* =========================================================== 响应式 */
/* 平板：侧栏收窄，内容区左右 16 */
@media (max-width: 1023px) {
  :root { --sidebar-w: 200px; }
  .page { padding: 16px 16px 40px; }
  .topbar { padding: 12px 16px 10px; }
  .announce { margin-left: 16px; margin-right: 16px; width: calc(100% - 32px); max-width: none; }
}

/* 窄桌面 / 横屏平板：两栏布局会把表格挤到 400px 上下，
   中文列一旦 nowrap 就撑破卡片（R2.1.1 报告 P2-A 正是 1280px 下拍的）。
   这一档改成单栏，把宽度让给表格。放在 1100px 那条之前，避免同优先级覆盖。 */
@media (max-width: 1400px) {
  .grid.side, .grid.side-r { grid-template-columns: minmax(0, 1fr); }
}

/* 宽屏（>1400px）虽然回到两栏，但「工作量排行」这类宽表在两栏里
   只有约 420px，六列放不下（R2.1.2 报告 P1：1440/1600/1920 三档都中招）。
   让带宽表的卡片跨满整行，其余卡片照旧并排。 */
@media (min-width: 1401px) {
  .grid.side > .span-all, .grid.side-r > .span-all { grid-column: 1 / -1; }
}
/* 万一仍有放不下的宽表，至少能横向滚动，而不是把右侧列裁掉 */
.table-wrap { max-width: 100%; }

@media (max-width: 1100px) {
  .grid.c4, .grid.c5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side, .grid.side-r { grid-template-columns: minmax(0, 1fr); }
}

/* 手机：顶栏 + 内容 + 底部 tab，侧栏变抽屉 */
@media (max-width: 767px) {
  :root { --sidebar-w: 264px; }
  .only-mobile { display: inline-flex; }

  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0;
    transform: translateX(-104%); transition: transform 180ms ease-out;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .tabbar { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; }

  .main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .topbar { padding: 10px 16px; min-height: 52px; }
  .topbar-title { flex: 1 1 auto; }
  .topbar-title h2 { font-size: 18px; line-height: 26px; }
  .topbar-title p { display: none; }
  /* 顶部操作区：只留一个主操作，其余进「更多」菜单（R2 报告 P2-a）。
     不换行 —— 换行会把标题挤成两行、按钮摊成两排。 */
  .topbar-actions { gap: 6px; flex-wrap: nowrap; }
  .topbar-actions > .btn { flex: 0 0 auto; }
  .page { padding: 12px 16px 24px; }
  .announce { margin: 10px 16px 0; }

  .grid.c2, .grid.c3, .grid.c4, .grid.c5 { grid-template-columns: minmax(0, 1fr); }
  /* 指标卡改 2 列：首屏留给内容，不要五张卡各占一行（R2 报告 P2-b） */
  .grid.stat-grid, .grid.c2.stat-grid, .grid.c3.stat-grid,
  .grid.c4.stat-grid, .grid.c5.stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grid.stat-grid .stat .v { font-size: 20px; line-height: 26px; }
  .grid.stat-grid .stat .k { font-size: 12.5px; line-height: 18px; }
  .grid { gap: 12px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 14px 16px; }
  .stat .v { font-size: 22px; line-height: 28px; }

  /* 触控目标 ≥44px */
  .btn { min-height: 44px; padding: 10px 14px; font-size: 14px; }
  .btn-sm { min-height: 36px; }
  .icon-btn { width: 44px; height: 44px; }
  input, select, textarea { min-height: 44px; font-size: 16px; }
  .chip { min-height: 34px; }
  .nav-item { min-height: 44px; }

  /* 浮层：底部抽屉式，提交按钮够得着 */
  .modal-root { align-items: flex-end; padding: 0; }
  .modal, .modal.wide {
    max-width: none; max-height: 92vh;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
  }
  .modal-foot {
    position: sticky; bottom: 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .modal-foot .btn { flex: 1; }

  /* ---- 表格转卡片列表：不许横向滚动 ---- */
  .table-wrap { overflow-x: visible; }
  table.tb { display: block; font-size: 14px; }
  table.tb thead { display: none; }
  table.tb tbody { display: block; }
  table.tb tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 10px;
    background: var(--card);
  }
  table.tb tr:last-child { margin-bottom: 0; }
  table.tb td {
    display: flex; align-items: baseline; gap: 10px;
    padding: 3px 0; border: none; min-height: 24px;
    text-align: left !important;
  }
  /* 首列当卡片标题 */
  table.tb td:first-child {
    font-weight: 600; font-size: 15px; line-height: 22px;
    padding-bottom: 6px;
  }
  table.tb td:first-child::before { display: none; }
  table.tb td::before {
    content: attr(data-label);
    flex: 0 0 76px;
    color: var(--text-3-strong);
    font-size: 12.5px; font-weight: 400;
  }
  table.tb td:empty { display: none; }
  table.tb td.num, table.tb td.mid { text-align: left; }
  table.tb .content-cell { max-width: none; }
  table.tb td .btn-row { justify-content: flex-start !important; }
}

/* 动效：尊重系统设置 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
