/* ============================================================
   企业服务平台 · 统一样式（唯一一份）

   这个文件是「源码」，不要直接改 web/assets/ui.css 或
   web-portal/assets/ui.css —— 那两份是 build-shared.js 复制出来的副本，
   下次构建会被覆盖。改这里，然后跑 `node build-shared.js`。

   约束：
     1. 不引外部字体 / CDN，内网断网也要能渲染
     2. 正文 14px，手机上不小于 13px（一半人在手机上看）
     3. 颜色一律走 CSS 变量，改主题只改 :root
     4. 不写死色值 —— 上一版 app.css 里有 55 处硬编码，
        底色从冷灰换暖米之后它们还是发青的，比不换更难看
   ============================================================ */

:root {
    /* 表面与底 */
    --bg: #F1EFE8;
    --bg-subtle: #FAF9F6;
    --surface: #FFFFFF;

    /* 文字：五级灰阶 */
    --ink: #2C2C2A;
    --ink-2: #444441;
    --ink-3: #5F5E5A;
    --ink-4: #888780;
    --ink-5: #B4B2A9;

    /* 线与边 */
    --line: #E3E0D8;
    --line-2: #D3D1C7;

    /* 主色与语义色 */
    --brand: #185FA5;
    --brand-mid: #2E76B8;
    --brand-dark: #134B84;
    --brand-weak: #E6F1FB;
    --danger: #A32D2D;
    --danger-weak: #FCEBEB;
    --ok: #3B6D11;
    --ok-weak: #EAF3DE;
    --warn: #854F0B;
    --warn-weak: #FAEEDA;

    /* 形状 */
    --radius: 10px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(44, 44, 42, .04), 0 4px 16px rgba(44, 44, 42, .04);

    /* 外壳尺寸：改侧栏宽度只改这一处 */
    --sidebar-w: 240px;
    --topbar-h: 60px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
                 "Noto Sans CJK SC", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 浏览器默认的 [hidden] 只有 display:none，元素自己一带 display:flex/grid 就被盖掉，
   于是「隐藏」的元素照样显示。这个坑踩过两次（.field、.modal-mask），
   所以在这里一次按住 —— 用 ui.css 的页面不必各自再补一遍。 */
[hidden] { display: none !important; }

/* ============================================================
   外壳：侧栏 + 顶栏 + 内容
   由 shell.js 注入，页面只写 <body data-layout="app" data-nav="list">
   ============================================================ */

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ---------- 侧栏 ---------- */

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 16px 10px 12px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 30;
}

.sidebar .brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 14px;
    /* 品牌区下沿与菜单分开，否则第一组菜单看起来像品牌的一部分 */
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
}
.sidebar .brand-mark {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    display: block;
    object-fit: contain;
}
.sidebar .brand-name {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: .2px;
    white-space: nowrap;
}

.nav-group { margin-top: 14px; }
.nav-group > .g-label {
    padding: 0 10px 5px;
    font-size: 11px;
    color: var(--ink-4);
    letter-spacing: .3px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 10px;
    border-radius: 7px;
    font-size: 13px;
    color: var(--ink-3);
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    /* 当前项用左侧色条标记，比整块高亮更轻，也不会和悬停态撞车 */
    position: relative;
}
.nav-item:hover {
    background: var(--bg-subtle);
    color: var(--ink);
    text-decoration: none;
}
.nav-item.active {
    background: var(--brand-weak);
    color: var(--brand);
    font-weight: 500;
}
.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    bottom: 9px;
    width: 2px;
    border-radius: 1px;
    background: var(--brand);
}
.nav-item .count {
    margin-left: auto;
    font-size: 11px;
    color: var(--ink-4);
    background: var(--bg);
    border-radius: 9px;
    padding: 0 6px;
    height: 17px;
    line-height: 17px;
}

.sidebar-foot {
    margin-top: auto;
    padding: 12px 10px 2px;
    border-top: 1px solid var(--line);
    font-size: 11.5px;
    color: var(--ink-5);
    line-height: 1.65;
}
.sidebar-foot a { color: var(--ink-4); }
.sidebar-foot a:hover { color: var(--ink); }

/* 手机抽屉的遮罩。桌面上永远不出现 */
.nav-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(44, 44, 42, .32);
    z-index: 29;
}
body.nav-open .nav-mask { display: block; }

/* 任何弹层打开时锁住背景滚动 —— 小屏手指一划，页面不会跟着动。
   抽屉、弹窗、图片放大都由 overlay.js 统一加这个类，不按层各写一份 */
body.ovl-open { overflow: hidden; }

/* ---------- 主区 ---------- */

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    height: var(--topbar-h);
    padding: 0 26px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.topbar .crumb {
    font-size: 12.5px;
    color: var(--ink-4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-weak);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    font-weight: 500;
    flex: 0 0 auto;
}
.user-chip .role { color: var(--ink-4); font-size: 11.5px; }
.link-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--ink-4);
    cursor: pointer;
}
.link-btn:hover { color: var(--ink); }

/* 手机才出现的「菜单」按钮 */
.nav-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-3);
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
}

.app-body {
    padding: 24px 26px 48px;
    flex: 1 1 auto;
    min-width: 0;
}
/* 内容最宽 1180：再宽一行字就过长，读起来费劲 */
.app-body > .body-inner { max-width: 1180px; }

/* 外壳骨架写在每个页面的 HTML 里（8 行），不靠 JS 创建整个结构：
   JS 挂了页面内容仍然可读，只是没有导航；也不会因为注入晚了一拍而布局跳动。
   所以侧栏在桌面上是 sticky、正常占位，只在手机媒体查询里才改成 fixed 抽屉。
   不要再给 body 加 padding-left 之类的"防跳动"补偿 —— 那和骨架方案是两套思路，
   混用会让内容区整体右移、然后被侧栏盖住，画面看起来像整块错位。 */

/* flow 型：只有顶栏和返回，没有侧栏 */
body[data-layout="flow"] .topbar { padding: 0 20px; }

/* ============================================================
   通用组件
   ============================================================ */

/* ---------- 按钮 ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, border-color .15s, opacity .15s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { background: var(--bg-subtle); text-decoration: none; }
.btn:active { background: var(--bg); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:disabled:hover { background: var(--surface); }

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 500;
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-primary:active { background: #0F3E6D; }
.btn-primary:disabled:hover { background: var(--brand); }

.btn-danger { color: var(--danger); border-color: var(--danger-weak); background: var(--surface); }
.btn-danger:hover { background: var(--danger-weak); }

.btn-ghost { border-color: transparent; color: var(--ink-4); background: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14px; }
.btn-block { width: 100%; }

/* ---------- 表单 ---------- */

/* 字段自带下边距：表单里 field 是连续堆叠的，没有它就全挤在一起。
   放在 .field 上而不是让父容器 gap，是因为 .row-2 里的 field 也要这个间距 ——
   手机端 row-2 塌成单列时，行间距正好等于字段间距，不会突然变宽。 */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--ink-4); line-height: 1.5; }

.input, .select, .textarea {
    width: 100%;
    height: 36px;
    padding: 0 11px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-size: 13.5px;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 72px; padding: 9px 11px; resize: vertical; }

/* 只读值 + 复制按钮（员工登录链接这类「给你一串东西，你拿去发」的字段）。
   输入框弹性收缩、按钮不收缩 —— 手机上链接很长时，被压的必须是输入框。 */
.copy-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.copy-row .input { flex: 1 1 auto; min-width: 0; }
.copy-row .btn { flex: 0 0 auto; }.input::placeholder, .textarea::placeholder { color: var(--ink-5); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(24, 95, 165, .12);
}
.input:disabled, .select:disabled { background: var(--bg-subtle); color: var(--ink-4); }
.select { cursor: pointer; }

/* ---------- 卡片 ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-body { padding: 16px; }
.card-title { margin: 0 0 3px; font-size: 14px; font-weight: 600; }
.card-sub { margin: 0 0 12px; font-size: 12.5px; color: var(--ink-3); line-height: 1.65; }

/* ---------- 页头 ---------- */

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.page-head h1 {
    margin: 0 0 3px;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -.2px;
}
.page-head p {
    margin: 0;
    font-size: 12.5px;
    color: var(--ink-3);
    line-height: 1.6;
}
.page-head .actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; }

/* ---------- 筛选条 ---------- */

.filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}
.filters .input, .filters .select { width: auto; min-width: 130px; }
.filters .input.grow, .filters .select.grow { flex: 1 1 160px; width: auto; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------- 表格 ---------- */

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data th {
    text-align: left;
    font-weight: 500;
    font-size: 11.5px;
    color: var(--ink-4);
    padding: 10px 14px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
table.data td {
    padding: 11px 14px;
    border-top: 1px solid var(--line);
    color: var(--ink-2);
    vertical-align: middle;
}
table.data tbody tr:first-child td { border-top: none; }
table.data tbody tr:hover { background: #FDFCFA; }
table.data .num { text-align: right; }
table.data th.num { text-align: right; }
table.data .mono { font-variant-numeric: tabular-nums; }
/* 列语义类：写在样式表里比每行内联更稳，改一次全站生效 */
.cell-time { color: var(--ink-4); font-size: 12.5px; }
.cell-actions { text-align: right; white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.num { text-align: right; }

/* td 里有多段内容（姓名 + 部门、单号 + 备注）时用这个包裹。
   手机端 td 是 flex + space-between，直接放两个子元素会被推到两端，
   中间空出一大片，看起来像排版坏了。 */
.td-body { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; flex-wrap: wrap; }
.td-body .sub { color: var(--ink-4); font-size: 12px; }

/* ---------- 指标卡（统计分析页顶部四宫格） ----------
   类名沿用旧 app.css 的 kpi / k-label / k-value，没改成 metric：
   confirm.html、manage.html 迁过来时 HTML 一行都不用动。
   色彩全部换成暖米色令牌，不再留 --muted / --card 这类旧变量名。 */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}
.kpi {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.kpi .k-label { font-size: 12.5px; color: var(--ink-4); }
.kpi .k-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.5px;
    margin-top: 4px;
}
.kpi .k-unit { font-size: 13px; font-weight: 500; color: var(--ink-4); margin-left: 3px; }

/* ---------- 条形图（费用构成、按月走势） ---------- */

.bar-row {
    display: grid;
    grid-template-columns: 76px 1fr 90px;
    gap: 10px;
    align-items: center;
    margin-bottom: 9px;
}
.bar-row .b-name {
    font-size: 13px;
    color: var(--ink-3);
    /* 小类名会出现「差旅费 / 城市间交通费」这种长串，不给省略号会把
       中间那栏挤到 0 宽，条形直接消失 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bar-track { height: 18px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-mid), var(--brand));
    border-radius: 5px;
    min-width: 2px;
    transition: width .4s;
}
.bar-row .b-val {
    font-size: 13px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--ink-2);
}

/* ---------- 上传区 ---------- */

.dropzone {
    border: 1.5px dashed var(--line-2);
    border-radius: var(--radius);
    background: var(--bg-subtle);
    padding: 28px 18px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag {
    border-color: var(--brand);
    background: var(--brand-weak);
}
.dropzone .dz-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
    border-radius: 10px;
    background: var(--brand-weak);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-size: 20px;
}
.dropzone .dz-main { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.dropzone .dz-sub { color: var(--ink-4); font-size: 12.5px; margin-top: 4px; line-height: 1.7; }

/* ---------- 待提交文件列表 ---------- */

.thumb-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.thumb {
    display: flex;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 9px;
    background: var(--surface);
}
.thumb img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    background: var(--bg);
    flex: none;
}
/* 文档/压缩包没有缩略图，用扩展名色块代替，避免出现空白方框 */
.thumb .t-file {
    width: 56px;
    height: 56px;
    flex: none;
    border-radius: 6px;
    background: var(--brand-weak);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .4px;
}
.thumb .t-info { flex: 1; min-width: 0; }
.thumb .t-name {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.thumb .t-meta { font-size: 12px; color: var(--ink-4); margin-top: 2px; }

/* 不能解压的压缩包：留在列表里把原因和出路写清楚，而不是弹个 3 秒就消失的提示 */
.thumb-blocked {
    align-items: flex-start;
    border-color: var(--danger);
    background: var(--danger-weak);
}
.thumb-blocked .t-hint {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.55;
    color: var(--danger);
}
.thumb .t-del {
    border: none;
    background: transparent;
    color: var(--ink-4);
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
}
.thumb .t-del:hover { background: var(--danger-weak); color: var(--danger); }

/* ---------- 提示条 ---------- */

.check-item {
    display: flex;
    gap: 7px;
    font-size: 12.5px;
    line-height: 1.5;
    padding: 7px 10px;
    border-radius: 7px;
    /* 提示语里会出现 invoice_type / amount_ex_tax 这类长标识符，
       默认不在连字符处断行，会把整页撑出手机屏宽 */
    overflow-wrap: anywhere;
    min-width: 0;
}
.check-item > span { min-width: 0; }
.check-item.error { background: var(--danger-weak); color: var(--danger); }
.check-item.warn  { background: var(--warn-weak);   color: var(--warn); }
.check-item.ok    { background: var(--ok-weak);     color: var(--ok); }
.check-item.info  { background: var(--bg);          color: var(--ink-3); }

/* ---------- 两栏 ---------- */

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
/* 宽屏比例 1.35fr : 1fr → 1.8fr : 1fr。
   加进 240px 侧栏后内容只剩约 1128px，按原比例表单会被压到 638px，
   而右侧「怎么用 / 识别说明」占着 474px 反而显得空。
   右栏给 1fr 已经够读，省下来的宽度应该归表单。 */
@media (min-width: 900px) {
    .grid-2 { grid-template-columns: 1.8fr 1fr; align-items: start; }
}
/* 两列字段用 column-gap：宽屏并排时留 12px 列间距，
   塌成单列后靠 .field 自己的 margin-bottom 控制行间距，不会叠加成 28px */
.row-2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
@media (max-width: 560px) { .row-2 { grid-template-columns: 1fr; } }

/* ---------- 状态标记 ---------- */

.badge, .tag {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 5px;
    font-size: 11.5px;
    flex: 0 0 auto;
    white-space: nowrap;
}
.badge-gray,   .tag-muted  { background: var(--bg);          color: var(--ink-4); }
.badge-brand,  .tag-brand  { background: var(--brand-weak);  color: var(--brand); }
.badge-ok,     .tag-ok     { background: var(--ok-weak);     color: var(--ok); }
.badge-warn,   .tag-warn   { background: var(--warn-weak);   color: var(--warn); }
.badge-danger, .tag-danger { background: var(--danger-weak); color: var(--danger); }

/* ---------- 空状态 / 加载 ---------- */

.empty { padding: 30px 12px; text-align: center; font-size: 13px; color: var(--ink-4); line-height: 1.7; }
.empty .e-icon { font-size: 22px; line-height: 1; margin-bottom: 8px; opacity: .55; }
.empty .e-title { font-size: 13.5px; color: var(--ink-3); font-weight: 500; margin-bottom: 3px; }
.empty .e-sub { font-size: 12.5px; color: var(--ink-4); }

.loading-line { display: flex; align-items: center; gap: 8px; padding: 16px 12px; font-size: 13px; color: var(--ink-4); }
.spinner {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    border: 2px solid var(--line-2);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 分页 ---------- */

.pager {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--ink-4);
}
.pager > span.flex1 { flex: 1 1 auto; }

/* ---------- Toast ---------- */

#toast-host {
    position: fixed;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
    pointer-events: none;
}
.toast {
    padding: 9px 15px;
    border-radius: 8px;
    font-size: 13px;
    color: #fff;
    background: var(--ink);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .16);
    animation: toast-in .18s ease-out;
    max-width: 86vw;
}
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   管理后台组件

   这些原来住在 web/assets/app.css 里（旧报销端皮肤，冷灰色令牌）。
   搬过来时逐条换成了暖米色令牌：app.css 用的 --muted / --brand-soft /
   --card 在本文件里都没有定义，原样复制过来不会报错，只会**静默失效** ——
   变量取不到值就回落到继承值，页面看起来「颜色怪但还能用」，最难查。
   ============================================================ */

/* ---------- 两栏：左树右表、左表单右概览 ---------- */

.manage-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 16px;
    align-items: start;
}
.manage-grid.company { grid-template-columns: 1fr 320px; }

/* grid 子项默认 min-width:auto，会被「不换行的筛选条」撑开整列，
   进而把整页撑出横向滚动。必须显式归零。 */
.manage-grid > * { min-width: 0; }

@media (max-width: 900px) {
    .manage-grid,
    .manage-grid.company { grid-template-columns: 1fr; }
}

/* ---------- 表单分区标题 ---------- */

.form-section {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-4);
    letter-spacing: .4px;
    margin: 4px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
}
.form-section:not(:first-child) { margin-top: 20px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 统计小卡（管理概览） ---------- */

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 10px;
}
.stat-mini {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 11px 12px;
    background: var(--bg-subtle);
}
.stat-mini .s-label { font-size: 12px; color: var(--ink-4); }
.stat-mini .s-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}
.stat-mini.warn .s-value { color: var(--warn); }

/* ---------- 提示条 ---------- */

.tip-bar {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    padding: 10px 13px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.6;
    margin-bottom: 14px;
}
.tip-bar.info { background: var(--bg-subtle); color: var(--ink-3); }
.tip-bar.warn { background: var(--warn-weak); color: var(--warn); }
.tip-bar.ok   { background: var(--ok-weak);   color: var(--ok); }
.tip-bar .t-act { margin-left: auto; white-space: nowrap; }
.tip-bar a { color: inherit; text-decoration: underline; }

/* ---------- 小圆标签（人员状态） ---------- */

.chip {
    display: inline-block;
    font-size: 12px;
    padding: 1px 7px;
    border-radius: 20px;
    background: var(--brand-weak);
    color: var(--brand);
    white-space: nowrap;
}
.chip.gray { background: var(--bg);      color: var(--ink-4); }
.chip.ok   { background: var(--ok-weak); color: var(--ok); }
.chip.warn { background: var(--warn-weak); color: var(--warn); }
.role-chips { display: flex; gap: 4px; flex-wrap: wrap; }

/* 角色勾选区（人员编辑弹窗） */
.role-picks { display: flex; flex-direction: column; gap: 2px; }
.role-picks .check-item { cursor: pointer; align-items: flex-start; }
.role-picks .check-item:hover { background: var(--bg-subtle); }
.check-item > input[type="checkbox"],
.check-item > input[type="radio"] {
    /* 不加这一条，checkbox 在 flex 行里会被拉满高度，看起来像个方块 */
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    margin: 2px 0 0;
}

/* ---------- 组织树 ---------- */

.tree { padding: 6px 8px 10px; }

.tree-node {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13.5px;
}
.tree-node:hover { background: var(--bg-subtle); }
.tree-node.active { background: var(--brand-weak); color: var(--brand); font-weight: 600; }
.tree-node .n-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tree-node .n-count {
    font-size: 12px;
    color: var(--ink-4);
    font-variant-numeric: tabular-nums;
}
.tree-node.active .n-count { color: var(--brand); }
.tree-node .n-ops {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity .12s;
}
.tree-node:hover .n-ops,
.tree-node.active .n-ops { opacity: 1; }

.icon-btn {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--ink-4);
    font-size: 13px;
    line-height: 1;
    padding: 3px 4px;
    border-radius: 4px;
    font-family: inherit;
}
.icon-btn:hover { background: var(--brand-weak); color: var(--brand); }
.icon-btn.danger:hover { background: var(--danger-weak); color: var(--danger); }

.tree-empty { padding: 18px 14px; color: var(--ink-4); font-size: 12.5px; text-align: center; line-height: 1.8; }

/* ---------- 行内操作组 ---------- */
/* 不加 nowrap 的话「通过 / 驳回 / 详情 / 删除」在窄列里会各自折行，
   每行只剩一个按钮，表格高度翻三倍 */
.row-actions { display: flex; gap: 2px; flex-wrap: nowrap; white-space: nowrap; }
.row-actions .btn { flex: 0 0 auto; }

/* ---------- 弹窗 ---------- */

.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(44, 44, 42, .45);
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
}

.modal {
    background: var(--surface);
    border-radius: 12px;
    width: 100%;
    max-width: 440px;
    max-height: 84vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(44, 44, 42, .25);
}

.modal-head { padding: 16px 18px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-body { padding: 16px 18px; }
.modal-foot {
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 合并档案那种「选一条」的卡片 */
.pick-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
}
.pick-item:hover { border-color: var(--brand-mid); background: var(--brand-weak); }
.pick-item .p-name { font-weight: 600; font-size: 13.5px; }
.pick-item .p-meta { font-size: 12px; color: var(--ink-4); }

/* ---------- 无权限提示 ---------- */

.auth-box {
    max-width: 400px;
    margin: 60px auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 26px 24px;
    text-align: center;
}
.auth-box .a-icon { font-size: 26px; }
.auth-box h2 { font-size: 17px; margin: 10px 0 6px; }
.auth-box p { font-size: 13px; color: var(--ink-4); margin: 0 0 16px; line-height: 1.75; }

/* ---------- 图片放大 ---------- */
/* shell.js 的 Shell.lightbox() 用这个类。上一版它写的是内联样式，
   这段 CSS 一直没人引用；现在两边合一，改尺寸改一处。 */

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .86);
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 24px;
    cursor: zoom-out;
}
.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

/* ============================================================
   工作台（门户首页）
   ============================================================ */

/* 左主列 + 右侧列。右列 320：再宽主列的单据行会被压得换行 */
.page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
}
.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* 问候语比普通页头大一号：这是登录后第一眼，要有一点分量 */
.greet h1 {
    margin: 0 0 5px;
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -.3px;
}
.greet p { margin: 0; font-size: 13px; color: var(--ink-3); }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.section-head h2 { margin: 0; font-size: 14.5px; font-weight: 600; }
.section-head .note { font-size: 12px; color: var(--ink-4); }

/* 业务入口卡片 */
.entries {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
.entry:hover {
    text-decoration: none;
    border-color: var(--line-2);
    box-shadow: var(--shadow);
}
.entry .icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 15px;
    color: var(--ink-3);
}
.entry.primary .icon { background: var(--brand-weak); color: var(--brand); }
.entry .txt { min-width: 0; }
.entry .name { font-size: 14px; font-weight: 500; }
.entry .sub { font-size: 12px; color: var(--ink-4); margin-top: 1px; }
.entry[aria-disabled="true"] { opacity: .55; pointer-events: none; }

/* 卡片标题行：左边标题右边「查看全部」这类链接 */
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
}
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.card-head a { font-size: 12px; }

/* 卡片里的简表行（最近单据、待我审批） */
.row-list { display: flex; flex-direction: column; }
.row-list .row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
    font-size: 13px;
}
.row-list .row:first-child { border-top: none; padding-top: 0; }
.row-list .row:last-child { padding-bottom: 0; }
.row-list .row .grow { flex: 1 1 auto; min-width: 0; }
.row-list .row .time { font-size: 11.5px; color: var(--ink-4); white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   核对识别结果页（confirm.html）

   这一页的结构和其他页不同：一条单据 = N 张票据卡，每张卡里是
   「缩略图 + 一组可编辑字段 + 校验提示」，底部还有一条常驻合计条。
   所以卡片不是 .card 而是更紧凑的 .inv-card —— 卡头放序号/票种/状态
   徽章，卡身左图右字段。

   字段用 .f-input 而不是 .input：置信度低的格子要带一层琥珀底
   （「待核对」），和普通输入框不是同一种东西，混用会让
   「这格到底要不要改」看不出来。
   ============================================================ */

/* ---------- 识别进度 ---------- */
.prog-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; min-width: 0; }
.prog-title { flex: 1; min-width: 0; font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.prog-title strong { font-size: 15px; color: var(--brand); }
/* 进度条本身不承载关键信息，数字在上面那行文字里 */
.prog-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.prog-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--brand-mid), var(--brand));
    transition: width .4s ease;
}
.prog-meta { margin-top: 7px; font-size: 11.5px; color: var(--ink-4); line-height: 1.6; overflow-wrap: anywhere; }

/* ---------- 票据卡 ---------- */
.inv-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    margin-bottom: 14px;
    overflow: hidden;
}
/* 排除的票压暗但留在原位：它还能被「纳入报销」救回来，直接藏掉就没有退路了 */
.inv-card.excluded { opacity: .55; background: var(--bg-subtle); }

.inv-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.inv-head .idx {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--brand-weak);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    flex: none;
}
.inv-head .title { font-weight: 600; font-size: 14px; }

/* 卡身默认单列（手机上图在上、字段在下），720 起才左右并排 */
.inv-body { padding: 14px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) {
    .inv-body { grid-template-columns: 150px minmax(0, 1fr); align-items: start; }
}

/* 缩略区：图片给缩略图，PDF/文档给一块带扩展名的打开入口 */
.inv-preview {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    display: block;
    max-height: 200px;
    object-fit: contain;
    cursor: zoom-in;
}
/* 无图可预览时不要丢个破图方框给用户 */
.inv-preview.empty-preview {
    display: grid;
    place-items: center;
    height: 120px;
    color: var(--ink-4);
    font-size: 12px;
    cursor: default;
}
.inv-preview.doc-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 150px;
    padding: 12px;
    text-decoration: none;
    color: var(--ink-2);
    cursor: pointer;
}
.inv-preview.doc-preview .dp-ext { font-size: 20px; font-weight: 700; color: var(--brand); letter-spacing: .5px; }
.inv-preview.doc-preview .dp-name {
    font-size: 12px;
    color: var(--ink-4);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.inv-preview.doc-preview .dp-act { font-size: 12.5px; color: var(--brand); }
@media (min-width: 720px) { .inv-preview { height: 150px; } }

/* 文件行：缩略图只回答「是哪张票」，文件名、格式与查看入口在这里。
   一条记录通常只有一个原件，所以多数时候它就是一行，不会把卡片撑高。 */
.inv-files { margin-top: 6px; display: flex; flex-direction: column; gap: 1px; }
.inv-file {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 3px 4px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.35;
    color: var(--ink-3);
    text-decoration: none;
}
.inv-file:hover { background: var(--bg-subtle); color: var(--ink); }
.inv-file .if-ext { flex: none; font-size: 10px; font-weight: 700; color: var(--brand); letter-spacing: .3px; }
.inv-file .if-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-file .if-act { flex: none; font-size: 11.5px; color: var(--brand); }

/* 辅助材料行：不计金额，但必须让人看见「5 个文件里另外 2 个去哪了」 */
.mat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
    min-width: 0;
}
.mat-row:first-of-type { border-top: none; }
.mat-row .t-file {
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: var(--radius-sm);
    background: var(--brand-weak);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .3px;
}
.mat-info { flex: 1; min-width: 0; }
.mat-name { font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mat-desc { font-size: 12.5px; color: var(--ink-4); margin-top: 3px; line-height: 1.5; word-break: break-word; }
.mat-acts { display: flex; gap: 6px; flex: none; }

/* ---------- 票面字段 ---------- */
.inv-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; min-width: 0; }
.inv-fields .full { grid-column: 1 / -1; }
.f-label { font-size: 12px; color: var(--ink-4); margin-bottom: 3px; display: block; line-height: 1.5; }
.f-input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 7px 9px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: var(--surface);
}
.f-input:focus { outline: none; border-color: var(--brand-mid); box-shadow: 0 0 0 3px rgba(24, 95, 165, .12); }
/* 琥珀底只表示「这格值得再看一眼」，不表示填错了 —— 用红色会让人去改本来对的数 */
.f-input.lowconf { border-color: var(--warn); background: var(--warn-weak); }
.f-input.amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.checks { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.inv-actions {
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    background: var(--bg-subtle);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* ---------- 底部合计条 ---------- */
/* 必须 sticky 而不是普通块：这一页能滚很长，合计与「确认提交」跟着滚走
   等于每改一个金额都要滑到底。放在 .app-body 外面、.app-main 里面，
   既不受 body-inner 的 1180 宽度限制，也不用 fixed 去追侧栏宽度。 */
.summary-bar {
    position: sticky;
    bottom: 0;
    z-index: 15;
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 12px rgba(44, 44, 42, .06);
    padding: 10px 26px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.summary-bar .sum-label { font-size: 13px; color: var(--ink-4); }
.summary-bar .sum-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.5px;
}
.summary-bar .spacer { flex: 1; }

/* 卡片标题里跟一句说明用的小字（如「辅助材料 2 份，不计入合计」） */
.hint { font-size: 11.5px; color: var(--ink-4); font-weight: 400; }

@media (max-width: 720px) {
    .prog-head { flex-wrap: wrap; }
    /* 标题独占一行（进度数字要看得清），按钮换行后靠右、保持自身宽度。
       按钮拉满整行会变成页面里最醒目的东西，而它只是个辅助操作——
       真正要看到的是「4/6 正在读第 5 页」。 */
    .prog-title { flex: 1 1 100%; }
    .prog-head .btn { width: auto; margin-left: auto; }
    .inv-fields { grid-template-columns: minmax(0, 1fr); }
    .mat-row { flex-wrap: wrap; }
    .mat-acts { width: 100%; justify-content: flex-end; }
    .summary-bar { padding: 10px 16px; gap: 10px; }
    .summary-bar .sum-value { font-size: 20px; }
}

/* ============================================================
   响应式
   ============================================================ */

/* 侧栏收起为抽屉。960 是经验值：再窄侧栏就挤掉表格的主列 */
@media (max-width: 960px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 0 0 32px rgba(0, 0, 0, .12);
        /* 抽屉在暗色遮罩上要有一道边，否则和背景糊在一起 */
        border-right: 1px solid var(--line);
    }
    /* 抽屉的开关只操作 body 一个类：遮罩和侧栏都挂在这个类上，
       不会出现「侧栏开了但遮罩没开」的半开状态 */
    body.nav-open .sidebar { transform: translateX(0); }
    .nav-toggle { display: inline-flex; }
    .app-body { padding: 18px 16px 40px; }
    .topbar { padding: 0 16px; }
    /* 右列掉到主列下面：手机上并排两栏会把单据行压成两行字 */
    .page-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
    .topbar { height: 54px; gap: 10px; }
    .topbar .crumb, .user-chip .role { display: none; }
    .page-head h1 { font-size: 17px; }
    .page-head { margin-bottom: 14px; }

    /* 表格转卡片：手机上横滑表格是最难用的一种控件 */
    table.data thead { display: none; }
    table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
    table.data tr { padding: 11px 13px; border-top: 1px solid var(--line); }
    table.data tbody tr:first-child { border-top: none; }
    table.data td {
        border: none;
        padding: 3px 0;
        display: flex;
        justify-content: space-between;
        gap: 12px;
        text-align: left;
    }
    table.data td::before {
        content: attr(data-label);
        font-size: 11.5px;
        color: var(--ink-4);
        flex: 0 0 auto;
    }
    /* 操作列没有 data-label：不显示前缀，内容靠右，不被 space-between 拉开 */
    table.data td:not([data-label]) { justify-content: flex-end; gap: 8px; padding-top: 8px; }
    table.data td:not([data-label])::before { display: none; }
    table.data td.num { text-align: right; }

    /* 手机上名字够认人，头像那 28px 让给内容 */
    .user-chip .avatar { display: none; }
    .filters { padding: 10px 12px; }
    .filters .input, .filters .select { min-width: 0; flex: 1 1 120px; }

    .entries { grid-template-columns: minmax(0, 1fr); }
    .greet h1 { font-size: 20px; }
    .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
    .kpi { padding: 13px 12px; }
    .kpi .k-value { font-size: 21px; }
    .kpi .k-label { font-size: 11.5px; }
    .manage-grid { gap: 12px; }
    .modal { max-height: 88vh; }
}

/* ============================================================
   电子名片 · 我的名片页（2026-10-29）
   ============================================================ */

.studio {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(340px, .85fr);
    gap: 16px;
    align-items: start;
}

.studio-preview {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
}

.studio-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.style-chips { display: flex; gap: 8px; flex-wrap: wrap; }

.style-chip {
    display: flex; flex-direction: column; gap: 2px;
    padding: 8px 11px; border-radius: 9px; cursor: pointer;
    border: 1px solid var(--line-2); background: var(--bg-subtle);
    font-family: inherit; text-align: left; max-width: 220px;
}
.style-chip b { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.style-chip span { font-size: 10.5px; color: var(--ink-4); line-height: 1.45; }
.style-chip:hover { border-color: var(--brand-mid); }
.style-chip.on {
    border-color: var(--brand); background: var(--brand-weak);
    box-shadow: 0 0 0 1px var(--brand) inset;
}
.style-chip.on b { color: var(--brand-dark); }

/* 横竖切换：两个按钮拼一个分段控件 */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button {
    border: 0; background: var(--surface); color: var(--ink-3);
    font-family: inherit; font-size: 12.5px; height: 30px; padding: 0 14px; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--brand); color: #fff; }

/* 预览区：canvas 按容器宽度缩放。竖版单独限宽，
   否则 420×700 在宽屏上会被拉到 700 多高，把右栏挤出屏幕 */
.canvas-wrap {
    display: flex; justify-content: center;
    padding: 10px 6px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
/* 扁平渲染后这张 canvas 就是名片本身（1 像素不多），所以它的圆角必须
   **不大于画出来的圆角**，否则 CSS 会把卡片四角啃掉一块。
   画出来的圆角是 width 的 2.96%（横版 32/1080）和 6.19%（竖版 26/420），
   取 3% 对两版都安全；写死 px 会随预览宽度变化而失效。 */
.card-canvas {
    display: block; width: 100%; height: auto;
    border-radius: 3%;
    box-shadow: 0 12px 32px rgba(20, 22, 34, .22);
}
.canvas-wrap[data-layout="port"] .card-canvas { width: min(300px, 100%); }

.studio-actions {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding-top: 4px;
}
.studio-hint { font-size: 11.5px; color: var(--ink-4); }

.studio-form .card-body { padding: 16px; }

/* ------------------------------------------------------------
   个人资料页（2026-10-30 改版：不再放名片预览）
   ------------------------------------------------------------
   单列堆叠并限宽：表单占满整行后，宽屏上不限宽会被拉成
   「一行只有两个字段」的长条，眼睛来回扫很远。
   ------------------------------------------------------------ */
.profile-stack { display: flex; flex-direction: column; gap: 14px; max-width: 880px; }
/* 用 .ro-grid.ro-grid-3 提高特异性：本段写在 .ro-grid 之前，
   同权重时会被后面那条 1fr 1fr 覆盖掉（第一版就踩了） */
.ro-grid.ro-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* 名片显示项：只读状态条。
   能看出「这几项现在开没开」，但不给开关 —— 改的地方只有一个（我的名片），
   这里再放一套开关，两份状态迟早互相打架，用户还会怀疑没保存。 */
.flag-line {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px;
    margin-top: 4px; padding: 8px 10px;
    background: var(--bg-subtle); border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 12px; color: var(--ink-3);
}
.flag-cap { color: var(--ink-4); font-size: 11.5px; }
.flag {
    padding: 1px 8px; border-radius: 5px;
    background: var(--surface); border: 1px solid var(--line-2);
    font-size: 11.5px; color: var(--ink-2);
}
.flag.off {
    color: var(--ink-4); border-style: dashed; background: transparent;
    text-decoration: line-through;
}
.flag-more { margin-left: auto; font-size: 11.5px; color: var(--brand); text-decoration: none; }
.flag-more:hover { text-decoration: underline; }

/* 公开链接一行：输入框吃掉剩余宽度，按钮不被压缩 */
.pub-row { display: flex; gap: 8px; align-items: center; }
.pub-row .input { flex: 1 1 auto; min-width: 0; font-size: 12px; }

/* ------------------------------------------------------------
   名片模板选择（管理员，公司信息页）
   ------------------------------------------------------------
   以前这里是员工页的「导出样式」（平铺/微倾/舞台/叠卡/真3D），
   2026-10-31 摆拍整体删除，同一套缩略图选择器搬到管理员侧选**模板**。

   为什么仍然用图而不是下拉框：模板的差别是配色与质感——
   「墨玉金 / 素白 / 朱砂」这几个词单独看没有任何信息量，
   给一张真名片缩略图，人三秒就选完了。缩略图用真渲染出的图，
   不用示意图：示意图永远和成品有落差。
   ------------------------------------------------------------ */
.tpl-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 10px 0 2px;
}

.tpl-opt {
    display: block;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    overflow: hidden;
    text-align: left;
    font: inherit;
    color: var(--ink);
    transition: border-color .14s, box-shadow .14s;
    /* 选中勾是绝对定位的锚点 */
    position: relative;
}

.tpl-opt:hover { border-color: var(--brand-mid); }

.tpl-opt.on {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px var(--brand-weak);
}

/* 缩略图：容器先按名片的真实比例占好位置，图到了不跳版。
   16/10 会和 1080×640（=1.6875）差一点，object-fit:cover 会把
   左右各裁掉几个像素 —— 卡片的圆角和描边正好在那一带，所以直接用真比例。 */
.tpl-opt .tpl-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 1080 / 640;
    background: var(--bg-subtle);
    object-fit: cover;
}

.tpl-opt .tpl-name {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 9px 8px;
    font-size: 12.5px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 选中标记：不占位置，用右上角一个小勾，避免名称被挤 */
.tpl-opt .tpl-name::after {
    content: '';
    margin-left: auto;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--line);
    flex: none;
}

.tpl-opt.on .tpl-name::after {
    border-color: var(--brand);
    background: var(--brand)
        url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E")
        center / 10px no-repeat;
}

/* 模板卡片下方的一句色调说明：管理员要能看懂「这个适合什么行业」 */
.tpl-note {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--ink-4);
    line-height: 1.55;
}

@media (max-width: 640px) {
    /* 手机上两列各 40% 屏宽，缩略图里的卡片已经看不清了，
       改成一行两个但更矮的比例，至少能看出深浅与倾斜 */
    .stage-grid { gap: 8px; }
    .stage-opt .stage-thumb { aspect-ratio: 16 / 9; }
}

/* ============================================================
   开关（显示与公开）
   ------------------------------------------------------------
   用原生 checkbox + 包一层，不自己造按钮：
   这样键盘 Tab / 空格、「读屏念出勾选状态」都是浏览器自带的，
   自己 div 画的开关在手机上要额外补 44px 热区和 aria-checked，
   少写一处就是个「点不准」的投诉。
   ============================================================ */
.sw { position: relative; display: inline-flex; flex: none; }
.sw input {
    position: absolute; inset: 0; width: 100%; height: 100%;
    margin: 0; opacity: 0; cursor: pointer; z-index: 1;
}
.sw span {
    display: block; width: 40px; height: 22px; border-radius: 999px;
    background: var(--line-2); transition: background .16s;
    position: relative;
}
.sw span::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 3px rgba(20, 22, 34, .28);
    transition: transform .16s;
}
.sw input:checked + span { background: var(--brand); }
.sw input:checked + span::after { transform: translateX(18px); }
.sw input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-weak); }
.sw input:disabled + span { opacity: .5; }

/* 一行「标题 + 说明 + 开关」 */
.sw-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; padding: 11px 0;
    border-bottom: 1px solid var(--line);
}
.sw-row:last-of-type { border-bottom: 0; }
.sw-row .sw-text { min-width: 0; }
.sw-row .sw-label { font-size: 13px; color: var(--ink-2); }
.sw-row .sw-desc { font-size: 11.5px; color: var(--ink-4); margin-top: 3px; line-height: 1.5; }

/* 只读信息格：一眼能分清「这个改不了」 */
.ro-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
.ro-item { margin-bottom: 14px; }
.ro-item .k { font-size: 11.5px; color: var(--ink-4); margin-bottom: 4px; }
.ro-item .v {
    font-size: 13.5px; color: var(--ink); padding: 7px 10px;
    background: var(--bg-subtle); border: 1px solid var(--line);
    border-radius: var(--radius-sm); min-height: 34px;
    display: flex; align-items: center;
}

.colors {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}
.color-item {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    padding: 8px 4px; border: 1px solid var(--line); border-radius: 8px;
    cursor: pointer; background: var(--bg-subtle);
}
.color-item span { font-size: 10.5px; color: var(--ink-4); white-space: nowrap; }
.color-item input[type="color"] {
    width: 100%; height: 26px; padding: 0; border: 0; background: none; cursor: pointer;
    /* Safari 会把 color input 渲染成胶囊，去掉默认圆角与阴影 */
    -webkit-appearance: none; appearance: none; border-radius: 6px;
}
.color-item input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-item input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }

/* 品牌配置只有两个色槽，别撑成名片页那样五列 */
.colors.brand { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 232px; }

/* ---------- 品牌 logo / 徽标图 ---------- */

.form-tip {
    font-size: 12px;
    color: var(--ink-4);
    line-height: 1.6;
    margin: -4px 0 14px;
}

.logo-row { display: flex; gap: 14px; align-items: flex-start; }

/*
 * 预览盒用中性灰底。
 * 一开始用浅色棋盘格，结果白色透明底的 logo 放上去完全看不见，
 * 看着像「上传失败」。品牌 logo 深浅两种都有，只有中灰能同时照顾：
 * 白字有对比、深色也压得住。棋盘格留着，但要透到灰底上，用来提示透明区域。
 */
.logo-box {
    flex: 0 0 156px;
    height: 62px;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    color: var(--ink-4);
    overflow: hidden;
    background-color: #9AA1AA;
    background-image:
        linear-gradient(45deg, rgba(255,255,255,.10) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.10) 75%),
        linear-gradient(45deg, rgba(255,255,255,.10) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.10) 75%);
    background-size: 10px 10px;
    background-position: 0 0, 5px 5px;
}
.logo-box > span { color: rgba(255,255,255,.82); }
.logo-box.small { flex-basis: 76px; height: 44px; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }

.logo-ops { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.logo-ops .hint { max-width: 320px; }
.btn-line { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 640px) {
    .logo-row { flex-direction: column; gap: 10px; }
    .logo-box { flex: 0 0 auto; width: 100%; }
}

/* 微信内「长按保存」的遮罩 */
.img-mask {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(12, 14, 20, .88);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.img-mask-in { display: flex; flex-direction: column; align-items: center; gap: 14px; max-height: 92vh; }
.img-mask-in b { color: #fff; font-size: 14px; font-weight: 500; }
.img-mask-in img { max-width: 88vw; max-height: 74vh; border-radius: 12px; }

@media (max-width: 1120px) {
    .studio { grid-template-columns: minmax(0, 1fr); }
    .canvas-wrap[data-layout="port"] .card-canvas { width: min(260px, 100%); }
}

/* 资料页：三列只读格在窄屏退成两列，手机上一列放三个会把手机号那种长值挤到换行 */
@media (max-width: 720px) {
    .ro-grid.ro-grid-3 { grid-template-columns: 1fr 1fr; }
    .flag-more { margin-left: 0; }
}

@media (max-width: 640px) {
    /* 账号信息：手机号与密码状态都偏长，两列会各自折行、上下不齐 */
    .ro-grid.ro-grid-account { grid-template-columns: 1fr; }
    .studio-preview { padding: 10px; }
    .style-chip span { display: none; }
    .colors { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
    .color-item { padding: 6px 2px; }
    .color-item span { font-size: 9.5px; }
}

/* 标语框：.input 的 36px 固定高度对 textarea 不适用，
   不覆盖会被压成一行，写 30 个字只能看到开局几个字 */
.studio-form textarea.input {
    height: auto;
    min-height: 62px;
    padding: 8px 10px;
    line-height: 1.55;
    resize: vertical;
}

/* ============================================================
   工作日志
   ------------------------------------------------------------
   这一页的核心是「写起来没有负担」，所以样式上做了两件事：
     · 填写区不套 .field 那套 label + 提示的竖排结构（占高度、显得正式），
       改成一行小标签 + 控件，视觉上更像随手记的输入框。
     · 列表按天分组、每条之间只隔一条细线，不做卡片。
       卡片会让人觉得「每条都是重要记录」，反而不敢写短的。
   ============================================================ */

/* 标题右侧的小统计（本月几天 / 共几小时 / 累计几条） */
.head-stat {
    font-size: 12.5px;
    color: var(--ink-3);
    white-space: nowrap;
    padding-bottom: 2px;
}
.head-stat b { color: var(--ink); font-weight: 600; }
.dot-sep { color: var(--ink-5); margin: 0 2px; }

/* ---------- 填写区 ---------- */

.wl-edit-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.wl-edit-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.wl-edit-head .btn { margin-left: auto; }

/* 用 grid 而不是 flex：flex + width:auto 时四个格子会互相挤，
   实际渲染出来日期 94px、时间 95px，和设定的 148/112 对不上。
   grid 的列宽是硬的，不会被邻居影响。 */
.wl-meta {
    display: grid;
    grid-template-columns: 150px 114px 118px minmax(150px, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}
.wl-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.wl-meta-item > span {
    font-size: 11.5px;
    color: var(--ink-4);
    padding-left: 1px;
}
.wl-meta-item .input,
.wl-meta-item .select {
    height: 34px;
    font-size: 13px;
    min-width: 0;
}
/* 日期/时间/耗时给固定宽度。
   原来写 width:auto + min-width，实际宽度由浏览器按内容自己定，
   结果这一行四个格子参差不齐（日期 144 / 时间 90 / 耗时 76），
   看上去像没对齐，不像没写样式。 */
/* grid 已经把列宽定死了，控件铺满自己的格子即可 */
.wl-meta-item .input,
.wl-meta-item .select { width: 100%; }
.wl-meta-wide { min-width: 0; }

/* 手机：两列，项目占整行 —— 四列在 390 宽下每格不到 90px，日期根本显示不全 */
@media (max-width: 560px) {
    .wl-meta { grid-template-columns: 1fr 1fr; }
    .wl-meta-wide { grid-column: 1 / -1; }
}

/* 正文：单列铺满，行高给足。日志是要读的，不是要填满的表格 */
.wl-body {
    height: auto;
    min-height: 88px;
    padding: 10px 12px;
    line-height: 1.62;
    font-size: 13.5px;
    resize: vertical;
}

.wl-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.wl-hint { font-size: 11.5px; color: var(--ink-4); }

/* ---------- 今天收尾（期 19） ----------
   一天一份，两栏并排。窄屏会变单列（见文末 640 媒体查询），
   因为手机上两栏各剩不到 170px，写起来会一直换行。 */

.wl-edit-sub {
    font-weight: 400;
    font-size: 12px;
    color: var(--ink-4);
    margin-left: 8px;
}

.wl-close-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 10px;
}
.wl-close-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.wl-close-item > .k {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-3);
    margin-bottom: 6px;
}
.wl-close-item .textarea {
    height: auto;
    min-height: 84px;
    padding: 9px 11px;
    font-size: 13px;
    line-height: 1.62;
    resize: vertical;
}

/* 昨天留给今天的计划：浅蓝底而不是卡片底色 —— 它属于「提醒」，不属于「记录」 */
.wl-carry {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    background: var(--brand-weak);
}
.wl-carry-body { flex: 1; min-width: 0; }
.wl-carry-k {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--brand-dark);
}
.wl-carry-v {
    margin-top: 3px;
    font-size: 13px;
    line-height: 1.62;
    color: var(--ink-2);
    white-space: pre-wrap;
    word-break: break-word;
}
.wl-carry-x {
    flex: 0 0 auto;
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: var(--brand);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}
.wl-carry-x:hover { color: var(--brand-dark); }

/* 列表里某天的收尾：虚线框，视觉上属于「那天的总结」而不是又一条日志 */
.wl-day-plan {
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px dashed var(--line-2);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
}
.wl-day-plan-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    line-height: 1.62;
}
.wl-day-plan-row + .wl-day-plan-row { margin-top: 6px; }
.wl-day-plan-k {
    flex: 0 0 auto;
    min-width: 56px;
    padding-top: 1px;
    font-size: 11.5px;
    color: var(--ink-4);
}
.wl-day-plan-v {
    min-width: 0;
    color: var(--ink-2);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---------- 附件 ---------- */

.wl-atts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

/* 表单里的附件条：一行一个，带大小和移除按钮 */
.wl-att-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 5px 8px 5px 5px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
}
.wl-att-chip img {
    width: 30px;
    height: 30px;
    object-fit: cover;
    border-radius: 4px;
    flex: none;
    background: var(--surface);
}
.wl-att-chip .wl-att-name {
    font-size: 12px;
    color: var(--ink-2);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wl-att-chip .wl-att-size { font-size: 11px; color: var(--ink-5); flex: none; }
.wl-att-del {
    border: none;
    background: none;
    color: var(--ink-4);
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
    flex: none;
}
.wl-att-del:hover { color: var(--danger); }

/* 列表里的附件：图片给缩略图，PDF 给标签 */
.wl-att {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--bg-subtle);
    text-decoration: none;
}
.wl-att img {
    display: block;
    width: 62px;
    height: 46px;
    object-fit: cover;
}
.wl-att-file { padding: 6px 10px; }
.wl-att-ico {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .5px;
    color: #fff;
    background: #c0392b;
    border-radius: 3px;
    padding: 2px 4px;
    flex: none;
}
.wl-att-file .wl-att-ico { font-size: 10px; padding: 3px 5px; }
.wl-att-name {
    font-size: 11.5px;
    color: var(--ink-3);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- 列表 ---------- */

.wl-day { margin-bottom: 18px; }

.wl-day-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 0 2px 7px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2px;
}
.wl-day-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.wl-day-sub { font-size: 11.5px; color: var(--ink-5); }
.wl-day-count {
    margin-left: auto;
    font-size: 11.5px;
    color: var(--ink-5);
}

.wl-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 2px;
    border-bottom: 1px solid var(--line);
}
.wl-item:last-child { border-bottom: none; }
.wl-item:hover { background: var(--bg-subtle); }

.wl-item-main { flex: 1 1 auto; min-width: 0; }

.wl-item-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}
.wl-time {
    font-size: 11.5px;
    color: var(--ink-4);
    font-variant-numeric: tabular-nums;
}

/* 正文：默认收三行，超出显示省略号。
   点开看全文 —— 一条日志可能有几百字，全摊开会把列表拉成一张长卷 */
.wl-item-text {
    font-size: 13px;
    line-height: 1.62;
    color: var(--ink-2);
    white-space: pre-wrap;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.wl-item.open .wl-item-text {
    display: block;
    overflow: visible;
}
.wl-item.open .wl-item-text::after { content: none; }

.wl-item { cursor: default; }
.wl-item-main { cursor: pointer; }

.wl-item-ops {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
    padding-top: 1px;
    /* 默认半透明：操作不常点，但也不能藏起来——
       藏到 hover 才出现的话，手机上根本没有 hover */
    opacity: .55;
    transition: opacity .12s;
}
.wl-item:hover .wl-item-ops { opacity: 1; }

.link-danger { color: var(--ink-4); }
.link-danger:hover { color: var(--danger); }
.link-danger[data-confirm="1"] { color: var(--danger); font-weight: 600; }

.wl-dash { font-size: 12px; color: var(--ink-4); }

/* ---------- 手机 ---------- */

@media (max-width: 860px) {
    .wl-meta { gap: 8px; }
    .wl-meta-item .input,
    .wl-meta-item .select { min-width: 96px; height: 36px; }
    .wl-meta-wide { flex: 1 1 100%; }
    .wl-body { min-height: 76px; }

    /* 收尾两栏在手机上并排只剩不到 170px，写一行断三行，改单列 */
    .wl-close-grid { grid-template-columns: 1fr; gap: 10px; }
    .wl-close-item .textarea { min-height: 70px; }

    .wl-item { flex-direction: column; gap: 6px; }
    .wl-item-ops {
        opacity: 1;
        align-self: flex-end;
        gap: 16px;
    }
    .wl-att-chip .wl-att-name { max-width: 120px; }
}

/* 全员日志表格：内容列收三行
   一条日志可能有几百字，全摊开会让每行高度不受控，
   一屏只能看三条，翻页就失去了意义 */
.wl-cell-clip {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--ink-2);
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 520px;
}

/* 收尾两列：列宽本来就窄，两行封顶，全文在 title 里。
   不给 max-width，表格的定宽列会把它撑破 */
.wl-cell-clip-2 {
    -webkit-line-clamp: 2;
    max-width: 100%;
}

@media (max-width: 640px) {
    /* 手机上「已保存 17:22:29」会把保存按钮挤到下一行，
       而那个时间戳对手机用户没有意义 —— 列表已经变了就是保存成功了 */
    #saveHint { display: none; }
    .wl-foot { gap: 8px; }
    .wl-foot #btnSave { margin-left: auto; }
}

/* ============================================================
   ES-IA-v1.0 两层菜单（2026-11-04）
   7 个大菜单可折叠，子菜单缩进一级；未开发项置灰不可点。
   加这一段不改任何既有选择器，老页面的单层样式不受影响。
   ============================================================ */

.nav-direct {
    display: flex;
    align-items: center;
    height: 34px;
    padding: 0 10px;
    margin-top: 10px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
}
.nav-direct:hover { background: var(--bg-subtle); }
.nav-direct.active { background: var(--brand-weak); color: var(--brand); }

.nav-group { margin-top: 2px; }

.nav-group > .g-head {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 10px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
    cursor: pointer;
    user-select: none;
}
.nav-group > .g-head:hover { background: var(--bg-subtle); color: var(--ink); }

/* 小三角：用边框画，不用图标字体 —— 断网也要能渲染 */
.nav-group > .g-head .chev {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    margin-left: 1px;
    border-right: 1.4px solid var(--ink-5);
    border-bottom: 1.4px solid var(--ink-5);
    transform: rotate(-45deg);
    transition: transform .16s ease;
}
.nav-group.open > .g-head .chev { transform: rotate(45deg); }
.nav-group > .g-head .n {
    margin-left: auto;
    font-size: 10.5px;
    font-weight: 400;
    color: var(--ink-5);
}

.nav-group > .g-body { display: none; padding: 1px 0 5px; }
.nav-group.open > .g-body { display: block; }

/* 子项缩进一级，和小三角对齐感更强 */
.nav-group .nav-item { padding-left: 26px; font-size: 12.5px; }

/* 未开发的功能：置灰 + 角标，不给链接 */
.nav-item.soon,
.nav-item.soon:hover {
    color: var(--ink-5);
    background: transparent;
    cursor: default;
}
.nav-item.soon em {
    margin-left: auto;
    font-style: normal;
    font-size: 9.5px;
    color: var(--ink-4);
    background: var(--bg);
    border-radius: 6px;
    padding: 0 5px;
    line-height: 16px;
    height: 16px;
}


/* ============================================================
   折叠动画（2026-11-04）
   ------------------------------------------------------------
   原来是 display:none/block —— 这个属性不参与过渡，点下去是硬跳。
   改成 grid-template-rows 0fr → 1fr：
     · 纯 CSS，不需要 JS 量 scrollHeight
     · 高度随子项数量自动适应（2 项和 7 项都顺）
     · Chrome 117+ / Safari 16.4+ 支持插值，本机 Edge 156 没问题
   动画只做「高度 + 箭头 + 淡入」三件事，不过度。
   ============================================================ */

.nav-group > .g-body-wrap {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .26s cubic-bezier(.4, 0, .2, 1);
}
.nav-group.open > .g-body-wrap {
    grid-template-rows: 1fr;
}

.nav-group > .g-body-wrap > .g-body {
    overflow: hidden;
    min-height: 0;          /* 没有这行，grid 子项会被内容撑开，动画失效 */
    padding: 0;
    transition: padding .26s cubic-bezier(.4, 0, .2, 1);
}
.nav-group.open > .g-body-wrap > .g-body {
    padding: 1px 0 5px;
}

/* 子项逐条落下：比「整块淡入」有方向感。
   不给 g-body 加 opacity，否则和子项叠加会淡两次，看着发灰。 */
.nav-group > .g-body-wrap > .g-body > * {
    opacity: 0;
    transform: translateX(-5px);
    transition: opacity .2s ease, transform .26s cubic-bezier(.4, 0, .2, 1);
}
.nav-group.open > .g-body-wrap > .g-body > * {
    opacity: 1;
    transform: translateX(0);
}
.nav-group.open > .g-body-wrap > .g-body > *:nth-child(1) { transition-delay: .05s; }
.nav-group.open > .g-body-wrap > .g-body > *:nth-child(2) { transition-delay: .08s; }
.nav-group.open > .g-body-wrap > .g-body > *:nth-child(3) { transition-delay: .11s; }
.nav-group.open > .g-body-wrap > .g-body > *:nth-child(4) { transition-delay: .14s; }
.nav-group.open > .g-body-wrap > .g-body > *:nth-child(5) { transition-delay: .16s; }
.nav-group.open > .g-body-wrap > .g-body > *:nth-child(6) { transition-delay: .18s; }
.nav-group.open > .g-body-wrap > .g-body > *:nth-child(7) { transition-delay: .20s; }

/* 箭头转得更跟手 */
.nav-group > .g-head .chev {
    transition: transform .26s cubic-bezier(.4, 0, .2, 1);
}

/* 组头与菜单项的 hover 也加一点过渡，不然只有折叠在动、其它是硬切 */
.nav-group > .g-head,
.nav-item,
.nav-direct {
    transition: background-color .15s ease, color .15s ease, padding-left .2s ease;
}

/* 尊重系统设置：关了动效就全部瞬时完成 */
/* 系统开了「减少动效」时怎么处理。
   ────────────────────────────────────────────────────────────
   2026-11-04 改过一次，原因值得记下来：
   原来这里写的是 transition: none !important，等于把折叠动画整个删掉。
   Windows 开了「设置 → 辅助功能 → 视觉效果 → 动画效果」的人，
   点菜单就是瞬间跳变 —— 从用户视角看，这不是"体贴的无障碍"，
   是"这个功能坏了"，而且怎么刷新都好不了。

   正确的做法是**减弱**而不是**消除**：
   - 时长压到 0.12s（原来 0.26s），几乎一笔带过，不会让人晕
   - 去掉横向位移和逐条延迟（位移和错峰最容易引起不适）
   - 保留高度过渡 —— 高度变化本身是必要信息（内容在展开），不是装饰
   ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .nav-group > .g-body-wrap,
    .nav-group > .g-body-wrap > .g-body {
        transition-duration: .2s !important;
    }
    .nav-group > .g-body-wrap > .g-body > * {
        transition: opacity .1s ease !important;
        transform: none !important;
        transition-delay: 0s !important;
    }
    .nav-group.open > .g-body-wrap > .g-body > * { transition-delay: 0s !important; }
    .nav-group > .g-head .chev,
    .user-chip .caret { transition-duration: .16s !important; }
    .nav-group > .g-head,
    .nav-item,
    .nav-direct { transition-duration: .1s !important; }
    .user-pop { transition-duration: .1s !important; }
}

/* ============================================================
   头像下拉（IA v1.0 §A2）
   名片 / 个人资料 / 改密从侧栏底部收进来 —— 一周点不了一次的东西
   不该常驻，但也不能藏到用户找不到，所以放头像后面。
   ============================================================ */

.user-menu { position: relative; }

.user-chip {
    background: none;
    border: none;
    font-family: inherit;
    padding: 4px 8px 4px 4px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .16s ease;
}
.user-chip:hover,
.user-menu.open .user-chip { background: var(--bg-subtle); }

.user-chip .caret {
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    margin-left: 1px;
    border-right: 1.3px solid var(--ink-5);
    border-bottom: 1.3px solid var(--ink-5);
    transform: rotate(45deg) translate(-1px, 1px);
    transition: transform .22s cubic-bezier(.4, 0, .2, 1);
}
.user-menu.open .user-chip .caret { transform: rotate(-135deg) translate(-1px, 1px); }

.user-pop {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 154px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(44, 44, 42, .13);
    padding: 5px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px) scale(.985);
    transform-origin: top right;
    transition: opacity .16s ease,
                transform .19s cubic-bezier(.4, 0, .2, 1),
                visibility .16s;
    z-index: 60;
}
.user-menu.open .user-pop {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.user-pop a,
.user-pop .pop-quit {
    display: block;
    width: 100%;
    padding: 7px 10px;
    border: none;
    background: none;
    border-radius: 7px;
    font: inherit;
    font-size: 13px;
    color: var(--ink-2);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
.user-pop a:hover,
.user-pop .pop-quit:hover { background: var(--bg-subtle); color: var(--ink); }
.user-pop .pop-quit:hover { color: var(--danger); }
.pop-sep { height: 1px; background: var(--line); margin: 5px 4px; }

.build-tag.warn { color: #BA7517; margin-left: 4px; }

.build-tag {
    font-size: 10.5px;
    color: var(--ink-5);
    letter-spacing: .03em;
    cursor: text;
    user-select: text;
}

/* ============================================================
   日志填写弹层（2026-11-04）
   原来表单常驻页内，占了近半屏；改成一行入口 + 浮窗后列表回到首屏。
   一份 DOM 两种形态：小屏右侧抽屉，PC 居中浮窗。
   规范见 docs/29-弹层与URL规范-v1.0.md
   ============================================================ */

.wl-bar { display: flex; align-items: center; gap: 16px; padding: 14px 18px; }
.wl-bar-l { min-width: 0; }
.wl-bar-t { font-size: 14px; font-weight: 500; color: var(--ink); }
.wl-bar-t strong { color: var(--brand); font-size: 16px; margin: 0 2px; }
.wl-bar-s { font-size: 12px; color: var(--ink-4); margin-top: 2px; }

.wl-mask {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(44, 44, 42, .32);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .2s ease, visibility .2s;
}
.wl-mask.on { opacity: 1; visibility: visible; pointer-events: auto; }

.wl-sheet {
    position: absolute; right: 0; top: 0; bottom: 0; width: min(520px, 94vw);
    background: var(--surface); display: flex; flex-direction: column;
    box-shadow: -8px 0 30px rgba(44, 44, 42, .12);
    transform: translateX(100%);
    transition: transform .26s cubic-bezier(.4, 0, .2, 1);
}
.wl-mask.on .wl-sheet { transform: translateX(0); }

.wl-sheet-head {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 20px; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.wl-sheet-x {
    border: none; background: none; font-size: 18px; line-height: 1;
    color: var(--ink-4); cursor: pointer; padding: 2px 6px; border-radius: 6px;
    transition: color .12s, background .12s;
}
.wl-sheet-x:hover { color: var(--ink); background: var(--bg-subtle); }

/* 只有中间这段滚，头和脚永远看得见 —— 长日志也不怕找不到保存按钮 */
.wl-sheet-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 20px; min-height: 0;
    display: flex; flex-direction: column; }
/* 正文吃掉剩余空间：弹窗拉高了，空着也是空着 */
.wl-sheet-body .wl-body { flex: 1 1 auto; min-height: 150px; }
.wl-sheet-body .wl-atts { flex: 0 0 auto; }
.wl-sheet-foot {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 12px 20px; border-top: 1px solid var(--line); flex: 0 0 auto;
}

@media (min-width: 900px) {
    .wl-mask { display: grid; place-items: center; padding: 32px 24px; }
    .wl-sheet {
        /* 写日志是这个页面的主要动作，弹窗不能只有 330 高，
           正文框被压到三行，看起来像「随便写点」 */
        min-height: min(540px, 84vh);
        position: relative; right: auto; top: auto; bottom: auto;
        width: min(680px, 100%);
        max-height: min(86vh, 780px);
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 16px 56px rgba(44, 44, 42, .2);
        transform: translateY(10px) scale(.985);
        opacity: 0;
        transition: transform .22s cubic-bezier(.4, 0, .2, 1), opacity .18s ease;
    }
    .wl-mask.on .wl-sheet { transform: translateY(0) scale(1); opacity: 1; }
    .wl-sheet-head { border-radius: 12px 12px 0 0; }
    .wl-sheet-foot { border-radius: 0 0 12px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .wl-mask, .wl-sheet { transition-duration: .12s; }
}

/* ---------- 全员日志详情浮层（复用 .wl-sheet 外壳） ---------- */
.wl-row { cursor: pointer; }
.wl-row:hover { background: var(--bg-subtle); }

.wl-dt-entry { padding: 12px 0; border-bottom: 1px solid var(--line); }
.wl-dt-entry:last-child { border-bottom: none; padding-bottom: 0; }
.wl-dt-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.wl-dt-k { font-size: 12px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.wl-dt-k2 { font-size: 12px; color: var(--ink-4); margin: 10px 0 4px; }
.wl-dt-text {
    font-size: 13.5px; line-height: 1.72; color: var(--ink-2);
    white-space: pre-wrap; word-break: break-word;
}
.wl-dt-sec { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.wl-dt-h { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-bottom: 8px; }

/* ============================================================
   基础设置三页（账套 / 会计科目 / 对应关系）
   只加 .su- 与 .fs- 前缀，不碰既有类。
   ============================================================ */

.su-note {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 10px 14px; border-radius: 9px;
    background: #FDF6E7; border: 1px solid #F0E0BE50;
    font-size: 12.5px; line-height: 1.7; color: #7A5A16;
    margin-bottom: 14px;
}
.su-note b { font-weight: 600; }
.su-note .su-x { margin-left: auto; }

.su-code {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 12.5px; color: var(--ink-2); letter-spacing: .02em;
}
.su-tag {
    display: inline-block; padding: 1px 7px; border-radius: 6px;
    font-size: 11px; line-height: 17px; white-space: nowrap;
}
.su-tag.ok { background: #E8F3E0; color: #3B6D11; }
.su-tag.warn { background: #FDF2DB; color: #8A5A0B; }
.su-tag.off { background: var(--bg); color: var(--ink-4); }

.su-empty {
    padding: 40px 20px; text-align: center; color: var(--ink-4);
}
.su-empty .e-icon { font-size: 26px; margin-bottom: 8px; opacity: .6; }
.su-empty .e-title { font-size: 14px; color: var(--ink-2); margin-bottom: 5px; }
.su-empty .e-sub { font-size: 12.5px; line-height: 1.7; }

/* 表单：modal 里的字段 */
.fs-row { margin-bottom: 13px; }
.fs-row > label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 5px; }
.fs-row .input, .fs-row .select, .fs-row textarea { width: 100%; }
.fs-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fs-hint { font-size: 11.5px; color: var(--ink-4); line-height: 1.65; margin-top: 6px; }
.fs-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
@media (max-width: 560px) { .fs-2 { grid-template-columns: 1fr; } }

/* 映射页的下拉：宽一点，科目名很长 */
.map-sel { width: 100%; min-width: 180px; font-size: 12.5px; }
