/* ============================================================
   宝措卤阳® 进销存营销管理 CRM —— 样式
   沿用彩妆ODM CRM 的设计语言，并针对报表/分析场景做扩展
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", Arial, sans-serif; background: #f2f4f8; color: #1f2937; font-size: 14px; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶栏 */
.topbar { background: #1e293b; color: #fff; }
.topbar-inner { max-width: 1360px; margin: 0 auto; display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-logo { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; background: linear-gradient(135deg, #e11d48, #be123c); color: #fff; font-weight: 700; font-size: 18px; }
.brand-logo.big { width: 56px; height: 56px; font-size: 28px; border-radius: 14px; }
.brand-text strong { display: block; font-size: 15px; letter-spacing: 2px; }
.brand-text em { display: block; font-style: normal; font-size: 11px; color: #94a3b8; }
.nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav a { color: #cbd5e1; padding: 7px 11px; border-radius: 6px; font-size: 13px; white-space: nowrap; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.on { color: #fff; background: #2563eb; }

/* ---- 带二级下拉的导航栏目（如「组织管理」） ---- */
.nav-group { position: relative; display: inline-flex; }
.nav-parent { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.nav-parent .caret { font-size: 10px; opacity: .75; transition: transform .18s ease; }
.nav-group:hover .nav-parent .caret { transform: rotate(180deg); }
/* 下拉面板：默认隐藏，悬停展开 */
.nav-sub { position: absolute; top: 100%; left: 0; z-index: 60; display: none;
  min-width: 292px; padding: 6px; margin-top: 4px;
  background: #fff; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15,23,42,.22), 0 2px 6px rgba(15,23,42,.10);
  border: 1px solid #e5e7eb; }
/* 用一层透明"桥"填住菜单与父项之间的空隙，避免鼠标下滑时菜单闪退 */
.nav-sub::before { content: ""; position: absolute; top: -6px; left: 0; right: 0; height: 6px; }
.nav-group:hover .nav-sub { display: block; }
.nav-sub a { display: block; padding: 8px 11px; border-radius: 7px; color: #1f2937 !important;
  white-space: normal; line-height: 1.45; }
.nav-sub a:hover { background: #eff6ff; color: #1d4ed8 !important; text-decoration: none; }
.nav-sub a b { display: block; font-size: 13px; font-weight: 600; }
.nav-sub a i { display: block; font-style: normal; font-size: 11.5px; color: #94a3b8; margin-top: 2px; }
.nav-sub a:hover i { color: #60a5fa; }
.nav-sub a.on { background: #2563eb; }
.nav-sub a.on b { color: #fff; }
.nav-sub a.on i { color: #bfdbfe; }

.userbox { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-shrink: 0; }
.userbox a { color: #94a3b8; }
.userbox a:hover { color: #fff; }
.uname { color: #e2e8f0; }
.role-tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; background: #475569; color: #e2e8f0; }
.role-admin { background: #fde68a; color: #92400e; }
.role-sales { background: #bfdbfe; color: #1e40af; }
.role-purchase { background: #ddd6fe; color: #5b21b6; }
.role-stock { background: #bbf7d0; color: #166534; }
.role-viewer { background: #e2e8f0; color: #475569; }

/* 主体 */
.main { max-width: 1360px; margin: 0 auto; padding: 20px; }
.page-title { font-size: 20px; margin-bottom: 16px; color: #111827; }
.foot { text-align: center; color: #9ca3af; font-size: 12px; padding: 24px 0; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 10px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); border-top: 3px solid #2563eb; }
.stat-card.warn { border-top-color: #f59e0b; }
.stat-card.ok { border-top-color: #16a34a; }
.stat-card.danger { border-top-color: #dc2626; }
.stat-num { font-size: 24px; font-weight: 700; color: #111827; }
.stat-label { color: #6b7280; font-size: 12px; margin-top: 4px; }

/* 面板 */
.panel { background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 20px; padding: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.panel-head h3 { font-size: 16px; color: #111827; }
.mono { font-family: Consolas, Monaco, monospace; font-size: 12.5px; }

/* 两列布局 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 9px 8px; border-bottom: 1px solid #eef0f4; text-align: left; vertical-align: middle; font-size: 13px; }
.tbl th { color: #6b7280; font-weight: 600; background: #f9fafb; white-space: nowrap; }
.tbl tr:hover td { background: #f8fafc; }
.tbl .empty { text-align: center; color: #9ca3af; padding: 30px; }
.tbl .ops { white-space: nowrap; }
.tbl .ops .linkbtn { margin-right: 6px; }
.num-strong { font-weight: 700; color: #111827; }
.num-profit { font-weight: 700; color: #c2410c; }
.num-in { color: #16a34a; font-weight: 600; }
.num-out { color: #dc2626; font-weight: 600; }
.num-low { color: #dc2626; font-weight: 700; }
td.num-strong, td.num-profit { white-space: nowrap; }

/* 单据明细录入表 */
.item-tbl { margin: 14px 0 6px; }
.item-tbl select, .item-tbl input { width: 100%; }
.sum-row td { background: #f9fafb; font-weight: 600; border-top: 2px solid #e5e7eb; }

/* 徽章 */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; white-space: nowrap; }
.st-active { background: #dcfce7; color: #15803d; }
.st-draft { background: #f3f4f6; color: #6b7280; }
.st-low { background: #fef3c7; color: #b45309; }
.st-out { background: #fee2e2; color: #b91c1c; }
.rg-tag { display: inline-block; padding: 2px 9px; border-radius: 4px; font-size: 12px; background: #eef2ff; color: #4338ca; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.fg label { display: block; font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.fg.full { grid-column: 1 / -1; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; font-family: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { resize: vertical; }

/* 按钮 */
.btn { display: inline-block; padding: 8px 18px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; color: #374151; font-size: 13px; cursor: pointer; }
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.ok { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn.danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.big { padding: 10px 26px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; }
.linkbtn { background: none; border: none; color: #2563eb; cursor: pointer; font-size: 13px; padding: 0; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: #dc2626; }
.link { font-size: 13px; }

/* 提示 */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; line-height: 1.7; }
.alert.ok { background: #dcfce7; color: #15803d; }
.alert.err { background: #fee2e2; color: #b91c1c; }
.alert.warn { background: #fef3c7; color: #b45309; }
.muted { color: #9ca3af; font-size: 12px; }
.img-ph { display: inline-block; width: 34px; height: 34px; line-height: 34px; text-align: center; font-size: 10px; color: #9ca3af; background: #f3f4f6; border-radius: 6px; }
.thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; border: 1px solid #e5e7eb; vertical-align: middle; }
.cell-img { width: 46px; }

/* 筛选 */
.filter-bar { margin-bottom: 16px; }
.filter-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-form input[type=text] { width: 220px; }
.stage-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-tabs a { padding: 6px 14px; border-radius: 16px; background: #fff; color: #4b5563; font-size: 13px; border: 1px solid #e5e7eb; }
.stage-tabs a:hover { text-decoration: none; border-color: #2563eb; color: #2563eb; }
.stage-tabs a.on { background: #2563eb; color: #fff; border-color: #2563eb; }

/* 极简柱状图 */
.chart-bars { display: flex; align-items: flex-end; justify-content: space-around; gap: 12px; height: 210px; padding: 10px 4px 0; }
.chart-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1; height: 100%; }
.chart-stack { display: flex; align-items: flex-end; gap: 5px; }
.cbar { width: 22px; border-radius: 4px 4px 0 0; transition: height .4s; }
.cbar.a { background: linear-gradient(180deg, #3b82f6, #2563eb); }
.cbar.g { background: linear-gradient(180deg, #fb923c, #ea580c); }
.chart-val { font-size: 12px; color: #374151; margin-top: 6px; font-weight: 600; }
.chart-lb { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.legend { text-align: center; margin-top: 8px; font-size: 12px; color: #6b7280; }
.legend span { margin: 0 10px; }
.lg-a { color: #2563eb; }
.lg-g { color: #ea580c; }

/* 进度条 */
.pbar { height: 8px; background: #eef0f4; border-radius: 5px; overflow: hidden; display: inline-block; width: 90px; vertical-align: middle; margin-right: 6px; }
.pbar > div { height: 100%; background: linear-gradient(90deg, #3b82f6, #2563eb); border-radius: 5px; }

/* ============================================================
   区域销售额排行（水平条状图）
   「客户与区域」页四张图共用：大区 / 省份 / 城市 / 县级及以下
   ============================================================ */
.rank-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 18px; }
@media (max-width: 940px) { .rank-grid { grid-template-columns: 1fr; } }

.rank-panel { background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.rank-head { display: flex; align-items: baseline; gap: 10px; padding: 14px 18px 10px; border-bottom: 1px solid #f1f5f9; }
.rank-head h4 { font-size: 15px; color: #111827; font-weight: 700; }
.rank-head .rank-sub { font-size: 12px; color: #9ca3af; margin-left: auto; white-space: nowrap; }
.rank-head .rank-ico { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }

/* 图标配色：四级各不同，便于快速区分 */
.ico-region   { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.ico-province { background: linear-gradient(135deg, #0891b2, #0e7490); }
.ico-city     { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.ico-county   { background: linear-gradient(135deg, #db2777, #be185d); }

.rank-body { padding: 12px 18px 16px; flex: 1; }

/* 单行排行条 */
.rk-row { margin-bottom: 11px; }
.rk-row:last-child { margin-bottom: 2px; }
.rk-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.rk-no { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 5px; font-size: 11px; font-weight: 700; background: #eef2f7; color: #64748b; flex-shrink: 0; }
.rk-no.top1 { background: #fef3c7; color: #b45309; }
.rk-no.top2 { background: #e2e8f0; color: #475569; }
.rk-no.top3 { background: #ffedd5; color: #c2410c; }
.rk-name { color: #1f2937; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-name .rk-blank { color: #9ca3af; font-weight: 400; font-style: normal; }
.rk-amt { margin-left: auto; font-weight: 700; color: #111827; font-family: Consolas, Monaco, monospace; white-space: nowrap; }
.rk-share { font-size: 11px; color: #9ca3af; font-family: Consolas, Monaco, monospace; white-space: nowrap; min-width: 44px; text-align: right; }

/* 条形轨道 */
.rk-track { position: relative; height: 16px; background: #f1f5f9; border-radius: 8px; overflow: hidden; }
.rk-fill { height: 100%; border-radius: 8px; transition: width .5s ease; min-width: 2px; }
.rk-fill.c-region   { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.rk-fill.c-province { background: linear-gradient(90deg, #22d3ee, #0891b2); }
.rk-fill.c-city     { background: linear-gradient(90deg, #a78bfa, #7c3aed); }
.rk-fill.c-county   { background: linear-gradient(90deg, #f472b6, #db2777); }

/* 空态 */
.rk-empty { text-align: center; color: #9ca3af; font-size: 13px; padding: 34px 10px; }

/* 排行汇总脚注 */
.rank-foot { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #e5e7eb; display: flex; font-size: 12px; color: #6b7280; }
.rank-foot b { color: #1f2937; font-family: Consolas, Monaco, monospace; }
.rank-foot span { margin-right: 18px; }

/* 期间切换条的说明文字 */
.chart-tip { background: #f8fafc; border-left: 3px solid #2563eb; border-radius: 0 6px 6px 0; padding: 9px 14px; font-size: 12.5px; color: #475569; line-height: 1.8; margin-bottom: 16px; }

/* 报表 */
.report-period { background: #eff6ff; border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #1e40af; margin-bottom: 16px; }
.report-tbl td { padding: 9px 12px; }
.report-tbl .rnum { text-align: right; font-family: Consolas, Monaco, monospace; white-space: nowrap; }
.report-tbl .ind1 { padding-left: 30px; color: #4b5563; }
.rpt-head td { background: #f9fafb; font-weight: 700; color: #111827; border-bottom: 1px solid #e5e7eb; }
.rpt-sub td { font-weight: 600; background: #fbfcfd; }
.rpt-total td { font-weight: 700; background: #eff6ff; color: #1e3a8a; border-top: 2px solid #bfdbfe; }
.rpt-total.big td { font-size: 15px; background: #e0e7ff; }
.rnum.pos { color: #16a34a; }
.rnum.neg { color: #dc2626; }

/* 采购建议 */
.suggest-panel { border-left: 4px solid #f59e0b; }
.suggest-legend { background: #fffbeb; border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #92400e; margin-bottom: 14px; line-height: 1.8; }
.insight-list { list-style: none; }
.insight-list li { padding: 10px 14px; border-left: 3px solid #2563eb; background: #f8fafc; border-radius: 0 6px 6px 0; margin-bottom: 10px; font-size: 13px; line-height: 1.9; }
.insight-list li.warn-li { border-left-color: #f59e0b; background: #fffbeb; }

/* 图片上传 */
.ph-wrap { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.ph-preview { width: 120px; height: 120px; border: 1px dashed #d1d5db; border-radius: 8px; background: #f9fafb; display: flex; align-items: center; justify-content: center; overflow: hidden; text-align: center; }
.ph-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-ops { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.up-status { font-size: 12px; }
.up-status .ok { color: #15803d; }

/* 保存条 */
.save-bar { display: flex; gap: 12px; margin: 16px 0; align-items: center; flex-wrap: wrap; }
.save-hint { color: #9ca3af; font-size: 12px; }

/* 分页 */
.pager { margin-top: 14px; font-size: 13px; color: #6b7280; }
.pager a, .pager .cur { display: inline-block; min-width: 30px; padding: 4px 8px; margin-right: 4px; text-align: center; border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; }
.pager a:hover { border-color: #2563eb; color: #2563eb; text-decoration: none; }
.pager .cur { background: #2563eb; color: #fff; border-color: #2563eb; }
.pager .dots { padding: 4px 4px; color: #9ca3af; }

/* 登录页 */
.login-page { background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-wrap { text-align: center; }
.login-card { background: #fff; border-radius: 16px; padding: 36px 40px; width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.4); }
.login-brand { margin-bottom: 24px; }
.login-brand h1 { font-size: 24px; letter-spacing: 6px; margin-top: 12px; color: #111827; }
.login-brand p { color: #6b7280; font-size: 13px; margin-top: 4px; }
.login-brand .brand-logo { width: 64px; height: 64px; font-size: 32px; border-radius: 16px; }
.login-form { text-align: left; }
.login-form label { display: block; font-size: 12px; color: #6b7280; margin: 12px 0 4px; }
.login-form .btn { margin-top: 20px; padding: 10px; font-size: 15px; }
.login-tip { margin-top: 16px; font-size: 12px; color: #9ca3af; }
.login-foot { color: #64748b; font-size: 12px; margin-top: 20px; }
.no-auth { padding: 80px; text-align: center; color: #b91c1c; font-size: 16px; }

.st-sel { width: auto !important; display: inline-block; padding: 4px 6px !important; font-size: 12px !important; }

@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px; }
  .nav { order: 3; width: 100%; }
}
@media print {
  .topbar, .foot, .filter-bar, .save-bar, .stage-tabs, .btn, .no-print { display: none !important; }
  body { background: #fff; }
  .panel { box-shadow: none; border: 1px solid #e5e7eb; page-break-inside: avoid; }
}

/* ============================================================
   组织管理组卡片（组织与账户页）
   ============================================================ */
.org-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 14px 18px 18px; }
.org-card { border: 1px solid #e5e7eb; border-radius: 10px; padding: 13px 14px; background: #fafbfc;
  border-top: 3px solid #94a3b8; }
.org-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.org-badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 13px;
  font-weight: 600; color: #fff; background: #64748b; }
.org-desc { font-size: 12.5px; color: #64748b; line-height: 1.6; margin: 0 0 10px; }
.org-duty { list-style: none; margin: 0; padding: 0; }
.org-duty li { padding: 7px 0; border-top: 1px dashed #e5e7eb; font-size: 12.5px; }
.org-duty li b { display: block; color: #1f2937; font-weight: 600; margin-bottom: 2px; }
.org-duty li span { color: #94a3b8; line-height: 1.55; }
.org-card.g-mkt    { border-top-color: #2563eb; } .org-card.g-mkt    .org-badge { background: #2563eb; }
.org-card.g-buy    { border-top-color: #0891b2; } .org-card.g-buy    .org-badge { background: #0891b2; }
.org-card.g-fin    { border-top-color: #7c3aed; } .org-card.g-fin    .org-badge { background: #7c3aed; }
.org-card.g-office { border-top-color: #db2777; } .org-card.g-office .org-badge { background: #db2777; }
.org-card.g-hr     { border-top-color: #ea580c; } .org-card.g-hr     .org-badge { background: #ea580c; }
.org-card.g-stock  { border-top-color: #059669; } .org-card.g-stock  .org-badge { background: #059669; }
.org-card.g-prod   { border-top-color: #b45309; } .org-card.g-prod   .org-badge { background: #b45309; }

/* ============================================================
   权限微调浮层
   ============================================================ */
.perm-mask { position: fixed; inset: 0; z-index: 900; display: none;
  background: rgba(15,23,42,.45); align-items: center; justify-content: center; padding: 20px; }
.perm-dialog { width: 100%; max-width: 720px; max-height: 88vh; overflow: hidden;
  background: #fff; border-radius: 12px; box-shadow: 0 24px 60px rgba(15,23,42,.32);
  display: flex; flex-direction: column; }
.perm-head { display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px; border-bottom: 1px solid #e5e7eb; }
.perm-head h3 { margin: 0; font-size: 16px; color: #1f2937; }
.perm-close { border: 0; background: none; font-size: 24px; line-height: 1;
  color: #94a3b8; cursor: pointer; padding: 0 4px; }
.perm-close:hover { color: #ef4444; }
.perm-tip { padding: 11px 20px; background: #f8fafc; border-bottom: 1px solid #e5e7eb;
  font-size: 12.5px; color: #64748b; line-height: 1.65; }
.perm-body { padding: 14px 20px; overflow-y: auto; flex: 1;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px 14px; }
.perm-item { display: flex; align-items: center; gap: 7px; padding: 7px 9px;
  border: 1px solid #e5e7eb; border-radius: 7px; font-size: 13px; cursor: pointer;
  transition: background .15s ease, border-color .15s ease; }
.perm-item:hover { background: #eff6ff; border-color: #bfdbfe; }
.perm-item input { margin: 0; cursor: pointer; }
.perm-item span { color: #1f2937; }
.perm-foot { padding: 13px 20px; border-top: 1px solid #e5e7eb;
  display: flex; gap: 9px; justify-content: flex-end; background: #fafbfc; }

@media (max-width: 1100px) { .org-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .org-grid { grid-template-columns: 1fr; }
  .perm-body { grid-template-columns: repeat(2, 1fr); }
}

/* 账户身份徽章（新权限体系：组织组 + 四级销售商） */
.role-mkt { background: #dbeafe; color: #1d4ed8; }
.role-buy { background: #cffafe; color: #0e7490; }
.role-fin { background: #ede9fe; color: #6d28d9; }
.role-office { background: #fce7f3; color: #be185d; }
.role-hr  { background: #ffedd5; color: #c2410c; }
.role-stock { background: #d1fae5; color: #047857; }
.role-prod  { background: #fef3c7; color: #b45309; }
.role-region { background: #dbeafe; color: #1e40af; }
.role-province { background: #cffafe; color: #155e75; }
.role-city { background: #ede9fe; color: #5b21b6; }
.role-county { background: #fce7f3; color: #9d174d; }
.role-viewer { background: #f1f5f9; color: #475569; }
.role-purchase { background: #cffafe; color: #0e7490; }
.badge.lv0 { background: #fde68a; color: #92400e; }
.badge.lv1 { background: #dbeafe; color: #1d4ed8; }
.badge.lv2 { background: #cffafe; color: #0e7490; }
.badge.lv3 { background: #ede9fe; color: #6d28d9; }
.badge.lv4 { background: #fce7f3; color: #be185d; }
.badge.lv9 { background: #e2e8f0; color: #475569; }

/* ============================================================
   行政管理 / 公告与制度正文、置顶标记、内联勾选
   ============================================================ */
.nt-body { font-size: 12px; line-height: 1.65; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pin { display: inline-block; padding: 0 5px; margin-right: 5px; border-radius: 4px;
  background: #ef4444; color: #fff; font-size: 11px; line-height: 17px; vertical-align: 1px; }
.chk-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  color: #374151; cursor: pointer; padding-top: 9px; }
.chk-inline input { margin: 0; cursor: pointer; }
textarea { font-family: inherit; line-height: 1.7; resize: vertical; }

/* ============================================================
   审批流程步骤条
   ============================================================ */
.flow-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 14px 18px 4px; }
.flow-step { display: inline-block; padding: 7px 14px; border-radius: 999px;
  background: #f1f5f9; color: #475569; font-size: 13px; border: 1px solid #e2e8f0; }
.flow-step.on { background: #2563eb; color: #fff; border-color: #2563eb; font-weight: 600; }
.flow-step.end { background: #d1fae5; color: #047857; border-color: #a7f3d0; }
.flow-arrow { color: #94a3b8; font-size: 15px; }
@media (max-width: 760px) { .flow-row { flex-direction: column; align-items: flex-start; } .flow-arrow { transform: rotate(90deg); } }

/* ============================================================
   §趋势图（近 12 个月销售/采购走势）
   mkt_analysis.asp 用 .tr-chart/.tr-bars/.tr-col/.tr-bar
   buy_analysis.asp 用 .mini-bars/.mb-col/.mb-track/.mb-bar
   ============================================================ */
.tr-chart { padding: 6px 2px 0; }
.tr-bars { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding: 0 4px;
  border-bottom: 2px solid #e2e8f0; overflow-x: auto; }
.tr-col { flex: 1 0 46px; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; height: 100%; min-width: 46px; }
.tr-val { font-size: 11px; color: #64748b; margin-bottom: 4px; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.tr-track { width: 100%; display: flex; align-items: flex-end; justify-content: center;
  gap: 4px; flex: 1; }
.tr-bar { width: 13px; min-height: 3px; border-radius: 3px 3px 0 0; transition: opacity .15s; }
.tr-bar.lg-sale { background: linear-gradient(180deg,#3b82f6,#2563eb); }
.tr-bar.lg-profit { background: linear-gradient(180deg,#fbbf24,#f59e0b); }
.tr-bar:hover { opacity: .78; }
.tr-bar-p { background: linear-gradient(180deg,#60a5fa,#2563eb); width: 18px; }
.tr-bar-p:hover { opacity: 1; }
.tr-lab { font-size: 11px; color: #94a3b8; margin-top: 6px; white-space: nowrap; }
.tr-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px;
  font-size: 12px; color: #64748b; }
.tr-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tr-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.tr-legend i.lg-sale { background: #2563eb; }
.tr-legend i.lg-profit { background: #f59e0b; }

/* 迷你柱状（采购分析：月度采购额） */
.mini-bars { display: flex; align-items: flex-end; gap: 7px; height: 152px; padding: 0 4px;
  border-bottom: 2px solid #e2e8f0; overflow-x: auto; }
.mb-col { flex: 1 0 42px; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; height: 100%; min-width: 42px; }
.mb-track { width: 100%; display: flex; align-items: flex-end; justify-content: center;
  flex: 1; }
.mb-bar { width: 16px; min-height: 3px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg,#a78bfa,#7c3aed); transition: opacity .15s; }
.mb-bar:hover { opacity: .78; }
.mb-lab { font-size: 11px; color: #94a3b8; margin-top: 6px; white-space: nowrap; }

@media (max-width: 760px) {
  .tr-bars, .mini-bars { height: 140px; }
  .tr-col, .mb-col { flex: 0 0 38px; min-width: 38px; }
}

/* ============================================================
   §折叠明细行（hr.asp / admin_office.asp / approve.asp）
   ============================================================ */
tr.row-detail > td { background: #f8fafc; padding: 0; border-top: 1px dashed #e2e8f0; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 22px; padding: 14px 18px 16px; font-size: 13px; }
.detail-grid > div { line-height: 1.9; }
.detail-grid b { color: #94a3b8; font-weight: 500; margin-right: 6px; }

/* ============================================================
   §账户链路矩阵表（org.asp）
   ============================================================ */
.role-matrix { font-size: 13px; }
.role-matrix th { background: #f8fafc; color: #475569; font-weight: 600; white-space: nowrap; }
.role-matrix td { vertical-align: middle; }
.role-matrix tr:hover td { background: #f8fafc; }

/* 表格外层包裹（让宽表可横向滚动而不撑破布局） */
.tbl-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl-wrap > .tbl { margin-bottom: 0; }
