/* Dashboard layout: local styles, shared data hooks stay in dashboard-ui.js. */
:root {
  --bg-app: #f3f7fc;
  --sidebar-bg: #172b43;
  --sidebar-hover: #223c57;
  --sidebar-active: #1768f5;
  --border-color: #e0e9f3;
  --text-primary: #101b34;
  --text-muted: #667993;
  --danger-red: #e83f52;
  --success-green: #09977d;
}
body { color: var(--text-primary); }
button, input, select, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #8fbaff;
  outline-offset: 3px;
}
.app-sidebar { width: 198px; background: linear-gradient(180deg, #172b43 0%, #1a2e46 100%); border-right: 1px solid #263e58; }
.brand { height: 89px; padding: 0 20px; gap: 11px; border-bottom: 0; flex-wrap: wrap; align-content: center; }
.brand-logo { width: 31px; height: 34px; background: transparent; border: 1.5px solid #e5edf7; border-radius: 7px; font-size: 20px; transform: rotate(-5deg); }
.brand-text { font-size: 23px; font-weight: 700; letter-spacing: 1px; }
.brand-tag { display: none; }
.nav-group { color: #7e93aa; padding: 20px 20px 8px; font-size: 10px; letter-spacing: 1.4px; }
.nav-group:first-of-type { padding-top: 7px; }
.nav-item { min-height: 48px; margin: 4px 10px; padding: 11px 13px; gap: 12px; border-radius: 7px; color: #c4d1e2; font-size: 14px; }
.nav-item.active { background: #1466f4; box-shadow: 0 5px 14px #05296942; }
.nav-icon { width: 22px; font-size: 22px; line-height: 1; color: inherit; }
.scope-control { padding: 18px 18px 2px; }
.scope-control label { display: block; margin-bottom: 7px; color: #8fa4bb; font-size: 11px; }
.scope-control select { width: 100%; height: 34px; background: #223951; border: 1px solid #3b5068; color: #e6edf6; font-size: 12px; }
.scope-control select:disabled { opacity: .75; }
#sidebar-db-box { background: #223951 !important; border-color: #3b5068 !important; margin: 18px 14px !important; padding: 11px 10px !important; }
#sidebar-db-box #sidebar-db-title, #sidebar-db-box #sidebar-db-status, #sidebar-db-box #sidebar-db-badge { color: #a8bcd2 !important; }
.user-footer { margin: auto 14px 0; padding: 17px 2px; border-color: #3a4d63; }
.user-avatar { width: 29px; height: 29px; background: #365777; font-size: 12px; }
.user-role { color: #92a6bd; }
.app-body { min-width: 0; background: radial-gradient(ellipse at 85% 8%, #f9fcff, transparent 65%), #f2f7fc; }
.app-topbar { min-height: 98px; height: auto; gap: 20px; padding: 18px 26px 15px; background: transparent; border-bottom: 0; align-items: center; }
.top-left { display: block; min-width: 190px; flex: 1 1 auto; }
.page-title { font-size: 28px; font-weight: 750; letter-spacing: -.5px; line-height: 1.3; }
.page-subtitle { margin-top: 5px; color: #667a95; font-size: 13px; letter-spacing: .4px; }
.top-right { gap: 14px; align-items: flex-end; }
.dashboard-dates, .header-actions, .export-actions { display: flex; align-items: flex-end; gap: 10px; }
.date-control { display: flex; flex-direction: column; gap: 5px; }
.control-eyebrow { font-size: 10px; color: #7587a0; letter-spacing: .5px; }
.date-control .text-input, .date-control .select-input { height: 37px; border-color: #ccd9e9; color: #263651; background: #fff; font-size: 13px; padding: 0 10px; }
.date-control input { width: 151px; }
.date-control select { width: 141px; }
.btn { height: 37px; border-radius: 6px; font-size: 13px; white-space: nowrap; }
.btn-primary { background: #1265f6; border-color: #1265f6; }
.btn-primary:hover { background: #0854db; }
.btn-export { border-color: #8fb3f4; color: #1260e4; font-weight: 600; }
.btn-export:hover { background: #edf4ff; }
.export-actions { gap: 0; }
.export-actions .btn-export { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-export-csv { border-color: #b8cbeb; border-left: 0; color: #5275a9; padding: 0 9px; font-size: 11px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.main-content { padding: 0 26px 32px; }
#tab-dashboard { max-width: 1680px; margin: 0 auto; }
.dashboard-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding: 12px 16px; border: 1px solid var(--border-color); background: #ffffffed; border-radius: 7px; }
.filter-field { display: flex; align-items: center; gap: 9px; font-weight: 500; color: #24334e; }
.filter-field .select-input { min-width: 106px; height: 34px; border-color: #cfdbec; font-size: 12px; color: #253753; }
.dashboard-search { display: flex; align-items: center; height: 34px; min-width: 155px; width: 225px; gap: 9px; padding: 0 11px; border: 1px solid #cfdbec; border-radius: 6px; color: #8597b0; background: white; }
.dashboard-search:focus-within { border-color: #2563eb; box-shadow: 0 0 0 3px #2563eb13; }
.dashboard-search .text-input { width: 100%; min-width: 0; height: 30px; padding: 0; border: 0; color: #263651; background: transparent; }
.dashboard-search .text-input:focus-visible { outline: none; }
.dashboard-search svg { flex: 0 0 17px; }
.dashboard-search input::placeholder { color: #7b8da7; }
.loss-filter { display: flex; align-items: center; gap: 7px; white-space: nowrap; color: #435574; font-size: 12px; cursor: pointer; }
.loss-filter input { width: 15px; height: 15px; accent-color: #1666ec; cursor: pointer; }
.loss-filter:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.dashboard-scope-status { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 12px; color: #6b7f99; white-space: nowrap; }
.archive-state, .chip { display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; padding: 3px 10px; font-size: 11px; line-height: 1.6; font-weight: 600; background: #eaf0f8; color: #61758e; }
.archive-state[data-state="ready"] { color: #147766; background: #d9f4e9; }
.archive-state[data-state="draft"] { color: #976015; background: #fff0ce; }
.archive-state[data-state="error"] { color: #bb3547; background: #ffe8ec; }
.accounting-note { display: flex; align-items: center; gap: 10px; margin-top: 9px; padding: 9px 14px; border-radius: 6px; background: #e4f1ff; color: #1767dc; font-size: 12px; }
.info-mark { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; flex: 0 0 16px; background: #1b70f6; color: white; border-radius: 50%; font-family: Georgia, serif; font-weight: bold; font-size: 12px; }
.dashboard-data-status { margin: 8px 2px 12px; color: #71829a; font-size: 11px; line-height: 1.5; }
.dashboard-data-status[data-state="error"] { color: #b33345; }
.dashboard-update-banner { margin-bottom: 12px; padding: 10px 14px; background: #e8f8ef; border: 1px solid #b4e4c7; border-radius: 7px; color: #166534; font-size: 12px; justify-content: space-between; align-items: center; }
.banner-close { background: transparent; border: 0; padding: 0 4px; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.kpi-grid { gap: 14px; margin-bottom: 16px; }
.kpi-card { min-width: 0; padding: 18px 20px 15px; border-color: #e1eaf5; border-radius: 7px; box-shadow: none; }
.kpi-card::before { display: none; }
.kpi-label { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; color: #16233e; font-size: 14px; font-weight: 650; }
.kpi-icon { display: flex; align-items: center; justify-content: center; width: 27px; height: 29px; flex: 0 0 27px; border-radius: 7px; }
.kpi-icon svg { width: 21px; height: 21px; }
.kpi-icon.blue { background: #e7f0ff; color: #1266f8; }
.kpi-icon.green { background: #e4f5f0; color: #0a9b82; }
.kpi-icon.orange { background: #fff1e0; color: #f29a28; }
.kpi-icon.red { background: #ffe9ec; color: #f14d5e; }
.kpi-val { font-size: clamp(24px, 2.3vw, 36px); font-weight: 750; letter-spacing: -.7px; line-height: 1.25; margin-bottom: 8px; font-variant-numeric: tabular-nums; color: #111b31; overflow-wrap: anywhere; }
.kpi-val.text-success { color: #075c4e; }
.kpi-val.text-danger { color: #d2384b; }
.kpi-sub { min-height: 18px; font-size: 11px; color: #71819a; line-height: 1.6; }
.loss-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.loss-total strong { color: #e53f50; font-size: 15px; font-variant-numeric: tabular-nums; }
.card { min-width: 0; padding: 17px 18px; border-radius: 7px; border-color: #e1eaf5; box-shadow: none; }
.card-header { align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.card-title { font-size: 17px; font-weight: 700; letter-spacing: -.1px; line-height: 1.4; }
.card-description { margin-top: 4px; color: #7788a1; font-size: 11px; line-height: 1.5; }
.dashboard-charts { display: grid; grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr); gap: 14px; margin-bottom: 16px; }
.chart-unit { color: #8594aa; font-size: 10px; white-space: nowrap; padding-top: 4px; }
.loss-chart { min-height: 218px; padding: 6px 0 4px; }
.loss-row { display: grid; grid-template-columns: minmax(82px, 1fr) minmax(70px, 2fr) minmax(73px, auto); align-items: center; gap: 12px; width: 100%; min-height: 38px; padding: 5px 0; background: transparent; border: 0; border-radius: 4px; text-align: left; cursor: pointer; font-size: 12px; color: #34435e; }
.loss-row:hover { background: #fff8f9; }
.loss-row:focus-visible { outline-offset: 1px; }
.loss-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loss-track { display: flex; justify-content: flex-end; align-items: center; height: 24px; border-right: 1px solid #9eaabd; background: repeating-linear-gradient(to left, #f1f4f8 0 1px, transparent 1px 25%); }
.loss-bar { display: block; height: 17px; background: linear-gradient(90deg, #ff6b76, #f64054); border-radius: 2px 0 0 2px; }
.loss-value { text-align: right; white-space: nowrap; color: #e5384b; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.loss-axis-note { margin-top: 12px; font-size: 11px; color: #71829b; line-height: 1.6; }
.chart-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: #677a94; font-size: 10px; }
.chart-legend > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend-swatch { display: inline-block; width: 10px; height: 10px; flex: 0 0 10px; border-radius: 1px; background: #95a4ba; }
.legend-swatch.sales { background: #3287fb; }
.legend-swatch.deduction { background: #ff967c; }
.legend-swatch.estimated { background: #fff3e8; border: 1px dashed #eaa56d; }
.legend-swatch.profit { background: #2fc1ac; }
.legend-swatch.ads { background: #f59e0b; }
.waterfall-card .card-header { flex-wrap: wrap; }
.waterfall-scroll { width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.waterfall-scroll svg { display: block; width: 100%; min-width: 560px; max-height: 254px; }
.chart-empty { min-height: 202px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; color: #8090a7; font-size: 12px; line-height: 1.8; padding: 24px 16px; text-align: center; border: 1px dashed #e2e9f2; border-radius: 6px; background: #fbfdff; }
.chart-footnote { margin-top: 9px; color: #71829b; font-size: 10px; line-height: 1.7; }
.chart-footnote span { color: #c5d0df; margin: 0 3px; }
.cost-details { margin-top: 8px; border-top: 1px solid #edf1f7; padding-top: 7px; }
.cost-details summary { display: list-item; color: #687f9d; font-size: 10px; cursor: pointer; width: fit-content; }
.cost-details summary::marker { color: #96a7bd; }
.cost-values { margin-top: 9px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.cost-values div { display: flex; justify-content: space-between; gap: 10px; color: #6e7d92; font-size: 11px; }
.cost-values dd { color: #34465f; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.detail-note { margin-top: 9px; color: #8592a4; font-size: 10px; line-height: 1.5; }
.dashboard-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 228px; align-items: start; gap: 14px; margin-bottom: 16px; }
.dashboard-table { min-width: 0; border-color: #e1eaf5; border-radius: 7px; box-shadow: none; }
.dashboard-table .table-toolbar { padding: 15px 17px 12px; border-bottom: 0; }
.table-scroll-hint { color: #94a2b5; font-size: 10px; }
.store-table-scroll { overflow: auto; max-height: 460px; overscroll-behavior-x: contain; scrollbar-width: thin; border-top: 1px solid #e5edf7; }
.dashboard-table table { min-width: 1060px; border-collapse: separate; border-spacing: 0; font-size: 11px; }
.dashboard-table th { position: sticky; top: 0; z-index: 2; height: 40px; background: #eef4fb; border-bottom: 1px solid #dce6f3; padding: 10px 12px; font-size: 11px; color: #344967; }
.dashboard-table td { padding: 12px; border-bottom: 1px solid #edf2f8; background: #fff; height: 45px; }
.dashboard-table th:first-child, .dashboard-table td:first-child:not([colspan]) { position: sticky; left: 0; min-width: 210px; max-width: 265px; border-right: 1px solid #e7eef7; box-shadow: 4px 0 8px #1b3a6404; }
.dashboard-table th:first-child { z-index: 3; }
.dashboard-table td:first-child:not([colspan]) { z-index: 1; white-space: normal; }
.dashboard-table td:first-child strong { display: inline-block; max-width: 230px; overflow-wrap: anywhere; font-weight: 600; }
.dashboard-table td:first-child .badge { margin: 4px 0 0 4px; font-size: 9px; }
.dashboard-table tbody tr:hover td { background: #f5f9ff; }
.dashboard-table tbody tr:last-child td { border-bottom: 0; }
.dashboard-table .text-danger { color: #e14253; }
.dashboard-table .text-success { color: #078d73; }
.sort-arrow { color: #9babc1; font-size: 10px; }
.quality-card { padding: 17px 15px; }
.quality-card .card-header { align-items: center; margin-bottom: 15px; }
.quality-indicator { width: 6px; height: 6px; background: #9cb5d2; border-radius: 50%; }
.quality-values { border: 1px solid #e0e9f4; border-radius: 6px; }
.quality-values > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 45px; padding: 10px 11px; border-bottom: 1px solid #e9eff6; }
.quality-values > div:last-child { border-bottom: 0; }
.quality-values dt { font-size: 11px; color: #445570; }
.quality-values dd { font-size: 17px; font-weight: 650; color: #1767ee; font-variant-numeric: tabular-nums; white-space: nowrap; }
.quality-note { margin-top: 17px; color: #788aa3; font-size: 11px; line-height: 1.8; overflow-wrap: anywhere; }
.secondary-analysis { border: 1px solid #e1eaf5; border-radius: 7px; background: #ffffffb3; }
.secondary-analysis > summary { display: flex; align-items: center; gap: 12px; padding: 14px 17px; color: #465d7e; cursor: pointer; list-style: none; font-size: 12px; font-weight: 600; }
.secondary-analysis > summary::-webkit-details-marker { display: none; }
.secondary-analysis > summary::after { content: '+'; margin-left: auto; font-size: 18px; line-height: 1; color: #8094af; font-weight: 400; }
.secondary-analysis[open] > summary::after { content: '−'; }
.secondary-summary-note { font-weight: 400; font-size: 10px; color: #8b9aaf; }
.secondary-grid { padding: 0 14px 14px; margin-bottom: 0; gap: 14px; }
.secondary-grid .card { background: #fff; }
.comparison-row { grid-template-columns: 115px minmax(0, 1fr); }
.rank-name { flex-shrink: 0; }
.rank-val { font-variant-numeric: tabular-nums; }
@media (min-width: 1700px) { .app-topbar { padding-right: 36px; padding-left: 36px; } .main-content { padding-right: 36px; padding-left: 36px; } }
@media (max-width: 1380px) {
  .app-topbar { flex-wrap: wrap; gap: 12px; padding-top: 17px; }
  .top-left { min-width: 215px; }
  .page-title { font-size: 25px; }
  .top-right { gap: 10px; }
  .dashboard-dates { gap: 8px; }
  .dashboard-filters { gap: 10px 14px; }
  .dashboard-search { width: 190px; }
  .dashboard-scope-status { gap: 8px; }
  .kpi-card { padding: 16px 16px 14px; }
  .kpi-label { font-size: 13px; gap: 8px; }
  .kpi-val { font-size: clamp(23px, 2.3vw, 32px); }
  .dashboard-charts { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
  .loss-row { gap: 8px; grid-template-columns: minmax(70px, 1fr) minmax(50px, 1.5fr) minmax(70px, auto); font-size: 11px; }
  .loss-value { font-size: 11px; }
  .chart-legend { gap: 7px 9px; }
  .dashboard-detail-grid { grid-template-columns: minmax(0, 1fr) 205px; }
  .quality-values > div { padding: 10px 9px; }
}
@media (max-width: 1120px) {
  .app-sidebar { width: 176px; }
  .brand { padding: 0 16px; }
  .brand-text { font-size: 20px; }
  .nav-item { font-size: 12px; padding: 10px; gap: 8px; }
  .nav-icon { font-size: 20px; }
  .app-topbar { padding: 17px 20px 14px; }
  .top-right { flex: 1 1 100%; justify-content: space-between; }
  .main-content { padding-right: 20px; padding-left: 20px; }
  .dashboard-filters { gap: 10px 13px; }
  .dashboard-scope-status { margin-left: 0; }
  .dashboard-search { flex: 1; min-width: 165px; }
  .dashboard-charts { grid-template-columns: 1fr; }
  .loss-chart { min-height: 210px; }
  .loss-row { grid-template-columns: minmax(110px, 1fr) minmax(90px, 3fr) minmax(80px, auto); }
  .waterfall-card .card-header { flex-wrap: nowrap; }
  .dashboard-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .quality-card { display: grid; grid-template-columns: 115px minmax(0, 1fr); column-gap: 14px; }
  .quality-card .card-header { align-self: center; margin-bottom: 0; }
  .quality-values { display: grid; grid-template-columns: repeat(3, 1fr); }
  .quality-values > div { flex-direction: column; align-items: flex-start; min-height: 67px; border-bottom: 0; border-right: 1px solid #e9eff6; gap: 3px; }
  .quality-values > div:last-child { border-right: 0; }
  .quality-note { grid-column: 2; margin-top: 8px; }
}
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-val { font-size: 31px; }
  .secondary-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  #main-app { flex-direction: column; height: 100dvh; }
  .app-sidebar { width: 100%; flex-direction: row; flex-wrap: nowrap; align-items: center; padding: 5px 6px; overflow-x: auto; border-right: 0; border-bottom: 1px solid #29415c; min-height: 48px; scrollbar-width: none; }
  .app-sidebar::-webkit-scrollbar { display: none; }
  .app-sidebar .brand, .app-sidebar .nav-group, .app-sidebar #sidebar-db-box, .app-sidebar .user-info, .scope-control { display: none !important; }
  .nav-item { flex: 0 0 auto; min-height: 35px; padding: 8px 9px; margin: 0 2px; font-size: 11px; gap: 5px; white-space: nowrap; border-radius: 5px; }
  .nav-icon { font-size: 15px; width: 15px; }
  .user-footer { margin: 0 0 0 auto; padding: 5px; border: 0; flex: 0 0 auto; }
  .btn-logout { font-size: 12px; }
  .app-topbar { padding: 16px 14px 13px; gap: 12px; }
  .top-left { min-width: 0; }
  .page-title { font-size: 23px; line-height: 1.35; }
  .page-subtitle { font-size: 11px; margin-top: 3px; }
  .top-right { flex-wrap: wrap; gap: 11px; }
  .dashboard-dates { gap: 8px; flex: 1; }
  .date-control { flex: 1; min-width: 0; }
  .date-control .text-input, .date-control .select-input { width: 100%; min-width: 0; height: 35px; font-size: 12px; }
  .header-actions { flex: 0 0 auto; gap: 8px; }
  .btn { height: 35px; font-size: 12px; padding: 0 11px; }
  .btn-export-csv { font-size: 10px; padding: 0 8px; }
  .control-eyebrow { font-size: 10px; }
  .main-content { padding: 0 12px 24px; }
  .dashboard-filters { gap: 10px 12px; padding: 12px; }
  .filter-field { flex: 1; min-width: calc(50% - 6px); font-size: 11px; gap: 7px; }
  .filter-field .select-input { flex: 1; width: 100%; min-width: 0; height: 33px; font-size: 11px; }
  .dashboard-search { flex: 1; width: auto; min-width: 130px; height: 33px; }
  .dashboard-search .text-input { font-size: 12px; }
  .loss-filter { font-size: 11px; gap: 6px; }
  .dashboard-scope-status { width: 100%; justify-content: space-between; border-top: 1px solid #edf2f8; padding-top: 9px; font-size: 11px; }
  .archive-state { font-size: 10px; padding: 2px 8px; }
  .accounting-note { align-items: flex-start; gap: 8px; padding: 9px 11px; font-size: 11px; line-height: 1.65; }
  .info-mark { margin-top: 2px; }
  .dashboard-data-status { font-size: 10px; margin: 7px 1px 11px; }
  .kpi-grid { gap: 10px; margin-bottom: 12px; }
  .kpi-card { padding: 14px 12px 12px; }
  .kpi-label { font-size: 12px; gap: 7px; margin-bottom: 9px; }
  .kpi-icon { width: 23px; height: 25px; flex-basis: 23px; border-radius: 6px; }
  .kpi-icon svg { width: 18px; height: 18px; }
  .kpi-val { font-size: clamp(20px, 5.4vw, 30px); margin-bottom: 7px; letter-spacing: -.5px; }
  .kpi-sub { font-size: 10px; }
  .loss-total { gap: 5px; }
  .loss-total strong { font-size: 12px; }
  .dashboard-charts { gap: 12px; margin-bottom: 12px; }
  .card { padding: 15px 13px; }
  .card-title { font-size: 15px; }
  .card-description { font-size: 10px; }
  .card-header { margin-bottom: 12px; }
  .loss-chart { min-height: 205px; padding-top: 2px; }
  .loss-row { gap: 8px; min-height: 38px; grid-template-columns: minmax(82px, 1.2fr) minmax(48px, 1.8fr) minmax(72px, auto); }
  .loss-track { height: 23px; }
  .loss-bar { height: 16px; }
  .waterfall-card .card-header { flex-wrap: wrap; }
  .chart-legend { font-size: 9px; gap: 7px 12px; }
  .chart-footnote { font-size: 9px; }
  .cost-values { grid-template-columns: 1fr; }
  .chart-empty { min-height: 192px; font-size: 11px; }
  .dashboard-detail-grid { gap: 12px; margin-bottom: 12px; }
  .dashboard-table .table-toolbar { padding: 13px 13px 11px; gap: 7px; }
  .table-scroll-hint { font-size: 9px; }
  .store-table-scroll { max-height: 390px; }
  .dashboard-table table { min-width: 1000px; }
  .dashboard-table th, .dashboard-table td { padding: 10px; font-size: 10px; }
  .dashboard-table th:first-child, .dashboard-table td:first-child:not([colspan]) { min-width: 128px; max-width: 150px; width: 150px; }
  .dashboard-table td:first-child strong { max-width: 128px; }
  .dashboard-table td:first-child .badge { display: table; margin: 4px 0 0; }
  .quality-card { display: block; padding: 14px 13px; }
  .quality-card .card-header { margin-bottom: 11px; }
  .quality-values > div { align-items: center; text-align: center; padding: 10px 4px; gap: 4px; }
  .quality-values dt { font-size: 10px; }
  .quality-values dd { font-size: 17px; }
  .quality-note { margin-top: 11px; font-size: 10px; }
  .secondary-analysis > summary { padding: 13px; gap: 7px; font-size: 11px; flex-wrap: wrap; }
  .secondary-summary-note { font-size: 9px; }
  .secondary-grid { padding: 0 10px 10px; gap: 10px; }
  .comparison-row { grid-template-columns: 90px minmax(0, 1fr); gap: 10px; }
  .comparison-name, .comparison-values { font-size: 10px; }
  .rank-row { gap: 8px; font-size: 10px; }
  .rank-name { width: 60px; }
  .rank-val { width: 78px; }
}
@media (max-width: 540px) {
  .top-right { display: block; }
  .dashboard-dates { width: 100%; margin-bottom: 11px; }
  .header-actions { justify-content: flex-end; }
  .header-actions #top-upload-button { margin-left: auto; }
  .kpi-label { gap: 6px; font-size: 11px; }
  .kpi-icon { width: 21px; height: 23px; flex-basis: 21px; }
  .kpi-val { font-size: clamp(18px, 5.1vw, 26px); }
  .kpi-card { padding: 13px 11px; }
  .kpi-sub { font-size: 9px; }
  .loss-value { font-size: 10px; }
  .loss-row { grid-template-columns: minmax(78px, 1.2fr) minmax(45px, 1.6fr) minmax(68px, auto); gap: 7px; font-size: 10px; }
  .table-scroll-hint { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
