/* Chỉ áp dụng trong dashboard; không thay đổi form nhập, auth hoặc trang admin. */
#tab-dashboard { --dash-border: #243147; --dash-panel: #101a2c; --dash-muted: #92a2b8; max-width: 1960px; margin-inline: auto; }
#tab-dashboard [hidden] { display: none !important; }
#tab-dashboard .dash-heading { display: flex; justify-content: space-between; gap: 18px; align-items: start; padding-bottom: 2px; }
#tab-dashboard .dash-eyebrow { color: #7dd3fc; font-size: 10px; font-weight: 700; letter-spacing: .16em; margin-bottom: 5px; }
#tab-dashboard h2 { color: #f8fafc; font-size: 24px; font-weight: 750; letter-spacing: -.025em; }
#tab-dashboard .dash-subtitle { color: var(--dash-muted); font-size: 12px; margin-top: 5px; }
#tab-dashboard #dashboardStatus { flex-shrink: 0; font-size: 11px; padding: 8px 11px; border: 1px solid #26435b; color: #7dd3fc; border-radius: 999px; margin-top: 5px; }
#tab-dashboard #dashboardStatus[data-state="error"] { color: #fda4af; border-color: #7f1d1d; }
#tab-dashboard .dash-filter-panel, #tab-dashboard .dash-panel { background: var(--dash-panel); border: 1px solid var(--dash-border); border-radius: 16px; }
#tab-dashboard .dash-filter-panel { padding: 16px 18px; }
#tab-dashboard .dash-filters { display: grid; grid-template-columns: .7fr 1.4fr 1fr 1fr 1fr auto; gap: 12px; align-items: end; }
#tab-dashboard .dash-field { min-width: 0; }
#tab-dashboard .dash-field label { font-size: 11px; color: #aab8ca; font-weight: 600; display: block; margin-bottom: 7px; }
#tab-dashboard .dash-input { width: 100%; min-width: 0; height: 38px; padding: 0 10px; background: #172338; border: 1px solid #304057; border-radius: 9px; color: #e2e8f0; font-size: 12px; color-scheme: dark; }
#tab-dashboard .dash-input:focus { outline: 2px solid #38bdf8; outline-offset: 1px; }
#tab-dashboard .dash-input:disabled { opacity: .7; }
#tab-dashboard .dash-period-inputs { display: flex; gap: 8px; align-items: end; }
#tab-dashboard .dash-period-inputs > .dash-field { flex: 1; }
#tab-dashboard .dash-filter-actions { display: flex; gap: 7px; }
#tab-dashboard .dash-button { background: #1b2b43; border: 1px solid #32465f; padding: 0 12px; height: 38px; border-radius: 9px; font-size: 11px; font-weight: 600; color: #cbd5e1; white-space: nowrap; }
#tab-dashboard .dash-button:hover { background: #253956; }
#tab-dashboard .dash-button:focus-visible { outline: 2px solid #38bdf8; }
#tab-dashboard .dash-button:disabled { opacity: .55; cursor: wait; }
#tab-dashboard .dash-button-primary { background: #123a55; color: #7dd3fc; border-color: #246486; }
#tab-dashboard .dash-period-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 12px; margin-top: 14px; border-top: 1px solid var(--dash-border); font-size: 11px; color: #9cabc0; }
#tab-dashboard #dashboardPeriodLabel { color: #e2e8f0; font-weight: 600; }
#tab-dashboard .dash-period-note { color: #7c90ac; font-size: 10px; margin-top: 7px; line-height: 1.5; }
#tab-dashboard .dash-banner { background: #422233; border: 1px solid #78314f; color: #fecdd3; padding: 12px 16px; border-radius: 12px; font-size: 12px; }
#tab-dashboard .dash-kpi-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
#tab-dashboard .dash-kpi { background: linear-gradient(135deg,#111d31,#0f182a); border: 1px solid var(--dash-border); border-radius: 14px; padding: 18px; min-height: 136px; }
#tab-dashboard .dash-kpi.dash-kpi-primary { background: linear-gradient(135deg,#10324a,#111d31); border-color: #235675; }
#tab-dashboard .dash-kpi-label { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; font-weight: 650; color: #9fb0c7; display: flex; gap: 8px; justify-content: space-between; }
#tab-dashboard .dash-kpi-label i { color: #7dd3fc; font-size: 13px; }
#tab-dashboard .dash-kpi-value { color: #f1f5f9; font-size: clamp(21px,1.55vw,29px); font-weight: 750; letter-spacing: -.02em; margin-top: 12px; line-height: 1.2; overflow-wrap: anywhere; }
#tab-dashboard .dash-kpi-name { font-size: 17px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-dashboard .dash-kpi-detail { font-size: 11px; color: var(--dash-muted); margin-top: 9px; line-height: 1.5; }
#tab-dashboard [data-tone="warning"] { color: #fdba74; }
#tab-dashboard [data-tone="positive"] { color: #6ee7b7; }
#tab-dashboard [data-tone="neutral"] { color: #aab8ca; }
#tab-dashboard #dashboardBranchMini { display: grid; gap: 7px; margin-top: 11px; }
#tab-dashboard .dash-branch-mini { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; color: #cbd5e1; }
#tab-dashboard .dash-branch-mini span { display: flex; align-items: center; gap: 6px; }
#tab-dashboard .dash-branch-mini i, #tab-dashboard .dash-source-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 999px; flex-shrink: 0; }
#tab-dashboard .dash-branch-mini strong { font-weight: 650; white-space: nowrap; }
#tab-dashboard .dash-chart-row { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; }
#tab-dashboard .dash-trend-row { grid-template-columns: minmax(0,1.8fr) minmax(300px,1fr); }
#tab-dashboard .dash-panel { padding: 20px; min-width: 0; }
#tab-dashboard .dash-panel-title { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
#tab-dashboard h3 { color: #e2e8f0; font-size: 13px; font-weight: 650; }
#tab-dashboard .dash-panel-caption { font-size: 10px; color: #8395af; margin-top: 5px; line-height: 1.5; }
#tab-dashboard .dash-panel-title > span { font-size: 10px; color: #93a4ba; white-space: nowrap; }
#tab-dashboard .dash-trend-selector { max-width: 145px; height: 29px; font-size: 10px; }
#tab-dashboard .dash-chart { position: relative; height: 300px; }
#tab-dashboard .dash-chart-category { height: 330px; }
#tab-dashboard .dash-chart-stack { height: 300px; }
#tab-dashboard .dash-chart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #8194af; font-size: 12px; text-align: center; padding: 20px; }
#tab-dashboard .dash-donut-wrap { max-width: 220px; height: 205px; margin-inline: auto; position: relative; }
#tab-dashboard .dash-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; gap: 4px; }
#tab-dashboard .dash-donut-center small { font-size: 10px; color: #94a3b8; }
#tab-dashboard .dash-donut-center strong { font-size: 20px; font-weight: 750; color: #e2e8f0; }
#tab-dashboard .dash-source-legend { display: grid; gap: 7px; margin-top: 16px; }
#tab-dashboard .dash-source-legend > div { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 12px; align-items: center; font-size: 11px; color: #aab8ca; }
#tab-dashboard .dash-source-legend span { display: flex; align-items: center; gap: 7px; color: #cbd5e1; }
#tab-dashboard .dash-source-legend strong { color: #e2e8f0; font-weight: 600; }
#tab-dashboard .dash-source-legend small { font-size: 10px; color: #8da0b9; }
#tab-dashboard .dash-table-scroll { overflow-x: auto; max-height: 480px; overflow-y: auto; margin-inline: -20px; }
#tab-dashboard .dash-table { width: 100%; border-collapse: collapse; font-size: 11px; color: #c1ccda; text-align: left; }
#tab-dashboard .dash-table th { padding: 11px 14px; background: #152136; color: #94a6bf; font-size: 10px; font-weight: 650; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
#tab-dashboard .dash-table td { padding: 12px 14px; border-bottom: 1px solid #202c40; vertical-align: middle; }
#tab-dashboard .dash-table tr:hover { background: #17233a; }
#tab-dashboard .dash-nowrap, #tab-dashboard .dash-money { white-space: nowrap; }
#tab-dashboard .dash-money { text-align: right; color: #e2e8f0; font-weight: 700; }
#tab-dashboard .dash-money i { color: #fbbf24; font-size: 10px; }
#tab-dashboard .dash-code { color: #7dd3fc; font-family: ui-monospace,monospace; white-space: nowrap; font-size: 10px; }
#tab-dashboard .dash-content { min-width: 150px; max-width: 240px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
#tab-dashboard .dash-creator { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
#tab-dashboard .dash-branch-tag { font-size: 10px; padding: 4px 7px; background: #1a2941; border-radius: 5px; }
#tab-dashboard .dash-unusual { background: #3f2d201f; }
#tab-dashboard .dash-empty-row { text-align: center; padding-block: 36px !important; color: #8395af; }
#tab-dashboard .dash-analysis-row { display: grid; grid-template-columns: minmax(0,1.9fr) minmax(290px,1fr); gap: 18px; }
#tab-dashboard .dash-insights { display: grid; gap: 12px; }
#tab-dashboard .dash-insights li { display: flex; gap: 9px; font-size: 11px; line-height: 1.6; padding-bottom: 12px; border-bottom: 1px solid #243147; }
#tab-dashboard .dash-insights li:last-child { border: 0; }
#tab-dashboard .dash-insights i { margin-top: 4px; flex-shrink: 0; font-size: 11px; }
#tab-dashboard .dash-insight-rule { font-size: 10px; line-height: 1.6; color: #7e92af; border-top: 1px solid #243147; margin-top: 10px; padding-top: 12px; }
#tab-dashboard [aria-busy="true"] .dash-kpi-grid { opacity: .5; }
#tab-dashboard[aria-busy="true"] .dash-kpi-grid, #tab-dashboard[aria-busy="true"] .dash-chart-row, #tab-dashboard[aria-busy="true"] .dash-analysis-row { opacity: .55; }
@media (min-width: 1800px) { #tab-dashboard .dash-filters { grid-template-columns: .7fr 1.15fr 1fr 1.15fr 1.2fr auto; } }
@media (max-width: 1300px) {
  #tab-dashboard .dash-filters { grid-template-columns: repeat(3,minmax(0,1fr)); }
  #tab-dashboard .dash-filter-actions { justify-content: end; }
  #tab-dashboard .dash-trend-row { grid-template-columns: minmax(0,1.6fr) minmax(260px,1fr); }
}
@media (max-width: 1000px) {
  #tab-dashboard .dash-kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #tab-dashboard .dash-trend-row, #tab-dashboard .dash-analysis-row { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 640px) {
  /* Thu gọn shell chỉ khi dashboard đang mở, giữ layout các tab cũ. */
  body:has(#tab-dashboard:not(.hidden)) > header > div { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; }
  body:has(#tab-dashboard:not(.hidden)) > header > div > div:first-child { gap: 8px; }
  body:has(#tab-dashboard:not(.hidden)) > header > div > div:first-child > div:first-child { width: 32px; height: 32px; }
  body:has(#tab-dashboard:not(.hidden)) > header h1 { font-size: 11px; white-space: nowrap; }
  body:has(#tab-dashboard:not(.hidden)) > header > div > div:first-child p,
  body:has(#tab-dashboard:not(.hidden)) > header > div > div:first-child > div:last-child > div > span { display: none; }
  body:has(#tab-dashboard:not(.hidden)) > header > div > div:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  body:has(#tab-dashboard:not(.hidden)) > header > div > div:nth-child(2) .relative,
  body:has(#tab-dashboard:not(.hidden)) > header #headerBranchFilter { width: 100%; }
  body:has(#tab-dashboard:not(.hidden)) > header > div > div:last-child { grid-column: 2; grid-row: 1; }
  #tab-dashboard .dash-heading { flex-direction: column; gap: 6px; }
  #tab-dashboard h2 { font-size: 21px; }
  #tab-dashboard .dash-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #tab-dashboard .dash-period-inputs { grid-column: span 2; }
  #tab-dashboard .dash-filter-actions { grid-column: span 2; }
  #tab-dashboard .dash-filter-panel, #tab-dashboard .dash-panel { padding: 15px; }
  #tab-dashboard .dash-kpi { padding: 14px; min-height: 132px; }
  #tab-dashboard .dash-kpi-name { font-size: 14px; }
  #tab-dashboard .dash-kpi-value { font-size: 20px; }
  #tab-dashboard .dash-kpi-detail { font-size: 10px; }
  #tab-dashboard .dash-chart-row { grid-template-columns: minmax(0,1fr); }
  #tab-dashboard .dash-chart { height: 270px; }
  #tab-dashboard .dash-table-scroll { margin-inline: -15px; }
  #tab-dashboard .dash-source-legend small { display: none; }
  #tab-dashboard .dash-source-legend > div { grid-template-columns: 1fr auto; }
}
