/* 后台 SaaS · 深色开发者主题（IDE / GitHub-Dark 风格） */
:root {
  --bg: #0d1117; --bg2: #010409; --panel: #161b22; --panel2: #21262d;
  --border: #30363d; --text: #c9d1d9; --muted: #8b949e;
  --accent: #58a6ff; --accent2: #388bfd;
  --ok: #3fb950; --warn: #d29922; --bad: #f85149; --purple: #bc8cff;
  --mono: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Consolas, 'Microsoft YaHei', monospace;
  --sans: 'Segoe UI', 'Microsoft YaHei', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--accent); }

/* 布局 */
#app { display: grid; grid-template-columns: 232px 1fr; grid-template-rows: 100%; height: 100vh; overflow: hidden; }
#app.collapsed { grid-template-columns: 64px 1fr; }
#app.collapsed .brand { justify-content: center; gap: 6px; padding: 2px 0 6px; }
#app.collapsed .brand > .brand-text { display: none; }
#app.collapsed .navitem { justify-content: center; padding: 10px 0; font-size: 0; gap: 0; }
#app.collapsed .navitem .dot { display: none; }
#app.collapsed .navitem .nav-text { display: none; }
#app.collapsed .navitem .nav-short { display: block; font-size: 12px; line-height: 1; }
#app.collapsed .nav-sep { margin: 8px 8px; }
.side-toggle-bottom { width: 100%; height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); cursor: pointer; font-size: 12.5px; transition: color .16s, border-color .16s, background .16s; }
.side-toggle-bottom svg { width: 15px; height: 15px; display: block; transition: transform .18s ease; }
.side-toggle-bottom:hover { color: #fff; border-color: var(--accent); background: var(--panel2); }
.side-toggle-bottom:active { transform: scale(.98); }
#app.collapsed .side-toggle-bottom { width: 34px; height: 34px; margin: 0 auto; padding: 0; }
#app.collapsed .side-toggle-text { display: none; }
#app.collapsed .side-toggle-bottom svg { transform: rotate(180deg); }
#app.collapsed .side-foot-text { display: none; }
.nav-short { display: none; }

/* 侧边栏 */
#sidebar { background: var(--bg2); border-right: 1px solid var(--border); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.side-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 2px 4px 6px; }
.brand .logo { width: 34px; height: 34px; border-radius: 8px; flex: 0 0 34px; background: linear-gradient(135deg, var(--accent2), var(--purple)); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-weight: 800; font-size: 14px; letter-spacing: .5px; box-shadow: 0 0 0 1px rgba(88,166,255,.25), 0 2px 10px rgba(0,0,0,.45); cursor: pointer; }
.brand-text { cursor: pointer; min-width: 0; }
.brand .name { font-weight: 700; color: #fff; font-size: 15px; letter-spacing: .5px; }
.brand .sub { font-size: 8.5px; color: var(--muted); letter-spacing: 1.2px; font-family: var(--mono); }
.navitem { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 4px 0; border-radius: 8px; color: var(--muted); cursor: pointer; font-size: 13.5px; border: 1px solid transparent; user-select: none; transition: background .12s, color .12s, border-color .12s; }
.navitem:hover { background: var(--panel); color: var(--text); }
.navitem.active { background: var(--accent2); color: #fff; font-weight: 600; }
.navitem .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.navitem.active .dot { background: #fff; }
.navitem.hidden { display: none; }
.side-foot { flex: 0 0 auto; margin-top: 10px; }
.side-foot-text { font-size: 9px; color: var(--muted); font-family: var(--mono); text-align: center; margin-top: 8px; }

/* 主区域 */
#main { display: flex; flex-direction: column; min-width: 0; height: 100%; min-height: 0; }
#topbar { height: 56px; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 20px; gap: 14px; background: var(--bg); position: sticky; top: 0; z-index: 5; }
#topbar h1 { font-size: 16px; margin: 0; font-weight: 700; }
.top-spacer { flex: 1; }
#topbarActions { display: flex; align-items: center; gap: 8px; }
button.btn-export { height: 32px; padding: 0 14px; border-radius: 8px; font-size: 13px; }
.search-box, input.search-box { height: 34px; width: 260px; flex: 0 0 260px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg2); color: var(--text); font-size: 13px; box-sizing: border-box; }
.filterbar input.search-box { flex: 0 0 260px; width: 260px; }
.search-box:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(88,166,255,.14); }
.search-btn { height: 34px; padding: 0 14px; border-radius: 8px; font-size: 13px; }
.filter-select { height: 34px; min-width: 140px; width: auto; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg2); color: var(--text); font-size: 13px; box-sizing: border-box; }
.sm-select { height: 30px; min-width: 120px; padding: 5px 8px; font-size: 12px; border-radius: 7px; }
.role-switch { display: flex; gap: 6px; align-items: center; }
.role-pill { padding: 5px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); cursor: pointer; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; user-select: none; transition: all .12s; }
.role-pill:hover { color: var(--text); border-color: var(--accent); }
.role-pill.active { background: var(--accent2); color: #fff; border-color: var(--accent2); font-weight: 600; }
.role-pill.locked { border-style: dashed; }
.role-pill .lk { opacity: .75; display: inline-flex; }
.role-pill.active .lk { opacity: 1; }

.avatar-wrap { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--mono); font-size: 12px; cursor: pointer; user-select: none; border: 1px solid var(--border); }
.avatar:hover { border-color: var(--accent); }
.avatar-menu { display: none; position: absolute; right: 0; top: 40px; min-width: 208px; z-index: 30; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.55); }
.avatar-menu.show { display: block; }
.avatar-menu .am-head { font-size: 11.5px; color: var(--muted); padding: 8px 10px; font-family: var(--mono); }
.avatar-menu .am-item { padding: 9px 10px; border-radius: 7px; font-size: 13px; cursor: pointer; }
.avatar-menu .am-item:hover { background: var(--panel2); color: var(--accent); }

/* 连接错误横幅 */
.banner { display: flex; align-items: center; gap: 14px; padding: 9px 18px; background: linear-gradient(90deg, rgba(248,81,73,.16), rgba(248,81,73,.06)); border-bottom: 1px solid var(--bad); color: #ffb4ae; font-size: 13px; }
.banner.hidden { display: none; }
.banner .banner-msg { flex: 1; }
.banner-retry { background: var(--bad); color: #fff; border: 0; border-radius: 7px; padding: 6px 14px; font-weight: 600; cursor: pointer; }

#view { padding: 22px 26px; overflow-x: hidden; overflow-y: auto; flex: 1; container-type: inline-size; scrollbar-width: none; -ms-overflow-style: none; }
#view::-webkit-scrollbar { display: none; }

/* 卡片 / KPI 通用 */
.grid { display: grid; gap: 16px; }
.card { background: rgba(22,27,34,.7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 12px 14px; min-width: 0; box-shadow: 0 4px 24px rgba(0,0,0,.25); }
.card h3 { margin: 0 0 12px; font-size: 14px; }
/* 看板卡片可点击 / 悬浮高亮（第二批） */
.card.clickable { cursor: pointer; transition: border-color .12s, transform .12s, box-shadow .12s; }
.card.clickable:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.28); }
.risk-cell { cursor: pointer; transition: border-color .12s, transform .12s, box-shadow .12s; }
.risk-cell:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.alert.clickable { cursor: pointer; border-radius: 6px; }
.alert.clickable:hover { background: var(--panel2); }
/* 侧边栏分组分隔 */
.nav-sep { height: 1px; background: var(--border); margin: 8px 12px; opacity: .6; }
.warn-tip { color: var(--warn); border-left: 3px solid var(--warn); padding-left: 8px; margin-top: 10px; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .val { font-size: 24px; font-weight: 700; margin-top: 6px; font-family: var(--mono); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.row2 { grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 1.4fr 1fr; }

/* KPI 指标条（模块页顶部） */
.stat-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; overflow: visible; container-type: inline-size; }
.stat-cell { flex: 0 0 auto; width: 120px; width: max(120px, calc((100cqw - 90px) / 10)); height: 69px; box-sizing: border-box; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.stat-cell .sc-label { color: var(--muted); font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-cell .sc-val { font-family: var(--mono); font-size: 20px; line-height: 23px; font-weight: 700; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-mini { font-size: 12px; color: var(--muted); line-height: 1.5; white-space: nowrap; }
.kpi-mini b { color: var(--text); font-family: var(--mono); }

/* 表格滚动容器（窄屏不撑破卡片；滚动条隐藏，保留滚轮/触摸横向滚动） */
.tbl-scroll { width: 100%; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
.tbl-scroll::-webkit-scrollbar { display: none; }
.system-page > .card, .risk-grid, .rp-table-wrap, .sys-log-list { scrollbar-width: none; -ms-overflow-style: none; }
.system-page > .card::-webkit-scrollbar, .risk-grid::-webkit-scrollbar, .rp-table-wrap::-webkit-scrollbar, .sys-log-list::-webkit-scrollbar { display: none; }

/* 筛选条 */
.filterbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filterbar select, .filterbar input { width: auto; min-width: 150px; }
.filterbar select { height: 34px; padding: 7px 10px; border-radius: 8px; }
.filterbar input { flex: 1 1 200px; }
.filter-hint { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
/* 结算单（P0-1）：日期筛选紧凑布局 + 下钻明细 + 周期标签 */
.filterbar label.fl { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.filterbar label.fl input[type="date"] { flex: 0 0 auto; min-width: 130px; width: auto; }
.set-row:hover { background: var(--bg2); }
.period-label { color: var(--muted); font-size: 12.5px; margin: 4px 0 10px; }
.drill-body { padding: 10px 14px; background: var(--bg2); border-radius: 8px; }
.drill-list { margin: 6px 0 0; padding-left: 20px; }
.drill-list li { margin: 3px 0; color: var(--text); font-size: 13px; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pager .pg { min-width: 30px; padding: 6px 10px; border-radius: 7px; background: var(--panel); border: 1px solid var(--border); color: var(--text); cursor: pointer; font-size: 12.5px; }
.pager .pg:hover:not(:disabled) { border-color: var(--accent); }
.pager .pg.on { background: var(--accent2); border-color: var(--accent2); color: #fff; font-weight: 600; }
.pager .pg:disabled { opacity: .4; cursor: not-allowed; }
.pager .pg-dots { color: var(--muted); padding: 0 4px; }
.pager .pg-info { margin-left: auto; color: var(--muted); font-size: 12px; }

/* 迷你进度条（库存水位 / 单品余量） */
.mini-bar { display: inline-block; width: 100%; height: 7px; border-radius: 4px; background: var(--panel2); overflow: hidden; vertical-align: middle; margin-right: 6px; }
.mini-bar i { display: block; height: 100%; min-width: 4px; background: var(--bad); }
.mini-bar i.bad { background: linear-gradient(90deg, var(--bad), #ff7b72); }
.mini-bar i.warn { background: linear-gradient(90deg, var(--warn), #e3b341); }
.mini-bar i.ok { background: linear-gradient(90deg, var(--ok), #3fb950); }

button:disabled, .sm:disabled, .primary:disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(0.25); }

.slot-empty { border-color: var(--bad) !important; background: rgba(255, 80, 80, .08) !important; }

.sig { display: inline-block; width: 4px; margin: 0 2px; border-radius: 2px; background: var(--panel2); vertical-align: bottom; transition: background .2s, box-shadow .2s; }
.sig:nth-child(1) { height: 6px; }
.sig:nth-child(2) { height: 9px; }
.sig:nth-child(3) { height: 12px; }
.sig:nth-child(4) { height: 15px; }
.sig:nth-child(5) { height: 18px; }
.sig.on { background: var(--ok); box-shadow: 0 0 8px rgba(63,185,80,.45); }

/* ===================== 数据看板布局 ===================== */
.section-title { font-size: 18px; margin: 0 0 4px; }
.section-sub { color: var(--muted); margin-bottom: 18px; font-size: 13px; }
.tip { color: var(--muted); font-size: 12px; margin-top: 8px; }
.block-title { font-size: 12px; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }

.dash-filter { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.dash-filter .seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.dash-filter .seg button { border: 0; border-radius: 0; background: var(--panel); color: var(--muted); padding: 7px 14px; font-size: 12.5px; cursor: pointer; }
.dash-filter .seg button.on { background: var(--accent2); color: #fff; font-weight: 600; }
.dash-filter .seg button + button { border-left: 1px solid var(--border); }
.dash-filter select { width: auto; min-width: 180px; padding: 7px 10px; height: 34px; border-radius: 8px; }
.dash-filter .filter-hint { margin-left: auto; color: var(--muted); font-size: 12px; }

/* 看板：宽屏保持 5 行完整布局，窄屏由容器查询自动重排 */
.dash-main { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 3fr) minmax(0, 2.5fr) minmax(0, 2fr); gap: 12px; align-items: stretch; margin-bottom: 0; height: calc(100vh - 174px); overflow: hidden; }
.dash-main .kpi-hero { grid-column: 1 / -1; }
.dash-main .kpi-side { grid-column: 1 / -1; }
.dash-main .dash-trend { grid-column: span 8; }
.dash-main .dash-low { grid-column: span 4; }
.dash-main .dash-health { grid-column: span 4; }
.dash-main .dash-top5 { grid-column: span 4; }
.dash-main .dash-risk { grid-column: span 4; }
.dash-main .dash-replenish { grid-column: span 3; }
.dash-main .dash-heat { grid-column: span 6; }
.dash-main .dash-alerts { grid-column: span 3; }
.dash-main .dash-infra { grid-column: 1 / -1; }

/* 看板容器查询：内容区变窄时自动重排，侧边栏收起/展开也会触发 */
@container (max-width: 1100px) {
  .dash-main { grid-template-columns: 1fr 1fr; grid-template-rows: none; height: auto; overflow: visible; }
  .dash-main .kpi-hero, .dash-main .kpi-side, .dash-main .dash-infra { grid-column: 1 / -1; }
  .dash-main .dash-trend, .dash-main .dash-low,
  .dash-main .dash-health, .dash-main .dash-top5,
  .dash-main .dash-risk, .dash-main .dash-replenish,
  .dash-main .dash-heat, .dash-main .dash-alerts { grid-column: span 1; min-height: 220px; }
  .dash-main .dash-trend { min-height: 300px; }
  .dash-main .dash-health { min-height: 320px; }
  .dash-main .dash-low { min-height: 260px; }
  .dash-main .dash-top5 { min-height: 240px; }
  .dash-main .dash-risk { min-height: 240px; }
  .dash-main .dash-replenish { min-height: 260px; }
  .dash-main .dash-heat { min-height: 260px; }
  .dash-main .dash-alerts { min-height: 240px; }
}
@container (max-width: 760px) {
  .dash-main { grid-template-columns: 1fr; }
  .dash-main .dash-trend, .dash-main .dash-low,
  .dash-main .dash-health, .dash-main .dash-top5,
  .dash-main .dash-risk, .dash-main .dash-replenish,
  .dash-main .dash-heat, .dash-main .dash-alerts { min-height: 220px; }
  .dash-main .dash-trend { min-height: 260px; }
  .dash-main .dash-health { min-height: 300px; }
}
.rp-summary { margin: 2px 0 10px; }
.rp-bar { font-size: 12.5px; color: var(--muted); }
.rp-bar b { color: var(--text); }

/* 主 KPI 英雄卡（4 张） */
.kpi-hero { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi-hero .metric { position: relative; overflow: hidden; background: linear-gradient(180deg, var(--panel) 0%, rgba(22,27,34,.55) 100%); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 8px; transition: border-color .15s, transform .15s; }
.kpi-hero .metric::after { content: ''; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); }
.kpi-hero .metric:hover { border-color: #3d4652; transform: translateY(-1px); }
.kpi-hero .metric.dragging { opacity: .5; border-color: var(--accent); }
.m-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.m-label { color: var(--muted); font-size: 12.5px; }
.m-delta { font-size: 11.5px; font-weight: 700; font-family: var(--mono); padding: 1px 7px; border-radius: 9px; white-space: nowrap; }
.m-delta.up { color: #56d364; background: rgba(63,185,80,.14); }
.m-delta.down { color: #ff7b72; background: rgba(248,81,73,.14); }
.m-val { font-size: 26px; font-weight: 700; font-family: var(--mono); margin: 8px 0 2px; letter-spacing: .3px; }
.m-unit { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 5px; font-family: var(--sans); }
.m-foot { color: var(--muted); font-size: 11.5px; }
.spark { display: block; }
.m-bar { height: 6px; border-radius: 4px; background: var(--panel2); overflow: hidden; margin-top: 22px; }
.m-bar i { display: block; height: 100%; border-radius: 4px; transition: width .3s; }
.spark-host { width: 100%; height: 38px; margin-top: 8px; }

/* 侧栏 6 项紧凑指标 */
.kpi-side { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; display: flex; flex-direction: column; justify-content: space-between; height: 100%; }
.stat .ss-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.stat .ss-label { color: var(--muted); font-size: 11.5px; }
.stat .ss-val { font-size: 20px; font-weight: 700; font-family: var(--mono); margin-top: 4px; }
.stat .ss-unit { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 3px; font-family: var(--sans); }
.stat .ss-note { display: block; font-size: 10px; color: var(--muted); margin-top: 4px; }
.stat .m-bar { margin-top: 8px; }

/* 图表卡通用 */
.dash-trend, .dash-top5, .dash-health, .dash-low, .dash-risk, .dash-heat, .dash-alerts, .dash-infra { display: flex; flex-direction: column; min-width: 0; }
.dash-trend h3, .dash-top5 h3, .dash-health h3, .dash-low h3, .dash-risk h3, .dash-heat h3, .dash-alerts h3, .dash-infra h3 { flex: 0 0 auto; }
.chart-wrap { position: relative; flex: 1 1 auto; min-height: 200px; overflow: hidden; }
.chart { display: block; max-width: 100%; }
.tabs { float: right; font-size: 11.5px; font-weight: 400; }
.tabs span { display: inline-block; padding: 2px 9px; margin-left: 4px; border-radius: 11px; border: 1px solid var(--border); color: var(--muted); cursor: pointer; user-select: none; }
.tabs span.on { background: var(--accent2); color: #fff; border-color: var(--accent2); }
/* 财务对账：结算单 tab 独立成条，保持 h2 标题纯净 */
.rec-tabbar { margin: 6px 0 16px; }
.rec-tabbar .tabs { float: none; }

/* 低库存 / 缺货预警 */
.ls-list { display: flex; flex-direction: column; gap: 8px; max-height: 232px; overflow-y: auto; }
.ls-row { background: var(--panel2); border: 1px solid var(--border); border-left: 3px solid var(--muted); border-radius: 8px; padding: 8px 10px; }
.ls-row.ls-bad { border-left-color: var(--bad); }
.ls-row.ls-warn { border-left-color: var(--warn); }
.ls-row.ls-ok { border-left-color: var(--ok); }
.ls-head { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.ls-sn { font-size: 12px; color: var(--text); font-weight: 600; }
.ls-loc { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-sku { font-size: 12px; color: var(--text); margin: 4px 0; }
.ls-bar { height: 5px; border-radius: 3px; background: var(--bg2); overflow: hidden; }
.ls-bar i { display: block; height: 100%; background: var(--bad); }
.ls-row.ls-warn .ls-bar i { background: var(--warn); }
.ls-row.ls-ok .ls-bar i { background: var(--ok); }
.ls-foot { font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.ls-foot-note { font-size: 11px; color: var(--muted); margin-top: 10px; }

/* 时段热力 + 告警 */
.heat-wrap { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; width: 100%; min-width: 0; overflow: visible; }
.heat-grid { flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); grid-template-rows: repeat(7, 1fr); gap: 2px; width: 100%; min-width: 0; overflow: visible; }
.heat-grid .heat-cell { width: 100%; height: 100%; border-radius: 2px; position: relative; border: 1px solid rgba(255,255,255,0.06); }
.heat-lvl-0 { background: rgba(255,255,255,0.05); }
.heat-lvl-1 { background: #0e4429; }
.heat-lvl-2 { background: #006d32; }
.heat-lvl-3 { background: #26a641; }
.heat-lvl-4 { background: #39d353; }

.heat-axis span { font-size: 9px; color: var(--muted); text-align: center; }
.alerts-wrap, .dash-alerts .alerts-wrap { max-height: 100%; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; }
.alerts-wrap::-webkit-scrollbar, .dash-alerts .alerts-wrap::-webkit-scrollbar { display: none; }
.alert { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 12px; }
.alert .adot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; align-self: center; }
.alert.bad .adot { background: var(--bad); }
.alert.warn .adot { background: var(--warn); }
.alert .at { color: var(--muted); font-family: var(--mono); font-size: 10.5px; white-space: nowrap; }
.alert .atx { color: var(--text); }
.alert.done { color: var(--muted); }
.alert.done .adot { background: var(--muted); }
.alert.done .atx { color: var(--muted); }
.alert .done-badge { margin-left: auto; font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 8px; padding: 1px 7px; white-space: nowrap; }
.dismiss-btn { margin-left: auto; font-size: 11px; padding: 2px 8px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--accent); cursor: pointer; white-space: nowrap; }
.dismiss-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 设备健康环形图 */
.dh-wrap { position: relative; flex: 1 1 auto; min-height: 168px; display: flex; align-items: center; justify-content: center; }
.donut { display: block; }
.dh-foot { flex: 0 0 auto; margin-top: 8px; padding-top: 9px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }
.dh-foot b { color: var(--text); font-family: var(--mono); }

/* TOP5 明细 */
.t5-list { flex: 0 0 auto; margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.t5-row { display: flex; align-items: center; gap: 8px; font-size: 11px; padding: 2px 0; }
.t5-rank { flex: 0 0 auto; width: 15px; height: 15px; line-height: 15px; text-align: center; border-radius: 4px; font-size: 10px; font-family: var(--mono); background: var(--panel2); color: var(--muted); }
.t5-rank.r1 { background: rgba(240,166,60,.18); color: #f0a63c; }
.t5-rank.r2 { background: rgba(88,166,255,.16); color: #58a6ff; }
.t5-rank.r3 { background: rgba(63,185,80,.16); color: #56d364; }
.t5-loc { flex: 1 1 auto; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t5-row b { font-family: var(--mono); color: var(--text); }
.t5-share { flex: 0 0 auto; text-align: right; color: var(--muted); font-family: var(--mono); font-size: 10.5px; }

/* 悬浮气泡 */
.chart-tip { position: absolute; z-index: 3; pointer-events: none; white-space: nowrap; background: #1c222b; border: 1px solid #3d4652; border-radius: 8px; padding: 7px 10px; box-shadow: 0 8px 22px rgba(0,0,0,.45); }
.chart-tip .tp-head { color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 5px; }
.chart-tip .tp-head i { width: 6px; height: 6px; border-radius: 50%; background: #f0a63c; flex: 0 0 auto; }
.chart-tip .tp-val { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--text); margin-top: 2px; }
.chart-tip .tp-note { color: var(--muted); font-size: 10.5px; margin-top: 2px; }

/* 趋势图富化 tooltip（方案 B） */
.chart-tip.tp-interactive { width: 300px; max-width: 320px; white-space: normal; padding: 9px 11px; }
.chart-tip .tp-sep { height: 1px; background: var(--border, #2b323c); margin: 6px 0; opacity: .55; }
.chart-tip .tp-row { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 10px; font-size: 12px; line-height: 1.5; }
.chart-tip .tp-ic { width: 16px; text-align: center; flex: 0 0 auto; }
.chart-tip .tp-k { color: var(--muted, #8b949e); white-space: nowrap; }
.chart-tip .tp-v { font-family: var(--mono, monospace); color: var(--text, #e6edf3); text-align: right; white-space: nowrap; }
.chart-tip .tp-d { font-family: var(--mono, monospace); font-size: 11px; white-space: nowrap; }
.chart-tip .tp-d.up { color: #56d364; }
.chart-tip .tp-d.down { color: #f85149; }
.chart-tip .tp-d.no { color: var(--muted, #8b949e); }
.chart-tip .tp-sub { color: var(--accent, #58a6ff); font-size: 11.5px; margin: 2px 0; }
.chart-tip .tp-rank { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; font-size: 12px; line-height: 1.5; }
.chart-tip .tp-rank .tp-loc { color: var(--text, #e6edf3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-tip .tp-loading { color: var(--muted, #8b949e); font-size: 11.5px; padding: 2px 0; }
.chart-tip .tp-foot { margin-top: 4px; }
.chart-tip .tp-foot a { color: var(--accent, #58a6ff); font-size: 11.5px; text-decoration: none; pointer-events: auto; }
.chart-tip .tp-foot a:hover { text-decoration: underline; }

/* 接口与系统（开发视角） */
.iface { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; }
.iface .in { flex: 1 1 auto; }
.iface .ist { font-size: 11px; padding: 1px 8px; border-radius: 9px; background: rgba(63,185,80,.16); color: #56d364; }
.iface.warn .ist { background: rgba(210,153,34,.18); color: #e3b341; }
.iface .ip { color: var(--muted); font-family: var(--mono); font-size: 11px; white-space: nowrap; }

/* ===================== 通用表格 ===================== */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--panel2); }
tr:hover td { background: var(--panel2); }
.mono-cell { font-family: var(--mono); }
/* 全局行号列：表格最左、不参与排序、分页时连续递增 */
th.col-rownum, td.rownum { width: 1%; min-width: 38px; max-width: 56px; white-space: nowrap; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; user-select: none; }
th.col-rownum { font-weight: 600; }
td.rownum { font-size: 12px; }

/* 徽章 */
.badge { display: inline-block; padding: 2px 10px; border-radius: 11px; font-size: 11px; font-weight: 700; color: #fff; }
.b-ok { background: var(--ok); } .b-warn { background: var(--warn); color: #1a1205; }
.b-bad { background: var(--bad); } .b-acc { background: var(--accent2); } .b-pur { background: var(--purple); color: #1a0b2e; }
.b-mut { background: var(--panel2); color: var(--muted); border: 1px solid var(--border); }

/* 会员管理：分层色标（新客蓝 / 活跃绿 / 沉睡黄 / 流失灰）+ 标签 chip */
.seg { display: inline-block; padding: 2px 10px; border-radius: 11px; font-size: 11px; font-weight: 700; }
.seg-new { background: rgba(88,166,255,.16); color: #58a6ff; }
.seg-active { background: rgba(63,185,80,.16); color: #56d364; }
.seg-sleeping { background: rgba(210,153,34,.18); color: #e3b341; }
.seg-lost { background: rgba(139,148,158,.18); color: #8b949e; }
.tag-chip { display: inline-block; padding: 1px 8px; margin: 1px 3px 1px 0; border-radius: 9px; font-size: 11px; background: var(--panel2); color: var(--text); border: 1px solid var(--border); }
.tag-more { display: inline-block; padding: 1px 7px; margin-left: 2px; border-radius: 9px; font-size: 11px; background: transparent; color: var(--muted); border: 1px dashed var(--border); }
.tags-cell { white-space: nowrap; }
.acts { white-space: nowrap; }

/* 按钮 */
button, .btn { font-family: var(--sans); cursor: pointer; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 8px 14px; font-size: 13px; transition: border-color .12s, background .12s; }
button:hover { border-color: var(--accent); }
button.sm { padding: 5px 10px; font-size: 12px; }
button.ghost { background: transparent; }
button.primary { background: var(--accent2); color: #fff; border-color: var(--accent2); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.ok { background: var(--ok); color: #04130a; border-color: var(--ok); font-weight: 600; }
button.danger, button.primary.danger { background: var(--bad); color: #fff; border-color: var(--bad); font-weight: 600; }
button.danger:hover, button.primary.danger:hover { filter: brightness(1.08); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.row-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.tbl-scroll thead th { position: sticky; top: 0; z-index: 2; }
.text-num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.toast { position: fixed; right: 24px; bottom: 24px; padding: 12px 18px; border-radius: 10px; background: rgba(18,22,30,.96); color: #fff; font-size: 13px; z-index: 99999; box-shadow: 0 10px 28px rgba(0,0,0,.4); border: 1px solid rgba(63,185,80,.55); transition: opacity .3s; max-width: 420px; }
.toast.error { border-color: rgba(248,81,73,.55); }
.toast.info { border-color: rgba(88,166,255,.55); }
.empty { color: var(--muted); padding: 34px 20px; text-align: center; font-size: 13px; }
.empty .empty-title { display: block; font-size: 14px; color: var(--text); margin-bottom: 6px; font-weight: 600; }
.switch { width: 52px; height: 28px; border-radius: 14px; background: var(--ok); position: relative; cursor: pointer; }
.switch .knob { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; }
.switch.off { background: var(--panel2); } .switch.off .knob { left: 3px; right: auto; }

/* 表单 */
input:not([type="checkbox"]):not([type="radio"]), select { background: var(--bg2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px 11px; font-size: 13px; font-family: var(--sans); width: 100%; height: 34px; box-sizing: border-box; }
select { font-family: var(--mono); }
.field { margin-bottom: 14px; }
.field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.sub-h { font-size: 13px; font-weight: 600; margin: 16px 0 10px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--text); }
.tier-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.tier-row > span { color: var(--muted); }
.tier-row .tDel { margin-left: auto; }

/* 事件日志 */
.logline { font-family: var(--mono); font-size: 12px; padding: 7px 0; border-bottom: 1px dashed var(--border); display: flex; gap: 12px; }
.logline .t { color: var(--muted); white-space: nowrap; }

/* 演示面板 */
.demo-grid { grid-template-columns: 440px 1fr; align-items: start; }
.demo-out { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 16px; min-height: 260px; }

/* 模态（设备 / 订单详情） */
.modal-mask { display: none; position: fixed; inset: 0; z-index: 60; background: rgba(1,4,9,.72); align-items: center; justify-content: center; }
.modal-mask.show { display: flex; }
.modal { width: 380px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 22px 22px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.6); max-height: 90vh; overflow-y: visible; }
.modal-body { max-height: calc(90vh - 120px); overflow-y: auto; overflow-x: hidden; }
.modal.md-scroll-hidden .modal-body { scrollbar-width: none; -ms-overflow-style: none; }
.modal.md-scroll-hidden .modal-body::-webkit-scrollbar { display: none; }
.modal-lg { width: min(960px, 90vw); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-x { background: transparent; border: 0; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.modal-x:hover { color: var(--text); }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-bottom: 6px; }
.kv > div { display: flex; gap: 8px; align-items: baseline; }
.kv .k { color: var(--muted); font-size: 12px; min-width: 48px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 20px; margin: 8px 0 14px; }
.loc-map { margin: 8px 0 14px; }
.loc-map img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); min-height: 120px; }
.loc-bind { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
/* 开门柜「层架陈列」：柜内商品按层平铺（开门柜没有货道概念） */
.shelf-list { display: flex; flex-direction: column; gap: 10px; }
.shelf { background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.shelf-no { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.shelf-no .muted { font-size: 11px; }
.shelf-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.sitem { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--ok); border-radius: 8px; padding: 7px 9px; }
.sitem.bad { border-left-color: var(--bad); }
.sitem.warn { border-left-color: var(--warn); }
.sitem-name { font-size: 12.5px; font-weight: 600; }
.sitem-sub { font-size: 10.5px; color: var(--muted); margin: 2px 0 5px; }
.sitem-foot { font-size: 11px; color: var(--muted); margin-top: 4px; }
.sitem-foot b { color: var(--text); }

/* 身份密码弹窗（复用 .modal-mask） */
.modal-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }
.modal input { margin-bottom: 8px; }
.pwd-err { color: var(--bad); font-size: 12px; min-height: 16px; margin-bottom: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.sm-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.sm-seg button { border: 0; background: var(--panel); color: var(--muted); padding: 7px 12px; font-size: 12.5px; cursor: pointer; }
.sm-seg button.on { background: var(--accent2); color: #fff; font-weight: 600; }
.sm-seg button + button { border-left: 1px solid var(--border); }

/* ===================== 响应式 ===================== */
@container (max-width: 780px) {
  .demo-grid, .kv, .md-blocks { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  #view { padding: 16px; }
}

/* ===================== 商品管理 / 设备详情 / 系统权限 新增样式 ===================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .field { margin-bottom: 0; }
.req { color: var(--bad); }
.chk { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-top: 6px; cursor: pointer; }
.chk input { width: auto; }

/* 设备详情：可编辑信息 */
.dv-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
.dv-edit-grid .field { margin-bottom: 12px; }
.dv-edit-grid .kv { margin-bottom: 8px; }

/* 层架陈列网格（层 × 列） */
.shelf-grid { display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr); gap: 8px; margin: 8px 0; }
.cell { background: var(--panel2); border: 1px solid var(--border); border-left: 3px solid var(--ok); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 64px; }
.cell.warn { border-left-color: var(--warn); }
.cell.bad { border-left-color: var(--bad); }
.cell .cell-sku { width: 100%; font-size: 11px; padding: 4px 6px; }
.cell .cell-name { font-size: 12.5px; font-weight: 600; }
.cell .cell-stock { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.cell .cell-stock b { color: var(--text); }
.dv-layout-ctrl { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.dv-layout-ctrl label { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.dv-layout-ctrl input { width: 70px; }
.dv-take { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dv-take select { width: auto; min-width: 150px; }
.dv-result { margin-top: 8px; font-size: 13px; min-height: 18px; }

/* 会员详情 6 区块 */
.md-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.md-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.md-uid { color: var(--muted); font-weight: 400; }
.md-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.md-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.md-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; padding: 10px 12px; background: rgba(88,166,255,.06); border: 1px solid rgba(88,166,255,.22); border-radius: 10px; }
.md-sum-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.md-sum-item .k { color: var(--muted); font-size: 11px; }
.md-sum-item .v { color: var(--text); font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-block { background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.md-block.md-wide { grid-column: 1 / -1; }
.md-block h4 { margin: 0 0 8px; font-size: 13px; color: var(--accent); border-left: 3px solid var(--accent); padding-left: 8px; }
.md-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag-x { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 0 0 2px; }
.tag-x:hover { color: var(--bad); }
.md-tag-add { display: flex; gap: 8px; align-items: center; }
.md-tag-add select { width: auto; min-width: 160px; }
.log-list { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow: auto; font-size: 12px; }
.log-list li { padding: 4px 0; border-bottom: 1px dashed var(--border); display: flex; gap: 8px; align-items: baseline; }
.log-list li:last-child { border-bottom: none; }
.log-list b { color: var(--accent); }
.reason-list { margin: 2px 0 0; padding-left: 18px; list-style: disc; }
.reason-list li { color: var(--bad); font-size: 12.5px; line-height: 1.7; }
.log-note { margin-top: 6px; font-size: 11.5px; color: var(--muted); }

.b-ok-text { color: #56d364; font-weight: 600; }
.b-bad-text { color: var(--bad); font-weight: 600; }
button.ghost.danger { color: var(--bad); background: transparent; border-color: rgba(248, 81, 73, .45); }
.sub-h { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .03em; }
button.ghost.danger:hover { color: var(--bad); background: rgba(248, 81, 73, .1); border-color: var(--bad); }

/* 设备地图分布（按点位聚合） */
.devmap { display: flex; flex-direction: column; gap: 8px; }
.dm-row { display: grid; grid-template-columns: 160px 1fr auto; gap: 12px; align-items: center; }
.dm-name { font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-bar { display: flex; align-items: center; gap: 8px; }
.dm-segb { flex: 1; height: 18px; border-radius: 5px; overflow: hidden; display: flex; background: var(--bg2); }
.dm-seg { display: block; height: 100%; transition: width .25s; }
.dm-seg.ok { background: var(--ok); }
.dm-seg.warn { background: var(--warn); }
.dm-seg.bad { background: var(--bad); }
.dm-total { font-size: 11px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }
.dm-meta { display: flex; gap: 10px; white-space: nowrap; font-size: 11px; }
.dm-low { color: var(--muted); }
.dm-low.on { color: var(--bad); font-weight: 600; }
.dm-rate.ok { color: #56d364; }
.dm-rate.warn { color: var(--warn); }
.dm-rate.bad { color: var(--bad); }
@container (max-width: 680px) {
  .dm-row { grid-template-columns: 110px 1fr; }
  .dm-meta { grid-column: 1 / -1; }
  #view .form-grid, #view .dv-edit-grid { grid-template-columns: 1fr; }
}

/* 系统 / 权限：可编辑矩阵与账号 */
.acct-add { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.acct-add input, .acct-add select, .acct-add #acctAdd { margin: 0; height: 34px; line-height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel2); color: var(--text); box-sizing: border-box; font-size: 13px; vertical-align: middle; }
.acct-add #acctName { width: 140px; }
.acct-add #acctRole { width: 140px; }
.acct-add #acctTag { width: 160px; }
.acct-add #acctAdd { padding: 0 14px; background: var(--accent2); color: #fff; border-color: var(--accent2); font-weight: 600; }
.acct-role { padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel2); color: var(--text); }

/* 看板筛选：当前口径标签（让"点位筛选是否生效"一眼可见） */
.scope-chip { font-size: 12px; color: var(--muted); padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg2); white-space: nowrap; }
.scope-chip b { color: var(--accent); font-family: var(--mono); }

/* 设备：一键全开/全关突出按钮 */
.filterbar #devAllOn, .filterbar #devAllOff { font-weight: 600; padding: 8px 14px; margin-left: 4px; }
.filterbar #devAllOff { background: var(--bad); color: #fff; border-color: var(--bad); }
.filterbar #devAllOff:hover { filter: brightness(1.08); }

.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 6px 0 2px; cursor: pointer; }

/* 演示：未支付弹窗 */
.unpaid-box { text-align: center; padding: 8px 4px 4px; }
.unpaid-box .big-amt { font-size: 40px; font-weight: 700; color: var(--bad); font-family: var(--mono); margin: 6px 0; }
.unpaid-box p { margin: 4px 0; }

/* 设备地图分布（3.1 + 天地图·成都静态截图背景；纯静态、不缩放不拖动） */
.devmap .dm-canvas { position: relative; height: 420px; border-radius: 12px; border: 1px solid var(--border); background-color: #0b0f15; background-image: url('/images/chengdu-map.png'); background-size: cover; background-position: center; background-repeat: no-repeat; overflow: hidden; }
.devmap .dm-canvas.no-bg { background-image: none; background: radial-gradient(circle at 30% 20%, #0f1620, #0b0f15); }
.devmap .dm-placeholder { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--muted); font-size: 13px; letter-spacing: .3px; pointer-events: none; }
.devmap .dm-canvas.no-bg .dm-placeholder { display: flex; }
.devmap .dm-marker { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; border: 2px solid #0d1117; cursor: pointer; padding: 0; transition: transform .1s; }
.devmap .dm-marker:hover { transform: scale(1.35); z-index: 3; }
.devmap .dm-marker.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(63,185,80,.22); }
.devmap .dm-marker.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(210,153,34,.22); }
.devmap .dm-marker.bad { background: var(--bad); box-shadow: 0 0 0 3px rgba(248,81,73,.22); }
.devmap .dm-tip { display: none; position: absolute; z-index: 5; pointer-events: none; background: var(--panel2); border: 1px solid var(--accent); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--text); white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.devmap .dm-legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.devmap .dm-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.devmap .dm-legend .lg::before { content: ''; width: 9px; height: 9px; border-radius: 50%; }
.devmap .dm-legend .lg.ok::before { background: var(--ok); }
.devmap .dm-legend .lg.warn::before { background: var(--warn); }
.devmap .dm-legend .lg.bad::before { background: var(--bad); }
.devmap .dm-unpos { margin-top: 8px; font-size: 12px; color: var(--warn); border-left: 3px solid var(--warn); padding-left: 8px; }

/* 权限精细化：账号角色直接决定可见模块与写权限 */

body { overflow: hidden; }

.dash-top5 { display: flex; flex-direction: column; height: 100%; }
#top5ListWrap { flex: 1; display: flex; flex-direction: column; min-height: 0; height: 100%; }
.t5-micro { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.t5-micro-row { display:flex; align-items:center; gap:8px; background:rgba(255,255,255,.03); border:1px solid rgba(255,255,255,.06); border-radius:8px; padding:6px 8px; flex:1; }
.t5-badge { width:22px; height:22px; border-radius:5px; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; flex-shrink:0; }
.t5-badge.g { background:#ffd700; color:#000; }
.t5-badge.s { background:#c0c0c0; color:#000; }
.t5-badge.b { background:#cd7f32; color:#000; }
.t5-badge.n { background:#21262d; color:#8b949e; }
.t5-name { flex:1; font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.t5-val { font-size:13px; font-weight:600; color:#f0a63c; font-variant-numeric:tabular-nums; }
.t5-unit { font-size:10px; color:#8b949e; margin-left:2px; }

.dash-health { display:flex; flex-direction:column; }
.dh-a { display:flex; gap:12px; flex:1; min-height:0; align-items:stretch; overflow:hidden; }
.dh-ring { flex:0 0 45%; min-width:0; display:flex; align-items:center; justify-content:center; }
.dh-info { flex:1; display:grid; grid-template-columns:repeat(2,1fr); grid-template-rows:repeat(5,1fr); gap:4px; min-width:0; min-height:0; overflow:hidden; }
.dh-cell { background:rgba(255,255,255,.03); border:1px solid rgba(255,255,255,.06); border-radius:6px; padding:4px 8px; display:flex; flex-direction:row; align-items:center; justify-content:space-between; gap:6px; overflow:hidden; }
.dh-l { font-size:11px; color:#8b949e; line-height:1.2; }
.dh-v { font-size:13px; font-weight:600; color:#c9d1d9; font-variant-numeric:tabular-nums; line-height:1.2; }
.dh-v.bad { color:#f85149; }
.dh-v.warn { color:#f0a63c; }
.dh-v.gray { color:#8b949e; }

.dash-low { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 10px 12px; }
.dash-low h3 { flex: 0 0 auto; margin: 0 0 8px; font-size: 14px; }
.ls-g-grid { flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; overflow-y: auto; overflow-x: hidden; align-content: start; scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior: contain; }
.ls-g-grid::-webkit-scrollbar { display: none; width: 0; height: 0; }
.ls-g-cell { border-radius: 8px; padding: 10px 12px; overflow: hidden; display: flex; flex-direction: row; gap: 10px; min-height: 80px; align-items: stretch; }
.ls-g-cell.bad { background: linear-gradient(135deg, rgba(248,81,73,.2), rgba(248,81,73,.04)); }
.ls-g-cell.warn { background: linear-gradient(135deg, rgba(240,166,60,.2), rgba(240,166,60,.04)); }
.ls-g-cell.border-red { border: 2px solid #f85149; }
.ls-g-cell.border-yellow { border: 2px solid #f0a63c; }
.ls-g-cell:not(.border-red):not(.border-yellow) { border: 1px solid var(--border); }
.ls-g-left { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.ls-g-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ls-g-name { flex: 0 1 auto; min-width: 0; font-size: 14px; font-weight: 700; color: #c9d1d9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-g-sku { flex-shrink: 0; font-size: 11px; color: #8b949e; }
.ls-g-loc { font-size: 12px; color: #c9d1d9; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-g-loc span { color: #8b949e; font-weight: 400; }
.ls-g-sales { font-size: 11px; color: #8b949e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-g-sales b { color: #c9d1d9; font-variant-numeric: tabular-nums; }
.ls-g-right { flex: 0 0 84px; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 4px; }
.ls-g-tag { padding: 2px 6px; border-radius: 3px; font-size: 10px; font-weight: 700; }
.ls-g-tag.bad { background: #f85149; color: #fff; }
.ls-g-tag.warn { background: #f0a63c; color: #000; }
.ls-g-remain-big { font-size: 14px; font-weight: 700; color: #c9d1d9; font-variant-numeric: tabular-nums; }
.ls-g-suggest { display: flex; align-items: baseline; gap: 4px; }
.ls-g-lbl { font-size: 10px; color: #8b949e; }
.ls-g-num { font-size: 18px; font-weight: 700; line-height: 1; color: #f0a63c; }
.ls-g-cell.bad .ls-g-num { color: #f85149; }

.risk-a-grid { display:grid; grid-template-columns:1fr 1fr; grid-template-rows:1fr 1fr; gap:8px; flex:1; width:100%; height:100%; align-content:stretch; }
.risk-a-item { border-radius:8px; padding:8px; display:flex; flex-direction:column; gap:3px; }
.risk-a-item .ra-lbl { font-size:10.5px; color:var(--muted); }
.risk-a-item .ra-val { font-size:18px; font-weight:700; }
.risk-a-item .ra-note { font-size:9.5px; color:var(--muted); }
.risk-a-item .ra-trend { font-size:9.5px; color:var(--muted); }
.risk-grid { display:flex; flex:1; min-height:0; overflow-y:auto; width:100%; scrollbar-width:none; -ms-overflow-style:none; }
.risk-grid::-webkit-scrollbar { display:none; width:0; height:0; }

.risk-a-item.risk-red { background:linear-gradient(135deg,rgba(248,81,73,.25),rgba(248,81,73,.05)); border:1px solid rgba(248,81,73,.3); }
.risk-a-item.risk-yellow { background:linear-gradient(135deg,rgba(240,166,60,.25),rgba(240,166,60,.05)); border:1px solid rgba(240,166,60,.3); }
.risk-a-item.risk-blue { background:linear-gradient(135deg,rgba(88,166,255,.25),rgba(88,166,255,.05)); border:1px solid rgba(88,166,255,.3); }
.risk-a-item.risk-green { background:linear-gradient(135deg,rgba(63,185,80,.25),rgba(63,185,80,.05)); border:1px solid rgba(63,185,80,.3); }

.rp-table-wrap { width:100%; height:100%; overflow-y:auto; scrollbar-width:none; -ms-overflow-style:none; }
.rp-table-wrap::-webkit-scrollbar { display:none; width:0; height:0; }
.rp-table { width:100%; border-collapse:collapse; font-size:12px; }
.rp-table th, .rp-table td { padding:6px 8px; border-bottom:1px solid var(--border); text-align:left; }
.rp-table thead { position:sticky; top:0; background:var(--panel); }
.rp-table .bad { color:var(--bad); font-weight:700; }
.rp-table .warn { color:var(--warn); font-weight:700; }
.rp-row { cursor:pointer; }
.rp-row:hover { background:rgba(255,255,255,.03); }

.rp-urgent { display:inline-block; margin-left:6px; padding:1px 5px; border-radius:3px; font-size:9px; font-weight:700; background:#f85149; color:#fff; }

.login-mask { position:fixed; inset:0; z-index:9999; display:flex; align-items:center; justify-content:center; background:rgba(13,17,23,.92); backdrop-filter:blur(8px); }
.login-mask.hidden { display:none; }
.login-card { width:360px; max-width:90vw; padding:32px; border-radius:16px; background:var(--panel, #161b22); border:1px solid var(--border, #30363d); box-shadow:0 20px 60px rgba(0,0,0,.5); text-align:center; }
.login-card .logo { width:56px; height:56px; margin:0 auto 16px; border-radius:14px; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#58a6ff,#3fb950); color:#fff; font-weight:800; font-size:22px; }
.login-card h2 { margin:0 0 20px; font-size:18px; }
.login-card input { width:100%; box-sizing:border-box; padding:10px 12px; margin-bottom:10px; border-radius:8px; border:1px solid var(--border, #30363d); background:rgba(255,255,255,.04); color:inherit; }
.login-card button { width:100%; padding:10px; border-radius:8px; border:none; background:linear-gradient(135deg,#58a6ff,#3fb950); color:#fff; font-weight:700; cursor:pointer; }
.login-card .pwd-err { min-height:18px; color:#f85149; font-size:12px; margin-bottom:8px; text-align:left; }

.clickable-card { cursor: pointer; transition: all 0.2s ease; border: 1px solid var(--border, #30363d); border-radius: 8px; }
.clickable-card:hover { border-color: var(--accent, #58a6ff); box-shadow: 0 0 8px rgba(88,166,255,0.3); transform: translateY(-1px); }

/* 设备管理：网格监控 + 右侧抽屉 */
.dev-grid-wrap { max-height: 420px; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; }
.dev-grid-wrap::-webkit-scrollbar { display: none; }
.dev-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@container (min-width: 900px) { .dev-grid { grid-template-columns: repeat(3, 1fr); } }
@container (min-width: 1200px) { .dev-grid { grid-template-columns: repeat(4, 1fr); } }
@container (min-width: 1600px) { .dev-grid { grid-template-columns: repeat(5, 1fr); } }
@container (max-width: 640px) { .dev-grid { grid-template-columns: 1fr; } }
.archived-reason { display:inline-block; max-width:180px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; background:rgba(248,81,73,.16); color:var(--bad); border:1px solid rgba(248,81,73,.35); border-radius:999px; padding:2px 8px; font-size:11px; vertical-align:middle; }
.dev-card { background: rgba(22,27,34,.72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 14px; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.22); }
.dev-card:hover { transform: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.dev-card.archived { opacity: .7; }
.dev-card-loc { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.dev-card-sn { font-size: 11px; color: var(--muted); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.dev-card-badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.dev-card-mid { display: flex; flex-direction: column; gap: 8px; }
.dev-card-row { display: flex; justify-content: space-between; font-size: 12px; }
.dev-card-rate { font-weight: 700; }
.dev-card-rate.bad { color: var(--bad); }
.dev-card-rate.warn { color: var(--warn); }
.dev-card-rate.ok { color: var(--ok); }
.dev-card-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 12px; }
.dev-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.drawer-mask { position: fixed; inset: 0; background: rgba(1,4,9,.55); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-mask.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; width: min(460px, 92vw); height: 100vh; background: var(--panel); border-left: 1px solid var(--border); z-index: 90; transform: translateX(100%); transition: transform .25s ease; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0,0,0,.4); }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; scrollbar-width: none; -ms-overflow-style: none; }
.drawer-body::-webkit-scrollbar { display: none; }
.drawer-scroll { overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; }
.drawer-scroll::-webkit-scrollbar { display: none; }
.drawer-foot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-wrap: wrap; }
.drawer-heart { width: 100%; height: 90px; margin: 6px 0; }
.drawer-sku { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.drawer-sku-list { display: flex; flex-direction: column; }

.loc-badge { display:inline-block; margin-left:4px; padding:0 4px; font-size:9px; line-height:14px; border-radius:4px; color:var(--muted); border:1px solid var(--border); background:rgba(255,255,255,.04); vertical-align:middle; }

/* layer product cards grid */
.layer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-right: 2px;
}
.layer-grid::-webkit-scrollbar { width: 0; height: 0; display: none; }
.layer-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.layer-card img { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; margin-bottom: 8px; }

/* real number stepper component */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: none;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
  display: none;
}
.num-stepper {
  display: flex;
  align-items: center;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel2);
}
.num-stepper .num-input {
  width: 60px;
  border: none;
  background: transparent;
  text-align: center;
  margin: 0;
  padding: 0;
  height: 100%;
  text-align: center;
  outline: none;
  border: none;
  box-sizing: border-box;
  color: var(--fg);
}
.num-stepper .num-btns {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
}
.num-stepper .num-btns button {
  border: none;
  background: transparent;
  color: var(--accent);
  padding: 2px 8px;
  cursor: pointer;
  line-height: 1;
  font-size: 10px;
}
.num-stepper .num-btns button:hover {
  background: rgba(88,166,255,0.18);
}
.num-stepper .num-btns button:active {
  background: rgba(88,166,255,0.35);
}
/* layer arrow buttons */
.layer-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0 !important;
  box-sizing: border-box;
  cursor: pointer;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  transition: all .18s ease;
}
.layer-arrow svg {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.layer-arrow:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.layer-arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* layer tabs horizontal scroll hidden */
.layer-tabs { scrollbar-width: none; -ms-overflow-style: none; }
.layer-tabs::-webkit-scrollbar { width: 0; height: 0; display: none; }

.qty-tag { display:inline-flex; align-items:center; justify-content:center; min-width:34px; padding:3px 8px; border-radius:999px; background:rgba(88,166,255,.16); color:var(--accent); border:1px solid rgba(88,166,255,.35); font-size:11px; font-weight:700; white-space:nowrap; }

/* ===== device create panel: scheme 1 geek wide modal ===== */
#dynModal .modal.dev-create-panel {
  width: min(980px, 96vw);
  background: rgba(13, 17, 23, .78);
  border: 1px solid rgba(88, 166, 255, .22);
  border-radius: 20px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 0 0 1px rgba(188, 140, 255, .08), 0 0 42px rgba(88, 166, 255, .16), 0 28px 90px rgba(0, 0, 0, .5);
  overflow: hidden;
}
#dynModal .modal.dev-create-panel .modal-head {
  margin-bottom: 0;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(88, 166, 255, .12), rgba(188, 140, 255, .08));
}
#dynModal .modal.dev-create-panel .modal-head h3 {
  font-size: 21px;
  letter-spacing: .5px;
}
#dynModal .modal.dev-create-panel .modal-body {
  padding: 20px 24px 22px;
}
.dev-create-grid {
  display: grid;
  gap: 14px;
}
.dev-create-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, .055);
  padding: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
}
.dev-create-card-title {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 14px;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dev-create-card-title span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  color: #06101f;
  font-weight: 800;
  font-size: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 24px rgba(88, 166, 255, .28);
}
.dev-create-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.dev-create-card .field {
  display: grid;
  gap: 6px;
  margin-bottom: 0;
}
.dev-create-card .field label {
  font-size: 12px;
  color: var(--muted);
}
.dev-create-card .field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(13, 17, 23, .78);
  color: var(--text);
  outline: none;
  transition: .16s ease;
  box-shadow: inset 0 0 18px rgba(88, 166, 255, .08);
}
.dev-create-card .field input:focus {
  border-color: var(--accent);
  box-shadow: inset 0 0 22px rgba(188, 140, 255, .12), 0 0 0 3px rgba(88, 166, 255, .16);
}
.dev-create-card .tip {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
#dynModal .modal.dev-create-panel .modal-actions {
  margin-top: 14px;
}

/* 仓库弹窗 - 方案一：极简毛玻璃悬浮 */
#dynModal .modal.wh-glass {
  background: rgba(15,20,35,.55);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(88,166,255,.22);
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08);
}
#dynModal .modal.wh-glass .modal-head h3 {
  font-size: 18px;
  font-weight: 800;
}
#dynModal .modal.wh-glass .modal-body input,
#dynModal .modal.wh-glass .modal-body select,
#dynModal .modal.wh-glass .modal-body textarea {
  border: none;
  border-bottom: 1px solid rgba(255,255,255,.18);
  border-radius: 0;
  background: transparent;
  padding-left: 0;
  padding-right: 0;
}
#dynModal .modal.wh-glass .modal-body input:focus,
#dynModal .modal.wh-glass .modal-body select:focus,
#dynModal .modal.wh-glass .modal-body textarea:focus {
  outline: none;
  border-bottom-color: var(--accent);
  box-shadow: 0 6px 14px -10px rgba(88,166,255,.9);
}

/* H5 落地页配置 */
.h5-form-grid { display: grid; grid-template-columns: 120px 1fr; gap: 10px 12px; align-items: center; }
.h5-form-grid > label { color: var(--muted); font-size: 12px; }
.h5-input { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel2); color: var(--text); font-size: 13px; }
.h5-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(88,166,255,.15); }
.h5-q-card { background: rgba(33,38,45,.72); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.h5-q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.h5-q-num { color: var(--accent); font-weight: 700; font-size: 12px; letter-spacing: .3px; }
.h5-q-grid { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; align-items: center; }
.h5-q-grid > label { color: var(--muted); font-size: 12px; }
.h5-preview-wrap { display: flex; justify-content: center; padding: 8px; background: var(--bg2); border-radius: 12px; }
.h5-preview-wrap iframe { width: 390px; max-width: 100%; height: 72vh; border: 1px solid var(--border); border-radius: 18px; background: #0b0f14; }

/* 系统日志 */
.sys-log-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.sys-log-row { display: grid; grid-template-columns: 90px 70px 110px 1fr; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: rgba(248,81,73,.06); font-size: 12px; }
.sys-log-row .t { color: var(--muted); font-family: var(--mono); }
.sys-log-row .module { color: var(--accent); font-weight: 700; }
.sys-log-row .action { color: var(--purple); }
.sys-log-row .msg { color: var(--text); word-break: break-all; }
.sys-log-row.cb { background: rgba(88,166,255,.06); }
.sys-log-row.cb .action { color: var(--ok); }
.system-page { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 12px; height: 100%; overflow: hidden; }
.system-page > .card { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.system-page > .card > h3 { flex: 0 0 auto; }
.system-page > .card > .muted { flex: 0 0 auto; }
.system-page > .card > .tbl-scroll,
.system-page > .card > .sys-log-list,
.system-page > .card > .audit-list { flex: 1 1 auto; min-height: 0; overflow: auto; }
#apiConfigSummary { flex: 1 1 auto; min-height: 0; overflow: auto; }
.system-page > .sys-audit { grid-column: span 2; }
.sys-acct th, .sys-acct td { white-space: nowrap; }
.sys-acct td:last-child { text-align: right; }

/* ===================== 响应式 / 窄屏适配 ===================== */
@media (max-width: 1280px) {
  #view { padding: 16px; }
}
@media (max-width: 900px) {
  .modal-lg { width: 92vw; }
}
@container (max-width: 900px) {
  .h5-form-grid, .h5-q-grid { grid-template-columns: 1fr; }
  .sys-log-row { grid-template-columns: 70px 60px 1fr; }
  .sys-log-row .action { display: none; }
  .md-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .system-page { grid-template-columns: 1fr; grid-template-rows: none; height: auto; overflow: visible; }
  .system-page > .card { overflow: auto; }
  .system-page > .sys-audit { grid-column: auto; }
}
@container (max-width: 1280px) {
  .sys-acct .col-desc, .sys-acct .col-modules, .sys-acct .col-last { display: none; }
}
@container (max-width: 900px) {
  .system-page > .sys-acct { max-height: 360px; }
  .system-page > .sys-api { max-height: 300px; }
  .system-page > .sys-log, .system-page > .sys-cb { max-height: 240px; }
  .system-page > .sys-audit { max-height: 340px; }
}
@container (max-width: 560px) {
  .md-summary { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  #view { padding: 10px; }
  #topbar { padding: 0 12px; }
  #topbar h1 { font-size: 14px; }
  .modal { width: 94vw; padding: 16px; }
  .modal-body { max-height: calc(92vh - 110px); }
}
