/* ============================================================================
   商场管理系统 v3 —— 样式（浅色主题）
   设计约束：
     · 桌面端为主（商管同事日常用电脑），移动端可用（签到、抄表场景）
     · 颜色语义固定：涨/正向用红、跌/负向用绿（国内习惯），危险操作用红
     · 不依赖任何 CSS 框架，样式全部在本文件，避免多端不一致
   ========================================================================== */

:root {
  --brand: #2b6de5;
  --brand-dark: #1f55b8;
  --brand-soft: #eaf1fe;

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --border: #e4e7ef;
  --border-strong: #d3d8e4;

  --text: #1f2430;
  --text-2: #4b5563;
  --muted: #8a92a6;

  --ok: #16a34a;
  --ok-soft: #e8f7ed;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --info: #0e7490;
  --info-soft: #e6f6fa;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(24, 32, 56, .05), 0 6px 20px rgba(24, 32, 56, .06);
  --shadow-lg: 0 12px 40px rgba(24, 32, 56, .16);
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }

/* ---------------------------------------------------------------------------
   hidden 属性必须永远生效。
   浏览器默认样式里 [hidden]{display:none} 的优先级极低，本项目大量使用
   el.hidden = true/false 控制显隐，而这些元素往往带着 .grid / .flex / .tag /
   .tabs-bar 等**声明了 display** 的类 —— 作者样式会盖掉默认规则，
   于是 hidden 被静默忽略：登录页在登录后不消失、外包字段一直露出来、
   单页签模块的页签栏不隐藏、未保存标记永远亮着。
   统一在这里兜住，比逐处写 style.display 可靠。
   --------------------------------------------------------------------------- */
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.grow { flex: 1; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover { background: var(--surface); border-color: var(--border-strong); color: var(--text); }

.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

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

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); color: var(--brand); }

.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }

.icon-btn {
  border: none; background: transparent; font-size: 18px; cursor: pointer;
  padding: 4px 8px; border-radius: var(--radius-sm); color: var(--text-2); font-family: inherit;
}
.icon-btn:hover { background: var(--surface-2); }

/* ============ 站内信 ============ */
.msg-btn { position: relative; }
.msg-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--danger); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center; font-weight: 600;
  font-family: inherit; box-sizing: border-box;
}
.msg-item { padding: 10px 8px; border-bottom: 1px solid var(--border); cursor: pointer; }
.msg-item:hover { background: var(--surface-2); }
/* 未读用左侧色条而不是整块底色：一屏十几条时底色会让文字对比度下降 */
.msg-item.unread { box-shadow: inset 3px 0 0 var(--brand); }

.link-btn {
  border: none; background: none; padding: 0; color: var(--brand);
  cursor: pointer; font-size: 13px; font-family: inherit;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.link-btn:disabled { color: var(--muted); cursor: not-allowed; text-decoration: none; }

/* ============ 表单 ============ */
.field { margin-bottom: 14px; }
.field label {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
}
/* `input:not([type])` 必须写进来：不写 type 的输入框 type 属性值为空，
   属性选择器匹配不到，于是它退回浏览器默认样式（宽度按 size 撑、无内边距、
   边框颜色也不一样）—— 页面上「就这一个框看着不对齐」基本都出在这里。 */
input[type=text], input:not([type]), input[type=password], input[type=number], input[type=date],
input[type=time], input[type=search], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(43, 109, 229, .12);
}
input::placeholder, textarea::placeholder { color: #b3b9c8; }
input:disabled, select:disabled { background: var(--surface-2); color: var(--muted); }
textarea { resize: vertical; min-height: 76px; }

select { appearance: none; background-image: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, #98a1b5 50%), linear-gradient(135deg, #98a1b5 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}

.form-error {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}
.form-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.pwd-box { position: relative; }
.pwd-box input { padding-right: 56px; }
.pwd-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: none; background: none; color: var(--brand); font-size: 12px;
  cursor: pointer; padding: 6px 8px; font-family: inherit;
}

/* 开关（配置页用） */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track {
  width: 42px; height: 24px; border-radius: 999px; background: #cfd5e2;
  position: relative; transition: background .18s; flex: none;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
  transition: transform .18s;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch .label-text { font-size: 13px; color: var(--text-2); }

/* 复选行 */
.check-line { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check-line input { width: auto; }

/* ============ 登录页 ============ */
.login-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background: linear-gradient(160deg, #f0f4fc 0%, #f6f7fb 45%, #eef2f8 100%);
}
.login-card {
  width: 100%; max-width: 380px; padding: 34px 30px 26px;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
}
.login-logo { width: 54px; height: 54px; border-radius: 14px; background: var(--brand-soft);
  display: flex; align-items: center; justify-content: center; font-size: 27px; margin: 0 auto 14px; }
.login-title { text-align: center; font-size: 20px; letter-spacing: .5px; }
.login-sub { text-align: center; font-size: 12px; color: var(--muted); margin: 5px 0 24px; letter-spacing: .6px; }
.login-foot { margin-top: 20px; text-align: center; font-size: 12px; color: var(--muted); line-height: 1.8; }
.crypto-warn { margin-top: 14px; color: var(--danger); font-size: 13px; }

/* ============ 主框架 ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 17px 16px; border-bottom: 1px solid var(--border); }
.brand-icon { font-size: 21px; }
.brand-name { font-weight: 600; font-size: 15px; }

.side-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-group { margin-bottom: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-2); cursor: pointer; font-size: 14px;
  border: none; background: none; width: 100%; text-align: left; font-family: inherit;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex: none; }
.nav-item .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sub { padding: 2px 0 6px 30px; }
.nav-sub button {
  display: block; width: 100%; text-align: left; padding: 6px 10px;
  border: none; background: none; border-radius: 6px;
  color: var(--text-2); font-size: 13px; cursor: pointer; font-family: inherit;
}
.nav-sub button:hover { background: var(--surface-2); color: var(--text); }
.nav-sub button.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }

.side-foot { padding: 12px; border-top: 1px solid var(--border); }
.side-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--brand); color: #fff; font-weight: 600;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.side-user-meta { min-width: 0; }
.side-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-role { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pwdBtn, #logoutBtn { margin-top: 4px; }

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

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.topbar-title h2 { font-size: 17px; }
.topbar-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar-right { margin-left: auto; }

.tabs-bar {
  display: flex; gap: 4px; padding: 0 22px; background: var(--surface);
  border-bottom: 1px solid var(--border); overflow-x: auto;
}
.tab {
  padding: 9px 13px; border: none; background: none; cursor: pointer;
  color: var(--text-2); font-size: 13.5px; font-family: inherit;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.content { padding: 20px 22px 40px; flex: 1; }

/* ============ 卡片 ============ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 14.5px; }
.card-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* 指标卡 */
.stat { padding: 15px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 600; margin-top: 4px; line-height: 1.25; }
.stat .u { font-size: 12px; color: var(--muted); margin-left: 4px; font-weight: 400; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.table th, table.table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
table.table th {
  background: var(--surface-2); font-weight: 600; font-size: 12.5px;
  color: var(--text-2); white-space: nowrap; position: sticky; top: 0;
}
table.table tbody tr:hover { background: #fafbfe; }
table.table tbody tr:last-child td { border-bottom: none; }
table.table td.ops { white-space: nowrap; }
table.table td.ops .link-btn { margin-right: 10px; }
table.table td.ops .link-btn:last-child { margin-right: 0; }

/* 未填报占位行（业绩明细的当日台账）：整行淡黄底 + 左侧色条，
   一眼能从「已报的数据行」里区分出来 —— 它没有数字，只有待办 */
table.table tbody tr.row-pending { background: #fffdf5; }
/* 抄表导入/工作台：读数倒退等硬异常行，一眼能扫出来 */
table.table tbody tr.row-warn { background: #fff6f6; }
table.table tbody tr.row-warn:hover { background: #ffefef; }
/* 工作台行数多（200+），行高收一点才能一屏看更多 */
table.table-dense th, table.table-dense td { padding: 6px 10px; font-size: 13px; }
table.table-dense td input { padding: 4px 6px; }
/* 数字列一律右对齐 + 等宽数字：铺位号、表号、读数上下能对齐，几百行扫下来不串行 */
table.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ============ 抄表录入（全表工作台） ============ */
.wb-toolbar { border-bottom: none; }
.wb-count { font-size: 12.5px; color: var(--text-2); }
/* 顶部一条完成度细线：不占高度，一眼知道还剩多少 */
.wb-progress { height: 3px; background: var(--surface-2); }
.wb-progress i { display: block; height: 100%; background: var(--brand); transition: width .25s ease; }

.wb-stat { padding: 12px 14px; gap: 10px; border-bottom: 1px solid var(--border); }
.wb-stat .stat { padding: 10px 13px; box-shadow: none; }
.wb-stat .stat .v { font-size: 20px; }

.wb-table td { vertical-align: middle; }
.wb-table tbody tr:hover { background: #f7f9fe; }
/* 输入框贴着右边缘，和上下的读数、用量对齐成一条竖线 */
.wb-input {
  width: 100%; padding: 5px 8px; text-align: right;
  font-variant-numeric: tabular-nums; font-size: 13.5px; font-weight: 600;
}
.wb-input:focus { font-weight: 700; }

/* 底部合计条常驻：填到第 80 行也知道这一趟抄了多少度电 */
.wb-foot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-top: 1px solid var(--border);
  background: var(--surface); border-radius: 0 0 var(--radius) var(--radius);
  position: sticky; bottom: 0; z-index: 5;
  box-shadow: 0 -1px 0 var(--border);
}
.wb-foot-nums { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.wb-foot-nums b { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.wb-sep { width: 1px; height: 14px; background: var(--border-strong); }
.wb-hint { font-size: 12px; }
.wb-modal-foot { display: flex; align-items: center; gap: 10px; width: 100%; }
/* 行详情顶部的一行事实：上期 / 倍数 / 铺位 / 用途 / 位置。
   以前是 3 张指标卡，标题长度不一导致数值基线上下错位，改为一行紧凑信息 */
.wb-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px 16px;
  padding: 10px 12px; margin-bottom: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12.5px; color: var(--muted);
}
.wb-meta b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.wb-meta-wide { grid-column: 1 / -1; }
table.table tbody tr.row-pending:hover { background: #fffaeb; }
table.table tbody tr.row-pending td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

/* 环比涨跌：国内习惯 —— 涨红跌绿（与欧美相反）。
   这里刻意不复用 --ok/--danger，因为它们语义是「成功/危险」，
   而「生意变好」用绿色会让商管同事第一眼读反。 */
.c-up { color: #dc2626; font-weight: 600; }
.c-down { color: #16a34a; font-weight: 600; }
/* 指标卡上的涨跌（statRow 的 cls 落在 .v 上）：同样涨红跌绿 */
.stat .v.up { color: #dc2626; }
.stat .v.down { color: #16a34a; }

/* ============ 标签 ============ */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.tag-ok { background: var(--ok-soft); color: #15803d; border-color: #c4e8d1; }
.tag-warn { background: var(--warn-soft); color: #b45309; border-color: #f2ddb8; }
.tag-danger { background: var(--danger-soft); color: var(--danger); border-color: #f4c6c6; }
.tag-info { background: var(--info-soft); color: var(--info); border-color: #bfe6ee; }
.tag-brand { background: var(--brand-soft); color: var(--brand-dark); border-color: #c7dafb; }
.tag-ghost { background: transparent; }

/* ============ 页签栏 ============ */
.seg { display: inline-flex; padding: 3px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; gap: 2px; }
.seg button {
  padding: 5px 14px; border: none; background: none; border-radius: 6px;
  font-size: 13px; color: var(--text-2); cursor: pointer; font-family: inherit;
}
.seg button.active { background: var(--surface); color: var(--brand-dark); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ============ 工具条 ============ */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.toolbar .search { width: 220px; }
.toolbar select { width: auto; min-width: 130px; }

/* ============ 分页 ============ */
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }

/* ============ 空态与提示 ============ */
.empty { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty .big { font-size: 30px; display: block; margin-bottom: 8px; opacity: .6; }

.notice { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.notice-warn { background: var(--warn-soft); border-color: #f2ddb8; color: #92400e; }
.notice-info { background: var(--info-soft); border-color: #bfe6ee; color: #0e5f70; }
.notice-danger { background: var(--danger-soft); border-color: #f4c6c6; color: #991b1b; }
.notice-ok { background: var(--ok-soft); border-color: #c4e8d1; color: #166534; }

.alert-strip {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 10px;
  background: var(--warn-soft); border: 1px solid #f2ddb8; color: #92400e;
}

/* ============ 弹窗 ============ */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(24, 32, 56, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 460px; max-height: 90vh;
  display: flex; flex-direction: column; animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }
.modal-head { padding: 15px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--border); background: var(--surface-2);
  display: flex; justify-content: flex-end; gap: 10px; }

/* 二次确认用的小弹窗 */
.confirm-text { font-size: 14px; line-height: 1.7; }
.confirm-text strong { color: var(--danger); }
.risk-list { margin: 10px 0 0; padding-left: 20px; font-size: 13px; color: var(--text-2); }
.risk-list li { margin-bottom: 4px; }

/* ============ 值班日志 ============ */
.field-group { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.field-group-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--brand-dark, #2e5aa8); }
.duty-card { background: #ffffff; color: #222; width: 640px; max-width: 100%;
  margin: 0 auto; padding: 18px; border-radius: 8px; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; }
.dc-title { background: #2e75b6; color: #ffffff; font-size: 17px; font-weight: 700;
  text-align: center; padding: 9px 0; border-radius: 4px 4px 0 0; }
.dc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dc-table th, .dc-table td { border: 1px solid #9cb9dd; padding: 6px 8px; text-align: left; vertical-align: middle; }
.dc-table th { background: #ddebf7; font-weight: 600; text-align: center; }
.dc-table .dc-cat { background: #ddebf7; font-weight: 600; text-align: center; }
.dc-table .dc-content { word-break: break-word; }
.dc-foot { margin-top: 8px; font-size: 11px; color: #98a4b5; text-align: right; }

/* ============ Toast ============ */
.toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 10px 18px; border-radius: 999px; font-size: 13.5px;
  background: #1f2430; color: #fff; box-shadow: var(--shadow-lg);
  animation: drop .18s ease-out; max-width: 80vw;
}
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.ok { background: #15803d; }
.toast.err { background: #b91c1c; }
.toast.warn { background: #b45309; }

/* ============ 权限勾选树 ============ */
.perm-wrap { display: grid; grid-template-columns: 258px 1fr; gap: 16px; align-items: start; }

.role-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.role-list-head { padding: 11px 13px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; background: var(--surface-2); }
.role-list-head h3 { font-size: 13.5px; }
.role-item {
  padding: 11px 13px; border-bottom: 1px solid var(--border); cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.role-item:last-child { border-bottom: none; }
.role-item:hover { background: var(--surface-2); }
.role-item.active { background: var(--brand-soft); }
.role-item.active .role-name { color: var(--brand-dark); font-weight: 600; }
.role-item .role-name { font-size: 13.5px; }
.role-item .role-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.role-item .role-badge { margin-left: auto; flex: none; }

.perm-head { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.perm-body { padding: 8px 16px 16px; max-height: 60vh; overflow-y: auto; }

.perm-module { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 10px; overflow: hidden; }
.perm-module-head {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.perm-module-head .m-name { font-weight: 600; font-size: 13.5px; }
.perm-module-head .m-desc { font-size: 12px; color: var(--muted); }
.perm-module-head .m-actions { margin-left: auto; display: flex; gap: 8px; }
.perm-module-body { padding: 6px 12px 10px; }

.perm-tab { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.perm-tab:last-child { border-bottom: none; }
.perm-tab-head { display: flex; align-items: center; gap: 9px; }
.perm-tab-head .t-name { font-size: 13px; font-weight: 500; }
.perm-ops { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 0 22px; }
.perm-op {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border-strong);
  font-size: 12px; color: var(--text-2); cursor: pointer; background: var(--surface);
  user-select: none;
}
.perm-op:hover { border-color: var(--brand); color: var(--brand); }
.perm-op.on { background: var(--brand-soft); border-color: #b9d0fa; color: var(--brand-dark); font-weight: 500; }
.perm-op input { display: none; }

.perm-summary {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--text-2); margin-bottom: 6px;
}

/* 只读展示（账号详情里的权限一览） */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ============ 颜色文字工具类 ============
   表格里给单个数字/原因着色（金额超限、异常提示、达标率），
   用类而不是内联 style，是为了让同一语义在全站颜色一致。
   这里的是**状态语义色**：ok=达标/已结清，danger=待办/异常，与行情涨跌色无关。 */
.c-brand { color: var(--brand); }
.c-ok { color: var(--ok); }
.c-warn { color: var(--warn); }
.c-danger { color: var(--danger); }
.c-muted { color: var(--muted); }

/* 危险动作的文字按钮（删除、作废）—— 与 .link-btn.danger 同义，
   写成 .link-btn.link-danger 是为了让双类名同时命中，
   不必在 JS 里拼两个 class 字符串 */
.link-btn.link-danger { color: var(--danger); }
.link-btn.link-danger:hover { color: #b91c1c; }

/* ============ 复选 / 单选行 ============
   .chk 用于工具条上的勾选项与弹窗里的选项卡片：
   默认 inline-flex 让 checkbox 与文字横排对齐，避免 checkbox 单独一行。 */
.chk {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none;
}
.chk input[type="checkbox"], .chk input[type="radio"] { margin: 0; cursor: pointer; }
.chk:hover { color: var(--text); }

/* 占位符标签（缴费单模板页）：可点击复制，故给出 hover 反馈 */
.ph-chip { cursor: pointer; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ph-chip:hover { filter: brightness(.95); }

/* ============ 建设中占位 ============ */
.placeholder { max-width: 720px; margin: 30px auto; text-align: center; }
.placeholder .ph-icon { font-size: 42px; }
.placeholder h2 { margin: 12px 0 6px; font-size: 18px; }
.placeholder .ph-desc { color: var(--text-2); font-size: 13.5px; }
.plan-list { margin: 18px auto 0; max-width: 520px; text-align: left; }
.plan-list li { margin-bottom: 6px; font-size: 13px; color: var(--text-2); }

/* ============ 响应式 ============ */
.backdrop { display: none; }
.only-mobile { display: none; }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .perm-wrap { grid-template-columns: 1fr; }
  .perm-body { max-height: none; }
  /* 抄表工作台：手机上先舍掉「用途 / 位置 / 倍数」，留下铺位、表号、上期、本期 */
  .wb-table .hide-sm { display: none; }
  /* 指标卡在手机上会把表格顶到屏幕外，进度与合计在工具条和底栏已有 */
  .wb-stat { display: none; }
  .wb-foot { position: static; }
}

@media (max-width: 720px) {
  .only-mobile { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(24,32,56,.4); z-index: 50; }
  .topbar { padding: 12px 14px; }
  .content { padding: 14px 14px 32px; }
  .tabs-bar { padding: 0 14px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .toolbar .search { width: 100%; }
  .modal-card { max-height: 92vh; }
  table.table th, table.table td { padding: 9px 10px; }

  /* 抄表工作台在手机上改成「一表一张卡」：
     横向滚动抄表是最难用的交互 —— 电工一只手拿手电，另一只手要点到屏幕外的输入框。
     用 grid 定死三行（不是 flex 自动换行：名称长短不同会换在奇怪的位置）：
       ① 铺位 · 表号 · 状态 · 详情
       ② 商户 · · · 位置
       ③ 上期 · 本期输入 · 用量
     选择器要写 `table.wb-table td`：`table.table td`（内边距 + 单元格下边框）比 `.wb-table td` 更具体，
     权重不够会在卡片上留一排短横线、内边距也压不下去。 */
  .wb-table thead { display: none; }
  .wb-table, .wb-table tbody { display: block; }
  .wb-table tr {
    display: grid; grid-template-columns: 1fr 1fr 0.9fr 1.5fr; gap: 6px 8px;
    grid-template-areas:
      "unit code status ops"
      "mer  mer  mer    loc"
      "prev input input usage";
    align-items: center;
    padding: 10px 12px; border-bottom: 1px solid var(--border);
  }
  table.wb-table td { display: block; width: auto; min-width: 0; border: none; padding: 0; }
  .wb-table .m-unit { grid-area: unit; font-size: 12px; }
  .wb-table .m-code { grid-area: code; font-size: 12px; }
  .wb-table .m-status { grid-area: status; }
  .wb-table .m-ops { grid-area: ops; text-align: right; }
  .wb-table .m-merchant {
    grid-area: mer; font-weight: 600; font-size: 14px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: none !important;
  }
  /* 位置必须留着：同一商户名下常有好几只表（九记火锅-厨房 / -后厨 / -外立面灯箱），
     光看商户名分不清手上这只是哪一只。跟商户同一行、靠右、短而灰 */
  .wb-table .m-loc {
    display: block; grid-area: loc; max-width: none !important;
    font-size: 12px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .wb-table .m-prev { grid-area: prev; font-size: 12px; }
  .wb-table .m-input { grid-area: input; }
  .wb-table .m-usage { grid-area: usage; font-size: 12px; }
  .wb-table .m-prev::before { content: '上期 '; color: var(--muted); font-weight: 400; }
  .wb-table .m-usage::before { content: '用量 '; color: var(--muted); font-weight: 400; }
  /* iOS 会为 <16px 的输入框放大页面，抄表时一放大就再也点不准下一行 */
  .wb-table .m-input input { font-size: 16px; padding: 6px 8px; }
  .wb-table tr.row-warn { background: #fff6f6; box-shadow: inset 3px 0 0 var(--danger); }
  /* 失焦即存的那一瞬间：左边一条淡色竖条，存完自己消失（存成功另有状态标签变化） */
  .wb-table tr.row-saving { box-shadow: inset 3px 0 0 var(--brand); }
}

/* ============ 输入候选下拉（企划活动：活动类型/开展单位；原生 datalist 行为不一故自绘） ============ */
.suggest-box {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 3px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 8px; box-shadow: 0 6px 18px rgba(24, 32, 56, .14);
  max-height: 190px; overflow: auto; z-index: 120;
}
.suggest-box > div { padding: 7px 10px; font-size: 13px; cursor: pointer; color: var(--text); }
.suggest-box > div:hover { background: var(--surface-2); }

/* ============================================================================
   物业管理 → 商户缴费单（2026-11）
   版式对齐纸质单据：店铺/项目/月份纵向合并，表格用实线，金额右对齐。
   ========================================================================== */
.slip-layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.slip-side { position: sticky; top: 12px; }
.slip-list { max-height: calc(100vh - 240px); overflow: auto; padding: 4px; }
.slip-item {
  display: flex; flex-direction: column; gap: 2px;
  width: 100%; text-align: left; cursor: pointer;
  padding: 9px 10px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); font: inherit;
}
.slip-item:hover { background: var(--surface-2); border-color: var(--border); }
.slip-item.active { background: var(--brand-soft); border-color: #c7d9fb; }
.slip-item-name { font-weight: 600; font-size: 13px; }
.slip-item-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }

.slip-main { padding: 0; background: transparent; border: 0; box-shadow: none; }
.slip-paper {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px 30px 22px; overflow-x: auto;
}
.slip-head { text-align: center; margin-bottom: 12px; }
.slip-title { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.slip-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.slip-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.slip-table th, .slip-table td {
  border: 1px solid #3f4350; padding: 5px 6px; vertical-align: middle; word-break: break-all;
}
.slip-table thead th { background: #f3f4f6; font-weight: 600; text-align: center; }
.slip-table .slip-shop { background: #a9dd75; text-align: center; font-weight: 600; font-size: 15px; width: 92px; }
.slip-table .slip-item-name-cell { text-align: center; font-weight: 600; width: 70px; }
.slip-table .slip-month { text-align: center; width: 42px; }
.slip-table .slip-meter { text-align: center; }
.slip-num { text-align: right; font-variant-numeric: tabular-nums; }
.slip-amount { font-weight: 600; }
.slip-total-row td { border-top: 1px solid #3f4350; }
.slip-total-label { text-align: right; font-weight: 700; letter-spacing: 2px; padding-right: 14px; }
.slip-total { font-weight: 700; font-size: 15px; }

.slip-tip { color: #c00000; font-weight: 700; margin: 14px 0 6px; }
.slip-pay { width: 100%; border-collapse: collapse; font-size: 13px; }
.slip-pay th, .slip-pay td { border: 1px solid #9aa0ac; padding: 5px 8px; text-align: left; font-weight: 400; }
.slip-pay th { background: #f7f8fa; width: 86px; white-space: nowrap; }
.slip-pay .slip-pay-th { width: 52px; }
.slip-contact { margin-top: 6px; font-size: 13px; }
.slip-foot { margin-top: 10px; font-size: 11.5px; border-top: 1px dashed var(--border); padding-top: 8px; }

@media (max-width: 900px) {
  .slip-layout { grid-template-columns: 1fr; }
  .slip-side { position: static; }
  .slip-list { max-height: 220px; }
  .slip-paper { padding: 14px; }
}

/* 打印：只留单据本身（浏览器「打印」→ 另存 PDF 给财务留档） */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff; }
  #sidebar, #topbar, #tabsBar, .toolbar, .slip-side, .notice, .wb-foot { display: none !important; }
  .app, .main, .content { display: block !important; margin: 0 !important; padding: 0 !important; width: auto !important; }
  .slip-layout { display: block; }
  .slip-main { border: 0; }
  .slip-paper { border: 0; box-shadow: none; padding: 0; }
  .slip-table { font-size: 11px; }
}

/* 抄表页单价：双击可改，虚线提示可编辑（移动端整列隐藏） */
.price-edit { cursor: pointer; border-bottom: 1px dashed var(--border-strong); padding-bottom: 1px; }
.price-edit:hover { color: var(--brand); border-bottom-color: var(--brand); }
.m-price { user-select: none; }
