:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1f2733;
  --ink-soft: #6b7686;
  --line: #e7ebf2;
  --brand: #c0392b;        /* 工厂红 */
  --brand-soft: #fbe9e7;
  --accent: #2563eb;
  --green: #1e9e6a;
  --green-soft: #e6f6ef;
  --amber: #d98324;
  --shadow: 0 6px 24px rgba(31,39,51,.08);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 登录 ---------- */
.login-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: linear-gradient(135deg, #1a202b 0%, #2d3a4a 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-overlay[hidden] { display: none; }
.login-box {
  background: #fff; border-radius: 18px; padding: 40px 36px;
  width: 360px; max-width: 92vw; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  text-align: center;
}
.login-logo {
  width: 60px; height: 60px; border-radius: 14px; background: var(--brand);
  color: #fff; font-size: 28px; font-weight: 800;
  display: grid; place-items: center; margin: 0 auto 12px;
}
.login-box h2 { font-size: 20px; margin: 0 0 20px; color: var(--ink); }
.login-box .field { text-align: left; margin-bottom: 14px; }
.login-box .field label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; font-weight: 600; }
.login-box .field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
}
.login-box .field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.login-err { color: var(--brand); font-size: 13px; margin-bottom: 10px; }
.login-hint { font-size: 12px; color: var(--ink-soft); margin-top: 14px; }

/* ---------- 侧边栏用户 ---------- */
.sidebar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin-bottom: 10px;
  background: rgba(255,255,255,.06); border-radius: 8px;
}
.sidebar-user[hidden] { display: none; }
.user-avatar { font-size: 18px; }
.user-name { color: #fff; font-size: 13px; font-weight: 600; flex: 1; }
.user-role { font-size: 11px; padding: 2px 7px; border-radius: 4px; }
.user-role.admin { background: #fbe9e7; color: var(--brand); }
.user-role.editor { background: #e6f6ef; color: var(--green); }
.user-role.viewer { background: #e7ebf2; color: var(--ink-soft); }
.sidebar-user .btn-ghost { color: #8a95a6; font-size: 14px; padding: 2px 6px; margin: 0; }
.sidebar-user .btn-ghost:hover { color: #fff; }

.tag.admin { background: var(--brand-soft); color: var(--brand); }

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

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 232px; flex: 0 0 232px;
  background: #1f2733; color: #cdd5e0;
  display: flex; flex-direction: column;
  padding: 18px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--brand); color: #fff; font-weight: 800;
  display: grid; place-items: center; font-size: 19px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { color: #fff; font-size: 15px; }
.brand-text span { font-size: 11.5px; color: #8a95a6; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border: 0; border-radius: 10px;
  background: transparent; color: #cdd5e0; cursor: pointer;
  font-size: 14px; text-align: left; transition: .15s;
}
.nav-item .ic { font-size: 16px; width: 20px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.06); }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 14px; }
.btn-ghost {
  border: 1px solid rgba(255,255,255,.12); background: transparent;
  color: #cdd5e0; padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { background: rgba(255,255,255,.06); }
.btn-ghost.danger { color: #ff9a8f; border-color: rgba(255,120,100,.3); }

/* ---------- 主区域 ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 18px; margin: 0; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.today { color: var(--ink-soft); font-size: 12.5px; }
.hamburger { display: none; border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--ink); }

.btn-primary {
  background: var(--brand); color: #fff; border: 0; border-radius: 10px;
  padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 12px rgba(192,57,43,.28);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-secondary {
  background: #eef1f6; color: var(--ink); border: 0; border-radius: 9px;
  padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.btn-secondary:hover { background: #e3e7ef; }

.content { padding: 22px 24px 60px; }

/* ---------- 看板时间筛选 ---------- */
.dash-filter { margin-bottom: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dash-filter-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.df-btn {
  padding: 6px 16px; border: 1px solid var(--line); border-radius: 20px;
  background: var(--panel); color: var(--text); cursor: pointer;
  font-size: 13px; font-family: inherit; transition: all .15s; white-space: nowrap;
}
.df-btn:hover { border-color: var(--primary); color: var(--primary); }
.df-btn.df-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.dash-filter-custom { display: flex; align-items: center; gap: 8px; }
.dash-filter-custom input[type="date"] {
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 13px; font-family: inherit;
}
.dash-filter-custom span { color: #888; font-size: 13px; }

/* ---------- 卡片/网格 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.card .label { color: var(--ink-soft); font-size: 12.5px; display: flex; align-items: center; gap: 7px; }
.card .value { font-size: 23px; font-weight: 700; margin-top: 8px; letter-spacing: .3px; }
.card .sub { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.v-red { color: var(--brand); } .v-green { color: var(--green); } .v-blue { color: var(--accent); } .v-amber { color: var(--amber); }

/* ---------- 面板 ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-top: 18px; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 15px; margin: 0; }
.panel-head .hint { color: var(--ink-soft); font-size: 12.5px; }
.panel-head .spacer { flex: 1; }
.panel-note {
  background: #fff8ec; border-left: 3px solid var(--amber); color: #8a5a12;
  font-size: 12.5px; padding: 10px 14px; margin: 14px 18px 0; border-radius: 0 8px 8px 0;
}

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { background: #fafbfd; color: var(--ink-soft); font-weight: 600; font-size: 12.5px; position: sticky; top: 0; }
.tbl tbody tr:hover { background: #fafbff; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.ta-r, .tbl th.ta-r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 700; background: #fafbfd; border-top: 2px solid var(--line); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; }
.tag-客户 { background: var(--green-soft); color: var(--green); }
.tag-供应商 { background: #e8eefc; color: var(--accent); }
.tag-两者都是 { background: #f3e8fc; color: #8b3fb0; }
.tag-收入 { background: var(--green-soft); color: var(--green); }
.tag-支出 { background: var(--brand-soft); color: var(--brand); }
.tag-是 { background: var(--green-soft); color: var(--green); }
.tag-否 { background: var(--brand-soft); color: var(--brand); }
.row-actions button { border: 0; background: transparent; cursor: pointer; color: var(--ink-soft); font-size: 13px; padding: 2px 6px; border-radius: 6px; }
.row-actions button:hover { background: #eef1f6; }
.row-actions .del:hover { color: var(--brand); }
.empty { padding: 36px; text-align: center; color: var(--ink-soft); }
.strong { font-weight: 700; }

/* ---------- 工资表月份/销售额控制条 ---------- */
.sub-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 18px; background: #f7f9fc; border-bottom: 1px solid var(--line); font-size: 13px; }
.sub-bar label { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); }
.sub-bar select, .sub-bar input { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; }
.sub-bar input[type=number] { width: 140px; }

/* ---------- 还款提醒 ---------- */
.rem-soon { background: #fff8ec !important; }
.rem-overdue { background: #fdecec !important; }
.rem-badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.rem-badge.soon { background: #fdf0d5; color: #b9770e; }
.rem-badge.overdue { background: #fbd5d5; color: #c0392b; }

/* ---------- 导入模态 ---------- */
.import-step .hint { margin: 4px 0 12px; }
.import-step .field { margin-bottom: 12px; }
.import-step input[type=file] { width: 100%; padding: 8px; border: 1px dashed var(--line); border-radius: 8px; background: #fafbfd; }
.import-summary { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 14px 0 8px; font-size: 13.5px; }
.import-summary .ok { color: var(--green); font-weight: 600; }
.import-summary .bad { color: var(--brand); font-weight: 600; }
.import-skip { margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); }
.import-skip summary { cursor: pointer; }
.import-skip ul { margin: 6px 0 0; padding-left: 18px; }
.import-skip li { margin: 2px 0; }
table.tbl.mini { font-size: 12.5px; margin-top: 6px; }
table.tbl.mini th, table.tbl.mini td { padding: 7px 10px; }

/* ---------- 设置 ---------- */
.settings-form { padding: 16px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.settings-form .field { display: flex; flex-direction: column; gap: 6px; }
.settings-form .field label { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.settings-form .field input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: #fff; }
.settings-form .field .hint { font-size: 12px; color: var(--ink-soft); }
.settings-actions { grid-column: 1 / -1; display: flex; gap: 12px; flex-wrap: wrap; padding-top: 4px; }

/* ---------- LOGO 上传 ---------- */
.logo-upload { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-preview {
  width: 72px; height: 72px; border-radius: 12px; border: 2px dashed var(--line);
  display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.logo-placeholder { font-size: 28px; font-weight: 800; color: var(--ink-soft); }
/* 侧边栏 LOGO */
.brand-logo.has-logo { background: transparent; }
.brand-logo .logo-img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }

/* ---------- 类目编辑器 ---------- */
.cat-editor { padding: 16px 18px; }
.cat-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.cat-row:last-child { margin-bottom: 0; }
.cat-row > label { font-size: 13px; color: var(--ink-soft); font-weight: 600; min-width: 72px; padding-top: 8px; }
.cat-row .tags { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; }
.cat-row .tags .tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; background: var(--brand-soft); color: var(--brand); border-radius: 6px; font-size: 13px; }
.cat-row .tags .tag button { background: none; border: none; color: var(--brand); cursor: pointer; font-size: 15px; padding: 0; line-height: 1; opacity: 0.6; }
.cat-row .tags .tag button:hover { opacity: 1; }
.cat-row .cat-add { flex: 1; }
.cat-row .cat-add input { width: 100%; padding: 6px 10px; border: 1px dashed var(--line); border-radius: 8px; font-size: 13px; background: #fafbfc; }
.cat-row .cat-add input:focus { outline: none; border-color: var(--accent); background: #fff; }

/* ---------- 图表 ---------- */
.charts { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-top: 18px; }
.chart-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.chart-box h3 { font-size: 14px; margin: 0 0 12px; }
.chart-canvas { position: relative; height: 260px; }
@media (max-width: 880px) { .charts { grid-template-columns: 1fr; } }

/* ---------- 经营指标 KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi { background: #f7f8fa; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.k-label { font-size: 12.5px; color: var(--ink-soft); }
.k-val { font-size: 20px; font-weight: 700; margin-top: 6px; letter-spacing: .3px; }
.k-sub { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.top-h { font-size: 13px; margin: 0 0 8px; color: var(--ink); }
@media (max-width: 880px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- 智能对账系统 ---------- */
.recon-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.recon-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.recon-tab {
  padding: 7px 16px; border: 1px solid var(--line); border-radius: 20px; background: #fff;
  font-size: 13px; color: var(--ink-soft); cursor: pointer; transition: all .15s;
}
.recon-tab:hover { border-color: var(--brand); color: var(--brand); }
.recon-tab.rt-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.recon-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.recon-search {
  border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px; font-size: 13px;
  width: 200px; background: #fff; color: var(--ink); transition: border-color .15s;
}
.recon-search:focus { outline: none; border-color: var(--brand); }
.recon-sort {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px;
  background: #fff; color: var(--ink); cursor: pointer;
}
.recon-expand-all {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 12px;
  background: #fff; color: var(--ink-soft); cursor: pointer; transition: all .15s;
}
.recon-expand-all:hover { border-color: var(--brand); color: var(--brand); }
.recon-summary { display: flex; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.recon-stat {
  flex: 1; min-width: 180px; background: var(--bg); border-radius: 10px; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.recon-stat.rs-age { flex: 2; min-width: 280px; }
.rs-label { font-size: 12px; color: var(--ink-soft); }
.rs-val { font-size: 22px; font-weight: 700; }
.rs-sub { font-size: 11px; color: var(--ink-soft); }
.rs-age-bars { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.rs-age-item { display: flex; align-items: center; gap: 8px; }
.rs-age-label { font-size: 11px; color: var(--ink-soft); min-width: 60px; }
.rs-age-val { font-size: 12px; font-weight: 600; min-width: 80px; text-align: right; }
.rs-age-bar { flex: 1; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.rs-age-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.recon-tbl .recon-unit { font-weight: 600; white-space: nowrap; }
.recon-count { display: inline-block; margin-left: 6px; font-size: 11px; color: var(--ink-soft); font-weight: 400; background: var(--bg); padding: 1px 6px; border-radius: 8px; }
.recon-contact { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.recon-phone { color: var(--brand); text-decoration: none; font-size: 12px; }
.recon-phone:hover { text-decoration: underline; }
/* 账龄标签 */
.age-tag { font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 500; white-space: nowrap; }
.age-ok { background: #f0fdf4; color: #1e9e6a; }
.age-notice { background: #fffbeb; color: #d97706; }
.age-warn { background: #fff7ed; color: #ea580c; }
.age-danger { background: #fef2f2; color: #dc2626; }
.age-none { background: #f3f4f6; color: #9ca3af; }
.age-bar-ok { background: #1e9e6a; }
.age-bar-notice { background: #d97706; }
.age-bar-warn { background: #ea580c; }
.age-bar-danger { background: #dc2626; }
.rs-age-val.age-ok { color: #1e9e6a; }
.rs-age-val.age-notice { color: #d97706; }
.rs-age-val.age-warn { color: #ea580c; }
.rs-age-val.age-danger { color: #dc2626; }
/* 收款进度条 */
.recon-progress { display: flex; align-items: center; gap: 6px; }
.rp-bar { width: 60px; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.rp-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.rp-text { font-size: 11px; color: var(--ink-soft); font-weight: 500; min-width: 32px; }
/* 状态标签 */
.recon-badge { font-size: 12px; padding: 3px 10px; border-radius: 12px; font-weight: 500; }
.rb-ar { background: #fef2f2; color: #c0392b; }
.rb-ap { background: #eff6ff; color: #2563eb; }
.rb-zero { background: #f0fdf4; color: #1e9e6a; }
/* 操作区 */
.recon-actions { display: flex; gap: 4px; align-items: center; }
.recon-toggle {
  border: none; background: none; cursor: pointer; font-size: 14px; color: var(--ink-soft);
  padding: 2px 8px; border-radius: 4px; transition: all .15s;
}
.recon-toggle:hover { background: var(--bg); color: var(--brand); }
.recon-act {
  border: none; border-radius: 6px; padding: 3px 10px; font-size: 11px; cursor: pointer;
  font-weight: 500; transition: all .15s; white-space: nowrap;
}
.recon-act.ra-ar { background: #fef2f2; color: #c0392b; }
.recon-act.ra-ar:hover { background: #c0392b; color: #fff; }
.recon-act.ra-ap { background: #eff6ff; color: #2563eb; }
.recon-act.ra-ap:hover { background: #2563eb; color: #fff; }
.recon-row.expanded { background: var(--bg); }
.recon-detail td { padding: 0 !important; }
.recon-detail-row {
  display: flex; gap: 12px; padding: 8px 16px 8px 40px; font-size: 12px; color: var(--ink-soft);
  border-bottom: 1px solid var(--line); align-items: center;
}
.rd-date { min-width: 70px; }
.rd-type { min-width: 60px; font-weight: 500; }
.rd-type.rd-ar { color: #c0392b; }
.rd-type.rd-ap { color: #2563eb; }
.rd-note { flex: 1; }
.rd-order { color: var(--brand); font-size: 11px; white-space: nowrap; }
.rd-amt { white-space: nowrap; font-weight: 500; }

/* ---------- 表单/筛选 ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; background: #fff; color: var(--ink);
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field label { font-size: 13px; color: var(--ink-soft); }
.field label .req { color: var(--brand); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font-size: 14px;
  background: #fff; color: var(--ink); font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field .auto { color: var(--green); font-size: 12px; }

/* ---------- 模态框 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(20,26,36,.45); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal-mask[hidden] { display: none; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 1100px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { border: 0; background: transparent; font-size: 18px; cursor: pointer; color: var(--ink-soft); }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; }

/* ---------- 权限设置网格 ---------- */
.perm-grid { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.perm-row { display: flex; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.perm-row:last-child { border-bottom: 0; }
.perm-header { background: #f7f8fa; font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.perm-mod { flex: 1; font-size: 13.5px; }
.perm-chk { flex: 0 0 70px; font-size: 12.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 4px; cursor: pointer; }
.perm-chk input[type="checkbox"] { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; }
.perm-full { flex: 0 0 200px; }
.perm-summary { font-size: 12.5px; }
.perm-dot { display: inline-block; padding: 2px 7px; border-radius: 5px; font-size: 11.5px; margin-right: 4px; }
.perm-dot.ok { background: var(--green-soft); color: var(--green); }
.perm-dot.no { background: #fef2f2; color: #dc2626; }
.perm-tbl td { vertical-align: middle; }

/* ---------- TOAST ---------- */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #1f2733; color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 13.5px; z-index: 200; box-shadow: var(--shadow); }

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .sidebar { position: fixed; z-index: 90; transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; }
  .hamburger { display: block; }
  .form-grid, .field-row { grid-template-columns: 1fr; }
}

/* ---------- 分段筛选 ---------- */
.segment-filter { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.segment-filter button {
  border: none; background: #fff; color: var(--ink-soft); padding: 7px 18px; font-size: 13px;
  cursor: pointer; border-right: 1px solid var(--line); transition: .15s;
}
.segment-filter button:last-child { border-right: none; }
.segment-filter button:hover { background: var(--bg); }
.segment-filter button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.segment-filter button.active + button { border-left-color: var(--brand); }

/* ---------- 图片上传 ---------- */
.image-upload { padding: 4px 0; }
.img-preview-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.img-preview {
  position: relative; width: 72px; height: 72px; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--line);
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-preview .img-del {
  position: absolute; top: 1px; right: 2px; width: 18px; height: 18px;
  background: #c0392b; color: #fff; border-radius: 50%; font-size: 12px;
  display: grid; place-items: center; cursor: pointer; line-height: 1;
}
.img-add-btn {
  display: inline-block; padding: 6px 16px; border: 1px dashed var(--line);
  border-radius: 8px; color: var(--brand); font-size: 13px; cursor: pointer;
  transition: .15s;
}
.img-add-btn:hover { background: var(--brand-soft); border-color: var(--brand); }

/* ---------- 图片查看器 ---------- */
.img-indicator {
  display: inline-block; padding: 2px 7px; background: var(--brand-soft);
  border-radius: 5px; font-size: 12px; cursor: pointer; color: var(--brand);
}
.img-indicator:hover { opacity: .8; }
.img-popup-overlay {
  position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
}
.img-popup { background: #fff; border-radius: 14px; max-width: 90vw; max-height: 85vh; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.img-popup-nav { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-soft); }
.img-popup-close { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--ink); padding: 4px; }
.img-popup-body { padding: 12px; display: flex; flex-wrap: wrap; gap: 8px; overflow-y: auto; max-height: 70vh; }
.img-popup-body img { max-width: 300px; max-height: 300px; border-radius: 8px; object-fit: contain; border: 1px solid var(--line); cursor: zoom-in; transition: transform .2s; }
.img-popup-body img:hover { transform: scale(1.02); }

/* 单图放大层 */
.img-zoom-overlay {
  position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.img-zoom-overlay img { max-width: 95vw; max-height: 95vh; object-fit: contain; border-radius: 4px; }
.img-zoom-overlay .img-zoom-close { position: absolute; top: 16px; right: 24px; color: #fff; font-size: 28px; cursor: pointer; background: none; border: none; }

/* ---------- 账户统计 ---------- */
.acc-row { background: #fafcfd !important; }
.acc-stat { display: inline-block; margin: 0 12px 0 0; font-size: 12px; white-space: nowrap; }
.acc-stat .tag { margin-right: 4px; }
.acc-stat .v-green, .acc-stat .v-red { font-weight: 600; margin: 0 2px; }

/* ---------- ARAP 状态显示 ---------- */
.arap-status { font-size: 12px; color: var(--ink-soft); margin-top: 4px; display: block; }

/* ---------- 订单报价 ---------- */
.order-items-wrap { overflow-x: auto; }
.order-items-tbl { min-width: 760px; font-size: 13px; }
.order-items-tbl th, .order-items-tbl td { padding: 6px 8px; }
.order-items-tbl input, .order-items-tbl select {
  padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 13px; font-family: inherit; background: #fff; color: var(--ink);
}
.order-items-tbl input:focus, .order-items-tbl select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft);
}
.order-items-tbl select { width: 90px; }
.order-items-tbl .item-amount { font-weight: 600; color: var(--ink); }
.order-items-tbl tfoot td { background: #f7f9fc; }
.order-items-tbl .btn-del-item:hover { color: var(--brand) !important; }

/* 下拉+新增按钮组合 */
.combo-search-wrap { display: flex; align-items: center; gap: 4px; }
.combo-search-wrap input { flex: 1; }
.combo-search-wrap .combo-add {
  width: 24px; height: 24px; padding: 0; border: 1px solid var(--line);
  background: #f7f9fc; border-radius: 4px; cursor: pointer;
  font-size: 14px; line-height: 1; color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.combo-search-wrap .combo-add:hover { background: var(--brand-soft); border-color: var(--brand); }
.combo-wrap { display: flex; align-items: center; gap: 4px; }
.combo-wrap select { flex: 1; }
.combo-wrap .combo-add {
  width: 24px; height: 24px; padding: 0; border: 1px solid var(--line);
  background: #f7f9fc; border-radius: 4px; cursor: pointer;
  font-size: 14px; line-height: 1; color: var(--brand);
  display: flex; align-items: center; justify-content: center;
}
.combo-wrap .combo-add:hover { background: var(--brand-soft); border-color: var(--brand); }

/* ---------- checkbox-list 多选列表 ---------- */
.checkbox-list { display: flex; flex-direction: column; gap: 6px; }
.cbl-search {
  width: 100%; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 13px; outline: none; transition: border-color .15s;
}
.cbl-search:focus { border-color: var(--brand); }
.cbl-items {
  max-height: 200px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px;
  padding: 4px; background: #fff;
}
.cbl-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px;
  cursor: pointer; transition: background .12s; font-size: 13px; color: var(--ink-soft);
}
.cbl-item:hover { background: var(--bg); }
.cbl-item.checked { background: var(--brand-soft, #eef4ff); color: var(--ink); }
.cbl-item input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand);
  flex-shrink: 0;
}
.cbl-label { flex: 1; word-break: break-all; line-height: 1.4; }
.cbl-empty { padding: 16px; text-align: center; color: var(--ink-soft); font-size: 13px; }
.suggest-item { padding: 8px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid #f0f0f0; }
.suggest-item:hover { background: #e3f2fd; }
.cbl-toolbar { display: flex; gap: 8px; align-items: center; }
.cbl-toolbar .cbl-search { flex: 1; }
.cbl-select-all-wrap { display: flex; align-items: center; gap: 4px; cursor: pointer; padding: 2px 0; }
.cbl-select-all-wrap input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; accent-color: var(--brand); }

/* ---------- 分页导航 ---------- */
.pagination-bar { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; padding: 8px 0; }
.pagination-bar .btn-sm { padding: 4px 12px; font-size: 13px; min-width: 32px; }
.pagination-bar .btn-sm:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-bar .page-info { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
