/* =========================================================
   心定心理 OA · 模版二「靛」
   扁平、极简：纯色色带 + 白色纸面，不用渐变和装饰性阴影
   主色承担结构，点缀色只标记“当前 / 主要动作”
   下面是默认主题（靛蓝）；切换主题时由 assets/js/theme.js 覆盖这些变量
   ========================================================= */
:root {
  --brand: #3538cd;
  --brand-d: #2b2eb3;
  --brand-dd: #1f2190;
  --brand-1: #e9eaff;
  --brand-05: #f4f5ff;
  --brand-2: #d6d7f8;
  --brand-t: #3538cd;
  --chart-1: #3538cd;
  --chart-2: #d97400;
  --sun: #ffc83d;
  --sun-d: #f2b60c;

  --ink: #12131a;
  --ink-2: #4a4f5e;
  --ink-3: #717686;
  --ink-4: #a6abb8;
  --ground: #f2f3f6;
  --paper: #ffffff;
  --fill: #f1f2f5;
  --fill-2: #e6e8ee;
  --line: #e2e4ea;
  --line-2: #eef0f3;
  --hover: #f7f8fa;

  --danger: #d93f3f;
  --danger-1: #fdecec;
  --warn: #d97400;
  --ok: #16864a;
  --info: #2f6fed;

  /* 页面脚本里少量行内样式沿用的旧变量名，映射到新色板 */
  --teal: var(--brand);
  --teal-7: var(--brand);
  --teal-dd: var(--ink);
  --leaf: var(--brand);
  --leaf-d: var(--ok);

  --font: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --num: "DIN Alternate", "Bahnschrift", "DIN Condensed", "Roboto Condensed", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;

  --gutter: clamp(16px, 3.4vw, 56px);
  --mast-h: 64px;
  --r-sm: 4px;
  --r: 6px;
  --r-lg: 10px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --float: 0 12px 32px rgba(18, 19, 26, .14);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--ink); background: var(--ground); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-t); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted, .dim { color: var(--ink-3); }
.ink2 { color: var(--ink-2); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cdd0d9; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #a9adb9; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.ico.sm { width: 15px; height: 15px; vertical-align: -3px; }
.ico.lg { width: 24px; height: 24px; }

/* ---------------- 框架：顶部导航 ---------------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.masthead { position: sticky; top: 0; z-index: 30; height: var(--mast-h); background: var(--brand); color: #fff; display: flex; align-items: stretch; gap: 36px; padding: 0 var(--gutter); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 19px; font-weight: 800; letter-spacing: 1px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.nav { display: flex; align-items: stretch; gap: 4px; min-width: 0; }
.nav a { position: relative; display: flex; align-items: center; gap: 6px; padding: 0 14px; color: rgba(255, 255, 255, .74); font-size: 15px; white-space: nowrap; }
.nav a:hover { color: #fff; text-decoration: none; }
.nav a.active { color: #fff; font-weight: 700; }
.nav a.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 4px; background: var(--sun); }
.nav .badge { font-family: var(--num); font-style: normal; font-size: 12px; font-weight: 700; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 5px; border-radius: 9px; background: var(--sun); color: var(--ink); }
.mast-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.today { text-align: right; font-size: 12px; line-height: 1.35; color: rgba(255, 255, 255, .7); white-space: nowrap; margin-right: 6px; }
.today .clock { color: #fff; font-size: 13px; font-family: var(--num); letter-spacing: .3px; }
.icon-btn { width: 38px; height: 38px; border: 0; border-radius: var(--r); background: transparent; color: rgba(255, 255, 255, .8); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.masthead :focus-visible { outline-color: var(--sun); }
.menu-btn { display: none; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px; border-radius: 22px; cursor: pointer; }
.user-chip:hover { background: rgba(255, 255, 255, .12); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-1); color: var(--brand-t); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.masthead .avatar { background: #fff; }
.user-chip .who { line-height: 1.25; }
.user-chip .who b { display: block; font-size: 13px; font-weight: 600; }
.user-chip .who small { font-size: 11px; color: rgba(255, 255, 255, .66); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-bottom: 48px; }
.content > :where(:not(.page-head, .journey, .daystrip, .hero, .subtabs, .batchbar)) { margin: 20px var(--gutter) 0; }
.foot { padding: 18px var(--gutter) 26px; font-size: 12px; color: var(--ink-3); }

/* ---------------- 色带：页面标题区 ---------------- */
.page-head { background: var(--brand); color: #fff; display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; padding: 30px var(--gutter) 30px; }
.page-title { margin: 0; font-size: 36px; line-height: 1.15; font-weight: 800; letter-spacing: 1px; }
.page-desc { margin-top: 8px; font-size: 14px; color: rgba(255, 255, 255, .72); max-width: 62ch; }
.page-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.page-head .btn { height: 40px; padding: 0 18px; background: transparent; border-color: rgba(255, 255, 255, .42); color: #fff; }
.page-head .btn:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }
.page-head .btn-primary { background: var(--sun); border-color: var(--sun); color: var(--ink); font-weight: 700; }
.page-head .btn-primary:hover { background: var(--sun-d); border-color: var(--sun-d); }
.page-head .search-box .ico { color: rgba(255, 255, 255, .7); top: 11px; }
.page-head .input { height: 40px; background: rgba(255, 255, 255, .14); color: #fff; }
.page-head .input::placeholder { color: rgba(255, 255, 255, .6); }
.page-head .input:focus { background: rgba(255, 255, 255, .2); border-color: #fff; }
.page-head :focus-visible, .journey :focus-visible, .daystrip :focus-visible, .hero :focus-visible, .subtabs :focus-visible { outline-color: var(--sun); }

.subtabs { background: var(--brand); display: flex; gap: 4px; padding: 0 var(--gutter); margin-top: -8px; overflow-x: auto; }
.subtabs a { position: relative; padding: 12px 16px 16px; color: rgba(255, 255, 255, .74); font-size: 15px; white-space: nowrap; }
.subtabs a:first-child { padding-left: 0; }
.subtabs a:hover { color: #fff; text-decoration: none; }
.subtabs a.on { color: #fff; font-weight: 700; }
.subtabs a.on::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 4px; background: var(--sun); }
.subtabs a:first-child.on::after { left: 0; }

/* ---------------- 按钮 ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: var(--r); border: 1.5px solid transparent; background: var(--fill); color: var(--ink); cursor: pointer; white-space: nowrap; font-size: 14px; font-weight: 500; line-height: 1; user-select: none; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--fill-2); }
.btn[disabled], .btn.is-disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--brand-d); }
.btn-dark { background: var(--ink); color: #fff; font-weight: 600; }
.btn-dark:hover { background: #2b2d38; }
.btn-ghost { background: transparent; color: var(--brand-t); }
.btn-ghost:hover { background: var(--brand-05); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-1); }
.btn-danger.solid { background: var(--danger); color: #fff; }
.btn-danger.solid:hover { background: #c23232; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: var(--r-sm); gap: 4px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }

/* ---------------- 表单：填充式输入框 ---------------- */
.input, .select, .textarea { height: 36px; width: 100%; min-width: 0; padding: 0 12px; border: 1.5px solid transparent; border-radius: var(--r); background: var(--fill); font-size: 14px; transition: background .12s, border-color .12s; }
.textarea { height: auto; min-height: 88px; padding: 9px 12px; line-height: 1.65; resize: vertical; }
.select { appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a4f5e' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.input:hover, .select:hover, .textarea:hover { background-color: var(--fill-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; background-color: #fff; border-color: var(--brand); }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input[readonly], .textarea[readonly] { color: var(--ink-2); }
.input:disabled, .select:disabled { opacity: .55; cursor: not-allowed; }
.input.sm, .select.sm { height: 30px; font-size: 13px; }
.is-invalid { border-color: var(--danger) !important; background-color: #fff !important; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.field .req::after { content: " *"; color: var(--danger); }
.field-hint { font-size: 12px; color: var(--ink-3); }
.field-err { font-size: 12px; color: var(--danger); }
.field-err:empty { display: none; }
.form-grid { display: grid; gap: 16px 16px; grid-template-columns: repeat(12, 1fr); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.form-sec { font-size: 16px; font-weight: 800; margin: 2px 0 14px; padding-left: 12px; border-left: 4px solid var(--sun); line-height: 1.2; }
.form-sec + .form-grid { margin-bottom: 28px; }
.inline-row { display: flex; gap: 8px; align-items: center; }
.inline-row > * { flex: 1; }
.inline-row > .sep { flex: none; color: var(--ink-3); }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13px; color: var(--ink-2); height: 36px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 40px; height: 22px; border-radius: 11px; background: #cdd0d9; position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .18s var(--ease); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch .on-text { display: none; color: var(--ink); font-weight: 600; }
.switch input:checked ~ .on-text { display: inline; }
.switch input:checked ~ .off-text { display: none; }

.ck { position: relative; display: inline-flex; width: 18px; height: 18px; flex: none; cursor: pointer; vertical-align: middle; }
.ck input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.ck span { width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid #b4b9c6; background: #fff; display: grid; place-items: center; transition: background .12s, border-color .12s; }
.ck input:checked + span, .ck input:indeterminate + span { background: var(--brand); border-color: var(--brand); }
.ck input:checked + span::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.ck input:indeterminate + span::after { content: ""; width: 8px; height: 2px; background: #fff; }
.ck input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.ck input:disabled + span { opacity: .5; }

.seg { display: inline-flex; background: var(--fill); border-radius: var(--r); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 30px; padding: 0 14px; border-radius: 4px; cursor: pointer; color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--brand); color: #fff; font-weight: 600; }

/* ---------------- 纸面 ---------------- */
.panel { background: var(--paper); border-radius: var(--r-lg); }
.panel-head { display: flex; align-items: baseline; gap: 12px; padding: 22px 24px 0; }
.panel-head h3 { margin: 0; font-size: 18px; font-weight: 800; }
.panel-head .sub { font-size: 13px; color: var(--ink-3); }
.panel-head .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; align-self: center; }
.panel-body { padding: 18px 24px 24px; }

.pill { --c: var(--ink-2); display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; white-space: nowrap; color: color-mix(in srgb, var(--c) 78%, #000); background: color-mix(in srgb, var(--c) 14%, #fff); }
.yn { font-size: 13px; }
.yn.y { color: var(--ok); font-weight: 700; }
.yn.n { color: var(--ink-4); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--r-sm); font-size: 12px; font-weight: 500; background: var(--fill); color: var(--ink-2); white-space: nowrap; }
.tag.risk { background: var(--danger-1); color: var(--danger); }

/* ---------------- 访客旅程（色带内的大数字） ---------------- */
.journey { background: var(--brand); display: flex; gap: 0; padding: 0 var(--gutter); overflow-x: auto; }
.journey button { flex: 1 0 auto; min-width: 96px; border: 0; background: transparent; cursor: pointer; text-align: left; color: #fff; padding: 6px 18px 16px 0; border-bottom: 5px solid transparent; }
.journey .j-n { display: block; font-family: var(--num); font-size: 40px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.journey .j-l { display: block; margin-top: 2px; font-size: 13px; color: rgba(255, 255, 255, .7); white-space: nowrap; }
.journey button:hover .j-l { color: #fff; }
.journey button.on { border-bottom-color: var(--sun); }
.journey button.on .j-n { color: var(--sun); }
.journey button.on .j-l { color: #fff; font-weight: 600; }
.journey .all { flex: 0 0 auto; min-width: 128px; margin-right: 28px; border-right: 1px solid rgba(255, 255, 255, .2); }

/* ---------------- 筛选 ---------------- */
.filterbar { background: var(--paper); border-radius: var(--r-lg); }
.filter-quick { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 16px 20px; }
.search-box { position: relative; flex: 1 1 280px; max-width: 380px; }
.search-box .ico { position: absolute; left: 12px; top: 10px; color: var(--ink-3); pointer-events: none; }
.search-box .input { padding-left: 36px; }
.filter-quick .select { width: auto; min-width: 118px; }
.filter-quick .spacer { flex: 1; }
.filter-more { border-top: 1px solid var(--line-2); padding: 20px 20px 4px; display: none; }
.filterbar.open .filter-more { display: block; }
.fgroup { display: grid; grid-template-columns: 84px 1fr; gap: 12px; margin-bottom: 16px; align-items: start; }
.fgroup-t { font-size: 13px; font-weight: 800; padding-top: 26px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 12px; }
.fitem { display: flex; flex-direction: column; gap: 4px; }
.fitem > span { font-size: 12px; color: var(--ink-3); }
.fitem.w2 { grid-column: span 2; }
.fitem .input, .fitem .select { height: 34px; font-size: 13px; }
.filter-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 0 0 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 16px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 10px; border-radius: var(--r-sm); background: var(--brand-1); font-size: 12px; color: var(--brand-dd); }
.chip b { font-weight: 700; }
.chip button { width: 20px; height: 20px; border: 0; border-radius: 4px; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--brand-t); }
.chip button:hover { background: var(--brand-2); }
.chip-clear { font-size: 12px; color: var(--ink-3); background: none; border: 0; cursor: pointer; padding: 0 6px; }
.chip-clear:hover { color: var(--danger); }
.more-toggle .count { font-family: var(--num); background: var(--brand); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 6px; height: 17px; line-height: 17px; }

/* ---------------- 数据表 ---------------- */
.table-panel { background: var(--paper); border-radius: var(--r-lg); overflow: hidden; }
.table-tools { display: flex; align-items: center; gap: 8px; padding: 16px 20px 12px; flex-wrap: wrap; }
.table-tools .total { font-size: 14px; color: var(--ink-2); }
.table-tools .total b { font-family: var(--num); color: var(--ink); font-size: 24px; font-weight: 700; margin: 0 3px; vertical-align: -2px; }
.table-tools .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.table-tools .right label { white-space: nowrap; }
.tbl-scroll { overflow: auto; max-height: calc(100vh - var(--mast-h) - 150px); min-height: 300px; position: relative; }
table.dt { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.dt th, .dt td { padding: 0 12px; height: 50px; border-bottom: 1px solid var(--line-2); white-space: nowrap; text-align: left; background: var(--paper); }
.dt th:first-child, .dt td:first-child { padding-left: 20px; }
.dt th:last-child, .dt td:last-child { padding-right: 20px; }
.dt thead th { position: sticky; top: 0; z-index: 3; height: 42px; color: var(--ink-3); font-weight: 600; font-size: 12px; border-bottom: 2px solid var(--ink); }
.dt thead th.sortable { cursor: pointer; }
.dt thead th.sortable:hover { color: var(--ink); }
.dt thead th .sort-ind { opacity: .4; margin-left: 3px; font-size: 10px; }
.dt thead th.sorted { color: var(--ink); }
.dt thead th.sorted .sort-ind { opacity: 1; color: var(--brand-t); }
.dt .sl, .dt .sr { position: sticky; z-index: 2; }
.dt thead .sl, .dt thead .sr { z-index: 4; }
.dt .sl.edge { border-right: 1px solid var(--line); }
.dt .sr.edge { border-left: 1px solid var(--line); }
.dt tbody tr:hover td { background: var(--hover); }
.dt tbody tr.sel td { background: var(--brand-05); }
.dt td.name { font-weight: 700; font-size: 14px; cursor: pointer; }
.dt td.name:hover { color: var(--brand-t); }
.dt td.name .tag { margin-left: 5px; }
.dt tbody tr.locked td.name { color: var(--ink-3); }
.dt .cell-edit { cursor: pointer; }
.dt tbody tr .cell-edit:hover { background: var(--brand-1); }
.dt .staff { color: var(--ink-2); }
.dt .staff.none { color: var(--ink-4); }
.dt .ops { display: flex; gap: 2px; }
.dt .ops .btn { background: transparent; color: var(--brand-t); padding: 0 7px; font-size: 13px; font-weight: 600; }
.dt .ops .btn:hover { background: var(--brand-1); }
.dt .ops .btn-danger { color: var(--danger); }
.dt .ops .btn-danger:hover { background: var(--danger-1); }
.dt .ellip { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 64px 20px; text-align: center; color: var(--ink-3); }
.empty .ico { width: 44px; height: 44px; color: var(--ink-4); stroke-width: 1.3; }
.empty p { margin: 10px 0 16px; }

.pager { display: flex; align-items: center; gap: 4px; padding: 14px 20px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.pager .pg { min-width: 32px; height: 32px; border: 0; background: transparent; border-radius: var(--r); cursor: pointer; padding: 0 8px; font-family: var(--num); font-size: 14px; }
.pager .pg:hover:not([disabled]) { background: var(--fill); }
.pager .pg.on { background: var(--ink); color: #fff; font-weight: 700; }
.pager .pg[disabled] { opacity: .3; cursor: not-allowed; }
.pager .gap { padding: 0 2px; color: var(--ink-3); }
.pager .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pager .select { width: auto; height: 32px; font-size: 13px; }
.pager .input { width: 56px; height: 32px; text-align: center; }

.batchbar { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); background: var(--ink); color: #fff; border-radius: var(--r-lg); display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 20px; z-index: 40; max-width: calc(100vw - 32px); overflow-x: auto; opacity: 0; visibility: hidden; transition: transform .25s var(--ease), opacity .2s, visibility .25s; }
.batchbar.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.batchbar .cnt { font-size: 13px; white-space: nowrap; margin-right: 10px; }
.batchbar .cnt b { font-family: var(--num); color: var(--sun); font-size: 20px; margin: 0 2px; vertical-align: -1px; }
.batchbar .btn { background: transparent; color: #fff; height: 34px; }
.batchbar .btn:hover { background: rgba(255, 255, 255, .14); }
.batchbar .btn.danger { color: #ff9c9c; }

/* ---------------- 弹层 ---------------- */
.overlay { position: fixed; inset: 0; background: rgba(18, 19, 26, .56); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; transition: opacity .18s; }
.overlay.show { opacity: 1; }
.modal { background: var(--paper); border-radius: 12px; width: 560px; max-width: 100%; max-height: calc(100vh - 40px); display: flex; flex-direction: column; transform: translateY(12px); transition: transform .2s var(--ease); }
.overlay.show .modal { transform: none; }
.modal-head { display: flex; align-items: flex-start; gap: 10px; padding: 26px 28px 6px; }
.modal-head h3 { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.25; }
.modal-head .sub { color: var(--ink-3); font-size: 13px; margin-top: 4px; }
.modal-x { margin-left: auto; width: 34px; height: 34px; border: 0; background: var(--fill); border-radius: 50%; cursor: pointer; color: var(--ink-2); display: grid; place-items: center; flex: none; }
.modal-x:hover { background: var(--fill-2); color: var(--ink); }
.modal-body { padding: 18px 28px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 28px 26px; }
.modal-foot .btn { height: 40px; padding: 0 22px; }
.modal-foot .left { margin-right: auto; display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 12px; }

.drawer-mask { position: fixed; inset: 0; background: rgba(18, 19, 26, .44); z-index: 90; opacity: 0; transition: opacity .2s; }
.drawer-mask.show { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(860px, 100vw); background: var(--ground); z-index: 91; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .26s var(--ease); }
.drawer.show { transform: none; }
.drawer-head { background: var(--brand); color: #fff; padding: 26px 30px 0; }
.drawer-head :focus-visible { outline-color: var(--sun); }
.drawer-body { flex: 1; overflow-y: auto; padding: 24px 30px 36px; }

.pop, .menu { position: fixed; z-index: 120; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--float); }
.pop { padding: 14px; min-width: 220px; opacity: 0; transform: translateY(-4px); transition: opacity .14s, transform .14s; }
.pop.show { opacity: 1; transform: none; }
.pop-title { font-size: 14px; font-weight: 800; margin-bottom: 10px; }
.pop .opt-list { display: flex; flex-direction: column; gap: 2px; max-height: min(400px, 60vh); overflow-y: auto; margin: 0 -6px; }
.pop .opt { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: var(--r); cursor: pointer; font-size: 13px; }
.pop .opt:hover { background: var(--fill); }
.pop .opt.on { background: var(--brand-1); color: var(--brand-dd); font-weight: 700; }
.pop .opt .dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.menu { padding: 6px; min-width: 176px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: transparent; padding: 9px 12px; border-radius: var(--r); cursor: pointer; font-size: 14px; text-align: left; }
.menu button:hover { background: var(--fill); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 5px 4px; }
.tip { position: fixed; z-index: 130; background: var(--ink); color: rgba(255, 255, 255, .86); font-size: 12px; padding: 9px 12px; border-radius: var(--r); max-width: 380px; line-height: 1.65; pointer-events: none; }
.tip b { color: #fff; }

.toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; border-radius: var(--r); padding: 12px 18px; font-size: 14px; pointer-events: auto; animation: toastIn .22s var(--ease); }
.toast .ico { color: #6fe3a5; }
.toast.err .ico { color: #ff9c9c; }
.toast.warn .ico, .toast.info .ico { color: var(--sun); }
.toast.out { opacity: 0; transform: translateY(-6px); transition: all .2s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.loading-bar { position: fixed; top: 0; left: 0; height: 3px; background: var(--sun); z-index: 300; width: 0; transition: width .3s; }
.spin { width: 20px; height: 20px; border: 2.5px solid var(--fill-2); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.lightbox { position: fixed; inset: 0; background: rgba(18, 19, 26, .92); z-index: 300; display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 90vh; }

/* ---------------- 访客档案抽屉 ---------------- */
.vd-top { display: flex; align-items: flex-start; gap: 16px; }
.vd-avatar { width: 56px; height: 56px; border-radius: var(--r-lg); background: #fff; color: var(--brand-t); display: grid; place-items: center; font-size: 26px; font-weight: 800; flex: none; }
.vd-name { font-size: 28px; font-weight: 800; line-height: 1.2; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vd-name .tag { background: rgba(255, 255, 255, .16); color: #fff; }
.vd-name .tag.risk { background: var(--sun); color: var(--ink); font-weight: 700; }
.vd-meta { color: rgba(255, 255, 255, .76); font-size: 13px; margin-top: 6px; display: flex; gap: 16px; flex-wrap: wrap; }
.vd-actions { margin-left: auto; display: flex; gap: 6px; flex: none; }
.vd-actions .btn { background: rgba(255, 255, 255, .14); color: #fff; }
.vd-actions .btn:hover { background: rgba(255, 255, 255, .26); }
.vd-flags { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.flag { display: flex; align-items: center; gap: 9px; text-align: left; padding: 9px 14px; border: 0; border-radius: var(--r); background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; font-size: 13px; }
.flag:hover { background: rgba(255, 255, 255, .22); }
.flag small { display: block; font-size: 11px; line-height: 1.2; color: rgba(255, 255, 255, .7); }
.flag b { display: block; font-size: 13px; line-height: 1.4; font-weight: 600; }
.flag .pill { margin-top: 2px; height: 20px; }
.flag.overdue b { color: var(--sun); }
.tabs { display: flex; gap: 4px; margin-top: 18px; overflow-x: auto; }
.tabs button { position: relative; border: 0; background: transparent; padding: 12px 14px 16px; cursor: pointer; color: rgba(255, 255, 255, .74); font-size: 15px; white-space: nowrap; }
.tabs button:first-child { padding-left: 0; }
.tabs button:hover { color: #fff; }
.tabs button.on { color: #fff; font-weight: 700; }
.tabs button.on::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 4px; background: var(--sun); }
.tabs button:first-child.on::after { left: 0; }
.tabs button .n { font-family: var(--num); font-size: 12px; margin-left: 5px; opacity: .8; }

.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--paper); border-radius: var(--r-lg); padding: 6px 22px; margin: 0; }
.kv > div { padding: 13px 12px 13px 0; border-bottom: 1px solid var(--line-2); min-width: 0; }
.kv > div:nth-last-child(-n+3) { border-bottom: 0; }
.kv dt { font-size: 12px; color: var(--ink-3); }
.kv dd { margin: 3px 0 0; font-size: 15px; font-weight: 500; word-break: break-all; }
.kv dd .dim { font-weight: 400; color: var(--ink-4); }
.sec-t { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; margin: 28px 0 12px; }
.sec-t:first-child { margin-top: 0; }
.sec-t .tools { margin-left: auto; display: flex; gap: 6px; }
.textbox { background: var(--paper); border-radius: var(--r-lg); padding: 16px 20px; white-space: pre-wrap; min-height: 52px; font-size: 15px; line-height: 1.75; }
.textbox.empty-t { color: var(--ink-3); }
.modal .textbox { background: var(--fill); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--brand)); }
.tl-head { font-size: 12px; color: var(--ink-3); display: flex; gap: 8px; align-items: center; }
.tl-head b { color: var(--ink); font-weight: 700; font-size: 13px; }
.tl-body { background: var(--paper); border-radius: var(--r); padding: 10px 14px; margin-top: 5px; font-size: 14px; white-space: pre-wrap; }
.modal .tl-body { background: var(--fill); }
.tl-empty { color: var(--ink-3); font-size: 13px; padding: 4px 0 10px; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

.rte { border-radius: var(--r-lg); background: var(--fill); overflow: hidden; }
.rte-bar { display: flex; gap: 4px; padding: 8px; flex-wrap: wrap; align-items: center; }
.rte-bar .btn { background: #fff; }
.rte-bar .hint { margin-left: auto; font-size: 12px; color: var(--ink-3); padding-right: 6px; }
.rte-area { min-height: 260px; max-height: 52vh; overflow-y: auto; margin: 0 8px 8px; padding: 14px 16px; outline: none; line-height: 1.75; background: #fff; border-radius: var(--r); }
.rte-area img { max-width: 100%; display: block; margin: 6px 0; }
.rte-area:empty::before { content: attr(data-ph); color: var(--ink-4); }
.chat-view { background: var(--paper); border-radius: var(--r-lg); padding: 18px 20px; min-height: 120px; line-height: 1.75; font-size: 15px; }
.chat-view img { max-width: 100%; display: block; margin: 6px 0; cursor: zoom-in; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.g-item { position: relative; border-radius: var(--r); overflow: hidden; background: var(--fill); }
.drawer .g-item { background: var(--paper); }
.g-item img { width: 100%; height: 120px; object-fit: cover; display: block; cursor: zoom-in; }
.g-item .g-bar { display: flex; align-items: center; gap: 6px; padding: 7px 8px; font-size: 12px; color: var(--ink-2); }
.g-item .g-bar .input { height: 26px; width: 64px; font-size: 12px; padding: 0 6px; background: #fff; }
.g-item.del { opacity: .4; }
.g-item.del img { filter: grayscale(1); }
.g-add { border: 2px dashed #c3c7d2; border-radius: var(--r); min-height: 160px; display: grid; place-items: center; text-align: center; color: var(--ink-3); cursor: pointer; font-size: 13px; }
.g-add:hover, .g-add.drag { border-color: var(--brand); color: var(--brand-t); background: var(--brand-05); }
.g-queue img { height: 100px; }
.g-state { font-size: 11px; }

.quick-dates { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-dates button { height: 28px; padding: 0 11px; border-radius: var(--r-sm); border: 0; background: var(--fill); cursor: pointer; font-size: 12px; color: var(--ink-2); }
.quick-dates button:hover { background: var(--brand-1); color: var(--brand-dd); }
.quick-dates button.on { background: var(--brand); color: #fff; }
.quick-dates .grp { width: 100%; font-size: 11px; color: var(--ink-3); margin-top: 4px; }

/* ---------------- 汇总页 ---------------- */
.daystrip { background: var(--brand); display: flex; gap: 8px; padding: 0 var(--gutter) 30px; overflow-x: auto; }
.day { flex: 0 0 auto; min-width: 118px; border: 0; background: rgba(255, 255, 255, .11); color: #fff; border-radius: var(--r); padding: 12px 16px 12px; cursor: pointer; text-align: left; transition: background .12s; }
.day:hover { background: rgba(255, 255, 255, .2); }
.day .d-w { font-size: 12px; color: rgba(255, 255, 255, .72); }
.day .d-d { font-family: var(--num); font-size: 20px; font-weight: 700; line-height: 1.3; }
.day .d-n { font-size: 12px; color: rgba(255, 255, 255, .72); }
.day .d-n b { font-family: var(--num); color: #fff; font-size: 15px; }
.day.on { background: #fff; color: var(--ink); }
.day.on .d-w, .day.on .d-n { color: var(--ink-3); }
.day.on .d-n b { color: var(--brand-t); }
.day.custom { display: flex; flex-direction: column; justify-content: center; gap: 6px; cursor: default; }
.day.custom .input { height: 32px; width: 150px; background: #fff; color: var(--ink); }
.sum-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.content > .sum-head { margin-top: 28px; }
.sum-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.sum-head .stat { font-size: 14px; color: var(--ink-2); }
.sum-head .stat b { font-family: var(--num); color: var(--brand-t); font-size: 22px; margin: 0 2px; vertical-align: -1px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.content > .cards { margin-top: 16px; }
.vcard { background: var(--paper); border-radius: var(--r-lg); display: flex; flex-direction: column; outline: 2px solid transparent; outline-offset: -2px; }
.vcard.active { outline-color: var(--brand); }
.vc-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 12px; }
.vc-head .avatar { width: 40px; height: 40px; border-radius: var(--r); font-size: 16px; }
.vc-name { font-weight: 800; font-size: 18px; line-height: 1.3; cursor: pointer; }
.vc-name:hover { color: var(--brand-t); }
.vc-sub { font-size: 12px; color: var(--ink-3); }
.vc-head .pill { margin-left: auto; }
.vc-body { padding: 4px 22px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 5px 16px; font-size: 13px; }
.vc-body .k { color: var(--ink-3); margin-right: 2px; }
.vc-body .full { grid-column: 1 / -1; }
.vc-staff span { display: inline-block; white-space: nowrap; margin-right: 12px; }
.vc-body .note { background: var(--fill); border-radius: var(--r); padding: 8px 12px; color: var(--ink-2); margin-top: 6px; max-height: 68px; overflow: hidden; white-space: pre-wrap; font-size: 12px; }
.vc-times { margin: 0 22px; padding: 12px 0; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-3); }
.vc-times b { font-weight: 600; color: var(--ink); }
.vc-times .hl { color: var(--brand-t); }
.vc-foot { display: flex; gap: 8px; padding: 4px 22px 22px; margin-top: auto; }
.vc-foot .btn { flex: 1; height: 36px; }
.vc-foot .btn-dark { background: var(--brand); }
.vc-foot .btn-dark:hover { background: var(--brand-d); }

/* ---------------- 工作台 ---------------- */
.hero { background: var(--brand); color: #fff; padding: 34px var(--gutter) 0; }
.hero-top { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.hero-date { margin: 0 0 8px; font-size: 14px; color: rgba(255, 255, 255, .72); }
.hero h1 { margin: 0; font-size: 44px; line-height: 1.15; font-weight: 800; letter-spacing: 1px; }
.hero .btn { margin-left: auto; height: 44px; padding: 0 22px; font-size: 15px; background: var(--sun); color: var(--ink); font-weight: 700; }
.hero .btn:hover { background: var(--sun-d); }
.hero-nums { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 34px; border-top: 1px solid rgba(255, 255, 255, .2); }
.hn { display: block; color: #fff; padding: 22px 24px 30px 0; border-bottom: 5px solid transparent; }
.hn + .hn { padding-left: 28px; border-left: 1px solid rgba(255, 255, 255, .2); }
.hn:hover { text-decoration: none; border-bottom-color: var(--sun); }
.hn-l { display: flex; align-items: center; gap: 8px; font-size: 14px; color: rgba(255, 255, 255, .8); }
.hn-n { display: block; font-family: var(--num); font-size: 76px; font-weight: 700; line-height: 1.05; margin-top: 6px; font-variant-numeric: tabular-nums; }
.hn.warn .hn-n { color: var(--sun); }
.hn-s { display: block; font-size: 13px; color: rgba(255, 255, 255, .7); }
.grid-2 { display: grid; grid-template-columns: 1.45fr 1fr; gap: 20px; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 104px 1fr 40px; gap: 12px; align-items: center; font-size: 13px; }
a.bar-row { color: inherit; }
a.bar-row:hover { text-decoration: none; }
a.bar-row:hover .l { color: var(--brand-t); }
.bar-row .l { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .track { display: block; height: 10px; background: var(--fill); border-radius: 2px; overflow: hidden; }
.bar-row .fill { display: block; height: 100%; background: var(--c, var(--brand)); border-radius: 2px; }
.bar-row .v { text-align: right; font-family: var(--num); font-size: 16px; font-weight: 700; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.recent li:last-child { border-bottom: 0; }
.recent .r-name { font-weight: 700; cursor: pointer; min-width: 4em; }
.recent .r-name:hover { color: var(--brand-t); }
.recent .r-time { margin-left: auto; font-family: var(--num); color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.legend b { font-family: var(--num); color: var(--ink); font-size: 15px; margin-left: 3px; }

/* ---------------- 设置 ---------------- */
.split { display: grid; grid-template-columns: 232px 1fr; gap: 20px; align-items: start; }
.side-list { background: var(--paper); border-radius: var(--r-lg); padding: 8px; }
.side-list button { display: flex; width: 100%; align-items: center; justify-content: space-between; border: 0; background: transparent; padding: 11px 14px; border-radius: var(--r); cursor: pointer; font-size: 14px; color: var(--ink-2); text-align: left; }
.side-list button:hover { background: var(--fill); }
.side-list button.on { background: var(--brand); color: #fff; font-weight: 700; }
.side-list button small { font-family: var(--num); font-size: 13px; color: var(--ink-3); font-weight: 400; }
.side-list button.on small { color: rgba(255, 255, 255, .8); }
.dict-row { display: grid; grid-template-columns: 28px 1fr 80px 90px 170px; gap: 10px; align-items: center; padding: 10px 24px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.dict-row:last-child { border-bottom: 0; }
.dict-row.head { font-size: 12px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid var(--ink); margin-top: 14px; }
.dict-row .grip { color: var(--ink-4); cursor: grab; display: grid; place-items: center; }
.dict-row.dragging { opacity: .4; }
.dict-row.over { box-shadow: inset 0 3px 0 var(--brand); }
.dict-row .ops { display: flex; gap: 2px; }
.dict-row .ops .btn { background: transparent; color: var(--brand-t); padding: 0 7px; font-weight: 600; }
.dict-row .ops .btn:hover { background: var(--brand-1); }
.dict-row .ops .btn-danger { color: var(--danger); }
.dict-row .swatch { width: 20px; height: 20px; border-radius: var(--r-sm); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.perm-grid > label { display: flex; align-items: center; gap: 9px; padding: 10px 12px; background: var(--fill); border-radius: var(--r); cursor: pointer; font-size: 13px; }
.perm-grid > label:hover { background: var(--fill-2); }
.perm-sec { font-size: 15px; font-weight: 800; margin: 22px 0 10px; }
.cols-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 10px; }
.cols-pick > label { display: flex; gap: 9px; align-items: center; font-size: 14px; cursor: pointer; padding: 4px 0; }

.strength { display: flex; gap: 4px; margin-top: 6px; }
.strength i { flex: 1; height: 4px; background: var(--fill-2); }
.strength.s1 i:nth-child(-n+1) { background: var(--danger); }
.strength.s2 i:nth-child(-n+2) { background: var(--warn); }
.strength.s3 i:nth-child(-n+3) { background: var(--ok); }
.strength.s4 i { background: var(--brand); }

/* ---------------- 登录页 ---------------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(400px, .75fr); background: var(--paper); }
.login-hero { position: relative; overflow: hidden; background: var(--brand); color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 48px clamp(28px, 5vw, 80px); }
.login-hero .brand { font-size: 20px; }
.login-quote { position: relative; z-index: 1; }
.login-quote h1 { margin: 0; font-size: clamp(54px, 8.2vw, 132px); line-height: 1.12; font-weight: 800; letter-spacing: .04em; }
.login-quote p { margin: 26px 0 0; font-size: 16px; color: rgba(255, 255, 255, .76); }
.login-hero .foot-note { position: relative; z-index: 1; font-size: 12px; color: rgba(255, 255, 255, .6); }
.login-sun { position: absolute; right: -9vw; top: -9vw; width: 30vw; height: 30vw; border-radius: 50%; background: var(--sun); animation: sunrise 1.1s var(--ease) both; }
@keyframes sunrise { from { transform: translate(8vw, -8vw); } to { transform: none; } }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px clamp(24px, 4vw, 64px); }
.login-form { width: 100%; max-width: 380px; }
.login-form h2 { margin: 0; font-size: 34px; font-weight: 800; }
.login-form .sub { color: var(--ink-3); margin: 8px 0 34px; }
.login-form .field { margin-bottom: 18px; }
.login-form .input { height: 52px; font-size: 16px; padding: 0 16px; }
.pw-wrap { position: relative; }
.pw-eye { position: absolute; right: 9px; top: 9px; width: 34px; height: 34px; border: 0; background: transparent; cursor: pointer; color: var(--ink-3); border-radius: var(--r); display: grid; place-items: center; }
.pw-eye:hover { background: var(--fill-2); color: var(--ink); }
.captcha-row { display: flex; gap: 10px; }
.captcha-row .input { flex: 1; }
.captcha-row canvas, .captcha-row img { height: 52px; width: 132px; border-radius: var(--r); cursor: pointer; flex: none; background: var(--fill); }
.login-form .switch { margin: 0 0 8px; }
.login-form .err { color: var(--danger); font-size: 13px; min-height: 22px; }
.login-form .btn-primary { width: 100%; height: 54px; font-size: 17px; font-weight: 700; margin-top: 4px; }
.login-form .demo { margin-top: 22px; font-size: 12px; color: var(--ink-3); line-height: 1.8; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1320px) {
  .today { display: none; }
  .masthead { gap: 20px; }
  .nav a { padding: 0 10px; }
  .nav a.active::after { left: 10px; right: 10px; }
}
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .hn-n { font-size: 60px; }
  .user-chip .who { display: none; }
}
@media (max-width: 940px) {
  .menu-btn { display: grid; }
  .nav { display: none; position: fixed; inset: var(--mast-h) 0 0 0; background: var(--brand); flex-direction: column; align-items: stretch; padding: 12px var(--gutter) 32px; overflow-y: auto; gap: 0; }
  .app.menu-open .nav { display: flex; }
  .nav a { padding: 18px 0; font-size: 24px; font-weight: 700; border-bottom: 1px solid rgba(255, 255, 255, .16); }
  .nav a.active::after { left: 0; right: auto; top: 22px; bottom: 22px; width: 5px; height: auto; margin-left: -16px; }
  .page-title { font-size: 28px; }
  .hero h1 { font-size: 32px; }
  .hero-nums { grid-template-columns: 1fr 1fr; }
  .hn { padding: 18px 16px 22px 0; border-top: 1px solid rgba(255, 255, 255, .2); margin-top: -1px; }
  .hn + .hn { padding-left: 0; border-left: 0; }
  .hn:nth-child(even) { padding-left: 20px; border-left: 1px solid rgba(255, 255, 255, .2); }
  .hn-n { font-size: 52px; }
  .login { grid-template-columns: 1fr; }
  .login-hero { min-height: 300px; padding: 28px; gap: 28px; }
  .login-sun { width: 44vw; height: 44vw; right: -14vw; top: -14vw; }
  .kv { grid-template-columns: 1fr 1fr; }
  .kv > div:nth-last-child(-n+3) { border-bottom: 1px solid var(--line-2); }
  .cols-2, .split { grid-template-columns: 1fr; }
  .form-grid > [class*="span-"] { grid-column: span 12; }
  .fgroup { grid-template-columns: 1fr; gap: 4px; }
  .fgroup-t { padding-top: 0; }
  .dt .sr { position: static; border-left: 0 !important; }
  .table-tools .right { margin-left: 0; flex-wrap: wrap; }
  .table-tools .right label { display: none; }
  .journey .all { min-width: 108px; margin-right: 20px; }
  .tbl-scroll { max-height: none; }
  .drawer-head { padding: 18px 16px 0; }
  .drawer-body { padding: 16px; }
  .vd-name { font-size: 22px; }
  .vd-flags .flag { flex: 1 1 45%; }
  .modal-head { padding: 20px 20px 4px; }
  .modal-body { padding: 14px 20px; }
  .modal-foot { padding: 12px 20px 20px; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .journey .j-n { font-size: 32px; }
  .dict-row { grid-template-columns: 24px 1fr 150px; }
  .dict-row > :nth-child(3), .dict-row > :nth-child(4) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media print {
  .masthead, .filterbar, .journey, .batchbar, .pager, .table-tools, .foot { display: none !important; }
  .tbl-scroll { max-height: none; overflow: visible; }
}

/* 宽表格里的空状态：始终显示在可视区域中间 */
.tbl-scroll td .empty { position: sticky; left: 0; width: calc(100vw - 2 * var(--gutter) - 4px); max-width: 100%; }
@media (min-width: 941px) { .tbl-scroll td .empty { max-width: none; } }

/* ---------------- 主题颜色 ---------------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-tile { border: 0; background: transparent; padding: 0; cursor: pointer; text-align: left; border-radius: var(--r-lg); }
.theme-tile .tp { display: block; height: 92px; border-radius: var(--r-lg); overflow: hidden; background: var(--ground); outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .12s; position: relative; }
.theme-tile:hover .tp { outline-color: var(--line); }
.theme-tile.on .tp { outline: 3px solid var(--ink); }
.theme-tile .tp-band { display: block; height: 46px; padding: 9px 10px 0; position: relative; }
.theme-tile .tp-band i { display: inline-block; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .55); margin-right: 5px; vertical-align: top; }
.theme-tile .tp-band b { position: absolute; left: 10px; bottom: 0; width: 22px; height: 4px; }
.theme-tile .tp-num { position: absolute; right: 10px; top: 8px; font-family: var(--num); font-size: 20px; font-weight: 700; line-height: 1; }
.theme-tile .tp-card { display: flex; align-items: center; gap: 6px; margin: 8px 10px; padding: 7px 8px; background: #fff; border-radius: 5px; }
.theme-tile .tp-card i { flex: 1; height: 5px; border-radius: 3px; background: var(--fill-2); }
.theme-tile .tp-card em { width: 26px; height: 12px; border-radius: 3px; }
.theme-tile .tp-check { position: absolute; right: 8px; bottom: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; display: none; place-items: center; }
.theme-tile.on .tp-check { display: grid; }
.theme-tile .tn { display: flex; align-items: center; gap: 6px; padding: 8px 2px 0; font-size: 14px; font-weight: 600; }
.theme-tile .tn small { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.theme-tile.custom .tp { background: conic-gradient(from 200deg, #3538cd, #0b5cad, #0f595a, #1d5a3b, #f4c542, #7a3a12, #96203a, #5b2b8c, #3538cd); }
.theme-tile.custom .tp-plus { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.theme-tile.custom .tp-plus span { width: 40px; height: 40px; border-radius: 50%; background: rgba(18, 19, 26, .55); display: grid; place-items: center; }
.theme-custom { margin-top: 20px; padding: 18px; background: var(--fill); border-radius: var(--r-lg); }
.color-field { display: flex; align-items: center; gap: 8px; }
.color-field input[type=color] { width: 44px; height: 36px; padding: 2px; border: 0; border-radius: var(--r); background: #fff; cursor: pointer; flex: none; }
.color-field .input { background: #fff; font-family: var(--num); text-transform: uppercase; }
.theme-note { font-size: 12px; color: var(--ink-3); margin-top: 10px; min-height: 18px; }
.theme-note.adj { color: var(--warn); }
.theme-scope { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 560px) {
  .theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; }
  .theme-tile .tp { height: 64px; }
  .theme-tile .tp-band { height: 32px; padding: 7px 7px 0; }
  .theme-tile .tp-band i { height: 4px; margin-right: 3px; }
  .theme-tile .tp-band b { left: 7px; width: 16px; height: 3px; }
  .theme-tile .tp-num { right: 7px; top: 6px; font-size: 15px; }
  .theme-tile .tp-card { margin: 6px 7px; padding: 5px 6px; }
  .theme-tile .tp-card em { width: 18px; height: 9px; }
  .theme-tile .tp-check { width: 18px; height: 18px; right: 5px; bottom: 5px; }
  .theme-tile .tn { font-size: 13px; padding-top: 6px; flex-wrap: wrap; gap: 0 4px; }
}

/* =========================================================
   第 3 版新增：风险预警、消息中心、搜索、日历、统计、设置等
   ========================================================= */
/* 风险等级：关注（琥珀）/ 重点（橙）/ 危机（红）；颜色之外始终带文字 */
:root { --risk-1: #b07a12; --risk-2: #d4541f; --risk-3: #c62828; --risk-1-bg: #fdf4e1; --risk-2-bg: #fdeee6; --risk-3-bg: #fde8e8; }
.risk-pill { display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 8px 0 6px; border-radius: var(--r-sm); font-size: 12px; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.risk-pill .ico { width: 13px; height: 13px; }
.risk-pill.sm { height: 19px; padding: 0 6px 0 4px; font-size: 11px; margin-left: 4px; }
.risk-pill.l1 { background: var(--risk-1-bg); color: var(--risk-1); }
.risk-pill.l2 { background: var(--risk-2-bg); color: var(--risk-2); }
.risk-pill.l3 { background: var(--risk-3); color: #fff; }
.tag-pill { --c: var(--ink-3); display: inline-flex; align-items: center; height: 19px; padding: 0 6px; margin-left: 4px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; vertical-align: middle;
  color: color-mix(in srgb, var(--c) 82%, var(--ink)); background: color-mix(in srgb, var(--c) 13%, var(--paper)); }
.tag-add { border: 0; cursor: pointer; gap: 3px; background: rgba(255, 255, 255, .16) !important; color: #fff !important; }
.tag-add:hover { background: rgba(255, 255, 255, .28) !important; }
.dt td.name.crisis { box-shadow: inset 4px 0 0 var(--risk-3); }
.dt .ops .risk-op { color: var(--risk-2); }
.dt .ops .risk-op.l3 { color: var(--risk-3); }
.masked { color: var(--ink-3); letter-spacing: .02em; }
input.masked { background: var(--fill); cursor: not-allowed; }

/* 档案顶部的风险横幅：始终显示，沟通前第一眼看到 */
.risk-banner { display: flex; align-items: center; gap: 14px; margin: -26px -30px 18px; padding: 12px 30px; color: #fff; }
.risk-banner > .ico { width: 26px; height: 26px; flex: none; }
.risk-banner > div { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.risk-banner b { font-size: 16px; font-weight: 800; }
.risk-banner span { font-size: 14px; }
.risk-banner small { width: 100%; font-size: 12px; opacity: .85; }
.risk-banner small em { font-style: normal; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .22); padding: 0 6px; border-radius: 3px; }
.risk-banner .btn { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .5); color: #fff; flex: none; }
.risk-banner .btn:hover { background: rgba(255, 255, 255, .3); }
.risk-banner.l1 { background: var(--risk-1); }
.risk-banner.l2 { background: var(--risk-2); }
.risk-banner.l3 { background: var(--risk-3); }
.risk-now { background: var(--paper); border-radius: var(--r-lg); padding: 18px 20px; border-left: 5px solid var(--line); }
.risk-now.l1 { border-left-color: var(--risk-1); } .risk-now.l2 { border-left-color: var(--risk-2); } .risk-now.l3 { border-left-color: var(--risk-3); }
.rn-main { display: flex; gap: 12px; align-items: flex-start; }
.rn-main b { display: block; font-size: 15px; }
.rn-main small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.rn-next { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 14px; flex-wrap: wrap; }
.rn-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.risk-tl .tl-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 12px; color: var(--ink-3); }
.risk-tl .tl-meta b { color: var(--ink); font-size: 14px; }
.risk-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.risk-seg button { text-align: left; border: 2px solid var(--line); background: var(--paper); border-radius: var(--r); padding: 10px 12px; cursor: pointer; }
.risk-seg button b { display: block; font-size: 16px; }
.risk-seg button small { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.risk-seg button.l1 b { color: var(--risk-1); } .risk-seg button.l2 b { color: var(--risk-2); } .risk-seg button.l3 b { color: var(--risk-3); }
.risk-seg button.on.l1 { border-color: var(--risk-1); background: var(--risk-1-bg); }
.risk-seg button.on.l2 { border-color: var(--risk-2); background: var(--risk-2-bg); }
.risk-seg button.on.l3 { border-color: var(--risk-3); background: var(--risk-3-bg); }
.risk-seg button.cur { opacity: .45; cursor: not-allowed; }

/* 必须确认的风险弹窗 */
.overlay.blocking { background: rgba(18, 19, 26, .72); }
.ack-title { display: inline-flex; align-items: center; gap: 8px; }
.ack-title .ico { width: 24px; height: 24px; }
.ack-title.l3 { color: var(--risk-3); } .ack-title.l2 { color: var(--risk-2); } .ack-title.l1 { color: var(--risk-1); }
.ack-lead { margin: 0 0 12px; color: var(--ink-2); }
.ack-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.ack-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--fill); }
.ack-item.l3 { background: var(--risk-3-bg); } .ack-item.l2 { background: var(--risk-2-bg); }
.ack-item p { margin: 3px 0; font-size: 14px; }
.ack-item small { color: var(--ink-3); font-size: 12px; }

/* 顶栏：菜单多时让出空间 */
.user-chip .who b { white-space: nowrap; max-width: 6em; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1680px) { .masthead .today { display: none; } }
@media (max-width: 1440px) { .nav a { padding: 0 10px; font-size: 14px; } .nav a.active::after { left: 10px; right: 10px; } .masthead { gap: 20px; } #newWin { display: none; } }
@media (max-width: 1240px) and (min-width: 941px) { .user-chip .who { display: none; } .nav a { padding: 0 8px; } .nav a.active::after { left: 8px; right: 8px; } }
/* 顶栏：搜索、铃铛 */
.icon-btn.bell { position: relative; }
.icon-btn.bell .badge { position: absolute; top: 3px; right: 1px; min-width: 17px; height: 17px; line-height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-family: var(--num); font-style: normal; font-size: 11px; font-weight: 700; text-align: center; }
.icon-btn.bell.alarm { color: #fff; }
.icon-btn.bell.alarm .ico { animation: ring 1.6s ease-in-out infinite; }
@keyframes ring { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-14deg); } 20%, 40% { transform: rotate(14deg); } }
@media (prefers-reduced-motion: reduce) { .icon-btn.bell.alarm .ico { animation: none; } }

/* 新消息弹出（右上角） */
.npops { position: fixed; top: calc(var(--mast-h) + 10px); right: 16px; z-index: 140; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.npop { display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 0; border-left: 4px solid var(--brand); background: var(--paper); color: var(--ink); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--float); cursor: pointer; animation: npIn .25s var(--ease); transition: opacity .3s, transform .3s; }
.npop.lv1 { border-left-color: var(--warn); } .npop.lv2 { border-left-color: var(--danger); }
.npop .ico { flex: none; margin-top: 2px; color: var(--ink-3); }
.npop b { display: block; font-size: 14px; }
.npop small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.npop.out { opacity: 0; transform: translateX(20px); }
@keyframes npIn { from { opacity: 0; transform: translateX(20px); } }

/* 消息面板 */
.notice-drawer .drawer-head { padding: 20px 22px 16px; }
.nd-head { display: flex; align-items: center; gap: 10px; }
.nd-head h3 { margin: 0 auto 0 0; font-size: 22px; }
.nd-head .seg { background: rgba(255, 255, 255, .14); }
.nd-head .seg button { color: rgba(255, 255, 255, .8); }
.nd-head .seg button.on { background: #fff; color: var(--ink); }
.nd-head .btn { background: transparent; border-color: rgba(255, 255, 255, .42); color: #fff; }
.nd-tip { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13px; background: rgba(255, 255, 255, .12); padding: 8px 10px; border-radius: var(--r); }
.nd-tip .btn { margin-left: auto; flex: none; }
.notice-drawer .drawer-body { padding: 12px 16px 24px; }
.nlist { display: flex; flex-direction: column; gap: 6px; }
.nitem { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; border: 0; background: var(--paper); color: var(--ink); border-radius: var(--r); padding: 12px 14px; cursor: pointer; position: relative; }
.nitem:hover { background: var(--hover); }
.nitem > .ico { flex: none; margin-top: 2px; color: var(--ink-4); }
.nitem.lv1 > .ico { color: var(--warn); } .nitem.lv2 > .ico { color: var(--danger); }
.nitem.unread::after { content: ""; position: absolute; top: 16px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.nitem:not(.unread) b { font-weight: 500; color: var(--ink-2); }
.nbody { min-width: 0; padding-right: 14px; }
.nmeta { display: block; font-size: 12px; color: var(--ink-3); }
.nmeta em { font-style: normal; color: var(--danger); font-weight: 700; }
.nitem b { display: block; font-size: 14px; margin-top: 2px; }
.nitem small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 2px; }

/* 今日要做的事 */
.digest { display: flex; flex-direction: column; gap: 8px; }
.dg-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: var(--r); background: var(--fill); color: var(--ink); }
.dg-item:hover { background: var(--brand-1); text-decoration: none; }
.dg-item b { font-size: 28px; min-width: 48px; color: var(--brand-t); }
.dg-item.warn b { color: var(--danger); }
.dg-item span { flex: 1; font-size: 15px; }

/* 设备、二次验证 */
.dev-list { display: flex; flex-direction: column; gap: 8px; }
.dev-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--fill); }
.dev-item > div { flex: 1; min-width: 0; }
.dev-item b { display: flex; gap: 8px; align-items: center; }
.dev-item small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.totp-steps { margin: 0 0 16px; padding-left: 20px; color: var(--ink-2); font-size: 14px; line-height: 1.8; }
.totp-box { display: flex; gap: 20px; align-items: center; margin-bottom: 16px; padding: 16px; border-radius: var(--r-lg); background: var(--fill); }
.totp-qr { width: 168px; flex: none; background: #fff; padding: 6px; border-radius: var(--r); }
.qr { display: block; width: 100%; height: auto; }
.totp-key { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; }
.totp-key small { color: var(--ink-3); }
.totp-key code { font-family: var(--num); font-size: 17px; letter-spacing: .06em; word-break: break-all; background: var(--paper); padding: 6px 10px; border-radius: var(--r-sm); }

/* 外观设置 */
.mode-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.mode-row > span { font-weight: 700; }

/* 全局搜索 */
.overlay.search-ov { align-items: flex-start; padding-top: 12vh; }
.search-ov .modal-head { display: none; }
.search-pal .sp-input { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.search-pal .sp-input .ico { color: var(--ink-3); }
.search-pal .sp-input .input { border: 0; height: 40px; font-size: 18px; padding: 0; background: transparent; box-shadow: none; }
.search-pal kbd { font-family: var(--num); font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.sp-list { max-height: 52vh; overflow-y: auto; padding: 8px; }
.sp-hint { margin: 0; padding: 18px; text-align: center; color: var(--ink-3); font-size: 13px; }
.sp-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--ink); padding: 10px 12px; border-radius: var(--r); cursor: pointer; }
.sp-item.on, .sp-item:hover { background: var(--brand-1); }
.sp-item > span:nth-child(2) { flex: 1; min-width: 0; }
.sp-item b { font-size: 15px; }
.sp-item small { display: block; color: var(--ink-3); font-size: 12px; }
.vd-avatar.sm { width: 34px; height: 34px; font-size: 15px; border-radius: var(--r); background: var(--brand-1); flex: none; }

/* 草稿 */
.draft-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 8px 12px; border-radius: var(--r); background: var(--brand-1); color: var(--brand-dd); font-size: 13px; }
.draft-bar span { flex: 1; }
[data-mode=dark] .draft-bar { color: var(--ink); }

/* 预约时段、疗程 */
.slots { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.slot { border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); border-radius: var(--r-sm); height: 30px; padding: 0 10px; font-family: var(--num); cursor: pointer; }
.slot:hover { border-color: var(--brand); }
.slot.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.warn-t { color: var(--danger); }
.ok-t { color: var(--ok); }
.treat-rule { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--r); background: var(--fill); color: var(--ink-2); font-size: 13px; }
.treat-rule.warn { background: var(--danger-1); color: var(--danger); }
.left-n { font-family: var(--num); font-size: 22px; font-weight: 700; line-height: 36px; }
.treat-card { background: var(--paper); border-radius: var(--r-lg); padding: 20px 22px; border-top: 4px solid var(--brand); }
.treat-card.warn { border-top-color: var(--warn); }
.tc-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tc-top b { font-size: 20px; }
.tc-mode { font-size: 12px; background: var(--fill); padding: 1px 8px; border-radius: var(--r-sm); color: var(--ink-2); }
.tc-nums { display: flex; gap: 36px; margin-top: 14px; }
.tc-nums small { display: block; font-size: 12px; color: var(--ink-3); }
.tc-nums b { font-size: 34px; line-height: 1.1; }
.tc-nums .warn-t b { color: var(--danger); }
.tc-warn { display: flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--danger); font-weight: 700; font-size: 14px; }
.tc-actions { display: flex; gap: 10px; justify-content: center; margin: 16px 0 0; flex-wrap: wrap; }
.dt.mini { width: 100%; background: var(--paper); border-radius: var(--r-lg); overflow: hidden; }
.dt.mini th, .dt.mini td { height: 40px; font-size: 13px; }
.dt.mini td { white-space: normal; }
.dt.mini thead th { position: static; border-bottom-width: 1px; }
.dt.hist td.old { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-4); }

/* 量表趋势 */
.sc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 12px; }
.sc-card { background: var(--paper); border-radius: var(--r-lg); padding: 14px 16px 8px; }
.sc-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sc-head b { font-size: 14px; }
.sc-head .num { font-size: 22px; font-weight: 700; }
.sc-lv { font-size: 12px; font-weight: 700; color: var(--brand-t); }
.sc-svg { width: 100%; height: auto; display: block; margin-top: 4px; }
.sc-base { stroke: var(--ink); stroke-width: 1.5; }
.sc-band { stroke: var(--line); stroke-dasharray: 3 3; }
.sc-ax { font-size: 10px; fill: var(--ink-3); font-family: var(--num); }
.sc-line { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; }
.sc-pt .hit { fill: transparent; }
.sc-pt .dot { fill: var(--chart-1); stroke: var(--paper); stroke-width: 2; }
.sc-pt:hover .dot { r: 6; }

/* 附件 */
.consent-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.consent { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r); font-size: 13px; font-weight: 600; }
.consent.ok { background: color-mix(in srgb, var(--ok) 12%, var(--paper)); color: var(--ok); }
.consent.no { background: var(--fill); color: var(--ink-3); }
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--paper); border-radius: var(--r); }
.file-item > div { flex: 1; min-width: 0; }
.file-item b { color: var(--brand-t); }
.file-item small { display: block; color: var(--ink-3); font-size: 12px; }
.merge-list { margin-top: 12px; max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.merge-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r); background: var(--fill); cursor: pointer; }
.merge-item:has(input:checked) { background: var(--brand-1); outline: 2px solid var(--brand); }
.merge-item small { display: block; color: var(--ink-3); font-size: 12px; }

/* 汇总 */
.vcard.crisis { outline-color: var(--risk-3); }
.vcard.crisis .vc-head { box-shadow: inset 0 4px 0 var(--risk-3); }
.vc-times .late { color: var(--danger) !important; }
.day.alarm:not(.on) .d-n b { color: var(--sun); }
.day .crit { font-style: normal; margin-left: 6px; font-size: 11px; font-weight: 700; background: var(--risk-3); color: #fff; padding: 0 5px; border-radius: 3px; }

/* 工作台 */
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.hero-nums.n3 { grid-template-columns: repeat(3, 1fr); }
.hero-nums.n2 { grid-template-columns: repeat(2, 1fr); }
.recent .r-sub { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 8em; }
.src-bars .track { position: relative; height: 14px; background: transparent; overflow: visible; }
.src-bars .track::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 8px; background: var(--fill); border-radius: 2px; }
.src-bars .fill { position: relative; height: 8px; }
.src-bars .fill2 { position: absolute; left: 0; top: 10px; height: 4px; background: var(--chart-2); border-radius: 1px; }
.bar-row .v small { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.valid-top { display: flex; align-items: center; gap: 18px; }
.valid-top > b { font-size: 56px; line-height: 1; color: var(--brand-t); }
.valid-top > b small { font-size: 24px; }
.valid-top > span { font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.valid-bar { height: 12px; background: var(--fill-2); border-radius: 2px; margin-top: 14px; overflow: hidden; }
.valid-bar span { display: block; height: 100%; background: var(--chart-1); border-radius: 2px; }

/* 设置 */
.perm-note { width: 100%; font-size: 12px; color: var(--ink-3); margin: -4px 0 6px; }
.sched { display: flex; flex-direction: column; gap: 10px; }
.sched-row { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.sched-slots { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.slot-ed { display: inline-flex; align-items: center; gap: 4px; background: var(--fill); padding: 4px 4px 4px 8px; border-radius: var(--r); }
.slot-ed .input { width: 104px; height: 30px; }
.sched-off { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.off-list { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.sys-form { display: flex; flex-direction: column; gap: 16px; }
.sys-foot { display: flex; justify-content: flex-end; }
.log-filter { display: flex; gap: 10px; flex-wrap: wrap; background: var(--paper); border-radius: var(--r-lg); padding: 14px 16px; }
.log-filter .search-box { flex: 1; min-width: 220px; max-width: none; }
.log-filter .select { width: auto; }
.pager .right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.dt td.wrap { white-space: normal; line-height: 1.6; padding-top: 10px; padding-bottom: 10px; }
.dt .r { text-align: right; }
.dt tr.sum td { font-weight: 700; border-top: 2px solid var(--ink); }

/* 导入 */
.imp-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.imp-pick label.btn { cursor: pointer; }
.imp-sum { display: flex; gap: 18px; align-items: baseline; margin: 18px 0 10px; font-size: 15px; }
.imp-sum b { font-size: 26px; margin-right: 4px; }
.imp-list { max-height: 280px; overflow-y: auto; border-radius: var(--r-lg); }

/* 预约日历 */
.cal-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav b { font-size: 18px; margin-left: 10px; }
.cal-tools { display: flex; gap: 10px; margin-left: auto; align-items: center; }
.cal-tools .select { width: auto; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--ink-2); align-items: center; }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.cal-bad { color: var(--danger); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.cal-panel { padding: 0; overflow-x: auto; position: relative; }
.cal-grid { display: grid; grid-template-columns: 56px repeat(var(--days), minmax(110px, 1fr)); grid-template-rows: 58px repeat(var(--rows), 26px); min-width: calc(56px + var(--days) * 110px); position: relative; }
.cal-corner { grid-row: 1; grid-column: 1; border-bottom: 2px solid var(--ink); }
.cal-dh { grid-row: 1; display: flex; flex-direction: column; justify-content: center; padding: 6px 10px; border-bottom: 2px solid var(--ink); border-left: 1px solid var(--line-2); }
.cal-dh b { font-size: 14px; } .cal-dh span { font-size: 13px; color: var(--ink-2); } .cal-dh small { font-size: 11px; color: var(--ink-3); }
.cal-dh.today b, .cal-dh.today span { color: var(--brand-t); }
.cal-hr { grid-column: 1; font-family: var(--num); font-size: 11px; color: var(--ink-3); text-align: right; padding-right: 8px; transform: translateY(-7px); }
.cal-col { grid-row: 2 / -1; position: relative; border-left: 1px solid var(--line-2);
  background-image: linear-gradient(var(--line-2) 1px, transparent 1px); background-size: 100% 52px; }
.cal-col.today { background-color: var(--brand-05); }
.cal-col.off { background-color: var(--fill); }
.cal-avail { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--ok) 9%, transparent); border-left: 3px solid color-mix(in srgb, var(--ok) 55%, transparent); }
.cal-offtag { position: absolute; top: 8px; left: 8px; font-size: 12px; color: var(--ink-3); font-weight: 700; }
.cal-ev-wrap { position: absolute; padding: 1px 2px; }
.cal-ev { --c: var(--brand); position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 0; width: 100%; height: 100%; min-height: 34px; overflow: hidden; text-align: left; border: 0; cursor: pointer;
  border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 13%, var(--paper)); color: var(--ink); border-radius: 4px; padding: 3px 6px; font-size: 12px; line-height: 1.35; }
.cal-ev:hover { background: color-mix(in srgb, var(--c) 22%, var(--paper)); z-index: 2; }
.cal-ev .t { font-weight: 700; color: color-mix(in srgb, var(--c) 70%, var(--ink)); }
.cal-ev b { font-size: 13px; }
.cal-ev small { color: var(--ink-3); font-size: 11px; white-space: nowrap; }
.cal-ev.came { opacity: .62; }
.cal-ev.bad { outline: 2px solid var(--danger); outline-offset: -2px; }
.cal-ev em { position: absolute; top: 2px; right: 4px; font-style: normal; font-size: 10px; font-weight: 700; color: #fff; background: var(--danger); padding: 0 4px; border-radius: 3px; }
.cal-ev.wide { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 10px 14px; height: auto; font-size: 14px; }
.cal-ev.wide .t { font-size: 18px; } .cal-ev.wide b { font-size: 16px; } .cal-ev.wide small { width: 100%; font-size: 13px; }
.cal-list { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.cal-empty { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--ink-3); background: var(--paper); padding: 8px 14px; border-radius: var(--r); pointer-events: none; }

/* 统计分析 */
.st-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.st-bar .select { width: auto; }
.st-range { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.st-range button { border: 1.5px solid var(--line); background: var(--paper); color: var(--ink-2); height: 34px; padding: 0 12px; border-radius: var(--r); cursor: pointer; font-size: 13px; }
.st-range button.on { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 700; }
.st-range .input { width: auto; height: 34px; }
.st-grid { grid-template-columns: 1.3fr 1fr; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpis small { display: block; font-size: 12px; color: var(--ink-3); }
.kpis b { font-size: 28px; line-height: 1.2; }
.funnel { display: flex; flex-direction: column; gap: 14px; }
.fn-row { display: grid; grid-template-columns: 56px 1fr 64px 90px 90px; gap: 14px; align-items: center; }
.fn-l { font-weight: 700; }
.fn-track { height: 30px; background: var(--fill); border-radius: 3px; overflow: hidden; }
.fn-bar { display: block; height: 100%; background: var(--chart-1); border-radius: 3px; }
.fn-n { font-size: 22px; font-weight: 700; text-align: right; }
.fn-r b { display: block; font-size: 16px; }
.fn-r small { color: var(--ink-3); font-size: 11px; }
.cmp-dates span { color: var(--ink-3); }
.cmp-a, .cmp-b { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink) !important; margin-left: 6px; }
.cmp-a i, .cmp-b i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.cmp-a i { background: var(--chart-1); } .cmp-b i { background: var(--ink-4); }
.cmp-tbl { width: 100%; }
.cmp-bars { display: flex; flex-direction: column; gap: 3px; }
.cmp-bars span { display: block; height: 8px; border-radius: 1px; min-width: 2px; }
.cmp-bars .ca { background: var(--chart-1); } .cmp-bars .cb { background: var(--ink-4); }

/* 打印：只打印档案或当前页面内容 */
.print-root { display: none; }
@media print {
  html.printing body > *:not(.print-root) { display: none !important; }
  html.printing .print-root { display: block; font-size: 12pt; color: #000; }
  .print-root h1 { font-size: 20pt; margin: 0; } .print-root h1 small { font-size: 11pt; color: #555; font-weight: 400; }
  .print-root h2 { font-size: 13pt; margin: 18pt 0 6pt; padding-bottom: 3pt; border-bottom: 1.5pt solid #000; }
  .p-head { display: flex; justify-content: space-between; gap: 20pt; border-bottom: 2pt solid #000; padding-bottom: 8pt; }
  .p-head p { margin: 4pt 0 0; }
  .p-meta { text-align: right; font-size: 9pt; color: #444; line-height: 1.5; }
  .p-kv { width: 100%; border-collapse: collapse; } .p-kv th { width: 7em; text-align: left; color: #555; font-weight: 400; vertical-align: top; padding: 3pt 8pt 3pt 0; } .p-kv td { padding: 3pt 0; }
  .p-notes { margin: 0; padding-left: 14pt; } .p-notes li { margin-bottom: 5pt; } .p-notes b { display: block; font-size: 10pt; color: #444; }
  .print-root .dt { width: 100%; border-collapse: collapse; } .print-root .dt th, .print-root .dt td { border: .5pt solid #999; height: auto; padding: 3pt 5pt; font-size: 10pt; }
  html:not(.printing) .masthead, html:not(.printing) .tabbar, html:not(.printing) .foot, html:not(.printing) .page-actions, html:not(.printing) .fab, html:not(.printing) .npops, html:not(.printing) .daystrip, html:not(.printing) .vc-foot, html:not(.printing) .cal-bar .btn, html:not(.printing) .subtabs, html:not(.printing) .st-bar { display: none !important; }
  html:not(.printing) .page-head { background: none; color: #000; padding: 0 0 10pt; }
  html:not(.printing) .content > * { margin-left: 0 !important; margin-right: 0 !important; }
  html:not(.printing) body { background: #fff; }
  html:not(.printing) .content[data-print-by]::after { content: "打印人：" attr(data-print-by) "　内部资料 请勿外传"; display: block; margin-top: 12pt; font-size: 9pt; color: #555; }
  .vcard, .panel { break-inside: avoid; border: .5pt solid #ccc; }
}

/* =========================================================
   移动端（≤ 940px）
   底部导航 · 卡片列表 · 底部弹出层 · 大触控区域 · 输入不缩放 · 刘海屏安全区
   ========================================================= */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, a, label, input, select, textarea { touch-action: manipulation; }
.tabbar, .fab, .vlist, .pg-of, .sel-all-m, .fm-head, .sheet-mask { display: none; }
.fq-row, .fq-btns { display: contents; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--brand-t); cursor: pointer; }
.vd-link { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.vd-link:hover { color: #fff; text-decoration: underline; }
.menu-title { padding: 8px 12px 10px; font-size: 13px; color: var(--ink-3); }
.menu-badge { margin-left: auto; font-style: normal; font-family: var(--num); font-size: 12px; font-weight: 700; min-width: 20px; height: 20px; line-height: 20px; padding: 0 6px; border-radius: 10px; background: var(--sun); color: var(--ink); text-align: center; }
.menu button.active { color: var(--brand-t); font-weight: 700; }
.menu-cancel { display: none; }

@media (max-width: 940px) {
  :root { --gutter: 16px; --mast-h: 56px; --tab-h: 58px; --safe-b: env(safe-area-inset-bottom, 0px); }
  html.layer-open, html.layer-open body { overflow: hidden; }
  body { font-size: 15px; }

  /* 输入框字号 16px，iPhone 聚焦时不会自动放大页面 */
  .input, .select, .textarea { font-size: 16px; height: 44px; }
  .textarea { height: auto; }
  .input.sm, .select.sm, .fitem .input, .fitem .select { height: 42px; font-size: 16px; }
  .btn { height: 42px; }
  .btn-sm { height: 36px; }
  .btn-xs { height: 32px; padding: 0 10px; font-size: 13px; }
  .switch { height: 44px; }
  .seg button { height: 36px; }
  .ck span { width: 22px; height: 22px; }
  .ck { width: 22px; height: 22px; }

  /* 顶栏：品牌 + 主题 + 头像；导航移到底部 */
  .masthead { height: calc(var(--mast-h) + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px); gap: 12px; }
  .masthead .nav, .menu-btn, #newWin, .today { display: none !important; }
  .brand { font-size: 17px; }
  .mast-right { gap: 4px; }
  .user-chip { padding: 4px; }

  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: var(--paper); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
  .tabbar a, .tabbar button { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: var(--tab-h); border: 0; background: transparent; color: var(--ink-3); font-size: 11px; text-decoration: none; cursor: pointer; }
  .tabbar .ico { width: 22px; height: 22px; }
  .tabbar .active { color: var(--brand-t); font-weight: 700; }
  .tabbar .active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
  .tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); font-family: var(--num); font-style: normal; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; text-align: center; }
  .tabbar .dot { position: absolute; top: 9px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
  .content { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 24px); }
  .foot { display: none; }

  /* 色带标题区：压缩高度，按钮只显示图标 */
  .page-head { flex-wrap: nowrap; align-items: center; gap: 12px; padding: 18px var(--gutter) 18px; }
  .page-title { font-size: 24px; letter-spacing: .5px; }
  .page-desc { display: none; }
  .page-actions { flex-wrap: nowrap; gap: 8px; }
  .page-head .btn { height: 40px; padding: 0 12px; }
  .page-head .bt, .vd-actions .bt, .hero .bt { display: none; }
  .page-head .btn:has(.bt), .hero .btn:has(.bt) { width: 40px; padding: 0; }
  .subtabs { margin-top: 0; }
  .subtabs a { padding: 6px 14px 14px; }

  .hero { padding: 22px var(--gutter) 0; }
  .hero h1 { font-size: 28px; }
  .hero-date { font-size: 13px; }
  .hero .btn { width: 44px; height: 44px; padding: 0; }
  .hero-nums { margin-top: 20px; }
  .hn-n { font-size: 44px; }
  .hn-l, .hn-s { font-size: 12px; }

  .journey { padding: 0 var(--gutter); -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .journey::-webkit-scrollbar { display: none; }
  .journey button { min-width: 78px; padding: 2px 14px 12px 0; }
  .journey .j-n { font-size: 28px; }
  .journey .j-l { font-size: 12px; }
  .journey .all { min-width: 88px; margin-right: 16px; }

  .content > :where(:not(.page-head, .journey, .daystrip, .hero, .subtabs, .batchbar)) { margin-top: 14px; }

  /* 筛选：搜索独占一行，快捷筛选横向滑动；“更多筛选”为全屏面板 */
  .filter-quick { padding: 12px; gap: 10px; }
  .search-box { flex: 1 1 100%; max-width: none; }
  .search-box .ico { top: 14px; }
  .fq-row { display: flex; gap: 8px; overflow-x: auto; flex: 1 1 100%; margin: 0 -12px; padding: 0 12px 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .fq-row::-webkit-scrollbar { display: none; }
  .fq-row .select { flex: none; width: auto; min-width: 0; height: 38px; padding-right: 28px; }
  .fq-row .btn { flex: none; height: 38px; }
  .fq-btns, .filter-quick .spacer { display: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding: 0 12px 12px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip, .chip-clear { flex: none; height: 32px; }
  .chip button { width: 26px; height: 26px; }

  .filterbar.open .filter-more { position: fixed; inset: 0; z-index: 96; display: flex; flex-direction: column; background: var(--paper); border: 0; padding: 0 var(--gutter); overflow-y: auto; animation: sheetUp .22s var(--ease); }
  .fm-head { display: flex; align-items: center; position: sticky; top: 0; z-index: 2; background: var(--paper); padding: calc(14px + env(safe-area-inset-top, 0px)) 0 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line-2); }
  .fm-head b { font-size: 18px; }
  .fm-head .modal-x { margin-left: auto; }
  .fgroup { margin: 12px 0 16px; }
  .fgroup-t { font-size: 14px; }
  .fgrid { grid-template-columns: 1fr 1fr; gap: 12px 10px; }
  .fitem.w2 { grid-column: 1 / -1; }
  .fitem.w2 .inline-row { flex-wrap: wrap; }
  .fitem.w2 .inline-row > * { flex: 1 1 100%; }
  .filter-foot { position: sticky; bottom: 0; margin: auto calc(-1 * var(--gutter)) 0; padding: 12px var(--gutter) calc(12px + var(--safe-b)); background: var(--paper); border-top: 1px solid var(--line-2); }
  .filter-foot .btn { flex: 1; height: 46px; }
  .fm-fold { display: none !important; }

  /* 列表：表格换成卡片 */
  .v-panel { background: transparent; border-radius: 0; overflow: visible; }
  .content > .v-panel { margin-left: 0; margin-right: 0; }
  .table-tools { padding: 4px var(--gutter) 10px; gap: 10px; flex-wrap: nowrap; }
  .table-tools .total { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .table-tools .total b { font-size: 20px; }
  .table-tools .right { margin-left: auto; flex-wrap: nowrap; flex: none; gap: 6px; }
  .table-tools .right .select { height: 36px; max-width: 120px; padding-left: 10px; }
  .table-tools .right .btn { height: 36px; }
  #orderBtn .bt { display: none; }
  #orderBtn { width: 36px; padding: 0; justify-content: center; }
  .cols-btn { display: none !important; }
  .sel-all-m { display: inline-flex; align-items: center; }
  .v-panel .tbl-scroll { display: none; }
  .vlist { display: flex; flex-direction: column; gap: 10px; padding: 0 var(--gutter); }
  .vlist .empty { background: var(--paper); border-radius: var(--r-lg); }

  .vm { background: var(--paper); border-radius: var(--r-lg); padding: 14px 14px 4px; outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .12s; }
  .vm:active { background: var(--hover); }
  .vm.sel { outline-color: var(--brand); }
  .vm.locked .vm-name { color: var(--ink-3); }
  .vm-top { display: flex; align-items: flex-start; gap: 10px; }
  .vm-top .ck { margin-top: 3px; }
  .vm-who { flex: 1; min-width: 0; }
  .vm-name { font-size: 18px; font-weight: 800; line-height: 1.3; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .vm-sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
  .vm-status { border: 0; background: transparent; padding: 0; cursor: pointer; flex: none; }
  .vm-status .pill { height: 28px; padding: 0 10px; font-size: 13px; }
  .vm-contact { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0 32px; }
  .vm-link { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 0; border-radius: 17px; background: var(--brand-05); color: var(--brand-t); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; max-width: 100%; }
  .vm-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .vm-link:hover { text-decoration: none; }
  .vm-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 12px 0 0 32px; }
  .vm-fact { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 0; background: var(--fill); border-radius: var(--r); padding: 7px 9px; text-align: left; cursor: pointer; min-width: 0; }
  .vm-fact small { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .vm-fact b { font-size: 13px; font-family: var(--num); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .vm-fact.today { background: var(--brand-1); }
  .vm-fact.today b { color: var(--brand-t); }
  .vm-fact.warn { background: var(--danger-1); }
  .vm-fact.warn b { color: var(--danger); }
  .vm-staff { margin: 10px 0 0 32px; font-size: 12px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 2px 12px; }
  .vm-staff b { color: var(--ink-2); font-weight: 600; }
  .vm-ops { display: flex; margin: 10px -14px 0; border-top: 1px solid var(--line-2); }
  .vm-ops button { flex: 1; height: 44px; border: 0; background: transparent; color: var(--brand-t); font-size: 14px; font-weight: 600; cursor: pointer; }
  .vm-ops button + button { border-left: 1px solid var(--line-2); }
  .vm-ops button:active { background: var(--brand-05); }

  .pager { justify-content: space-between; padding: 14px var(--gutter); }
  .pager .pg:not([aria-label]), .pager .gap { display: none; }
  .pager .pg[aria-label] { width: 44px; height: 44px; background: var(--paper); }
  .pg-of { display: inline; font-family: var(--num); font-size: 14px; color: var(--ink-2); }
  .pager .select { font-size: 16px; height: 40px; }
  .pager .right { flex: 1 1 100%; order: 3; justify-content: center; margin: 4px 0 0; }
  .pager .right > span:not(:first-child), .pager [data-jump] { display: none; }

  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); z-index: 34; width: 56px; height: 56px; border: 0; border-radius: 50%; background: var(--sun); color: var(--ink); cursor: pointer; box-shadow: 0 6px 18px rgba(18, 19, 26, .24); }
  .fab:active { transform: scale(.95); }
  .layer-open .fab { display: none; }
  .page-head .to-fab { display: none; }

  .batchbar { left: 8px; right: 8px; bottom: calc(var(--tab-h) + var(--safe-b) + 8px); transform: translateY(160%); max-width: none; padding: 6px 6px 6px 14px; scrollbar-width: none; }
  .batchbar.show { transform: none; }
  .batchbar .btn { height: 40px; flex: none; }
  .batchbar .cnt { flex: none; }
  .batchbar.show ~ .fab { display: none; }

  /* 弹窗：从底部弹出，按钮在拇指能够到的位置 */
  .overlay { align-items: flex-end; padding: 0; }
  .modal { width: 100% !important; max-width: none; max-height: calc(100dvh - 24px); border-radius: 16px 16px 0 0; transform: translateY(100%); }
  .modal-head { padding: 18px 18px 4px; }
  .modal-head h3 { font-size: 19px; }
  .modal-body { padding: 14px 18px; -webkit-overflow-scrolling: touch; }
  .modal-foot { padding: 10px 18px calc(12px + var(--safe-b)); border-top: 1px solid var(--line-2); }
  .modal-foot .btn { flex: 1; height: 46px; }
  .modal-foot .left { display: none; }
  .form-sec { margin-bottom: 12px; }
  .form-grid { gap: 14px; }

  .sheet-mask { display: block; position: fixed; inset: 0; z-index: 119; background: rgba(18, 19, 26, .44); opacity: 0; transition: opacity .18s; }
  .sheet-mask.show { opacity: 1; }
  .pop.as-sheet, .menu.as-sheet { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto !important; min-width: 0; border: 0; border-radius: 16px 16px 0 0; padding: 10px 12px calc(10px + var(--safe-b)); transform: translateY(100%); transition: transform .22s var(--ease); max-height: 80dvh; overflow-y: auto; }
  .pop.as-sheet.show, .menu.as-sheet.show { transform: none; opacity: 1; }
  .pop.as-sheet .pop-title { font-size: 16px; padding: 6px 4px 8px; }
  .pop.as-sheet .opt-list { max-height: 60dvh; margin: 0; }
  .pop.as-sheet .opt { padding: 13px 12px; font-size: 16px; }
  .pop.as-sheet .opt .dot { width: 10px; height: 10px; }
  .pop.as-sheet .input { margin-bottom: 8px; }
  .menu.as-sheet button { padding: 14px 12px; font-size: 16px; }
  .menu.as-sheet .menu-cancel { display: block; margin-top: 6px; text-align: center; justify-content: center; background: var(--fill); font-weight: 600; }

  /* 访客档案 */
  .drawer { width: 100vw !important; }
  .drawer-head { padding: calc(14px + env(safe-area-inset-top, 0px)) var(--gutter) 0; }
  .vd-top { gap: 12px; }
  .vd-avatar { width: 46px; height: 46px; font-size: 21px; }
  .vd-name { font-size: 21px; gap: 6px; }
  .vd-meta { gap: 6px 14px; margin-top: 6px; }
  .vd-actions .btn { width: 38px; height: 38px; padding: 0; }
  .vd-flags { flex-wrap: nowrap; overflow-x: auto; margin: 14px calc(-1 * var(--gutter)) 0; padding: 0 var(--gutter); scrollbar-width: none; }
  .vd-flags::-webkit-scrollbar { display: none; }
  .vd-flags .flag { flex: none; padding: 8px 12px; }
  .tabs { margin: 10px calc(-1 * var(--gutter)) 0; padding: 0 var(--gutter); scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { padding: 10px 12px 14px; font-size: 15px; }
  .drawer-body { padding: 16px var(--gutter) calc(28px + var(--safe-b)); }
  .kv { padding: 4px 14px; }
  .kv dd { font-size: 14px; }
  .sec-t { font-size: 16px; margin-top: 22px; }
  .sec-t .tools .btn { height: 36px; }

  /* 汇总 */
  .daystrip { padding: 0 var(--gutter) 18px; scrollbar-width: none; }
  .daystrip::-webkit-scrollbar { display: none; }
  .day { min-width: 92px; padding: 10px 12px; }
  .day .d-d { font-size: 18px; }
  .content > .sum-head { margin-top: 18px; }
  .sum-head h2 { font-size: 18px; }
  .vc-head { padding: 16px 16px 10px; }
  .vc-body { padding: 4px 16px 12px; }
  .vc-times { margin: 0 16px; }
  .vc-foot { padding: 4px 16px 16px; }
  .vc-foot .btn { height: 42px; }

  /* 设置 */
  .side-list { display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .side-list::-webkit-scrollbar { display: none; }
  .side-list button { flex: none; width: auto; gap: 8px; }
  .panel-head { padding: 18px 16px 0; flex-wrap: wrap; }
  .panel-body { padding: 14px 16px 18px; }

  .toasts { top: calc(var(--mast-h) + env(safe-area-inset-top, 0px) + 8px); width: calc(100vw - 32px); }
  .toast { max-width: 100%; }
}


/* 手机上，员工表和日志表改为一条一张卡片 */
@media (max-width: 940px) {
  .dt-stack, .dt-stack tbody { display: block; width: 100%; }
  .dt-stack thead { display: none; }
  .dt-stack tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); align-items: start; }
  .dt-stack tr:last-child { border-bottom: 0; }
  .dt-stack td, .dt-stack td:first-child, .dt-stack td:last-child { display: block; height: auto; padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere; font-size: 14px; background: transparent !important; }
  .dt-stack td[colspan] { grid-column: 1 / -1; }
  .dt-stack td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 400; color: var(--ink-3); margin-bottom: 2px; }
  .dt-stack .st-hide { display: none !important; }
  .dt-stack .st-main { grid-column: 1 / 3; font-size: 18px !important; font-weight: 800 !important; align-self: center; }
  .dt-stack .st-badge { grid-column: 3; grid-row: 1; justify-self: end; align-self: center; }
  .dt-stack td[data-l="最后登录"] { grid-column: span 2; }
  .dt-stack .st-ops { grid-column: 1 / -1; border-top: 1px solid var(--line-2) !important; margin: 2px -16px -14px; }
  .dt-stack .st-ops .ops { gap: 0; }
  .dt-stack .st-ops .ops .btn { flex: 1; height: 44px; border-radius: 0; font-size: 14px; }
  .dt-stack .st-ops .ops .btn + .btn { border-left: 1px solid var(--line-2); }
  .dt-log tr { grid-template-columns: 1fr auto; grid-template-areas: "who time" "act act" "tgt tgt"; gap: 4px 12px; }
  .dt-log .lg-who { grid-area: who; font-weight: 700; }
  .dt-log .lg-time { grid-area: time; font-size: 12px !important; color: var(--ink-3); }
  .dt-log .lg-act { grid-area: act; color: var(--brand-t); font-weight: 600; }
  .dt-log .lg-tgt { grid-area: tgt; color: var(--ink-2); }
  .page-head { flex-wrap: wrap; }
  .page-title { white-space: nowrap; }
  .page-actions:has(.search-box) { flex: 1 1 100%; }
  .page-actions .search-box { width: auto !important; flex: 1; min-width: 0; }
  .page-actions .search-box .input { height: 40px; }
  .v-panel { padding-bottom: 60px; }
}

/* 小屏手机（≤ 360px，如 iPhone SE 一代、部分安卓） */
@media (max-width: 360px) {
  .table-tools .right [data-a=reload] { display: none; }
  .table-tools .right .select { max-width: 108px; }
  .table-tools .total b { font-size: 17px; }
  .vm-contact, .vm-facts, .vm-staff { margin-left: 0; }
  .vm-fact { padding: 6px 7px; }
  .vm-fact b { font-size: 12px; }
  .dt-stack tr { grid-template-columns: 1fr 1fr; }
  .dt-stack .st-main { grid-column: 1; }
  .dt-stack .st-badge { grid-column: 2; }
  .dict-row { grid-template-columns: 18px 1fr auto; gap: 6px; padding: 10px 12px; }
  .dict-row .ops .btn { padding: 0 5px; }
  .hero h1 { font-size: 24px; }
}

/* 登录页（手机） */
@media (max-width: 940px) {
  .login-hero { min-height: 0; padding: calc(22px + env(safe-area-inset-top, 0px)) 22px 26px; gap: 22px; }
  .login-quote h1 { font-size: 30px; letter-spacing: .06em; }
  .login-quote p, .login-hero .foot-note { display: none; }
  .login-sun { width: 150px; height: 150px; right: -40px; top: -40px; }
  .login-panel { padding: 26px 22px calc(30px + env(safe-area-inset-bottom, 0px)); align-items: flex-start; }
  .login-form h2 { font-size: 26px; }
  .login-form .sub { margin-bottom: 22px; }
  .login-form .input { height: 50px; font-size: 16px; }
  .captcha-row canvas, .captcha-row img { height: 50px; width: 120px; }
}

@keyframes sheetUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* =========================================================
   第 3 版新增组件：手机适配
   ========================================================= */
@media (max-width: 940px) {
  .masthead #searchBtn { display: grid; }
  .npops { top: calc(var(--mast-h) + env(safe-area-inset-top, 0px) + 8px); right: 12px; }
  .risk-banner { margin: calc(-14px - env(safe-area-inset-top, 0px)) calc(-1 * var(--gutter)) 14px; padding: calc(10px + env(safe-area-inset-top, 0px)) var(--gutter) 10px; gap: 10px; }
  .risk-banner > .ico { width: 22px; height: 22px; }
  .risk-banner b { font-size: 15px; }
  .risk-banner span { font-size: 13px; }
  .risk-seg { grid-template-columns: 1fr; }
  .rn-actions .btn { flex: 1 1 auto; height: 40px; }
  .dash-grid { grid-template-columns: 1fr; gap: 14px; }
  .hero-nums.n3, .hero-nums.n2 { grid-template-columns: repeat(2, 1fr); }
  .valid-top > b { font-size: 44px; }
  .tc-nums { gap: 22px; }
  .tc-nums b { font-size: 28px; }
  .tc-actions .btn { flex: 1 1 auto; height: 44px; }
  .sc-grid { grid-template-columns: 1fr; }
  .dt.mini { display: block; overflow-x: auto; }
  .totp-box { flex-direction: column; align-items: stretch; }
  .totp-qr { width: 200px; margin: 0 auto; }
  .overlay.search-ov { align-items: flex-start; padding-top: 0; }
  .search-ov .modal { border-radius: 0 0 16px 16px; transform: translateY(-100%); max-height: 80dvh; }
  .search-ov.show .modal { transform: none; }
  .sp-item { padding: 12px 10px; }
  .notice-drawer .drawer-head { padding: calc(14px + env(safe-area-inset-top, 0px)) var(--gutter) 14px; }
  .nd-head { flex-wrap: wrap; }
  .nd-head h3 { font-size: 20px; }
  .nitem { padding: 14px; }
  .cal-bar { gap: 10px; }
  .cal-nav b { width: 100%; margin: 6px 0 0; order: 5; font-size: 16px; }
  .cal-nav { flex-wrap: wrap; }
  .cal-tools { margin-left: 0; width: 100%; }
  .cal-tools .select { flex: 1; }
  .cal-grid { grid-template-columns: 44px repeat(var(--days), minmax(96px, 1fr)); min-width: calc(44px + var(--days) * 96px); }
  .st-range { width: 100%; }
  .st-range .input { flex: 1; min-width: 0; }
  .st-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .fn-row { grid-template-columns: 40px 1fr 48px; gap: 8px 10px; }
  .fn-r { grid-column: span 1; }
  .fn-row .fn-r:last-child { display: none; }
  .fn-row .fn-r { grid-column: 2 / -1; display: flex; gap: 6px; align-items: baseline; }
  .cmp-tbl td:last-child, .cmp-tbl th:last-child { display: none; }
  .sched-row { grid-template-columns: 1fr; gap: 6px; }
  .slot-ed .input { width: 92px; }
  .log-filter { margin-left: var(--gutter); margin-right: var(--gutter); }
  .log-filter .search-box { flex: 1 1 100%; }
  .log-filter .select, .log-filter .input[type=date] { flex: 1; }
  .dt-log .lg-ip { display: none !important; }
  .imp-pick .btn { flex: 1; height: 44px; }
  .mode-row { flex-wrap: wrap; }
  .vm-name .risk-pill { margin-left: 0; }
}

/* =========================================================
   深色外观（跟随系统或手动切换）
   主色带保持主题色；纸面、文字、线条换成深色系，并重新计算主色文字以保证对比度
   ========================================================= */
[data-mode=dark] {
  color-scheme: dark;
  --ink: #e6e7ec; --ink-2: #b3b7c3; --ink-3: #8b909e; --ink-4: #5d6270;
  --ground: #0f1015; --paper: #181a21; --fill: #22252d; --fill-2: #2c2f39; --line: #2f323c; --line-2: #25282f; --hover: #1f2129;
  --danger: #ff6b6b; --danger-1: #3a1d20; --warn: #f5a524; --ok: #3ecf7a; --info: #6b9cff;
  --risk-1: #e0a83a; --risk-2: #f08454; --risk-3: #e5484d; --risk-1-bg: #33290f; --risk-2-bg: #36201a; --risk-3-bg: #3a1a1c;
  --float: 0 12px 32px rgba(0, 0, 0, .55);
}
[data-mode=dark] .btn-dark, [data-mode=dark] .pager .pg.on { background: var(--ink); color: var(--ground); }
[data-mode=dark] .btn-dark:hover { background: #fff; }
[data-mode=dark] .batchbar, [data-mode=dark] .toast, [data-mode=dark] .tip { background: #2c2f39; color: #fff; }
[data-mode=dark] .input:focus, [data-mode=dark] .select:focus, [data-mode=dark] .textarea:focus, [data-mode=dark] .is-invalid { background-color: var(--paper) !important; }
[data-mode=dark] .ck span { background: var(--paper); border-color: var(--ink-4); }
[data-mode=dark] .day.on, [data-mode=dark] .day.custom .input, [data-mode=dark] .rte-bar .btn, [data-mode=dark] .rte-area, [data-mode=dark] .g-item .g-bar .input { background: var(--paper); color: var(--ink); }
[data-mode=dark] .vd-avatar, [data-mode=dark] .masthead .avatar { background: var(--paper); }
[data-mode=dark] .pop .opt.on, [data-mode=dark] .chip { color: var(--ink); }
[data-mode=dark] .risk-pill.l3 { color: #fff; }
[data-mode=dark] .masthead, [data-mode=dark] .page-head, [data-mode=dark] .hero, [data-mode=dark] .journey, [data-mode=dark] .daystrip, [data-mode=dark] .subtabs, [data-mode=dark] .drawer-head { background: var(--brand-dd); }
[data-mode=dark] .tabbar { background: var(--paper); border-top-color: var(--line); }
[data-mode=dark] .tabbar .active { color: var(--brand-t); }
[data-mode=dark] .tabbar .active::before { background: var(--brand-t); }
[data-mode=dark] .seg button.on, [data-mode=dark] .side-list button.on, [data-mode=dark] .btn-primary, [data-mode=dark] .quick-dates button.on, [data-mode=dark] .slot.on { background: var(--brand); }
[data-mode=dark] img { opacity: .92; }
[data-mode=dark] .qr, [data-mode=dark] .totp-qr { opacity: 1; }
/* 点缀色上的文字始终用深色 */
[data-mode=dark] .page-head .btn-primary, [data-mode=dark] .hero .btn, [data-mode=dark] .fab, [data-mode=dark] .menu-badge, [data-mode=dark] .nav .badge, [data-mode=dark] .vd-name .tag.risk { color: #12131a; }
.st-bar .input[type=date] { width: auto; }
.sys-form .cols-pick { display: flex; gap: 20px; flex-wrap: wrap; }
@media (max-width: 940px) {
  .st-range .input[type=date], .cmp-dates .input[type=date] { flex: 1 1 40%; width: auto; min-width: 128px; }
  .cmp-dates { gap: 8px; }
  .cmp-dates > span:not(.cmp-a):not(.cmp-b) { display: none; }
  .cmp-a, .cmp-b { width: 100%; margin: 4px 0 0; }
  .panel-head .tools { flex-wrap: wrap; }
  #se .panel-head .tools { width: 100%; margin-left: 0; }
  #se .panel-head .tools .btn { flex: 1 1 auto; height: 40px; white-space: normal; line-height: 1.3; }
  .dt td.wrap { min-width: 240px; }
}
