/* ================================================================
   v4.8.0 — DASHBOARD LAYOUT REFINEMENT
   - Consolidates the two Design/Construction trend cards under one
     shared scope control for a denser executive reading flow.
   - Removes the redundant Recent Activity dashboard card and lets
     Project Pulse use the full available content width.
   ================================================================ */
.executive-delivery-grid{
  grid-template-columns:minmax(0,2.3fr) minmax(290px,.7fr)!important;
  gap:15px!important;
  align-items:stretch;
}
.executive-delivery-card{
  min-height:0!important;
  padding:15px 15px 13px!important;
  border-radius:19px!important;
  border-color:#dae5eb!important;
  box-shadow:0 12px 30px rgba(5,47,68,.055)!important;
}
.executive-delivery-heading{
  align-items:flex-start!important;
  margin:0 0 8px!important;
  padding:0 0 10px!important;
  border-bottom:1px solid color-mix(in srgb,var(--line) 82%,transparent);
}
.executive-delivery-heading>div:first-child{min-width:0}
.executive-delivery-heading h2{font-size:15px!important;letter-spacing:-.018em}
.executive-delivery-heading p{max-width:720px;line-height:1.45}
.executive-delivery-card>.dashboard-scope-warning{margin:0 0 10px}
.executive-delivery-chart-pair{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  min-width:0;
}
.executive-delivery-pane{
  min-width:0;
  padding:11px 11px 9px;
  border:1px solid color-mix(in srgb,var(--line) 82%,transparent);
  border-radius:14px;
  background:linear-gradient(180deg,color-mix(in srgb,var(--surface) 97%,var(--primary) 3%),var(--surface));
}
.executive-delivery-pane-heading{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  min-height:38px;
  margin-bottom:2px;
}
.executive-delivery-pane-heading>div{min-width:0}
.executive-delivery-pane-heading span{
  display:block;
  margin-bottom:3px;
  color:var(--primary);
  font-size:7.5px;
  font-weight:900;
  letter-spacing:.1em;
}
.executive-delivery-pane-heading h3{
  margin:0;
  color:var(--text);
  font-size:12px;
  line-height:1.25;
  letter-spacing:-.012em;
}
.executive-delivery-pane-heading small{
  flex:none;
  padding:4px 7px;
  border:1px solid color-mix(in srgb,var(--line) 80%,transparent);
  border-radius:999px;
  background:var(--surface);
  color:var(--muted);
  font-size:7.5px;
  font-weight:750;
  white-space:nowrap;
}
.executive-delivery-pane .chart-legend{
  gap:5px;
  margin:2px 0 7px;
  min-height:24px;
}
.executive-delivery-pane .legend-item{
  min-height:22px;
  padding:3px 7px;
  font-size:8px;
}
.executive-delivery-pane .legend-dot{width:7px;height:7px}
.executive-delivery-pane .legend-line{width:14px;height:2px}
.executive-delivery-pane .chart-unit-badge{
  padding:4px 7px;
  font-size:8px;
}
.executive-delivery-combo.combo-chart{
  height:242px;
  gap:7px;
  padding:1px 0 0;
}
.executive-delivery-pane .y-axis{
  width:43px;
  padding:7px 0 25px;
  font-size:8px;
}
.executive-delivery-pane .plot{border-radius:11px}
.executive-delivery-pane .bar-groups{inset:12px 8px 28px 9px;gap:5px}
.executive-delivery-pane .bar-group{gap:3px}
.executive-delivery-pane .bar{width:clamp(4px,36%,16px);border-radius:5px 5px 2px 2px}
.executive-delivery-pane .line-svg{inset:12px 8px 28px 9px;width:calc(100% - 17px);height:calc(100% - 40px)}
.executive-delivery-pane .line-svg polyline{stroke-width:2.7}
.executive-delivery-pane .line-svg circle{r:4;stroke-width:2}
.executive-delivery-pane .x-labels{bottom:6px;left:9px;right:8px;font-size:8px}
.executive-project-pulse-full{width:100%}
.executive-project-table-card{
  width:100%;
  min-width:0;
  border-radius:19px!important;
}
.executive-project-table-card .dashboard-project-table-wrap{width:100%}
.executive-project-table-card .table-dashboard-projects th,
.executive-project-table-card .table-dashboard-projects td{padding-left:13px;padding-right:13px}
.executive-project-table-card .table-dashboard-projects .dashboard-col-project{width:22%}
.executive-project-table-card .table-dashboard-projects .dashboard-col-client{width:16%}
.executive-project-table-card .table-dashboard-projects .dashboard-col-progress{width:19%}
.executive-project-table-card .table-dashboard-projects .dashboard-col-contract{width:17%}
.executive-project-table-card .table-dashboard-projects .dashboard-col-cost{width:15%}
.executive-project-table-card .table-dashboard-projects .dashboard-col-status{width:11%}
html[data-theme="dark"] .executive-delivery-pane{
  background:linear-gradient(180deg,#102936,#0e222d);
  border-color:#2d4959;
}
html[data-theme="dark"] .executive-delivery-pane-heading small{background:#102733;border-color:#2d4959}
html[data-theme="dark"] .executive-delivery-heading{border-bottom-color:#2d4959}
@media(max-width:1179px){
  .executive-delivery-grid{grid-template-columns:1fr!important}
  .executive-delivery-grid>.operations-alert-card{grid-column:auto!important}
}
@media(max-width:900px){
  .executive-delivery-chart-pair{grid-template-columns:1fr}
  .executive-delivery-combo.combo-chart{height:250px}
}
@media(max-width:600px){
  .executive-delivery-card{padding:12px 10px 10px!important}
  .executive-delivery-heading{padding-bottom:9px!important}
  .executive-delivery-pane{padding:10px 8px 8px}
  .executive-delivery-pane-heading{display:block;min-height:0;margin-bottom:7px}
  .executive-delivery-pane-heading small{display:inline-flex;margin-top:6px}
  .executive-delivery-pane .chart-unit-badge{width:auto;margin-left:0}
  .executive-project-table-card .table-dashboard-projects th,
  .executive-project-table-card .table-dashboard-projects td{padding-left:9px;padding-right:9px}
}

/* ------------------------------------------------------------------
   v4.8.40 - Bieu do thanh xep hang (thay bieu do tron o Tong quan)
   Xep hang tren mot duong co so chung: doc duoc thu hang, gia tri VND
   va ty trong cung luc. Mau gan theo thu hang nen on dinh giua cac bo loc.
   ------------------------------------------------------------------ */
.ranked-bars{display:grid;gap:14px;align-content:start;padding:4px 2px 2px;min-width:0}
.ranked-bars.is-empty{align-content:center;min-height:150px}
.ranked-bars-total{display:grid;gap:5px;padding:14px 16px;border:1px solid var(--border,#dce8ee);border-radius:14px;background:var(--surface-2,linear-gradient(145deg,#f7fbfd,#fff))}
.ranked-bars-total span{font-size:10px;font-weight:760;color:var(--muted,#64748b);text-transform:uppercase;letter-spacing:.06em}
.ranked-bars-total strong{font-size:26px;line-height:1;color:var(--text,#0f2742);font-variant-numeric:tabular-nums}
.ranked-bars-total small{font-size:9.5px;line-height:1.45;color:var(--muted,#64748b)}
.ranked-bars-list{display:grid;gap:11px;min-width:0}
.ranked-bar-row{display:grid;grid-template-columns:minmax(0,1fr) 48px;column-gap:10px;row-gap:5px;align-items:center;min-width:0}
.ranked-bar-head{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;font-size:10.5px}
.ranked-bar-head>span{display:flex;align-items:center;gap:7px;min-width:0;color:var(--text,#0f2742);font-weight:680;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ranked-bar-head>span b{flex:none;width:15px;height:15px;display:grid;place-items:center;border-radius:5px;background:var(--surface-2,#eef4f8);color:var(--muted,#64748b);font-size:8.5px;font-weight:800;font-variant-numeric:tabular-nums}
.ranked-bar-head>span i{width:8px;height:8px;border-radius:3px;flex:none}
.ranked-bar-head strong{font-variant-numeric:tabular-nums;white-space:nowrap;flex:none}
.ranked-bar-track{height:8px;border-radius:999px;background:var(--surface-2,#edf3f6);overflow:hidden}
.ranked-bar-track>span{display:block;height:100%;border-radius:inherit;min-width:2px;transition:width .24s cubic-bezier(.2,.7,.2,1)}
.ranked-bar-row>small{text-align:right;font-size:9px;font-weight:700;color:var(--muted,#64748b);font-variant-numeric:tabular-nums}
html[data-theme="dark"] .ranked-bars-total{background:#12252f;border-color:#2b4451}
html[data-theme="dark"] .ranked-bar-track{background:#1b303b}
html[data-theme="dark"] .ranked-bar-head>span b{background:#1b303b;color:#93a9b6}
@media(prefers-reduced-motion:reduce){.ranked-bar-track>span{transition:none}}
@media(max-width:600px){
  .ranked-bars-total{padding:12px}
  .ranked-bars-total strong{font-size:22px}
  .ranked-bar-row{grid-template-columns:minmax(0,1fr) 42px}
}

/* ------------------------------------------------------------------
   v4.8.40 - Bieu do cot co dau (thang lo phai ve khac thang lai)
   Chi kich hoat khi chuoi co gia tri am; bieu do toan duong giu nguyen.
   ------------------------------------------------------------------ */
.bar-groups.is-signed{align-items:stretch}
.bar-groups.is-signed .bar-group{align-items:stretch;justify-content:flex-start;gap:0}
.bar-groups.is-signed .bar{
  position:absolute;height:var(--h);width:calc(100% / var(--n) - 4px);
  left:calc(var(--i) * (100% / var(--n)) + 2px);transform-origin:center;
}
.bar-groups.is-signed .bar.is-positive{bottom:var(--zero);border-radius:6px 6px 2px 2px}
.bar-groups.is-signed .bar.is-negative{top:calc(100% - var(--zero));border-radius:2px 2px 6px 6px;opacity:.88}
.bar-groups.is-signed .bar:hover{transform:none;filter:saturate(1.1)}
.bar-groups.is-signed::after{
  content:"";position:absolute;left:0;right:0;bottom:var(--zero);height:0;
  border-top:1px dashed color-mix(in srgb,var(--muted,#64748b) 58%,transparent);pointer-events:none;
}
html[data-theme="dark"] .bar-groups.is-signed::after{border-top-color:color-mix(in srgb,#93a9b6 52%,transparent)}

/* Khoang tin cay cua du bao AI */
.operations-ai-band{display:grid;gap:4px;padding:11px 14px;margin:12px 0 0;border:1px solid var(--border,#dce8ee);border-radius:12px;background:var(--surface-2,#f7fbfd)}
.operations-ai-band>span{font-size:9.5px;font-weight:760;letter-spacing:.06em;text-transform:uppercase;color:var(--muted,#64748b)}
.operations-ai-band>strong{font-size:15px;font-variant-numeric:tabular-nums;color:var(--text,#0f2742)}
.operations-ai-band>small{font-size:9.5px;line-height:1.45;color:var(--muted,#64748b)}
html[data-theme="dark"] .operations-ai-band{background:#12252f;border-color:#2b4451}

/* ------------------------------------------------------------------
   v4.8.40 - Gop tieu de muc + ghi chu nguon + nut tuy chinh KPI vao mot dong
   ------------------------------------------------------------------ */
.executive-section-heading.has-widget-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:10px 18px}
.executive-section-heading.has-widget-toolbar>div:first-child{flex:1 1 260px;min-width:0}
.executive-section-heading.has-widget-toolbar>p{margin:0;flex:0 1 auto;text-align:right}
.executive-section-heading.has-widget-toolbar .alpha-widget-toolbar{margin:0;flex:0 0 auto}
@media(max-width:900px){
  .executive-section-heading.has-widget-toolbar>p{flex-basis:100%;text-align:left}
  .executive-section-heading.has-widget-toolbar .alpha-widget-toolbar{margin-left:auto}
}

/* Dai chi so nhanh: 4 o thay vi 3 */
.executive-stat-rail{grid-template-columns:repeat(4,minmax(0,1fr))}
@media(max-width:1100px){.executive-stat-rail{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.executive-stat-rail{grid-template-columns:1fr}}

/* Can cu hieu chuan xac suat theo du lieu thang that */
.operations-ai-calib{display:grid;gap:4px;padding:11px 14px;margin:10px 0 0;border:1px solid var(--border,#dce8ee);border-radius:12px;background:var(--surface-2,#f7fbfd)}
.operations-ai-calib>span{font-size:9.5px;font-weight:760;letter-spacing:.06em;text-transform:uppercase;color:var(--muted,#64748b)}
.operations-ai-calib>strong{font-size:14px;font-variant-numeric:tabular-nums;color:var(--text,#0f2742)}
.operations-ai-calib>small{font-size:9.5px;line-height:1.45;color:var(--muted,#64748b)}
.operations-ai-calib.is-muted>strong{color:var(--muted,#64748b)}
html[data-theme="dark"] .operations-ai-calib{background:#12252f;border-color:#2b4451}

/* ------------------------------------------------------------------
   v4.8.40 - Virtual COO khi chua co bao cao: thu gon thay vi chiem mot nua hang trong
   ------------------------------------------------------------------ */
.executive-intelligence-grid.is-coo-idle{grid-template-columns:minmax(0,1.9fr) minmax(240px,.6fr)}
.operations-coo-idle{display:grid;gap:8px;align-content:start;min-height:0}
.operations-coo-idle-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.operations-coo-idle-head .badge{background:var(--surface-2,#eef4f8);color:var(--muted,#64748b)}
.operations-coo-idle>p{margin:0;font-size:11px;line-height:1.55;color:var(--text,#0f2742)}
.operations-coo-idle>p code{font-size:10px;padding:1px 5px;border-radius:5px;background:var(--surface-2,#eef4f8)}
.operations-coo-idle-metric{display:flex;align-items:baseline;justify-content:space-between;gap:10px;padding:9px 12px;border:1px solid var(--border,#dce8ee);border-radius:10px}
.operations-coo-idle-metric>span{font-size:10px;color:var(--muted,#64748b)}
.operations-coo-idle-metric>strong{font-size:16px;font-variant-numeric:tabular-nums}
.operations-coo-idle>small{font-size:9.5px;line-height:1.45;color:var(--muted,#64748b)}
html[data-theme="dark"] .operations-coo-idle-head .badge,
html[data-theme="dark"] .operations-coo-idle>p code{background:#1b303b;color:#93a9b6}
@media(max-width:900px){.executive-intelligence-grid.is-coo-idle{grid-template-columns:1fr}}

/* Ghi chu gioi han pham vi tren bieu do delivery */
.delivery-scope-caveat{margin:0 0 10px;padding:9px 12px;border:1px solid color-mix(in srgb,#d99000 34%,transparent);border-radius:10px;background:color-mix(in srgb,#d99000 8%,transparent);color:var(--text,#0f2742);font-size:10px;line-height:1.5}
.delivery-scope-caveat b{font-weight:750}
html[data-theme="dark"] .delivery-scope-caveat{background:color-mix(in srgb,#d99000 14%,transparent);border-color:color-mix(in srgb,#d99000 42%,transparent)}

/* ------------------------------------------------------------------
   Trang Du an: o chuyen trang thai tren tung dong bang
   Chi liet ke trang thai HOP LE tu trang thai hien tai, nen chieu rong
   thay doi theo tung dong; khoa chieu rong de cot Thao tac khong nhay.
   ------------------------------------------------------------------ */
.project-transition { display: flex; align-items: center; min-width: 0; flex: 1 1 100%; }
.project-transition-select {
  /* Trong ô bảng, chieu rong phai theo O chu khong theo noi dung: min-width co dinh 9.5rem
     lam o chon day Sua/Xoa tran ra ngoai cot Thao tac. */
  width: 100%;
  min-width: 0;
  max-width: none;
  font-size: 0.8125rem;
  padding-block: 0.28rem;
  text-overflow: ellipsis;
}
.project-transition-end {
  display: inline-block;
  min-width: 1.5rem;
  text-align: center;
  opacity: 0.55;
}
/* O Thao tac cua trang Du an co BA thanh phan: o chuyen trang thai + Sua + Xoa.
   Xep thanh hai hang co chu dich (o chon mot hang, hai nut mot hang) va khoa trong pham vi
   o bang, thay vi de flex-wrap tu tran ra ngoai cot. */
.table-projects .table-action-group {
  display: flex;
  flex-wrap: wrap;
  row-gap: 0.35rem;
  column-gap: 0.35rem;
  justify-content: flex-end;
  align-items: center;
  max-width: 100%;
  min-width: 0;
}
.table-projects .table-action-group > .project-transition { flex: 1 1 100%; }
.table-projects .table-action-group > .action-btn { flex: 0 1 auto; min-width: 0; }
.table-projects td:last-child { overflow: hidden; }

/* ------------------------------------------------------------------
   Trang Du an: hai ghi chu doi chieu tren bang
   - Tien do theo pham vi: hien khi lech voi tien do theo giai doan
   - Co "chua co chi phi tren so": ty le su dung chua phai gia thanh day du
   ------------------------------------------------------------------ */
.project-progress-divergence {
  margin-top: 0.2rem;
  font-size: 0.6875rem;
  line-height: 1.3;
  color: var(--warning-text, #92400e);
  cursor: help;
}
.project-usage-note { margin-top: 0.2rem; line-height: 1.3; }
.project-usage-flag {
  display: inline-block;
  font-size: 0.625rem;
  padding: 0.05rem 0.35rem;
  border-radius: 0.6rem;
  border: 1px solid currentColor;
  color: var(--warning-text, #92400e);
  cursor: help;
}
@media (prefers-color-scheme: dark) {
  .project-progress-divergence, .project-usage-flag { color: var(--warning-text, #fbbf24); }
}

/* Nut "Tinh lai" nam trong ghi chu doi chieu tien do — chi hien khi hai cach tinh lech nhau. */
.project-progress-recalc {
  margin-left: 0.3rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.6875rem;
  color: var(--link-color, #226b93);
  text-decoration: underline;
  cursor: pointer;
}
.project-progress-recalc:disabled { opacity: 0.5; cursor: progress; text-decoration: none; }
.project-progress-recalc:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 2px; }

/* ------------------------------------------------------------------
   Trang Cong viec: bang chi tiet (checklist, trao doi, tien do, QA/QC)
   Du lieu den tu API nghiep vu, khong qua kenh dong bo.
   ------------------------------------------------------------------ */
.task-detail-panel { margin-top: 1rem; }
.task-detail-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  padding-bottom: 0.75rem; margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color, rgba(148,163,184,0.3));
}
.task-detail-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .task-detail-grid { grid-template-columns: 1fr; } }
.task-detail-block h3 { font-size: 0.875rem; margin: 0 0 0.5rem; }
.task-detail-list { list-style: none; margin: 0 0 0.6rem; padding: 0; display: grid; gap: 0.4rem; }
.task-detail-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem;
  padding: 0.45rem 0.6rem; border-radius: 0.5rem;
  background: var(--surface-subtle, rgba(148,163,184,0.08));
  font-size: 0.8125rem; line-height: 1.4;
}
.task-detail-item.is-done .task-detail-check span { text-decoration: line-through; opacity: 0.65; }
.task-detail-check { display: flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.task-detail-decide { display: inline-flex; gap: 0.5rem; white-space: nowrap; }
.task-detail-form { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.task-detail-form input { flex: 1 1 8rem; min-width: 0; font-size: 0.8125rem; padding: 0.35rem 0.5rem; }
.task-detail-form input[type="number"] { flex: 0 0 5.5rem; }

/* ------------------------------------------------------------------
   Trang Kiem soat van hanh: canh bao khi khong co du an nao de kiem soat.
   Trang nay ca muc dich la bao dong khi co gi sai; no bao toan so 0 vi
   chinh no khong co du lieu la kieu hong te nhat.
   ------------------------------------------------------------------ */
.control-empty-notice { margin-bottom: 1rem; }
.control-empty-notice ul { margin: 0.4rem 0 0.4rem 1.1rem; padding: 0; }
.control-empty-notice li { margin-bottom: 0.25rem; }
.control-empty-notice p { margin: 0.35rem 0; }
