/* ============================================================
   出入库管理系统 - 视觉样式（统一设计语言）
   设计令牌：配色 / 圆角 / 阴影 / 间距 / 字体
   ============================================================ */

:root {
  /* 品牌主色（深蓝渐变） */
  --brand: #1e3c72;
  --brand-2: #2a5298;
  --brand-soft: #eef3fb;
  --brand-border: #d6e2f5;
  --accent: #2f6fed;

  /* 功能色 */
  --warn: #d48806;
  --warn-bg: #fff7e6;
  --danger: #cf1322;
  --danger-bg: #fff1f0;
  --success: #389e0d;
  --success-bg: #f6ffed;
  --info: #13c2c2;
  --purple: #722ed1;

  /* 中性色 */
  --text: #1f2d3d;
  --text-2: #4a5b78;
  --muted: #8a98ad;
  --border: #e8edf5;
  --bg: #f4f6fb;
  --surface: #ffffff;

  /* 圆角 / 阴影 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(30, 60, 114, 0.06);
  --shadow-md: 0 4px 14px rgba(30, 60, 114, 0.10);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.18);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ===== 登录页 ===== */
.login-wrap {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1e3c72, #2a5298 60%, #3b6cb8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 24px;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px 40px 26px;
  width: 396px;
  max-width: 100%;
  box-shadow: 0 24px 70px rgba(10, 25, 60, 0.4);
  animation: pop .35s ease;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid #eef1f6;
}
.login-brand-text { text-align: left; }
.login-brand-text h1 {
  font-size: 21px;
  color: var(--brand);
  letter-spacing: .5px;
  line-height: 1.2;
}
.login-badge {
  flex: 0 0 auto;
  width: 56px; height: 56px; border-radius: 16px;
  object-fit: contain;
  box-shadow: 0 8px 20px rgba(42, 82, 152, 0.35);
}
.login-sub { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.login-fields { display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 7px; }
.login-field-label { font-size: 13px; color: var(--text-2); font-weight: 600; padding-left: 2px; }
.login-field input {
  padding: 13px 15px;
  border: 1px solid #dde3ee;
  border-radius: var(--r-md);
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
  background: #fbfcfe;
}
.login-field input:focus { outline: none; border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.14); }
.login-submit {
  margin-top: 6px;
  padding: 14px;
  font-size: 16px;
  letter-spacing: 6px;
  width: 100%;
}
.login-error { color: var(--danger); font-size: 13px; text-align: center; min-height: 18px; margin: 0; }
.login-foot { text-align: center; color: #aeb7c6; font-size: 12px; margin-top: 22px; }

@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== 顶栏 ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #1e3c72, #2a5298);
  color: #fff;
  padding: 13px 26px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar .logo { font-size: 18px; font-weight: 700; letter-spacing: .5px; display: flex; align-items: center; gap: 10px; }
.topbar .logo-img { width: 30px; height: 30px; border-radius: 8px; object-fit: contain; flex: none; align-self: center; }
/* 品牌标识统一使用 cockpit-emblem.png，不再用纯 CSS 方块徽标（避免与图标重复） */
.topbar .logo::before { content: none; }
.topbar .logo-sub { font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, 0.72); letter-spacing: 0; }
.topbar-left { display: flex; align-items: center; }
.topbar-right { display: flex; align-items: center; gap: 10px; font-size: 14px; }
#user-info { opacity: .95; display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; background: rgba(255,255,255,0.14); border-radius: 20px; font-size: 13px; font-weight: 600; }
/* 用户图标：CSS 绘制的圆点 + 弧线，替代 emoji */
#user-info::before {
  content: "";
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 -5px 0 -3px rgba(255, 255, 255, 0.9);
  margin-bottom: 4px;
}
.topbar-right .btn-ghost {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  padding: 7px 16px;
  font-weight: 600;
  backdrop-filter: blur(2px);
}
.topbar-right .btn-ghost:hover { background: #fff; color: var(--brand); border-color: #fff; }
.topbar-right #logout-btn { background: rgba(231, 76, 60, 0.85); border-color: rgba(231, 76, 60, 0.9); }
.topbar-right #logout-btn:hover { background: #e74c3c; color: #fff; }

/* ===== 一级库栏 ===== */
.wh-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--brand-soft);
  border-bottom: 1px solid var(--brand-border);
  padding: 12px 26px;
  flex-wrap: wrap;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.6);
}
.wh-bar-left, .wh-bar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wh-label { font-size: 14px; color: var(--text-2); font-weight: 600; }
.wh-bar select {
  padding: 7px 12px;
  border: 1px solid var(--brand-border);
  border-radius: var(--r-sm);
  font-size: 13px;
  min-width: 170px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.wh-bar select:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.12); }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 22px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: transparent;
  border: none;
  padding: 11px 18px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  transition: color .2s, border-color .2s, background .2s;
  font-family: inherit;
}
.tab:hover { color: var(--brand-2); background: rgba(42, 82, 152, 0.06); }
.tab.active {
  color: var(--brand-2);
  font-weight: 600;
  border-bottom-color: var(--brand-2);
  background: var(--brand-soft);
}

/* ===== 基础资料子tab ===== */
.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.subtab {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s, box-shadow .2s;
  font-family: inherit;
}
.subtab:hover { color: var(--brand-2); border-color: var(--brand-border); background: var(--brand-soft); }
.subtab.active {
  color: #fff;
  font-weight: 600;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  border-color: var(--brand-2);
  box-shadow: 0 2px 8px rgba(42, 82, 152, 0.28);
}
.mtab-panel.hidden { display: none; }

/* ===== 分页 ===== */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.pager-info { font-size: 13px; color: var(--text-2); }
.pager-ctrl { display: flex; align-items: center; gap: 8px; }
.pager-size {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
}
.pager-size:focus { outline: none; border-color: var(--brand-2); }

/* ===== 内容区 ===== */
.content { padding: 22px 26px; max-width: 1520px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 18px; color: var(--brand); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.panel-head h2::before { content: ""; width: 4px; height: 18px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-radius: 3px; }
/* 面板头部的主操作按钮靠右对齐，视觉更平衡。
   用直接子选择器，避免误伤嵌套在 .stock-toggle 内的按钮。 */
.panel-head > .btn-primary,
.panel-head > #open-user-create { margin-left: auto; }
.panel-head .muted { line-height: 1.5; }
.muted { color: var(--muted); font-size: 13px; }

/* ===== 卡片容器（快速表单 / 区块统一为卡片） ===== */
.card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 18px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card h2 { font-size: 17px; margin-bottom: 14px; color: var(--brand); }

/* ===== 快速表单 ===== */
.quick-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: linear-gradient(180deg, #fbfcfe, #f6f8fc);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
/* 快速表单的输入框白底突出，与卡片底色形成层次 */
.quick-form input, .quick-form select { background: #fff; }
.quick-form input:focus, .quick-form select:focus { background: #fff; }
.quick-form select, .quick-form input {
  padding: 9px 12px;
  border: 1px solid #dde3ee;
  border-radius: var(--r-sm);
  font-size: 13px;
  background: #fbfcfe;
  transition: border-color .2s, box-shadow .2s;
}
.quick-form select:focus, .quick-form input:focus { outline: none; border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.12); }
.quick-form input[name="quantity"], .quick-form input[name="unit_price"] { width: 120px; }
.perm-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }

/* ===== 通用表格 ===== */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
th, td { padding: 10px 12px; text-align: left; font-size: 12.5px; border-bottom: 1px solid #f1f4f9; white-space: nowrap; }
/* 宽表自适应：固定布局避免横向滚动，长文本列省略显示 */
.fit-table { table-layout: fixed; }
.fit-table th, .fit-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fit-table th:nth-child(1) { width: 118px; } /* 时间列 */
.fit-table td:nth-child(1) { width: 118px; }
.fit-table th:nth-child(2), .fit-table td:nth-child(2) { width: 110px; } /* 一级库 */
/* 订单表第 2 列是订单号（DD-20260831-001 较长），需单独加宽 */
#order-table th:nth-child(2), #order-table td:nth-child(2) { width: 152px; }

/* 时间列：日期与时间分两行，窄列宽下也能完整显示 */
.col-time { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.col-time span { font-size: 12px; }
.col-time .t-time { color: var(--muted); font-size: 11.5px; }

/* 订单号：等宽字体 + 完整显示，便于人工核对与复制。
   选择器需带 #order-table 以提升特异性，否则会被 .fit-table td 的 overflow:hidden 覆盖而截断。 */
#order-table .col-no {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11.5px;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
/* 出库备注列：收窄，长文本省略 */
#order-table th:nth-child(15), #order-table td:nth-child(15) { width: 80px; }
#inbound-table th:nth-child(10), #inbound-table td:nth-child(10) { width: 150px; }
.fit-table th:last-child, .fit-table td:last-child { width: 64px; text-align: center; } /* 操作列（单按钮表） */
/* 订单表「操作」列含「修」「删」两个按钮，加宽避免被裁切 */
#order-table th:last-child, #order-table td:last-child { width: 120px; white-space: nowrap; text-align: center; overflow: visible; }
/* 订单表「操作」列：修/删 横向排列，不换行（防止被挤成上下两行） */
#order-table td.col-op { text-align: center; white-space: nowrap; padding-left: 4px; padding-right: 4px; }
#order-table td.col-op .btn { width: auto; vertical-align: middle; margin: 0 3px; }
/* 已付/应付列：换行完整显示，不省略 */
#order-table th:nth-child(13), #order-table td:nth-child(13) { width: 120px; white-space: normal; word-break: break-all; }
.col-pay { display: flex; flex-direction: column; gap: 3px; line-height: 1.35; }
.col-pay span { font-size: 12px; }
th {
  background: linear-gradient(180deg, #f7f9fc, #eef2f8);
  color: var(--text-2);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--brand-border);
  letter-spacing: .3px;
}
tbody tr { transition: background .15s; }
tbody tr:nth-child(even) td { background: #fafbfe; }
tbody tr:hover td { background: #eef4ff !important; }
td.empty { text-align: center; color: var(--muted); padding: 36px; font-size: 13px; }
.muted { color: var(--muted); }

/* ===== 弹窗 ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px; z-index: 200; overflow-y: auto;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: 1100px; max-width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  animation: pop .3s ease;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  font-size: 16px; font-weight: 600; color: var(--brand);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  position: sticky; top: 0; background: linear-gradient(180deg, #fbfcfe, #f2f6fc); z-index: 2;
}
.modal-close { background: none; border: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); border-radius: 50%; width: 32px; height: 32px; transition: background .2s, color .2s; }
.modal-close:hover { background: #f1f4f9; color: var(--text); }
.modal-body { padding: 20px 22px; }

/* ===== 现金流水弹窗（新增/编辑）美化 ===== */
.cash-modal-box { width: 620px; max-width: 100%; }
.cash-modal-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; margin-right: 9px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff;
  font-size: 16px; font-weight: 700; vertical-align: -6px; box-shadow: var(--shadow-sm);
}
.cash-form { display: flex; flex-direction: column; gap: 18px; }
.cash-sec {
  background: linear-gradient(180deg, #fbfcfe, #f7faff);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 16px 18px 18px; box-shadow: inset 0 1px 0 #fff;
}
.cash-sec-title {
  font-size: 13.5px; font-weight: 700; color: var(--brand);
  margin-bottom: 14px; padding-left: 10px; position: relative; letter-spacing: .3px;
}
.cash-sec-title::before { content: ""; position: absolute; left: 0; top: 1px; bottom: 1px; width: 3px; border-radius: 3px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); }
.cash-sec-title .muted { font-weight: 400; font-size: 12px; margin-left: 4px; }
.cash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.cash-grid .cf-wide { grid-column: 1 / -1; }
.cf { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.cf input, .cf select {
  padding: 10px 12px; border: 1px solid #dde3ee; border-radius: var(--r-sm);
  font-size: 14px; background: #fff; font-weight: 400; color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.cf input::placeholder, .cf select option[value=""] { color: var(--muted); }
.cf input:focus, .cf select:focus { outline: none; border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.12); }
.cf.req::after { content: '*'; color: #e0524b; font-weight: 700; margin-left: 2px; align-self: flex-start; }
.cash-form-actions { display: flex; justify-content: flex-end; gap: 12px; padding-top: 4px; border-top: 1px dashed var(--border); margin-top: 2px; padding-top: 16px; }
.cash-form-actions .btn { min-width: 96px; padding: 10px 18px; font-size: 14px; }
.cash-form-actions .btn-primary { background: linear-gradient(135deg, var(--brand-2), var(--brand)); }

@media (max-width: 560px) {
  .cash-grid { grid-template-columns: 1fr; }
}

/* ===== 通用按钮 ===== */
.btn {
  border: none; border-radius: var(--r-sm);
  padding: 9px 18px; font-size: 14px; cursor: pointer;
  background: #eef1f6; color: var(--text);
  transition: transform .08s, box-shadow .2s, opacity .2s, background .2s;
  font-family: inherit;
}
.btn:hover { opacity: .92; box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand-2); color: #fff; }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(42, 82, 152, 0.35); }
.btn-warn { background: var(--warn); color: #fff; }
.btn-warn:hover { box-shadow: 0 4px 12px rgba(212, 136, 6, 0.3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { box-shadow: 0 4px 12px rgba(207, 19, 34, 0.3); }
.btn-invoice { background: var(--info); color: #fff; }
.btn-return { background: var(--purple); color: #fff; }
.btn-sm { padding: 6px 13px; font-size: 12px; border-radius: var(--r-sm); }
.btn-del-actual { background: #fff; color: #cf1322; border: 1px solid #ffccc7; }
.btn-del-actual:hover { background: #fff1f0; }
.ops-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-ghost {
  background: #fff; color: var(--text-2); border: 1px solid var(--border);
  padding: 6px 14px; font-size: 13px;
}
.btn-ghost:hover { background: #f4f7fc; }
.btn-ghost.active { background: var(--brand-2); color: #fff; border-color: var(--brand-2); }
.btn-xs { padding: 1px 7px; font-size: 11px; border-radius: var(--r-sm); line-height: 1.5; }

/* 文件中转站：文件夹导航栏 */
.file-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.file-toolbar-actions { display: flex; gap: 8px; flex-shrink: 0; }
.file-breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 14px; min-width: 0; }
.file-breadcrumb .crumb { cursor: pointer; color: var(--file-blue); padding: 4px 8px; border-radius: 7px; font-weight: 600; white-space: nowrap; transition: background .15s ease; }
.file-breadcrumb .crumb:hover { background: #e8f2ff; }
.file-breadcrumb .crumb-current { color: #203b61; cursor: default; font-weight: 700; }
.file-breadcrumb .crumb-current:hover { background: transparent; }
.file-breadcrumb .crumb-sep { color: var(--muted); padding: 0 1px; }
.file-folder-row { background: #f7f9fc; cursor: default; }
.file-folder-row:hover { background: #edf3ff; }
.folder-expand { width: 22px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; font-size: 15px; }
.folder-icon { margin: 0 7px 0 3px; }
.folder-count { margin-left: 10px; font-size: 12px; }
.tree-indent { display: inline-block; width: 28px; }
.folder-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 16px;
  background: #f6f8fc; font-size: 13px; cursor: pointer; user-select: none;
}
.folder-chip:hover { background: #eaf0fb; border-color: var(--brand-2); }
.folder-chip .muted { font-size: 12px; }
.folder-chip .btn-xs { margin-left: 2px; padding: 0 6px; }

/* ===== 状态标签（药丸 + 左侧色点） ===== */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 11px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.status-pending { background: var(--warn-bg); color: var(--warn); }
.status-partial { background: #e6f4ff; color: #096dd9; }
.status-completed { background: var(--success-bg); color: var(--success); }
.status-closed { background: #f1f4f9; color: var(--muted); }
.status-to_invoice { background: #fff4e5; color: #d9730a; }
.status-to_payment { background: #fff1f0; color: #d4380d; }

/* 订单详情弹框内状态：彩色圆点标签（按状态区分颜色） */
.order-status-dot {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600;
}
.order-status-dot::before {
  content: ''; width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none;
}
.order-status-dot.is-pending { color: var(--warn); }
.order-status-dot.is-partial { color: #096dd9; }
.order-status-dot.is-completed { color: var(--success); }
.order-status-dot.is-closed { color: var(--muted); }
.order-status-dot.is-to_invoice { color: #d9730a; }
.order-status-dot.is-to_payment { color: #ff7875; }

.amount { color: var(--success); font-weight: 600; font-variant-numeric: tabular-nums; }
.amount-due { color: #c0392b; font-weight: 600; font-variant-numeric: tabular-nums; }
/* 现金表：付款行的收付类型与金额标红 */
#rep-modal-cash tr.row-pay td:nth-child(2) .status,
#rep-modal-cash tr.row-pay td.amount { color: var(--danger); }
#rep-modal-statement td.amount-due,
#rep-modal-statement tr.order-subtotal td.amount-due,
#rep-modal-statement tr.rec-total td.amount-due { color: #c0392b; }
.tag { display: inline-block; padding: 2px 9px; border-radius: var(--r-sm); font-size: 12px; }
.tag-tk { background: #f9f0ff; color: var(--purple); }
.tag-excess { background: #fff1f0; color: #cf1322; border: 1px solid #ffccc7; }
.tag-ok { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.excess-tip { margin: 0 0 12px; color: var(--text-2); font-size: 13px; }
.excess-tip b { color: #cf1322; }

/* 计提记录超额行 + 出库/订单管理三行展示 */
.excess-row td { background: #fff7f6; }
.excess-row .excess-amt { color: #cf1322; font-weight: 600; }
.row-excess td { background: #fff7f6; }
.row-excess:hover td { background: #fff1f0; }
.row-total td { background: #f6f9ff; font-weight: 600; }
.row-total:hover td { background: #eef4ff; }

/* ===== 订单详情 ===== */
/* 订单弹窗头部与关键指标 */
.order-summary {
  background: linear-gradient(180deg, #fbfcfe, #f5f8fc);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 16px 18px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
}
.os-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.oh-cust { font-size: 16px; font-weight: 700; color: var(--text); }
.os-metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 14px; }
.metric {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 10px 12px; min-width: 0; text-align: center;
}
.metric span { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 3px; }
.metric b { font-size: 16px; font-weight: 700; color: var(--text); }
.metric-due { background: #fff1f0; border-color: #ffccc7; }
.metric-due b { color: #d4380d; }
@media (max-width: 860px) { .os-metrics { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .os-metrics { grid-template-columns: repeat(2, 1fr); } }

/* 计提进度条 */
.oh-progress { margin-bottom: 0; }
.oh-progress-bar-track { height: 8px; background: #eef1f6; border-radius: 999px; overflow: hidden; }
.oh-progress-bar { height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); border-radius: 999px; transition: width .3s ease; }
.oh-progress-text { display: block; font-size: 12px; color: var(--text-2); margin-top: 6px; }

/* 订单信息卡片 */
.info-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.info-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 16px; box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, border-color .2s ease;
}
.info-card:hover { box-shadow: var(--shadow-md); border-color: var(--brand-border); }
.info-card h4 {
  font-size: 13px; color: var(--brand); margin: -14px -16px 10px; padding: 10px 16px;
  background: linear-gradient(180deg, #fbfcfe, #f4f7fb); border-bottom: 1px solid var(--border);
  border-radius: var(--r-md) var(--r-md) 0 0; border-left: 3px solid var(--brand-2);
}
.info-dl { margin: 0; }
.info-dl > div {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 7px 2px; border-bottom: 1px dashed #eef1f6;
}
.info-dl > div:last-child { border-bottom: none; }
.info-dl dt { font-size: 12.5px; color: var(--text-2); margin: 0; flex-shrink: 0; }
.info-dl dd { font-size: 13.5px; font-weight: 600; color: var(--text); margin: 0; text-align: right; word-break: break-all; }
.info-dl dd.note { font-weight: 500; color: var(--text-2); }
@media (max-width: 720px) { .info-cards { grid-template-columns: 1fr; } }

.section-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.section-block > h3 { font-size: 14px; color: var(--brand); margin-bottom: 14px; padding-left: 11px; border-left: 3px solid var(--brand-2); font-weight: 700; }

.ops-area { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.ops-plan-card {
  display: flex; flex-direction: column; gap: 14px;
  background: #f7f9fc; border: 1px solid var(--brand-border);
  border-radius: var(--r-md); padding: 14px 16px;
}
.ops-right { display: flex; flex-direction: column; gap: 12px; }
.ops-subhead { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--brand); margin-bottom: 10px; padding-left: 9px; border-left: 3px solid var(--brand-2); }
.ops-subhead-plain { border-left-color: #b37feb; color: #722ed1; }
.ops-divider { height: 1px; background: #eef1f6; margin: 2px 0; }
.ops-badge { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }
.badge-plan { background: var(--brand-2); }
.badge-actual { background: #fa8c16; }
.ops-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ops-row-plan { background: #fffbe6; border-color: #ffe58f; }
@media (max-width: 860px) { .ops-area { grid-template-columns: 1fr; } }
.ops-row { display: flex; flex-direction: column; gap: 10px; background: #f7f9fc; border: 1px solid var(--brand-border); border-radius: var(--r-md); padding: 14px 16px; }
.ops-row label { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.ops-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ops-col { display: flex; flex-direction: column; gap: 12px; }
.ops-col label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.ops-col input { padding: 9px 12px; border: 1px solid #dde3ee; border-radius: var(--r-sm); font-size: 14px; background: #fbfcfe; transition: border-color .2s, box-shadow .2s; }
.ops-col input:focus { outline: none; border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.12); }
.edit-actual-modal .ops-inline { margin-top: 4px; }
.edit-actual-modal .btn { min-width: 96px; }
.ops-inline input, .ops-inline select { padding: 8px 11px; border: 1px solid #dde3ee; border-radius: var(--r-sm); font-size: 13px; background: #fbfcfe; transition: border-color .2s, box-shadow .2s; }
.ops-inline input[name="plan_qty"], .ops-inline input[name="actual_qty"] { width: 190px; }
.ops-inline input[name="plate_no"] { width: 140px; }
.ops-inline select { flex: 1; min-width: 170px; }
.ops-inline input:focus, .ops-inline select:focus { outline: none; border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.12); }
.ops-inline .btn { padding: 9px 18px; font-size: 13px; white-space: nowrap; }

.action-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; background: #fafbfd; border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px 14px 18px; }
.action-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--border); }
.action-card.act-pay::before { background: var(--brand-2); }
.action-card.act-refund::before { background: #ff7875; }
.action-card.act-invoice::before { background: #36cfc9; }
.action-card.act-return::before { background: #faad14; }
.action-card label { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.action-card input, .action-card select { width: 100%; padding: 8px 11px; border: 1px solid #dde3ee; border-radius: var(--r-sm); font-size: 13px; background: #fbfcfe; transition: border-color .2s, box-shadow .2s; }
.action-card input:focus, .action-card select:focus { outline: none; border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.12); }
.action-card .btn { width: 100%; padding: 9px 0; font-size: 13px; }

.modal-lists { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.modal-list-wide { grid-column: 1 / -1; }
.modal-lists > div {
  background: #fafbfd; border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 12px 14px; box-shadow: var(--shadow-sm); transition: box-shadow .2s ease, border-color .2s ease;
}
.modal-lists > div:hover { box-shadow: var(--shadow-md); border-color: var(--brand-border); }
.modal-lists h3 {
  display: flex; align-items: center; font-size: 13px; color: var(--brand);
  margin: -12px -14px 12px; padding: 10px 14px; background: linear-gradient(180deg, #fbfcfe, #f4f7fb);
  border-bottom: 1px solid var(--border); border-radius: var(--r-md) var(--r-md) 0 0; border-left: 3px solid var(--brand-2);
}
.modal-lists table { font-size: 13px; box-shadow: none; border: none; }
.modal-lists th, .modal-lists td { padding: 7px 9px; }
.modal-lists thead th { background: #eef2f7; color: var(--text-2); font-weight: 600; border-bottom: 1px solid var(--border); }
.modal-lists tbody tr:nth-child(even) { background: #f7f9fc; }
.modal-lists tbody tr:hover { background: #eef4fc; }

.col-form { display: flex; flex-direction: column; gap: 14px; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: flex; flex-direction: column; gap: 15px; padding-left: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); }
/* 复选框不带边框与 padding：继承自 .form-grid label input 会让它变成带边框的方块。
   必须在选择器与 focus 选择器中都显式排除。 */
.form-grid label input:not([type="checkbox"]), .form-grid label select { padding: 10px 12px; border: 1px solid #dde3ee; border-radius: var(--r-sm); font-size: 14px; background: #fbfcfe; font-weight: 400; transition: border-color .15s, box-shadow .15s, background .15s; }
.form-grid label input:not([type="checkbox"]):focus, .form-grid label select:focus { outline: none; border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.12); }
.form-grid label.req { position: relative; }
.form-grid label.req > :first-child { display: inline; }
.form-grid label.req { flex-direction: column; }
.form-grid label.req::before { content: '*'; position: absolute; left: -11px; top: 0; color: #e0524b; font-weight: 700; font-size: 14px; }
.modal-tip { margin: -2px 0 4px; font-size: 12.5px; color: var(--muted); }
.modal-tip.tip-red { color: #e0524b; font-weight: 600; }
.req-star { color: #e0524b; font-weight: 700; }
.form-actions { margin-top: 6px; }
.form-actions .btn { width: 100%; padding: 11px; font-size: 15px; }

/* 新增入库/出库/移库弹窗：加宽后改为双列栅格。
   原本 480px 单列堆叠 5~7 个字段会又长又窄，双列后弹窗更矮更宽，填写更顺手。
   仅作用于带 .form-2col 的表单，共用 .form-grid 的现金等弹窗不受影响。
   注意：必须定义在 .form-grid 之后，才能覆盖其 flex 单列布局。 */
.form-grid.form-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px 16px;
  align-items: start;
}
/* 修复选择框溢出弹窗：grid 子项 min-width 默认为 auto，
   超长选项（如「商品名（规格）」）会顶宽整列，把 select 挤出弹窗边界。
   子项 min-width 归零后列宽只由容器决定，控件再限宽 100%，
   任何长度的选项都会被压缩在弹窗内，过长文本以省略号收尾。 */
.form-grid.form-2col > label { min-width: 0; }
.form-grid.form-2col label input:not([type="checkbox"]),
.form-grid.form-2col label select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  text-overflow: ellipsis;
}
/* 需独占整行的元素（库存提示、落单的备注）加 .span-all；按钮容器统一跨整行 */
.form-grid.form-2col > .span-all,
.form-grid.form-2col > .form-actions {
  grid-column: 1 / -1;
}
@media (max-width: 560px) {
  .form-grid.form-2col { grid-template-columns: 1fr; }
}

/* 入库详情弹窗 */
.inbound-detail { display: flex; flex-direction: column; gap: 14px; }
.ib-hero {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: var(--r-md); padding: 16px 18px; color: #fff;
  box-shadow: 0 6px 16px rgba(30, 60, 114, 0.22);
}
.ib-hero-no { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.ib-hero-meta { margin-top: 5px; font-size: 12.5px; opacity: .85; }
.ib-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ib-card {
  background: var(--brand-soft); border: 1px solid var(--brand-border);
  border-radius: var(--r-md); padding: 13px 15px;
}
.ib-card-label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.ib-card-val { font-size: 15.5px; font-weight: 700; color: var(--brand); line-height: 1.3; word-break: break-all; }
.ib-spec { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.ib-card-sub { margin-top: 6px; font-size: 12.5px; color: var(--text-2); }
.ib-amount {
  display: flex; align-items: center; justify-content: space-around; gap: 12px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.ib-amount-item { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: 1; }
.ib-amount-item span { font-size: 12px; color: var(--muted); }
.ib-amount-item b { font-size: 16px; font-weight: 700; color: var(--text); }
.ib-amount-total { color: var(--brand-2); font-size: 20px; }
.ib-amount-divider { width: 1px; height: 32px; background: var(--border); }
.ib-notes { background: #f9fbfe; border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px 15px; }
.ib-notes-label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.ib-notes-text { font-size: 13.5px; color: var(--text); line-height: 1.6; word-break: break-all; }

/* 入库开票区 */
/* 开票与付款并排：弹框加宽后单列会显空旷，两者为同类信息并排更易对照 */
.ib-split { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 680px) { .ib-split { grid-template-columns: 1fr; } }
.ib-invoice { background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 15px; }
.ib-invoice-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.ib-invoice-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.ib-invoice-remain { font-size: 12px; color: var(--brand-2); font-weight: 600; }
.ib-invoice-remain.full { color: var(--muted); }
.iv-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; max-height: 220px; overflow-y: auto; }
.iv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 9px 11px; background: #f7f9fd; border: 1px solid #eef2f8; border-radius: var(--r-sm); font-size: 12.5px; }
.iv-idx { font-weight: 700; color: var(--muted); }
.iv-qty { font-weight: 600; color: var(--text); }
.iv-amt { font-weight: 700; color: var(--brand-2); }
.iv-no { color: var(--text-2); flex: 1; min-width: 80px; }
.iv-time { color: var(--muted); font-size: 11.5px; }
.iv-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; background: #f7f9fd; border-radius: var(--r-sm); }
.iv-del { margin-left: 4px; padding: 3px 9px; }
.iv-form { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.iv-form input { padding: 8px 10px; border: 1px solid #dde3ee; border-radius: var(--r-sm); font-size: 13px; background: #fbfcfe; }
.iv-form input:focus { outline: none; border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.12); }
.iv-form button { grid-column: 1 / -1; }
/* 表格已开票数量列 */
.ib-remain { color: var(--muted); font-size: 12px; font-weight: 400; }
.modal-sm { width: 400px; }

.list-scroll { max-height: 220px; overflow: auto; }
.list-scroll table { border-collapse: collapse; width: 100%; }
.list-scroll thead th { position: sticky; top: 0; background: #f7f9fc; }

/* ===== 权限控件 ===== */
.perm-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.perm-checks label { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text); cursor: pointer; }
.perm-checks-inline { gap: 6px 12px; }
.perm-checks-inline .btn-sm { margin-left: 6px; }
.perms-field { flex: 1; }
.perm-all { font-size: 13px; color: var(--success); font-weight: 600; }
.perm-item { display: inline-flex; align-items: center; gap: 5px; margin: 2px 10px 2px 0; padding: 3px 9px; border-radius: var(--r-sm); font-size: 13px; background: #f5f8fc; border: 1px solid var(--border); }
.perm-danger { background: #fdecec; color: #c0392b; border-color: #f5c6c6; }
.perm-all-toggle { font-weight: 600; background: var(--brand-soft); border-color: var(--brand-border); }

/* 账号管理：角色徽章 */
.role-badge { display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.role-admin { background: linear-gradient(135deg, #2a5298, #1e3c72); color: #fff; }
.role-normal { background: #eef2f7; color: #43566f; border: 1px solid var(--border); }

/* 账号管理：权限标签展示 */
.cell-perm { vertical-align: top; }
.perm-tags { display: flex; flex-wrap: wrap; gap: 6px; max-width: 340px; }
.perm-tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; background: #eaf2fb; color: #2a5298; border: 1px solid #cfe0f4; }
.perm-tag-danger { background: #fdecec; color: #c0392b; border-color: #f5c6c6; }
.perm-none { color: var(--muted); font-size: 13px; }
.cell-time { white-space: nowrap; color: var(--text-2); font-size: 13px; }
.op-inline { display: flex; flex-wrap: wrap; gap: 6px; }

/* 权限分类：每个业务域独立成组，组内权限保持双列，危险权限单独警示。 */
.perm-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 4px 0 14px;
}
.perm-group {
  overflow: hidden;
  border: 1px solid #dce5f0;
  border-radius: 10px;
  background: #fbfdff;
}
.perm-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-bottom: 1px solid #e6edf5;
  background: linear-gradient(180deg, #f7faff, #f1f6fc);
}
.perm-group-head > div { min-width: 0; }
.perm-group-head strong { display: block; color: var(--brand); font-size: 13px; }
.perm-group-head span { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.perm-group-toggle {
  display: inline-flex !important;
  flex: 0 0 auto;
  flex-direction: row !important;
  align-items: center;
  gap: 5px;
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.perm-group-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}
.perm-grid .perm-item {
  margin: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  line-height: 1.4;
  background: #f7faff;
}
.perm-item-copy { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.perm-item-copy strong { color: inherit; font-size: 12.5px; line-height: 1.35; }
.perm-item-copy small { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.35; }
.perm-danger .perm-item-copy small { color: #a96868; }

.perm-group-danger { border-color: #f1caca; }
.perm-group-danger .perm-group-head { background: linear-gradient(180deg, #fff9f9, #fdf0f0); border-color: #f3d6d6; }
.perm-group-danger .perm-group-head strong { color: #b94238; }
.perm-grid .perm-danger { background: #fdecec; border-color: #f5c6c6; color: #c0392b; font-weight: 600; }
@media (max-width: 560px) {
  .perm-group-items { grid-template-columns: 1fr; }
  .perm-group-head { align-items: flex-start; }
}

/* 权限分组头部：计数 + 全选 右对齐成一组 */
.perm-group-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.perm-group-count {
  display: inline-block;
  min-width: 42px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand-2);
  background: #eaf2fb;
  border: 1px solid #d4e2f4;
}
.perm-group-danger .perm-group-count { color: #b94238; background: #fdecec; border-color: #f3d6d6; }
/* 分组卡片左侧强调色，强化“业务域”视觉边界 */
.perm-group { border-left: 3px solid var(--brand-2); }
.perm-group-danger { border-left-color: #cf5b5b; }

/* 编辑权限弹窗：顶部固定的已选统计条 */
.perm-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 9px 14px;
  border: 1px solid var(--brand-border);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #eef4fc, #e6eef9);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
.perm-summary b { color: var(--brand); font-size: 15px; }
.perm-summary-hint { font-weight: 400; font-size: 11.5px; color: var(--muted); }

/* 新建账号弹窗：权限标题旁的已选计数徽标 */
.perm-count {
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-2);
  background: #eaf2fb;
  border: 1px solid #d4e2f4;
}

/* 账号列表搜索框 */
.acct-search {
  margin-left: 14px;
  padding: 8px 12px;
  min-width: 200px;
  border: 1px solid #dde3ee;
  border-radius: var(--r-sm);
  font-size: 13px;
  background: #fbfcfe;
}
.acct-search:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(42, 82, 152, .12); }

/* 新建账号「权限设置」区：卡片化两段式。
   原先「全选」开关与 6 个长短不一的标签挤在同一行 flex 里，既无分组又参差不齐。
   现改为「标题栏(含全选) + 等宽网格」，权限项整齐对齐，危险权限(删除)单独高亮警示。 */
.perm-block {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.perm-block-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #fbfcfe, #f4f7fb);
  border-bottom: 1px solid var(--border);
}
.perm-block-head .field-label { font-size: 13px; font-weight: 700; color: var(--brand); }
/* 标题栏里的「全选/全不选」label 须有自己的 focus 样式，否则继承全局
   :focus-visible 的 2px outline + 2px offset，会在浅灰背景上形成一个矩形硬边框。 */
.perm-block-head .perm-all-toggle { margin: 0; }
.perm-block-head .perm-all-toggle:focus-within {
  outline: none;
  border-radius: 2px;
  background: rgba(42, 82, 152, 0.08);
}
#create-perms.perm-grid { margin: 0; padding: 14px; }

/* ===== Toast ===== */
.toast {
  position: fixed; top: 88px; left: 50%; transform: translateX(-50%);
  padding: 13px 28px; border-radius: var(--r-md);
  color: #1a1a1a; font-size: 15px; font-weight: 700; z-index: 900;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast-ok { background: #d8f3dc; border: 1px solid var(--success); }
.toast-err { background: #ffe0e0; border: 1px solid var(--danger); }
.toast.hidden { display: none; }

/* ===== 库存总览（二级库·客户库） ===== */
.stock-toggle { display: inline-flex; gap: 8px; margin-left: auto; }
.stock-summary { margin: 12px 0 16px; }
.summary-cards { display: flex; flex-wrap: wrap; gap: 12px; }
.summary-card {
  background: linear-gradient(180deg, #f7fafe, #eaf1fb); border: 1px solid var(--brand-border);
  border-radius: var(--r-md); padding: 14px 20px;
  display: flex; flex-direction: column; gap: 5px; min-width: 160px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, border-color .2s ease;
}
.summary-card:hover { box-shadow: var(--shadow-md); border-color: var(--brand-2); }
.summary-card span { font-size: 12.5px; color: var(--text-2); }
.summary-card b { font-size: 19px; color: var(--brand); font-weight: 700; }

.stock-blocks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) { .stock-blocks { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .stock-blocks { grid-template-columns: 1fr; } }
.lib-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 16px 18px; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
/* 顶部渐变条：悬停时展开，增强可点击感 */
.lib-card::before {
  content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--brand-2), #4a7fd4);
  transform: scaleX(0); transform-origin: left; transition: transform .25s ease;
}
.lib-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--brand-2); }
.lib-card:hover::before { transform: scaleX(1); }
.lib-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.lib-card-customer { font-size: 15px; font-weight: 600; color: var(--brand); }
.lib-card-wh { font-size: 12px; color: var(--text-2); background: var(--brand-soft); padding: 2px 9px; border-radius: 20px; white-space: nowrap; }
.lib-card-meta { font-size: 13px; color: var(--text-2); }
.lib-card-meta b { color: var(--brand); }
.lib-card-title { font-size: 12px; color: var(--text-2); background: #f5f8fc; border: 1px dashed #d6e0ef; border-radius: 6px; padding: 3px 8px; line-height: 1.5; }
.lib-card-title b { color: var(--brand); }
.lib-card-items { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.lib-chip { font-size: 12px; background: #f5f8fc; border: 1px solid #e3eaf5; color: #42526e; padding: 2px 9px; border-radius: 20px; }
.lib-chip.more { background: var(--brand-2); color: #fff; border-color: var(--brand-2); }
.lib-card-foot { font-size: 12px; color: var(--accent); margin-top: 2px; }
.empty-block { text-align: center; color: var(--muted); padding: 40px; background: var(--surface); border-radius: var(--r-md); border: 1px dashed var(--brand-border); }

/* ===== 二级库明细弹窗 ===== */
.lib-detail-summary { font-size: 14px; color: var(--text-2); margin-bottom: 14px; }
.lib-detail-summary b { color: var(--brand); font-size: 16px; }
.lib-detail-h { font-size: 14px; color: var(--brand); margin: 18px 0 10px; padding-left: 11px; border-left: 3px solid var(--brand-2); }
.lib-detail-order-head { display: flex; align-items: center; gap: 14px; }
.link { color: var(--accent); text-decoration: none; cursor: pointer; font-weight: 500; }
.link:hover { text-decoration: underline; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f0f5fc; }
.badge-wait { display: inline-block; background: var(--warn-bg); color: var(--warn); border: 1px solid #ffd591; border-radius: 20px; padding: 1px 9px; font-size: 12px; }
.count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; padding: 0 6px; margin-left: 8px; background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; vertical-align: middle; }

.filter-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; margin-right: 12px; }
.filter-check input { cursor: pointer; accent-color: var(--brand-2); }

/* ===== 审计日志 ===== */
.audit-filters { display: inline-flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px 16px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.audit-filters select, .audit-filters input { padding: 7px 10px; border: 1px solid var(--brand-border); border-radius: var(--r-sm); font-size: 13px; background: #fbfcfe; }
.audit-filters select:focus, .audit-filters input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.12); }
.audit-filters .btn { margin-left: 2px; }
.audit-date { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: #555; }
.audit-date input { padding: 6px 8px; }
.audit-snap { font-size: 12px; color: var(--text-2); max-width: 380px; word-break: break-all; }

/* ===== 报表中心 ===== */
.report-filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 18px; background: linear-gradient(180deg, #fbfcfe, #f4f8fc); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.report-filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--text-2); gap: 5px; }
.report-filters select, .report-filters input { padding: 8px 11px; border: 1px solid #dde3ee; border-radius: var(--r-sm); font-size: 13px; min-width: 140px; background: #fbfcfe; }
.report-filters select:focus, .report-filters input:focus { outline: none; border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.12); }
.report-title { margin: 20px 0 10px; font-size: 16px; color: var(--text); font-weight: 600; }
.report-title + h4 { margin: 14px 0 8px; font-size: 14px; color: var(--text-2); }
/* 应收总账专属筛选条（位于该表格上方） */
.report-sub-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px 26px; margin-bottom: 14px; background: var(--brand-soft); border: 1px solid var(--brand-border); border-radius: var(--r-md); padding: 14px 18px; }
.customer-search-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 190px; }
.customer-search-input { padding: 8px 11px; border: 1px solid #dde3ee; border-radius: var(--r-sm); font-size: 13px; background: #fbfcfe; }
.customer-search-input:focus { outline: none; border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.12); }
.customer-search-wrap select { min-width: 190px; }

.report-sub-filters .filter-item { display: flex; flex-direction: column; gap: 6px; }
.report-sub-filters .filter-label { font-size: 12px; font-weight: 600; color: var(--brand-dark); letter-spacing: .3px; }
.report-sub-filters select, .report-sub-filters input { padding: 8px 11px; border: 1px solid #dde3ee; border-radius: var(--r-sm); font-size: 13px; background: #fbfcfe; }
.report-sub-filters select { min-width: 190px; }
.report-sub-filters input[type="date"] { min-width: 140px; }
.report-sub-filters select:focus, .report-sub-filters input:focus { outline: none; border-color: var(--brand-2); background: #fff; box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.12); }
.report-sub-filters .filter-range { display: flex; align-items: center; gap: 8px; }
.report-sub-filters .filter-range > span { color: var(--text-3); font-size: 12px; }
.report-sub-filters .filter-actions { display: flex; gap: 10px; align-items: center; margin-left: auto; }
/* 库存报表：一级库 / 二级库 筛选分组 */
.report-sub-filters .filter-group { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; padding: 4px 16px 4px 0; position: relative; }
.report-sub-filters .filter-group + .filter-group { border-left: 1px dashed #d4ddec; padding-left: 18px; }
.report-sub-filters .filter-group-label { width: 100%; font-size: 12px; font-weight: 700; color: var(--brand-dark); letter-spacing: .3px; margin-bottom: 2px; }
.stock-h { margin: 18px 0 8px; padding-left: 9px; border-left: 3px solid var(--brand-2); font-size: 15px; color: var(--text); font-weight: 600; }
/* 应收总账合计行高亮 */
#rep-receivables-table tfoot td, #rep-receivables-table tr.rec-total td { background: #f3f7fd; font-weight: 600; border-top: 2px solid var(--brand-border); }
.report-summary { font-size: 13px; color: var(--text-2); background: var(--brand-soft); border: 1px solid var(--brand-border); border-radius: var(--r-sm); padding: 9px 13px; margin-bottom: 12px; }
.report-summary b { color: var(--brand); }
.report-summary .amount { color: var(--success); }
.report-summary .amount-due { color: var(--danger); }

/* 报表详情：宽表吸顶表头 + 长列表滚动 */
.report-detail .table-wrap { max-height: 64vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
.report-detail .table-wrap table { margin: 0; }
.report-detail .table-wrap thead th {
  position: sticky; top: 0; z-index: 2;
  background: linear-gradient(180deg, #f7f9fc, #eef2f8);
  box-shadow: inset 0 -1px 0 var(--border);
}
/* 客户抬头：允许换行，弱化显示，避免挤占数值列 */
.report-detail .ctitle { color: var(--text-2); white-space: normal; word-break: break-all; min-width: 96px; max-width: 180px; }
/* 报表合计行高亮 */
#rep-modal-outbound tr.rec-total td,
#rep-modal-receivables tr.rec-total td {
  background: #f3f7fd; font-weight: 600; border-top: 2px solid var(--brand-border);
}
#cash-form.form-grid { grid-template-columns: repeat(3, 1fr); }
#cash-form.form-grid label:last-of-type { grid-column: 1 / -1; }
#cash-form .form-actions { grid-column: 1 / -1; }

/* 客户对账单：分组表头与订单小计 */
#rep-modal-statement thead th { background: var(--brand); color: #fff; font-weight: 600; vertical-align: middle; padding: 11px 12px; position: sticky; top: 0; z-index: 1; }
#rep-modal-statement thead tr:first-child th { border-bottom: 1px solid rgba(255,255,255,.25); }
#rep-modal-statement tbody td { padding: 9px 12px; font-variant-numeric: tabular-nums; }
/* 小计/合并且合并首列（订单 X 小计 / 合计）标签保持居中（仅影响 colspan 合并单元格，不与列对齐冲突） */
#rep-modal-statement tr.order-subtotal td:first-child,
#rep-modal-statement tr.rec-total td:first-child { text-align: center; }
/* 每个订单的首行（含合并单元格）左侧加标识色条，区分不同订单 */
#rep-modal-statement tbody tr:not(.order-subtotal):not(.rec-total) td:first-child { border-left: 3px solid var(--brand-2); }
#rep-modal-statement tbody tr.order-group { background: #fafcff; }
#rep-modal-statement tbody tr:hover td { background: #f0f6ff; }
#rep-modal-statement tr.order-subtotal td { background: #e7eefb; font-weight: 600; color: var(--brand-dark); border-top: 1px dashed var(--brand-border); }
#rep-modal-statement tr.order-subtotal td:first-child { border-left: 3px solid var(--brand); border-radius: 0 0 0 4px; }
#rep-modal-statement tr.rec-total td { background: linear-gradient(180deg,#f3f7fd,#e9f1fc); font-weight: 700; border-top: 2px solid var(--brand); color: var(--text); }
#rep-modal-statement tr.rec-total td:first-child { border-left: 3px solid var(--brand); }
/* 长列表时表头吸顶；表格自适应容器宽度，尽量不出现横向滚动条 */
.report-detail .table-scroll { max-height: 62vh; overflow-y: auto; overflow-x: hidden; border: 1px solid var(--border); border-radius: var(--r-md); }
.report-detail .table-scroll table { margin: 0; width: 100%; table-layout: fixed; }
#rep-modal-statement tbody td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 固定列宽（合计=100%），确保小计/合计的 colspan 与明细列严格对齐 */
#rep-modal-statement col.c-order { width: 5%; }
#rep-modal-statement col.c-date { width: 4%; }
#rep-modal-statement col.c-qty { width: 4.5%; }
#rep-modal-statement col.c-prod { width: 3.5%; }
#rep-modal-statement col.c-acc { width: 3.5%; }
#rep-modal-statement col.c-plate { width: 6%; }
#rep-modal-statement col.c-title2 { width: 5%; }
#rep-modal-statement col.c-invprice { width: 5.5%; }
#rep-modal-statement col.c-outprice { width: 4.5%; }
#rep-modal-statement col.c-amtqty { width: 4.5%; }
#rep-modal-statement col.c-price { width: 4.5%; }
#rep-modal-statement col.c-plan { width: 4.5%; }
#rep-modal-statement col.c-unitprice { width: 5%; }
#rep-modal-statement col.c-amount { width: 5.5%; }
#rep-modal-statement col.c-paydate { width: 6%; }
#rep-modal-statement col.c-pay { width: 6%; }
#rep-modal-statement col.c-payacc { width: 6%; }
#rep-modal-statement col.c-paytitle { width: 6%; }
#rep-modal-statement col.c-due { width: 5%; }
#rep-modal-statement col.c-inv { width: 5%; }
#rep-modal-statement col.c-note { width: 8%; min-width: 110px; }
/* 列级对齐：作用于该列所有单元格（表头/明细/小计/合计），不受 rowspan/colspan 干扰 */
#rep-modal-statement col.c-order,
#rep-modal-statement col.c-date,
#rep-modal-statement col.c-qty,
#rep-modal-statement col.c-plate,
#rep-modal-statement col.c-paydate { text-align: center; }
#rep-modal-statement col.c-amtqty,
#rep-modal-statement col.c-price,
#rep-modal-statement col.c-plan,
#rep-modal-statement col.c-unitprice,
#rep-modal-statement col.c-amount,
#rep-modal-statement col.c-pay,
#rep-modal-statement col.c-inv,
#rep-modal-statement col.c-due { text-align: right; }
/* 退款以负数标红显示 */
#rep-modal-statement tbody td.refund { color: #c0392b; font-weight: 600; }
#rep-modal-statement col.c-prod,
#rep-modal-statement col.c-acc,
#rep-modal-statement col.c-payacc,
#rep-modal-statement col.c-paytitle { text-align: left; }
/* 单列客户视图：客户列宽度归零，消除隐藏列导致的整表相对表头右移错位 */
#rep-modal-statement.hide-cust-col col.c-acc { width: 0; }
/* 客户对账单：所有表头标题允许换行，避免窄列标题被截断 */
#rep-modal-statement th { white-space: normal; word-break: break-all; line-height: 1.25; }
/* 备注列允许换行显示，不被 nowrap 截断 */
#rep-modal-statement td.note-cell { white-space: normal; word-break: break-all; overflow: visible; text-overflow: clip; }
/* 缩短后的窄列（订单日期/商品名/客户名）内容换行显示，不再以省略号截断，其余单元格保持原显示逻辑 */
#rep-modal-statement tbody td.c-date,
#rep-modal-statement tbody td.c-prod,
#rep-modal-statement tbody td.c-acc { white-space: normal; word-break: break-all; overflow: visible; text-overflow: clip; }
/* 客户对账单全屏展示：报表详情页内容撑满视口宽度 */
#tab-report-detail .content { max-width: none; padding-left: 24px; padding-right: 24px; }
/* 客户对账单：19 列较宽，设最小宽度避免被压缩到换行；不足时由 .table-wrap 横向滚动 */
#rep-modal-statement { width: 100%; min-width: 1700px; table-layout: fixed; }
#rep-modal-statement thead th { white-space: normal; }
#rep-modal-statement tbody td { white-space: normal; word-break: break-all; }
/* 账户/抬头/公司抬头等长文本：允许换行以保证完整显示，单元格内最多 2 行，避免个别行被撑得过高；完整内容悬停可见 */
#rep-modal-statement tbody td.ctitle > .cell-clamp,
#rep-modal-statement tbody td.ptitle > .cell-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}
/* 报表详情区突破页面 1520 内容宽度限制，使用更宽的可视区域（不影响数据） */
#tab-report-detail {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
  overflow-x: hidden;
  border-radius: 0;
}
/* 空数据提示行 */
#rep-modal-statement tbody td.empty { text-align: center; color: var(--muted); padding: 28px 0; }
.report-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; margin-bottom: 18px; }
.report-card {
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px;
  background: var(--surface); box-shadow: var(--shadow-sm); cursor: pointer;
  transition: box-shadow .2s, transform .12s, border-color .2s;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 10px;
}
.report-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); opacity: .85; }
.report-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--brand-border); }
.report-card-head { cursor: pointer; }
.report-card-head h3 { margin: 0; font-size: 15.5px; color: var(--text); font-weight: 700; }
.report-card-desc { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 0; min-height: 40px; }
.report-open { color: var(--accent); font-size: 13px; font-weight: 600; margin-top: auto; }
.report-card:hover .report-open { text-decoration: underline; }
/* 报表图标：圆角方块 + 渐变底色，各报表用不同色系便于区分 */
.report-card-icon {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; letter-spacing: .5px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  box-shadow: 0 3px 8px rgba(42, 82, 152, 0.22);
}
.report-card[data-report="stock"] .report-card-icon { background: linear-gradient(135deg, #36cfc9, #08979c); box-shadow: 0 3px 8px rgba(8, 151, 156, 0.22); }
.report-card[data-report="receivables"] .report-card-icon { background: linear-gradient(135deg, #ffa940, #d46b08); box-shadow: 0 3px 8px rgba(212, 107, 8, 0.22); }
.report-card[data-report="statement"] .report-card-icon { background: linear-gradient(135deg, #9254de, #722ed1); box-shadow: 0 3px 8px rgba(114, 46, 209, 0.22); }
.report-card[data-report="cash"] .report-card-icon { background: linear-gradient(135deg, #73d13d, #389e0d); box-shadow: 0 3px 8px rgba(56, 158, 13, 0.22); }
.report-card[data-report="stock"]::before { background: linear-gradient(180deg, #36cfc9, #08979c); }
.report-card[data-report="receivables"]::before { background: linear-gradient(180deg, #ffa940, #d46b08); }
.report-card[data-report="statement"]::before { background: linear-gradient(180deg, #9254de, #722ed1); }
.report-card[data-report="cash"]::before { background: linear-gradient(180deg, #73d13d, #389e0d); }
.report-card .report-summary { margin: 12px 0; }
.report-card .btn { width: 100%; }

/* ===== 公司总库存弹窗标题配色 ===== */
#company-modal .modal-body h3 { margin: 16px 0 10px; color: var(--brand); font-size: 15px; padding-left: 11px; border-left: 3px solid var(--brand-2); }

/* ===== 全局细节打磨 ===== */
html { scroll-behavior: smooth; }
::placeholder { color: #aab4c4; }
input::placeholder, select::placeholder { opacity: 1; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; border-radius: var(--r-sm); }

/* ===== 复选框统一外观 =====
   复选框仅 15px，套用全局 2px outline + 2px offset 会形成一个悬浮的硬边矩形框
   （部分系统主题下渲染为白色，即「点击出现矩形白框」）。
   故单独改用柔和光晕，并用 accent-color 统一勾选色为主题蓝。 */
/* ===== 复选框最终样式（!important 兜底）=====
   此前的尝试都没解决矩形框问题，根因是 .form-grid label input、
   .modal-body input 等 20+ 条规则都用通用 input 选择器命中复选框，
   给它套上了 padding、border、box-shadow。
   鼠标点击触发 :focus 而非 :focus-visible，所以前两轮的 :focus-visible 修复不生效。
   这里用 !important 强制清除所有错误样式，无视任何选择器优先级。 */
input[type="checkbox"] {
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  max-width: 15px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 3px !important;
  flex: none !important;
  cursor: pointer !important;
  accent-color: var(--brand-2) !important;
  appearance: auto !important;
  -webkit-appearance: auto !important;
}
/* 复选框聚焦时不再套 box-shadow（即使柔和光晕也会在 15px 上看起来像矩形），
   只保留 accent-color 勾选变化与原生 outline 自适应主题。 */
input[type="checkbox"]:focus,
input[type="checkbox"]:focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}
/* 父容器内的复选框：标签默认是 column 布局，复选框+文字会竖排。
   在所有可能容器中显式声明 row。 */
.perm-item, .perm-all-toggle, .form-grid label input[type="checkbox"],
.modal-body label input[type="checkbox"], label input[type="checkbox"] {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cdd7e6; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #b3c0d6; }
::-webkit-scrollbar-track { background: transparent; }
.card { transition: box-shadow .2s, transform .12s; }
.card:hover { box-shadow: var(--shadow-md); }
.section-title { display: flex; align-items: center; gap: 2px; }
.empty-block { box-shadow: var(--shadow-sm); }
.list-scroll { border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.muted { color: var(--muted); font-size: 13px; }

/* ============================================================
   帮助文档（用户手册）全屏阅读器
   ============================================================ */
.help-box {
  width: min(1080px, 96vw);
  height: 90vh;
  max-width: none;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.help-head-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.help-doc-title { font-size: 13px; color: var(--muted); }

/* 文档切换（用户手册 / 运维手册） */
.help-docs { display: flex; gap: 4px; padding: 3px; background: #eaf0f9; border-radius: 20px; }
.help-doc-btn {
  padding: 6px 18px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-2);
  background: none;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.help-doc-btn:hover { color: var(--brand); }
.help-doc-btn.active { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.help-search {
  width: 200px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.help-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 111, 237, .12); }

.help-layout {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* ---- 左侧目录 ---- */
.help-toc {
  width: 250px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: #fafbfe;
  overflow-y: auto;
  padding: 14px 0 30px;
}
.help-toc-item {
  display: block;
  padding: 7px 20px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.help-toc-item:hover { background: var(--brand-soft); color: var(--brand); }
.help-toc-item.lv3 { padding-left: 34px; font-size: 12.5px; color: var(--muted); }

/* ---- 右侧正文 ---- */
.help-body {
  flex: 1;
  overflow-y: auto;
  padding: 26px 40px 80px;
  line-height: 1.85;
  color: var(--text);
  font-size: 14.5px;
}
.help-body > :first-child { margin-top: 0; }
.help-body h1 {
  font-size: 24px;
  margin: 0 0 20px;
  padding-bottom: 14px;
  color: var(--brand);
  border-bottom: 2px solid var(--brand-border);
}
.help-body h2 {
  font-size: 19px;
  margin: 38px 0 16px;
  padding-left: 12px;
  color: var(--brand);
  border-left: 4px solid var(--brand-2);
  scroll-margin-top: 16px;
}
.help-body h3 { font-size: 16px; margin: 28px 0 12px; color: var(--brand-2); scroll-margin-top: 16px; }
.help-body h4 { font-size: 14.5px; margin: 22px 0 10px; color: var(--text-2); }
.help-body p { margin: 12px 0; }
.help-body hr { margin: 30px 0; border: none; border-top: 1px solid var(--border); }

.help-body ul, .help-body ol { margin: 12px 0 12px 24px; }
.help-body li { margin: 6px 0; }
.help-body code {
  padding: 2px 6px;
  font-size: 13px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color: var(--purple);
  background: #f5f2ff;
  border-radius: 4px;
}
.help-body strong { color: var(--text); font-weight: 600; }
.help-body a { color: var(--accent); text-decoration: none; border-bottom: 1px dashed var(--accent); cursor: pointer; }
.help-body a:hover { color: var(--brand); border-bottom-style: solid; }

.help-body pre.md-code {
  margin: 16px 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: #1e2433;
  border-radius: var(--r-md);
}
.help-body pre.md-code code {
  padding: 0;
  color: #d7e0f0;
  background: none;
  font-size: 12.5px;
  line-height: 1.6;
}

.help-body blockquote {
  margin: 16px 0;
  padding: 12px 18px;
  color: var(--text-2);
  background: var(--warn-bg);
  border-left: 4px solid var(--warn);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.help-body blockquote p { margin: 4px 0; }

.help-body .md-table-wrap {
  margin: 18px 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.help-body table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.help-body thead th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  white-space: nowrap;
}
.help-body tbody td { padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: top; }
.help-body tbody tr:nth-child(even) { background: #fafbfe; }
.help-body tbody tr:hover { background: var(--brand-soft); }

/* ---- 窄屏适配 ---- */


/* ===== 2026 UI polish: 统一层级、留白与窄屏体验 ===== */
:root {
  --brand-dark: #17315f;
  --text-3: #6f7f98;
  --surface-raised: #ffffff;
  --focus-ring: 0 0 0 4px rgba(47, 111, 237, .14);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 92% 0%, rgba(42, 82, 152, .07), transparent 28rem),
    var(--bg);
}

button, input, select { font-family: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.topbar {
  min-height: 64px;
  padding: 14px clamp(16px, 3vw, 42px);
  background: linear-gradient(115deg, #172f5d 0%, #1e3c72 52%, #315fa7 100%);
}
.topbar .logo { font-size: clamp(16px, 1.5vw, 19px); }
.topbar .logo-sub { font-size: 12px; }
.topbar-right { gap: 8px; }
.topbar-right .btn-ghost { padding: 7px 13px; }

.wh-bar {
  padding: 11px clamp(16px, 3vw, 42px);
  background: rgba(238, 243, 251, .92);
  backdrop-filter: blur(8px);
}
.wh-bar-left, .wh-bar-right { gap: 8px; }
.wh-bar select { min-width: 190px; height: 36px; }

.tabs {
  position: sticky;
  top: 64px;
  z-index: 90;
  gap: 2px;
  padding: 8px clamp(12px, 2.5vw, 36px) 0;
  box-shadow: 0 3px 12px rgba(30, 60, 114, .05);
}
.tab { padding: 12px 17px; }

.content {
  width: 100%;
  padding: clamp(18px, 3vw, 32px) clamp(16px, 3vw, 42px) 48px;
}
.panel-head { min-height: 38px; margin-bottom: 18px; }
.panel-head h2 { font-size: 19px; letter-spacing: .1px; }
.panel-head .muted { flex: 0 1 auto; }

.table-wrap {
  box-shadow: 0 6px 20px rgba(30, 60, 114, .045);
}
table { border-color: #e1e8f2; }
th, td { padding: 11px 13px; }
th { background: linear-gradient(180deg, #f9fbfd, #eef3f9); color: #50627e; }
tbody tr:last-child td { border-bottom: 0; }

.btn {
  min-height: 36px;
  font-weight: 600;
  letter-spacing: .1px;
}
.btn-sm { min-height: 32px; }
.btn-primary { background: linear-gradient(135deg, #3679ed, #285dc7); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-warn, .btn-danger, .btn-invoice, .btn-return { font-weight: 600; }

input, select {
  color: var(--text);
}
/* 文本/下拉/文本域的统一焦点样式。复选框不从此处继承，
   否则 box-shadow + !important 会在 15px 复选框外套一个厚重蓝色矩形框。 */
input:not([type="checkbox"]):focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: var(--focus-ring) !important;
}

/* ===== 复选框统一外观 =====
   复选框仅 15px，套用 4px box-shadow 会形成厚重蓝色矩形，故单独定制： */
input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  flex: none;
  cursor: pointer;
  accent-color: var(--brand-2);
}
input[type="checkbox"]:focus,
input[type="checkbox"]:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  border-radius: 3px;
}

.card, .quick-form, .audit-filters, .report-filters, .report-sub-filters {
  border-color: #e1e8f2;
}
.quick-form { padding: 17px 20px; }

.modal {
  padding: clamp(20px, 6vh, 64px) 16px;
  background: rgba(10, 23, 48, .56);
}
.modal-box {
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 22px 70px rgba(10, 25, 60, .28);
}
.modal-head { padding: 17px 22px; }
.modal-body { padding: 22px; }

/* 把操作按钮与表单内容在窄屏下改为单列，避免控件互相挤压。 */
@media (max-width: 860px) {
  .help-box { height: 94vh; width: 98vw; }
  .help-toc { display: none; }
  .help-body { padding: 20px 18px 60px; }
  .help-search { width: 130px; }
}

@media (max-width: 760px) {
  .topbar { position: relative; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
  .topbar-right { width: 100%; flex-wrap: wrap; }
  #user-info { order: -1; }
  .tabs { top: 0; }
  .panel-head { align-items: flex-start; }
  .panel-head > .btn-primary,
  .panel-head > #open-user-create,
  .stock-toggle { margin-left: 0; }
  .panel-head > .btn-primary { width: 100%; }
  .stock-toggle { width: 100%; }
  .stock-toggle .btn { flex: 1; }
  .report-cards { grid-template-columns: 1fr; }
  .modal { padding: 12px; }
  .modal-box { max-height: calc(100vh - 24px); }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
  .form-grid { padding-left: 8px; }
}

@media (max-width: 520px) {
  body { font-size: 13px; }
  .topbar .logo { flex-wrap: wrap; gap: 6px; }
  .topbar .logo-sub { width: 100%; margin-left: 36px; }
  .topbar-right .btn-ghost { flex: 1; padding-left: 8px; padding-right: 8px; }
  .wh-bar-left, .wh-bar-right { width: 100%; }
  .wh-bar select { flex: 1; min-width: 0; }
  .wh-bar-right .btn { width: 100%; }
  .content { padding-top: 18px; }
  .panel-head h2 { width: 100%; }
  .filter-check { margin-right: 0; }
  .summary-card { flex: 1 1 140px; min-width: 0; padding: 13px 15px; }
  th, td { padding: 9px 10px; }
  .pager { align-items: stretch; }
  .pager-ctrl { width: 100%; justify-content: space-between; }
  .login-card { padding: 30px 22px 22px; }
  .login-brand { gap: 11px; }
  .login-brand-text h1 { font-size: 18px; }
}



/* 订单明细重新布局：14 列按信息密度分配，优先保证出库时间和付款信息完整。 */
#order-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
#order-table th,
#order-table td {
  width: auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
  vertical-align: middle;
}
#order-table th:nth-child(1), #order-table td:nth-child(1) { width: 9%; }
#order-table th:nth-child(2), #order-table td:nth-child(2) { width: 9%; }
#order-table th:nth-child(3), #order-table td:nth-child(3) { width: 6%; }
#order-table th:nth-child(4), #order-table td:nth-child(4) { width: 9%; }
#order-table th:nth-child(5), #order-table td:nth-child(5) { width: 7%; }
#order-table th:nth-child(6), #order-table td:nth-child(6) { width: 6%; }
#order-table th:nth-child(7), #order-table td:nth-child(7) { width: 11%; }
#order-table th:nth-child(8), #order-table td:nth-child(8) { width: 4%; }
#order-table th:nth-child(9), #order-table td:nth-child(9) { width: 5%; }
#order-table th:nth-child(10), #order-table td:nth-child(10) { width: 6%; }
#order-table th:nth-child(11), #order-table td:nth-child(11) { width: 6%; }
#order-table th:nth-child(12), #order-table td:nth-child(12) { width: 7%; }
#order-table th:nth-child(13), #order-table td:nth-child(13) { width: 10%; }
#order-table th:nth-child(14), #order-table td:nth-child(14) { width: 6%; }
#order-table th:nth-child(15), #order-table td:nth-child(15) { width: 80px; }
#order-table th:last-child, #order-table td:last-child { width: 120px; text-align: center; white-space: nowrap; overflow: visible; }
/* 出库时间、订单号：固定为单行数据刚好够用的宽度，避免随全宽被撑大 */
#order-table th:nth-child(1), #order-table td:nth-child(1) { width: 156px; }
#order-table th:nth-child(2), #order-table td:nth-child(2) { width: 140px; }

/* 名称、订单号和备注只在必要时换行；时间、数值与状态保持紧凑。 */
#order-table th,
#order-table td {
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}
#order-table td.col-no {
  line-height: 1.25;
  font-size: 10.5px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}
#order-table td:nth-child(8),
#order-table td:nth-child(9),
#order-table td:nth-child(10),
#order-table td:nth-child(11),
#order-table td:nth-child(12) {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  font-size: 11px;
  letter-spacing: -.2px;
}
#order-table td:nth-child(14) .status {
  white-space: nowrap;
  font-size: 11px;
  padding-left: 6px;
  padding-right: 6px;
}
#order-table .col-time {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
#order-table .col-time span { white-space: nowrap; }
#order-table .col-pay { gap: 1px; line-height: 1.2; }
#order-table .col-pay span { white-space: nowrap; font-size: 11px; }

/* 不出现横向滚动；所有列在表格内部完成换行。 */
#tab-outbound-orders .table-wrap {
  width: 100%;
  overflow-x: hidden;
}

/* 订单管理页：激活时让内容区突破 max-width，左右铺满全屏。
   用纯 CSS :has() 选中祖先 main.content，比 full-bleed 计算更简单，且仅作用于本页。 */
main.content:has(#tab-outbound-orders.active) { max-width: none; }

/* ===== 全站高级视觉层：装饰、层级与一致性 ===== */
:root {
  --brand: #173966;
  --brand-2: #245da8;
  --accent: #3d7bea;
  --accent-cyan: #18a6b8;
  --brand-soft: #edf4ff;
  --brand-border: #cbdcf3;
  --text: #18263a;
  --text-2: #4c5f78;
  --muted: #8090a6;
  --border: #dfe7f1;
  --bg: #edf2f8;
  --surface-glass: rgba(255, 255, 255, .88);
  --r-sm: 8px;
  --r-md: 13px;
  --r-lg: 18px;
  --shadow-sm: 0 3px 12px rgba(26, 57, 96, .06);
  --shadow-md: 0 12px 32px rgba(26, 57, 96, .11);
  --shadow-lg: 0 28px 80px rgba(12, 32, 64, .25);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 12%, rgba(61, 123, 234, .10), transparent 23rem),
    radial-gradient(circle at 92% 72%, rgba(24, 166, 184, .08), transparent 26rem),
    linear-gradient(180deg, #f2f6fb 0%, #eaf0f7 100%);
}

#app-view {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}
#app-view::before,
#app-view::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(2px);
}
#app-view::before {
  width: 360px;
  height: 360px;
  right: -170px;
  top: 180px;
  border: 70px solid rgba(61, 123, 234, .045);
}
#app-view::after {
  width: 240px;
  height: 240px;
  left: -120px;
  bottom: 5vh;
  background: linear-gradient(135deg, rgba(24, 166, 184, .05), rgba(61, 123, 234, .02));
}

/* 登录页装饰采用纯 CSS 光晕和网格，不增加图片依赖。 */
.login-wrap {
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    radial-gradient(circle at 18% 20%, rgba(83, 163, 255, .38), transparent 30rem),
    linear-gradient(135deg, #102b50 0%, #184678 52%, #246c91 100%);
  background-size: 38px 38px, 38px 38px, auto, auto;
}
.login-wrap::before,
.login-wrap::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.login-wrap::before {
  width: 420px;
  height: 420px;
  right: -130px;
  top: -160px;
  border: 90px solid rgba(255, 255, 255, .055);
}
.login-wrap::after {
  width: 260px;
  height: 260px;
  left: -80px;
  bottom: -120px;
  background: rgba(56, 196, 204, .12);
  box-shadow: 0 0 100px rgba(56, 196, 204, .15);
}
.login-card {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255,255,255,.72);
  box-shadow: 0 30px 90px rgba(4, 21, 48, .40), inset 0 1px 0 #fff;
}
.login-card::before {
  content: "";
  position: absolute;
  left: 32px;
  right: 32px;
  top: 0;
  height: 3px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent-cyan));
}
.login-badge { box-shadow: 0 12px 28px rgba(34, 93, 168, .32); }

.topbar {
  min-height: 68px;
  overflow: hidden;
  background: linear-gradient(112deg, #122f57 0%, #194777 55%, #22648c 100%);
  border-bottom: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 8px 28px rgba(18, 47, 87, .20);
}
.topbar::after {
  content: "";
  position: absolute;
  width: 360px;
  height: 180px;
  right: 22%;
  top: -120px;
  border-radius: 50%;
  border: 34px solid rgba(255,255,255,.045);
  pointer-events: none;
}
.topbar .logo::before {
  content: none;
}
.topbar-right .btn-ghost,
#user-info {
  border-color: rgba(255,255,255,.24);
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(10px);
}

.wh-bar {
  position: relative;
  z-index: 5;
  background: rgba(245, 249, 254, .90);
  backdrop-filter: blur(14px);
  border-bottom-color: rgba(196, 214, 237, .85);
  box-shadow: 0 8px 22px rgba(31, 68, 112, .05);
}
.wh-label::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 0 4px rgba(24, 166, 184, .12);
  vertical-align: 1px;
}
.wh-bar select { border-color: #ccdaeb; box-shadow: inset 0 1px 2px rgba(26,57,96,.04); }

.tabs {
  top: 68px;
  padding: 10px clamp(14px, 2.6vw, 42px);
  gap: 6px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(210, 222, 237, .86);
  box-shadow: 0 7px 24px rgba(26, 57, 96, .07);
}
.tab {
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 600;
}
.tab:hover { border-color: #dce7f5; background: #f3f7fc; }
.tab.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #2d6dc8, #24579c);
  box-shadow: 0 7px 18px rgba(36, 93, 168, .22);
}

.content {
  max-width: 1600px;
  padding: clamp(22px, 3vw, 38px) clamp(16px, 3vw, 46px) 56px;
}
.tab-panel.active {
  position: relative;
  padding: clamp(18px, 2.2vw, 28px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.92);
  border-radius: 20px;
  background: var(--surface-glass);
  box-shadow: 0 18px 48px rgba(25, 56, 94, .09), inset 0 1px 0 #fff;
  backdrop-filter: blur(10px);
}
.tab-panel.active::after {
  content: "";
  position: absolute;
  z-index: 0;
  width: 180px;
  height: 180px;
  right: -105px;
  top: -110px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(61,123,234,.09), rgba(24,166,184,.04));
  pointer-events: none;
}
.tab-panel.active > * { position: relative; z-index: 1; }
.panel-head {
  min-height: 44px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e8eef6;
}
.panel-head h2 {
  font-size: clamp(18px, 1.45vw, 22px);
  color: #173b69;
  letter-spacing: .1px;
}
.panel-head h2::before {
  width: 5px;
  height: 24px;
  background: linear-gradient(180deg, var(--accent-cyan), var(--accent));
  box-shadow: 0 0 0 4px rgba(61,123,234,.07);
}
.panel-head .muted { max-width: 760px; }

.btn {
  border: 1px solid rgba(99, 122, 151, .12);
  box-shadow: 0 2px 6px rgba(28, 58, 94, .05);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(28, 58, 94, .12); }
.btn:active { transform: translateY(0); }
.btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, #3d7bea, #2459a5);
  box-shadow: 0 7px 16px rgba(45, 105, 199, .22);
}
.btn-warn { background: linear-gradient(135deg, #e5a227, #c9820b); }
.btn-danger { background: linear-gradient(135deg, #df4c57, #b82230); }
.btn-invoice { background: linear-gradient(135deg, #1db8c5, #168b9d); }

input, select, textarea,
.quick-form input, .quick-form select,
.form-grid label input, .form-grid label select {
  border-color: #d8e2ee;
  background: #fbfdff;
  box-shadow: inset 0 1px 2px rgba(23, 57, 102, .035);
}
input:hover, select:hover, textarea:hover { border-color: #b9cce4; }

.filter-check {
  padding: 7px 11px;
  border: 1px solid #dce6f2;
  border-radius: 9px;
  background: #f7faff;
  color: var(--text-2);
}
.filter-check input { accent-color: var(--accent); }
.filter-check select { margin-left: 2px; padding: 2px 6px; border: 1px solid #cdd9ea; border-radius: 7px; background: #fff; font-size: 13px; color: #1f2733; max-width: 180px; }

.table-wrap {
  border: 1px solid #dfe7f1;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(26, 57, 96, .065);
}
table { border: 0; border-radius: 14px; box-shadow: none; }
th {
  background: linear-gradient(180deg, #f8fbff, #edf3fa);
  color: #425b79;
  border-bottom-color: #d5e1ef;
  text-transform: none;
}
th:first-child { box-shadow: inset 3px 0 0 rgba(61,123,234,.42); }
tbody tr:nth-child(even) td { background: #fbfcfe; }
tbody tr:hover td { background: #edf5ff !important; }
td { color: #26384e; }
td.empty {
  background: linear-gradient(180deg, #fff, #fafcff) !important;
  color: #90a0b4;
}

.pager {
  margin-top: 16px;
  border-color: #dce6f1;
  background: rgba(250,252,255,.92);
  box-shadow: 0 7px 18px rgba(26,57,96,.05);
}
.pager-info::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
}

.quick-form,
.audit-filters,
.report-filters,
.report-sub-filters {
  position: relative;
  overflow: hidden;
  border-color: #dce6f2;
  background: linear-gradient(135deg, #f9fbfe, #f2f7fd);
  box-shadow: 0 8px 22px rgba(26,57,96,.055);
}
.quick-form::before,
.audit-filters::before,
.report-filters::before,
.report-sub-filters::before {
  content: "";
  width: 4px;
  align-self: stretch;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent-cyan), var(--accent));
}

.subtabs {
  padding: 5px;
  width: fit-content;
  border: 1px solid #dce6f1;
  border-radius: 14px;
  background: #f4f8fd;
}
.subtab { border-color: transparent; background: transparent; }
.subtab.active { box-shadow: 0 7px 16px rgba(36,89,165,.20); }

.report-cards { gap: 20px; }
.report-card {
  position: relative;
  overflow: hidden;
  border-color: #dce6f1;
  border-radius: 16px;
  background: linear-gradient(145deg, #fff 0%, #f7faff 100%);
  box-shadow: 0 10px 26px rgba(26,57,96,.07);
}
.report-card::after {
  content: "";
  position: absolute;
  width: 90px;
  height: 90px;
  right: -38px;
  bottom: -45px;
  border-radius: 50%;
  background: rgba(61,123,234,.07);
}
.report-card:hover {
  transform: translateY(-5px);
  border-color: #b9cde7;
  box-shadow: 0 18px 38px rgba(26,57,96,.14);
}
.report-card-icon {
  color: #fff;
  background: linear-gradient(135deg, #3d7bea, #2459a5);
  box-shadow: 0 7px 16px rgba(36,89,165,.20);
}
.report-open { color: var(--accent); font-weight: 700; }

.stock-summary, .summary-row { gap: 14px; }
.summary-card,
.stock-block,
.lib-card,
.info-card,
.section-block,
.order-summary,
.cash-sec,
.ib-card,
.ib-invoice,
.ib-notes,
.modal-lists > div {
  border-color: #dce6f1;
  box-shadow: 0 8px 22px rgba(26,57,96,.06);
}
.summary-card,
.stock-block,
.lib-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #fff, #f7faff);
}
.summary-card::before,
.stock-block::before,
.lib-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent-cyan), var(--accent));
}
.summary-card:hover,
.stock-block:hover,
.lib-card:hover,
.info-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.modal { background: rgba(10, 27, 51, .58); backdrop-filter: blur(8px); }
.modal-box {
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 20px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 #fff;
}
.modal-head {
  border-bottom-color: #dce6f1;
  background: linear-gradient(135deg, rgba(250,252,255,.98), rgba(237,245,255,.98));
}
.modal-head::before {
  content: "";
  width: 4px;
  height: 22px;
  margin-right: 10px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent-cyan), var(--accent));
  box-shadow: 0 0 0 4px rgba(61,123,234,.07);
}
.modal-head > :first-child { margin-right: auto; }
.modal-close { border: 1px solid transparent; }
.modal-close:hover { border-color: #d7e2ef; background: #fff; color: #c0392b; }
.modal-tip {
  padding: 9px 11px;
  border-radius: 9px;
  background: #f3f7fc;
  border-left: 3px solid #8db2e4;
}

.toast {
  border: 1px solid rgba(255,255,255,.25);
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 36px rgba(10,27,51,.22);
}

@media (max-width: 760px) {
  .tabs { top: 0; padding: 8px 10px; }
  .content { padding: 14px 10px 34px; }
  .tab-panel.active { padding: 16px 12px; border-radius: 15px; }
  .panel-head { padding-bottom: 13px; }
  .quick-form::before,
  .audit-filters::before,
  .report-filters::before,
  .report-sub-filters::before { display: none; }
  .subtabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .subtab { flex: 0 0 auto; }
}

@media (max-width: 520px) {
  .login-card { padding: 34px 22px 24px; }
  .topbar::after, #app-view::before, #app-view::after { display: none; }
  .wh-bar { padding-left: 12px; padding-right: 12px; }
  .panel-head h2 { font-size: 18px; }
  .tab-panel.active { border-left: 0; border-right: 0; }
  .report-card { min-height: 150px; }
}

/* ===== 弹窗专属视觉系统 ===== */
.modal:not(.hidden) {
  align-items: center;
  padding: clamp(16px, 4vh, 44px) 18px;
  background:
    radial-gradient(circle at 20% 12%, rgba(78, 143, 236, .18), transparent 28rem),
    rgba(7, 20, 40, .68);
  backdrop-filter: blur(14px) saturate(125%);
  animation: modalBackdropIn .22s ease both;
}
.modal-box {
  position: relative;
  width: min(1100px, calc(100vw - 36px));
  max-height: min(88vh, 900px);
  overflow: hidden auto;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 22px;
  background: linear-gradient(160deg, #ffffff 0%, #f8fbff 58%, #f2f7fd 100%);
  box-shadow: 0 34px 100px rgba(3, 18, 40, .42), 0 8px 24px rgba(3,18,40,.16), inset 0 1px 0 #fff;
  animation: modalPanelIn .28s cubic-bezier(.2,.8,.2,1) both;
  scrollbar-color: #b8c8dc transparent;
}
.modal-box::before {
  content: "";
  position: absolute;
  z-index: 0;
  width: 240px;
  height: 240px;
  right: -130px;
  top: 46px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(61,123,234,.10), rgba(24,166,184,.025) 58%, transparent 70%);
  pointer-events: none;
}
.modal-head {
  min-height: 68px;
  padding: 17px 22px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.14);
  border-radius: 21px 21px 0 0;
  background: linear-gradient(112deg, #15365f 0%, #205a91 62%, #237b94 100%);
  box-shadow: 0 8px 24px rgba(20,54,95,.18);
  overflow: hidden;
}
.modal-head::before {
  width: 10px;
  height: 10px;
  margin-right: 12px;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 50%;
  background: rgba(91, 210, 218, .9);
  box-shadow: 0 0 0 5px rgba(255,255,255,.10), 0 0 20px rgba(91,210,218,.55);
}
.modal-head::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: 76px;
  top: -106px;
  border: 26px solid rgba(255,255,255,.055);
  border-radius: 50%;
  pointer-events: none;
}
.modal-head > span,
.modal-head > h3 {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .3px;
}
.modal-close {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  color: rgba(255,255,255,.88);
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(8px);
}
.modal-close:hover {
  color: #fff;
  border-color: rgba(255,255,255,.48);
  background: rgba(255,255,255,.20);
  transform: rotate(4deg);
}
.modal-body {
  position: relative;
  z-index: 1;
  padding: clamp(20px, 2.5vw, 30px);
  background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(247,250,254,.94));
}

/* 新增、编辑、密码和权限弹窗的表单采用独立内容卡片。 */
.modal-body > .form-grid,
.modal-body > .col-form,
.modal-body > .form-stack {
  padding: 20px;
  border: 1px solid #dfe8f3;
  border-radius: 15px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 10px 28px rgba(26,57,96,.07), inset 0 1px 0 #fff;
}
.modal-body > .form-grid label,
.modal-body > .col-form label {
  color: #3f536d;
  font-weight: 650;
}
.modal-body input,
.modal-body select,
.modal-body textarea {
  min-height: 42px;
  border-color: #cfdae8;
  border-radius: 10px;
  background: #f9fbfe;
  transition: border-color .16s, box-shadow .16s, background .16s, transform .16s;
}
.modal-body input:hover,
.modal-body select:hover,
.modal-body textarea:hover { background: #fff; border-color: #afc4df; }
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  background: #fff;
  transform: translateY(-1px);
}
.modal-tip {
  margin: 0 0 14px;
  padding: 11px 13px;
  color: #63758d;
  border: 1px solid #dce8f5;
  border-left: 4px solid var(--accent-cyan);
  border-radius: 10px;
  background: linear-gradient(90deg, #edf8fb, #f4f8fd);
}
.form-actions,
.cash-form-actions {
  padding-top: 16px;
  border-top: 1px solid #e5ebf3;
}
.form-actions .btn,
.cash-form-actions .btn { min-height: 42px; border-radius: 10px; }

/* 详情型弹窗强化信息层级。 */
.order-summary,
.section-block,
.info-card,
.ib-card,
.ib-amount,
.ib-invoice,
.ib-pay,
.ib-notes,
.cash-sec,
.modal-lists > div {
  border-radius: 14px;
  border-color: #dbe5f1;
  background: rgba(255,255,255,.92);
  box-shadow: 0 9px 24px rgba(26,57,96,.065);
}
.order-summary,
.ib-hero {
  position: relative;
  overflow: hidden;
  border: 0;
  color: #fff;
  background: linear-gradient(125deg, #173966 0%, #2768aa 68%, #23869a 100%);
  box-shadow: 0 15px 34px rgba(26,72,126,.22);
}
.order-summary::after,
.ib-hero::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -68px;
  top: -82px;
  border: 24px solid rgba(255,255,255,.075);
  border-radius: 50%;
  pointer-events: none;
}
.order-summary .oh-cust,
.order-summary .order-status-dot,
.order-summary .oh-progress-text,
.ib-hero-no,
.ib-hero-meta { color: #fff; }
.order-summary .oh-progress-bar-track { background: rgba(255,255,255,.20); }
.order-summary .oh-progress-bar { background: linear-gradient(90deg, #65d6dc, #fff); }
.metric {
  border-color: rgba(215,227,241,.92);
  border-radius: 12px;
  box-shadow: 0 5px 14px rgba(19,52,91,.06);
}
.info-card h4,
.modal-lists h3 {
  background: linear-gradient(90deg, #edf4fd, #f8fbff);
  border-left-color: var(--accent-cyan);
}
.section-block > h3 { border-left-color: var(--accent-cyan); }
.ops-row,
.ops-plan-card,
.action-card { border-radius: 12px; background: linear-gradient(145deg, #fbfdff, #f4f8fd); }

/* 特定弹窗宽度和阅读体验。 */
#inbound-modal .modal-box,
#outbound-modal .modal-box,
#transfer-modal .modal-box { width: min(520px, calc(100vw - 36px)); }
#pwd-modal .modal-box { width: min(420px, calc(100vw - 36px)); }
#customer-edit-modal .modal-box { width: min(540px, calc(100vw - 36px)); }
/* 新建账号 / 编辑权限弹窗：加宽后权限分组双列排布，减少纵向滚动，布局更均衡。 */
#user-create-modal .modal-box,
#edit-perm-modal .modal-box { width: min(880px, calc(100vw - 36px)); }
#user-create-modal .perm-grid,
#edit-perm-modal .perm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
@media (max-width: 720px) {
  #user-create-modal .perm-grid,
  #edit-perm-modal .perm-grid { grid-template-columns: 1fr; }
}
#order-modal .modal-box,
#company-modal .modal-box { width: min(1180px, calc(100vw - 36px)); }
#help-modal .modal-box { width: min(1160px, 96vw); }
#help-modal .help-search {
  color: #fff;
  border-color: rgba(255,255,255,.25);
  background: rgba(255,255,255,.12);
}
#help-modal .help-search::placeholder { color: rgba(255,255,255,.68); }
#help-modal .help-search:focus { background: rgba(255,255,255,.18); }
#cash-modal .cash-sec { background: linear-gradient(145deg, #fff, #f5f9fe); }

@keyframes modalBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalPanelIn {
  from { opacity: 0; transform: translateY(18px) scale(.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
  .modal:not(.hidden) { align-items: flex-end; padding: 10px; }
  .modal-box {
    width: 100% !important;
    max-height: calc(100vh - 20px);
    border-radius: 18px;
  }
  .modal-head { min-height: 60px; padding: 14px 16px; border-radius: 17px 17px 0 0; }
  .modal-head > span, .modal-head > h3 { font-size: 16px; }
  .modal-body { padding: 16px; }
  .modal-body > .form-grid,
  .modal-body > .col-form,
  .modal-body > .form-stack { padding: 15px; }
  .os-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-lists { grid-template-columns: 1fr; }
  .modal-list-wide { grid-column: auto; }
}

@media (max-width: 520px) {
  .modal:not(.hidden) { padding: 0; }
  .modal-box {
    max-height: 100vh;
    min-height: auto;
    border: 0;
    border-radius: 16px 16px 0 0;
  }
  .modal-head { border-radius: 15px 15px 0 0; }
  .modal-head::after { display: none; }
  .modal-body { padding: 14px 12px 18px; }
  .ib-cards, .cash-grid { grid-template-columns: 1fr; }
  .ib-amount { flex-wrap: wrap; }
  .ib-amount-divider { display: none; }
  .ib-amount-item { min-width: 42%; padding: 6px; }
}

/* 复选框保持紧凑焦点态，避免全局焦点轮廓形成突兀的大矩形。 */
input[type="checkbox"]:focus,
input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: none;
  border-radius: 4px;
}
input[type="checkbox"] {
  accent-color: var(--accent);
  vertical-align: middle;
}

/* ===== 表格系统二次精修 ===== */
main .table-wrap {
  position: relative;
  overflow: auto;
  margin-top: 12px;
  border: 1px solid #d8e3ef;
  border-radius: 16px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 12px 30px rgba(26,57,96,.075);
}
main table {
  min-width: 680px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  font-variant-numeric: tabular-nums;
}
main th,
main td {
  height: 48px;
  padding: 11px 14px;
  line-height: 1.45;
  border-bottom: 1px solid #e8eef5;
  vertical-align: middle;
}
main th {
  height: 46px;
  color: #365271;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .45px;
  background: linear-gradient(180deg, #f7faff, #eaf1f8);
  box-shadow: inset 0 -1px 0 #cfddea;
}
main th:first-child { padding-left: 17px; }
main tbody tr:last-child td { border-bottom: 0; }
main tbody tr { transition: background .16s ease, box-shadow .16s ease; }
main tbody tr:hover td {
  background: linear-gradient(90deg, #eef6ff, #f8fbff) !important;
  box-shadow: inset 0 1px 0 rgba(61,123,234,.08), inset 0 -1px 0 rgba(61,123,234,.08);
}
main td.empty { height: 120px; }
main td .btn { min-height: 30px; }

/* 常见数字字段右对齐，便于快速比较数量与金额。 */
#inbound-table th:nth-child(4), #inbound-table th:nth-child(5), #inbound-table th:nth-child(6),
#inbound-table th:nth-child(8), #inbound-table th:nth-child(9),
#inbound-table td:nth-child(4), #inbound-table td:nth-child(5), #inbound-table td:nth-child(6),
#inbound-table td:nth-child(8), #inbound-table td:nth-child(9),
#transfer-table th:nth-child(6), #transfer-table td:nth-child(6),
#order-table th:nth-child(8), #order-table th:nth-child(9), #order-table th:nth-child(10), #order-table th:nth-child(11),
#order-table td:nth-child(8), #order-table td:nth-child(9), #order-table td:nth-child(10), #order-table td:nth-child(11) {
  text-align: right;
}
#order-table th:nth-child(13), #order-table td:nth-child(13) { text-align: left; }
#order-table th:last-child, #order-table td:last-child,
#inbound-table th:last-child, #inbound-table td:last-child { text-align: center; }
#order-table .col-time { align-items: flex-start; }
#order-table .col-time span:first-child { color: #2d4d70; font-weight: 650; }
#order-table .col-time .t-time { color: #8293a8; }
#order-table .col-pay { gap: 2px; }
#order-table .col-pay span:first-child { color: #3a668f; }
#order-table .col-pay span:last-child { color: #c34e4e; }

/* 基础资料表格通过固定操作列和轻量分隔保持易读性。 */
#customer-table, #product-table, #supplier-table, #account-table, #user-table, #audit-table-list,
#transfer-table { min-width: 760px; }
#customer-table th:last-child, #product-table th:last-child, #supplier-table th:last-child,
#account-table th:last-child, #user-table th:last-child { width: 112px; }

@media (max-width: 760px) {
  main .table-wrap { margin-top: 10px; border-radius: 12px; }
  main table { min-width: 620px; }
  main th, main td { height: 44px; padding: 9px 11px; }
  main th { height: 42px; }
  #tab-outbound-orders main .table-wrap { overflow-x: hidden; }
  #order-table { min-width: 0; }
  #order-table th, #order-table td { padding-left: 7px; padding-right: 7px; font-size: 11px; }
}

@media (max-width: 520px) {
  main .table-wrap { margin-left: -4px; margin-right: -4px; }
  main th, main td { padding-left: 9px; padding-right: 9px; }
  #order-table th, #order-table td { padding-left: 5px; padding-right: 5px; }
}

/* ===== 账号管理明细布局 =====
   账号页信息类型差异较大：账号与状态需要突出，权限和操作允许多行展开，创建时间保持单行。 */
#user-table {
  min-width: 1120px;
  table-layout: fixed;
}
#user-table th,
#user-table td {
  overflow: hidden;
}
#user-table th:nth-child(1), #user-table td:nth-child(1) { width: 10%; }
#user-table th:nth-child(2), #user-table td:nth-child(2) { width: 10%; }
#user-table th:nth-child(3), #user-table td:nth-child(3) { width: 31%; }
#user-table th:nth-child(4), #user-table td:nth-child(4) { width: 9%; }
#user-table th:nth-child(5), #user-table td:nth-child(5) { width: 14%; }
#user-table th:nth-child(6), #user-table td:nth-child(6) { width: 26%; }
#user-table td {
  vertical-align: top;
  padding: 7px 10px;
}
#user-table th {
  padding-left: 10px;
  padding-right: 10px;
}
#user-table td.cell-user,
#user-table td:nth-child(2),
#user-table td:nth-child(4),
#user-table td.cell-time,
#user-table td.cell-op {
  vertical-align: middle;
}
#user-table .cell-user {
  position: relative;
  padding-left: 20px;
  color: var(--brand);
}
#user-table .cell-user::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 4px;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-cyan));
  transform: translateY(-50%);
}
#user-table .cell-user b {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
#user-table .cell-perm {
  padding-top: 6px;
  padding-bottom: 6px;
}
#user-table .perm-tags {
  max-width: none;
  gap: 3px 5px;
  align-items: center;
}
#user-table .perm-tag {
  padding: 2px 8px;
  line-height: 1.25;
  white-space: normal;
  text-align: center;
}
#user-table .perm-all {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border: 1px solid #c9e8d5;
  border-radius: 20px;
  background: #effaf3;
}
#user-table .cell-time {
  white-space: normal;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
#user-table .cell-op {
  padding-top: 6px;
  padding-bottom: 6px;
}
#user-table .op-inline {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
}
#user-table .op-inline .btn {
  width: auto;
  min-width: 0;
  min-height: 27px;
  flex: 1 1 0;
  padding: 4px 7px;
  font-size: 12px;
  white-space: nowrap;
}
#user-table .status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
#user-table .status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

@media (max-width: 760px) {
  #user-table { min-width: 1120px; }
  #user-table th, #user-table td { padding-left: 8px; padding-right: 8px; }
  #user-table .cell-user { padding-left: 17px; }
  #user-table .cell-user::before { left: 6px; }
}

/* ===== 账号与授权页面 ===== */
.account-panel-head {
  align-items: flex-end;
  gap: 18px;
  padding: 18px 20px;
  margin-bottom: 18px;
  border: 1px solid var(--brand-border);
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, #f8fbff, #eef4fc);
  box-shadow: var(--shadow-sm);
}
.account-heading { min-width: 0; }
.account-heading h2 { margin-bottom: 4px; }
.account-heading p { color: var(--text-2); font-size: 13px; }
.account-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.account-search-wrap { display: block; }
.account-toolbar .acct-search {
  width: min(240px, 28vw);
  min-width: 180px;
  margin: 0;
  min-height: 38px;
  background: #fff;
}
.account-toolbar .btn { min-height: 38px; white-space: nowrap; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.account-modal-head { align-items: flex-start; }
.account-modal-title { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.account-modal-title strong { font-size: 17px; color: var(--brand); }
.account-modal-title span { color: var(--muted); font-size: 12px; font-weight: 400; }
.account-modal-title b { color: var(--brand-2); font-weight: 700; }
#user-create-modal .modal-body,
#edit-perm-modal .modal-body { background: #f8fafd; }
#user-create-modal .form-grid,
#edit-perm-modal .modal-body { padding: 20px 22px 22px; }
#user-create-modal .form-grid.form-2col {
  gap: 18px 20px;
  padding-left: 0;
}
#user-create-modal .form-grid > label {
  padding: 13px 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: 0 2px 8px rgba(30, 60, 114, .04);
}
#user-create-modal .form-grid > label::before { left: 3px; top: 13px; }
#user-create-modal .perm-block { grid-column: 1 / -1; margin-top: 2px; }
#user-create-modal .form-actions,
#edit-perm-modal .form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  margin-top: 0;
  border-top: 1px solid var(--border);
}
#user-create-modal .form-actions .btn,
#edit-perm-modal .form-actions .btn { width: auto; min-width: 104px; }
#edit-perm-modal .modal-body > .muted {
  margin: 0 0 14px !important;
  padding: 12px 14px;
  border: 1px solid #f1d1d1;
  border-radius: var(--r-md);
  background: #fffafa;
  line-height: 1.6;
}
#edit-perm-modal .perm-summary { margin-bottom: 16px; }
#edit-perm-modal .perm-grid { margin-bottom: 18px; }

@media (max-width: 640px) {
  .account-panel-head { align-items: stretch; padding: 16px; }
  .account-toolbar { flex-wrap: wrap; }
  .account-search-wrap { flex: 1 1 180px; }
  .account-toolbar .acct-search { width: 100%; min-width: 0; }
  .account-toolbar .btn { flex: 0 0 auto; }
  #user-create-modal .form-grid.form-2col { grid-template-columns: 1fr; }
  #user-create-modal .form-grid > label,
  #user-create-modal .perm-block,
  #user-create-modal .form-actions { grid-column: 1; }
  #user-create-modal .form-actions,
  #edit-perm-modal .form-actions { justify-content: stretch; }
  #user-create-modal .form-actions .btn,
  #edit-perm-modal .form-actions .btn { flex: 1; }
}

/* ===== 文件中转站 ===== */
#tab-files {
  --file-blue: #2563a9;
  --file-blue-soft: #eef5ff;
  --file-border: #d9e3f0;
}
#tab-files .panel-head {
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--file-border);
}
#tab-files .panel-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
#tab-files .panel-head h2::before {
  content: "";
  width: 4px;
  height: 22px;
  border-radius: 4px;
  background: linear-gradient(180deg, #2f80ed, #56ccf2);
}
#tab-files .file-upload-card label {
  color: #52657d;
  font-size: 12px;
  font-weight: 600;
}
#tab-files .file-upload-card select,
#file-move-modal select {
  min-width: 170px;
  border-color: #c8d6e7;
  background-color: #fff;
}
#tab-files .file-upload-card .btn { min-height: 36px; }
#tab-files .file-upload-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #dbe8f7;
  border-radius: 12px;
  background: linear-gradient(135deg, #fbfdff, #f3f7fc);
  box-shadow: var(--shadow-sm);
}
#tab-files .file-upload-card #file-input {
  flex: 1 1 240px;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px dashed #b9cde5;
  border-radius: 8px;
  background: #fff;
}
#tab-files .file-upload-target {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#tab-files #file-upload-tip {
  flex: 1 1 160px;
}
#tab-files .table-wrap {
  overflow-x: auto;
  border: 1px solid var(--file-border);
  border-radius: 10px;
  box-shadow: 0 5px 18px rgba(31, 66, 109, .06);
}
#tab-files #files-table {
  min-width: 760px;
  border: 0;
  margin: 0;
}
#tab-files #files-table thead th {
  height: 44px;
  padding: 10px 14px;
  color: #49627f;
  background: #f5f8fc;
  border-bottom: 1px solid var(--file-border);
  font-size: 12px;
  letter-spacing: .02em;
}
#tab-files #files-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
}
#tab-files #files-table tbody tr:last-child td { border-bottom: 0; }
#tab-files .file-folder-row td {
  color: #24466f;
  background: #f8fbff;
  transition: background .15s ease;
}
#tab-files .file-folder-row:hover td { background: #edf5ff; }
#tab-files .file-item-row:hover td { background: #fbfdff; }
#tab-files .file-item-row td:first-child { color: #263b55; font-weight: 600; }
#tab-files .file-type-icon {
  display: inline-grid;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  place-items: center;
  color: #5b87ba;
  border: 1px solid #cfe0f3;
  border-radius: 6px;
  background: #eef5fd;
  font-size: 13px;
  font-weight: 700;
}
#tab-files .file-name {
  display: inline-block;
  max-width: min(42vw, 430px);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#tab-files .folder-expand {
  width: 26px;
  height: 26px;
  margin-right: 5px;
  padding: 0;
  color: var(--file-blue);
  border: 1px solid #cbdcf0;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
#tab-files .folder-expand:hover { background: #e8f2ff; }
#tab-files .folder-icon { margin: 0 7px 0 2px; font-size: 17px; }
#tab-files .folder-open { cursor: pointer; border-radius: 6px; padding: 1px 4px; margin: 0 -4px; transition: background .15s ease; }
#tab-files .folder-open:hover { background: #e8f2ff; }
#tab-files .folder-count { margin-left: 9px; font-size: 12px; }
#tab-files .tree-indent {
  display: inline-block;
  width: 26px;
  height: 1px;
}
#tab-files .file-item-row td:last-child,
#tab-files .file-folder-row td:last-child { white-space: nowrap; }
#tab-files .file-item-row .btn,
#tab-files .file-folder-row .btn {
  margin: 2px 3px 2px 0;
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
}
#file-move-modal .modal-box {
  width: min(460px, calc(100vw - 32px));
  border: 1px solid #d6e2ef;
  box-shadow: 0 18px 55px rgba(20, 55, 95, .2);
}
#file-move-modal .modal-head {
  padding: 16px 20px;
  color: #1e3c72;
  background: linear-gradient(135deg, #f5f9ff, #edf5ff);
}
#file-move-modal .modal-head > span { color: #1e3c72; }
#file-move-modal .modal-head::before,
#file-move-modal .modal-head::after { display: none; }
#file-move-modal .modal-close {
  color: #1e3c72;
  background: rgba(30, 60, 114, .08);
  border: 1px solid rgba(30, 60, 114, .18);
}
#file-move-modal .modal-close:hover {
  color: #1e3c72;
  background: rgba(30, 60, 114, .16);
  border-color: rgba(30, 60, 114, .32);
}
#file-move-modal .modal-body { padding: 20px; }
#file-move-modal .modal-body > label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #52657d;
  font-size: 13px;
  font-weight: 600;
}
#file-move-modal .modal-body select { width: 100%; }
#file-move-modal .form-actions {
  justify-content: flex-end;
  margin-top: 20px;
}
@media (max-width: 640px) {
  #tab-files .file-toolbar { align-items: stretch; }
  #tab-files .file-upload-card { align-items: stretch; }
  #tab-files .file-upload-card select,
  #tab-files .file-upload-card .btn { flex: 1 1 180px; }
  #tab-files .file-upload-card #file-input { flex-basis: 100%; }
}

/* 数字输入框：隐藏上下微调箭头，禁止滚轮/点击箭头改变数值 */
input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ===== 登录与账号授权页面最终布局约束 ===== */
.login-wrap {
  min-height: 100dvh;
  padding: clamp(16px, 4vw, 32px);
  overflow-y: auto;
}
.login-card {
  width: min(420px, 100%);
  padding: clamp(28px, 5vw, 40px) clamp(20px, 5vw, 40px) 24px;
}
.login-brand { align-items: flex-start; }
.login-brand-text { min-width: 0; }
.login-brand-text h1 { overflow-wrap: anywhere; }
.login-sub { line-height: 1.5; }

.account-panel-head {
  align-items: flex-end;
  min-height: 0;
  padding: 18px 20px;
}
.account-heading { flex: 1 1 260px; }
.account-toolbar { margin-left: auto; }

#user-create-modal .modal-box,
#edit-perm-modal .modal-box {
  width: min(920px, calc(100vw - 32px));
}
#user-create-modal .modal-body,
#edit-perm-modal .modal-body { padding: 18px; }
#user-create-modal .form-grid,
#edit-perm-modal .modal-body > .perm-grid {
  padding: 0;
}
#user-create-modal .form-grid.form-2col {
  padding: 0;
  gap: 16px;
}
#user-create-modal .perm-block { margin-top: 0; }
#user-create-modal .perm-grid,
#edit-perm-modal .perm-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
#user-create-modal .perm-group,
#edit-perm-modal .perm-group { min-width: 0; }
#user-create-modal .perm-group-items,
#edit-perm-modal .perm-group-items {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
#user-create-modal .form-actions,
#edit-perm-modal .form-actions {
  margin-top: 2px;
  padding-top: 14px;
}

@media (max-width: 760px) {
  .login-card { margin: auto 0; }
  .account-panel-head { align-items: stretch; }
  .account-heading { flex-basis: 100%; }
  .account-toolbar { width: 100%; margin-left: 0; }
  .account-search-wrap { flex: 1 1 0; min-width: 0; }
  #user-create-modal .perm-grid,
  #edit-perm-modal .perm-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .login-brand { gap: 10px; }
  .login-badge { width: 48px; height: 48px; border-radius: 13px; font-size: 24px; }
  .login-brand-text h1 { font-size: 18px; }
  .login-sub { font-size: 11px; }
  #user-create-modal .modal-body,
  #edit-perm-modal .modal-body { padding: 14px 12px 18px; }
  #user-create-modal .perm-group-items,
  #edit-perm-modal .perm-group-items { grid-template-columns: 1fr; }
}
