/* 丁火排班 —— 前端样式（无框架、无构建）
 *
 * 设计取向：店长在 PC 上要「一眼看完一周、点哪排哪」，员工在手机上看
 * 「我今天几点到几点」。同一份样式，窄屏自动降级为竖排卡片。
 * 不引入任何外部字体/图标库：图标一律用字符（‹ › × +），保证离线与微信内可用。
 */

:root {
  --brand: #d9480f;
  --brand-soft: #fff4ec;
  --brand-line: #ffd8c2;

  --bg: #f4f5f7;
  --panel: #ffffff;
  --text: #1f2430;
  --text-dim: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;

  --ok: #0f7b3f;
  --ok-soft: #e8f6ee;
  --warn: #a15c00;
  --warn-soft: #fff6e5;
  --danger: #b42318;
  --danger-soft: #fdeceb;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .10);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #ff8a4c;
    --brand-soft: #3a2114;
    --brand-line: #6b3a1e;

    --bg: #14161a;
    --panel: #1c1f25;
    --text: #e8eaed;
    --text-dim: #9aa1ac;
    --line: #2b3038;
    --line-strong: #3a414b;

    --ok: #62d19a;
    --ok-soft: #16301f;
    --warn: #ffc266;
    --warn-soft: #33260f;
    --danger: #ff8b80;
    --danger-soft: #35191a;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }

/* [hidden] 必须压得住作者样式里的 display。
 * 浏览器的 UA 规则是 [hidden]{display:none}，优先级【低于】任何类选择器——
 * 于是 `.modal{display:flex}` / `.tb-right{display:flex}` 会让 hidden 属性失效
 * （元素照常显示，且不报任何错）。本页大量用 hidden 做视图与弹层开关，
 * 所以这条兜底必须放在最前面。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

/* ---------------- 顶栏 ---------------- */

#topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding-top: max(10px, env(safe-area-inset-top));
}
.tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand { font-weight: 700; letter-spacing: .5px; }
.brand::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px;
  border-radius: 50%; background: var(--brand); vertical-align: 1px;
}
.store-chip {
  font-size: 13px; color: var(--text-dim); padding: 2px 8px;
  border: 1px solid var(--line); border-radius: 999px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw;
}
.tb-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.nav-btn {
  appearance: none; border: 0; background: transparent; color: var(--text-dim);
  font: inherit; font-size: 14px; padding: 6px 10px; border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-btn:hover { background: var(--bg); color: var(--text); }
.nav-btn.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-btn.ghost { color: var(--text-dim); }

/* ---------------- 页面容器 ---------------- */

#main { padding: 16px 14px calc(32px + env(safe-area-inset-bottom)); }
.view { max-width: 560px; margin: 0 auto; }
.view.wide { max-width: 1180px; }
.view.narrow { max-width: 520px; }

.page-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.page-head h2 { font-size: 17px; margin-right: auto; }
.head-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* ---------------- 表单与按钮 ---------------- */

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}

.btn {
  appearance: none; font: inherit; font-size: 14px; cursor: pointer;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
}
.btn:hover { border-color: var(--text-dim); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-dim); }
.btn.ghost:hover { background: var(--bg); color: var(--text); }
.btn.block { width: 100%; padding: 11px; }
.btn.icon { padding: 6px 11px; font-size: 16px; line-height: 1; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.link {
  appearance: none; border: 0; background: none; color: var(--brand);
  font: inherit; cursor: pointer; padding: 0; text-decoration: underline;
}
.row-actions { display: flex; gap: 8px; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 14px;
}

/* ---------------- 登录 ---------------- */

.auth-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 26px 20px; margin-top: 6vh; box-shadow: var(--shadow);
}
.auth-title { font-size: 21px; margin-bottom: 4px; }
.auth-sub { color: var(--text-dim); font-size: 13px; margin: 0 0 20px; }
.auth-switch { margin: 14px 0 0; font-size: 13px; color: var(--text-dim); }
.auth-switch .link { margin-left: 4px; }
.auth-note {
  margin: 12px 0 0; padding: 9px 11px; font-size: 13px;
  background: var(--danger-soft); color: var(--danger);
  border-radius: var(--radius-sm); white-space: pre-wrap;
}

/* ---------------- 门店列表 ---------------- */

.store-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.store-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 14px; cursor: pointer;
}
.store-item:hover { border-color: var(--brand-line); }
.store-item .si-main { min-width: 0; flex: 1; }
.store-item .si-name { font-weight: 600; }
.store-item .si-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.role-tag {
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); flex-shrink: 0;
}

/* ---------------- 周导航 ---------------- */

.week-nav { display: flex; align-items: center; gap: 4px; }
.week-label { font-weight: 600; font-variant-numeric: tabular-nums; }
.status-dot {
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: var(--bg); color: var(--text-dim); border: 1px solid var(--line);
}
.status-dot.draft { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.status-dot.published { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

.hint {
  margin: 0 0 12px; padding: 10px 12px; font-size: 13px;
  background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-sm);
  white-space: pre-wrap;
}
.empty { color: var(--text-dim); font-size: 14px; text-align: center; padding: 28px 0; }

/* ---------------- 排班网格 ---------------- */

.grid-wrap {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: auto;
  max-height: calc(100vh - 190px);
}
.sched-grid { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 760px; }

.sched-grid th, .sched-grid td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 0; vertical-align: top;
}
.sched-grid th:last-child, .sched-grid td:last-child { border-right: 0; }
.sched-grid tbody tr:last-child td { border-bottom: 0; }

.sched-grid thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--panel); padding: 8px 10px; text-align: left;
  font-size: 12px; font-weight: 600; color: var(--text-dim);
}
.sched-grid thead th .d-num { color: var(--text); font-size: 15px; }
.sched-grid thead th.today { color: var(--brand); }
.sched-grid thead th.today .d-num { color: var(--brand); }

.sched-grid .col-emp {
  position: sticky; left: 0; z-index: 1;
  background: var(--panel); width: 118px; min-width: 118px;
  padding: 9px 10px; font-size: 13px;
}
.sched-grid thead .col-emp { z-index: 3; }
.col-emp .emp-name { font-weight: 600; }
.col-emp .emp-meta { font-size: 11px; color: var(--text-dim); margin-top: 1px; }

.cell {
  min-height: 46px; padding: 5px; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
}
.cell:hover { background: var(--brand-soft); }
.cell.past { background: var(--bg); cursor: not-allowed; }
.cell.past:hover { background: var(--bg); }

.shift-pill {
  border-radius: var(--radius-sm); padding: 5px 7px;
  background: var(--brand-soft); border-left: 3px solid var(--brand);
  font-size: 12px; line-height: 1.35;
}
.shift-pill .sp-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.shift-pill .sp-name { color: var(--text-dim); font-size: 11px; }
.shift-pill.cancelled { opacity: .45; text-decoration: line-through; }
.shift-pill.forced { border-left-color: var(--warn); background: var(--warn-soft); }

.cell-add {
  color: var(--text-dim); font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 36px; border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm); opacity: 0;
}
.cell:hover .cell-add { opacity: 1; }
@media (hover: none) { .cell-add { opacity: .55; } }

/* ---------------- 员工「我的班表」 ---------------- */

.me-list { display: grid; gap: 10px; }
.me-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 14px;
  display: flex; align-items: center; gap: 14px;
}
.me-card.today { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.me-date {
  text-align: center; flex-shrink: 0; width: 52px;
}
.me-date .md-dow { font-size: 12px; color: var(--text-dim); }
.me-date .md-num { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.me-main { flex: 1; min-width: 0; }
.me-time { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.me-name { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.me-badge {
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); flex-shrink: 0;
}

/* ---------------- 邀请码 ---------------- */

.invite-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 30px; font-weight: 700; letter-spacing: 6px; text-align: center;
  padding: 16px 10px; margin: 8px 0 10px;
  background: var(--brand-soft); color: var(--brand);
  border-radius: var(--radius); user-select: all;
}
.invite-link {
  font-size: 12px; color: var(--text-dim); word-break: break-all;
  background: var(--bg); padding: 9px 11px; border-radius: var(--radius-sm);
  user-select: all; margin-bottom: 10px;
}
.auth-note.info { background: var(--brand-soft); color: var(--brand); }

/* ---------------- 窄屏：导航改为底部 Tab 栏 ----------------
 * 手机上市 390px 宽度放不下「品牌 + 门店 + 5 个导航项」，
 * 挤的结果是品牌名被逐字竖排、门店名被截成两个字。
 * 移动端的惯例是导航下沉到底部，这里照做：顶栏只留品牌与门店。
 */
@media (max-width: 620px) {
  .brand { white-space: nowrap; }
  .store-chip { max-width: 46vw; }

  .tb-right {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    /* 导航项从 5 个增到 8 个后，一行放不下。横向滚动比换行更可用：
     * 换行会把底栏撑高、把正文挤上去，而"滚一下找得到"是移动端的常态。
     * 隐藏滚动条，免得底栏里多出一条突兀的横线。 */
    overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap;
    justify-content: flex-start; gap: 0;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    background: var(--panel); border-top: 1px solid var(--line);
    padding: 6px 2px calc(6px + env(safe-area-inset-bottom));
  }
  .tb-right::-webkit-scrollbar { display: none; }
  .nav-btn {
    flex: 0 0 auto; text-align: center; padding: 7px 12px;
    font-size: 13px; border-radius: var(--radius-sm); white-space: nowrap;
  }
  .nav-btn.on { background: transparent; color: var(--brand); font-weight: 700; }
  #main { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }

  .modal-panel { width: 96vw; max-height: 82vh; }
  .auth-card { margin-top: 3vh; padding: 22px 16px; }
}

/* ---------------- 门店设置（模板 / 员工） ---------------- */

.panel h3 { font-size: 15px; margin-bottom: 4px; }
.panel .auth-sub { margin-bottom: 12px; }

.plain-list { list-style: none; margin: 0 0 12px; padding: 0; }
.plain-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px;
}
.plain-list li:last-child { border-bottom: 0; }
.plain-list .pl-main { flex: 1; min-width: 0; }
.plain-list .pl-name { font-weight: 600; }
.plain-list .pl-sub { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.plain-list .pl-time {
  font-variant-numeric: tabular-nums; font-weight: 600; flex-shrink: 0;
}

.inline-form {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.inline-form input[type="text"], .inline-form select {
  padding: 9px 11px; font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); flex: 1 1 130px; min-width: 0;
}
/* 独占一行（模板名、复选框等） */
.inline-form .full { flex: 1 1 100%; }
.inline-form input[type="time"], .inline-form input[type="number"] {
  padding: 8px 8px; font: inherit; font-size: 14px; color: var(--text); background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  width: 100%; min-width: 0;
}
/* 时间控件必须留够宽度。曾经的写法是 <input type="time">，中文 locale 下浏览器
 * 把它渲染成 12 小时制「下午 02:00」——与页面其它地方的 24 小时制两套口径，
 * 已换成自己的时/分下拉（见 app.js clockSelect）。这里保留宽度约束，
 * 避免换行时把「时:分」拆成两行。 */
.iff { display: flex; flex-direction: column; gap: 3px; flex: 1 1 104px; min-width: 104px; }
.iff > span { font-size: 12px; color: var(--text-dim); }
.chk {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-dim); flex: 1 1 100%;
}
.chk input { width: auto; }
.sm-empty { padding: 10px 0; font-size: 13px; text-align: left; }

/* ---------------- 轻提示 / 弹层 ---------------- */

.toast {
  position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 60;
  max-width: min(88vw, 420px); max-height: 42vh; overflow: auto;
  padding: 10px 16px;
  background: #1f2430; color: #fff; font-size: 14px;
  /* 用圆角矩形而不是 999px 胶囊：错误信息可能很长（例如后端把整份
   * 违规清单塞进 message），胶囊圆角在长文本下会被撑成一个椭圆，
   * 既难看又难以阅读。 */
  border-radius: 12px; box-shadow: var(--shadow-lg);
  white-space: pre-wrap; word-break: break-word; text-align: left;
}
.toast.err { background: var(--danger); }

/* 违规清单（预检报告 / 发布失败） */
.chk-h {
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  margin: 16px 0 6px;
}
.chk-h:first-child { margin-top: 0; }
.chk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.chk-list li {
  padding: 9px 11px; border-radius: var(--radius-sm);
  background: var(--danger-soft); border-left: 3px solid var(--danger);
}
.chk-msg { font-size: 14px; }
.chk-meta { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(16, 24, 40, .45); }
.modal-panel {
  position: relative; background: var(--panel); border-radius: 14px;
  width: min(94vw, 440px); max-height: 86vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 16px; overflow: auto; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  padding: 12px 16px; border-top: 1px solid var(--line);
}
.modal-foot:empty { display: none; }

.tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tpl-btn {
  appearance: none; font: inherit; cursor: pointer; text-align: left;
  padding: 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
}
.tpl-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.tpl-btn .t-name { font-weight: 600; font-size: 14px; }
.tpl-btn .t-time { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

@media (max-width: 620px) {
  /* 底部 Tab 栏占据约 60px + 安全区，正文要留出这段空间，否则最后一行被盖住。 */
  #main { padding: 12px 10px calc(78px + env(safe-area-inset-bottom)); }
  .page-head { gap: 8px; }
  .week-label { font-size: 14px; }
  .grid-wrap { max-height: none; }
  .sched-grid { min-width: 680px; }
}

/* ---------------- 24 小时制时间选择（时 + 分） ---------------- */
/* 为什么不用 <input type="time">：中文 locale 下它渲染成 12 小时制（"下午 02:00"），
 * 而本页其它地方（模板列表、班次卡片、我的班表）一律 24 小时制——同一屏两套口径。
 * HTML 没有标准方式强制它走 24 小时制，于是改成一对 select，顺带在手机上少滚一次时间轮。 */
.clock { display: flex; align-items: center; gap: 4px; }
.clock select { padding: 7px 4px; }
.clock .sep { color: var(--text-dim); }

/* ---------------- 分段页签 ---------------- */
.tabs { display: flex; gap: 4px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.tab {
  appearance: none; border: 0; background: transparent; color: var(--text-dim);
  font: inherit; font-size: 14px; padding: 8px 12px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ---------------- 筛选条 ---------------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-bottom: 12px; }

/* ---------------- 状态胶囊 ---------------- */
.pill {
  display: inline-block; flex-shrink: 0; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--bg); color: var(--text-dim);
}
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.approved { background: var(--ok-soft); color: var(--ok); }
.pill.rejected { background: var(--danger-soft); color: var(--danger); }
.pill.cancelled { background: var(--bg); color: var(--text-dim); }

/* ---------------- 假勤列表 ---------------- */
.fact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fact-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel);
}
.fi-main { flex: 1; min-width: 0; }
.fi-title { font-weight: 600; font-size: 14px; }
.fi-sub {
  font-size: 12px; color: var(--text-dim); margin-top: 3px;
  line-height: 1.55; word-break: break-word;
}
.fi-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

/* ---------------- 通用数据表 ---------------- */
.data-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.data-table th, .data-table td {
  padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: right;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.data-table th {
  color: var(--text-dim); font-weight: 600;
  position: sticky; top: 0; z-index: 2; background: var(--panel);
}
.data-table th:first-child, .data-table td:first-child { text-align: left; }

/* ---------------- 列表行操作 ---------------- */
.pl-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------------- 警示 / 危险按钮 ---------------- */
.btn.warn { border-color: var(--warn); color: var(--warn); }
.btn.warn:hover { background: var(--warn-soft); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }

/* ---------------- 顶栏未读红点 ---------------- */
.nav-btn.bell { position: relative; }
.nav-btn .dot {
  position: absolute; top: 3px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--danger);
}

/* ---------------- 弹层内的表单栅格 ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid > label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.form-grid > label > span { color: var(--text-dim); }

/* ---------------- 窄屏微调（新增视图） ---------------- */
@media (max-width: 620px) {
  .form-grid { grid-template-columns: 1fr; }
  .fact-item { flex-wrap: wrap; }
  .fi-actions { flex-direction: row; width: 100%; }
  /* 手机上一行放不下「名字 + 状态胶囊」时，让胶囊掉到第二行而不是被压扁。 */
  .plain-list li { flex-wrap: wrap; }
  .plain-list .pl-actions { margin-left: auto; }
}

/* ---------------- 多行文本（驳回原因 / 申诉说明） ---------------- */
textarea.txt {
  width: 100%; box-sizing: border-box; resize: vertical;
  padding: 9px 11px; font: inherit; font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
textarea.txt:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ---------------- 时间的时/分下拉（clockSelect） ---------------- */
/* 宽度固定：.inline-form select 的 flex:1 1 130px 会让两个下拉各占一大块，
 * 把「时:分」拉得不像一个时间控件。 */
.clock select { flex: 0 0 auto; width: 58px; text-align: center; }

/* ---------------- 待办（登录后的首页） ---------------- */

/* 红点要挂在按钮右上角，父元素必须有定位上下文。
 * 原先只有 .bell 有 position:relative，现在「待办」「假勤」也带角标。 */
.nav-btn { position: relative; }

.todo-head { min-width: 0; }
.todo-date { margin: 3px 0 0; font-size: 13px; color: var(--text-dim); }

.todo-list {
  list-style: none; margin: 0 0 14px; padding: 0;
  display: flex; flex-direction: column; gap: 10px;
}

/* 左侧色条是「要不要现在管」的信号：品牌色 = 有人等你回话；灰 = 知会一声即可。 */
.todo-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
  cursor: pointer; transition: border-color .12s;
}
.todo-item:hover { border-color: var(--brand-line); }
.todo-item.urgent { border-left-color: var(--brand); }

.ti-main { flex: 1; min-width: 0; }
.ti-title { display: flex; align-items: baseline; gap: 8px; font-weight: 600; }
.ti-count { color: var(--brand); font-size: 18px; font-weight: 700; line-height: 1; }
.ti-sub { margin-top: 3px; font-size: 13px; color: var(--text-dim); }
.ti-go { flex: 0 0 auto; color: var(--text-dim); font-size: 20px; line-height: 1; }

/* 员工「下一班」：整页最显眼的一块 */
.next-shift {
  margin-bottom: 16px; padding: 16px 18px;
  background: var(--brand-soft); border: 1px solid var(--brand-line);
  border-radius: var(--radius);
}
.ns-label { font-size: 13px; color: var(--text-dim); }
.ns-time {
  margin: 5px 0 3px; font-size: 27px; font-weight: 700; line-height: 1.15;
  color: var(--brand); font-variant-numeric: tabular-nums;
}
.ns-meta { font-size: 14px; }
.ns-when { margin-top: 7px; font-size: 13px; color: var(--text-dim); }

/* 今天上班：时间与名字并排 */
.today-time { color: var(--brand); font-weight: 600; font-variant-numeric: tabular-nums; }
.today-who { font-weight: 600; }

@media (max-width: 620px) {
  .ns-time { font-size: 23px; }
  .todo-item { padding: 12px 13px; }
}

/* ---------------- 排班台：就地选班（丝滑 / 低感） ---------------- */

/* 选班浮层贴在格子旁边，而不是整屏中央。
 * 排班是【看着整张表做决定】的活：全屏弹层把表遮住 = 让人凭记忆选，
 * 这是排班台上最大的一处摩擦。
 * 用 fixed 而不是 absolute：网格容器是 overflow:auto，挂在格子里会被裁掉。 */
.tpl-pop {
  position: fixed; z-index: 45;
  min-width: 196px; max-width: 264px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: popIn .12s ease-out;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tpl-pop-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; padding: 2px 4px 7px; margin-bottom: 7px;
  font-size: 11px; color: var(--text-dim);
  border-bottom: 1px solid var(--line);
}
.tpl-pop-who { color: var(--text); font-weight: 600; font-size: 13px; }
.tpl-pop-list { display: flex; flex-direction: column; gap: 3px; }

/* 一行一个：扫视成本比两列网格低，也才放得下键位与「常用」标记。 */
.tpl-pick {
  appearance: none; font: inherit; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 8px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--panel); color: var(--text);
}
.tpl-pick:hover, .tpl-pick:focus-visible {
  background: var(--brand-soft); border-color: var(--brand-line); outline: none;
}
.tpl-pick[data-top="1"] { border-color: var(--brand-line); background: var(--brand-soft); }
.tpl-pick .tp-main { flex: 1; min-width: 0; }
.tpl-pick .tp-name { font-weight: 600; font-size: 13px; }
.tpl-pick .tp-time { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
/* 「常用」标记只在真有用时出现，不做装饰。 */
.tpl-pick .tp-tag {
  flex: 0 0 auto; font-size: 10px; padding: 1px 5px; border-radius: 999px;
  background: var(--brand); color: #fff;
}
.tpl-pick .tp-key {
  flex: 0 0 auto; min-width: 15px; text-align: center;
  font-size: 10px; color: var(--text-dim);
  border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px;
}
.tpl-pop-foot {
  margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--text-dim);
}

/* 乐观落格：先按已知信息在当地画出来，后台同步。
 * 「还没落定」只用半透明表达 —— 不转圈、不遮罩、不挡下一次点击。
 * transition 是为了它落定时【淡入】到实心，而不是跳一下。 */
.shift-pill { transition: opacity .22s ease-out; }
.shift-pill.pending { opacity: .5; }

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.shift-pill.drop { animation: dropIn .18s ease-out; }
