/* 财务助手：PC（≥1024px）左侧分组侧栏，窄屏顶栏 + 下拉菜单。移动优先，只用 min-width 640 / 1024 两个断点。
   通用组件只在这里定义；audit.css / ops.css 只放页面专属规则。不依赖外部字体和 CDN。
   视觉取自 coss ui（https://coss.com/ui，MIT）的浅色主题：Tailwind neutral 灰阶、近黑主色、半透明边框、细阴影、大圆角。
   只搬样式值，不引入 React / Tailwind；色值是 Tailwind 色板的 hex 近似。 */
:root {
  color-scheme: light;
  --bg: #fff; --card: #fff; --side: #fafafa;           /* background / card / sidebar（neutral-50） */
  --text: #262626; --muted: #686868;                    /* foreground（neutral-800）/ muted-foreground */
  --nav-text: #6b6b6b;                                  /* sidebar-foreground（在侧栏底色和悬停底色上都 ≥4.5:1） */
  --line: rgba(0, 0, 0, .08);                           /* border：装饰分隔线 */
  --input: rgba(0, 0, 0, .1);                           /* input：输入框、次要按钮边框 */
  --line-strong: #a3a3a3;                               /* 需要看得清的线框（步骤圆圈等，neutral-400） */
  --brand: #262626; --brand-hover: #3c3c3c; --brand-bg: rgba(0, 0, 0, .04);   /* primary / primary 90% / accent */
  --link: var(--text);                                  /* 文字链接：coss 用正文色 + 下划线区分，不用蓝色 */
  --link-line: rgba(38, 38, 38, .32);                   /* 链接下划线：比文字浅，悬停加深 */
  --info: #1d4ed8; --info-bg: rgba(59, 130, 246, .08);  /* 提示类状态（info-foreground，blue-700） */
  --ok: #047857; --ok-bg: rgba(16, 185, 129, .08); --ok-line: rgba(16, 185, 129, .32);       /* emerald-700 / 500 */
  --bad: #b91c1c; --bad-bg: rgba(239, 68, 68, .08); --bad-line: rgba(239, 68, 68, .32);      /* red-700 / 500 */
  --bad-strong: rgba(239, 68, 68, .64); --bad-ring: rgba(239, 68, 68, .16);                  /* 校验出错的输入框边框 / 聚焦光圈 */
  --danger: #dc2626; --danger-hover: #c81e1e;                                                /* destructive 底色（red-600，白字 ≥4.5:1） */
  --warn-text: #92400e; --warn-bg: rgba(245, 158, 11, .08); --warn-line: #f59e0b;            /* amber-800（小字 ≥4.5:1）/ 500 */
  --warn-border: rgba(245, 158, 11, .32);
  --neutral-bg: rgba(0, 0, 0, .04); --head-bg: #fafafa; --hover-bg: #fafafa;
  --focus: #737373;                                     /* ring：coss 用 neutral-400，加深一级保证 ≥3:1 */
  --ring: rgba(115, 115, 115, .24);                     /* 输入框聚焦的 3px 浅色光圈 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r-tag: 6px; --r-sm: 8px; --r-ctl: 10px; --r-alert: 14px; --r-card: 16px; --r-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-pop: 0 10px 15px -3px rgba(0, 0, 0, .05), 0 4px 6px -4px rgba(0, 0, 0, .05);
  --gap: 12px; --card-pad: 12px 14px; --ctl-h: 36px; --topbar-h: 48px; --side-w: 216px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 8px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 0.9375rem/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}
/* 文字链接（coss：text-foreground + underline underline-offset-4）；做成组件的链接（按钮、菜单、tab、卡片）在各自规则里去掉下划线 */
a { color: var(--link); font-weight: 500; text-decoration: underline; text-decoration-color: var(--link-line); text-decoration-thickness: 1px; text-underline-offset: 4px; }
/* 触屏点击后 :hover 会粘住（像又选中了一个），悬停样式只给能悬停的设备 */
@media (hover: hover) {
  a:hover { text-decoration-color: currentColor; }
}
h1, h2, h3 { line-height: 1.3; }
h1 { font-size: 18px; margin: 0 0 var(--s3); }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: var(--s3) 0 var(--s2); }
h1 small, h2 small { color: var(--muted); font-weight: normal; font-size: 13px; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.bad { color: var(--bad); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* 做成组件的链接：不要文字链接的下划线和加粗 */
.brand, .nav-group a, .tabs a, .chips a, .months a, .stats a, a.btn, .portal-tile, a.count-pill { text-decoration: none; }

/* ---------- 布局外壳 ---------- */
.skip-link {
  position: absolute; left: var(--s2); top: -100px; z-index: 100;
  background: var(--card); color: var(--text); padding: var(--s2) var(--s3); text-decoration: none;
  border: 2px solid var(--focus); border-radius: var(--r-ctl);
}
.skip-link:focus { top: var(--s2); }
.mock-banner {
  background: var(--danger); color: #fff; text-align: center; font-weight: 600;
  padding: 6px 12px; font-size: 14px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); white-space: nowrap; }
/* 品牌：主色方块标志（白色线性图标）+ 「财务助手」/「路源酒店（海南）」两行 */
.brand-mark {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border-radius: var(--r-sm); background: var(--brand); color: #fff; font-size: 15px; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), var(--shadow-xs);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; text-align: left; }
.brand-text b { font-size: 15px; font-weight: 600; }
.brand-text small { font-size: 12px; font-weight: normal; color: var(--muted); }
@media (hover: hover) {
  .brand:hover { text-decoration: none; }
}
.guest-head { padding: var(--s4) var(--s4) 0; text-align: center; }

/* 窄屏：sticky 顶栏，导航是顶栏下方的下拉层 */
.sidebar {
  position: sticky; top: 0; z-index: 30;
  background: var(--side); border-bottom: 1px solid var(--line);
}
.side-head { display: flex; align-items: center; gap: var(--s2); height: var(--topbar-h); padding: 0 var(--s3) 0 var(--s4); }
.page-name { flex: 1; min-width: 0; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-name::before { content: "·"; margin-right: var(--s2); }
button.nav-toggle { background: var(--card); color: var(--text); border-color: var(--input); box-shadow: var(--shadow-xs); padding: 4px 12px; }
@media (hover: hover) {
  button.nav-toggle:hover { background: var(--hover-bg); border-color: var(--input); }
}
.nav-toggle::after { content: ""; display: inline-block; margin-left: 6px; vertical-align: 3px;
  border: 4px solid transparent; border-top-color: currentColor; border-bottom-width: 0; }
.nav-open .nav-toggle::after { border-top-width: 0; border-bottom: 4px solid currentColor; }
.sidenav {
  position: absolute; left: 0; right: 0; top: 100%;
  max-height: calc(100vh - var(--topbar-h));
  max-height: calc(100dvh - var(--topbar-h));   /* iOS 工具栏不挡住底部「退出」；旧内核忽略此行 */
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--side); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-pop);
  padding: var(--s2) var(--s3) var(--s3);
  visibility: hidden; opacity: 0; transform: translateY(-4px);
  transition: opacity .15s, transform .15s, visibility 0s .15s;
}
.nav-open .sidenav { visibility: visible; opacity: 1; transform: none; transition: opacity .15s, transform .15s; }
.nav-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }   /* 选中和悬停的底色不连在一起 */
.nav-title { font-size: 12px; color: var(--muted); padding: var(--s3) var(--s3) var(--s1); }
.nav-group:first-child .nav-title { padding-top: var(--s1); }
.nav-group a {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--r-ctl); color: var(--nav-text); font-size: 14px; font-weight: 500;
}
.nav-icon { flex: none; width: 16px; height: 16px; opacity: .8; }
.nav-group a.on .nav-icon { opacity: 1; }
@media (hover: hover) {
  .nav-group a:hover { background: var(--neutral-bg); color: var(--text); text-decoration: none; }
}
.nav-group a.on { background: var(--brand-bg); color: var(--text); }
.side-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3);
  margin-top: var(--s3); padding: var(--s3) var(--s3) 0; border-top: 1px solid var(--line); font-size: 14px;
}
.who { min-width: 0; overflow-wrap: anywhere; }
.who small { color: var(--muted); }
/* 链接样式的按钮（coss button link 变体）：正文色、平时没有下划线，悬停才有 */
.logout, .back { text-decoration: none; }
@media (hover: hover) {
  .logout:hover, .back:hover { text-decoration: underline; text-decoration-color: currentColor; }
}
.logout { margin-left: auto; white-space: nowrap; }

.main { width: 100%; min-width: 0; padding: var(--s3); }   /* 不限最大宽度：宽屏上也铺满，右侧不留白 */

/* ---------- 页面头、卡片、栅格 ---------- */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--s2) var(--s4); margin-bottom: var(--s4);
}
.page-head h1 { margin: 0; }
.page-head p { margin: var(--s1) 0 0; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-xs);
  padding: var(--card-pad); margin-bottom: var(--gap); min-width: 0;
}
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.card.narrow { max-width: 480px; margin: var(--s5) auto; }
/* 登录表单：标签贴着输入框（.field），两组之间留间距，按钮占满一行 */
.login-form { display: grid; gap: var(--s2); margin-top: var(--s3); }
.login-form .field { margin-bottom: var(--s1); gap: 6px; }
.login-form input { width: 100%; }
.login-form button { margin-top: var(--s2); }
/* 建设中的页面（placeholder.html）：左对齐，说明限行宽；平台后台列成链接卡片 */
.placeholder { max-width: 760px; }
.ph-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-bottom: var(--s2); }
.ph-head h1 { margin: 0; }
.ph-note { margin: 0; max-width: 40em; color: var(--muted); line-height: 1.7; }
.ph-sub { margin: var(--s5) 0 var(--s2); font-size: 14px; font-weight: 600; }
.portal-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
.portal-tile {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--input); border-radius: var(--r-ctl); background: var(--card); box-shadow: var(--shadow-xs);
  color: var(--text); font-size: 14px; font-weight: 500; overflow-wrap: anywhere;
}
@media (hover: hover) {
  .portal-tile:hover { background: var(--hover-bg); border-color: var(--line-strong); text-decoration: none; }
}
@media (min-width: 640px) {
  .portal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* 外链图标（Lucide arrow-up-right，内嵌 SVG 作遮罩，颜色跟文字） */
.ext-icon {
  display: inline-block; flex: none; width: 14px; height: 14px; margin-left: 2px; vertical-align: -2px; opacity: .6; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 7h10v10'/%3E%3Cpath d='M7 17 17 7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 7h10v10'/%3E%3Cpath d='M7 17 17 7'/%3E%3C/svg%3E") center / contain no-repeat;
}
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.grid .card, .stack .card { margin-bottom: 0; }
.stack { display: grid; gap: var(--gap); align-content: start; min-width: 0; }

/* ---------- 按钮 ---------- */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s1);
  min-height: var(--ctl-h); padding: 6px 13px; border-radius: var(--r-ctl); border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font: inherit; font-size: 14px; font-weight: 500; line-height: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(38, 38, 38, .24);
  cursor: pointer; text-align: center; vertical-align: middle; transition: background-color .15s, box-shadow .15s;
}
.btn:active, button:active { box-shadow: inset 0 1px 0 rgba(0, 0, 0, .08); }
@media (hover: hover) {
  .btn:hover, button:hover { background: var(--brand-hover); border-color: var(--brand-hover); text-decoration: none; }
}
.secondary, .btn-sec {
  background: var(--card); color: var(--text); border-color: var(--input); box-shadow: var(--shadow-xs);
}
.secondary:active, .btn-sec:active { box-shadow: none; }
@media (hover: hover) {
  .secondary:hover, .btn-sec:hover {
    background: var(--hover-bg); border-color: var(--input); color: var(--text);
  }
}
.btn-sm { min-height: 28px; padding: 2px 9px; font-size: 13px; border-radius: var(--r-sm); }
/* 和输入框 / 下拉框同在一个容器里的小按钮（「查看」「上传」）和它们同高，不在一行里矮一截；只跟隐藏字段在一起的不算 */
:is(input:not([type=checkbox], [type=radio], [type=hidden]), select) ~ .btn-sm { min-height: var(--ctl-h); padding-left: 12px; padding-right: 12px; }
button:disabled, .btn[aria-disabled="true"] { opacity: .64; cursor: not-allowed; box-shadow: none; }
/* 提交中（forms.js）：按钮前面转圈，比普通禁用更实，表示「在处理」不是「不能点」 */
button[data-busy]:disabled { opacity: .8; cursor: progress; }
button[data-busy]::before {
  content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* 危险操作的确认按钮（coss destructive） */
button.danger { background: var(--danger); border-color: var(--danger); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(220, 38, 38, .24); }
@media (hover: hover) {
  button.danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
}
@media (hover: hover) {
  button:disabled:hover { background: var(--brand); border-color: var(--brand); }
  button.secondary:disabled:hover, button.btn-sec:disabled:hover { background: var(--card); border-color: var(--input); }
}

/* ---------- 表单 ---------- */
input:not([type]), input[type=text], input[type=search], input[type=number], input[type=date], input[type=month],
input[type=email], input[type=password], input[type=file], select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--card);
  min-height: var(--ctl-h); padding: 5px 11px; border: 1px solid var(--input); border-radius: var(--r-ctl);
  box-shadow: var(--shadow-xs); min-width: 0; max-width: 100%; transition: border-color .15s, box-shadow .15s;
}
/* 聚焦：边框加深 + 3px 浅色光圈（coss 的 ring），代替全局的 outline */
input:not([type]):focus-visible, input[type=text]:focus-visible, input[type=search]:focus-visible, input[type=number]:focus-visible,
input[type=date]:focus-visible, input[type=month]:focus-visible, input[type=email]:focus-visible, input[type=password]:focus-visible,
input[type=file]:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--ring);
}
::placeholder { color: var(--muted); opacity: .72; }
/* 输入框和按钮拼成一个控件（coss input group）：相邻处去掉圆角、边框重叠 */
.input-group { display: inline-flex; align-items: stretch; margin: 0; }
.input-group > :is(input, select):not([type=hidden]) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > button { margin-left: -1px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group > :focus-visible { position: relative; z-index: 1; }
/* 文件框里的「选择文件」：coss 的 file: 样式，去掉系统灰按钮，只留加粗文字 */
input[type=file]::file-selector-button {
  margin-right: var(--s3); padding: 0; border: 0; background: none; color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
}
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
/* 字段校验（forms.js 加 aria-invalid 和下面的 .field-msg）：出错标红，原因写在字段下面 */
[aria-invalid="true"]:is(input, select, textarea) { border-color: var(--bad-strong); }
[aria-invalid="true"]:is(input, select, textarea):focus-visible { border-color: var(--bad-strong); box-shadow: 0 0 0 3px var(--bad-ring); }
input[type=checkbox][aria-invalid="true"] { outline: 2px solid var(--bad-strong); outline-offset: 1px; }
.field-msg { flex-basis: 100%; margin: 2px 0 0; font-size: 13px; font-weight: normal; color: var(--muted); overflow-wrap: anywhere; }
.field-msg.is-error { color: var(--bad); }
.field-msg[hidden] { display: none; }
.form-row > .field-msg { margin-top: calc(var(--s2) * -1); }   /* 抵掉字段的下边距，提示贴着上面的输入框 */
.toolbar:has(> .field-msg:not([hidden])) { flex-wrap: wrap; }   /* PC 上工具栏不换行，有提示时让它换到下一行 */
/* 拖文件进窗口：文件框变虚线提示可以放；放到哪个框上，哪个框加深 */
.dragging-files input[type=file] { border-style: dashed; border-color: var(--line-strong); background: var(--hover-bg); }
.dragging-files input[type=file].drop-over { border-color: var(--text); box-shadow: 0 0 0 3px var(--ring); }
.check { display: inline-flex; align-items: center; gap: 6px; }
.field { display: flex; flex-direction: column; gap: 2px; min-width: 0; max-width: 100%; margin-bottom: var(--s2); }
.field > span { font-size: 13px; font-weight: 500; color: var(--text); }
.field select { min-width: 10em; }
.field.check { flex-direction: row; align-items: center; gap: 6px; padding-bottom: var(--s2); }
.field[hidden] { display: none; }
.form-row { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: flex-end; }

/* 工具栏 / 筛选：窄屏两列换行，PC 单行、按钮靠右 */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2) var(--s3); margin-bottom: var(--gap); }
.toolbar .field { flex: 1 1 140px; margin-bottom: 0; }
.toolbar .field select, .toolbar .field input { width: 100%; min-width: 0; }   /* 窄屏两列时不让 .field select 的最小宽度撑出 */
.toolbar-btns { display: flex; flex-wrap: wrap; gap: var(--s2); margin-left: auto; }

/* 分段切换（月份、营业日、草稿文件；coss segmented control）：浅灰底槽，当前项白底浮起；项多时横向滚动 */
.chips, .months {
  display: flex; gap: 2px; width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: thin;
  padding: 3px; margin: 0 0 var(--s3); background: var(--neutral-bg); border-radius: var(--r-ctl);
}
.chips a, .months a {
  flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 30px; padding: 2px 12px;
  border: 1px solid transparent; border-radius: var(--r-sm); color: var(--muted);
  font-size: 14px; font-weight: 500; white-space: nowrap; transition: color .15s, background-color .15s;
}
.chips a:focus-visible, .months a:focus-visible { outline-offset: -2px; }   /* 滚动容器会裁掉外侧的焦点框 */
@media (hover: hover) {
  .chips a:hover, .months a:hover { color: var(--text); text-decoration: none; }
}
.chips a.on, .months a.on { background: var(--card); border-color: var(--line); color: var(--text); box-shadow: var(--shadow-xs); }

/* 标签页（同一页的两种看法）：下划线标出当前页 */
.tabs { display: flex; gap: var(--s5); border-bottom: 1px solid var(--line); margin-bottom: var(--s4); }
.tabs a {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 2px; margin-bottom: -1px;
  color: var(--muted); font-size: 15px; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--brand); }
@media (hover: hover) {
  .tabs a:hover { color: var(--text); text-decoration: none; }
}
/* 数量角标 */
.count-pill {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--bad); color: #fff; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
/* 文字样式的按钮（撤销、移除、换一个文件等次要操作）：下划线和文字链接一样浅、悬停加深；行内小表单 */
button.linkish, summary.linkish {
  min-height: 0; padding: 2px; border: 0; background: none; box-shadow: none; color: var(--link); font-size: 14px; font-weight: normal;
  text-decoration: underline; text-decoration-color: var(--link-line); text-decoration-thickness: 1px; text-underline-offset: 4px;
}
summary.linkish { cursor: pointer; width: fit-content; }
@media (hover: hover) {
  button.linkish:hover, summary.linkish:hover { background: none; color: var(--link); text-decoration-color: currentColor; }
}
.flash button.linkish { color: inherit; font-weight: 600; }
form.inline-form { display: inline; margin: 0; }

/* ---------- 表格：外层横向滚动；不给 <table> 加 class ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* 横向滚动阴影（纯 CSS）：两层随内容滚动的白色遮罩（local）盖住两层贴边阴影（scroll），
   滚到哪一端，那一端的遮罩就盖住阴影；不需要滚动时两端都被盖住。遮罩色 = 卡片底色，表格都在 .card 里 */
.table-wrap, .md-table {
  background-image:
    linear-gradient(to right, var(--card) 30%, rgba(255, 255, 255, 0)),
    linear-gradient(to left, var(--card) 30%, rgba(255, 255, 255, 0)),
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .16), rgba(0, 0, 0, 0)),
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .16), rgba(0, 0, 0, 0));
  background-position: left center, right center, left center, right center;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-repeat: no-repeat;
  background-attachment: local, local, scroll, scroll;
}
table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.5; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 10px; text-align: left; white-space: nowrap; vertical-align: top; }
th { background: var(--head-bg); font-weight: 500; color: var(--muted); }
@media (hover: hover) {
  .table-wrap tbody tr:hover > td, .md-table tbody tr:hover > td { background: var(--hover-bg); }
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num, td.num { width: 1%; }   /* 金额列收紧到内容宽度，多出来的宽度留给文字列（单元格默认不换行，1% 即按内容） */
/* 应收核对的分组明细：固定列宽，各组表格的列上下对齐；日期、凭证号、金额定宽，应收账户 28%、客人 18%，剩下的给备注。
   定宽 368px + 46%，表格不窄于 840px 时备注至少留约 85px；更窄的屏幕横向滚动 */
.ar-items table { table-layout: fixed; min-width: 840px; }
.ar-items .c-date { width: 96px; }
.ar-items .c-no { width: 80px; }
.ar-items .c-amt { width: 96px; }
.ar-items .c-acct { width: 28%; }
.ar-items .c-guest { width: 18%; }
.ar-items td.wrap { min-width: 0; }
td:empty::before { content: "—"; color: var(--muted); }   /* 没有数据的格子显示占位符（模板和 Markdown 报告的表格都适用） */
td.wrap { white-space: normal; min-width: 12em; overflow-wrap: anywhere; }
tfoot th, tfoot td { background: var(--head-bg); font-weight: 500; color: var(--text); }

/* Markdown 渲染的报告：表格铺满宽度，外层 .md-table（render.md 加的）太宽时横向滚动；和标题之间留出间距 */
.md { overflow-wrap: anywhere; }
.md-table { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: var(--s2) 0 var(--s4); }
.md td { font-variant-numeric: tabular-nums; }
.md h2, .md h3 { margin-top: var(--s5); }
.md ul, .md ol { padding-left: 1.2em; margin: 6px 0; }
.md p { margin: 6px 0; }

/* ---------- 状态徽标、级别、标签（统一尺寸） ---------- */
.st, .lv, .tag {
  display: inline-block; padding: 0 6px; border-radius: var(--r-tag); font-size: 12px; line-height: 20px;
  font-weight: 500; white-space: nowrap; background: var(--neutral-bg); color: var(--muted);
}
.tag { margin-right: 4px; }
.tag-off { background: var(--bad-bg); color: var(--bad); }
.st-ok, .st-handled, .lv-ok { background: var(--ok-bg); color: var(--ok); }
.st-failed, .lv-error { background: var(--bad-bg); color: var(--bad); }
.st-running, .st-open { background: var(--info-bg); color: var(--info); }
.st-pending, .st-ignored, .st-resolved, .lv-info { background: var(--neutral-bg); color: var(--muted); }
.lv-warn, .st-warn, .tag-warn { background: var(--warn-bg); color: var(--warn-text); }
/* 正在跑的任务（poll.js 轮询，跑完换成链接） */
.run-state { color: var(--warn-text); font-weight: 600; }
/* 失败的卡片（任务、写入日志、预检输出）：红边框、红标题 */
.card.fail { border-color: var(--bad); }
.card.fail h2 { color: var(--bad); }
/* 文件框 + 上传按钮一行；窄屏放不下时按钮换到下一行 */
.upload-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.upload-row input[type=file] { flex: 1 1 240px; }

/* ---------- 提示条：coss alert，整圈浅色边框 + 浅底 ---------- */
.flash, .alert, .note {
  margin: 0 0 var(--gap); padding: 10px 14px; border-radius: var(--r-alert);
  border: 1px solid var(--ok-line); background: var(--ok-bg); color: var(--text); overflow-wrap: anywhere;
}
.flash-error, .alert-bad { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad); }
.alert-warn, .note { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn-text); }
/* 空状态（coss empty）：标题 + 说明 + 下一步；只有一句话时就是灰字居中 */
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty-title { margin: 0; color: var(--text); font-weight: 500; font-size: 15px; }
.empty-desc { margin: var(--s1) auto 0; max-width: 32em; font-size: 14px; }
.empty .btn, .empty form { margin-top: var(--s3); }

/* ---------- 确认框（forms.js 的 data-confirm；coss alert dialog）：手机上贴底、PC 居中 ---------- */
.confirm-dialog {
  width: min(440px, calc(100% - 32px)); max-width: none; padding: 0; color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow-pop);
}
.confirm-dialog::backdrop { background: rgba(0, 0, 0, .32); }
.confirm-dialog form { padding: var(--s5); }
.confirm-dialog h2 { margin: 0 0 var(--s2); font-size: 17px; font-weight: 600; }
.confirm-dialog p { margin: 0; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
.dialog-actions { display: flex; flex-direction: column-reverse; gap: var(--s2); margin-top: var(--s5); }
@media (max-width: 639.98px) {
  .confirm-dialog { margin: auto 0 0; width: 100%; border-radius: var(--r-card) var(--r-card) 0 0; padding-bottom: env(safe-area-inset-bottom); }
}
@media (min-width: 640px) {
  .dialog-actions { flex-direction: row; justify-content: flex-end; }
}

/* ---------- 键值、统计块、日志、返回 ---------- */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.stats a {
  font-weight: normal;
  display: flex; flex-direction: column; min-width: 0; padding: var(--s3) var(--s4);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); color: var(--text);
  box-shadow: var(--shadow-xs);
}
@media (hover: hover) {
  .stats a:hover { border-color: var(--line-strong); text-decoration: none; }
}
.stats small { color: var(--muted); font-size: 13px; }
.stats b { font-size: 28px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats .stat-ok b { color: var(--ok); }
.stats .stat-bad { border-color: var(--bad-line); background: var(--bad-bg); }
.stats .stat-bad b { color: var(--bad); }

/* 系统状态里给维护看的原始错误：直接显示，长内容换行 */
.tech { margin-top: var(--s1); overflow-wrap: anywhere; }
pre.log {
  background: var(--brand); color: #e5e5e5; padding: 10px 12px; border-radius: var(--r-ctl); margin: 0;
  font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all;
  max-height: 70vh; overflow: auto;
}
/* 下载按钮 + 说明：说明放在按钮下面（灰色小字），不和按钮挤在一行 */
.dl { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s1); }
.dl-note { font-size: 13px; color: var(--muted); }
.back { display: inline-block; margin: 0 0 var(--s3); font-size: 14px; color: var(--muted); }

/* ---------- 工作台：需要你处理（每件事一张卡，按钮在右；手机上按钮占满一行） ---------- */
.sec-title { display: flex; align-items: center; gap: var(--s2); font-size: 16px; margin: 0 0 var(--s3); }
.todos { list-style: none; margin: 0 0 var(--s5); padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
.todo {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4);
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: var(--s3) var(--s4); box-shadow: var(--shadow-xs);
}
.todo-warn { border-left: 4px solid var(--warn-line); padding-left: calc(var(--s4) - 3px); }   /* 只有要注意的事留黄色色条；色条多出的 3px 从内边距扣掉，文字和其他卡片对齐 */
.todo-text { flex: 1 1 280px; min-width: 0; overflow-wrap: anywhere; }
.todo-text b { display: block; font-size: 16px; margin-top: var(--s1); }
.todo-text p { margin: 2px 0 0; color: var(--muted); }
.todo > .btn { flex: 1 1 100%; }
.todo-none { margin: 0 0 var(--s5); color: var(--ok); font-weight: 500; }
.done-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.sys dd { overflow-wrap: anywhere; }
@media (min-width: 640px) {
  .todo > .btn { flex: 0 0 auto; min-width: 7em; }
}

/* ---------- 登录页成员列表 ---------- */
.members { list-style: none; margin: 0; padding: 0; }
.members li + li { margin-top: var(--s2); }
.members button {
  width: 100%; justify-content: flex-start; text-align: left; flex-wrap: wrap; gap: var(--s2); padding: 12px;
  background: var(--card); color: var(--text); border-color: var(--input); box-shadow: var(--shadow-xs);
}
@media (hover: hover) {
  .members button:hover { background: var(--hover-bg); border-color: var(--line-strong); }
}
.members small { color: var(--muted); }
.members .roles { margin-left: auto; }

/* ---------- 平板（≥640px） ---------- */
@media (min-width: 640px) {
  .main { padding: var(--s4); }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card.narrow { margin-top: var(--s6); }
}

/* ---------- PC（≥1024px）：左侧 sticky 侧栏 ---------- */
@media (min-width: 1024px) {
  :root { --gap: 16px; --card-pad: 16px 20px; }
  html { scroll-padding-top: 48px; }
  body { font-size: 0.875rem; }
  h1 { font-size: 20px; }
  .shell.has-nav {
    display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh;
  }
  .has-nav .mock-banner { grid-column: 2; grid-row: 1; position: sticky; top: 0; z-index: 20; }
  .has-nav .main { grid-column: 2; grid-row: 2; padding: var(--s5) var(--s6); }
  .sidebar {
    grid-column: 1; grid-row: 1 / span 2; align-self: start;
    height: 100vh; display: flex; flex-direction: column;
    border-bottom: 0; border-right: 1px solid var(--line);
  }
  .side-head { flex: none; height: 64px; padding: 0 var(--s4) 0 14px; }   /* 标志中心（14 + 16）和菜单图标中心（12 + 10 + 8）对齐 */
  .page-name, .nav-toggle { display: none; }
  .sidenav {
    position: static; flex: 1; min-height: 0; max-height: none; display: flex; flex-direction: column;
    visibility: visible; opacity: 1; transform: none; transition: none;
    border-bottom: 0; box-shadow: none; padding: 0 var(--s3) var(--s4);
  }
  .side-foot { margin-top: auto; padding-top: var(--s4); }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-aside { grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); align-items: start; }   /* 左列卡片高度随内容，不拉到右列同高 */
  .toolbar { flex-wrap: nowrap; }
  .toolbar .field { flex: 0 1 auto; }
  .kv.kv-cols { grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); }
}

/* 触控设备：控件至少 40px 高；输入框 16px 防止 iOS 聚焦时自动放大 */
@media (pointer: coarse) {
  .btn, button:not(.linkish), .btn-sm, .chips a, .months a { min-height: 40px; }
  button.linkish, summary.linkish { padding: 10px 4px; }
  input:not([type]), input[type=text], input[type=search], input[type=number], input[type=date], input[type=month],
  input[type=email], input[type=password], input[type=file], select, textarea { min-height: 40px; font-size: 16px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  .nav-group a { padding-top: 10px; padding-bottom: 10px; }
  .logout { padding: 8px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* 岗位 tab 栏（base.html）：tab 多时横向滚动。.tabs a 的 margin-bottom: -1px 会让滚动容器多出 1px 竖向溢出、出现竖滚动条，
   所以底线改用内阴影（画在 tab 的下划线下面），tab 不再下移 */
.desk-tabs { gap: var(--s4); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
  border-bottom: 0; box-shadow: inset 0 -1px 0 var(--line); }
.desk-tabs a { margin-bottom: 0; }
/* 菜单里「系统」小标题（维护和业务岗位分开） */
.sidenav li.nav-title { padding: var(--s3) 10px var(--s1); }
/* 平台后台登录链接（新窗口打开） */
a.portal, .portal-line a { white-space: nowrap; font-size: 14px; }
.portal-line { margin: 0 0 var(--s2); }
