/* ============================================================
 * HOT CRUSH 门店财务 AI 分析系统 — 设计系统
 * 财务报告纸面风：纸灰底 / 墨黑字 / 品牌红仅用于预警与品牌
 * ============================================================ */

:root {
  --hc-red: #D62F2F;
  --hc-red-strong: #A2191F;
  --hc-red-hover: var(--hc-red-strong);
  --ink-100: #161616;
  --ink-70: #525252;
  --ink-50: #6F6F6F;
  --surface-0: #FFFFFF;
  --surface-1: #F4F4F4;
  --surface-2: #E8E8E8;
  --border-subtle: #DEDEDE;
  --border-strong: #8D8D8D;
  --success: #198038;
  --warning: #8E6A00;
  --danger: #DA1E28;
  --info: #0F62FE;
  --nav-width: 212px;
  --context-height: 56px;
  --space-page: clamp(16px, 2.4vw, 36px);

  /* Compatibility aliases used by the existing finance and cost-card views. */
  --paper: var(--surface-1);
  --card: var(--surface-0);
  --ink: var(--ink-100);
  --ink-2: var(--ink-70);
  --ink-3: var(--ink-50);
  --hairline: var(--border-subtle);
  --hairline-2: #ECECEC;
  --red: var(--hc-red);
  --red-bg: #FFF1F1;
  --ok: var(--success);
  --ok-bg: #EDF8F0;
  --warn: var(--warning);
  --warn-bg: #FFF8E1;
  --font: Inter, -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --shadow: 0 1px 2px rgba(22, 22, 22, .04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}
b { font-weight: 600; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; font-size: 13px; color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.num, .kpi-value, .mono, td.num, th.num { font-variant-numeric: tabular-nums; }
.mono { font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace; font-size: .92em; }
.sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}

/* ================= Shared context controls ================= */
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-text { display: flex; flex-direction: column; }
.brand-name {
  font-size: 19px; font-weight: 800; letter-spacing: 5px; line-height: 1.15;
  font-family: 'Helvetica Neue', Arial, var(--font);
}
.brand-sub { font-size: 12px; color: var(--ink-2); letter-spacing: 1px; }
.demo-badge {
  display: inline-block; font-style: normal; font-size: 11px; color: var(--danger);
  border: 1px solid currentColor; border-radius: 3px; padding: 2px 6px; margin-left: 6px;
  background: var(--red-bg);
  vertical-align: 1px;
}
.db-badge {
  display: inline-block; font-size: 11px; color: var(--ink-2); background: none;
  border: 1px solid var(--hairline); border-radius: 3px; padding: 0 6px; margin-left: 6px;
  vertical-align: 1px; cursor: pointer; letter-spacing: .3px;
}
.db-badge.ok { color: var(--ok); border-color: currentColor; background: var(--ok-bg); }
.db-badge.err { color: var(--red); border-color: currentColor; background: var(--red-bg); }
.db-badge.warn { color: var(--warning); border-color: currentColor; background: #FFF8E1; }
.ctl { min-height: 40px; display: flex; align-items: center; gap: 8px; color: var(--ink-70); font-size: 12px; }
.ctl select,
.ctl-sm select,
.ctl-sm input,
select.ctl-sm,
input.ctl-sm {
  min-height: 40px;
  padding: 8px 32px 8px 12px;
  color: var(--ink-100);
  background-color: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
}
.month-nav { display: inline-flex; align-items: center; gap: 0; }
.nav-btn {
  width: 40px; height: 40px; border: 1px solid var(--border-subtle); border-radius: 2px;
  background: var(--surface-0); color: var(--ink-70); font-size: 16px; line-height: 1;
  transition: color .15s, border-color .15s;
}
.month-nav .nav-btn + select,
.month-nav select + .nav-btn { margin-left: -1px; }
.nav-btn:hover { color: var(--ink-100); background: var(--surface-1); border-color: var(--border-strong); }

/* ================= 页面布局 ================= */
.page { max-width: 1480px; margin: 0 auto; padding: 20px 24px 48px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: panelIn .3s cubic-bezier(.2, .7, .3, 1); }
.page-head {
  min-height: 104px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 18px 0 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.page-head h1 {
  margin: 4px 0;
  color: var(--ink-100);
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.1;
  letter-spacing: -.035em;
}
.page-head p { margin: 0; color: var(--ink-70); }
.page-kicker {
  display: block;
  color: var(--hc-red);
  font: 700 10px/1.2 ui-monospace, 'SFMono-Regular', Menlo, monospace;
  letter-spacing: .16em;
}
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 页签切换：整页轻抬入场；卡片与 KPI 级联浮现 */
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } }
.tab-panel.active .card { animation: riseIn .42s cubic-bezier(.2, .7, .3, 1) backwards; }
.tab-panel.active .card:nth-of-type(2), .tab-panel.active .grid:nth-of-type(2) .card { animation-delay: .05s; }
.tab-panel.active .card:nth-of-type(3), .tab-panel.active .grid:nth-of-type(3) .card { animation-delay: .1s; }
.tab-panel.active .card:nth-of-type(n+4) { animation-delay: .14s; }
.tab-panel.active .kpi { animation: riseIn .38s cubic-bezier(.2, .7, .3, 1) backwards; }
.tab-panel.active .kpi:nth-child(2) { animation-delay: .04s; }
.tab-panel.active .kpi:nth-child(3) { animation-delay: .08s; }
.tab-panel.active .kpi:nth-child(4) { animation-delay: .12s; }
.tab-panel.active .kpi:nth-child(5) { animation-delay: .16s; }
.tab-panel.active .kpi:nth-child(6) { animation-delay: .2s; }
.tab-panel.active .kpi:nth-child(7) { animation-delay: .24s; }
.tab-panel.active .kpi:nth-child(8) { animation-delay: .28s; }
.report-line { font-size: 12.5px; color: var(--ink-2); margin-bottom: 14px; }
.report-line b { color: var(--ink); }
.print-only { display: none; }

.empty-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px dashed var(--warn); background: var(--warn-bg); color: var(--ink);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 14px; font-size: 13px;
}

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g-1-1 { grid-template-columns: 1fr 1fr; }
.g-1-1-1 { grid-template-columns: 1fr 1fr 1fr; }
.g-2-1 { grid-template-columns: 2fr 1fr; }

/* ================= 卡片 ================= */
.card {
  background: var(--card); border: 1px solid var(--hairline); border-radius: 10px;
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(20, 20, 20, .05), 0 10px 28px rgba(20, 20, 20, .07);
}
.grid .card { margin-bottom: 0; }
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; font-weight: 700; letter-spacing: .3px; }
.eyebrow {
  display: block; font-size: 11px; color: var(--ink-3); letter-spacing: 1.5px;
  margin-bottom: 3px;
}
.eyebrow::before { content: ''; display: inline-block; width: 7px; height: 7px; border: 2px solid var(--red); border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.card-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.foot-note { font-size: 11.5px; color: var(--ink-3); margin-top: 10px; border-top: 1px dashed var(--hairline-2); padding-top: 8px; }
.muted { color: var(--ink-3); }
.muted-inline { font-size: 12px; color: var(--ink-3); font-weight: 400; margin-left: 6px; }
.muted-line { }
.count-pill {
  display: inline-block; min-width: 20px; text-align: center; font-size: 12px;
  background: var(--red); color: #FFF; border-radius: 10px; padding: 0 6px; margin-left: 4px;
}

/* ================= KPI 带 ================= */
.kpi-strip {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; margin-bottom: 16px;
}
.kpi-strip.kpi-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-strip.kpi-3 { grid-template-columns: repeat(3, 1fr); }
.kpi {
  background: var(--card); border: 1px solid var(--hairline); border-radius: 10px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
.kpi-label { font-size: 11.5px; color: var(--ink-2); letter-spacing: .5px; }
.kpi-value {
  font-size: 22px; font-weight: 800; letter-spacing: -.3px; margin: 3px 0 2px;
  font-family: 'Helvetica Neue', Arial, var(--font);
}
.kpi-sub { font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* ================= 图表 ================= */
.chart { width: 100%; height: 300px; }
.chart-sm { height: 220px; }

/* ================= 表格 ================= */
/* 横向滚动 + 触屏惯性滚动 + 边缘阴影提示（仅在可滚动时出现） */
.tbl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(to right, var(--card) 30%, rgba(255, 255, 255, 0)),
    linear-gradient(to left, var(--card) 30%, rgba(255, 255, 255, 0)) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(20, 20, 20, .14), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(20, 20, 20, .14), transparent) 100% 0;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}
.tbl-wrap:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--ink-3);
  letter-spacing: 1px; padding: 8px 10px; border-bottom: 1px solid var(--ink);
  white-space: nowrap; background: var(--card);
}
/* 长表格：限高内部滚动 + 表头吸顶，避免页面被拉得很长 */
.tbl-tall { max-height: 520px; overflow-y: auto; }
.tbl-tall .tbl thead th { position: sticky; top: 0; z-index: 3; box-shadow: 0 1px 0 var(--ink); border-bottom: none; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--hairline-2); white-space: nowrap; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl tbody tr:hover { background: #FAFAF7; }
.tbl .row-major td { font-weight: 700; border-top: 1px solid var(--hairline); background: #FBFBF9; }
td.ind-1 { padding-left: 26px; color: var(--ink-2); }
td.ind-2 { padding-left: 44px; color: var(--ink-3); }

/* ================= 语义零件 ================= */
/* 审计红章（签名元素：呼应品牌红圈） */
.stamp {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border: 1.5px solid var(--red); border-radius: 50%;
  color: var(--red); font-size: 11px; font-weight: 800; line-height: 1;
  transform: rotate(-8deg); background: rgba(199, 38, 31, .04);
  flex: none; user-select: none;
}

.chip {
  display: inline-block; font-size: 11.5px; font-weight: 600; border-radius: 4px;
  padding: 1px 6px; font-variant-numeric: tabular-nums;
}
.chip.good { color: var(--ok); background: var(--ok-bg); }
.chip.bad { color: var(--red); background: var(--red-bg); }
.chip.muted { color: var(--ink-3); background: var(--hairline-2); }

.tag {
  display: inline-block; font-size: 11px; border: 1px solid var(--hairline);
  color: var(--ink-2); border-radius: 4px; padding: 1px 7px; background: var(--card);
}
.tag.ok { color: var(--ok); border-color: currentColor; background: var(--ok-bg); }
.tag.warn { color: var(--warn); border-color: currentColor; background: var(--warn-bg); }
.tag.alert { color: var(--red); border-color: currentColor; background: var(--red-bg); }
.tag.muted { color: var(--ink-3); border-color: var(--hairline); }

.bad-text { color: var(--red); font-weight: 700; }
.ok-text { color: var(--ok); font-weight: 700; }
.warn-text { color: var(--warn); font-weight: 700; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--hairline); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--red); }

/* ================= 按钮 ================= */
.btn {
  border-radius: 6px; font-size: 13px; padding: 7px 14px; letter-spacing: .5px;
  transition: opacity .15s, background .15s;
}
.btn-solid { background: var(--ink); color: #FFF; border: 1px solid var(--ink); }
.btn-solid:hover { opacity: .85; }
.btn-line { background: var(--card); color: var(--ink); border: 1px solid var(--hairline); }
.btn-line:hover { border-color: var(--ink-2); }
.btn-danger { background: var(--card); color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.icon-btn {
  border: 1px solid var(--hairline); background: var(--card); color: var(--ink-2);
  border-radius: 6px; font-size: 11.5px; padding: 4px 8px; white-space: nowrap;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-2); }

/* 分段选择（日/周/月、备货标准） */
.seg { display: inline-flex; border: 1px solid var(--hairline); border-radius: 6px; overflow: hidden; }
.seg label {
  font-size: 12px; padding: 5px 11px; color: var(--ink-2); cursor: pointer;
  border-right: 1px solid var(--hairline-2); display: flex; align-items: center; gap: 4px;
}
.seg label:last-child { border-right: none; }
.seg input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.seg label:has(input:checked) { background: var(--ink); color: #FFF; }
.seg label:has(input:focus-visible) { box-shadow: inset 0 0 0 2px var(--info); }

.ctl-sm { font-size: 12px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.ctl-sm select, .ctl-sm input, select.ctl-sm, input.ctl-sm {
  border: 1px solid var(--hairline); border-radius: 6px; background: var(--card);
  padding: 5px 8px; font-size: 12px;
}
input[type="search"].ctl-sm { min-width: 200px; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pl-range-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: -4px 0 20px; padding: 12px 14px;
  background: var(--surface-1); border: 1px solid var(--border-subtle);
}
.pl-store-picker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; padding: 0; border: 0; }
.pl-store-picker legend { float: left; margin-right: 2px; color: var(--ink-70); font-size: 12px; }
.pl-store-picker label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.pl-scope-count { margin-left: auto; color: var(--ink-50); font-size: 11px; }

/* ================= 总览专用 ================= */
.warn-scroll { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.warn-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px;
  border: 1px solid var(--hairline-2); border-radius: 8px; cursor: pointer;
  width: 100%; color: inherit; background: transparent; font: inherit; text-align: left;
  transition: border-color .15s, background .15s;
}
.warn-item:hover { border-color: var(--red); background: var(--red-bg); }
.warn-title { font-size: 13px; font-weight: 600; }
.warn-meta { font-size: 11.5px; color: var(--ink-2); }
.empty-mini {
  color: var(--ink-3); font-size: 12.5px; text-align: center; padding: 22px 10px;
  border: 1px dashed var(--hairline); border-radius: 8px;
}

.ach-list { display: flex; flex-direction: column; gap: 9px; }
.ach-row { display: grid; grid-template-columns: 90px 1fr 56px; align-items: center; gap: 10px; }
.ach-label { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ach-bar { position: relative; height: 10px; background: var(--hairline-2); border-radius: 5px; overflow: visible; }
.ach-bar i { display: block; height: 100%; background: var(--ink); border-radius: 5px; transition: width .4s; }
.ach-bar i.bad { background: var(--red); }
.ach-bar em { position: absolute; top: -3px; bottom: -3px; width: 1.5px; background: var(--ink-3); }
.ach-val { font-size: 12.5px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.ai-list { display: flex; flex-direction: column; gap: 8px; }
.ai-item {
  display: flex; gap: 10px; font-size: 13px; padding: 10px 12px;
  border-left: 3px solid var(--hairline); background: #FBFBF9; border-radius: 0 8px 8px 0;
}
.ai-ico { flex: none; width: 18px; text-align: center; color: var(--ink-3); }
.ai-alert { border-left-color: var(--red); }
.ai-alert .ai-ico { color: var(--red); }
.ai-ok { border-left-color: var(--ok); }
.ai-ok .ai-ico { color: var(--ok); }
.ai-note { border-left-color: var(--warn); }
.ai-note .ai-ico { color: var(--warn); }
.ai-forecast { border-left-color: #4A6FA5; }
.ai-forecast .ai-ico { color: #4A6FA5; }

/* ================= 费用稽核卡 ================= */
.audit-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.audit-card { border: 1px solid var(--hairline); border-radius: 8px; padding: 12px 14px; }
.audit-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.audit-grid { display: flex; gap: 22px; flex-wrap: wrap; }
.audit-grid span { display: block; font-size: 11px; color: var(--ink-3); }
.audit-grid b { font-size: 16px; font-variant-numeric: tabular-nums; }

/* ================= 销售专用 ================= */
.rank {
  display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; border-radius: 4px; color: var(--ink-2); background: var(--hairline-2);
}
.rank.top { background: var(--ink); color: #FFF; }
.share-bar { position: relative; min-width: 110px; height: 16px; display: flex; align-items: center; justify-content: flex-end; }
.share-bar i { position: absolute; left: 0; top: 3px; bottom: 3px; background: var(--hairline); border-radius: 3px; transition: width .5s cubic-bezier(.2, .7, .3, 1); }
.share-bar span { position: relative; font-size: 12px; font-variant-numeric: tabular-nums; }

/* ================= 数据中心 ================= */
.priority-queue {
  display: grid;
  grid-template-columns: 1fr;
  border: 1px solid var(--border-subtle);
  border-bottom: 0;
}
.priority-item {
  min-height: 68px;
  display: grid;
  grid-template-columns: 40px minmax(180px, 1fr) 104px 104px auto;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  background: var(--surface-0);
  border-bottom: 1px solid var(--border-subtle);
}
.priority-item.urgent { box-shadow: inset 3px 0 var(--danger); }
.priority-rank { color: var(--ink-50); font: 700 11px/1 ui-monospace, 'SFMono-Regular', Menlo, monospace; }
.priority-copy, .priority-metric { min-width: 0; display: flex; flex-direction: column; }
.priority-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.priority-copy span, .priority-metric span { color: var(--ink-50); font-size: 11px; }
.priority-metric b { color: var(--ink-100); font-variant-numeric: tabular-nums; }

.fulfilment-stages {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  background: var(--border-subtle);
}
.fulfilment-stage {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  background: var(--surface-0);
}
.fulfilment-stage span { color: var(--ink-70); font-size: 12px; }
.fulfilment-stage b { color: var(--ink-100); font-size: 20px; font-variant-numeric: tabular-nums; }
.fulfilment-stage.hot { box-shadow: inset 0 3px var(--danger); background: var(--red-bg); }
.fulfilment-stage.hot span, .fulfilment-stage.hot b { color: var(--danger); }
.purchase-row-focus { outline: 2px solid var(--info); outline-offset: -2px; }

.exception-queue {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.exception-item {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-0);
}
.exception-item div { min-width: 0; display: flex; flex-direction: column; }
.exception-item div b, .exception-item div span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exception-item div span { color: var(--ink-50); font-size: 11px; }
.exception-item strong { font-variant-numeric: tabular-nums; }

.status-tag {
  width: max-content;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  color: var(--ink-70);
  background: var(--surface-2);
  border-radius: 2px;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}
.status-tag.success { color: #0E6027; background: #EDF8F0; }
.status-tag.danger { color: #A2191F; background: var(--red-bg); }
.status-tag.neutral { color: var(--ink-70); background: var(--surface-2); }

.data-source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.data-source {
  min-height: 112px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: 8px 12px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-1);
}
.data-source.primary { box-shadow: inset 3px 0 var(--success); background: #F3FAF5; }
.data-source.pending-source { grid-column: 1 / -1; box-shadow: inset 3px 0 var(--warning); background: var(--warn-bg); }
.data-source b { color: var(--ink-100); font-size: 16px; }
.data-source span { grid-column: 1 / -1; color: var(--ink-70); font-size: 12px; }
.data-source .status-tag { grid-column: 2; grid-row: 1; }
.data-sync-state { margin: 0; padding: 10px 12px; background: var(--surface-1); border-left: 3px solid var(--border-strong); }

.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tpl-card { border: 1px solid var(--hairline); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.tpl-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.tpl-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 22px; border-radius: 4px; background: var(--ink); color: #FFF;
  font-size: 11px; font-weight: 700; letter-spacing: .5px; flex: none;
}
.tpl-desc { font-size: 12px; color: var(--ink-2); }
.tpl-cols { font-size: 11px; color: var(--ink-3); line-height: 1.7; flex: 1; }
.tpl-cols i { font-style: normal; color: var(--ink-2); font-weight: 600; }
.tpl-card .btn { align-self: flex-start; }

.drop-zone {
  border: 1.5px dashed var(--hairline); border-radius: 10px; padding: 30px 20px;
  text-align: center; cursor: pointer; display: flex; flex-direction: column; gap: 4px; align-items: center;
  width: 100%; color: var(--ink-2); background: transparent; font: inherit;
  transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.drag { border-color: var(--ink); background: #FBFBF9; }
.drop-zone.permission-disabled { display: none; }
.drop-zone b { color: var(--ink); font-size: 14px; }
.drop-zone span { font-size: 12px; color: var(--ink-3); }
.drop-ico { font-size: 26px; color: var(--ink-3); }

.parse-card { border: 1px solid var(--hairline); border-radius: 8px; padding: 12px 14px; margin-top: 10px; }
.parse-card.parse-bad { border-color: var(--red); background: var(--red-bg); }
.parse-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.parse-meta { font-size: 12px; color: var(--ink-2); margin-top: 5px; }
.parse-errs { margin-top: 8px; font-size: 12px; color: var(--warn); }
.parse-errs summary { cursor: pointer; font-weight: 600; }
.parse-errs div { padding: 2px 0 0 12px; color: var(--ink-2); }
.import-actions { display: flex; gap: 10px; margin-top: 12px; }

.hint { font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
.target-input {
  width: 140px; text-align: right; border: 1px solid var(--hairline); border-radius: 5px;
  padding: 4px 8px; font-variant-numeric: tabular-nums;
}
.target-input:focus { border-color: var(--ink); outline: none; }
#target-editor .btn { margin-top: 12px; }
.target-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
#target-editor .target-actions .btn { margin-top: 0; }

.comp-wrap { max-height: 300px; overflow-y: auto; }
.log-item { font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--hairline-2); }
.log-item b { margin: 0 6px; }
.danger-row { display: flex; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--hairline); }

/* ================= 页脚 ================= */
.page-foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--ink-3); padding-top: 18px; border-top: 1px solid var(--hairline);
}

/* ============================================================
 * 2026-07-15 · IBM Carbon × HOT CRUSH enterprise refresh
 * Keep legacy variables as aliases so existing render logic remains intact.
 * ============================================================ */
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  background: var(--surface-1);
  color: var(--ink-100);
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink-100);
  border: 2px solid #fff;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

/* Application shell */
.account-rail { position: relative; min-height: 40px; padding-left: 8px; border-left: 1px solid var(--border-subtle); }
.account-chip { min-height: 40px; border-radius: 2px; }
.account-avatar { border-radius: 2px; background: var(--ink-100); }
.account-chip[aria-expanded="true"] { background: var(--surface-2); }
#account-popover[hidden] { display: none; }
#account-popover {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  right: 0;
  width: min(320px, calc(100vw - 24px));
  padding: 12px;
  color: var(--ink-100);
  background: var(--surface-0);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 32px rgba(22, 22, 22, .16);
}
.account-summary { display: flex; align-items: center; gap: 10px; padding: 4px 4px 12px; }
.account-summary > span:last-child { min-width: 0; display: grid; line-height: 1.25; }
.account-summary b { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.account-summary em { color: var(--ink-50); font-size: 11px; font-style: normal; }
.account-sync {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 8px;
  padding: 8px 10px;
  color: #0E6027;
  background: #DEFBE6;
  font-size: 11px;
  font-weight: 700;
}
.account-sync i { width: 7px; height: 7px; flex: 0 0 auto; background: #198038; border-radius: 50%; }
.account-menu-group { padding-block: 4px; border-block: 1px solid var(--border-subtle); }
.account-menu-group button, .account-logout {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--ink-100);
  background: transparent;
  border: 0;
  text-align: left;
}
.account-menu-group button:hover, .account-menu-group button:focus-visible, .account-logout:hover, .account-logout:focus-visible { background: var(--surface-2); }
.account-logout { margin-top: 4px; color: var(--danger); font-weight: 700; }
.auth-form .auth-status { color: var(--ink-50); }
.auth-form .auth-status.error { color: var(--danger); }

/* Page context and feedback */
.page { max-width: 1600px; padding: 24px 32px 64px; }
.report-line.muted-line {
  width: fit-content;
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 5px 10px;
  color: var(--ink-70);
  background: var(--surface-2);
  border-left: 3px solid var(--ink-100);
}
.report-line b { color: var(--ink-100); }
.empty-banner {
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px 16px;
  color: #684E00;
  background: var(--warn-bg);
  border: 1px solid #F1C21B;
  border-left: 4px solid #B28600;
  border-radius: 0;
}

.toast {
  position: fixed;
  z-index: 500;
  top: 18px;
  right: 18px;
  bottom: auto;
  left: auto;
  width: min(420px, calc(100vw - 32px));
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: #fff;
  background: var(--ink-100);
  border-left: 4px solid var(--info);
  border-radius: 0;
  box-shadow: 0 12px 32px rgba(22,22,22,.18);
  transform: translateX(calc(100% + 40px));
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.success { background: #0E6027; border-left-color: #42BE65; }
.toast.error { background: #A2191F; border-left-color: #FF8389; }

/* Buttons and compact controls */
.btn,
.icon-btn {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 2px;
  font-weight: 600;
  line-height: 38px;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-solid { color: #fff; background: var(--hc-red); border: 1px solid var(--hc-red); }
.btn-solid:hover { opacity: 1; background: var(--hc-red-hover); border-color: var(--hc-red-hover); }
.btn-line, .icon-btn { color: var(--ink-100); background: var(--surface-0); border: 1px solid var(--border-subtle); }
.btn-line:hover, .icon-btn:hover { color: var(--ink-100); background: var(--surface-1); border-color: var(--border-strong); }
.btn-danger { color: var(--danger); background: var(--surface-0); border: 1px solid var(--danger); }
.btn-danger:hover { color: #fff; background: var(--danger); }

/* Data surfaces */
.grid { gap: 16px; margin-bottom: 16px; }
.card {
  padding: 20px;
  background: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  box-shadow: none;
  transition: border-color .15s;
}
.card:hover { transform: none; box-shadow: none; border-color: var(--border-strong); }
.card-head {
  min-height: 56px;
  align-items: center;
  margin: -20px -20px 18px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.card-head h3 { color: var(--ink-100); font-size: 16px; letter-spacing: 0; }
.eyebrow { color: var(--ink-50); font-size: 11px; letter-spacing: .08em; }
.eyebrow::before { width: 8px; height: 8px; border-width: 2px; border-color: var(--hc-red); border-radius: 50%; }
.foot-note { color: var(--ink-70); border-top: 1px solid var(--border-subtle); }

.kpi-strip {
  gap: 1px;
  padding: 1px;
  background: var(--border-subtle);
  border: 0;
}
.kpi {
  min-height: 112px;
  padding: 16px;
  background: var(--surface-0);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.kpi-label { color: var(--ink-70); font-size: 12px; letter-spacing: 0; }
.kpi-value { margin: 8px 0 4px; color: var(--ink-100); font-size: clamp(24px, 2vw, 32px); line-height: 1.05; }
.kpi-sub { color: var(--ink-50); }
.count-pill { min-width: 24px; border-radius: 2px; background: var(--danger); }

.tbl-wrap { border: 1px solid var(--border-subtle); }
.card > .tbl-wrap { margin-inline: -1px; }
.tbl { color: var(--ink-100); font-size: 12.5px; }
.tbl th {
  height: 44px;
  padding: 10px 12px;
  color: var(--ink-70);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-strong);
  letter-spacing: .02em;
}
.tbl td { height: 42px; padding: 9px 12px; border-bottom: 1px solid var(--border-subtle); }
.tbl tbody tr:hover td { background: #F7F7F7; }
.tbl .row-major td { background: var(--surface-1); }
.tbl .risk-row > td:first-child { box-shadow: inset 3px 0 var(--danger); }
.tbl .risk-cell { color: var(--danger); background: var(--red-bg); font-weight: 650; }
.tbl tbody tr:hover .risk-cell { background: #FFE9E9; }
.tbl-tall .tbl thead th { box-shadow: 0 1px var(--border-strong); }
.empty-mini { min-height: 96px; color: var(--ink-70); background: var(--surface-1); border: 1px dashed var(--border-strong); }

.tag, .badge, .demo-badge, .db-badge {
  border-radius: 2px;
  font-weight: 600;
}
.db-badge.ok { color: #0E6027; background: #EDF8F0; }
.db-badge.err { color: #A2191F; background: #FFF1F1; }
.db-badge.warn { color: #6F4E00; background: #FFF8E1; }

.tab-panel.active,
.tab-panel.active .card,
.tab-panel.active .kpi { animation: none; }

/* Left workspace shell */
.workspace-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
  background: var(--surface-1);
}
.workspace-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  color: #BFBFBF;
  /* 黑白分界柔化：纵向微渐变 + 深色描边 + 轻投影，替代生硬的纯黑切边 */
  background: linear-gradient(180deg, #191919 0%, #141414 100%);
  border-right: 1px solid #262626;
  box-shadow: 6px 0 18px rgba(22, 22, 22, .08);
}
.workspace-brand {
  width: 100%;
  min-height: 86px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  color: #FFF;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #393939;
  text-align: left;
}
.workspace-brand .brand-mark {
  width: 40px;
  height: 40px;
  padding: 2px;
  background: #FFF;
  border-radius: 50%;
}
.workspace-brand .brand-text { min-width: 0; display: flex; flex-direction: column; }
.workspace-brand .brand-name { color: #FFF; font-size: 16px; letter-spacing: .22em; white-space: nowrap; }
.workspace-brand .brand-sub { color: #A8A8A8; font-size: 10px; letter-spacing: 0; white-space: nowrap; }
.nav-group { padding: 14px 0 4px; }
.nav-group-label {
  display: block;
  padding: 0 18px 8px;
  color: #777;
  font: 700 10px/1 ui-monospace, 'SFMono-Regular', Menlo, monospace;
  letter-spacing: .14em;
}
.workspace-link {
  width: 100%;
  min-height: 42px;
  padding: 0 18px;
  color: inherit;
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  text-align: left;
}
.workspace-link:hover { color: #FFF; background: #202020; }
.workspace-link.active { color: #FFF; background: #262626; border-left-color: var(--hc-red); }
.workspace-link.tab-dim::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 8px;
  background: #6F6F6F;
  border-radius: 50%;
  vertical-align: 1px;
}
.nav-group-system { margin-top: 10px; border-top: 1px solid #393939; }
.workspace-main { min-width: 0; }
.context-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--context-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px var(--space-page);
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
}
.context-heading { min-width: max-content; display: flex; flex-direction: column; }
.context-heading span { color: var(--ink-50); font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.context-heading b { color: var(--ink-100); font-size: 18px; line-height: 1.25; }
.context-controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.context-controls .ctl { padding-left: 0; background: transparent; border-left: 0; }
.context-controls .demo-badge, .context-controls .db-badge { margin-left: 0; }
.context-controls .account-rail { display: flex; align-items: center; gap: 6px; }
.context-controls .account-rail[hidden] { display: none; }
.workspace-main .page { width: 100%; max-width: none; margin: 0; padding: var(--space-page); }
.mobile-nav { display: none; }
.mobile-more-menu { display: none; }
.mobile-more-menu[hidden] { display: none; }
.table-scroll-hint { display: none; }

.state-panel {
  min-height: 148px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-content: center;
  column-gap: 12px;
  padding: 24px;
  color: var(--ink-70);
  background: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--border-strong);
}
.state-panel .state-icon { grid-row: 1 / span 2; width: 14px; height: 14px; margin-top: 4px; border: 2px solid currentColor; border-radius: 50%; }
.state-panel h3 { color: var(--ink-100); font-size: 16px; }
.state-panel p { margin-top: 4px; line-height: 1.6; }
.state-panel.loading { border-left-color: var(--info); }
.state-panel.loading .state-icon { border-right-color: transparent; animation: state-spin .8s linear infinite; }
.state-panel.empty { border-left-color: var(--border-strong); }
.state-panel.error { color: var(--danger); border-left-color: var(--danger); background: #FFF1F1; }
.state-panel.permission { color: var(--warning); border-left-color: var(--warning); background: #FFF8E1; }
.state-panel.success { color: var(--success); border-left-color: var(--success); background: #F3FAF6; }
.state-panel.conflict { color: var(--warning); border-left-color: var(--warning); background: #FFF8E1; }
@keyframes state-spin { to { transform: rotate(360deg); } }

/* Tablet */
@media (max-width: 1199px) {
  .workspace-shell { --nav-width: 64px; }
  .workspace-brand { min-height: 64px; justify-content: center; padding: 12px 8px; }
  .workspace-brand .brand-text, .nav-group-label { display: none; }
  .workspace-link { min-height: 48px; padding: 0; font-size: 0; text-align: center; }
  .workspace-link::before { color: inherit; font-size: 20px; font-weight: 400; line-height: 1; }
  .workspace-link[data-tab="overview"]::before { content: '⌂'; }
  .workspace-link[data-tab="sales"]::before { content: '↗'; }
  .workspace-link[data-tab="material"]::before { content: '◩'; }
  .workspace-link[data-tab="expense"]::before { content: '¥'; }
  .workspace-link[data-tab="labor"]::before { content: '♙'; }
  .workspace-link[data-tab="purchase"]::before { content: '▣'; }
  .workspace-link[data-tab="logistics"]::before { content: '⇄'; }
  .workspace-link[data-tab="cost-card"]::before { content: '▤'; }
  .workspace-link[data-tab="data"]::before { content: '⚙'; }
  .workspace-link[data-tab="profit"]::before { content: '⇡'; }
  .workspace-link[data-tab="pl"]::before { content: '▦'; }
  .workspace-link[data-tab="cashflow"]::before { content: '≋'; }
  .workspace-link[data-tab="balance-sheet"]::before { content: '▥'; }
  .workspace-link[data-tab="payables"]::before { content: '⌛'; }
  .workspace-link.tab-dim::after { display: none; }
  .context-bar { align-items: flex-start; flex-direction: column; }
  .context-controls { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .workspace-main .page { padding: 20px 20px 52px; }
  .kpi-strip { grid-template-columns: repeat(4, 1fr); }
  .g-1-1-1 { grid-template-columns: 1fr 1fr; }
  .audit-row, .tpl-grid { grid-template-columns: 1fr 1fr; }
}

/* Mobile */
@media (max-width: 767px) {
  body { font-size: 13px; }
  .workspace-shell { display: block; padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .workspace-nav { display: none; }
  .context-bar { min-height: auto; align-items: stretch; padding: 10px 12px; }
  .context-heading { flex-direction: row; align-items: baseline; gap: 8px; }
  .context-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .ctl { min-width: 0; padding: 0; background: transparent; border: 0; display: grid; gap: 4px; }
  .ctl select { width: 100%; min-width: 0; }
  .month-nav { width: 100%; }
  .month-nav select { min-width: 0; flex: 1; }
  .context-controls > .btn { display: none !important; }
  .context-controls > #btn-print { grid-column: 1 / -1; display: inline-flex !important; justify-content: center; }
  .pl-range-controls { align-items: stretch; flex-direction: column; }
  .pl-range-controls .ctl-sm { justify-content: space-between; }
  .pl-range-controls .ctl-sm input, .pl-range-controls .ctl-sm select { flex: 1; }
  .pl-store-picker { padding: 8px 0; }
  .pl-scope-count { margin-left: 0; }
  .context-controls > .demo-badge, .context-controls > .db-badge {
    grid-column: 1 / -1; width: 100%; margin: 0; padding: 6px 8px; text-align: center;
  }
  .context-controls .account-rail { grid-column: 1 / -1; width: 100%; padding: 8px 0 0; border-top: 1px solid var(--border-subtle); border-left: 0; }
  .account-chip { flex: 1; justify-content: flex-start; }
  #account-popover { position: fixed; top: auto; right: 12px; bottom: calc(68px + env(safe-area-inset-bottom)); left: 12px; width: auto; max-height: calc(100dvh - 92px - env(safe-area-inset-bottom)); overflow-y: auto; }
  .workspace-main .page { padding: 12px; }
  .page-head { min-height: 0; align-items: stretch; flex-direction: column; gap: 14px; padding: 12px 0 14px; }
  .page-head h1 { font-size: 28px; }
  .page-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .page-actions.single-action { grid-template-columns: 1fr; }
  .page-actions .btn { width: 100%; }
  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 50;
    min-height: 56px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: #FFF;
    border-top: 1px solid var(--border-subtle);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-nav button { color: var(--ink-70); background: #FFF; border: 0; border-top: 3px solid transparent; }
  .mobile-nav button.active { color: var(--ink-100); font-weight: 700; border-top-color: var(--hc-red); }
  .mobile-more-menu:not([hidden]) {
    position: fixed;
    z-index: 49;
    right: 8px;
    bottom: 64px;
    left: 8px;
    max-height: calc(100dvh - 88px);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    overflow-y: auto;
    background: var(--border-subtle);
    border: 1px solid var(--border-strong);
    box-shadow: 0 16px 36px rgba(22,22,22,.22);
  }
  .mobile-more-menu button {
    min-height: 48px;
    padding: 10px 12px;
    color: var(--ink-100);
    background: var(--surface-0);
    border: 0;
    text-align: left;
  }
  .mobile-more-menu button:hover,
  .mobile-more-menu button:focus-visible { background: var(--surface-2); }
  .mobile-more-menu button.active { box-shadow: inset 3px 0 var(--hc-red); font-weight: 700; }
  .report-line.muted-line { width: 100%; }
  .grid, .g-1-1, .g-1-1-1, .g-2-1 { grid-template-columns: 1fr; }
  .kpi-strip, .kpi-strip.kpi-4, .kpi-strip.kpi-3 { grid-template-columns: 1fr 1fr; gap: 1px; }
  .kpi { min-height: 104px; padding: 14px; }
  .kpi-value { font-size: 22px; }
  .card { padding: 16px; }
  .card-head { min-height: 52px; margin: -16px -16px 16px; padding: 12px 16px; }
  .card-tools { width: 100%; }
  .ctl-sm { flex-wrap: wrap; }
  input[type="search"].ctl-sm { min-width: 0; flex: 1 1 100%; }
  .ctl-sm input[type="date"] { max-width: 128px; }
  .tbl { min-width: 720px; }
  .tbl-wrap { overflow-x: auto; overscroll-behavior-inline: contain; }
  .table-scroll-hint { position: sticky; left: 0; display: block; margin: 0; padding: 8px 10px; color: var(--ink-70); background: var(--surface-1); font-size: 12px; }
  .chart { height: 260px; }
  .chart-sm { height: 200px; }
  .audit-row, .tpl-grid { grid-template-columns: 1fr; }
  .priority-queue { grid-template-columns: 1fr; }
  .priority-item { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; }
  .priority-item .priority-metric { grid-column: 2; flex-direction: row; justify-content: space-between; gap: 8px; }
  .priority-item .btn { grid-column: 3; grid-row: 1 / span 3; align-self: stretch; }
  .fulfilment-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exception-queue, .data-source-grid { grid-template-columns: 1fr; }
  .exception-item { grid-template-columns: 1fr auto; }
  .exception-item .status-tag { grid-column: 1 / -1; }
  .tpl-card .btn { align-self: stretch; text-align: center; }
  .ach-row { grid-template-columns: 76px 1fr 50px; }
  .import-actions, .danger-row { flex-direction: column; }
  .import-actions .btn, .danger-row .btn { width: 100%; }
  .target-actions { align-items: stretch; flex-direction: column; }
  .target-actions .btn { width: 100%; }
  .btn, .icon-btn { min-height: 44px; line-height: 42px; }
  .toast { top: 12px; right: 12px; width: calc(100vw - 24px); }
}

@media (max-width: 420px) {
  .context-controls { grid-template-columns: 1fr; }
  .context-controls .account-rail { grid-column: 1; }
  .kpi-strip, .kpi-strip.kpi-4, .kpi-strip.kpi-3 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

@page { size: A4 landscape; margin: 12mm; }
@media print {
  body { background: #fff; color: #000; font-size: 11px; }
  .skip-link, .workspace-nav, .context-bar, .mobile-nav, .mobile-more-menu, .context-controls, .toast, .screen-only, .empty-banner,
  .page-actions, .filter-bar, .row-menu, .cc-row-menu, dialog, .cc-drawer, .cc-drawer-backdrop, .page-foot,
  .icon-btn, .card-tools, .btn, .drop-zone, .danger-row, #import-preview, .table-scroll-hint { display: none !important; }
  .workspace-shell { display: block; min-height: 0; background: #fff; }
  .brand-mark { width: 34px; height: 34px; }
  .print-only { display: block; margin: 10px 0; color: #000; font-size: 14px; font-weight: 700; }
  .print-report-meta { display: flex !important; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 10mm; padding-bottom: 4mm; border-bottom: 2px solid #000; }
  .print-report-meta > div { display: grid; gap: 3px; }
  .print-report-meta > div:last-child { text-align: right; font-size: 10px; font-weight: 400; }
  .workspace-main .page { max-width: none; padding: 0; }
  .card, .kpi, .tbl-wrap { border-color: #777; box-shadow: none; break-inside: avoid; }
  .card:hover { border-color: #777; }
  .chart, .chart-sm { break-inside: avoid; }
  .tbl { min-width: 0; font-size: 9.5px; }
  .tbl th, .tbl td { padding: 4px 6px; white-space: normal; }
  .tbl-wrap { overflow: visible; }
  .chart > div, .chart-sm > div { width: 100% !important; }
  .chart canvas, .chart-sm canvas { max-width: 100% !important; height: auto !important; }
  .warn-scroll { max-height: none; overflow: visible; }
  .tab-panel { display: none !important; }
  .tab-panel.active { display: block !important; }
}
