/* =========================================================================
   算数建筑资质代办 CRM · 易用性增强样式（20260912）
   包含：顶栏 / 侧栏 / 图标 / 说明抽屉 / 弹窗 / 看板图表 / 批量条 /
        筛选 chips / 设置中心 / 权限矩阵 / 二维码 / 搜索 / 移动端 / 紧凑密度
   ========================================================================= */

/* ---------------- 基础：图标与密度 ---------------- */
.svg-sprite { display: none; }
.ico { width: 18px; height: 18px; flex-shrink: 0; display: inline-block; vertical-align: -3px; }
.ico-sm { width: 15px; height: 15px; }
.btn .ico, .tb-btn .ico { margin-right: .3rem; }
.btn .ico:last-child { margin-right: 0; }
.btn-sm .ico { width: 14px; height: 14px; }
a { color: var(--accent); }

.layout.is-density-compact .content { padding: .85rem 1.1rem 1.4rem; }
.layout.is-density-compact .table th,
.layout.is-density-compact .table td { padding: .38rem .5rem; font-size: 0.8rem; }
.layout.is-density-compact .card-body { padding: .8rem; }
.layout.is-density-compact .stat-card { padding: .7rem .85rem; }
.layout.is-density-compact .stat-card .value { font-size: 1.25rem; }

/* ---------------- 顶栏 ---------------- */
.main { background: var(--bg); }
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: .5rem 1rem;
  display: flex; align-items: center; gap: .75rem;
  min-height: 58px;
  box-shadow: 0 1px 3px rgba(15, 28, 40, .04);
}
.tb-left { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.tb-crumb { display: flex; align-items: center; gap: .35rem; min-width: 0; white-space: nowrap; }
.tb-crumb-group { color: var(--muted); font-size: 0.8rem; }
.tb-crumb-sep { color: #cbd5e1; }
.tb-crumb-page { font-weight: 700; font-size: 0.93rem; overflow: hidden; text-overflow: ellipsis; }

.tb-search { flex: 1; max-width: 460px; }
.tb-search form { display: flex; align-items: center; gap: .4rem; background: #f1f5f9; border: 1px solid transparent; border-radius: 8px; padding: .28rem .6rem; }
.tb-search form:focus-within { background: #fff; border-color: var(--accent); }
.tb-search .ico { color: var(--muted); }
.tb-search input {
  border: 0; background: transparent; outline: none; width: 100%;
  font-size: 0.87rem; color: var(--text); padding: .2rem 0;
}
.tb-search input::-webkit-search-cancel-button { cursor: pointer; }

.tb-right { display: flex; align-items: center; gap: .25rem; margin-left: auto; flex-wrap: nowrap; }
.tb-quick { display: flex; align-items: center; gap: .15rem; padding-right: .35rem; margin-right: .35rem; border-right: 1px solid var(--border); }
.tb-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: .1rem;
  border: 0; background: transparent; color: #334155;
  padding: .38rem .5rem; border-radius: 8px; cursor: pointer;
  font-size: 0.8rem; font-family: inherit; text-decoration: none;
  white-space: nowrap;
}
.tb-btn:hover { background: #f1f5f9; color: var(--accent); }
.tb-btn-text { }
.tb-quick-link .ico { margin-right: .15rem; }
.tb-badge {
  position: absolute; top: 0; right: 0;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: var(--accent); color: #fff;
  font-size: 0.68rem; line-height: 16px; text-align: center; font-weight: 700;
}
.tb-badge.is-warn { background: #dc2626; }
.tb-only-mobile { display: none; }

/* 顶栏下拉面板 */
.tb-dropdown { position: relative; }
.tb-panel {
  display: none;
  position: absolute; right: 0; top: calc(100% + 6px);
  width: 380px; max-width: calc(100vw - 24px);
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 28, 40, .14);
  z-index: 60; overflow: hidden;
}
.tb-dropdown.is-open .tb-panel { display: block; }
.tb-panel-sm { width: 280px; }
.tb-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .6rem .8rem; border-bottom: 1px solid var(--border); background: #f8fafc;
}
.tb-panel-head strong { font-size: 0.87rem; }
.tb-panel-head a { font-size: 0.8rem; text-decoration: none; }
.tb-panel-hint { color: var(--muted); font-size: 0.73rem; }
.tb-panel-body { max-height: 400px; overflow-y: auto; }
.tb-item {
  display: flex; align-items: flex-start; gap: .5rem;
  padding: .55rem .8rem; border-bottom: 1px solid #f1f5f9;
  text-decoration: none; color: inherit;
}
.tb-item:hover { background: #f8fafc; }
.tb-item-danger .tb-item-title { color: #b91c1c; }
.tb-item-main { display: flex; flex-direction: column; gap: .12rem; min-width: 0; }
.tb-item-title { font-size: 0.8rem; font-weight: 600; line-height: 1.35; }
.tb-item-sub { font-size: 0.73rem; color: var(--muted); line-height: 1.35; }
.tb-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: .35rem; background: #94a3b8; flex-shrink: 0; }
.tb-dot-danger { background: #dc2626; }
.tb-dot-warn { background: #d97706; }
.tb-dot-info { background: #2563eb; }
.tb-tag {
  flex-shrink: 0; font-size: 0.68rem; padding: .1rem .35rem; border-radius: 4px;
  background: #e2e8f0; color: #475569; margin-top: .1rem;
}
.tb-empty { padding: 1.2rem; text-align: center; color: var(--muted); font-size: 0.8rem; }
.tb-user .tb-btn-text { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- 侧栏 ---------------- */
.sidebar nav a { position: relative; }
.sidebar nav .nav-ico { flex-shrink: 0; opacity: .85; }
.sidebar nav a.active .nav-ico { opacity: 1; }
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #dc2626; color: #fff;
  font-size: 0.68rem; line-height: 18px; text-align: center; font-weight: 700;
}
.layout.is-sidebar-collapsed .sidebar nav .nav-ico { width: 20px; height: 20px; }
.layout.is-sidebar-collapsed .sidebar nav a .nav-badge {
  position: absolute; top: 4px; right: 8px; margin: 0;
  min-width: 8px; height: 8px; padding: 0; font-size: 0; line-height: 8px;
}
.layout.is-sidebar-collapsed .sidebar nav a::before { content: none; }
.sidebar-toggle .ico { width: 15px; height: 15px; }
.layout.is-sidebar-collapsed .sidebar .user-box { padding: .6rem .3rem; text-align: center; }

/* ---------------- 页面头 / 返回 / 说明按钮 ---------------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; flex-wrap: wrap; }
.page-header-left { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.page-header-sub { color: var(--muted); font-size: 0.8rem; width: 100%; }
.btn-back {
  display: inline-flex; align-items: center; gap: .25rem;
  border: 1px solid var(--border); background: #fff; color: #475569;
  border-radius: 8px; padding: .3rem .55rem; cursor: pointer;
  font-size: 0.8rem; font-family: inherit;
}
.btn-back:hover { border-color: var(--accent); color: var(--accent); }
.btn-back .ico { width: 15px; height: 15px; }
.page-help-btn {
  display: inline-flex; align-items: center; gap: .25rem;
  border: 1px dashed var(--border); background: #f8fafc; color: var(--muted);
  border-radius: 999px; padding: .18rem .6rem; cursor: pointer;
  font-size: 0.73rem; font-family: inherit;
}
.page-help-btn:hover { color: var(--accent); border-color: var(--accent); }
.page-help-btn .ico { width: 14px; height: 14px; }
.page-header-right { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }

/* ---------------- 说明抽屉 ---------------- */
.help-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 92vw;
  background: #fff; z-index: 90; display: flex; flex-direction: column;
  box-shadow: -12px 0 32px rgba(15, 28, 40, .16);
  border-left: 1px solid var(--border);
  animation: drawer-in .18s ease;
}
.help-drawer[hidden] { display: none; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.help-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1rem; border-bottom: 1px solid var(--border); background: #f8fafc;
}
.help-drawer-close { border: 0; background: transparent; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--muted); }
.help-drawer-body { padding: 1rem; overflow-y: auto; }
.help-block { margin-bottom: 1rem; }
.help-block-title { font-size: 0.73rem; font-weight: 700; color: var(--accent); margin-bottom: .3rem; letter-spacing: .02em; }
.help-block p { margin: 0; font-size: 0.87rem; line-height: 1.7; color: #334155; }
.help-block ul { margin: 0; padding-left: 1.1rem; font-size: 0.8rem; line-height: 1.7; color: #475569; }

/* ---------------- 弹窗 ---------------- */
dialog.modal {
  border: 0; border-radius: 12px; padding: 0; width: 460px; max-width: 94vw;
  box-shadow: 0 24px 48px rgba(15, 28, 40, .24);
}
dialog.modal::backdrop { background: rgba(15, 28, 40, .45); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; border-bottom: 1px solid var(--border); background: #f8fafc;
}
.modal-close { border: 0; background: transparent; font-size: 1.3rem; cursor: pointer; color: var(--muted); }
.modal-body { padding: 1rem; }

/* ---------------- 二维码 ---------------- */
.qr-wrap { display: flex; justify-content: center; padding: .5rem 0; }
.qr-wrap canvas, .qr-wrap svg, .qr-wrap img { border: 1px solid var(--border); border-radius: 8px; padding: 6px; background: #fff; }
.qr-tip { text-align: center; color: var(--muted); font-size: 0.8rem; margin: .4rem 0 .7rem; }
.qr-link-row { display: flex; gap: .4rem; align-items: center; }
.qr-link-row .form-control { flex: 1; font-size: 0.8rem; }
.qr-box { display: flex; justify-content: center; min-height: 180px; align-items: center; }
.qr-canvas canvas, .qr-canvas svg, .qr-canvas img { border: 1px solid var(--border); border-radius: 8px; padding: 6px; }
.share-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.share-card .share-open { margin-top: .5rem; display: inline-flex; }
.tips-list { margin: 0; padding-left: 1.1rem; font-size: 0.87rem; line-height: 1.8; color: #334155; }

/* ---------------- 看板 ---------------- */
.board-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1rem; }
.board-grid .card { margin-bottom: 0; }
.board-grid .card.is-wide { grid-column: 1 / -1; }
.panel-split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.panel-foot { margin: .6rem 0 0; color: var(--muted); font-size: 0.73rem; line-height: 1.6; }
.panel-note {
  margin-top: .7rem; padding: .55rem .7rem; border-radius: 8px;
  background: #f8fafc; border: 1px solid var(--border);
  font-size: 0.8rem; line-height: 1.7; color: #475569;
}
.bar-empty { padding: 1.2rem; text-align: center; color: var(--muted); font-size: 0.8rem; }
.bar-chart { display: flex; flex-direction: column; gap: .35rem; }
.bar-row { display: grid; grid-template-columns: 120px 1fr auto; gap: .5rem; align-items: center; text-decoration: none; color: inherit; padding: .12rem .2rem; border-radius: 6px; }
.bar-row.is-link:hover { background: #f8fafc; }
.bar-label { font-size: 0.8rem; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 14px; background: #eef2f7; border-radius: 7px; overflow: hidden; display: block; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 7px; transition: width .3s ease; }
.bar-fill.is-teal { background: #0d9488; }
.bar-fill.is-warn { background: #d97706; }
.bar-value { font-size: 0.8rem; font-weight: 700; color: #334155; white-space: nowrap; }
.bar-note { grid-column: 1 / -1; font-size: 0.68rem; color: var(--muted); padding-left: 122px; margin-top: -.2rem; }
.bar-row { grid-template-areas: 'label track value' 'note note note'; }
.bar-row .bar-note { grid-area: note; }

.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: .7rem; }
.donut { width: 150px; height: 150px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.donut-hole {
  width: 104px; height: 104px; border-radius: 50%; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
}
.donut-hole strong { font-size: 1.15rem; }
.donut-hole small { font-size: 0.68rem; color: var(--muted); }
.donut-legend { width: 100%; display: flex; flex-direction: column; gap: .25rem; }
.donut-legend-item { display: flex; align-items: center; gap: .4rem; font-size: 0.8rem; }
.donut-legend-item i { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.donut-legend-label { flex: 1; color: #475569; }
.donut-legend-value { font-weight: 700; }

.mini-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; }
.mini-stat {
  display: flex; flex-direction: column; gap: .18rem;
  padding: .7rem .8rem; border: 1px solid var(--border); border-radius: 9px;
  background: #fff; text-decoration: none; color: inherit;
}
a.mini-stat.is-link:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(13, 148, 136, .12); }
.mini-label { font-size: 0.73rem; color: var(--muted); }
.mini-value { font-size: 1.15rem; font-weight: 700; }
.mini-value.teal { color: var(--accent); }
.mini-hint { font-size: 0.68rem; color: var(--muted); }
.progress-row { display: flex; align-items: center; gap: .6rem; margin-top: .8rem; }
.progress-label { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.progress-track { flex: 1; height: 12px; background: #eef2f7; border-radius: 6px; overflow: hidden; }
.progress-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #2dd4bf); }
.progress-value { font-size: 0.8rem; font-weight: 700; }

/* 懒加载骨架 */
.lazy-panel .card-body { position: relative; }
.lazy-error { padding: 1.2rem; text-align: center; color: var(--muted); font-size: 0.8rem; }
.sk-lines { display: flex; flex-direction: column; gap: .5rem; padding: .3rem 0; }
.sk-lines i { display: block; height: 14px; border-radius: 6px; background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; }
.sk-lines i:nth-child(2) { width: 88%; }
.sk-lines i:nth-child(3) { width: 72%; }
.sk-lines i:nth-child(4) { width: 80%; }
.sk-chart { display: flex; align-items: flex-end; gap: .5rem; height: 140px; }
.sk-chart span { flex: 1; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, #eef2f7, #f8fafc); animation: sk 1.4s ease infinite; background-size: 100% 200%; }
.sk-chart span:nth-child(1) { height: 40%; } .sk-chart span:nth-child(2) { height: 70%; }
.sk-chart span:nth-child(3) { height: 55%; } .sk-chart span:nth-child(4) { height: 85%; }
.sk-chart span:nth-child(5) { height: 62%; }
.sk-stat { height: 110px; border-radius: 8px; background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------- 筛选 chips / 工具栏 ---------------- */
.filter-chips { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin: -.3rem 0 .8rem; }
.filter-chips-label { font-size: 0.73rem; color: var(--muted); }
.filter-chip {
  display: inline-flex; align-items: center; gap: .25rem;
  background: #e6fffb; color: #0f766e; border: 1px solid #99f6e4;
  border-radius: 999px; padding: .12rem .55rem; font-size: 0.73rem;
}
.filter-chip-x { text-decoration: none; color: #0f766e; font-weight: 700; padding: 0 .1rem; }
.filter-chip-x:hover { color: #b91c1c; }
.filter-chips-clear { font-size: 0.73rem; }
.input-wrap { position: relative; display: inline-flex; align-items: center; }
.input-wrap .input-clear {
  position: absolute; right: .3rem; border: 0; background: #e2e8f0; color: #475569;
  width: 18px; height: 18px; border-radius: 50%; line-height: 1; cursor: pointer; font-size: 0.8rem;
}
.date-quick { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; margin-top: .28rem; }
.date-quick-btn {
  border: 1px solid var(--border); background: #f8fafc; color: #475569;
  border-radius: 999px; padding: .1rem .5rem; font-size: 0.73rem; cursor: pointer; font-family: inherit;
}
.date-quick-btn:hover { border-color: var(--accent); color: var(--accent); }
.date-hint { font-size: 0.73rem; color: var(--muted); }
.has-error .form-control { border-color: #dc2626; background: #fef2f2; }

/* ---------------- 分页增强 ---------------- */
.pager { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: space-between; padding-top: .7rem; }
.pager-info { font-size: 0.8rem; color: var(--muted); }
.pager-links { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.pager-links a, .pager-links span {
  min-width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 6px; font-size: 0.8rem;
  text-decoration: none; color: #475569; padding: 0 .4rem; background: #fff;
}
.pager-links a:hover { border-color: var(--accent); color: var(--accent); }
.pager-links .is-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.pager-links .is-disabled { color: #cbd5e1; background: #f8fafc; }
.pager-gap { border: 0; background: transparent; color: var(--muted); }
.pager-jump { display: flex; align-items: center; gap: .3rem; font-size: 0.73rem; color: var(--muted); }
.pager-jump input { width: 60px; padding: .2rem .35rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.73rem; }
.pager-size { display: flex; align-items: center; gap: .2rem; font-size: 0.73rem; color: var(--muted); }
.pager-size a, .pager-size .is-active { padding: .1rem .35rem; border-radius: 5px; text-decoration: none; color: #475569; }
.pager-size .is-active { background: var(--accent); color: #fff; font-weight: 700; }

/* ---------------- 批量操作条 ---------------- */
.bulk-form { margin: 0; }
.bulk-bar {
  display: none; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .5rem .7rem; margin-bottom: .7rem;
  background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 9px;
}
.bulk-bar.is-active { display: flex; }
.bulk-count { font-size: 0.8rem; color: #065f46; }
.bulk-count b { font-size: 0.93rem; }
.bulk-hint { font-size: 0.73rem; color: var(--muted); margin-left: auto; }
.bulk-check { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }
.table th .bulk-check { margin-top: 2px; }
tr.is-clickable { cursor: pointer; }
.cell-actions { white-space: nowrap; }
.cell-actions .inline-form { display: inline; }
.form-control-sm { padding: .22rem .45rem; font-size: 0.8rem; width: auto; }

/* ---------------- 导入面板 ---------------- */
.import-card { max-width: 760px; }
.import-fields { margin-top: 1rem; padding-top: .8rem; border-top: 1px dashed var(--border); }
.import-fields-title { font-size: 0.8rem; font-weight: 700; margin-bottom: .3rem; }
.import-fields ol { margin: 0 0 .4rem; padding-left: 1.3rem; font-size: 0.8rem; line-height: 1.8; color: #475569; }
.hint-box {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
  padding: .55rem .7rem; font-size: 0.8rem; line-height: 1.7; color: #475569; margin-bottom: .8rem;
}
.hint-box code { background: #e2e8f0; padding: 0 .25rem; border-radius: 3px; }

/* ---------------- 系统设置中心 ---------------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .9rem; margin-bottom: 1.1rem; }
.settings-card {
  display: flex; flex-direction: column; gap: .25rem;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem; text-decoration: none; color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.settings-card:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(13, 148, 136, .12); transform: translateY(-1px); }
.settings-icon {
  width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  background: #e6fffb; color: var(--accent); margin-bottom: .2rem;
}
.settings-title { font-weight: 700; font-size: 0.93rem; }
.settings-desc { font-size: 0.8rem; color: var(--muted); line-height: 1.55; }
.settings-meta { font-size: 0.73rem; color: #94a3b8; margin-top: auto; padding-top: .4rem; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .7rem; }
.theme-card {
  display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem;
  border: 1px solid var(--border); border-radius: 9px; cursor: pointer; background: #fff;
}
.theme-card.is-active, .theme-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(13, 148, 136, .15); }
.theme-card input { margin: 0; accent-color: var(--accent); }
.theme-swatch { display: flex; gap: 2px; flex-shrink: 0; }
.theme-swatch i { width: 14px; height: 22px; border-radius: 3px; display: block; }
.theme-swatch i:nth-child(1) { background: var(--sw1); }
.theme-swatch i:nth-child(2) { background: var(--sw2); }
.theme-swatch i:nth-child(3) { background: #e2e8f0; }
.theme-name { font-size: 0.8rem; }

.tabs { display: flex; gap: .25rem; margin-bottom: .8rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.tab {
  padding: .4rem .8rem; font-size: 0.8rem; text-decoration: none; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.tab:hover { color: var(--accent); }

/* 权限矩阵 */
.table-scroll { overflow-x: auto; }
.table-matrix th, .table-matrix td { text-align: center; padding: .45rem .4rem; }
.matrix-head, .matrix-label { text-align: left !important; min-width: 190px; white-space: nowrap; }
.matrix-col { min-width: 96px; }
.matrix-role { display: block; font-size: 0.8rem; }
.matrix-col small { display: block; color: var(--muted); font-weight: 400; font-size: 0.68rem; line-height: 1.35; white-space: normal; margin-top: .15rem; }
.matrix-group td { background: #f1f5f9; font-weight: 700; font-size: 0.8rem; text-align: left !important; color: #334155; }
.matrix-label code { font-size: 0.68rem; }
.matrix-check { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.matrix-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.sticky-actions {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: flex-end; gap: .7rem;
  background: rgba(255, 255, 255, .96); border: 1px solid var(--border); border-radius: 10px;
  padding: .6rem .9rem; margin-top: .8rem; box-shadow: 0 -2px 12px rgba(15, 28, 40, .06);
}
.sticky-actions > span { margin-right: auto; color: var(--muted); font-size: 0.8rem; }
.form-actions-sticky { position: sticky; bottom: 0; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--border); }
.code-area { font-family: Consolas, Menlo, monospace; font-size: 0.8rem; line-height: 1.6; }
.form-grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.check-inline { display: inline-flex; align-items: center; gap: .35rem; font-weight: 400; font-size: 0.8rem; margin-right: .8rem; }
.check-inline input { accent-color: var(--accent); }
.input-suffix { display: flex; align-items: center; gap: .35rem; }
.input-suffix-text { font-size: 0.73rem; color: var(--muted); white-space: nowrap; }

/* ---------------- 全局搜索 ---------------- */
.search-group { margin-bottom: 1rem; }
.search-group-head { display: flex; align-items: center; gap: .4rem; font-size: 0.8rem; font-weight: 700; color: #334155; margin-bottom: .4rem; }
.search-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .5rem; }
.search-item {
  display: flex; flex-direction: column; gap: .15rem; padding: .55rem .7rem;
  border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: inherit;
}
.search-item:hover { border-color: var(--accent); background: #f8fafc; }
.search-item-title { font-size: 0.87rem; font-weight: 600; }
.search-item-sub { font-size: 0.73rem; color: var(--muted); }

/* ---------------- 数据大屏 ---------------- */
.screen-body { background: #0b1220; color: #e2e8f0; min-height: 100vh; margin: 0; font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
.screen-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.6rem; border-bottom: 1px solid rgba(148, 163, 184, .18); }
.screen-head h1 { margin: 0; font-size: 1.5rem; letter-spacing: .08em; background: linear-gradient(90deg, #2dd4bf, #60a5fa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.screen-head .screen-time { font-size: 0.87rem; color: #94a3b8; }
.screen-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .9rem; padding: 1.1rem 1.6rem; }
.screen-kpi {
  grid-column: span 2; background: linear-gradient(160deg, rgba(13, 148, 136, .18), rgba(15, 23, 42, .6));
  border: 1px solid rgba(45, 212, 191, .22); border-radius: 12px; padding: 1rem 1.1rem;
  text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: .2rem;
}
.screen-kpi:hover { border-color: #2dd4bf; }
.screen-kpi .k-label { font-size: 0.8rem; color: #94a3b8; }
.screen-kpi .k-value { font-size: 2rem; font-weight: 800; color: #2dd4bf; letter-spacing: .02em; }
.screen-kpi .k-hint { font-size: 0.73rem; color: #64748b; }
.screen-panel { grid-column: span 3; background: rgba(15, 23, 42, .72); border: 1px solid rgba(148, 163, 184, .16); border-radius: 12px; padding: .9rem 1rem; }
.screen-panel.is-2 { grid-column: span 2; }
.screen-panel h3 { margin: 0 0 .6rem; font-size: 0.93rem; color: #cbd5e1; font-weight: 600; }
.screen-panel .bar-track { background: rgba(148, 163, 184, .18); }
.screen-panel .bar-label, .screen-panel .bar-value { color: #cbd5e1; }
.screen-panel .donut-hole { background: #0f172a; color: #e2e8f0; }
.screen-panel .donut-legend-label { color: #94a3b8; }
.screen-ticker { padding: 0 1.6rem 1rem; }
.screen-ticker-inner { display: flex; gap: .8rem; overflow: hidden; }
.screen-ticker-item { display: flex; gap: .4rem; align-items: center; font-size: 0.8rem; color: #cbd5e1; background: rgba(30, 41, 59, .7); border: 1px solid rgba(148, 163, 184, .16); border-radius: 8px; padding: .4rem .7rem; flex-shrink: 0; }
.screen-foot { text-align: center; color: #475569; font-size: 0.73rem; padding: 1rem; }
@media (max-width: 1200px) {
  .screen-grid { grid-template-columns: repeat(4, 1fr); }
  .screen-kpi { grid-column: span 2; }
  .screen-panel { grid-column: span 4; }
}

/* ---------------- 移动端 ---------------- */
.m-body { background: #eef2f7; margin: 0; font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); }
.m-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .6rem;
  background: var(--sidebar); color: #fff; padding: .7rem .9rem;
}
.m-head-back {
  width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  color: #cbd5e1; text-decoration: none; background: rgba(255, 255, 255, .08);
}
.m-head-title { flex: 1; display: flex; flex-direction: column; }
.m-head-title strong { font-size: 0.93rem; }
.m-head-title small { color: #94a3b8; font-size: 0.73rem; }
.m-wrap { padding: .9rem; max-width: 560px; margin: 0 auto; }
.m-stats { display: flex; gap: .6rem; margin-bottom: .9rem; }
.m-stat {
  flex: 1; background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: .7rem .8rem; display: flex; flex-direction: column; gap: .15rem;
}
.m-stat span { font-size: 0.73rem; color: var(--muted); }
.m-stat strong { font-size: 1.35rem; }
.m-stat.is-warn strong { color: #b45309; }
.m-actions { display: flex; flex-direction: column; gap: .6rem; }
.m-action {
  display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: .6rem;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: .8rem .9rem; text-decoration: none; color: inherit;
}
.m-action:active { transform: scale(.99); }
.m-action span { font-size: 0.93rem; font-weight: 600; }
.m-action small { grid-column: 2; font-size: 0.73rem; color: var(--muted); margin-top: -1.4rem; }
.m-action .ico { width: 22px; height: 22px; color: var(--accent); justify-self: center; }
.m-action-primary { border-color: var(--accent); background: #f0fdfa; }
.m-form { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: .9rem; }
.m-field { margin-bottom: .8rem; }
.m-field label { display: block; font-size: 0.8rem; color: #475569; margin-bottom: .25rem; font-weight: 600; }
.m-field label em { color: #dc2626; font-style: normal; }
.m-field .form-control { width: 100%; padding: .5rem .6rem; font-size: 0.93rem; }
.m-field .region-row { display: flex; gap: .4rem; }
.m-submit { width: 100%; padding: .7rem; font-size: 1rem; margin-top: .3rem; }
.m-foot { text-align: center; color: var(--muted); font-size: 0.73rem; margin-top: 1rem; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1100px) {
  .panel-split { grid-template-columns: 1fr; }
  .board-grid { grid-template-columns: 1fr; }
  .tb-search { max-width: 220px; }
}
@media (max-width: 900px) {
  .tb-btn-text { display: none; }
  .tb-quick { display: none; }
  .tb-only-mobile { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 80;
    transform: translateX(-100%); transition: transform .2s ease; width: 250px !important;
  }
  .sidebar.is-open { transform: none; box-shadow: 8px 0 28px rgba(15, 28, 40, .3); }
  .layout.is-sidebar-collapsed .sidebar { width: 250px !important; }
  .layout.is-sidebar-collapsed .sidebar .brand-text,
  .layout.is-sidebar-collapsed .sidebar .nav-group,
  .layout.is-sidebar-collapsed .sidebar .nav-label,
  .layout.is-sidebar-collapsed .sidebar .user-meta,
  .layout.is-sidebar-collapsed .sidebar .user-links,
  .layout.is-sidebar-collapsed .sidebar .name { display: block; }
  .layout.is-sidebar-collapsed .sidebar .nav-ico { width: 18px; height: 18px; }
  .layout.is-sidebar-collapsed .sidebar nav a { justify-content: flex-start; padding: .55rem 1.25rem; font-size: 0.93rem; }
  .layout.is-sidebar-collapsed .sidebar .brand { justify-content: flex-start; padding: 1.1rem 1rem 1rem; }
  .tb-dropdown { position: static; }
  .tb-panel { position: fixed; left: 8px; right: 8px; width: auto; top: 62px; }
  .help-drawer { width: 100%; }
  .pager { flex-direction: column; align-items: flex-start; }
}
@media print {
  .sidebar, .topbar, .page-header-right, .help-drawer, .bulk-form, .pager, .sys-footer { display: none !important; }
  .content { padding: 0; }
}

/* 登录角色卡：一键进入的反馈状态 */
.login-role-card.is-loading { opacity: .65; pointer-events: none; }
.login-role-card.is-loading::after { content: ' 进入中…'; color: #2dd4bf; font-size: 0.73rem; }


/* 顶栏「只显示图标」偏好：悬停仍有 title 提示 */
.is-topbar-icons .tb-quick .tb-btn-text,
.is-topbar-icons .tb-right > .tb-btn > .tb-btn-text { display: none; }


/* ===== 角色工作台快捷条（主屏第一屏：常用动作 + 消息/待办概览） ===== */
.wb-quickbar {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
  justify-content: space-between;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0); border-radius: 10px;
}
.wb-quickbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.wb-quick-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px; text-decoration: none;
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0);
  color: var(--text, #0f172a); font-size: 0.87rem; line-height: 1.2; white-space: nowrap;
}
.wb-quick-btn:hover { border-color: var(--brand, #0d9488); color: var(--brand, #0d9488); }
.wb-quickbar-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.wb-stat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; text-decoration: none; font-size: 0.8rem;
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0); color: var(--text-muted, #475569);
}
.wb-stat-chip b { color: var(--text, #0f172a); font-size: 0.93rem; }
.wb-stat-chip.is-warn { border-color: #f59e0b; color: #b45309; background: #fffbeb; }
.wb-stat-chip.is-warn b { color: #b45309; }
@media (max-width: 720px) {
  .wb-quickbar { flex-direction: column; align-items: stretch; }
}

/* 顶栏下拉「底部更多入口」 */
.tb-panel-foot {
  display: flex; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; border-top: 1px solid var(--border, #e2e8f0);
}
.tb-panel-foot a { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; text-decoration: none; color: var(--brand, #0d9488); }

/* ===== 交付期（距交货期）分级徽标：逾期/紧急=红，偏紧/暂停=橙，正常/已交付=绿，未排期=灰 ===== */
.dlv {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 0.73rem; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.dlv-ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.dlv-warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.dlv-danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.dlv-muted { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.dlv-danger { animation: dlvPulse 2.4s ease-in-out infinite; }
@keyframes dlvPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0); } 50% { box-shadow: 0 0 0 3px rgba(185, 28, 28, .08); } }
@media print { .dlv { animation: none; } }

/* 交付期/逆向流程行内小表单 */
.inline-form { display: inline-block; margin: 0; }

/* 逆向流程：单据作废/终止后的置灰观感 */
.is-void-row > td { opacity: .62; }
.reversal-kind { font-weight: 600; }


/* ===== 详情页「逆向处理」下拉菜单（原生 details，无 JS 依赖） ===== */
.rev-menu { position: relative; display: inline-block; }
.rev-menu > summary { list-style: none; cursor: pointer; user-select: none; }
.rev-menu > summary::-webkit-details-marker { display: none; }
.rev-menu[open] > summary { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.rev-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
  width: 320px; padding: 12px; display: grid; gap: 8px; text-align: left;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
}
.rev-pop-title { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.87rem; color: #334155; }
.rev-pop textarea { resize: vertical; }
.rev-pop-hint { font-size: 0.73rem; color: #64748b; line-height: 1.5; }
.rev-pop-actions { display: flex; justify-content: flex-end; }
@media (max-width: 720px) { .rev-pop { width: min(84vw, 320px); } }

/* 大屏 KPI：超期风险用红色数字，与「正常」区分 */
.screen-kpi.is-warn { border-color: #f87171; }
.screen-kpi.is-warn .k-value { color: #f87171; }
