/* ===== Overview module (Tổng quan) — measured from actapp.misa.vn/app/Overview/dashboard @2524x1277 ===== */

/* tab bar extras */
/* scroll container */
.dashboard-container { flex: 1; min-height: 0; overflow-y: scroll; overflow-x: hidden; position: relative; }
.dashboard-container::-webkit-scrollbar { width: 10px; }
.dashboard-container::-webkit-scrollbar-thumb { background: #c4c7cc; border-radius: 8px; border: 2px solid var(--bg-body); }
.dashboard-container > .header { position: sticky; top: 0; z-index: 5; height: 52px; background: var(--bg-body); margin-bottom: -16px; display: flex; align-items: center; justify-content: space-between; padding: 8px 20px 7px 20px; }
.dashboard-container > .header .title-header { font-size: 24px; font-weight: 700; line-height: 36px; }
.dashboard-container > .header .header-right { display: flex; align-items: center; gap: 16px; }
.ms-button-secondary { height: 28px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--border); background: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 500; font-size: 13px; cursor: pointer; }
.ms-button-secondary .mi { color: var(--muted); }
.ms-button-secondary:hover { background: #f3f4f6; }

/* widget grid */
.dash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: 260px; grid-auto-rows: 329px; gap: 16px; margin: 16px 16px 16px 16px; }
.dash-grid > .grid-item { grid-column: span 2; min-height: 0; }
.dash-grid > .grid-item.row-1 { grid-row: 1; height: 260px; }
.dash-grid > .grid-item.span-1 { grid-column: span 1; }
.dash-grid .card { height: 100%; background: #fff; border-radius: 8px; box-shadow: rgba(0,0,0,.1) 0 0 2px 0; padding: 20px; display: flex; flex-direction: column; position: relative; }
.card-title { font-size: 16px; font-weight: 600; line-height: 22px; margin: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; height: 28px; }
.card-head .head-right { display: flex; align-items: center; }
.chart-function-btn { width: 16px; height: 28px; margin-left: 16px; display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .15s; }
.chart-function-btn.dash-icon { width: 24px; }
.card:hover .chart-function-btn { opacity: 1; }
.combo-dateranger { height: 28px; display: flex; align-items: center; background: #fff; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.combo-dateranger:hover { border-color: var(--border); }
.combo-dateranger .selected-options { padding-left: 12px; line-height: 16px; color: #111; white-space: nowrap; flex: 1 1 auto; }
.combo-dateranger .btn-dropdown { width: 22px; flex: 0 0 22px; display: flex; align-items: center; justify-content: center; color: #5d5d5d; }
.combo-dateranger.w97 { width: 97px; }
.combo-dateranger.w87 { width: 87px; }
.ms-last-update { display: flex; align-items: center; gap: 4px; height: 24px; padding: 2px; color: var(--muted); font-weight: 400; }
.ms-last-update .mi { color: var(--muted); }
.ms-last-update .mr-1 { margin-right: 3.25px; white-space: nowrap; }
.ms-last-update .text-reload { color: var(--link); cursor: pointer; }
.caption-20 { display: flex; align-items: center; gap: 12px; height: 20px; color: var(--muted); font-weight: 400; }
.caption-20 .mi { color: var(--muted); }
.caption-20 .info { display: flex; align-items: center; gap: 4px; }
.caption-20 .reload { color: var(--link); cursor: pointer; }
.chart-unit { font-size: 11px; color: var(--muted); line-height: 17px; text-align: right; }

/* W1 Tình hình tài chính */
.db-profit { padding: 20px 20px 16px !important; }
.profit-body .title-chart-unit { margin-bottom: 10px; display: flex; justify-content: flex-end; }
.fin-summary { display: flex; height: 148px; overflow: hidden; }
.fin-summary .col-left { width: 464px; flex: 0 0 464px; }
.fin-summary .col-gap { width: 70px; flex: 0 0 70px; }
.fin-summary .col-right { flex: 1; min-width: 0; }
.fin-row { display: flex; justify-content: space-between; height: 20px; margin-bottom: 4px; line-height: 20px; }
.fin-row .lbl { width: 66.6%; }
.fin-row .lbl.sub { color: var(--muted); padding-left: 20px; }
.fin-row .val { font-weight: 700; color: var(--link); cursor: pointer; }
.fin-row .val.total { color: var(--muted); cursor: default; }
.fin-row .val.neg { color: #ed1c24; }
hr.row-dotnet { height: 2px; margin: 0 0 5.5px; border: 0; border-top: 1px dashed #ced0d4; border-bottom: 1px dashed #ced0d4; box-sizing: border-box; }

/* W2/W3 Nợ phải thu / trả theo hạn nợ */
.debt-card { gap: 16px; }
.debt-card .card-head { height: 22px; align-items: flex-start; }
.debt-content { display: flex; flex-direction: column; gap: 16px; }
.debt-total { display: flex; flex-direction: column; gap: 4px; }
.debt-total-label { font-weight: 500; line-height: 20px; }
.debt-total-value-row { display: flex; align-items: center; gap: 4px; height: 29px; }
.debt-total-value { font-size: 24px; font-weight: 700; line-height: 29px; }
.debt-unit { color: var(--muted); font-weight: 400; }
.debt-detail-row { display: flex; justify-content: space-between; height: 38px; }
.debt-detail-item { display: flex; flex-direction: column; align-items: flex-start; }
.debt-detail-item.right { align-items: flex-end; }
.debt-detail-label { font-weight: 500; line-height: 18px; }
.debt-detail-value-row { display: flex; align-items: flex-start; gap: 4px; height: 20px; }
.debt-detail-value { font-size: 16px; font-weight: 600; line-height: 20px; }
.debt-detail-value.overdue { color: #dc6803; }
.debt-detail-unit { font-size: 12px; font-weight: 400; color: var(--muted); padding-bottom: 2px; line-height: 20px; }
.debt-progress { display: flex; align-items: flex-end; height: 24px; }
.debt-progress .overdue { height: 20px; background: var(--orange); border-radius: 2px; }
.debt-progress .in-time { height: 24px; background: #bdc1c8; border-radius: 2px; padding-bottom: 4px; display: flex; flex-direction: column; }
.debt-progress .in-time-fill { height: 20px; background: #d4d7dc; border-radius: 2px; }

/* W4 Doanh thu, chi phí, lợi nhuận */
.rpc-card { gap: 12px; }
.rpc-summary { display: flex; gap: 48px; padding-top: 8px; }
.rpc-item { width: 123px; display: flex; flex-direction: column; gap: 4px; }
.rpc-label { font-weight: 500; line-height: 18px; text-transform: uppercase; }
.rpc-value-row { display: flex; align-items: center; gap: 4px; height: 21px; }
.rpc-value { font-size: 16px; font-weight: 700; line-height: 21px; }
.rpc-value.revenue { color: var(--brand); }
.rpc-unit { color: var(--muted); font-weight: 400; line-height: 20px; }
.rpc-chart { height: 154px; }
.chart-svg { display: block; max-width: 100%; font-family: var(--font); overflow: hidden; }
.chart-svg .ylab { font-size: 11px; fill: #373d3f; font-weight: 400; }
.chart-svg .xlab { font-size: 12px; fill: #373d3f; font-weight: 400; }
.chart-svg .dlab { font-size: 12px; fill: #000; font-weight: 600; }
.chart-svg .grid { stroke: #e0e0e0; stroke-width: 1; }
.chart-legend { display: flex; justify-content: center; align-items: center; height: 32px; padding: 0 10px; }
.chart-legend .ls { display: flex; align-items: center; margin: 4px 5px 12px; height: 16px; }
.chart-legend .lm { width: 12px; height: 12px; border-radius: 50%; margin: 0 8px 0 2px; }
.chart-legend .lt { font-size: 12px; color: #373d3f; margin-right: 12px; }

/* W6 / W5 (db-body: chart full width) */
.db-body { padding: 0 !important; }
.db-header { display: flex; padding: 20px 20px 0; height: 57px; }
.db-header.cf { padding: 15px 20px 0; height: 52px; }
.db-header .flex-1 { display: flex; }
.db-header .title-db { margin: 0 0 13px; }
.db-header .header-right { display: flex; align-items: center; height: 37px; }
.db-header.cf .header-right { height: 44px; margin-top: -7px; }
.row-col2 { display: flex; padding: 0 20px 20px; height: 46px; flex: 0 0 46px; overflow: visible; }
.row-col2.cf { height: 49px; flex-basis: 49px; }
.row-col2 .big { font-size: 24px; font-weight: 700; line-height: 36px; margin-bottom: 4px; }
.row-col2 .title-unit-money { font-size: 12px; line-height: 26px; margin: 14px 0 0 4px; }
.row-col2 .title-text-chart { color: var(--muted); font-weight: 500; line-height: 20px; }
.row-col2 .title-chart-unit { margin-bottom: 10px; }
.cf-col { width: 200px; flex: 0 0 200px; }
.cf-col.last { flex: 1; width: auto; }
.cf-col .title-unit-money { font-size: 12px; line-height: 18px; margin-top: 13px; text-transform: uppercase; }
.cf-col .num { font-size: 16px; font-weight: 700; line-height: 24px; margin-bottom: 4px; }
.cf-col .unit { color: var(--muted); font-weight: 500; margin: 4.5px 0 0 4.5px; line-height: 24px; }
.cf-col .flex { display: flex; height: 28px; }
.db-chart { flex: 1; min-height: 0; }
.db-footer { padding: 20px 2px 20px 20px; height: 60px; }

/* W7 Hàng hóa tồn kho */
.inv-summary { display: flex; flex-direction: column; margin-top: 8px; }
.inv-summary-label { font-weight: 500; line-height: 18px; }
.inv-summary-value-row { display: flex; align-items: center; gap: 4px; height: 29px; }
.inv-summary-value { font-size: 24px; font-weight: 700; color: #111; line-height: 29px; }
.inv-table-header { display: flex; align-items: center; padding: 4px 0; height: 28px; font-weight: 600; color: #1f1f1f; }
.inv-col-name { flex: 1; min-width: 0; }
.inv-col-qty { width: 120px; flex: 0 0 120px; text-align: right; }
.inv-col-val { width: 140px; flex: 0 0 140px; text-align: right; }
.inv-row { display: flex; align-items: center; height: 25px; padding: 2px 0; border-bottom: 1px dashed #d5d7da; font-weight: 400; }
.inv-row .inv-col-name { display: flex; align-items: center; gap: 8px; }
.inv-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.inv-see-more { display: flex; justify-content: flex-end; height: 20px; color: var(--link); font-weight: 400; cursor: pointer; margin-top: auto; }
.inv-caption { height: 24px; display: flex; align-items: center; }

/* W8 Mặt hàng bán chạy / W9 Chi phí (db-profit) */
.main-summary { height: 58px; }
.main-summary .top { display: flex; height: 39px; }
.main-summary .big { font-size: 24px; font-weight: 700; line-height: 39px; }
.main-summary .title-unit-money { font-size: 12px; line-height: 26px; margin: 13px 0 0 4px; }
.main-summary .title-chart-unit { margin-left: auto; margin-bottom: 10px; }
.main-summary .title-chart-unit span { display: block; margin-top: 12px; }
.main-summary .summary-title { color: var(--muted); line-height: 20px; text-transform: uppercase; }
.bs-head { display: flex; height: 18px; margin-bottom: 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.bs-head .name { flex: 1; padding-left: 23px; }
.bs-col { width: 150px; flex: 0 0 150px; text-align: right; }
.bs-row { display: flex; height: 20px; margin-bottom: 11px; line-height: 20px; }
.bs-row .name { flex: 1; display: flex; min-width: 0; }
.bs-sq { width: 10px; height: 10px; margin: 4px 12px 0 0; flex: 0 0 10px; }
.bs-row .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-see-more { display: flex; justify-content: flex-end; height: 20px; color: var(--link); cursor: pointer; margin-top: -20px; position: relative; }
.donut-wrap { display: flex; height: 189px; }
.donut-wrap #chartCost { flex: 1; min-width: 170px; height: 189px; overflow: hidden; }
.donut-legend { display: flex; flex-direction: column; padding: 0 10px 0 15px; width: 243px; margin: 4px 0 0 42px; }
.donut-legend .ls { display: flex; align-items: center; height: 16px; margin-bottom: 12px; }
.donut-legend .lm { width: 12px; height: 12px; border-radius: 50%; margin: 0 8px 0 2px; flex: 0 0 12px; }
.donut-legend .lt { font-size: 12px; color: #373d3f; white-space: nowrap; }

/* Dashboard vẫn cần đọc được ở màn hình laptop hẹp. Ở dưới 1100px, ba thẻ
   đầu không còn bị ép vào bốn cột rất nhỏ; thẻ tài chính chiếm trọn hàng và
   hai thẻ công nợ nằm cạnh nhau ở hàng kế tiếp. */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; grid-auto-rows: auto; }
  .dash-grid > .grid-item.row-1 { grid-row: auto; }
  .dash-grid > .grid-item:not(.row-1) { height: 329px; }
  .fin-summary .col-left { width: 58%; flex-basis: 58%; }
  .fin-summary .col-gap { width: 32px; flex-basis: 32px; }
}
