/* ============================================================================
   MUVA OS - shared data-table CSS. Extends the My Day grid system to any screen
   that uses window.MuvaTable. The table markup reuses My Day's own classes
   (.grid.myd-grid, .frozen-col, .myd-colrz, .th-*, .myd-rowcbx, .myd-ra…),
   so those styles come straight from my-day.css. This file only adds the
   generic wrapper (mirroring #mydGridWrap), the migrated-screen flex layout,
   and the show-columns submenu / context menu / bulk toolbar chrome.
   ============================================================================ */
/* ---- E20 shared scrollbar system --------------------------------------------
   One definition, consumed by every MUVA grid scroll region (My Day, Jobs,
   Clients, Providers, Documents, Workflow, Settings tables). Promoted from the
   My Day reference: identical 14px thickness, thumb, track, hover and corner on
   both axes. Any grid wrap gets the branded scrollbar by adding .muva-gridscroll
   - no page defines its own scrollbar. */
/* THE GRIDS USE THE GLOBAL SCROLLBAR (the owner, 23 August). This class used
   to set scrollbar-color, and Chrome ignores every ::-webkit-scrollbar rule on
   an element that sets scrollbar-color or scrollbar-width - so the BOQ items
   grid drew the browser's thin native bar in its own colours while the Cost
   Centres and Order Packages panels beside it drew MUVA's. One treatment:
   the tokens in 01-app.css, and nothing here to override them. */
.muva-gridscroll{}
.muva-gridscroll::-webkit-scrollbar{width:14px;height:14px}
.muva-gridscroll::-webkit-scrollbar-track{background:var(--surface-2);border-radius:99px}
.muva-gridscroll::-webkit-scrollbar-thumb{background:var(--line-2);border-radius:99px;border:3px solid var(--surface-2);min-width:48px;min-height:48px}
.muva-gridscroll::-webkit-scrollbar-thumb:hover{background:var(--ink-3)}
.muva-gridscroll::-webkit-scrollbar-corner{background:transparent}

/* Off-screen auto-fit measurer: descendants must not clip/constrain so the intrinsic
   (full, un-ellipsised) content width is measured. Icons keep their real rendered size. */
#muva-af-measure *{overflow:visible!important;max-width:none!important;text-overflow:clip!important;white-space:nowrap!important}

/* desktop table system is hidden on mobile (the existing card lists handle mobile) */
.mdt-tools,.mdt-active,.mdt-wrap{display:none}
/* ---- THE GRID CONTINUES TO THE BOTTOM (opt-in, cfg.fillToBottom) ----------
   Presentation-only rows below the last record, so the ruled surface reaches
   the foot of the pane the way a worksheet does. They inherit their height,
   their column boundaries and the rule under them from the rules every other
   row obeys - they are `<tr>`s of `<td>`s in the same table under the same
   colgroup - so nothing here sets any of that a second time. What it does set
   is the three things a row with no data must not do. */
.myd-grid tbody tr.mdt-fill{pointer-events:none;background:transparent}
.myd-grid tbody tr.mdt-fill:hover{background:transparent}
.myd-grid tbody tr.mdt-fill td{padding:0}

@media (min-width:761px){
  /* migrated screens become flex columns so the table fills height exactly like My Day */
  #screen-clients.active,#screen-trades.active,#screen-documents.active{display:flex;flex-direction:column;min-height:0}
  #screen-clients.active > .dash,#screen-trades.active > .dash,#screen-documents.active > .dash{flex:1 1 auto;display:flex;flex-direction:column;min-height:0}
  #screen-clients .jl-titlerow,#screen-trades .jl-titlerow,#screen-documents .jl-titlerow{margin-bottom:14px;align-items:center}

  /* scroll container - breaks out of the .dash 22px padding so it spans the full inner
     width of the page card, exactly like My Day's flush #mydGridWrap. Title/toolbar/chips
     keep their padding; only the table goes edge-to-edge. */
  /* scrollbar comes from the shared .muva-gridscroll token (added to the wrap markup) - no page override */
  .mdt-wrap{display:block;flex:1 1 auto;min-height:0;overflow:auto;margin:0 -22px 10px}
  .mdt-wrap .myd-grid{width:max-content}   /* E20 correction: no min-width:100% (see my-day.css) */
  /* scroll-aware frozen edge shadows (mirror #mydGridWrap.scx-*) */
  .mdt-wrap.scx-l .myd-grid .frozen-last{box-shadow:7px 0 8px -8px rgba(20,20,22,.16)}
  .mdt-wrap.scx-r .myd-grid .frozen-right{box-shadow:-7px 0 8px -8px rgba(20,20,22,.16)}

  /* hide legacy mobile card lists on desktop, show the shared table */
  #screen-clients #clMobileList,#screen-trades #tsMobileList,#screen-documents #dcMobileList{display:none}
  #screen-clients #clBody,#screen-trades #tsBody,#screen-documents #dcBody{display:block}

  /* right-aligned toolbar (mirror #mydTools) */
  .mdt-tools{display:flex;align-items:center;gap:8px;flex:0 0 auto}
  /* active filter chip row (mirror #mydActive) */
  .mdt-active{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-bottom:12px}
  .mdt-active:empty{display:none}
  .mdt-active .mdt-fclear{border:none;background:none;color:var(--ink-3);font:inherit;font-size:11.5px;font-weight:700;cursor:pointer;padding:0 6px}
  .mdt-active .mdt-fclear:hover{color:var(--ink)}

  /* ============================================================================
     E20 - one connected grid header menu + Show-columns flyout + Columns & layout panel.
     Spreadsheet-style column menu (NOT a settings drawer). Sizing: ~206px menu, 33px rows,
     16px icons, 10px h-padding, restrained dividers. Scoped under .myd-pop so it overrides
     the shared popover base without touching My Day's other menus.
     ============================================================================ */
  .myd-pop.mdt-menu{padding:5px;width:206px}
  .mdt-menu .mdt-mhead{font-size:11px;font-weight:700;color:var(--ink-3);letter-spacing:.1px;padding:5px 10px 5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;border-bottom:1px solid var(--line);margin-bottom:4px}
  .mdt-menu .myd-mitem{height:var(--menu-row-h,33px);padding:0 10px;gap:9px;font-size:12.5px;border-radius:var(--menu-row-r,7px)}
  /* THE FORMATTING STRIP: a compact toolbar row above the commands. Six
     controls, even widths, centred contents, a caret on the three that open
     something, and a colour bar under the two colour tools showing the last
     colour each would apply - the same grammar as every desktop editor. */
  .mdt-menu.has-strip,.mdt-ctx.has-strip{width:246px}
  .mdt-menu .myd-mstrip,.mdt-ctx .myd-mstrip{display:flex;align-items:center;justify-content:space-between;gap:3px;padding:2px 3px 7px;border-bottom:1px solid var(--line);margin-bottom:4px}
  .mdt-menu .myd-msbtn,.mdt-ctx .myd-msbtn{height:30px;flex:1 1 0;min-width:0;border:none;background:none;border-radius:7px;display:inline-flex;align-items:center;justify-content:center;gap:2px;cursor:pointer;color:var(--ink-2);font-size:13px;padding:0 2px}
  .mdt-menu .myd-msbtn:hover,.mdt-ctx .myd-msbtn:hover{background:var(--surface-2,#f1f1ef);color:var(--ink)}
  .mdt-menu .myd-msbtn.is-on,.mdt-ctx .myd-msbtn.is-on{background:var(--accs,#edeef2);color:var(--ink)}
  .mdt-menu .myd-msbtn[disabled],.mdt-ctx .myd-msbtn[disabled]{opacity:.4;cursor:default}
  .mdt-menu .myd-msbtn[disabled]:hover,.mdt-ctx .myd-msbtn[disabled]:hover{background:none;color:var(--ink-2)}
  .mdt-menu .myd-msbtn svg,.mdt-ctx .myd-msbtn svg{width:16px;height:16px;flex:0 0 auto}
  .mdt-menu .myd-msbtn svg.msb-car,.mdt-ctx .myd-msbtn svg.msb-car{width:9px;height:9px;opacity:.55;margin-left:-1px}
  .mdt-menu .msb-t,.mdt-ctx .msb-t{line-height:1;font-size:13px}
  .mdt-menu .msb-wrap,.mdt-ctx .msb-wrap{display:inline-flex;flex-direction:column;align-items:center;gap:2px;line-height:1}
  .mdt-menu .msb-wrap svg,.mdt-ctx .msb-wrap svg{width:14px;height:14px}
  .mdt-menu .msb-bar,.mdt-ctx .msb-bar{display:block;width:15px;height:3.5px;border-radius:2px;border:.5px solid rgba(20,22,38,.14)}
  /* the two colour tools are SPLIT PAIRS: a main half and a narrow chevron
     half, joined - the same grammar as the command bar's split buttons */
  .mdt-menu .myd-msbtn.msb-main,.mdt-ctx .myd-msbtn.msb-main{border-top-right-radius:0;border-bottom-right-radius:0}
  .mdt-menu .myd-msbtn.msb-arrow,.mdt-ctx .myd-msbtn.msb-arrow{flex:0 0 15px;min-width:15px;padding:0;margin-left:-3px;border-top-left-radius:0;border-bottom-left-radius:0}
  /* the chevron reads as attached to its icon, not as a button of its own:
     a hairline between the halves, not a gap */
  .mdt-menu .myd-msbtn.msb-arrow::before,.mdt-ctx .myd-msbtn.msb-arrow::before{content:'';display:block;width:1px;height:14px;background:rgba(20,22,38,.10);margin-right:1px}
  .mdt-menu .myd-msbtn.msb-arrow svg.msb-car,.mdt-ctx .myd-msbtn.msb-arrow svg.msb-car{margin:0}
  .mdt-menu .myd-mitem svg{width:16px;height:16px}
  .mdt-menu .myd-mitem.locked{opacity:.4;pointer-events:none}
  .mdt-menu .myd-mitem .myd-msub-chev svg{width:14px;height:14px}
  /* Show-columns flyout: compact checkbox list (mdt-lrow), shared 14px scrollbar */
  .myd-pop.mdt-colsub{padding:5px;width:212px}
  .mdt-colsub-list{display:flex;flex-direction:column;gap:1px;max-height:min(64vh,360px);overflow-y:auto;padding-right:2px}
  .mdt-lrow.locked{opacity:.45;pointer-events:none}

  /* Columns & layout panel - flat, no nested menus. Header + scroll body + sticky footer. */
  .mdt-panel{padding:0;width:262px;display:flex;flex-direction:column;max-height:min(76vh,560px);overflow:hidden}
  .mdt-panel-head{display:flex;align-items:center;gap:8px;padding:11px 12px 9px;border-bottom:1px solid var(--line);flex:0 0 auto}
  .mdt-panel-title{font-size:12.5px;font-weight:800;color:var(--ink);flex:1 1 auto}
  .mdt-panel-x{width:26px;height:26px;flex:0 0 auto;display:grid;place-items:center;border:none;background:none;border-radius:7px;color:var(--ink-3);cursor:pointer;transition:.12s var(--ease)}
  .mdt-panel-x svg{width:15px;height:15px}
  .mdt-panel-x:hover,.mdt-panel-x:focus-visible{background:var(--surface-2);color:var(--ink);outline:none}
  .mdt-panel-scroll{overflow-y:auto;padding:10px 10px 4px;display:flex;flex-direction:column;gap:9px;min-height:0}
  .mdt-fld{display:flex;flex-direction:column;gap:5px}
  .mdt-flab{font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.4px;color:var(--ink-3);padding:0 2px}
  .mdt-selwrap{position:relative}
  .mdt-layout-sel{width:100%;height:32px;border:1px solid var(--line);border-radius:8px;background:var(--surface-2);padding:0 30px 0 11px;font-family:inherit;font-size:12.5px;font-weight:600;color:var(--ink);cursor:pointer;-webkit-appearance:none;appearance:none;background-image:var(--chev);background-repeat:no-repeat;background-position:right 10px center;background-size:15px}
  .mdt-layout-sel:focus{outline:none;border-color:var(--ink-3);background-color:#fff;box-shadow:0 0 0 3px rgba(20,20,22,.06)}
  .mdt-panel-search{display:flex;align-items:center;gap:8px;height:32px;padding:0 11px;background:var(--surface-2);border:1px solid var(--line);border-radius:8px;color:var(--ink-3)}
  .mdt-panel-search:focus-within{border-color:var(--ink-3);background:var(--surface)}
  .mdt-panel-search svg{width:14px;height:14px;flex:0 0 auto}
  .mdt-panel-search input{border:none;background:none;outline:none;font-family:inherit;font-size:12.5px;color:var(--ink);width:100%}
  .mdt-panel-search input::placeholder{color:var(--ink-3)}
  .mdt-panel-list{display:flex;flex-direction:column;gap:1px;overflow-y:auto;min-height:60px}
  .mdt-panel-empty{padding:14px 8px;text-align:center;font-size:12px;color:var(--ink-3)}
  .mdt-lrow{display:flex;align-items:center;gap:9px;width:100%;height:32px;padding:0 8px;border:none;background:none;border-radius:7px;cursor:pointer;font-family:inherit;font-size:12.5px;font-weight:600;color:var(--ink-2);text-align:left;transition:background .12s var(--ease),color .12s var(--ease)}
  .mdt-lrow:hover{background:var(--surface-2);color:var(--ink)}
  .mdt-lrow:focus-visible{outline:none;background:var(--surface-2);color:var(--ink)}
  .mdt-lrow.on{color:var(--ink)}
  .mdt-lrow .cbx{width:16px;height:16px;flex:0 0 auto;border-radius:4px;border:1.5px solid var(--line-2);display:grid;place-items:center}
  .mdt-lrow.on .cbx{background:var(--green);border-color:var(--green)}
  .mdt-lrow .cbx svg{width:11px;height:11px;color:#fff;opacity:0}
  .mdt-lrow.on .cbx svg{opacity:1}
  .mdt-lname{flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .mdt-lpin{flex:0 0 auto;display:inline-flex;color:var(--ink-3)}
  .mdt-lpin svg{width:13px;height:13px}
  .mdt-panel-foot{display:flex;gap:7px;padding:9px 10px;border-top:1px solid var(--line);flex:0 0 auto}
  .mdt-fbtn{flex:1 1 auto;height:31px;padding:0 10px;border-radius:8px;border:1px solid var(--line);background:#fff;font-family:inherit;font-size:11.5px;font-weight:700;color:var(--ink-2);cursor:pointer;transition:.12s var(--ease);white-space:nowrap}
  .mdt-fbtn:hover,.mdt-fbtn:focus-visible{background:var(--surface-2);color:var(--ink);outline:none}

  /* context / more menus reuse .myd-pop + .myd-mitem; add danger variant + width */
  .mdt-ctx{width:222px}
  .myd-pop .myd-mitem.danger{color:#B3261E}
  .myd-pop .myd-mitem.danger svg{color:#B3261E}
  .myd-pop .myd-mitem.danger:hover{background:#FBEAEA}
  /* Unavailable, and readable rather than hidden. It keeps its full contrast on
     the label so the reason can be read, and only the icon and the hover
     affordance drop away: a greyed-out row nobody can read explains nothing. */
  .myd-pop .myd-mitem.is-disabled{color:var(--ink-3);cursor:default}
  .myd-pop .myd-mitem.is-disabled svg{opacity:.45}
  .myd-pop .myd-mitem.is-disabled:hover{background:transparent}

  /* bulk toolbar: engine tables reuse My Day's .myd-bulk pill (styles live in my-day.css)
     so the count, buttons, height and top-right position are identical on every screen */

  /* one-line cell helpers (avatars/pills/values on a single row, truncating) */
  .mdt-cell{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .mdt-strong{font-weight:700;color:var(--ink)}
  .mdt-muted{color:var(--ink-3)}
  .mdt-stack{display:inline-flex;align-items:baseline;gap:6px;min-width:0;max-width:100%}
  .mdt-stack .s2{color:var(--ink-3);font-size:11.5px;white-space:nowrap}
  .mdt-num{font-variant-numeric:tabular-nums}
}

/* shared live reassignment popover (window.MuvaReassign) - used by My Day + Job Workflow */
.myd-pop.mrasg{width:300px;max-width:calc(100vw - 20px);padding:0;display:flex;flex-direction:column;max-height:min(80vh,520px);overflow:hidden}
.mrasg-h{display:flex;align-items:center;gap:8px;padding:12px 13px 10px;border-bottom:1px solid var(--line);flex:0 0 auto}
.mrasg-h > span{font-size:13px;font-weight:800;color:var(--ink);flex:1 1 auto}
.mrasg-x{width:26px;height:26px;flex:0 0 auto;display:grid;place-items:center;border:none;background:none;border-radius:7px;color:var(--ink-3);cursor:pointer}
.mrasg-x svg{width:15px;height:15px}
.mrasg-x:hover{background:var(--surface-2);color:var(--ink)}
.mrasg-ctx{padding:9px 13px 10px;font-size:12px;color:var(--ink-3);display:flex;flex-direction:column;gap:2px;border-bottom:1px solid var(--line);flex:0 0 auto}
.mrasg-ctx b{color:var(--ink-2);font-weight:700}
.mrasg-ctx .mrasg-job{font-size:11.5px}
.mrasg-search{display:flex;align-items:center;gap:8px;margin:10px 12px 6px;height:34px;padding:0 11px;background:var(--surface-2);border:1px solid var(--line);border-radius:9px;color:var(--ink-3);flex:0 0 auto}
.mrasg-search svg{width:15px;height:15px;flex:0 0 auto}
.mrasg-search input{border:none;background:none;outline:none;font-family:inherit;font-size:12.5px;color:var(--ink);width:100%}
.mrasg-scroll{overflow-y:auto;padding:2px 8px 6px;min-height:60px;flex:1 1 auto}
.mrasg-row{display:flex;align-items:center;gap:10px;width:100%;height:38px;padding:0 9px;border:none;background:none;border-radius:9px;cursor:pointer;font-family:inherit;text-align:left;transition:background .12s var(--ease)}
.mrasg-row:hover{background:var(--surface-2)}
.mrasg-row.sel{background:var(--slate-soft,#eef1f6)}
.mrasg-row .av{width:26px;height:26px;flex:0 0 auto;border-radius:50%;display:grid;place-items:center;color:#fff;font-size:10.5px;font-weight:800}
.mrasg-row .av.un{background:var(--surface-2)!important;color:var(--ink-3);border:1px solid var(--line)}
.mrasg-row .av.un svg{width:15px;height:15px}
.mrasg-row .nm{flex:1 1 auto;font-size:12.5px;font-weight:600;color:var(--ink-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mrasg-row.sel .nm{color:var(--ink)}
.mrasg-row .ck{flex:0 0 auto;color:var(--green,#0f7a3f)}
.mrasg-row .ck svg{width:16px;height:16px}
.mrasg-empty{padding:14px 8px;text-align:center;font-size:12px;color:var(--ink-3)}
.mrasg-sep{height:1px;background:var(--line);margin:5px 6px}
.mrasg-scoperow{padding:10px 13px 4px;border-top:1px solid var(--line);flex:0 0 auto;display:flex;flex-direction:column;gap:7px}
.mrasg-scopel{font-size:10.5px;font-weight:800;text-transform:uppercase;letter-spacing:.35px;color:var(--ink-3)}
.mrasg-scope{display:flex;align-items:center;gap:8px;font-size:12.5px;font-weight:600;color:var(--ink-2);cursor:pointer}
.mrasg-scope input{accent-color:var(--black);width:15px;height:15px;flex:0 0 auto}
.mrasg-scope b{font-weight:800;color:var(--ink)}
.mrasg-foot{display:flex;gap:8px;padding:11px 13px;border-top:1px solid var(--line);flex:0 0 auto}
.mrasg-foot .btn{flex:1 1 auto;justify-content:center}
.mrasg-foot .btn[disabled]{opacity:.5;pointer-events:none}
@media (max-width:760px){ .myd-pop.mrasg{position:fixed;left:8px!important;right:8px!important;bottom:8px!important;top:auto!important;width:auto;max-height:78vh;border-radius:16px} }

/* ============================================================================
   Opt-in INLINE header (cfg.inlineHeader) - one flex row per header cell:
   LABEL · ACTIVE SORT STATE · MENU, one vertical centre, one 38px height.
   Selectors are prefixed .myd-grid thead so they outweigh My Day's absolute
   hover-control rules; grids that do not opt in are untouched.
   ============================================================================ */
.myd-grid thead th.mdt-inhead{position:relative;padding:0 8px;height:34px;vertical-align:middle}
.myd-grid thead th.mdt-inhead .mdt-hrow{height:100%;display:flex;align-items:center;gap:4px;min-width:0}
.myd-grid thead th.mdt-inhead .mdt-hsort{display:inline-flex;align-items:center;gap:4px;min-width:0;height:100%;padding:0;border:0;background:transparent;font:inherit;color:inherit;text-transform:inherit;letter-spacing:inherit;cursor:pointer}
.myd-grid thead th.mdt-inhead .mdt-hsort.is-plain{cursor:default}
.myd-grid thead th.mdt-inhead .th-lbl{display:inline-flex;align-items:center;line-height:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;position:static}
.myd-grid thead th.mdt-inhead .th-ind{position:static;top:auto;right:auto;transform:none;display:inline-flex;align-items:center;line-height:1;opacity:1;visibility:visible;background:none;padding:0;flex:0 0 auto}
.myd-grid thead th.mdt-inhead:not(.sorted) .th-ind{display:none}
.myd-grid thead th.mdt-inhead.sorted:hover .th-ind{opacity:1;visibility:visible}
.myd-grid thead th.mdt-inhead .th-ind svg{width:13px;height:13px}
.myd-grid thead th.mdt-inhead .mdt-azlab{font-size:9.5px;font-weight:800;letter-spacing:.4px;color:var(--ink);background:var(--surface-2);border:1px solid var(--line);border-radius:6px;padding:1px 5px;line-height:1.2}
/* the hover menu OVERLAYS the cell's right edge: it stays on the same vertical
   centre as the label (the inline contract) but never consumes flow width, so a
   narrow column (SEQ, 60px) cannot squeeze its own label to nothing. A surface
   chip keeps it legible over any content it covers. */
.myd-grid thead th.mdt-inhead .myd-thmenu{position:absolute;top:50%;right:4px;transform:translateY(-50%);flex:0 0 auto;margin-left:0;opacity:0;pointer-events:auto;background:var(--surface);border-radius:6px}
.myd-grid thead th.mdt-inhead:hover .myd-thmenu,
.myd-grid thead th.mdt-inhead:focus-within .myd-thmenu{opacity:1}

/* E20 pointer parity: the disabled grip communicates its state, the checkbox is
   clickable, and these apply to every engine grid uniformly */
.mdt-drag.disabled{cursor:not-allowed}
.myd-rowcbx,.myd-selall{cursor:pointer}
