/* ALPHA DESIGN ERP Cloud — Construction workspace UI unification.
   Loaded after C1-C13 so this layer normalizes the construction experience without changing domain logic. */
.construction-workspace{--construction-radius:16px;--construction-gap:14px;display:grid;grid-template-columns:minmax(0,1fr);gap:16px;min-width:0;padding-bottom:28px}
/* Track cột phải là minmax(0,1fr) và mọi hàng con min-width:0: nếu để track `auto` + min-width:auto,
   một bảng rộng trong module (min-width:max(Npx,100%) cuộn trong .table-wrap) sẽ kéo track rộng hơn
   vùng nội dung và mọi hàng KPI/thao tác/nhịp/thanh tab cùng cột tràn ngang theo (v4.8.39, lỗi Thi công). */
.construction-workspace>*{min-width:0}
.construction-workspace__hero{display:flex;align-items:flex-end;justify-content:space-between;gap:22px;padding:22px 24px;border:1px solid var(--border-color,var(--border,#d9e1ea));border-radius:20px;background:linear-gradient(135deg,var(--surface,#fff),var(--surface-subtle,var(--surface-soft,#f6f8fb)));box-shadow:0 10px 30px rgba(15,23,42,.055)}
.construction-workspace__hero-copy{min-width:0;max-width:860px}.construction-workspace__hero h2{margin:5px 0 7px;font-size:clamp(1.45rem,2vw,1.9rem);line-height:1.2}.construction-workspace__hero p{margin:0;max-width:820px;color:var(--text-muted,var(--muted,#546a7c));line-height:1.55}
.construction-workspace__project{display:grid;gap:6px;min-width:min(360px,100%);font-size:12px;font-weight:750;color:var(--text-muted,var(--muted,#546a7c))}.construction-workspace__project select{width:100%;min-height:44px;border:1px solid var(--border-color,var(--border,#c9dbe4));border-radius:11px;background:var(--surface,#fff);color:inherit;padding:0 38px 0 12px;font:inherit;font-size:14px;font-weight:650}
.construction-workspace__nav{position:sticky;top:calc(var(--topbar-height,64px) + 8px);z-index:16;display:grid;grid-template-columns:repeat(6,minmax(135px,1fr));gap:7px;padding:7px;border:1px solid var(--border-color,var(--border,#d9e1ea));border-radius:16px;background:color-mix(in srgb,var(--surface,#fff) 94%,transparent);box-shadow:0 8px 22px rgba(15,23,42,.06);backdrop-filter:blur(16px)}
.construction-workspace__nav button{display:grid;gap:2px;min-width:0;min-height:54px;padding:9px 12px;border:1px solid transparent;border-radius:11px;background:transparent;color:inherit;text-align:left;cursor:pointer;transition:background .16s ease,border-color .16s ease,transform .16s ease}.construction-workspace__nav button:hover{background:var(--surface-subtle,var(--surface-soft,#f6f8fb));border-color:var(--border-color,var(--border,#d9e1ea))}.construction-workspace__nav button.is-active{background:var(--surface,#fff);border-color:var(--primary,#1a5777);box-shadow:0 3px 12px rgba(15,23,42,.06)}.construction-workspace__nav button:focus-visible,.construction-workspace__module-nav button:focus-visible{outline:3px solid color-mix(in srgb,var(--primary,#1a5777) 28%,transparent);outline-offset:2px}.construction-workspace__nav strong{font-size:13px}.construction-workspace__nav small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text-muted,var(--muted,#546a7c));font-size:11px}
.construction-workspace__group{display:none;min-width:0}.construction-workspace__group.is-active{display:block}.construction-workspace__module-nav{display:flex;gap:7px;overflow-x:auto;margin:0 0 10px;padding:3px 2px 6px;scrollbar-width:thin;-webkit-overflow-scrolling:touch}.construction-workspace__module-nav button{flex:0 0 auto;min-height:38px;padding:7px 12px;border:1px solid var(--border-color,var(--border,#d9e1ea));border-radius:999px;background:var(--surface,#fff);color:var(--text-muted,var(--muted,#546a7c));font-size:12px;font-weight:750;cursor:pointer;white-space:nowrap}.construction-workspace__module-nav button.is-active{border-color:var(--primary,#1a5777);background:color-mix(in srgb,var(--primary,#1a5777) 10%,var(--surface,#fff));color:var(--text,#101828)}
.construction-workspace__module{display:none;min-width:0}.construction-workspace__module.is-active{display:block}
/* C1-C13 share one visual grammar. */
.construction-workspace :is(.construction-c1,.construction-c2,.construction-c3,.construction-c4,.construction-c5,.construction-c6,.construction-c7,.construction-c8,.construction-c9,.construction-c10,.construction-c11,.construction-c12,.construction-c13){min-width:0;margin:0;padding:18px;border:1px solid var(--border-color,var(--border,#d9e1ea));border-radius:var(--construction-radius);background:var(--surface,#fff);box-shadow:none;overflow:visible}
.construction-workspace :is(.construction-c1__head,.construction-c2__head,.construction-c3__head,.construction-c4__head,.construction-c5__head,.construction-c6__head,.construction-c7__head,.construction-c8__head,.construction-c9__head,.construction-c10__head,.construction-c11__head,.construction-c12__head,.construction-c13__head){display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin:0 0 14px;padding-bottom:14px;border-bottom:1px solid var(--border-color,var(--border,#c9dbe4))}
.construction-workspace :is(.construction-c1__head,.construction-c2__head,.construction-c3__head,.construction-c4__head,.construction-c5__head,.construction-c6__head,.construction-c7__head,.construction-c8__head,.construction-c9__head,.construction-c10__head,.construction-c11__head,.construction-c12__head,.construction-c13__head)>div:first-child{min-width:0;max-width:850px}
.construction-workspace :is(.construction-c1,.construction-c2,.construction-c3,.construction-c4,.construction-c5,.construction-c6,.construction-c7,.construction-c8,.construction-c9,.construction-c10,.construction-c11,.construction-c12,.construction-c13) :is(h2,h3){margin:3px 0 5px;font-size:1.24rem;line-height:1.25}.construction-workspace :is(.construction-c1,.construction-c2,.construction-c3,.construction-c4,.construction-c5,.construction-c6,.construction-c7,.construction-c8,.construction-c9,.construction-c10,.construction-c11,.construction-c12,.construction-c13) p{line-height:1.5}.construction-workspace :is(.construction-c1__head,.construction-c2__head,.construction-c3__head,.construction-c4__head,.construction-c5__head,.construction-c6__head,.construction-c7__head,.construction-c8__head,.construction-c9__head,.construction-c10__head,.construction-c11__head,.construction-c12__head,.construction-c13__head) p{margin:0;color:var(--text-muted,var(--muted,#546a7c));font-size:13px}
.construction-workspace :is([data-c1-project],[data-c2-project],[data-c3-project],[data-c4-project],[data-c5-project],[data-c6-project],[data-c7-project],[data-c8-project],[data-c9-project],[data-c10-project],[data-c11-project],[data-c12-project],[data-c13-project]){min-width:min(320px,100%);max-width:420px;min-height:42px}
/* KPI cards */
.construction-workspace :is(.construction-c1__metrics,.construction-c2__metrics,.construction-c3__metrics,.construction-c4__metrics,.construction-c5__metrics,.construction-c6__metrics,.construction-c7__metrics,.construction-c8__metrics,.construction-c9__metrics,.construction-c10__metrics,.construction-c11__metrics,.construction-c12__metrics,.construction-c13__metrics,.construction-c13__finance,.construction-c13__signals){gap:9px}
.construction-workspace :is(.construction-c1__metrics>div,.construction-c2__metrics>div,.construction-c3__metrics>div,.construction-c4__metrics>div,.construction-c5__metrics>div,.construction-c6__metrics article,.construction-c7__metrics article,.construction-c8__metrics article,.construction-c9__metrics article,.construction-c10__metrics article,.construction-c11__metrics article,.construction-c12__metrics article,.construction-c13__metrics article,.construction-c13__finance article,.construction-c13__signals article){min-width:0;padding:12px 13px;border:1px solid var(--border-color,var(--border,#e1e7ef));border-radius:12px;background:var(--surface-subtle,var(--surface-soft,#f8fafc))}
.construction-workspace :is(.construction-c1__metrics,.construction-c2__metrics,.construction-c3__metrics,.construction-c4__metrics,.construction-c5__metrics,.construction-c6__metrics,.construction-c7__metrics,.construction-c8__metrics,.construction-c9__metrics,.construction-c10__metrics,.construction-c11__metrics,.construction-c12__metrics,.construction-c13__metrics) strong{font-size:clamp(1.05rem,1.8vw,1.35rem);font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
/* Forms / expandable task panels */
.construction-workspace :is(.construction-c1__form,.construction-c3__form,.construction-c3__mini-form,.construction-c4__form,.construction-c5__form,.construction-c8__grid,.construction-c9__grid,.construction-c10__grid,.construction-c11__grid,.construction-c12__grid){gap:9px}
.construction-workspace :is(input,select,textarea){max-width:100%;border-radius:9px}.construction-workspace :is(input,select){min-height:40px}.construction-workspace textarea{resize:vertical;min-height:78px}
.construction-workspace :is(.construction-c3__panel,.construction-c4__panel,.construction-c5__panel,.construction-c8__form,.construction-c9__form,.construction-c10__form,.construction-c10__detail,.construction-c11__panel,.construction-c12__panel,.construction-c13__panel,.construction-c6__quick details,.construction-c7__quick details){border:1px solid var(--border-color,var(--border,#e1e7ef));border-radius:12px;background:var(--surface,#fff);box-shadow:none}
.construction-workspace summary{list-style-position:outside}.construction-workspace summary::marker{color:var(--text-muted,var(--muted,#546a7c))}
.construction-workspace :is(.construction-c1__toolbar,.construction-c2__toolbar,.construction-c3__actions,.construction-c13__toolbar,.actions){gap:7px}.construction-workspace :is(button,.primary-btn,.ghost-btn){min-height:38px}.construction-workspace .primary-btn{font-weight:750}
/* Tables: readable, centered, no text spilling out of cells. */
.construction-workspace :is(.table-wrap,.construction-c8__table,.construction-c9__table){max-width:100%;overflow:auto;-webkit-overflow-scrolling:touch;border:1px solid var(--border-color,var(--border,#e1e7ef));border-radius:12px;background:var(--surface,#fff)}
.construction-workspace table{width:100%;border-collapse:separate;border-spacing:0;font-size:12.5px;line-height:1.35}.construction-workspace th,.construction-workspace td{max-width:320px;padding:10px 11px;border-bottom:1px solid var(--border-color,var(--border,#e7ebf0));vertical-align:middle;text-align:center;white-space:normal;overflow-wrap:anywhere;word-break:normal}.construction-workspace th{position:sticky;top:0;z-index:2;background:var(--surface-subtle,var(--surface-soft,#f8fafc));color:var(--text-muted,var(--muted,#546a7c));font-size:11px;font-weight:800;letter-spacing:.02em;text-transform:none}.construction-workspace tbody tr:last-child td{border-bottom:0}.construction-workspace tbody tr:hover td{background:color-mix(in srgb,var(--primary,#1a5777) 3%,var(--surface,#fff))}.construction-workspace td:first-child,.construction-workspace th:first-child{text-align:left}.construction-workspace :is(td.numeric,th.numeric,td.num,th.num){text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}.construction-workspace td :is(.ghost-btn,.primary-btn,button){white-space:nowrap}.construction-workspace .muted,.construction-workspace small{overflow-wrap:anywhere}
/* Delivery scope table is visually part of the Construction workspace, not a second page. */
.construction-workspace [data-construction-module-panel="scope"] .project-delivery-workspace{margin:0}.construction-workspace [data-construction-module-panel="scope"] .operations-screen-intro{border-radius:14px}.construction-workspace [data-construction-module-panel="scope"] .section:last-child{margin-bottom:0}
@media(max-width:1180px){.construction-workspace__nav{grid-template-columns:repeat(3,minmax(150px,1fr))}.construction-workspace :is(.construction-c1__metrics,.construction-c2__metrics,.construction-c3__metrics,.construction-c4__metrics,.construction-c5__metrics,.construction-c6__metrics,.construction-c7__metrics,.construction-c8__metrics,.construction-c9__metrics,.construction-c10__metrics,.construction-c11__metrics,.construction-c12__metrics,.construction-c13__metrics,.construction-c13__metrics.c13-progress,.construction-c13__signals){grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:1024px){.construction-workspace__hero{align-items:stretch;flex-direction:column;padding:18px}.construction-workspace__project{width:100%}.construction-workspace__nav{position:relative;top:auto;display:flex;overflow-x:auto;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch}.construction-workspace__nav button{flex:0 0 170px;scroll-snap-align:start}.construction-workspace :is(.construction-c1,.construction-c2,.construction-c3,.construction-c4,.construction-c5,.construction-c6,.construction-c7,.construction-c8,.construction-c9,.construction-c10,.construction-c11,.construction-c12,.construction-c13){padding:15px}.construction-workspace :is(.construction-c1__head,.construction-c2__head,.construction-c3__head,.construction-c4__head,.construction-c5__head,.construction-c6__head,.construction-c7__head,.construction-c8__head,.construction-c9__head,.construction-c10__head,.construction-c11__head,.construction-c12__head,.construction-c13__head){flex-direction:column;align-items:stretch}.construction-workspace :is([data-c1-project],[data-c2-project],[data-c3-project],[data-c4-project],[data-c5-project],[data-c6-project],[data-c7-project],[data-c8-project],[data-c9-project],[data-c10-project],[data-c11-project],[data-c12-project],[data-c13-project]){width:100%;min-width:0;max-width:none}.construction-workspace :is(.construction-c1__form,.construction-c1__form--wide,.construction-c3__form,.construction-c3__entry-grid,.construction-c4__form,.construction-c5__form,.construction-c8__grid,.construction-c9__grid,.construction-c10__grid,.construction-c11__grid,.construction-c12__grid){grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:640px){.construction-workspace{gap:12px}.construction-workspace__hero{padding:15px;border-radius:15px}.construction-workspace__hero h2{font-size:1.35rem}.construction-workspace__nav{margin-inline:-2px;border-radius:13px}.construction-workspace__nav button{flex-basis:154px;min-height:50px}.construction-workspace__module-nav{margin-bottom:7px}.construction-workspace :is(.construction-c1,.construction-c2,.construction-c3,.construction-c4,.construction-c5,.construction-c6,.construction-c7,.construction-c8,.construction-c9,.construction-c10,.construction-c11,.construction-c12,.construction-c13){padding:12px;border-radius:13px}.construction-workspace :is(.construction-c1__metrics,.construction-c2__metrics,.construction-c3__metrics,.construction-c4__metrics,.construction-c5__metrics,.construction-c6__metrics,.construction-c7__metrics,.construction-c8__metrics,.construction-c9__metrics,.construction-c10__metrics,.construction-c11__metrics,.construction-c12__metrics,.construction-c13__metrics,.construction-c13__metrics.c13-progress,.construction-c13__finance,.construction-c13__signals){grid-template-columns:repeat(2,minmax(0,1fr))}.construction-workspace :is(.construction-c1__form,.construction-c1__form--wide,.construction-c3__form,.construction-c3__entry-grid,.construction-c3__mini-form,.construction-c4__form,.construction-c5__form,.construction-c8__grid,.construction-c9__grid,.construction-c10__grid,.construction-c11__grid,.construction-c12__grid){grid-template-columns:1fr}.construction-workspace :is(button,.primary-btn,.ghost-btn,input,select){min-height:44px}.construction-workspace th,.construction-workspace td{padding:9px;max-width:260px}.construction-workspace table{min-width:720px}.construction-workspace .construction-c13__toolbar{width:100%;display:grid;grid-template-columns:1fr auto}.construction-workspace .construction-c13__toolbar select{min-width:0;width:100%}.construction-workspace .construction-c13__toolbar [data-c13-portfolio]{grid-column:1/-1}}
@media(max-width:420px){.construction-workspace :is(.construction-c1__metrics,.construction-c2__metrics,.construction-c3__metrics,.construction-c4__metrics,.construction-c5__metrics,.construction-c6__metrics,.construction-c7__metrics,.construction-c8__metrics,.construction-c9__metrics,.construction-c10__metrics,.construction-c11__metrics,.construction-c12__metrics,.construction-c13__metrics,.construction-c13__metrics.c13-progress,.construction-c13__finance,.construction-c13__signals){grid-template-columns:1fr}}
/* Dark-mode parity for construction-specific legacy badges and surfaces. */
html[data-theme="dark"] .construction-workspace :is(.construction-c1__badge,.construction-c2__badge,.construction-c3__badge,.construction-c4__badge,.construction-c5__badge,.construction-c6__badge,.construction-c6__severity,.construction-c7__badge,.construction-c8__badge,.construction-c9__badge,.construction-c10__badge,.construction-c11__badge,.construction-c12__badge,.c13-badge){background:var(--surface-2);border-color:var(--line);color:var(--text)}
html[data-theme="dark"] .construction-workspace :is(.construction-c8__badge.accepted,.construction-c8__badge.invoiced,.c13-on-track){background:color-mix(in srgb,#22c55e 18%,var(--surface));color:#8ee7ae}
html[data-theme="dark"] .construction-workspace :is(.construction-c8__badge.rejected,.c13-critical){background:color-mix(in srgb,#ef4444 18%,var(--surface));color:#ff9ca6}
html[data-theme="dark"] .construction-workspace :is(.construction-c8__badge.acceptance-pending,.construction-c8__badge.submitted,.construction-c8__badge.partially-accepted,.c13-at-risk){background:color-mix(in srgb,#f59e0b 18%,var(--surface));color:#ffd078}
html[data-theme="dark"] .construction-workspace .c13-watch{background:color-mix(in srgb,#4eaee2 16%,var(--surface));color:#94ceee}
html[data-theme="dark"] .construction-workspace :is(.construction-c13 .is-negative,.construction-c13 .danger-text){color:#ff9ca6}
html[data-theme="dark"] .construction-workspace .construction-c13 .ok{color:#8ee7ae}

/* Construction display hardening — single project context, compact actions and overflow safety. */
/* C1-C12 are driven by the workspace master project selector. Keep the legacy
   selectors in the DOM for each module's existing change/load contract, but do
   not render duplicate project controls in module headers. C13 keeps its own
   Portfolio/Project drill-down because it is a command-center navigation tool. */
.construction-workspace :is([data-c1-project],[data-c2-project],[data-c3-project],[data-c4-project],[data-c5-project],[data-c6-project],[data-c7-project],[data-c8-project],[data-c9-project],[data-c10-project],[data-c11-project],[data-c12-project]){display:none!important}
.construction-workspace .construction-c2__filters:has([data-c2-project]){justify-content:flex-end}
.construction-workspace .construction-c2__filters:has([data-c2-project]) input[type="date"]{min-width:172px}

/* Prevent long action clusters and metadata from forcing the whole workspace wider. */
.construction-workspace :is(.construction-c11__actions,.construction-c12__actions){min-width:0!important;max-width:360px;white-space:normal}
.construction-workspace :is(.construction-c11__actions,.construction-c12__actions) button{margin:2px;max-width:100%;white-space:normal;line-height:1.2}
.construction-workspace :is(.construction-c11__panel,.construction-c12__panel,.construction-c13__panel){min-width:0;max-width:100%;overflow:hidden}
.construction-workspace :is(.construction-c11__panel,.construction-c12__panel,.construction-c13__panel)>.table-wrap{width:100%;max-width:100%}

/* Make horizontal tables scroll inside their own card instead of widening the page. */
.construction-workspace :is(.table-wrap,.construction-c8__table,.construction-c9__table){overscroll-behavior-inline:contain;scrollbar-gutter:stable}
.construction-workspace__groups,.construction-workspace__group,.construction-workspace__module{width:100%;max-width:100%;overflow-x:clip}

/* Dense command-center rows should not inherit large generic button sizing on desktop. */
@media(min-width:641px){
  .construction-workspace .construction-c13 .table-wrap button.text-link{min-height:30px;padding-block:3px}
}

@media(max-width:640px){
  .construction-workspace__project{min-width:0}
  .construction-workspace__hero-copy,.construction-workspace__hero-copy p{max-width:100%}
  .construction-workspace__module-nav{scroll-snap-type:x proximity}
  .construction-workspace__module-nav button{scroll-snap-align:start}
  .construction-workspace .construction-c2__filters{width:100%}
  .construction-workspace .construction-c2__filters input[type="date"]{width:100%;min-width:0}
  .construction-workspace .construction-c13__panel-head{align-items:flex-start;flex-direction:column}
  .construction-workspace .construction-c13__project-title{min-width:0;overflow-wrap:anywhere}
  .construction-workspace :is(.construction-c11__actions,.construction-c12__actions){max-width:260px}
  .construction-workspace td.actions,.construction-workspace td[class*="__actions"]{white-space:normal}
}

/* v4.8.14 Frontend API + Construction transition hardening.
   Keep the shell/header fixed; animate only the active construction module. */
.construction-workspace__groups.alpha-construction-switching{
  overflow-anchor:none;
  contain:layout style;
}
.construction-workspace__module.alpha-construction-switch-out,
.construction-workspace__group.alpha-construction-switch-out{
  opacity:.94;
  transform:translateY(1px) scale(.9995);
  transition:opacity 70ms cubic-bezier(.4,0,.2,1),transform 70ms cubic-bezier(.4,0,.2,1);
  pointer-events:none;
}
.construction-workspace__module.alpha-construction-switch-in,
.construction-workspace__group.alpha-construction-switch-in{
  animation:alphaConstructionModuleIn 170ms cubic-bezier(.22,.61,.36,1) both;
}
@keyframes alphaConstructionModuleIn{
  from{opacity:.94;transform:translateY(2px) scale(.9995)}
  to{opacity:1;transform:translateY(0) scale(1)}
}
@media(prefers-reduced-motion:reduce){
  .construction-workspace__module.alpha-construction-switch-out,
  .construction-workspace__group.alpha-construction-switch-out{
    opacity:1!important;transform:none!important;transition:none!important
  }
  .construction-workspace__module.alpha-construction-switch-in,
  .construction-workspace__group.alpha-construction-switch-in{
    animation:none!important;opacity:1!important;transform:none!important
  }
}

/* v4.8.40 - Don gia nhan cong thi cong trong C3 */
.construction-c3__rates .construction-c3__form{margin-top:12px}
.construction-c3__coverage{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px 16px;padding:12px 14px;margin:10px 0;border:1px solid var(--border,#dce8ee);border-radius:12px;background:var(--surface-2,#f7fbfd)}
.construction-c3__coverage.is-warning{border-color:color-mix(in srgb,#d99000 40%,transparent);background:color-mix(in srgb,#d99000 8%,transparent)}
.construction-c3__coverage>div{display:grid;gap:3px}
.construction-c3__coverage span{font-size:9.5px;font-weight:740;text-transform:uppercase;letter-spacing:.05em;color:var(--muted,#64748b)}
.construction-c3__coverage strong{font-size:15px;font-variant-numeric:tabular-nums;color:var(--text,#0f2742)}
.construction-c3__coverage>p{grid-column:1/-1;margin:0;font-size:10.5px;line-height:1.55;color:var(--text,#0f2742)}
.construction-c3__rate-actions{display:flex;align-items:center;gap:12px;margin-top:10px;flex-wrap:wrap}
.construction-c3__rate-actions small{font-size:9.5px;color:var(--muted,#64748b)}
html[data-theme="dark"] .construction-c3__coverage{background:#12252f;border-color:#2b4451}
@media(max-width:760px){.construction-c3__coverage{grid-template-columns:1fr}}
