:root {
  --ink: #16221f;
  --muted: #66736f;
  --line: #d7dfdb;
  --line-strong: #b9c7c1;
  --paper: #fff;
  --canvas: #f5f7f6;
  --green: #167a5f;
  --green-soft: #e5f2ec;
  --blue: #2b668f;
  --blue-soft: #e6f0f7;
  --amber: #b56f09;
  --amber-soft: #fff2d5;
  --red: #bd3b31;
  --red-soft: #fdeae7;
  --violet: #7353a6;
  --charcoal: #293633;
  --shadow: 0 1px 2px rgba(18, 40, 34, .06);
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif; font-size: 14px; line-height: 1.45; letter-spacing: 0; overflow-x: hidden; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 20px; line-height: 1.25; font-weight: 650; }
h2 { font-size: 17px; line-height: 1.3; font-weight: 650; }
h3 { font-size: 15px; line-height: 1.3; font-weight: 650; }

.app-chrome { position: sticky; top: 0; z-index: 50; background: var(--paper); }
.app-header { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 28px; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand-block { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border: 1px solid var(--ink); color: var(--ink); font-size: 22px; font-weight: 700; }
.brand-copy { min-width: 0; }
.brand-copy p { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.freshness { min-height: 34px; display: inline-flex; align-items: center; padding: 0 10px; color: var(--muted); background: #f7f9f8; border: 1px solid var(--line); border-radius: 4px; white-space: nowrap; }
.freshness.stale { color: var(--red); background: var(--red-soft); border-color: #edb9b3; }
.button { min-height: 36px; padding: 0 13px; border-radius: 5px; border: 1px solid transparent; font-weight: 600; }
.button span { margin-right: 4px; font-size: 17px; line-height: 0; }
.button.primary { color: #fff; background: var(--green); border-color: var(--green); }
.button.primary:hover { background: #10664f; }
.button.secondary { color: var(--ink); background: var(--paper); border-color: var(--line-strong); }
.button.secondary:hover { background: #f2f6f4; }
.button:disabled { cursor: wait; opacity: .6; }

.tabs { display: flex; gap: 2px; padding: 0 28px; overflow-x: auto; background: var(--paper); border-bottom: 1px solid var(--line); }
.tab { min-width: 104px; height: 46px; padding: 0 14px; color: var(--muted); background: transparent; border: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); background: #f7f9f8; }
.tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 650; }

main { width: min(1540px, 100%); margin: 0 auto; padding: 20px 28px 42px; }
.view { display: none; }
.view.active { display: block; }
.dashboard-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.dashboard-intro > p { max-width: 680px; color: var(--muted); font-size: 12px; text-align: right; }
.eyebrow { margin-bottom: 3px; color: var(--muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.section-meta { align-self: center; color: var(--muted); font-size: 12px; text-align: right; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.text-button { padding: 4px 0; color: var(--green); background: transparent; border: 0; font-weight: 600; }
.text-button:hover { color: var(--blue); text-decoration: underline; }
.section-band { margin-top: 16px; padding-top: 18px; border-top: 1px solid var(--line); }
.first-band { margin-top: 0; }

.status-banner { display: none; margin-bottom: 14px; padding: 10px 12px; border-left: 4px solid var(--amber); background: var(--amber-soft); color: #664400; }
.status-banner.visible { display: block; }
.status-banner.error { border-left-color: var(--red); background: var(--red-soft); color: #7a2119; }
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.kpi-card { min-height: 105px; padding: 15px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
.kpi-label { color: var(--muted); font-size: 12px; }
.kpi-value { margin-top: 7px; font-size: 27px; line-height: 1; font-weight: 680; font-variant-numeric: tabular-nums; }
.kpi-sub { margin-top: 8px; color: var(--muted); font-size: 12px; }
.kpi-card.risk .kpi-value, .kpi-card.danger .kpi-value { color: var(--red); }
.kpi-card.warning .kpi-value { color: var(--amber); }
.kpi-card.accent .kpi-value { color: var(--green); }

.filter-bar { display: grid; grid-template-columns: repeat(3, minmax(150px, 200px)) auto; gap: 12px; align-items: end; margin-bottom: 14px; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); }
.overview-sticky { position: sticky; top: var(--chrome-height, 125px); z-index: 35; margin: -20px -1px 18px; padding: 16px 1px 1px; background: var(--canvas); }
.overview-filters { grid-template-columns: repeat(5, minmax(145px, 1fr)) 37px; align-items: start; margin-bottom: 0; box-shadow: 0 8px 20px rgba(18, 40, 34, .1); }
.overview-filters .result-count { grid-column: 1 / -1; justify-self: start; }
.filter-bar label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.filter-bar input, .filter-bar select { width: 100%; height: 37px; padding: 0 10px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 4px; outline: none; }
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(22, 122, 95, .12); }
.multi-filter { position: relative; min-width: 0; }
.multi-filter > summary { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 14px; grid-template-rows: auto auto; column-gap: 8px; min-height: 53px; padding: 7px 10px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 4px; cursor: pointer; list-style: none; }
.multi-filter > summary::-webkit-details-marker { display: none; }
.multi-filter > summary::after { content: ""; grid-column: 2; grid-row: 1 / 3; align-self: center; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform .16s ease; }
.multi-filter[open] > summary { border-color: var(--green); box-shadow: 0 0 0 2px rgba(22, 122, 95, .12); }
.multi-filter[open] > summary::after { transform: rotate(225deg) translate(-1px, -1px); }
.multi-filter-label { grid-column: 1; color: var(--muted); font-size: 11px; font-weight: 400; }
.multi-filter > summary strong { grid-column: 1; min-width: 0; overflow: hidden; font-size: 13px; font-weight: 560; text-overflow: ellipsis; white-space: nowrap; }
.multi-filter-menu { position: absolute; top: calc(100% + 5px); left: 0; z-index: 30; display: grid; min-width: 100%; width: max-content; max-width: min(280px, calc(100vw - 28px)); padding: 7px; background: #fff; border: 1px solid var(--line-strong); border-radius: 4px; box-shadow: 0 12px 28px rgba(18, 35, 31, .16); }
.multi-filter-menu.wide { min-width: 190px; }
.date-filter-menu { width: min(360px, calc(100vw - 28px)); }
.date-quick-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 4px 8px; border-bottom: 1px solid var(--line); }
.date-quick-actions strong { color: var(--ink); font-size: 12px; }
.date-quick-actions .multi-filter-clear { margin: 0; }
.date-tree { display: grid; gap: 4px; max-height: 310px; margin-top: 7px; overflow-x: hidden; overflow-y: auto; }
.filter-bar .date-tree-row { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 32px; padding: 4px 7px; color: var(--ink); font-size: 13px; cursor: pointer; }
.filter-bar .date-tree-row input { width: 16px; height: 16px; padding: 0; accent-color: var(--green); box-shadow: none; }
.date-year-row { font-weight: 650; background: #f4f7f5; }
.date-month { position: relative; border-bottom: 1px solid #edf1ef; }
.date-month:last-child { border-bottom: 0; }
.date-month summary { min-height: 34px; display: flex; align-items: center; gap: 7px; padding: 4px 7px 4px 24px; color: var(--ink); border: 0; border-radius: 3px; background: transparent; font-size: 13px; font-weight: 650; }
.date-month summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform .16s ease; }
.date-month[open] summary::before { transform: rotate(45deg); }
.date-month summary::after { display: none; }
.date-month summary input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.date-only-month { position: absolute; top: 4px; right: 7px; min-height: 26px; padding: 0 7px; color: var(--green); background: transparent; border: 0; border-radius: 3px; font-size: 11px; }
.date-only-month:hover { color: #fff; background: var(--green); }
.date-days { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 3px 5px 8px 30px; }
.filter-bar .date-days .multi-filter-option { min-height: 30px; padding: 3px 4px; }
.date-days .multi-filter-option span { white-space: nowrap; }
.date-days .multi-filter-option:has(input:checked) { color: var(--green); background: var(--green-soft); font-weight: 600; }
.filter-bar .multi-filter-option { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 34px; padding: 5px 7px; color: var(--ink); font-size: 13px; border-radius: 3px; cursor: pointer; }
.filter-bar .multi-filter-option:hover { background: var(--green-soft); }
.filter-bar .multi-filter-option input { width: 16px; height: 16px; padding: 0; accent-color: var(--green); box-shadow: none; }
.multi-filter-clear { justify-self: end; margin: 4px 4px 1px; padding: 4px 5px; color: var(--green); background: transparent; border: 0; font-size: 12px; }
.multi-filter-clear:hover { text-decoration: underline; }
.multi-filter-clear:disabled { color: var(--muted); cursor: default; opacity: .5; text-decoration: none; }
.search-field { min-width: 260px; grid-column: span 2; }
.result-count { align-self: center; justify-self: end; color: var(--muted); white-space: nowrap; }
.icon-button { width: 37px; height: 37px; padding: 0; color: var(--muted); background: transparent; border: 1px solid var(--line-strong); border-radius: 4px; font-size: 21px; line-height: 1; }
.icon-button:hover { color: var(--red); border-color: var(--red); background: var(--red-soft); }

.visual-row { display: grid; gap: 30px; }
.trend-row { grid-template-columns: minmax(0, 1.72fr) minmax(300px, .78fr); }
.analysis-row { grid-template-columns: minmax(0, 1.35fr) minmax(330px, .85fr); margin-top: 20px; }
.visual-section { min-width: 0; padding-top: 18px; border-top: 1px solid var(--line); }
.chart-frame { position: relative; width: 100%; min-height: 250px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); }
.chart-frame svg { display: block; width: 100%; height: auto; }
.trend-chart { aspect-ratio: 820 / 280; }
.quadrant-chart { aspect-ratio: 760 / 330; }
.chart-grid { stroke: #dfe6e3; stroke-width: 1; }
.axis-line { stroke: #9aa9a3; stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 11px; }
.axis-title { fill: var(--muted); font-size: 11px; }
.daily-bar { fill: var(--blue); opacity: .76; }
.daily-bar.negative-bar { fill: var(--violet); opacity: .72; }
.cumulative-line { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.cumulative-point { fill: var(--paper); stroke: var(--green); stroke-width: 2; }
.danger-zone { fill: var(--red-soft); opacity: .5; }
.threshold-line { stroke-width: 1; stroke-dasharray: 4 4; }
.threshold-line.t80 { stroke: var(--amber); }
.threshold-line.t90 { stroke: #d9821c; }
.threshold-line.t100 { stroke: var(--red); stroke-width: 1.4; }
.risk-bubble { cursor: pointer; stroke: var(--paper); stroke-width: 1.5; opacity: .88; }
.risk-bubble:hover, .risk-bubble:focus { opacity: 1; stroke: var(--ink); stroke-width: 2; }
.risk-bubble.oversold { fill: var(--red); }
.risk-bubble.critical { fill: #d9821c; }
.risk-bubble.warning { fill: #d2a21a; }

.risk-distribution { display: grid; gap: 18px; padding: 7px 0 8px; }
.distribution-row { display: grid; gap: 8px; }
.distribution-label { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.distribution-label strong { font-variant-numeric: tabular-nums; }
.distribution-track { height: 14px; overflow: hidden; background: #e9efec; border-radius: 2px; }
.distribution-fill { display: block; height: 100%; min-width: 2px; border-radius: 2px; }
.distribution-fill.oversold { background: var(--red); }
.distribution-fill.critical { background: #d9821c; }
.distribution-fill.warning { background: #d2a21a; }
.distribution-fill.zero { background: var(--violet); }

.risk-heatmap { padding-top: 8px; }
.heatmap-grid { display: grid; grid-template-columns: 70px repeat(3, minmax(92px, 1fr)); gap: 5px; }
.heatmap-corner, .heatmap-header, .heatmap-row-label { min-height: 32px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }
.heatmap-row-label { justify-content: flex-start; padding-left: 4px; color: var(--ink); font-weight: 650; }
.heat-cell { min-height: 86px; display: grid; align-content: center; gap: 3px; padding: 8px; color: var(--ink); border: 1px solid transparent; border-radius: 5px; text-align: center; }
.heat-cell:hover, .heat-cell.selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.heat-cell strong { font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.heat-cell span { color: var(--muted); font-size: 11px; }
.heat-0 { background: #f1f5f3; }
.heat-1 { background: #f8e8e5; }
.heat-2 { background: #f3c9c3; }
.heat-3 { background: #e9958c; }
.heat-4 { color: #fff; background: #bd3b31; }
.heat-4 span { color: #fff; opacity: .86; }
.heatmap-legend { display: flex; align-items: center; gap: 5px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.heatmap-legend i { width: 14px; height: 10px; display: inline-block; border-radius: 2px; }

.shop-contribution { display: grid; gap: 10px; max-width: 920px; }
.shop-row { display: grid; grid-template-columns: 150px minmax(180px, 1fr) 130px; gap: 14px; align-items: center; }
.shop-label, .shop-value { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.shop-label span, .shop-value span { color: var(--muted); font-size: 11px; }
.shop-value { text-align: right; }
.shop-track { height: 12px; overflow: hidden; background: #e6eeea; border-radius: 2px; }
.shop-track span { display: block; height: 100%; background: var(--blue); border-radius: 2px; }
.shop-row:nth-child(2n) .shop-track span { background: var(--green); }
.shop-row:nth-child(3n) .shop-track span { background: var(--violet); }

.table-wrap { overflow: auto; background: var(--paper); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
.priority-table { min-width: 1320px; }
th, td { padding: 10px 11px; text-align: left; vertical-align: middle; border-bottom: 1px solid #e7ece9; }
th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: #f6f8f7; font-size: 11px; font-weight: 650; white-space: nowrap; }
.comparison-header { white-space: normal; line-height: 1.2; }
.comparison-header span, .comparison-header small { display: block; }
.comparison-header small { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 400; white-space: nowrap; }
.sort-header { display: inline-flex; align-items: center; gap: 5px; width: 100%; min-height: 28px; padding: 0; color: inherit; background: transparent; border: 0; border-radius: 0; font: inherit; text-align: left; white-space: nowrap; }
.sort-header:hover { color: var(--ink); background: transparent; }
.num .sort-header { justify-content: flex-end; }
.comparison-header .sort-header { align-items: flex-end; white-space: normal; }
.sort-header i { width: 10px; color: #87928d; font-size: 11px; font-style: normal; line-height: 1; text-align: center; }
th[aria-sort="ascending"] .sort-header, th[aria-sort="descending"] .sort-header { color: var(--ink); }
th[aria-sort="ascending"] .sort-header i, th[aria-sort="descending"] .sort-header i { color: var(--green); font-weight: 800; }
tbody tr:hover { background: #f8faf9; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.attribute-cell { color: var(--muted); font-size: 12px; }
.product-identity { display: grid; grid-template-columns: 52px minmax(150px, 1fr); gap: 9px; align-items: center; min-width: 250px; }
.product-identity strong, .product-identity span, .product-identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-identity span { color: var(--ink); font-size: 12px; }
.product-identity small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.product-thumb { width: 52px; height: 52px; display: inline-flex; align-items: center; justify-content: center; padding: 3px; overflow: hidden; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 4px; font-size: 10px; }
.product-thumb:hover { border-color: var(--green); }
.product-thumb img { width: 100%; height: 100%; object-fit: contain; }
.product-thumb.placeholder { background: #f1f5f3; }
.sparkline { width: 118px; height: 36px; display: block; }
.sparkline line { stroke: #c8d3ce; stroke-width: 1; }
.sparkline polyline { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shop-summary { display: grid; gap: 2px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.shop-summary b { color: var(--ink); font-weight: 600; }
.detail-button { width: 30px; height: 30px; padding: 0; color: var(--green); background: transparent; border: 1px solid var(--line-strong); border-radius: 4px; font-size: 22px; line-height: 1; }
.detail-button:hover { color: #fff; background: var(--green); border-color: var(--green); }
.negative { color: var(--red); font-weight: 650; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; min-width: 76px; height: 24px; padding: 0 7px; border-radius: 4px; font-size: 11px; font-weight: 650; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: currentColor; }
.status-pill.oversold { color: #fff; background: var(--red); }
.status-pill.critical { color: #8a4c00; background: var(--amber-soft); border: 1px solid #e9c56f; }
.status-pill.warning { color: #7a5a05; background: #fff6d9; border: 1px solid #ead889; }
.status-pill.normal { color: var(--green); background: var(--green-soft); }
.muted { color: var(--muted); font-size: 11px; }
.empty-state { padding: 28px 16px; color: var(--muted); text-align: center; }

.table-section { padding-top: 0; }
.sku-filters { position: sticky; top: var(--chrome-height, 125px); z-index: 35; grid-template-columns: minmax(280px, 1.7fr) repeat(3, minmax(150px, 1fr)) auto; box-shadow: 0 8px 20px rgba(18, 40, 34, .1); }
.sku-filters .search-field { grid-column: auto; }
.sku-table { min-width: 1420px; }
.weekly-delta { display: block; font-weight: 650; font-variant-numeric: tabular-nums; }
.weekly-delta.increase { color: var(--red); }
.weekly-delta.decrease { color: var(--green); }
.new-oversold-badge { display: inline-block; margin-top: 3px; padding: 2px 5px; color: #fff; background: var(--red); border-radius: 3px; font-size: 10px; white-space: nowrap; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); }
.page-button { min-width: 34px; height: 32px; padding: 0 9px; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: 4px; }
.page-button:disabled { cursor: default; opacity: .45; }

.quality-list { border-top: 1px solid var(--line); }
.quality-row { display: grid; grid-template-columns: 150px 90px minmax(180px, .7fr) minmax(300px, 1.3fr); gap: 18px; align-items: center; min-height: 68px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.quality-source { font-weight: 650; }
.quality-coverage, .quality-detail { color: var(--muted); }
.source-state { width: fit-content; min-width: 62px; padding: 4px 7px; text-align: center; border-radius: 4px; font-size: 11px; font-weight: 650; }
.source-state.ready { color: var(--green); background: var(--green-soft); }
.source-state.partial { color: #765000; background: var(--amber-soft); }
.source-state.missing { color: var(--red); background: var(--red-soft); }
.rule-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 10px; }
.rule-item { min-height: 106px; padding: 14px; background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--green); }
.rule-item.warning { border-top-color: var(--amber); }
.rule-item.critical, .rule-item.oversold { border-top-color: var(--red); }
.rule-item strong { display: block; margin-bottom: 7px; }
.rule-item p { color: var(--muted); }

.detail-dialog, .image-dialog { width: min(780px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 24px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--paper); }
.detail-dialog::backdrop, .image-dialog::backdrop { background: rgba(23, 35, 32, .62); }
.dialog-close { position: absolute; top: 7px; right: 8px; width: 32px; height: 32px; padding: 0; color: var(--muted); background: transparent; border: 0; font-size: 24px; line-height: 1; }
.dialog-close:hover { color: var(--ink); background: #f1f5f3; }
.detail-head { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; align-items: center; padding-right: 28px; }
.detail-head .product-thumb { width: 96px; height: 96px; }
.detail-head h2 { margin: 5px 0 3px; }
.detail-head p { color: var(--muted); font-size: 12px; }
.detail-status { min-height: 24px; }
.detail-metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 20px 0; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-metrics span { display: block; color: var(--muted); font-size: 11px; }
.detail-metrics strong { display: block; margin-top: 4px; font-size: 18px; font-variant-numeric: tabular-nums; }
.detail-section { margin-top: 18px; }
.detail-trend { display: block; width: 100%; height: auto; min-height: 150px; border: 1px solid var(--line); }
.detail-trend polyline { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.detail-trend circle { fill: var(--paper); stroke: var(--blue); stroke-width: 1.5; }
.detail-shops { display: grid; gap: 10px; }
.detail-shops > div { display: grid; grid-template-columns: 110px minmax(120px, 1fr) 54px; gap: 10px; align-items: center; font-size: 12px; }
.detail-shop-track { height: 10px; overflow: hidden; background: #e7efeb; border-radius: 2px; }
.detail-shop-track i { display: block; height: 100%; background: var(--green); }
.image-dialog { width: min(720px, calc(100vw - 32px)); padding: 42px 20px 16px; }
.image-dialog img { display: block; width: auto; max-width: 100%; max-height: calc(100vh - 150px); margin: 0 auto; object-fit: contain; }
.image-dialog-caption { margin-top: 10px; color: var(--muted); text-align: center; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 10; display: none; max-width: 360px; padding: 11px 14px; color: #fff; background: var(--charcoal); border-radius: 5px; box-shadow: 0 8px 28px rgba(18, 35, 31, .2); }
.toast.visible { display: block; }
.toast.error { background: var(--red); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .overview-filters { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .trend-row, .analysis-row { grid-template-columns: 1fr; }
  .sku-filters { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .sku-filters .search-field { grid-column: 1 / -1; }
  .quality-row { grid-template-columns: 130px 90px minmax(140px, .7fr) minmax(220px, 1.3fr); }
}

@media (max-width: 720px) {
  body { font-size: 13px; }
  .app-header { align-items: flex-start; flex-direction: column; gap: 12px; padding: 14px 16px; }
  .header-actions { width: 100%; justify-content: flex-start; }
  .freshness { order: 3; width: 100%; }
  .tabs { padding: 0 12px; }
  main { padding: 14px 14px 34px; }
  .dashboard-intro { align-items: flex-start; flex-direction: column; gap: 5px; }
  .dashboard-intro > p { text-align: left; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .kpi-card { min-height: 94px; padding: 13px; }
  .kpi-value { font-size: 23px; }
  .filter-bar, .sku-filters { grid-template-columns: 1fr 1fr; }
  .filter-bar > label, .sku-filters > label, .sku-filters .search-field { grid-column: auto; min-width: 0; }
  .filter-bar .result-count { grid-column: 1 / -1; justify-self: start; }
  .search-field { min-width: 0; }
  .icon-button { align-self: end; }
  .trend-chart, .quadrant-chart { aspect-ratio: 1.35; min-height: 230px; overflow-x: auto; }
  .trend-chart svg, .quadrant-chart svg { min-width: 620px; height: 100%; }
  .heatmap-grid { grid-template-columns: 54px repeat(3, minmax(78px, 1fr)); }
  .heat-cell { min-height: 76px; padding: 5px; }
  .heat-cell strong { font-size: 21px; }
  .shop-row { grid-template-columns: 112px minmax(100px, 1fr) 86px; gap: 8px; }
  .shop-value { display: block; }
  .shop-value span { display: block; margin-top: 2px; }
  .quality-row { grid-template-columns: 1fr auto; gap: 7px 12px; padding: 14px 0; }
  .quality-coverage, .quality-detail { grid-column: 1 / -1; }
  .rule-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-dialog { padding: 20px 16px; }
  .detail-metrics { grid-template-columns: repeat(3, 1fr); row-gap: 13px; }
  .detail-metrics strong { font-size: 16px; }
}

@media (max-width: 430px) {
  h1 { font-size: 17px; }
  .brand-mark { width: 36px; height: 36px; flex-basis: 36px; }
  .button { flex: 1 1 auto; padding: 0 10px; }
  .filter-bar, .sku-filters { grid-template-columns: 1fr; }
  .filter-bar > label, .sku-filters > label, .sku-filters .search-field, .filter-bar .result-count { grid-column: auto; }
  .icon-button { width: 100%; }
  .date-filter-menu { left: auto; right: 0; }
  .date-days { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-left: 22px; }
  .rule-grid { grid-template-columns: 1fr; }
  .detail-head { grid-template-columns: 70px minmax(0, 1fr); }
  .detail-head .product-thumb { width: 70px; height: 70px; }
}
