/* 签证系统 —「寰宇」主题：深色、玻璃面板、冷蓝光，底下是一张哈萨克斯坦点阵地图。设计变量 + 组件。不能用内联样式（CSP）。 */
:root {
  color-scheme: dark;
  --navy-950: #03060c; --navy-900: #0c1422; --navy-800: #121c2e; --navy-700: rgba(255, 255, 255, .1); --navy-300: #8fa0bd;
  --bg: #05080f; --glass: rgba(15, 23, 39, .7); --solid: rgba(13, 20, 34, .94); --solid-2: #121b2d;
  --surface: rgba(255, 255, 255, .045); --surface-2: rgba(255, 255, 255, .055); --surface-3: rgba(255, 255, 255, .1);
  --border: rgba(255, 255, 255, .09); --border-strong: rgba(255, 255, 255, .18);
  --edge: linear-gradient(145deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .045) 36%, rgba(255, 255, 255, .045) 64%, rgba(255, 255, 255, .13));
  --text: #eef3fc; --text-2: #b9c5da; --muted: #8292ad;
  --primary: #55adff; --primary-600: #86c5ff; --primary-50: rgba(85, 173, 255, .13); --primary-100: rgba(85, 173, 255, .3); --on-primary: #04101f;
  --danger: #ff6b6b; --danger-50: rgba(255, 107, 107, .13); --warn: #ffbe5c; --warn-50: rgba(255, 190, 92, .13); --ok: #48e0a6; --ok-50: rgba(72, 224, 166, .15);
  --radius: 14px; --radius-lg: 22px;
  --shadow-sm: 0 12px 30px -22px rgba(0, 0, 0, .8);
  --shadow: 0 16px 40px -22px rgba(0, 0, 0, .85);
  --shadow-lg: 0 30px 80px -24px rgba(0, 0, 0, .9);
  --blur: blur(24px) saturate(165%);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Noto Sans SC", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --sidebar: 248px;
  /* tone palette: background / foreground */
  --teal-bg: rgba(45, 212, 191, .15); --teal-fg: #63e6d2; --teal-solid: #2dd4bf;
  --amber-bg: rgba(255, 190, 92, .15); --amber-fg: #ffc978; --amber-solid: #f5b041;
  --violet-bg: rgba(167, 139, 250, .18); --violet-fg: #c8b9ff; --violet-solid: #a78bfa;
  --blue-bg: rgba(85, 173, 255, .16); --blue-fg: #8ecbff; --blue-solid: #55adff;
  --indigo-bg: rgba(129, 140, 248, .19); --indigo-fg: #b4bbff; --indigo-solid: #818cf8;
  --rose-bg: rgba(255, 107, 107, .16); --rose-fg: #ff9292; --rose-solid: #ff6b6b;
  --gray-bg: rgba(255, 255, 255, .08); --gray-fg: #b9c5da; --gray-solid: #7f8faa;
  /* 地图底板 */
  --atlas-dot: rgba(126, 160, 222, .32); --atlas-dot2: rgba(96, 170, 255, .7); --atlas-dot3: #a8dcff; --atlas-line: rgba(120, 165, 235, .32); --atlas-grat: rgba(140, 170, 220, .1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); scrollbar-color: rgba(255, 255, 255, .2) transparent; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; background: linear-gradient(180deg, rgba(0, 0, 0, .42), transparent 22%, transparent 72%, rgba(0, 0, 0, .5)), radial-gradient(46% 50% at 60% 42%, rgba(85, 173, 255, .14), transparent 72%); }
#app { position: relative; z-index: 1; transition: opacity .7s ease; }
option, optgroup { background: #101a2c; color: var(--text); }
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .2) transparent; }
body.has-layer { overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.block { display: block; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -.01em; }
.small { font-size: 12px; }
.center { text-align: center; }
.error-text { color: var(--danger); }
.in-text { color: var(--ok); }
.icon { width: 18px; height: 18px; flex: none; }
.icon.sm { width: 14px; height: 14px; }
.icon.xl { width: 30px; height: 30px; }
.icon.crown { width: 14px; height: 14px; color: var(--amber-solid); margin-right: 3px; vertical-align: -2px; }
kbd { font: 11px var(--mono); padding: 1px 6px; border-radius: 5px; border: 1px solid currentColor; opacity: .55; }

/* ---------- tones ---------- */
.tone-teal { background: var(--teal-bg); color: var(--teal-fg); }
.tone-amber { background: var(--amber-bg); color: var(--amber-fg); }
.tone-violet { background: var(--violet-bg); color: var(--violet-fg); }
.tone-blue { background: var(--blue-bg); color: var(--blue-fg); }
.tone-indigo { background: var(--indigo-bg); color: var(--indigo-fg); }
.tone-rose { background: var(--rose-bg); color: var(--rose-fg); }
.tone-gray { background: var(--gray-bg); color: var(--gray-fg); }

/* ---------- boot / brand ---------- */
.boot-splash { min-height: 100vh; display: grid; place-items: center; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { display: block; font-size: 15px; letter-spacing: .02em; }
.brand small { display: block; font-size: 11px; color: var(--navy-300); letter-spacing: .04em; }
/* 标志：深色玻璃小方块，里面是 brand.js 的图标——圆环里一实一空两个 W（和 favicon.svg 同一个图形，都由 dev/make-icon.mjs 生成）。 */
.brand-mark { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; color: #eef6ff; border: 1px solid rgba(255, 255, 255, .18); background: radial-gradient(circle at 70% 24%, rgba(63, 155, 255, .5), transparent 62%), linear-gradient(150deg, #1c3c6e, #050b18); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 6px 16px -6px rgba(40, 130, 255, .55); }
.brand-mark svg { width: 100%; height: 100%; fill: currentColor; }
.brand-mark svg .ring { fill: #58b0ff; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 46%) 1fr; }
.auth-hero { color: var(--text); padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; text-shadow: 0 2px 18px var(--bg), 0 0 6px var(--bg); }
.auth-copy h1 { font-size: 32px; font-weight: 700; line-height: 1.35; letter-spacing: .01em; }
.auth-points { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 14px; color: var(--text-2); font-size: 15px; }
.auth-points li { display: flex; gap: 12px; align-items: center; }
.auth-points .icon { color: var(--primary); }
.auth-foot { color: var(--navy-300); font-size: 12px; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; position: relative; }
.auth-lang { position: absolute; top: 16px; right: 16px; height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--border); background: var(--surface-3); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.auth-lang:hover { border-color: var(--primary); color: var(--primary); }
.auth-card { width: min(420px, 100%); display: grid; gap: 16px; padding: 30px 28px; border-radius: 28px; border: 1px solid transparent; background: linear-gradient(var(--glass), var(--glass)) padding-box, var(--edge) border-box; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow-lg); }
.auth-card h2 { font-size: 24px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: calc(var(--sidebar) + 14px) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 14px; height: calc(100vh - 28px); margin: 14px 0 14px 14px; border-radius: 28px; border: 1px solid transparent; background: linear-gradient(var(--glass), var(--glass)) padding-box, var(--edge) border-box; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow); color: #dbe4f3; display: flex; flex-direction: column; padding: 18px 12px 12px; gap: 14px; z-index: 30; }
.sidebar .brand { padding: 2px 8px 4px; cursor: pointer; }
.search-trigger { display: flex; align-items: center; gap: 8px; width: 100%; height: 38px; padding: 0 12px; border-radius: 19px; border: 0; background: var(--surface-2); color: var(--navy-300); text-align: left; }
.search-trigger span { flex: 1; }
.search-trigger:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.nav { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 14px; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; scrollbar-color: var(--navy-700) transparent; }
.nav-group p { font-size: 11px; color: #7186a8; letter-spacing: .08em; padding: 0 10px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; color: #c6d2e6; font-size: 14px; position: relative; }
.nav-item .icon { color: #8aa0c4; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: var(--navy-700); color: #fff; font-weight: 600; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); }
.nav-item.active .icon { color: var(--primary); }
.nav-badge { margin-left: auto; min-width: 20px; padding: 0 6px; height: 20px; border-radius: 10px; background: var(--rose-solid); color: #fff; font: 600 11px/20px var(--font); text-align: center; font-style: normal; }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.user-chip div { flex: 1; min-width: 0; }
.user-chip b { display: block; font-size: 13px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip small { color: var(--navy-300); font-size: 12px; }
.user-chip .icon-btn { color: var(--navy-300); }
.user-chip .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.main { min-width: 0; display: flex; flex-direction: column; }
/* 吸顶的顶栏、工具栏不用 backdrop-filter：整页滚动时内容从它们底下滑过，浏览器每帧重算模糊，
   顶栏跟不上滚动、一跳一跳（第 37 条：签证缴费、计划签证、团队总览滑动时整页抖动）。
   底色要完全不透明（就是页面的底色）：原来是九成不透明，亮的字从底下滑过时会透出来，和栏里的搜索框、按钮叠在一起（P41）。 */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 20px 28px 14px; background: var(--bg); border-bottom: 1px solid transparent; }
.page-title { flex: 1; min-width: 0; }
.page-title h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.page-title p { color: var(--muted); font-size: 13px; margin-top: 2px; }
/* minmax(0, 1fr)：这一列永远只有屏幕那么宽。不写的话，里面一张宽表格会把整列撑宽，
   工具栏、数字卡片跟着被撑出屏幕（721～1300 宽的平板、折叠屏横屏上整页偏大）。 */
.view { padding: 8px 28px 48px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.view:focus { outline: none; }
.mobile-only, .icon-btn.mobile-only { display: none; }
.scrim { display: none; }
.quick-add { position: relative; }
/* 一句话登记 */
.qe-input { display: flex; gap: 8px; }
.qe-input input { flex: 1; min-width: 0; font-size: 16px; }
.qe-examples .chip { cursor: pointer; }
.qe-result:empty { display: none; }
.qe-result { display: grid; gap: 10px; }
.qe-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13.5px; }
.qe-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.qe-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.qe-item > .icon { flex: none; margin-top: 2px; }
.qe-item > div { flex: 1; min-width: 0; }
.qe-item p { margin: 4px 0 0; font-size: 13px; color: var(--text-2); }
.qe-item.ok > .icon { color: var(--teal-fg, #0f766e); }
.qe-item.choose { background: var(--warn-50); border-color: transparent; }
.qe-item.choose > .icon { color: var(--warn); }
.qe-item.error { background: var(--danger-50); border-color: transparent; }
.qe-item.error > .icon, .qe-item.error p { color: var(--danger); }
.qe-warn { color: var(--warn) !important; }
.qe-candidates { display: grid; gap: 6px; margin-top: 8px; }
.qe-candidate { display: grid; gap: 2px; text-align: left; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.qe-candidate:hover { border-color: var(--primary-600); }
.qe-candidate small { color: var(--muted); font-size: 12px; }
/* 设置 → WhatsApp */
.wa-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; margin-bottom: 8px; }
.wa-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wa-copy code { padding: 6px 8px; border-radius: 6px; background: var(--surface-2); font-size: 12.5px; word-break: break-all; }
.page-actions { display: flex; gap: 8px; }
.page-actions:empty { display: none; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--solid); border: 1px solid var(--border-strong); border-radius: 18px; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px; z-index: 40; display: grid; }
.menu button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: none; border-radius: 12px; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu .icon { color: var(--muted); }
.skeleton { display: grid; gap: 12px; }
.skeleton i { height: 76px; border-radius: var(--radius-lg); background: linear-gradient(90deg, rgba(255, 255, 255, .04) 0%, rgba(255, 255, 255, .09) 50%, rgba(255, 255, 255, .04) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton i:nth-child(2) { height: 220px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 19px; border: 1px solid transparent; font-weight: 600; font-size: 13.5px; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, filter .15s; }
.btn .icon { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 78%, white), var(--primary)); color: var(--on-primary); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 10px 24px -12px color-mix(in srgb, var(--primary) 85%, transparent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn.ghost:hover { background: rgba(255, 255, 255, .16); color: var(--text); }
.btn.danger { background: var(--danger); color: #230707; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 15px; }
.btn.lg { height: 46px; font-size: 15px; border-radius: 23px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--gray-bg); color: var(--text); }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.sm .icon { width: 15px; height: 15px; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.link { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 600; }
.link .icon { width: 14px; height: 14px; }
.link-like { border: 0; background: none; padding: 0; text-align: left; }

/* ---------- inputs ---------- */
input, select, textarea { height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: rgba(255, 255, 255, .055); width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
textarea { height: auto; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
input:disabled, select:disabled { background: var(--surface-2); color: var(--muted); }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; accent-color: var(--primary); }
select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238fa0bd' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; background-size: 15px; }
.field { display: grid; gap: 6px; align-content: start; }
.field.wide { grid-column: 1 / -1; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field-label em { color: var(--danger); font-style: normal; margin-left: 2px; }
.field-hint { font-size: 12px; color: var(--muted); }
.input-group { display: flex; gap: 6px; }
.input-group .btn { height: 38px; border-radius: 12px; }
.readonly-field { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; }
.readonly-field small { color: var(--muted); font-weight: 400; }
.form { display: grid; gap: 18px; }
.form-section { display: grid; gap: 12px; }
.form-section + .form-section { border-top: 1px solid var(--border); padding-top: 16px; }
.form-section h3 { font-size: 13px; color: var(--muted); letter-spacing: .04em; }
.form-section h3 small { font-weight: 400; margin-left: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-error { padding: 10px 12px; border-radius: 12px; background: var(--danger-50); color: var(--danger); font-size: 13px; }
.form-note { font-size: 12.5px; color: var(--muted); }
/* 表单底部的按钮行：一行放不下就折行（推送提醒有三个按钮，不折行会把整张表单撑得比手机屏幕宽），按钮之间留空 */
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check.inline { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.check-row { display: flex; flex-wrap: wrap; gap: 18px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.tick { display: inline-grid; cursor: pointer; }
.tick input { position: absolute; opacity: 0; pointer-events: none; }
.tick span { width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: transparent; background: var(--surface); transition: all .15s; }
.tick span .icon { width: 15px; height: 15px; stroke-width: 2.6; }
.tick input:checked + span { background: var(--ok); border-color: var(--ok); color: var(--on-primary); }
.tick input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-100); }
.tick input:disabled + span { cursor: default; opacity: .8; }
.inline-select { height: 32px; font-size: 13px; width: auto; min-width: 110px; }
.money-input { height: 32px; width: 120px; text-align: right; font-family: var(--mono); }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar > select, .toolbar > input[type=month] { width: auto; }
/* 下拉框按最长的一项定宽：选项里有一个俄文公司全称，筛选栏就比手机屏幕还宽，整页跟着被撑开（P38 审计三 中 1）。
   最多和筛选栏一样宽，放不下时浏览器自己截断显示。 */
.toolbar select { min-width: 0; max-width: 100%; }
.toolbar-spacer { flex: 1; }
.toolbar-note { font-size: 12.5px; color: var(--muted); }
.search-box { position: relative; flex: 1 1 280px; max-width: 420px; }
.search-box .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search-box input { padding-left: 36px; border-radius: 19px; border-color: transparent; background: var(--surface-3); }
.search-box.sm { flex: 0 1 260px; }
.search-box.sm input { height: 32px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 19px; background: var(--surface-2); gap: 2px; }
.segmented button, .segmented a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border: 0; border-radius: 16px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; }
.segmented .icon { width: 15px; height: 15px; }
.segmented .on { background: var(--surface-3); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 13px; border-radius: 15px; border: 1px solid transparent; background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.chip-count { font-size: 11.5px; color: var(--muted); }
.chip.on { background: color-mix(in srgb, var(--primary) 20%, transparent); border-color: color-mix(in srgb, var(--primary) 50%, transparent); color: var(--primary-600); font-weight: 600; }
.chip.on .chip-count { color: inherit; opacity: .75; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs.big .tab { padding: 10px 14px; font-size: 14px; }
.tab-count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--gray-bg); color: var(--gray-fg); font-size: 11.5px; line-height: 18px; text-align: center; }
.tab.active .tab-count { background: var(--primary-50); color: var(--primary); }
.month-nav { display: inline-flex; align-items: center; gap: 4px; }
.month-nav input { width: 150px; }

/* ---------- badges / status ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge .icon { width: 13px; height: 13px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-solid); }
.status.in { color: var(--ok); font-weight: 600; }
.status.in i { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-50); }
.status.out { color: var(--muted); }
.status.none { color: var(--muted); }
.days { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.days-ok { background: var(--gray-bg); color: var(--gray-fg); }
.days-warn { background: var(--amber-bg); color: var(--amber-fg); }
.days-danger { background: var(--rose-bg); color: var(--rose-fg); }
.days-overdue { background: var(--rose-solid); color: #230707; }
.presence-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gray-solid); display: inline-block; flex: none; }
.presence-dot.in { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-50); }
.avatar { width: 38px; height: 38px; border-radius: 13px; display: inline-grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xs { width: 22px; height: 22px; font-size: 11px; border-radius: 7px; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; border-radius: 11px; }
.avatar.xl { width: 72px; height: 72px; font-size: 28px; border-radius: 22px; }
.doc-count { font-family: var(--mono); font-size: 12.5px; color: var(--amber-fg); font-weight: 600; }
.doc-count.full { color: var(--ok); }

/* ---------- cards / tables ---------- */
.card { border: 1px solid transparent; background: linear-gradient(var(--glass), var(--glass)) padding-box, var(--edge) border-box; border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.card-head h3 .icon { color: var(--muted); }
.table-wrap { border: 1px solid transparent; background: linear-gradient(var(--glass), var(--glass)) padding-box, var(--edge) border-box; border-radius: var(--radius-lg); overflow: auto; box-shadow: var(--shadow-sm); max-height: calc(100vh - 220px); }
.card .table-wrap { box-shadow: none; max-height: none; background: var(--surface); border-color: var(--border); border-radius: 16px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--solid-2); text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.hover tbody tr { cursor: pointer; transition: background .1s; }
.table.hover tbody tr:hover { background: var(--surface-2); }
.table.compact td { padding: 8px 12px; font-size: 13px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .center { text-align: center; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * + * { margin-left: 4px; }
.table td small { font-size: 12px; }
.table-foot { font-size: 12.5px; color: var(--muted); padding: 0 4px; }
.cell-person { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.cell-person b { display: block; font-weight: 600; }
.cell-person small { display: block; color: var(--muted); font-size: 12px; }
.cell-stack { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.big-num { font-size: 18px; }
.empty { display: grid; justify-items: center; gap: 6px; padding: 48px 20px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.empty b { color: var(--text); font-size: 15px; }
.empty-mark { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--gray-bg); margin-bottom: 4px; }
.empty.slim { padding: 22px; border: 0; background: var(--surface-2); }
.alert-box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--primary-50); color: var(--primary-600); font-size: 13.5px; }
.alert-box > span { flex: 1; }
.alert-box.danger { background: var(--danger-50); color: var(--danger); }
.alert-box.warn { background: var(--warn-50); color: var(--warn); }
.alert-box.violet { background: var(--violet-bg); color: var(--violet-fg); }
.foot-note { font-size: 12.5px; color: var(--muted); line-height: 1.6; }

/* ---------- dashboard ---------- */
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpis.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { position: relative; display: grid; gap: 2px; text-align: left; padding: 16px 18px; border-radius: var(--radius-lg); border: 1px solid transparent; background: linear-gradient(var(--glass), var(--glass)) padding-box, var(--edge) border-box; box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s; }
button.kpi:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.kpi.static { cursor: default; }
.kpi-icon { position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.kpi-warn .kpi-icon { background: var(--amber-bg); color: var(--amber-fg); }
.kpi-danger .kpi-icon { background: var(--rose-bg); color: var(--rose-fg); }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { font-size: 32px; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 12px; color: var(--muted); }
.kpi-warn .kpi-value { color: var(--amber-fg); }
.kpi-danger .kpi-value { color: var(--rose-fg); }
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
.todo-row, .person-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 8px; border: 0; background: none; border-radius: 14px; text-align: left; color: var(--text); }
.todo-row:hover, .person-row:hover { background: var(--surface-2); }
.todo-row > div, .person-row > div { flex: 1; min-width: 0; }
.todo-row b, .person-row b { display: block; font-weight: 600; font-size: 13.5px; }
.todo-row small, .person-row small { color: var(--muted); font-size: 12px; }
.todo-row > .icon { color: var(--muted); }
.todo-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.level-due { background: color-mix(in srgb, var(--rose-solid) 34%, transparent); color: #ffb9b9; }
.level-important { background: var(--rose-bg); color: var(--rose-fg); }
.level-warning { background: var(--amber-bg); color: var(--amber-fg); }
.all-clear { display: grid; justify-items: center; gap: 4px; padding: 26px; color: var(--muted); }
.all-clear .icon { width: 34px; height: 34px; padding: 7px; border-radius: 50%; background: var(--ok-50); color: var(--ok); }
.all-clear b { color: var(--text); }
.all-clear.big { padding: 60px 20px; border-radius: var(--radius-lg); border: 1px solid transparent; background: linear-gradient(var(--glass), var(--glass)) padding-box, var(--edge) border-box; }
.stack-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--gray-bg); gap: 2px; }
.stack-bar i { display: block; height: 100%; }
.stack-bar .tone-teal { background: var(--teal-solid); } .stack-bar .tone-amber { background: var(--amber-solid); } .stack-bar .tone-violet { background: var(--violet-solid); }
.stack-bar .tone-blue { background: var(--blue-solid); } .stack-bar .tone-indigo { background: var(--indigo-solid); }
.legend-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.legend-list li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.legend-list b { margin-left: auto; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot.tone-teal { background: var(--teal-solid); } .dot.tone-amber { background: var(--amber-solid); } .dot.tone-violet { background: var(--violet-solid); } .dot.tone-blue { background: var(--blue-solid); } .dot.tone-indigo { background: var(--indigo-solid); }
.people-list { display: grid; }
.expiry-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.expiry-item { display: grid; gap: 4px; justify-items: start; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface-2); text-align: left; border-top: 3px solid var(--gray-solid); }
.expiry-item:hover { border-color: var(--border-strong); background: var(--surface); }
.expiry-item.days-warn { border-top-color: var(--amber-solid); }
.expiry-item.days-danger { border-top-color: var(--rose-solid); }
.expiry-item small { color: var(--muted); font-size: 12px; }
.expiry-date { font: 700 18px var(--mono); letter-spacing: -.02em; }

/* ---------- overlays ---------- */
.layer, .palette-layer { position: fixed; inset: 0; z-index: 100; }
.layer-scrim { position: absolute; inset: 0; background: rgba(2, 4, 9, .62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; transition: opacity .18s; }
.layer.open .layer-scrim, .palette-layer .layer-scrim { opacity: 1; }
.layer-panel { position: absolute; border: 1px solid transparent; background: linear-gradient(var(--solid), var(--solid)) padding-box, var(--edge) border-box; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: calc(100vh - 48px); transition: transform .2s ease, opacity .2s; }
.layer-panel.modal { left: 50%; top: 50%; width: min(560px, calc(100vw - 32px)); border-radius: 24px; transform: translate(-50%, -46%); opacity: 0; }
.layer.open .layer-panel.modal { transform: translate(-50%, -50%); opacity: 1; }
.layer-panel.modal.sm { width: min(420px, calc(100vw - 32px)); }
.layer-panel.modal.lg { width: min(720px, calc(100vw - 32px)); }
.layer-panel.modal.xl { width: min(1040px, calc(100vw - 32px)); }
.layer-panel.drawer { right: 12px; top: 12px; bottom: 12px; max-height: none; border-radius: 28px; width: min(760px, calc(100vw - 24px)); transform: translateX(30px); opacity: 0; }
.layer.open .layer-panel.drawer { transform: none; opacity: 1; }
.layer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.layer-head h2 { font-size: 18px; }
.layer-head p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.layer-body { padding: 4px 20px 20px; overflow-y: auto; flex: 1; }
.layer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 23px 23px; }
.confirm-text { color: var(--text-2); line-height: 1.7; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 400; display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 22px; border: 1px solid var(--border-strong); background: var(--solid); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); color: #fff; font-size: 13.5px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: all .2s; max-width: calc(100vw - 32px); }
.toast .icon { color: #6ee7b7; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: rgba(110, 24, 24, .94); }
.toast-error .icon { color: #fecaca; }
.progress { height: 8px; border-radius: 4px; background: var(--gray-bg); overflow: hidden; margin: 12px 0 8px; }
.progress i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.upload-name { display: flex; align-items: center; gap: 8px; font-weight: 600; word-break: break-all; }

/* ---------- import ---------- */
.import-drop { display: grid; justify-items: center; gap: 10px; padding: 36px 20px; border: 2px dashed var(--border-strong); border-radius: 20px; text-align: center; background: var(--surface-2); }
.import-drop .icon.xl { color: var(--primary); }
.import-drop.over { border-color: var(--primary); background: var(--primary-50); }
.import-result { display: grid; gap: 12px; margin-top: 12px; }
.import-result .table-wrap { max-height: 50vh; }
.import-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.import-summary > div { display: grid; margin-right: auto; }
.import-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- person dossier ---------- */
.dossier-hero { display: flex; gap: 16px; align-items: flex-start; padding: 6px 0 16px; }
.dossier-id { flex: 1; min-width: 0; display: grid; gap: 6px; }
/* 名字一长（中文名 + 拼音 / 俄文全名）就折到下一行，不把抽屉撑宽（P38 审计三 中 4） */
.dossier-names { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.dossier-names > * { min-width: 0; overflow-wrap: anywhere; }
.dossier-names b { font-size: 22px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.dossier-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dossier-body { padding-top: 16px; display: grid; gap: 16px; }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-card { display: grid; gap: 3px; align-content: start; justify-items: start; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.mini-card > span { font-size: 12px; color: var(--muted); }
.mini-card b { font-size: 15px; }
.mini-card small { font-size: 12px; color: var(--muted); }
.quota-card { padding: 14px 16px; border-radius: 18px; border: 1px solid var(--teal-bg); background: linear-gradient(180deg, var(--teal-bg), transparent); display: grid; gap: 10px; }
.quota-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.quota-head span { font-size: 12px; }
.quota-foot { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--text-2); }
.meter { height: 8px; border-radius: 4px; background: var(--gray-bg); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--teal-solid); transition: width .3s; }
.meter.warn i { background: var(--amber-solid); }
.meter.over i { background: var(--rose-solid); }
.meter-cell { display: grid; gap: 4px; min-width: 140px; }
.meter-cell small { color: var(--muted); }
.kv-grid { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.kv-grid.single { grid-template-columns: 1fr; border: 0; }
.kv { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); min-width: 0; }
.kv-grid:not(.single) .kv:nth-child(odd) { border-right: 1px solid var(--border); }
.kv span { width: 72px; flex: none; color: var(--muted); font-size: 12.5px; }
.kv b { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.mini-timeline { padding: 14px; border-radius: 16px; border: 1px solid var(--border); }
.tl-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.legend .tone-teal { background: var(--teal-solid); } .legend .tone-amber { background: var(--amber-solid); } .legend .tone-indigo { background: var(--indigo-solid); }
.legend .open-sample { background: repeating-linear-gradient(45deg, var(--indigo-solid) 0 3px, #a5b4fc 3px 6px); }
.tl-track { position: relative; height: 22px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.tl-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; min-width: 3px; }
.tl-bar.tone-teal { background: var(--teal-solid); } .tl-bar.tone-amber { background: var(--amber-solid); } .tl-bar.tone-indigo { background: var(--indigo-solid); }
.tl-bar.open { background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .0) 0 4px, rgba(255, 255, 255, .45) 4px 8px); }
.tl-axis { position: relative; height: 18px; font-size: 11px; color: var(--muted); }
.tl-axis span { position: absolute; top: 3px; transform: translateX(-50%); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.section-head .muted { font-size: 12px; }
/* 列表只有一列，这一列不许比列表宽（minmax(0, 1fr)）。不写的话，列宽按「最宽那一行不换行有多宽」来定：只要有一行带着断不开的长串
   （设备审批里的 IPv6 地址），所有行都被撑到卡片外面，右边的状态和按钮被 overflow: hidden 裁掉，手机上看不到也点不到（P35）。 */
.list { display: grid; grid-template-columns: minmax(0, 1fr); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface); }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; width: 100%; }
.list-row:last-child { border-bottom: 0; }
button.list-row:hover { background: var(--surface-2); }
.list-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.list-main > div { display: grid; min-width: 0; }
/* 文字放不下就在任意位置断行（长地址、长用户名），不往右边的按钮上压 */
.list-main b { font-weight: 600; overflow-wrap: anywhere; }
.list-main small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.list-side { display: flex; align-items: center; gap: 8px; flex: none; }
/* 右边带文字按钮的行，模板里写 list-row wrap（档案里的「注销签证」「登记出境」，设备审批的「批准 / 停用」）：
   右边那块给左边留不出 160px 时，整块另起一行、靠右；放得下就和原来一样在同一行。右边自己比一行还宽（俄文按钮）时，里面的按钮再折行。
   不写 wrap 的行（提醒中心）右边只有天数和箭头，永远不折行。 */
.list-row.wrap { flex-wrap: wrap; }
.list-row.wrap > .list-main { flex: 1 1 160px; }
.list-row.wrap > .list-side { flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.list-side > .icon { color: var(--muted); }
.stay-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gray-solid); flex: none; }
.stay-dot.open { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-50); }
.doc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.doc-card { display: grid; grid-template-rows: auto 1fr auto; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface); }
.doc-card.missing { border-style: dashed; }
.doc-card[data-drop] { position: relative; transition: border-color .15s, box-shadow .15s; }
.doc-drop-hint { position: absolute; inset: 0; display: none; place-items: center; align-content: center; gap: 6px; background: color-mix(in srgb, var(--primary) 16%, #0b1220 84%); color: var(--primary); font-weight: 600; font-size: 14px; pointer-events: none; z-index: 2; }
.doc-card.drop-over { border: 2px dashed var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); }
.doc-card.drop-over .doc-drop-hint { display: grid; }
.doc-card.uploading { opacity: .6; pointer-events: none; }
.template-card.drop-over { border: 2px dashed var(--primary); background: var(--primary-50); }
td.drop-over { background: var(--primary-50); }
td.drop-over .doc-cell.missing { border-color: var(--primary); color: var(--primary); }
.doc-thumb { height: 120px; display: grid; place-items: center; align-content: center; gap: 4px; background: var(--surface-2); color: var(--muted); font-size: 12px; overflow: hidden; }
.doc-card.has .doc-thumb { background: var(--primary-50); color: var(--primary); }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-meta { padding: 10px 12px 4px; display: grid; }
.doc-meta small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 12px; }

/* ---------- people cards ---------- */
.person-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.person-card { display: grid; gap: 12px; padding: 16px; border-radius: var(--radius-lg); border: 1px solid transparent; background: linear-gradient(var(--glass), var(--glass)) padding-box, var(--edge) border-box; text-align: left; box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s; }
.person-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.person-card-head { display: flex; gap: 12px; align-items: center; }
.person-card-head b { display: block; font-size: 16px; }
.person-card-head small { display: block; color: var(--muted); font-size: 12px; }
.person-card-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--muted); }
.person-card-meta b { color: var(--text); }
.person-card-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-top: 10px; border-top: 1px solid var(--border); }

/* ---------- team org chart ---------- */
.arrange-hint { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; background: var(--primary-50); color: var(--primary-600); font-size: 13px; }
.org-overview { display: grid; justify-items: center; gap: 0; padding: 22px 18px 18px; }
.org-root { position: relative; padding-bottom: 22px; }
.org-root::after { content: ""; position: absolute; left: 50%; bottom: 0; height: 22px; width: 2px; background: var(--border-strong); }
.org-root-node { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 16px; border: 1px solid var(--border-strong); background: var(--surface-3); color: #fff; }
.org-root-node .icon { color: #8fb3ff; }
.org-root-node small { color: var(--navy-300); }
.org-branches { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; position: relative; padding-top: 22px; width: fit-content; max-width: 100%; }
.org-branches::before { content: ""; position: absolute; top: 0; left: 80px; right: 80px; height: 2px; background: var(--border-strong); }
.org-branch { min-width: 160px; }
.org-branch { position: relative; display: grid; gap: 2px; min-width: 150px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); text-align: center; }
.org-branch::before { content: ""; position: absolute; left: 50%; top: -23px; height: 22px; width: 2px; background: var(--border-strong); }
.org-branch:hover { border-color: var(--primary); }
.org-branch b { font-size: 14.5px; }
.org-branch small { color: var(--muted); font-size: 12px; }
.org-branch.dashed { border-style: dashed; background: var(--surface-2); }
.org-count { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--primary); }
.team-boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 16px; align-items: start; }
.team-boards.masonry { display: flex; align-items: flex-start; }
.team-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.team-board { border: 1px solid transparent; background: linear-gradient(var(--glass), var(--glass)) padding-box, var(--edge) border-box; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; transition: border-color .15s, box-shadow .15s; scroll-margin-top: 90px; }
.team-board.unassigned { border: 1px dashed var(--border-strong); background: var(--surface-2); }
.team-board.drop { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.team-board-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--surface-2), transparent); }
.team-board.unassigned .team-board-head { background: none; }
.team-board-head > div:first-child { flex: 1 1 10em; min-width: min(100%, 10em); }
.team-board-head > .team-stats { margin-left: auto; }
.team-board-head h3 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-board-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.team-stats { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); }
.team-stats b { font-size: 16px; color: var(--text); margin-right: 2px; }
.org-tree { padding: 18px 16px 16px; display: grid; justify-items: center; }
.org-lead { position: relative; padding-bottom: 20px; width: min(280px, 100%); }
.org-lead::after { content: ""; position: absolute; left: 50%; bottom: 0; height: 20px; width: 2px; background: var(--border-strong); }
.org-members { position: relative; width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; padding-top: 18px; border-top: 2px solid var(--border-strong); }
.org-members.flat { border-top: 0; padding: 14px 16px 16px; }
.org-members.empty-members { display: block; text-align: center; color: var(--muted); font-size: 13px; padding-bottom: 6px; min-height: 40px; }
.org-node { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; flex-wrap: wrap; transition: border-color .15s, box-shadow .15s, opacity .15s; }
.org-members:not(.flat) > .org-node::before { content: ""; position: absolute; left: 50%; top: -19px; height: 18px; width: 2px; background: var(--border-strong); }
.org-node:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.org-node.lead { border-color: color-mix(in srgb, var(--amber-solid) 55%, transparent); background: linear-gradient(180deg, var(--amber-bg), transparent); }
.org-node.lead b { font-size: 15px; }
.org-node.placeholder { justify-content: center; color: var(--muted); border-style: dashed; cursor: default; }
.org-node.hit { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.org-node-text { flex: 1; min-width: 0; display: grid; }
.org-node-text b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-node-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-node-tags { display: flex; align-items: center; gap: 6px; }
.move-select { flex-basis: 100%; height: 30px; font-size: 12.5px; }
.team-boards.arranging .org-node[data-person] { cursor: grab; border-style: dashed; }
.org-node.dragging { opacity: .4; }

/* ---------- gantt ---------- */
.gantt { padding: 0; overflow: hidden; }
.gantt-head, .gantt-row { display: grid; grid-template-columns: 170px 1fr; align-items: center; }
.gantt-head { background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); font-weight: 600; }
.gantt-name { display: flex; align-items: center; gap: 8px; padding: 8px 14px; min-width: 0; }
.gantt-name b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-axis { position: relative; height: 34px; margin-right: 14px; }
.gantt-axis span { position: absolute; top: 9px; padding-left: 4px; white-space: nowrap; }
.gantt-row { border-bottom: 1px solid var(--border); cursor: pointer; }
.gantt-row:hover { background: var(--surface-2); }
.gantt-track { position: relative; height: 36px; margin-right: 14px; }
.gantt-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); }
.gantt-track .tl-bar { top: 10px; bottom: 10px; }
.gantt-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 10px 14px; font-size: 12px; }

/* ---------- attendance / tax ---------- */
.trips { display: flex; flex-wrap: wrap; gap: 4px; }
.trip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px; background: var(--indigo-bg); color: var(--indigo-fg); font: 600 12px var(--mono); white-space: nowrap; }
.trip small { font-family: var(--font); font-weight: 500; opacity: .8; }
.day-strip { display: grid; grid-template-columns: repeat(31, 7px); gap: 2px; }
.day-strip i { width: 7px; height: 16px; border-radius: 2px; background: var(--surface-3); }
.day-strip i.on { background: var(--indigo-solid); }
.day-strip i.future { background: transparent; border: 1px dashed var(--border-strong); }

/* ---------- documents ---------- */
.completion { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.completion .meter { width: 160px; }
.category-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.cat-chip { display: grid; gap: 2px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.cat-chip b { font-size: 18px; color: var(--text); }
.cat-chip b small { font-size: 12px; color: var(--muted); font-weight: 500; }
.table.matrix td { padding-top: 9px; padding-bottom: 9px; }
.doc-cell { width: 30px; height: 30px; border-radius: 10px; display: inline-grid; place-items: center; border: 0; }
.doc-cell .icon { width: 16px; height: 16px; }
.doc-cell.has { background: var(--ok-50); color: var(--ok); }
.doc-cell.has:hover { background: color-mix(in srgb, var(--ok) 28%, transparent); }
.doc-cell.missing { background: transparent; border: 1.5px dashed var(--border-strong); color: var(--muted); }
button.doc-cell.missing:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }

/* ---------- alerts / settings ---------- */
.alert-group { display: grid; gap: 8px; }
.alert-group h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.alert-group h3 .btn { margin-left: auto; }
.group-overdue h3 { color: var(--rose-fg); }
.group-history summary { list-style: none; cursor: pointer; }
.group-history summary::-webkit-details-marker { display: none; }
.group-history summary h3::before { content: '›'; display: inline-block; transition: transform .2s; }
.group-history[open] summary h3::before { transform: rotate(90deg); }
.group-history summary small { font-weight: 400; color: var(--text-3, var(--text-2)); }
.group-history .list { margin-top: 8px; opacity: .85; }
.alert-row .list-main b { font-weight: 500; }
.settings-body { display: grid; gap: 16px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.settings-grid .card p + * { margin-top: 12px; }
.role-help { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.role-help div { display: grid; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 12.5px; color: var(--muted); }
.role-help b { color: var(--text); font-size: 13px; }

/* ---------- command palette ---------- */
.palette { position: absolute; left: 50%; top: 12vh; transform: translateX(-50%); width: min(620px, calc(100vw - 24px)); border: 1px solid transparent; background: linear-gradient(var(--solid), var(--solid)) padding-box, var(--edge) border-box; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-radius: 24px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.palette-input .icon { color: var(--muted); }
.palette-input input { border: 0; height: 30px; padding: 0; font-size: 16px; box-shadow: none; background: none; }
.palette-input kbd { color: var(--muted); }
.palette-results { max-height: 56vh; overflow-y: auto; padding: 6px; }
.palette-hint { font-size: 12px; color: var(--muted); padding: 6px 10px; }
.palette-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 14px; text-align: left; }
.palette-item > div { flex: 1; min-width: 0; display: grid; }
.palette-item small { color: var(--muted); font-size: 12px; }
.palette-item.on, .palette-item:hover { background: var(--primary-50); }
.palette-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--gray-bg); color: var(--text-2); }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .category-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: auto; margin: 0; width: 280px; border-radius: 0 28px 28px 0; background: linear-gradient(var(--solid), var(--solid)) padding-box, var(--edge) border-box; transform: translateX(-104%); transition: transform .22s ease; box-shadow: var(--shadow-lg); padding-top: max(18px, env(safe-area-inset-top)); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(2, 4, 9, .62); z-index: 25; }
  .mobile-only, .icon-btn.mobile-only { display: inline-grid; }
  .topbar { padding: 12px 16px; gap: 8px; }
  .page-title h1 { font-size: 18px; }
  .page-title p { display: none; }
  .quick-add .btn span, .quick-add .btn .icon.sm { display: none; }
  .quick-line span { display: none; }
  .quick-line { width: 38px; padding: 0; }
  .wa-row { grid-template-columns: minmax(0, 1fr) auto; }
  .wa-row select { grid-column: 1; }
  .quick-add .btn { width: 38px; padding: 0; }
  .page-actions .btn span { display: none; }
  .page-actions .btn { width: 38px; padding: 0; }
  .view { padding: 6px 16px 40px; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 24px; }
  .auth-main { padding-top: 62px; } /* 给右上角的语言按钮让出位置，不然它压在登录卡片的角上 */
  .auth-copy h1 { font-size: 24px; }
  .auth-points { display: none; }
  .dash-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .stat-cards { grid-template-columns: 1fr; }
  .doc-grid { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .kpis, .kpis.compact { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 22px; }
  .kpi-icon { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .search-box { max-width: none; flex-basis: 100%; }
  .toolbar > select, .toolbar > input[type=month] { flex: 1 1 140px; }
  .toolbar-spacer { display: none; }
  .category-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv-grid { grid-template-columns: 1fr; }
  .kv-grid:not(.single) .kv:nth-child(odd) { border-right: 0; }
  .dossier-hero { flex-wrap: wrap; }
  .dossier-actions { width: 100%; justify-content: flex-start; }
  .role-help { grid-template-columns: 1fr; }
  .gantt-head, .gantt-row { grid-template-columns: 96px 1fr; }
  .gantt-name { padding: 8px; }
  .gantt-name .avatar { display: none; }
  .layer-panel.modal, .layer-panel.modal.lg, .layer-panel.modal.xl { left: 0; right: 0; top: auto; bottom: 0; width: 100%; transform: translateY(30px); border-radius: 26px 26px 0 0; max-height: 92vh; }
  .layer.open .layer-panel.modal { transform: none; }
  .layer-foot { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  /* tables collapse into cards */
  .table-wrap { max-height: none; overflow: visible; border: 0; background: none; box-shadow: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tbody tr { border: 1px solid transparent; background: linear-gradient(var(--glass), var(--glass)) padding-box, var(--edge) border-box; border-radius: 18px; padding: 10px 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
  /* overflow-wrap：卡片里断不开的长串（审计日志、访问日志的 IPv6 地址和网址）在任意位置断行，不然会伸出卡片，把整页撑得比屏幕宽 */
  .table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border: 0; text-align: right; overflow-wrap: anywhere; }
  .table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  .table td:first-child { border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 4px; }
  .table td:first-child::before { display: none; }
  /* a name followed by tags (计划签证): the tags wrap under the name */
  .table td:first-child { flex-wrap: wrap; justify-content: flex-start; gap: 6px 8px; text-align: left; }
  /* 用户填的字（名字、公司名、团队名、合同编号）在卡片里一律可以折行，徽标也一样：原来名字和徽标都不换行，
     一个 27 字的团队名或俄文公司全称就把卡片、整页撑得比屏幕宽，这一页的弹窗、底部菜单也跟着出屏（P38 审计三 中 1、中 2）。
     不要用给 #app / .main 加 overflow-x 的办法盖住：会把 2.5.8 修掉的吸顶抖动带回来。 */
  /* 只放开文字和徽标；按钮不能压窄，不然字会伸出按钮、两个按钮叠在一起（计划签证卡片底部那排） */
  .table td > :not(.btn, .icon-btn, button, input, select) { min-width: 0; max-width: 100%; }
  .table td:first-child > b { overflow-wrap: anywhere; }
  .badge, .status { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .badge { height: auto; min-height: 22px; padding-block: 3px; line-height: 1.3; }
  .table td:first-child > small.block { flex-basis: 100%; }
  .table td.actions { justify-content: flex-end; padding-top: 8px; }
  .table td.actions:empty { display: none; }
  .table .num, .table .center { text-align: right; }
  .cell-person { text-align: left; }
  .day-strip { grid-template-columns: repeat(31, 5px); gap: 1px; }
  .day-strip i { width: 5px; height: 14px; }
  .toast { bottom: calc(18px + env(safe-area-inset-bottom)); }
  /* 标题旁边带一句说明的卡片头（登录设备、证件模板、文书模板…）：一行放不下时说明另起一行，标题不再被挤成两行；
     「11 人」这种短的放得下，照旧在右边。不认 :has() 的旧浏览器保持原样。 */
  .card-head:has(> h3 + .muted) { flex-wrap: wrap; row-gap: 4px; }
  /* 设备审批（P35）：手机上每一行都上下排——设备名和说明在上，状态和「批准 / 停用」在下一行靠右，整张列表一个样子；按钮放大到手指好点。
     里面的行要写 list-row wrap。 */
  .list.phone-stack > .list-row > .list-main { flex-basis: 100%; }
  .list.phone-stack .list-side .btn.sm { height: 38px; padding: 0 16px; font-size: 13.5px; border-radius: 19px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print {
  .sidebar, .topbar .quick-add, .topbar .quick-line, .page-actions, .toolbar, .mobile-only { display: none !important; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .table-wrap { max-height: none; box-shadow: none; }
  body { background: #fff; color: #111; }
  body::before, .atlas, .intro { display: none !important; }
}

/* expired-visa banner + misfiled stay hint */
.alert-box.row { justify-content: space-between; margin-bottom: 12px; }
.alert-box.row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alert-box.row > div b { display: inline-flex; align-items: center; gap: 6px; }
.alert-box.row > div small { color: inherit; opacity: .85; }
.alert-box.row > .btn { flex: none; }
.warn-text { display: inline-flex; align-items: center; gap: 4px; color: var(--warn); }
.warn-text svg { width: 14px; height: 14px; }

/* ---------- 证件识别 ---------- */
.scan-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 16px; border: 1.5px dashed var(--border-strong); border-radius: 20px; background: var(--surface-2); text-align: center; transition: border-color .15s, background .15s; }
.scan-drop.over { border-color: var(--primary); background: var(--primary-50); }
.scan-drop.compact { padding: 14px 16px; }
.scan-drop .icon.xl { width: 30px; height: 30px; color: var(--primary); }
.scan-drop-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
.scan-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.scan-card { border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px; background: var(--surface); }
.scan-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.scan-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.scan-head .icon { width: 16px; height: 16px; color: var(--muted); flex: none; }
.scan-status { font-size: 12.5px; flex: none; }
.scan-body:not(:empty) { margin-top: 10px; }
.scan-kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 13px; }
.scan-kv dt { color: var(--muted); }
.scan-kv dd { margin: 0; font-weight: 600; word-break: break-all; }
.field-check input, .field-check select { border-color: var(--amber-solid, #d97706); background: var(--warn-50); }
.field-check-hint { font-style: normal; margin-left: 6px; font-size: 11px; color: var(--warn); }
.scan-reasons { list-style: none; margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--warn-50); color: var(--warn); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.scan-reasons li { display: flex; gap: 6px; align-items: flex-start; }
.scan-reasons .icon { width: 14px; height: 14px; flex: none; margin-top: 3px; }
.scan-form { display: flex; flex-direction: column; gap: 10px; }
.scan-conflicts { display: flex; flex-direction: column; gap: 6px; font-size: 13px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.scan-conflict { display: grid; grid-template-columns: 96px 1fr 1fr; gap: 8px; align-items: center; }
.scan-conflict > span { color: var(--muted); }
.scan-conflict label { display: flex; gap: 6px; align-items: center; cursor: pointer; min-width: 0; padding: 6px 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.scan-conflict label:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.scan-conflict input[type=radio] { width: 14px; height: 14px; min-height: 0; padding: 0; margin: 0; flex: none; accent-color: var(--primary); box-shadow: none; }
.scan-conflict label b { overflow-wrap: anywhere; }
.scan-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ok-text { color: var(--ok); display: inline-flex; align-items: center; gap: 6px; }
.ok-text .icon { width: 14px; height: 14px; }
@media (max-width: 720px) { .scan-conflict { grid-template-columns: 1fr; } }
.btn.danger-text { color: var(--danger); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--primary); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
/* 证件模板 */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.template-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.template-card > div:first-child { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.template-card .row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.template-editor { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.template-canvas-wrap { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; overflow: auto; max-height: 72vh; }
.template-canvas { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: none; }
.template-side { display: flex; flex-direction: column; gap: 10px; }
.template-fields { display: flex; flex-direction: column; gap: 6px; }
.template-field { display: flex; align-items: center; gap: 8px; text-align: left; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font: inherit; cursor: pointer; color: var(--text); }
.template-field.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-100); }
.template-field i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.template-field span { flex: 1; font-size: 13px; }
.template-field em { color: var(--danger); font-style: normal; margin-left: 2px; }
.link-btn.sm { font-size: 12px; font-weight: 500; flex: none; }
@media (max-width: 820px) { .template-editor { grid-template-columns: 1fr; } }
.template-field i.swatch-0 { background: #1d4ed8; }
.template-field i.swatch-1 { background: #be123c; }
.template-field i.swatch-2 { background: #0f766e; }
.template-field i.swatch-3 { background: #b45309; }
.template-field i.swatch-4 { background: #6d28d9; }
.template-field i.swatch-5 { background: #475569; }
.template-field i.swatch-6 { background: #0e7490; }
/* 调整成员 */
.members-dialog { display: flex; flex-direction: column; gap: 14px; }
.members-lists { display: flex; flex-direction: column; gap: 14px; max-height: 60vh; overflow: auto; padding-right: 18px; scrollbar-gutter: stable; }
.member-row .icon-btn { margin-right: 2px; }
.members-section header { display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.member-row:last-child { border-bottom: 0; }
.member-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.member-text small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row .icon-btn.add { color: var(--ok); border: 1px solid var(--border); }
.member-row .icon-btn.remove { color: var(--danger); border: 1px solid var(--border); }
.members-more summary { cursor: pointer; font-weight: 600; padding: 4px 2px; color: var(--text-2); }
.team-stats { flex-wrap: wrap; justify-content: flex-end; }
/* PDF first-page preview */
.doc-thumb { position: relative; }
.doc-thumb img[data-pdf-preview] { object-fit: cover; object-position: top; background: #fff; }
.doc-type-tag { position: absolute; top: 8px; right: 8px; padding: 2px 8px; border-radius: 9px; background: rgba(5, 8, 15, .78); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.doc-fallback { display: grid; place-items: center; gap: 4px; color: var(--primary); }
.doc-fallback[hidden] { display: none; }
/* Background auto-fill from uploaded documents */
.autofill-box { border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; display: grid; gap: 6px; }
.autofill-box ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.autofill-box li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* 计划签证 */
.plan-batch .card-head { flex-wrap: wrap; gap: 8px; }
.batch-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.plan-batch tbody tr { cursor: pointer; }
.muted.block { display: block; }
.plan-progress { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.plan-progress .bar { flex: 1; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.plan-progress .bar i { display: block; height: 100%; background: var(--primary); }
.plan-progress b { font-size: 12px; }
.plan-progress .w-0 { width: 0; } .plan-progress .w-10 { width: 10%; } .plan-progress .w-20 { width: 20%; } .plan-progress .w-30 { width: 30%; }
.plan-progress .w-40 { width: 40%; } .plan-progress .w-50 { width: 50%; } .plan-progress .w-60 { width: 60%; } .plan-progress .w-70 { width: 70%; }
.plan-progress .w-80 { width: 80%; } .plan-progress .w-90 { width: 90%; } .plan-progress .w-100 { width: 100%; background: var(--ok); }
.check-field { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check-field.inline { font-size: 13px; font-weight: 500; }
.check-field input { width: 18px; height: 18px; accent-color: var(--primary); }
.affix-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; background: var(--surface-2); }
.affix-body { display: grid; gap: 12px; }
.table td.plan-act, .table th.plan-act { width: 1%; white-space: nowrap; text-align: right; }
.plan-act .btn + .btn { margin-left: 6px; }
.shared-form { display: grid; gap: 14px; }
.shared-form .seg { display: flex; gap: 18px; padding: 6px 0; }
.shared-drop { max-width: 280px; }
.shared-form .row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.shared-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 6px 14px; }
.shared-person { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); gap: 10px; }
.shared-person span:first-of-type { flex: 1; min-width: 0; }
.shared-tag { font-size: 11px; margin-left: 4px; vertical-align: 1px; }
.plan-affix-btn .icon { margin-left: 2px; margin-right: -2px; }
.affix-body[hidden] { display: none; }
.doc-grid.single { grid-template-columns: minmax(0, 320px); }
.plan-hero { align-items: flex-start; }
.plain-list { margin: 8px 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.audit-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.audit-tools input[type=date] { height: 34px; }
.lang-toggle { flex: none; height: 28px; min-width: 40px; padding: 0 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,.18); background: transparent; color: var(--navy-300); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.lang-toggle:hover { color: #fff; border-color: rgba(255,255,255,.4); }

/* ================= Phone & foldable (iPhone, iPhone Duo folded ≈466pt / unfolded ≈626pt) ================= */
.tabbar { display: none; }
@media (max-width: 900px) {
  /* bottom tab bar, like an iPhone app */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 20;
    padding: 5px; border-radius: 30px; border: 1px solid transparent; background: linear-gradient(var(--solid), var(--solid)) padding-box, var(--edge) border-box;
    box-shadow: var(--shadow-lg); } /* 不加 backdrop-filter：见上面顶栏那条说明（第 37 条），手机上整页内容每一帧都从底栏下面滑过 */
  .tab-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 5px; border: 0; border-radius: 25px; background: none; color: var(--muted);
    font: inherit; font-size: 10.5px; font-weight: 600; text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .tab-item .icon { width: 22px; height: 22px; }
  .tab-item.active { color: var(--primary-600); background: var(--surface-3); }
  .tab-item .nav-badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; line-height: 16px; }
  .view { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
  .topbar { padding-top: max(12px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 15; }
  #nav-toggle { display: none; }
  /* Safari zooms into fields smaller than 16px */
  input, select, textarea { font-size: 16px !important; }
  /* touch targets */
  .btn { min-height: 40px; }
  .btn.sm { min-height: 36px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  /* one-row strips that scroll sideways instead of wrapping: tabs, filter chips, row buttons */
  .chips, .tabs, .row-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .chips::-webkit-scrollbar { display: none; }
  .chips > * { flex: none; }
  /* 放主要按钮的几排（签证工作台快捷操作、人员档案顶上的登记入境 / 出境、计划签证每月卡片头的生成文书 / 一键打包）
     改成折行：原来是隐藏滚动条的横滑条，后面的按钮在屏幕外，不滑根本不知道有（P38 审计三 低 1、低 2）。 */
  .quick-actions, .dossier-actions, .batch-meta { flex-wrap: wrap; }
  .chips { margin: 0 -16px; padding: 0 16px 2px; }
  /* compact numbers on 工作台 */
  .kpi { padding: 12px 14px; }
  .kpi small { font-size: 11.5px; }
  .kpis > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  /* sheets and drawers use the dynamic viewport so Safari's toolbars do not hide content */
  .layer-panel.modal { max-height: 92dvh; }
  .layer-panel.drawer { right: 0; top: 0; bottom: 0; border-radius: 0; border: 0; width: 100%; max-width: 100%; height: 100dvh; padding-bottom: env(safe-area-inset-bottom); }
  .dossier-hero .avatar.xl { width: 64px; height: 64px; font-size: 26px; }
  .dossier-names b { font-size: 20px; }
}
@media (max-width: 720px) {
  .table td.m-hide { display: none; }
  .toolbar { gap: 8px; }
  .toolbar > .btn { flex: 1 1 auto; }
  .stat-cards { gap: 8px; }
  .mini-card { padding: 12px 14px; }
}
/* Unfolded foldable / small tablet portrait: use the extra width */
@media (min-width: 560px) and (max-width: 900px) {
  /* 折叠屏展开后屏幕变宽：底部菜单不必拉满整屏，居中即可 */
  .tabbar { left: 50%; right: auto; width: min(520px, calc(100vw - 24px)); transform: translateX(-50%); }
  .stat-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .doc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis, .kpis.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis > :last-child:nth-child(odd) { grid-column: auto; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 560px) and (max-width: 720px) {
  .table tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .table tbody tr { margin-bottom: 0; }
  .layer-panel.modal, .layer-panel.modal.lg, .layer-panel.modal.xl { left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, 94vw); transform: translate(-50%, -48%); border-radius: 24px; max-height: 88dvh; }
  .layer.open .layer-panel.modal { transform: translate(-50%, -50%); }
  /* 这个宽度下弹窗是居中的圆角卡片，底栏要跟着圆回来（上面 720px 那条把它改成了贴底抽屉用的直角） */
  .layer-foot { border-radius: 0 0 23px 23px; padding-bottom: 14px; }
}
@media (max-width: 559px) {
  /* 手机上弹窗是贴底的整宽抽屉，宽度一律 100%。选择器故意比 .layer-panel.modal.sm 这类重：小确认框（.sm）和页面自己定宽度的弹窗
     原来还按电脑上的宽度算，贴在左边，右边空出一条。 */
  .layer.layer-modal > .layer-panel.modal { width: 100%; }
}
.date-selects { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
/* Every month card shares the same column widths, so the columns line up from month to month. */
@media (min-width: 1100px) {
  .plan-batch .table { table-layout: fixed; width: 100%; }
  .plan-batch .table th:nth-child(1) { width: 26%; }
  .plan-batch .table th:nth-child(2) { width: 10%; }
  .plan-batch .table th:nth-child(3), .plan-batch .table th:nth-child(4) { width: 15%; }
  .plan-batch .table th:nth-child(5) { width: 20%; }
  .plan-batch .table th:nth-child(6) { width: 14%; }
  .plan-batch .table td { overflow: hidden; text-overflow: ellipsis; }
  .plan-batch .table td:nth-child(3), .plan-batch .table td:nth-child(4) { white-space: nowrap; }
  /* 「进行中」每行右边有按钮（plans.js 给这种表格加 .has-act）。上面六列的百分比加起来正好 100%，第七列一点地方都分不到，
     按钮又被 overflow: hidden 整个裁掉（P37）。所以带按钮的表格另算：内容宽度固定的几列按内容给像素，按钮列给够，人员占剩下的；
     各月的表格一样宽，列照样对齐。按钮默认上下叠放（省 100 像素），屏幕够宽时并排（见下面 1360px 那段）。「已贴签」没有按钮列，还是上面的百分比。 */
  .plan-batch .table.has-act th { white-space: normal; }
  .plan-batch .table.has-act th:nth-child(1) { width: auto; }
  .plan-batch .table.has-act th:nth-child(2) { width: 78px; }
  .plan-batch .table.has-act th:nth-child(3), .plan-batch .table.has-act th:nth-child(4) { width: 106px; }
  .plan-batch .table.has-act th:nth-child(5) { width: 138px; }
  .plan-batch .table.has-act th:nth-child(6) { width: 144px; }
  .plan-batch .table.has-act th.plan-act { width: 156px; }
  .plan-batch .table.has-act td.plan-act { overflow: visible; white-space: normal; }
  .plan-batch .table.has-act .plan-act .btn { display: flex; width: 100%; }
  .plan-batch .table.has-act .plan-act .btn + .btn { margin: 6px 0 0; }
  /* 俄文的状态和按钮都长得多：窄的时候让它们在自己那一格里折成两行，不去挤人员那一列 */
  html[lang="ru"] .plan-batch .table.has-act th:nth-child(6) { width: 150px; }
  html[lang="ru"] .plan-batch .table.has-act th.plan-act { width: 164px; }
  html[lang="ru"] .plan-batch .table.has-act td:nth-child(6) .badge { white-space: normal; height: auto; min-height: 22px; padding: 2px 9px; line-height: 1.25; }
  html[lang="ru"] .plan-batch .table.has-act .plan-act .btn { white-space: normal; height: auto; min-height: 30px; padding: 5px 10px; line-height: 1.25; }
}
/* 窗口不够宽时先收起「开始准备」（手机上本来也不显示这一列），材料的进度条缩短，给人员留地方 */
@media (min-width: 1100px) and (max-width: 1239px) {
  .plan-batch .table.has-act th:nth-child(4), .plan-batch .table.has-act td:nth-child(4) { display: none; }
  .plan-batch .table.has-act th:nth-child(5) { width: 108px; }
  .plan-batch .table.has-act .plan-progress { min-width: 80px; }
}
@media (min-width: 1400px) {
  html[lang="ru"] .plan-batch .table.has-act th:nth-child(6) { width: 178px; }
  html[lang="ru"] .plan-batch .table.has-act th.plan-act { width: 220px; }
}
/* 够宽：两个按钮并排，一行不用撑高。俄文按钮太长，一直叠放 */
@media (min-width: 1360px) {
  html:not([lang="ru"]) .plan-batch .table.has-act th.plan-act { width: 260px; }
  html:not([lang="ru"]) .plan-batch .table.has-act .plan-act .btn { display: inline-flex; width: auto; }
  html:not([lang="ru"]) .plan-batch .table.has-act .plan-act .btn + .btn { margin: 0 0 0 6px; }
}

/* Person search above the person list in the visa plan dialog. */
.field .search-box { max-width: none; flex: none; }
.field .search-box + select { margin-top: 8px; }
.field input[readonly] { background: var(--surface-2); color: var(--text-2); }
.plan-team { margin-left: 6px; font-weight: 500; vertical-align: 1px; }
/* Possible duplicate person: shown while a new person or new-person plan is typed in. */
.dup-box { display: grid; gap: 8px; margin: 4px 0 8px; }
.dup-box.wide { grid-column: 1 / -1; }
.dup-box .alert-box { align-items: flex-start; }
.dup-box .link-like { margin-right: 6px; }
.choice-list { display: grid; gap: 10px; }
/* Team overview: the board jumped to from the chart flashes briefly. */
@keyframes team-flash { 0%, 60% { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); } 100% { border-color: transparent; box-shadow: var(--shadow-sm); } }
.team-board.flash { animation: team-flash 1.6s ease-out; }
.org-branch { cursor: pointer; }
.plan-only { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 20px 0; font-size: 13px; }
.link-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ---------- 签证缴费 ---------- */
.fee-table .fee-pick { width: 34px; }
.fee-table td { white-space: nowrap; }
/* 人员、备注两格可以折行（P38 审计三 中 8）：原来整表不换行，一个长团队名就让人员这一列 440px，1280 宽要横滚半张表。
   日期、状态保持一行：日期会从连字符处断开（2026-↵12-05），试过，难看。
   金额格（¥3,000 未缴）也可以折行：放不下时「未缴」「团队已缴」落到金额下面，金额本身中间没有断点。
   表格格子上的 min-width 浏览器不认，人员这一格的宽度由里面的 .cell-person（最窄 150px）撑着。 */
.fee-table td[data-label="人员"], .fee-table td.num { white-space: normal; }
.fee-table td[data-label="人员"] .cell-person { min-width: 200px; }
.fee-table td[data-label="人员"] .cell-person > div { min-width: 0; overflow-wrap: anywhere; }
/* 备注只显示一行，太长的截断（鼠标停上去看全文）：折行的话一条长备注能把这一行拉得几倍高 */
.fee-table td[data-label="备注"] small { display: block; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fee-table td[data-label="备注"] { white-space: normal; min-width: 80px; }
/* 手机上表格变成卡片，不用再保持一行：不折行的话，长的团队名会伸出卡片，把整页撑得比屏幕宽（弹窗跟着偏到左边） */
@media (max-width: 720px) { .fee-table td { white-space: normal; } .fee-table td[data-label="备注"] small { max-width: none; white-space: normal; overflow-wrap: anywhere; } }
.fee-table tr.row-danger td { background: var(--danger-50); }
.text-danger { color: var(--danger); font-weight: 600; }
.text-warn { color: var(--warn); font-weight: 600; }
.fee-pick-list { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; padding: 8px; border: 1px solid var(--border); border-radius: 10px; }
.fee-pick-list .check-field { flex-wrap: wrap; }
.fee-pick-list small { flex-basis: 100%; margin-left: 24px; }
.fee-summary { display: grid; gap: 6px; margin: 0; }
.fee-summary > div { display: flex; gap: 10px; align-items: baseline; }
.fee-summary dt { width: 56px; flex: none; color: var(--muted); font-size: 13px; }
.fee-summary dd { margin: 0; }
.fee-batch .card-head { flex-wrap: wrap; gap: 8px; }
.fee-batch tbody tr { cursor: pointer; }
.quota-strip { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.quota-chip { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 14px; background: var(--teal-bg); color: var(--teal-fg); font-size: 13px; }
.quota-chip .icon-btn { width: 26px; height: 26px; }
.fee-table tr.slot-row td { background: var(--surface-2); }
.badge.quota-flag { margin-left: 6px; background: var(--amber-bg); color: var(--amber-fg); }
.badge.mark-grey { margin-left: 6px; background: rgba(255, 255, 255, .2); color: #e6ebf3; }
.badge.mark-black { margin-left: 6px; background: #000; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45); }
.quota-chip .quota-unpaid { color: var(--amber-fg); background: var(--amber-bg); padding: 1px 8px; border-radius: 999px; }
/* A page bar that stays under the sticky top bar while the list scrolls (签证缴费). */
.toolbar.sticky-bar { position: sticky; top: var(--topbar-h, 72px); z-index: 14; margin: -8px -28px 0; padding: 8px 28px 10px; background: var(--bg); }
@media (max-width: 900px) {
  .toolbar.sticky-bar { margin: -6px -16px 0; padding: 8px 16px 10px; }
}

/* 设置 → 规则与税率 */
.rule-group { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
.rule-group legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 10px; }
.rule-default { display: flex; gap: 6px; align-items: center; }
.rule-changed { color: var(--amber-fg); background: var(--amber-bg); border-radius: 4px; padding: 0 5px; font-size: 11px; }
.rule-changed[hidden] { display: none; }

/* ================= 寰宇：地图底板与开场 ================= */
/* 地图平时很淡地铺在所有页面后面；打开系统时亮着停一两秒（body.intro），登录页半亮（body.atlas-mid）。 */
.atlas { position: fixed; inset: 0; z-index: 0; pointer-events: none; display: grid; place-items: center; overflow: hidden; opacity: .3; transition: opacity .9s ease; }
.atlas-stage { position: relative; width: min(96vw, 165vh); transform: scale(1.06); transition: transform 1.2s cubic-bezier(.2, .7, .2, 1); }
.atlas svg { display: block; width: 100%; height: auto; overflow: visible; }
body.atlas-mid .atlas { opacity: .55; }
body.atlas-bright .atlas { opacity: 1; transition-duration: .5s; } /* 亮起来快一点，暗下去还是 .9s */
body.atlas-bright .atlas-stage { transform: none; }
body.intro #app { opacity: 0; pointer-events: none; }
/* 页面刚到、脚本还没接手时（body.booting，写在 index.html 里）：底图已经亮着，等脚本来了接着放开场或退成背景。 */
body.booting .atlas { opacity: 1; transition: none; }
body.booting .atlas-stage { transform: none; transition: none; }
body.booting .atlas-label { opacity: 1; transition: none; }
.atlas-grat { fill: none; stroke: var(--atlas-grat); }
.atlas-out { fill: rgba(85, 173, 255, .05); stroke: var(--atlas-line); stroke-linejoin: round; }
.atlas-d1, .atlas-d2, .atlas-d3 { fill: none; stroke-linecap: round; stroke-width: 2.7; }
.atlas-d1 { stroke: var(--atlas-dot); } .atlas-d2 { stroke: var(--atlas-dot2); } .atlas-d3 { stroke: var(--atlas-dot3); }
.atlas-halo { fill: var(--primary); opacity: .18; }
.atlas-node { fill: var(--atlas-dot3); }
.atlas-label { opacity: 0; transition: opacity .6s ease; }
body.atlas-bright .atlas-label { opacity: 1; }
.atlas-arc { fill: none; stroke: var(--primary-600); stroke-width: 1.2; opacity: .3; }
.atlas-dash { fill: none; stroke: var(--atlas-dot3); stroke-width: 1.3; stroke-linecap: round; stroke-dasharray: 3 6; }
.atlas-ring { fill: none; stroke: var(--atlas-dot3); stroke-width: 1.8; }
.atlas-ping { fill: none; stroke: var(--atlas-dot3); stroke-width: 1.2; transform-box: fill-box; transform-origin: center; }
.atlas text { font: 10px var(--mono); fill: var(--muted); }
.atlas text.city { font: 600 13px var(--font); fill: var(--text); }
.atlas text.land { font: 11px var(--font); letter-spacing: .22em; opacity: .6; }
.atlas text.land.home { font-size: 13px; letter-spacing: .75em; opacity: .4; }
@keyframes atlas-dash { to { stroke-dashoffset: -18; } }
@keyframes atlas-ping { from { transform: scale(.4); opacity: .9; } to { transform: scale(2.4); opacity: 0; } }
@keyframes atlas-load { to { transform: none; } }
body.atlas-bright .atlas-dash { animation: atlas-dash 1.6s linear infinite; }
body.atlas-bright .atlas-ping { animation: atlas-ping 2.6s ease-out infinite; }
/* 开场时的人数、品牌和提示 */
.atlas-hero, .atlas-brand, .atlas-hint { opacity: 0; transition: opacity .5s ease; }
body.intro .atlas-hero, body.intro .atlas-brand, body.intro .atlas-hint { opacity: 1; }
.atlas-hero { position: absolute; left: 3%; top: 1%; color: var(--text); }
.atlas.nostats .atlas-hero { display: none; }
.atlas-hero p { display: flex; align-items: center; gap: 10px; font-size: clamp(13px, 1.1vw, 16px); color: var(--text-2); }
.atlas-live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-50); }
.atlas-count { display: flex; align-items: flex-end; gap: 10px; margin-top: 4px; }
.atlas-count, .atlas-hero small { opacity: 0; transition: opacity .45s ease; }
.atlas.counted .atlas-count, .atlas.counted .atlas-hero small { opacity: 1; }
.atlas-count b { font-size: clamp(64px, 8.4vw, 124px); line-height: .92; font-weight: 700; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.atlas-count span { font-size: clamp(16px, 1.5vw, 22px); font-weight: 600; color: var(--text-2); padding-bottom: .5em; }
.atlas-hero small { display: block; margin-top: 10px; min-height: 1.5em; font-size: clamp(12.5px, 1vw, 14.5px); color: var(--muted); }
.atlas-brand { position: absolute; left: max(26px, env(safe-area-inset-left)); bottom: max(24px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; color: var(--text-2); }
.atlas-hint { position: absolute; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; justify-items: center; gap: 10px; font-size: 12.5px; letter-spacing: .1em; color: var(--muted); white-space: nowrap; }
.atlas-hint i { position: relative; width: 132px; height: 2px; border-radius: 1px; background: var(--surface-3); overflow: hidden; }
.atlas-hint i::after { content: ""; position: absolute; inset: 0; background: var(--primary); transform: translateX(-100%); }
/* 进度线从「图和数字都齐了」那一刻开始走，走完就进系统；时长和 atlas.js 的 HOLD 一致 */
.atlas.holding .atlas-hint i::after { animation: atlas-load 2.5s linear forwards; }
@media (max-aspect-ratio: 1/1) {
  .atlas-stage { transform: scale(1.75); }
  body.atlas-bright .atlas-stage, body.atlas-mid .atlas-stage { transform: none; }
  .atlas-hero { left: 2%; top: auto; bottom: calc(100% + 28px); }
  .atlas-brand { left: 50%; bottom: auto; top: max(22px, env(safe-area-inset-top)); transform: translateX(-50%); }
  /* 竖屏时整张图只有屏幕那么宽，地名按图的比例会缩得看不清，这里放大 */
  .atlas text.city { font-size: 25px; }
  .atlas text.land { font-size: 15px; }
  .atlas text.land.home { font-size: 17px; }
  .atlas-label text:not(.city):not(.land) { font-size: 13px; }
}

/* ============================================================
   触屏和折叠屏的两处兜底（2026-11-16，iPhone Duo 上「页面比屏幕略大」）
   ============================================================ */
/* Safari 会在点进小于 16px 的输入框时自动放大页面，登录完也不缩回去。上面只在 900px 以内
   处理了；折叠屏横过来、iPad 比 900 宽，所以只要是触屏就一律 16px。 */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }
}
/* 100vh 在手机浏览器里比看得见的区域高（地址栏那一截），页面会多出一点可以上下滑。
   认 dvh 的浏览器改用「看得见的高度」。 */
@supports (min-height: 100dvh) {
  /* 只用在登录页和启动画面。主界面（body、.shell）不要用：手机上一滑动地址栏就伸缩，dvh 跟着一直变，
     整页要反复重新排版（第 37 条：手机上滑动时整页抖动的嫌疑之一，2.5.7 撤回）。 */
  .boot-splash, .auth { min-height: 100dvh; }
}
/* 电脑布局（含 iPhone Duo 展开、iPad）的侧栏吸在左边，高度原来是 100vh − 28px。iOS Safari 的 100vh 按工具栏收起时算，
   工具栏露出时侧栏下半截（「退出登录」、语言按钮）被挡在工具栏后面，侧栏又不跟页面滚，就再也看不到（P48）。
   改用 100svh（工具栏露出时看得见的高度）：任何时候整条侧栏都在屏幕里；工具栏收起时底下空出一截，不要紧。
   不用 100dvh：dvh 随工具栏伸缩一直变，侧栏在滑动中反复改高度、重新排版，就是上面说的抖动（2.5.7 撤回过）。 */
@supports (height: 100svh) {
  @media (min-width: 901px) {
    .sidebar { height: calc(100svh - 28px); }
  }
}
/* 屏幕很矮时（横着拿的 iPad、Duo 展开后工具栏和键盘都露出来）菜单区原来被压到只剩几像素，点不到（P48）：
   菜单区最少留 9rem；整条侧栏放不下时侧栏自己上下滚（滚到底就是「退出登录」），不带着页面一起滚。
   overflow 加在侧栏自己身上不影响它吸顶；不要加在它的祖先（#app、.shell、.main）上，见上面。 */
.sidebar { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
.sidebar .nav { min-height: 9rem; }
/* 这里原来有一条 `#app { overflow-x: clip; }` 当保险（2.5.1 加的），2.5.8 撤掉了，不要再加回来：
   吸顶的侧边栏和顶栏在它里面，iPhone / iPad 的 Safari 遇到祖先带 overflow: clip 时，吸顶位置改在主线程上算，
   整页滚动时侧边栏、顶栏跟不上，看着一直在抖（第 37 条）。页面不变宽靠的是上面 .view / .shell 的 minmax(0, 1fr)，不靠裁剪。
   同理，#app、.shell、.main 这几层都不要加 overflow（hidden / clip / auto 都不行）。 */

/* ============================================================
   动效
   只动位移、缩放、透明度，不动模糊和阴影；时长 0.15～0.45 秒；长列表不逐行动。
   系统开了「减弱动态效果」时，前面那条 prefers-reduced-motion 规则会把这里全部关掉，
   所以进场一律用 @keyframes 的 from（不在平时的样式里写 opacity: 0）。
   进场只在换页面时播一次：app.js 换页后调 motion.js 的 enterView()，给 .view 和
   .page-title 加 .enter，约一秒后拿掉——同一页里筛选、保存后重画不会重播。
   ============================================================ */
:root { --ease-out: cubic-bezier(.2, .7, .2, 1); --ease-spring: cubic-bezier(.3, 1.35, .5, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
@keyframes palette-in { from { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(.98); } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes ping { 0% { transform: scale(1); opacity: .7; } 70%, 100% { transform: scale(1.9); opacity: 0; } }
@keyframes sheen { to { transform: translateX(270%) skewX(-18deg); } }

/* 换页面：标题和内容依次浮上来 */
.page-title.enter > * { animation: rise .32s var(--ease-out) backwards; }
.view.enter > * { animation: rise .4s var(--ease-out) backwards; }
.view.enter > :nth-child(2) { animation-delay: .05s; }
.view.enter > :nth-child(3) { animation-delay: .1s; }
.view.enter > :nth-child(n+4) { animation-delay: .15s; }
/* 数字卡片、工作台的几块、人员卡片：前 12 个再错开一点，后面的跟着整块一起出来 */
.view.enter :is(.kpis, .dash-grid, .person-cards) > :nth-child(-n+12) { animation: rise .44s var(--ease-out) backwards; animation-delay: .3s; }
.view.enter :is(.kpis, .dash-grid, .person-cards) > :nth-child(1) { animation-delay: .06s; }
.view.enter :is(.kpis, .dash-grid, .person-cards) > :nth-child(2) { animation-delay: .1s; }
.view.enter :is(.kpis, .dash-grid, .person-cards) > :nth-child(3) { animation-delay: .14s; }
.view.enter :is(.kpis, .dash-grid, .person-cards) > :nth-child(4) { animation-delay: .18s; }
.view.enter :is(.kpis, .dash-grid, .person-cards) > :nth-child(5) { animation-delay: .22s; }
.view.enter :is(.kpis, .dash-grid, .person-cards) > :nth-child(6) { animation-delay: .26s; }
/* 工作台「在境构成」的色条从左边长出来 */
.view.enter .stack-bar { transform-origin: left center; animation: grow-x .7s .3s var(--ease-out) backwards; }
/* 加载占位晚 0.12 秒才出现：页面来得快就根本看不到它，少闪一下 */
.skeleton { animation: fade .25s .12s backwards; }
/* 登录页 */
.auth-hero > *, .auth-main > :not(.auth-lang) { animation: rise .6s var(--ease-out) backwards; }
.auth-hero > :nth-child(2), .auth-main > :not(.auth-lang) { animation-delay: .08s; }
.auth-hero > :nth-child(3) { animation-delay: .16s; }

/* 按下回弹 */
.btn { transition: background .15s, border-color .15s, box-shadow .15s, filter .15s, transform .16s var(--ease-out); }
.btn:active:not(:disabled) { transform: scale(.96); }
.nav-item, .chip, .todo-row, .person-row { transition: background .16s, color .16s, transform .16s var(--ease-out); }
.tab-item { transition: background .2s, color .2s, transform .16s var(--ease-out); }
:is(.nav-item, .tab-item, .chip, .todo-row, .person-row):active { transform: scale(.97); }
.kpi, .person-card { transition: border-color .2s, transform .22s var(--ease-out); }
button.kpi:active, .person-card:active { transform: scale(.985); }
/* 悬停略抬起，数字卡片上扫过一道很淡的光（只在有鼠标的设备上，触屏不会卡在悬停状态） */
@media (hover: hover) {
  button.kpi:hover, .person-card:hover { transform: translateY(-2px); }
  button.kpi:active, .person-card:active { transform: scale(.985); }
  button.kpi { overflow: hidden; }
  button.kpi::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 38%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .075), transparent); transform: translateX(-130%) skewX(-18deg); pointer-events: none; }
  button.kpi:hover::after { animation: sheen .75s var(--ease-out); }
}

/* 弹窗、抽屉：打开慢一点、有落定感；关闭要快（ui.js 在 180ms 后就把节点拿掉） */
.layer-panel { transition: transform .17s ease-in, opacity .15s ease-in; }
.layer.open .layer-panel { transition: transform .36s var(--ease-out), opacity .22s ease-out; }
.layer-scrim { transition: opacity .16s; }
.layer.open .layer-scrim { transition: opacity .28s; }
.layer-panel.drawer { transform: translateX(44px); }
.palette-layer .layer-scrim { animation: fade .2s backwards; }
.palette { animation: palette-in .24s var(--ease-out) backwards; }
.menu { transform-origin: top right; animation: pop .18s var(--ease-out) backwards; }
.toast { transition: opacity .2s, transform .38s var(--ease-spring); }

/* 有待处理的提醒时，红色数字外面一圈慢慢散开（全页最多两三个，很省） */
.nav-item .nav-badge { position: relative; }
.nav-badge::after, .kpi-danger .kpi-icon::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1.5px solid var(--rose-solid); opacity: 0; pointer-events: none; animation: ping 2.8s var(--ease-out) infinite; }
/* 生成文书 (P23) */
.docs-form .grid-2 { align-items: start; }
.docs-person { align-items: center; }
.docs-person select { width: auto; min-width: 72px; }
.tpl-tags { margin-top: 14px; }
.tpl-tags summary { cursor: pointer; color: var(--muted, inherit); }

/* ---------- 农场财务 (pages/finance.js): only layout; colours come from the theme variables ---------- */
/* One column that may shrink: without minmax(0, …) a wide table makes the whole page scroll sideways (P42).
   P38 审计三 中 3: a grid item's automatic minimum is its widest content, so children may shrink too; the table scrolls inside its card. */
.fin-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 16px; min-width: 0; }
.fin-body > * { min-width: 0; }
.fin-body > .section-head { margin-top: 4px; }
.fin-body .card > p { margin-bottom: 12px; }
.fin-sub { font-size: 14px; margin: 18px 0 8px; }
.toolbar .fin-sub { margin: 0; }
.fin-cards { align-items: start; }
.fin-range { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.fin-range input { width: auto; }
.toolbar > input[type=search] { width: 180px; }
.fin-clip { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.fin-drop { display: grid; gap: 6px; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.fin-drop.big { justify-items: center; gap: 10px; padding: 28px 16px; margin: 12px 0; color: var(--muted); }
.fin-drop.drop-over { border-color: var(--primary); background: var(--primary-50); }
.chip a { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.chip .icon-btn { width: 20px; height: 20px; margin-right: -6px; }
.kpi-value.text-danger { color: var(--danger); }
.table tr.row-danger td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.layer-body .kpis.compact { margin-bottom: 14px; }
.layer-body .toolbar { margin: 14px 0 8px; }
/* 仓库流水 (P42): the row's 收款 button must stay on screen at every width, so nothing in a row is
   kept on one line except the date and the amounts; long names and notes wrap and are cut at two lines.
   Between the phone cards and a wide screen the 类型 and 客户 columns fold into the first two cells. */
.fin-flow td { vertical-align: top; }
.fin-flow .flow-date, .fin-flow td.num { white-space: nowrap; }
.fin-flow .flow-item { min-width: 0; }
.fin-flow .flow-item > b { display: block; overflow-wrap: anywhere; }
.fin-flow .flow-note { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.fin-flow .flow-note > span + span::before { content: ' · '; }
.fin-flow .flow-narrow { display: none; }
.fin-flow td.num small { white-space: nowrap; }
.fin-preview { max-height: 46vh; margin: 12px 0; }
.fin-preview .fin-revive { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; font-size: 12.5px; color: var(--muted); white-space: normal; cursor: pointer; }
.fin-preview .fin-revive input { width: auto; margin-top: 2px; flex: none; }
.fin-preview select.fin-kind { width: auto; min-width: 0; padding: 4px 28px 4px 8px; font-size: 13px; margin-bottom: 4px; }
/* The import preview on tablets (721–1279) fits the dialog without sideways scrolling, like the tables of the
   tabs (P17): headers and the row's 序号 wrap, cells a little tighter. */
@media (min-width: 721px) and (max-width: 1279px) {
  .fin-preview .table th { white-space: normal; padding: 8px 6px; line-height: 1.3; vertical-align: bottom; }
  .fin-preview .table td { padding: 8px 6px; font-size: 13px; }
  .fin-preview .table td small { display: block; }
  .fin-preview .fin-clip { max-width: 140px; }
}
@media (max-width: 1280px) {
  .fin-flow .flow-wide { display: none; }
  .fin-flow .flow-narrow { display: inline; }
  .fin-flow td > .flow-narrow { display: block; margin-top: 4px; }
}
@media (min-width: 721px) and (max-width: 1020px) {
  .fin-flow th, .fin-flow td { padding-left: 8px; padding-right: 8px; }
  .fin-flow .actions .btn svg { display: none; }
}
@media (max-width: 720px) {
  .fin-flow td > .flow-narrow { display: inline; margin: 0 0 0 8px; }
  .fin-flow .flow-item { text-align: right; }
  .fin-flow td.num:empty { display: none; }
  /* Five rows of filters and buttons on a phone: pinned, they would cover half the screen. */
  .toolbar.sticky-bar.fin-flow-bar { position: static; }
  .fin-preview { max-height: none; }
}
@media (max-width: 900px) {
  .fin-clip { max-width: 60vw; }
  .toolbar > input[type=search] { flex: 1 1 140px; width: auto; }
}

/* ---------- merged from claude/jovial-wu-f024f0 ---------- */

/* 贸易与合同（原棉花贸易，P8） — plain first version until the P1 redesign */
.grid-4 { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
@media (max-width: 640px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; }
tr.clickable { cursor: pointer; }
.table.nowrap th, .table.nowrap td { white-space: nowrap; }
/* 棉花合同表（全站只有它用 .nowrap）：合同编号、对方公司、交货地可以折行，其余（类型、日期、吨数、金额、状态、按钮）仍然一行。
   原来整表不换行，编号或公司名一长 1920 宽也要横滚（P38 审计三 中 8）。按列号写的，改这张表的列顺序时要一起改
   （P51 改版后汇款不再占列，交货地仍在第 8 列；每笔合同下面的补充协议和汇款时间轴在单独一行的面板里，见 .deal-panel）。 */
.table.nowrap td:nth-child(1), .table.nowrap td:nth-child(3), .table.nowrap td:nth-child(8) { white-space: normal; overflow-wrap: anywhere; min-width: 6em; }
/* 手机上表格是一张张卡片，每格一行，不必再不换行：棉花合同编号一长就伸出卡片，把整页撑宽（P38 审计三 中 1） */
@media (max-width: 720px) { .table.nowrap td { white-space: normal; } }
.choice-list { display: grid; gap: 10px; }
.choice { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.choice:hover { border-color: var(--primary); background: var(--surface-2); }
.choice b { font-size: 16px; }
.choice small { color: var(--text-2); }

/* ---------- merged from claude/inspiring-borg-2a0541 ---------- */

/* 文件库 (P9) */
.lib-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 14px 0 10px; font-size: 13.5px; color: var(--text-2); }
.lib-crumbs .link-like { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); cursor: pointer; }
.lib-crumbs .icon { width: 15px; height: 15px; }
.lib-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.lib-folder { display: flex; align-items: center; gap: 10px; padding: 12px 14px; text-align: left; cursor: pointer; }
.lib-folder:hover { border-color: var(--primary); }
.lib-folder .icon { width: 22px; height: 22px; color: var(--primary); flex: none; }
.lib-folder span, .lib-main { display: grid; gap: 3px; min-width: 0; }
.lib-folder small, .lib-main small, .lib-meta small { color: var(--muted); font-size: 12px; }
.lib-list { padding: 4px 0; }
.lib-file { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; cursor: pointer; }
.lib-file:last-child { border-bottom: 0; }
.lib-file:hover { background: var(--surface-2); }
.lib-icon .icon { width: 20px; height: 20px; color: var(--text-2); margin-top: 2px; }
.lib-main { flex: 1; }
.lib-main b { overflow-wrap: anywhere; }
.lib-snippet { color: var(--text-2) !important; overflow-wrap: anywhere; }
.lib-main mark, .lib-text mark { background: #fde68a; color: inherit; border-radius: 2px; }
.lib-links { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.lib-meta { display: grid; justify-items: end; gap: 2px; white-space: nowrap; }
.lib-preview { display: block; width: 100%; max-height: 60vh; object-fit: contain; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--border); }
.lib-preview.pdf { height: 60vh; }
.lib-preview.none { display: grid; justify-items: center; gap: 8px; padding: 40px 16px; color: var(--muted); }
.lib-actions { display: flex; gap: 8px; margin: 10px 0 4px; }
.lib-section { margin-top: 18px; display: grid; gap: 8px; justify-items: start; }
.lib-section h3 { font-size: 14px; margin: 0; }
.lib-link-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.lib-link-row .link-like { color: var(--primary); cursor: pointer; font-size: 12.5px; }
.lib-link-row .link-like.danger { color: var(--danger); }
.lib-text { width: 100%; max-height: 260px; overflow: auto; white-space: pre-wrap; font-size: 12.5px; background: var(--surface-2); border-radius: 8px; padding: 10px; margin: 0; }
.lib-pick { display: grid; gap: 4px; margin-top: 8px; }
.lib-pick-row { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); text-align: left; cursor: pointer; }
.lib-pick-row:hover { border-color: var(--primary); }
.lib-pick-row small { color: var(--muted); }
#link-other { display: grid; gap: 10px; margin-top: 10px; }
#link-other[hidden] { display: none; }
@media (max-width: 640px) {
  .lib-file { padding: 10px 12px; }
  .lib-meta { display: none; }
}

/* ============================================================
   WinWin 工作台（P4，2.6.0）
   主页：没有侧栏，日期 → 搜索框 → 模块图标 → 一条系统状态。
   模块里：侧栏顶上一个「返回主页」，菜单只有本模块的页面。
   只补排版，颜色全部用上面的变量。
   ============================================================ */
.shell.wb-portal { grid-template-columns: 1fr; }
.wb-portal .topbar, .wb-portal .view { width: 100%; max-width: 1120px; margin-inline: auto; }
.wb-portal .topbar .brand { cursor: pointer; }
.wb-portal .topbar .user-chip, .wb-portal .topbar .user-chip div { flex: none; }
.wb-hello { padding: 10px 2px 4px; }
.wb-hello.center { text-align: center; padding-top: 22px; }
.wb-hello h1 { font-size: 28px; letter-spacing: -.01em; }
.wb-hello p { color: var(--muted); margin-top: 4px; }
.wb-ask-wrap { display: grid; gap: 14px; width: 100%; max-width: 760px; margin: 8px auto 0; }
.wb-ask { display: flex; align-items: center; gap: 12px; width: 100%; height: 68px; padding: 0 24px; border-radius: 34px; border: 1px solid transparent; background: linear-gradient(var(--glass), var(--glass)) padding-box, var(--edge) border-box; box-shadow: var(--shadow); color: var(--muted); font-size: 16px; text-align: left; cursor: pointer; }
.wb-ask > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-grid.wb-ico-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 30px 12px; width: 100%; max-width: 760px; margin: 26px auto 18px; }
.wb-ico { display: grid; justify-items: center; align-content: start; gap: 4px; padding: 4px; border: 0; background: none; color: var(--text); text-align: center; min-width: 0; text-decoration: none; }
.wb-ico-box { position: relative; width: 88px; height: 88px; margin-bottom: 8px; border-radius: 28px; display: grid; place-items: center; border: 1px solid transparent; background: linear-gradient(var(--glass), var(--glass)) padding-box, var(--edge) border-box; box-shadow: var(--shadow-sm); color: var(--primary); transition: transform .18s; }
.wb-ico-box .icon { width: 36px; height: 36px; stroke-width: 1.5; }
.wb-ico-box .nav-badge { position: absolute; top: -7px; right: -7px; margin: 0; min-width: 26px; height: 26px; border-radius: 13px; line-height: 26px; font-size: 13px; font-style: normal; }
.wb-ico b { font-size: 15px; }
.wb-ico small { color: var(--muted); font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wb-ico:active .wb-ico-box { transform: scale(.94); }
@media (hover: hover) { .wb-ico:hover .wb-ico-box { transform: translateY(-3px); } }
/* Title in its own column on the left, the items in two equal columns beside it; on narrow cards the title takes its own row and the items one column. */
.wb-status { container-type: inline-size; padding: 14px 18px; max-width: 760px; margin-inline: auto; }
.wb-status-in { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: start; gap: 10px 28px; }
.wb-status b { display: flex; align-items: center; gap: 8px; min-height: 22px; white-space: nowrap; }
.wb-status-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 8px 24px; }
/* The dot sits centred on the first line; a long error wraps under its own text, not under the dot. */
.wb-status-list .status { white-space: normal; align-items: flex-start; min-width: 0; line-height: 22px; }
.wb-status-list .status i { flex: none; margin-top: 7px; }
.wb-status-text { min-width: 0; overflow-wrap: anywhere; }
.wb-status-text > span:first-child, .wb-nw { white-space: nowrap; }
@container (max-width: 520px) {
  .wb-status-in,
  .wb-status-list { grid-template-columns: minmax(0, 1fr); }
}
.wb-status b .icon { color: var(--muted); }
.status.wb-warn { color: var(--warn); font-weight: 600; }
.status.wb-warn i { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-50); }
.nav-group { display: grid; gap: 2px; }
.nav-item.wb-back { color: var(--primary-600); font-weight: 600; margin: -4px 0; }
.nav-item.wb-back .icon { color: var(--primary); }
.sidebar .brand .todo-icon { width: 40px; height: 40px; border-radius: 13px; }
.wb-stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.wb-link-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.wb-link-card > div { flex: 1 1 260px; min-width: 0; }
.wb-link-card h3 { font-size: 15px; }
.wb-link-card p { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.wb-note { color: var(--muted); font-size: 13px; margin-top: 12px; }
.wb-policy { display: grid; gap: 8px; }
.wb-policy p { color: var(--text-2); font-size: 13.5px; }
.wb-policy footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.wb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
/* P43 押金：侧栏里可以展开的一栏（电话卡、对讲机、发电机、电动车） */
.nav-fold { display: grid; gap: 2px; }
.nav-fold-head { width: 100%; border: 0; background: transparent; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.nav-fold-head > span { flex: 1; }
.nav-fold-head > .icon.sm { transition: transform .16s var(--ease-out); }
.nav-fold.open > .nav-fold-head > .icon.sm { transform: rotate(180deg); }
.nav-fold.has-active > .nav-fold-head { color: #fff; font-weight: 600; }
.nav-fold.has-active > .nav-fold-head > .icon:first-child { color: var(--primary); }
.nav-fold-body { display: grid; gap: 2px; }
.nav-fold-body[hidden] { display: none; }
.nav-item.sub { padding-left: 40px; font-size: 13.5px; }
/* 押金页：四个 KPI；工具栏里的筛选和按钮放不下就换行，不往屏幕外挤；历任领用一行一任，按钮在右，窄了掉到下面 */
.kpis.dep-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dep-toolbar > select { flex: 0 1 150px; min-width: 0; }
.dep-toolbar > input[type=search] { flex: 1 1 180px; min-width: 0; max-width: 260px; }
.dep-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-left: auto; min-width: 0; }
.dep-btns > .btn { flex: none; }
.dep-new { display: contents; }
.dep-new[hidden] { display: none; }
.dep-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dep-history { display: grid; gap: 8px; }
.dep-hold { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; }
.dep-hold-main { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.dep-hold-main > .badge { margin-left: 8px; }
.dep-hold-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.fin-subtabs { justify-self: start; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.fin-subtabs button { flex: none; white-space: nowrap; }
@media (min-width: 901px) { .fin-subtabs { display: none; } }
@media (max-width: 1100px) { .kpis.dep-kpis { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) {
  .dep-toolbar > select { flex: 1 1 130px; }
  .dep-toolbar > input[type=search] { flex: 1 1 100%; max-width: none; }
  .dep-btns { flex: 1 1 100%; margin-left: 0; }
  .dep-btns > .btn { flex: 1 1 auto; justify-content: center; }
}
/* 电脑上侧栏已经列出了农场财务、贸易与合同的各个标签页，页面里那一排就不重复了；手机上保留。 */
@media (min-width: 901px) {
  .view[data-path="/finance"] > .tabs.big:first-child, .view[data-path="/team"] > .tabs.big:first-child, .view[data-path="/cotton"] > .toolbar > .segmented[role="tablist"] { display: none; }
}
@media (max-width: 900px) {
  .wb-portal .topbar .user-chip .lang-toggle, .wb-portal .topbar .btn span { display: none; }
  .wb-portal .topbar .btn { width: 38px; padding: 0; }
  .wb-portal .view { padding-bottom: 40px; }
  .wb-hello h1 { font-size: 22px; }
  .wb-ask { height: 60px; font-size: 15px; padding-left: 18px; }
  .wb-ask kbd { display: none; }
}
@media (max-width: 559px) {
  .wb-portal .topbar .user-chip div { display: none; }
  .dash-grid.wb-ico-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 6px; }
  .wb-ico-box { width: 72px; height: 72px; border-radius: 23px; }
  .wb-ico-box .icon { width: 30px; height: 30px; }
  .wb-ico b { font-size: 13.5px; }
}

/* B 签（P16）：人名、日期、进度不折行，「停留」那一列放说明文字可以折。 */
.b-table td, .b-table th { white-space: nowrap; }
.b-table td[data-label="停留"], .b-table td[data-label="提醒"] { white-space: normal; min-width: 150px; }
@media (max-width: 900px) { .b-table td { white-space: normal; } }

/* 发现新版本时的提示条（P31）：顶部居中的一条，不挡底部导航；点了整页重新加载。 */
.update-bar { position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 450; display: flex; align-items: center; gap: 2px; max-width: calc(100vw - 24px); padding: 4px 6px 4px 4px; border-radius: 22px; border: 1px solid color-mix(in srgb, var(--primary) 55%, transparent); background: var(--solid); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow-lg); animation: fade .3s ease backwards; }
.update-bar[hidden] { display: none; }
.update-go { display: flex; align-items: center; gap: 8px; min-width: 0; height: 36px; padding: 0 12px; border: 0; border-radius: 18px; background: none; color: var(--primary-600); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.update-go span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.update-go .icon { flex: none; width: 18px; height: 18px; color: var(--primary); }
.update-close { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 16px; background: none; color: var(--muted); cursor: pointer; }
@media (hover: hover) { .update-go:hover { background: var(--surface-2); } .update-close:hover { background: var(--surface-2); color: var(--text); } }
/* 断网时看的是存下的数据（P14，offline.js）：顶部一条小提示，有网的回答一到就收起。比「系统已更新」那条低一层。 */
.offline-bar { position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 440; display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 24px); padding: 8px 14px; border-radius: 20px; border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent); background: var(--solid); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow-lg); color: var(--text); font-size: 13px; font-weight: 600; pointer-events: none; animation: fade .3s ease backwards; }
.offline-bar[hidden] { display: none; }
.offline-bar .icon { flex: none; color: var(--warn); }
.offline-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 材料大图（P24）：图片尽量大，按钮在下面一直看得见。 */
.photo-view { display: grid; gap: 10px; }
.photo-stage { display: grid; place-items: center; min-height: 200px; border-radius: 14px; background: var(--surface-2); overflow: hidden; }
.photo-stage img { display: block; max-width: 100%; max-height: min(68vh, 900px); object-fit: contain; }
/* 放大证件大图 (photo-zoom.js): the picture moves inside the stage, the buttons under it stay where they are. */
.photo-stage.zoomable { position: relative; min-height: min(52vh, 480px); touch-action: none; cursor: zoom-in; user-select: none; -webkit-user-select: none; }
.photo-stage.zoomed { cursor: grab; }
.photo-stage.zoomed:active { cursor: grabbing; }
.photo-stage.zoomable img { transform-origin: center; will-change: transform; -webkit-user-drag: none; }
.photo-zoom-bar { position: absolute; right: 8px; top: 8px; display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 14px; background: color-mix(in srgb, var(--solid) 82%, transparent); box-shadow: var(--shadow-lg); cursor: default; }
.photo-zoom-bar .icon-btn { width: 34px; height: 34px; font-size: 20px; line-height: 1; }
.photo-zoom-tip { margin: 0; font-size: 12.5px; }
/* 手机上材料卡片的按钮各占一行（查看 / 保存到相册 / 替换 / 删除），主色的那个最显眼。 */
.doc-actions .btn.primary { flex: 1 1 auto; }

/* 资料库表格里的「对勾 + 保存」两个小方块并排（P24）：不撑高行；手机上大一点好点。 */
.doc-pair { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.doc-cell.save { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); cursor: pointer; }
.doc-cell.save:hover { background: color-mix(in srgb, var(--primary) 30%, transparent); }
.doc-cell.save.busy { opacity: .5; }
button.doc-cell.has { cursor: pointer; }
@media (max-width: 900px) { .doc-pair { gap: 8px; } .doc-pair .doc-cell { width: 36px; height: 36px; } }
/* ---------- 页面权限 (P29 / P30): grouped ticks, one role or one account at a time ---------- */
.perm-page { display: grid; gap: 14px; }
.perm-switch { justify-self: start; }
.perm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.perm-title { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.perm-title h3 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.perm-title p { margin: 4px 0 0; font-size: 13px; }
.perm-actions { display: flex; gap: 6px; }
.perm-groups { display: grid; gap: 10px; margin-top: 10px; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); overflow: hidden; }
.perm-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; min-height: 46px; }
.perm-head b { flex: 1; font-size: 15px; }
.perm-head input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); }
.perm-chev .icon { transition: transform .15s; }
.perm-chev.closed .icon { transform: rotate(-90deg); }
.perm-count { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.perm-count.on { color: var(--primary-600); font-weight: 600; }
.perm-group-set { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px 54px; }
.perm-body { border-top: 1px solid var(--border); padding: 2px 12px 2px 54px; }
.perm-group.closed .perm-body, .perm-group.closed .perm-group-set { display: none; }
.perm-row { display: flex; align-items: center; gap: 10px; min-height: 44px; border-bottom: 1px solid var(--border); font-size: 14px; cursor: pointer; }
.perm-row:last-child { border-bottom: 0; }
.perm-row > span:first-of-type { flex: 1; display: grid; gap: 2px; }
.perm-row .badge { min-width: 56px; justify-content: center; }
.perm-row small { font-size: 12px; }
.perm-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); }
.perm-who { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.segmented.sm button { height: 28px; padding: 0 11px; font-size: 12.5px; }
.perm-fixed { margin-top: 14px; font-size: 13px; color: var(--text-2); }
.perm-fixed summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.perm-fixed p { margin: 8px 0 0; }
@media (max-width: 640px) {
  .perm-body { padding-left: 12px; }
  .perm-group-set { padding-left: 12px; }
  .perm-row.acct { flex-wrap: wrap; padding: 6px 0; }
  .perm-row.acct > span:first-of-type { flex-basis: 100%; }
}

/* ---------- 操作手册 (SOP) ---------- */
.sop { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 14px; align-items: start; }
.sop-toc { display: grid; gap: 10px; position: sticky; top: 12px; }
.sop-search input { width: 100%; }
.sop-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sop-toc li { display: flex; align-items: center; gap: 4px; border-radius: 10px; }
.sop-toc li.on { background: color-mix(in srgb, var(--primary) 16%, transparent); }
.sop-item { flex: 1; text-align: left; border: 0; background: transparent; color: var(--text); padding: 9px 10px; font-size: 14px; border-radius: 10px; display: grid; gap: 2px; }
.sop-toc li.on .sop-item { color: var(--primary-600); font-weight: 600; }
.sop-move { display: inline-flex; }
.sop-move .icon-btn:first-child .icon { transform: rotate(-90deg); }
.sop-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sop-head h3 { font-size: 18px; }
.sop-body { font-size: 15px; line-height: 1.75; color: var(--text); }
.sop-body h4 { font-size: 15.5px; margin: 16px 0 6px; }
.sop-body p { margin: 0 0 8px; white-space: pre-wrap; }
.sop-body ul { margin: 0 0 10px; padding-left: 22px; }
.sop-edit textarea { width: 100%; min-height: 320px; font-family: var(--font); line-height: 1.6; }
@media (max-width: 760px) {
  .sop { grid-template-columns: 1fr; }
  .sop-toc { position: static; }
}
/* 一键办理签证 (P26)：给移民局的资料弹窗。 */
.fee-table .fee-act { width: 1%; text-align: right; }
.vr-list { display: grid; gap: 14px; }
.vr-note { margin: 0; font-size: 13px; }
.vr-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; background: var(--surface); }
.vr-card.lacking { border-color: var(--danger); }
.vr-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.vr-head input { width: 18px; height: 18px; accent-color: var(--primary); }
.vr-sheet { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; line-height: 1.5; user-select: text; overflow-wrap: anywhere; }
.vr-heading { margin: 0 0 8px; font-weight: 600; }
.vr-sheet dl { margin: 0; display: grid; gap: 4px; }
.vr-sheet dl > div { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 2px 12px; }
.vr-sheet dt { color: var(--muted); }
.vr-sheet dd { margin: 0; }
.vr-fix > summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--primary-600); padding: 2px 0; }
.vr-card.lacking .vr-fix > summary { color: var(--danger); }
.vr-fix[open] > summary { margin-bottom: 10px; }
.vr-fix textarea { width: 100%; resize: vertical; }
.vr-read { justify-self: start; margin-top: 6px; }
.vr-fix-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
/* 一键办理签证 beside 人员档案: on a wide screen the two boxes stand side by side and both stay usable.
   The dossier is the ordinary drawer (pages/person.js); only its wrapper gets .vr-beside here. */
.layer-panel.modal.vr-panel { width: min(820px, calc(100vw - 32px)); }
.vr-card.current { box-shadow: 0 0 0 2px var(--primary); }
.vr-head .vr-see { margin-left: auto; }
.vr-recognize { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.vr-recognize .vr-id-hint { flex-basis: 100%; }
.vr-tag { display: inline-block; padding: 0 6px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 18px; }
.vr-tag.sure { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary-600); }
.vr-tag.unsure { background: color-mix(in srgb, #f5b301 26%, transparent); color: #9a6b00; }
.vr-fix .vr-unsure { border-color: #f5b301; box-shadow: 0 0 0 2px color-mix(in srgb, #f5b301 30%, transparent); }
@media (min-width: 901px) {
  .layer.open .layer-panel.modal.vr-paired, .layer-panel.modal.vr-paired { left: 12px; top: 12px; bottom: 12px; transform: none; max-height: none; width: calc(100vw - 36px - min(760px, 50vw - 18px)); }
  .layer.vr-beside { pointer-events: none; }
  .layer.vr-beside > .layer-scrim { display: none; }
  .layer.vr-beside > .layer-panel { pointer-events: auto; width: min(760px, calc(50vw - 18px)); }
}
@media (max-width: 640px) {
  .vr-sheet dl > div { grid-template-columns: 1fr; }
  .vr-sheet dl > div + div { margin-top: 4px; }
  .vr-card { padding: 12px; }
}

/* P36 签证缴费: tenge receipts inside the row dialog (layout only) */
.fee-kzt-list { display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; }
.fee-kzt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; overflow-wrap: anywhere; }

/* P40 签证缴费 filter bar: search box first, the four buttons stay together and wrap as one group */
.fee-toolbar .search-box { flex: 1 1 160px; min-width: 160px; }
.fee-toolbar .fee-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-left: auto; }
@media (max-width: 900px) {
  .fee-toolbar .search-box { flex-basis: 100%; max-width: none; }
}
@media (max-width: 720px) {
  .fee-toolbar .fee-actions { flex: 1 1 100%; margin-left: 0; gap: 8px; }
  .fee-toolbar .fee-actions > .btn { flex: 1 1 auto; }
}
/* 签证缴费: the table is wider than the card on most screens and scrolls sideways; the button column stays
   pinned to the right edge so 一键办理签证 / 添加人员 is always in reach (P40).
   这一列的格子要盖住从底下滑过去的内容，所以得有不透明的底，而且要和所在的行一个颜色，不然就是一条补丁（P41）。
   行的颜色是几层半透明叠出来的：页面底色 → 卡片的玻璃 → 表格框 → 悬停 → 这一行格子自己的底色（逾期、待录入）。
   这里照同样的顺序再叠一遍，全用变量，不写死色值（原来写死的 #0f1727 比行深了十几级，悬停也不跟）。
   这几层放在格子的 ::before 上，再用遮罩让它整块从左边缘淡入（--pin-fade 这么宽，正好是格子的左内边距）：滑过去的内容是淡出去的，
   没有一条硬边。不要改成每一层各自渐变：半透明的几层分别淡入，中间会比两头都暗，左边缘多出一条两像素的暗线（量过）。
   卡片背后那张固定的地图会透上来一点，行在地图上方时比这里叠出来的颜色亮几级，哪种实色都对不齐，有了这段淡入就看不出接缝；
   所以也不要改回一刀切的实色加阴影。
   底下没有东西被盖住时（表格放得下，或已经滚到最右），ui.js 的 watchPinned 给表格框加 .pinned-clear：这时不垫底，格子和普通的一列完全一样。
   垫底时格子自己的底色要去掉（已经叠在 ::before 里了，留着会在淡入那一段叠两遍）；选择器写得长，是为了压过上面
   tr.row-danger td / tr.slot-row td 那两条。 */
/* 签证管理的 B / B1、C 类表（.pin-act，按钮在最后一格 td.actions）用同一套：1024 宽时这两张表比卡片宽 80–200px，
   「编辑」原来在屏幕外（P38 审计三 中 8）。.pinned-clear 由 ui.js watchPinned 加。 */
@media (min-width: 721px) {
  :is(.fee-table th.fee-act, .fee-table td.fee-act, .pin-act:has(td.actions) thead th:last-child, .pin-act td.actions) { position: sticky; right: 0; z-index: 1; }
  :is(.fee-table thead th.fee-act, .pin-act:has(td.actions) thead th:last-child) { z-index: 2; }
  .table-wrap:not(.pinned-clear) :is(.fee-table tbody tr td.fee-act, .pin-act tbody tr td.actions) { --pin-own: transparent; --pin-hover: transparent; --pin-fade: 14px; background: none; }
  .table-wrap:not(.pinned-clear) :is(.fee-table tbody tr td.fee-act, .pin-act tbody tr td.actions)::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: linear-gradient(var(--pin-own), var(--pin-own)), linear-gradient(var(--pin-hover), var(--pin-hover)),
      linear-gradient(var(--surface), var(--surface)), linear-gradient(var(--glass), var(--glass)), var(--bg);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--pin-fade)); mask-image: linear-gradient(90deg, transparent, #000 var(--pin-fade)); }
  .table-wrap:not(.pinned-clear) :is(.fee-table, .pin-act) tbody tr.row-danger :is(td.fee-act, td.actions) { --pin-own: var(--danger-50); }
  .table-wrap:not(.pinned-clear) .fee-table tbody tr.slot-row td.fee-act { --pin-own: var(--surface-2); }
  .table-wrap:not(.pinned-clear) :is(.fee-table, .pin-act).hover tbody tr:hover :is(td.fee-act, td.actions) { --pin-hover: var(--surface-2); }
}

/* 签证缴费 待核对 (P38): one line per person with its confirm button */
.fee-checks { align-items: flex-start; margin-bottom: 12px; }
.fee-checks > div { flex: 1; min-width: 0; display: grid; gap: 8px; }
.fee-check-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; color: var(--text); }

/* 农场财务 (P38 审计三 中 3): when a table is wider than its card (iPad, unfolded Duo, a narrow window) it scrolls sideways
   inside the card, and the row buttons (收款 …) stay pinned to the right edge so they are always in reach.
   Solid backgrounds, or the scrolled cells show through. */
@media (min-width: 721px) {
  .fin-body .table td.actions, .fin-body .table:has(td.actions) thead th:last-child { position: sticky; right: 0; z-index: 1; background: #0f1727; box-shadow: -10px 0 12px -10px rgba(0, 0, 0, .6); }
  .fin-body .table:has(td.actions) thead th:last-child { background: rgb(18, 27, 45); }
  .fin-body .table tr.row-danger td.actions { background: linear-gradient(var(--danger-50), var(--danger-50)), #0f1727; }
}
/* 农场财务 on tablets (768–1279: iPad, unfolded Duo, a narrow window): every column fits on one screen instead of scrolling
   sideways (the user:「直接全屏显示所有内容 调整比例」). Headers and long names wrap, cells are a little tighter and smaller. */
@media (min-width: 721px) and (max-width: 1279px) {
  .fin-body .table th { white-space: normal; padding: 8px 7px; line-height: 1.3; vertical-align: bottom; }
  .fin-body .table td { padding: 9px 7px; font-size: 13px; }
  .fin-body .table td:first-child { overflow-wrap: anywhere; }
  .fin-body .table td.actions .btn { padding-inline: 8px; }
}
/* 手机上传资料先选：拍照，还是选手机里已有的照片 / PDF（P14，forms.js pickAndUpload）。 */
.pick-source { display: grid; gap: 10px; padding-bottom: 4px; }

/* 土地文件 (P50) */
.land-alert { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius); background: var(--warn-50); color: var(--warn); font-size: 13px; font-weight: 600; }
.land-file-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.land-file-actions .field-hint { margin: 0; }

/* 贸易与合同 · 合同列表（P51 汇款时间轴、P54 补充协议；版面 P55）
   一笔合同是一个 <tbody class="deal-group">：上面合同那一行，下面一块面板（.deal-panel），面板里先是补充协议、再是汇款时间轴。
   三层读起来是一张卡片：组内不画分隔线，组和组之间一条；悬停时整组一起亮；面板缩进到和单元格对齐。只用主题变量。 */
.deal-table tbody.deal-group > tr > td { border-bottom: 0; }
.deal-table tbody.deal-group:not(:last-child) > tr:last-child > td { border-bottom: 1px solid var(--border); }
.deal-table.hover tbody tr:hover { background: none; }
.deal-table.hover tbody.deal-group:hover > tr { background: var(--surface); }
.deal-table tr.deal-sub { cursor: default; }
.deal-table tr.deal-sub > td { padding: 0 14px 16px; white-space: normal; }
.deal-panel { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; }
.deal-panel > * + * { border-top: 1px solid var(--border); }
/* 表格比卡片宽、要横滚时（1024、平板），面板不跟着表格一起滚走：钉在表格框的可见宽度里，右边的已汇和「记一笔」始终看得见。
   宽度用表格框的容器宽度（cqw）算。 */
@media (min-width: 721px) {
  .table-wrap:has(> .deal-table) { container-type: inline-size; }
  .deal-panel { position: sticky; left: 14px; width: calc(100cqw - 30px); }
}

/* 补充协议：每份一行——编号、日期，改了什么（原值划掉、小箭头、新值加粗，每项一个小胶囊），右边是文件 */
.amend-block { display: grid; box-shadow: inset 3px 0 0 var(--amber-solid); }
.amend-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 16px 10px 19px; font-size: 13px; }
.amend-item + .amend-item { border-top: 1px dashed var(--border); }
.amend-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600; background: var(--amber-bg); color: var(--amber-fg); white-space: nowrap; }
.amend-date { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.amend-changes { display: flex; flex-wrap: wrap; gap: 6px; }
.amend-change { display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.amend-change small { color: var(--muted); font-size: 11.5px; }
.amend-change s { color: var(--muted); font-size: 12px; text-decoration-thickness: 1px; }
.amend-change i { font-style: normal; font-size: 12px; color: var(--amber-fg); }
.amend-change b { font-weight: 600; color: var(--text); }
.amend-file { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--primary); }
.amend-file .icon { width: 14px; height: 14px; }
.amend-item > .amend-file { margin-left: auto; }
.amend-mark { display: block; color: var(--amber-fg); font-size: 11px; }

/* 汇款时间轴：签订 —— 轴 —— 交货，已经过去的一段亮一点；每笔汇款一个点（上面金额、下面日期），今天一道短竖线；
   右边是已汇 / 合同金额、进度条、还差（或多汇、已付清），最右「记一笔」。汇款单拖到这一块上时整块变成放置提示。 */
.pay-line { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 248px auto; gap: 24px; align-items: center; padding: 12px 16px; }
.pay-track { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pay-end { flex: none; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.pay-end b { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.pay-axis { position: relative; flex: 1; min-width: 0; height: 74px; }
.pay-axis::before { content: ''; position: absolute; left: 0; right: 0; top: 44px; height: 2px; border-radius: 1px; background: var(--border); }
.pay-elapsed { position: absolute; left: 0; top: 44px; height: 2px; border-radius: 1px; background: var(--border-strong); }
.pay-now { position: absolute; top: 37px; width: 2px; height: 16px; margin-left: -1px; border-radius: 1px; background: var(--amber-solid); }
.pay-dot { position: absolute; top: 39px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--teal-solid); box-shadow: 0 0 0 3px var(--bg); }
.pay-dot em { position: absolute; bottom: 17px; left: 50%; transform: translateX(-50%); padding: 1px 7px; border-radius: 7px; background: var(--surface-2); font-style: normal; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pay-dot small { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pay-dot:hover em { background: var(--surface-3); }
.pay-empty { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); font-size: 12px; color: var(--muted); white-space: nowrap; }
.pay-sum { display: grid; gap: 6px; min-width: 0; }
.pay-figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; font-variant-numeric: tabular-nums; }
.pay-figure span { color: var(--muted); font-size: 12px; }
.pay-figure b { font-size: 15px; font-weight: 700; }
.pay-figure small { color: var(--muted); font-size: 12px; }
/* 金额不在数字中间断开：手机卡片里格子是 overflow-wrap: anywhere，这一块放不下时整个金额换到下一行 */
.pay-figure b, .pay-figure small, .pay-left b { white-space: nowrap; overflow-wrap: normal; }
.pay-sum .meter { height: 6px; border-radius: 3px; }
.pay-sum .meter i { border-radius: 3px; }
.pay-left { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pay-pct { color: var(--muted); }
.pay-over { color: var(--amber-fg); }
.pay-done { color: var(--ok); }
.pay-act { justify-self: end; }
.pay-drop-hint { position: absolute; inset: 6px; display: none; align-items: center; justify-content: center; gap: 8px; border: 1.5px dashed var(--primary); border-radius: 12px; background: var(--primary-50); color: var(--primary); font-size: 13px; font-weight: 600; pointer-events: none; }
.pay-line.dragging .pay-drop-hint { display: flex; }
.pay-line.dragging > :not(.pay-drop-hint) { opacity: .2; }
/* 表格框不够宽时（1024 带侧栏、平板）轴放一整行，已汇和「记一笔」放在下面一行，轴上的金额才不会挤在一起 */
@container (max-width: 860px) {
  .pay-line { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 20px; }
  .pay-track { grid-column: 1 / -1; }
}

/* 合同详情：已签合同、补充协议、附件、汇款记录同一种小节——标题和按钮一行，内容在下面，都是同样的浅底圆角块 */
.deal-sec { display: grid; gap: 10px; margin-top: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.deal-sec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.deal-sec-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.deal-sec-head h3 small { font-weight: 400; font-size: 12px; }
.deal-sec-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.deal-sec-empty { margin: 0; font-size: 12.5px; color: var(--muted); }
.deal-sec > .foot-note, .deal-sec .foot-note { margin: 0; }
.deal-sec .amend-block { margin: 0 -16px; box-shadow: inset 3px 0 0 var(--amber-solid); border-block: 1px solid var(--border); }
.deal-sec .amend-item .row-actions { margin-left: auto; }
.amend-files { display: flex; flex-basis: 100%; flex-wrap: wrap; gap: 4px 14px; }
.amend-note { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.deal-files { display: grid; gap: 6px; }
.deal-file { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13px; }
.deal-file > .icon { flex: none; width: 16px; height: 16px; color: var(--muted); }
.deal-file > span, .deal-file > a { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.deal-file small { flex: none; color: var(--muted); font-size: 12px; }
.deal-sec .pay-sum-wide { padding: 2px 0; }
.deal-sec .table-wrap { margin: 2px 0 0; }

@media (max-width: 720px) {
  /* 手机：一笔合同（字段、补充协议、时间轴）整个是一张卡片 */
  .deal-table tbody.deal-group { display: block; margin-bottom: 10px; padding: 10px 14px 12px; border: 1px solid transparent; border-radius: 18px; background: linear-gradient(var(--glass), var(--glass)) padding-box, var(--edge) border-box; box-shadow: var(--shadow-sm); }
  .deal-table tbody.deal-group > tr { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
  .deal-table.hover tbody.deal-group:hover > tr { background: none; }
  .deal-table tbody.deal-group > tr > td { border-bottom: 0; }
  .deal-table tbody.deal-group > tr:first-child > td:first-child { border-bottom: 1px solid var(--border); }
  .deal-table tr.deal-sub > td, .deal-table tr.deal-sub > td:first-child { display: block; margin: 6px 0 0; padding: 0; border: 0; }
  /* 手机：轴一行，已汇 / 进度一行（整行宽，大金额不被挤成一个字一行），「记一笔」靠右再一行 */
  .pay-line { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px; }
  .pay-act { justify-self: end; }
  .pay-track { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
  .pay-track .pay-axis { grid-column: 1 / -1; order: -1; margin: 0 4px; }
  .pay-track .pay-end { margin-top: 4px; }
  .pay-track .pay-end:last-child { text-align: right; }
  .amend-item { padding: 10px 12px 10px 15px; }
  .amend-item > .amend-file { margin-left: 0; }
  .deal-sec { padding: 12px; }
  .deal-sec .amend-block { margin: 0 -12px; }
}
@media (min-width: 560px) and (max-width: 720px) {
  /* 两张卡片一排：卡片是整组，组里的行不再分成两列 */
  .deal-table { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
  .deal-table tbody.deal-group { margin-bottom: 0; }
}

/* 签证管理：注销签证挪到「在境状态」格里，叠在在境状态下面（P46 后续）。格子只多一行、不多一列；
   「将于 … 注销并登记出境」在格里折成两行，免得把这一列撑宽。 */
.presence-cell { display: grid; justify-items: start; gap: 6px; }
.cancel-stack { display: grid; justify-items: start; gap: 4px; }
.cancel-stack .badge { display: inline-block; height: auto; min-height: 22px; padding: 3px 9px; white-space: normal; line-height: 1.35; border-radius: 9px; }
.cancel-stack .badge .nowrap { white-space: nowrap; }
@media (min-width: 721px) and (max-width: 1280px) { .cancel-stack .badge { max-width: 9.5em; } }
@media (max-width: 720px) {
  .presence-cell, .cancel-stack { justify-items: end; }
  .cancel-stack .badge { max-width: none; text-align: right; }
}
/* 剩余天数在截止日期下面一行；C 类三项材料并成一格（P46 后续：表格在 1024 宽放得下）。 */
.cell-sub { margin-top: 4px; }
.tick-row { display: flex; gap: 10px; }
.tick-row > span { display: grid; justify-items: center; gap: 2px; }
.tick-row small { font-size: 11px; color: var(--muted); }
.cancel-stack .btn.sm { padding: 0 10px; }
/* 签证管理四张表的格子左右留白收窄一点（14 → 10px），1024 和 768 宽时整张表放得下，「注销签证」「编辑」都在屏内。 */
@media (min-width: 721px) {
  .table.visa-table th, .table.visa-table td { padding-left: 10px; padding-right: 10px; }
}
/* Duo 展开、平板横放（901–1100 宽）：有侧栏，内容只剩 580–780px。签证管理的表格再收一点，整张放得下：
   头像先不显示（名字还在），格子留白 8px，C 类两个操作按钮上下叠。 */
@media (min-width: 721px) and (max-width: 1100px) {
  .table.visa-table th, .table.visa-table td { padding-left: 8px; padding-right: 8px; }
  .table.visa-table .cell-person { min-width: 0; gap: 0; }
  .table.visa-table .cell-person > .avatar { display: none; }
  .table.visa-table .inline-select { min-width: 96px; }
  .table.visa-table td.actions { white-space: normal; }
  .table.visa-table td.actions .icon-btn { display: grid; }
}
.visa-table .nowrap { white-space: nowrap; }
@media (max-width: 720px) {
  .visa-table .date-stack { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 8px; }
  .visa-table .date-stack .cell-sub { margin-top: 0; }
}
/* 贸易与合同 › 出口（P53）：合同卡片上四类文件各几份、缺的标黄；文件拖到某一类的框里就传到那一类。 */
.trade-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.deal-sec[data-drop] { transition: border-color .15s, background .15s; }
.deal-sec[data-drop].dragging { border-style: dashed; border-color: var(--primary); }
/* 时间轴上的金额写全，下面一行是中文读法（四十万），手机上也不截断。 */
.pay-dot em .pay-zh { display: block; font-size: 11px; font-weight: 500; color: var(--muted); text-align: center; }
.pay-dot.at-start em, .pay-dot.at-start small { left: -6px; transform: none; }
.pay-dot.at-start em .pay-zh { text-align: left; }
.pay-dot.at-end em, .pay-dot.at-end small { left: auto; right: -6px; transform: none; }
.pay-dot.at-end em .pay-zh { text-align: right; }
/* 时间轴上的点可以点开（修改、删除、挂汇款单）；框架合同的预付款用琥珀色；还没挂汇款单的点是空心的。 */
button.pay-dot { padding: 0; border: 0; font: inherit; color: inherit; cursor: pointer; }
button.pay-dot:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.pay-dot.prepay { background: var(--amber-solid); }
.pay-dot.no-slip { box-shadow: inset 0 0 0 2px var(--teal-solid); background: var(--surface); }
.pay-dot.prepay.no-slip { box-shadow: inset 0 0 0 2px var(--amber-solid); }
.pay-pool { display: block; margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.pay-pick { display: grid; gap: 8px; }
.pay-pick-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.pay-pick-item input[type=radio] { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.pay-pick-item span { flex: 1; text-align: left; }
.pay-pick-item:has(input:checked) { border-color: var(--primary); }
.pay-one + .pay-one { margin-top: 10px; }
