/* ALFRED MATTERS LIST, brand pack v2. Only v2 variables; layout from the approved Matters list mock-up. */
#view-cases { margin: 0; padding: 0; background: transparent; min-height: 0; color: var(--al-text); font: 400 var(--al-fs-ui)/var(--al-lh-ui) var(--al-font-ui); }
#view-cases * { box-sizing: border-box; }
#view-cases a { color: var(--al-action); text-decoration: none; cursor: pointer; }
#view-cases a:hover { text-decoration: underline; }
#view-cases .ml { display: flex; flex-direction: column; min-width: 0; gap: 16px; max-height: calc(100vh - var(--al-topbar-h) - var(--well-t) - 92px); }
.ml-mono { font-family: var(--al-font-id); font-size: var(--al-fs-label); color: var(--al-text-2); }
.ml-muted, .ml-quiet { color: var(--al-text-2); }
.ml-none { color: var(--al-text-2); }
.ml-count { margin-left: 6px; font-weight: 400; color: var(--al-text-2); }
.ml-clamp { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* title and actions */
.ml-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex: none; min-height: 56px; }
.ml-head > div:first-child { min-width: 0; }
.ml-title { margin: 0; font: 800 var(--al-fs-title)/1.25 var(--al-font-ui); letter-spacing: 0; color: var(--al-text); }
.ml-stats { margin-top: 4px; min-height: 20px; color: var(--al-text-2); display: flex; gap: 8px; flex-wrap: wrap; }
.ml-stats .ml-exc { color: var(--al-critical); font-weight: 500; }
.ml-stats > span + span::before { content: "·"; margin-right: 8px; color: var(--al-text-2); }
.ml-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* the workspace well, the tab row, one card */
.ml-well { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; gap: var(--al-gap-card); padding: 0; background: transparent; }
.ml-tabsrow { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 34px; }
.ml-tabsrow .alf-tabs { padding-bottom: 0; border-bottom: 0; margin-bottom: 0; }
.ml-tabsrow .alf-tab { height: var(--al-control-h); padding: 0 14px; font-weight: 500; }
.ml-tabsrow .alf-tab[aria-selected=true] { font-weight: 600; }
.ml-card { flex: 0 1 auto; min-height: 0; min-width: 0; display: flex; flex-direction: column; }
.ml-tools { display: flex; flex: none; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; min-height: 0; }
.ml-tools > #ml-row1 { flex: 1 1 260px; min-width: 220px; }
.ml-tools > #ml-row2 { flex: 0 0 auto; flex-wrap: nowrap; }
.ml-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* the retired list's .ml-row rule in style.css (padding, a bottom line, weight 300) must not reach this screen */
#view-cases .ml-row { padding: 0; border-bottom: 0; font-size: inherit; font-weight: inherit; }
.ml-row2 { min-height: 32px; }
.ml-row2 .ml-spacer { flex: 1 1 8px; }
.ml-search { position: relative; flex: 1; min-width: 200px; margin: 0; }
.ml-search input { padding-left: 34px; }
.ml-search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--al-text-2); display: grid; pointer-events: none; }
.ml-search-ic .alf-icon { width: 15px; height: 15px; }
.ml-drop, .ml-facet-wrap { position: relative; flex: none; }
.ml-spacer { flex: 1; }
.ml-sel-label { display: flex; align-items: center; gap: 8px; color: var(--al-text-2); }
.alf-filter .alf-icon, .alf-button .alf-icon { width: 14px; height: 14px; }

/* menus: solid, above the page (L42) */
.ml-pop { z-index: 90; background: var(--al-field); box-shadow: var(--al-shadow-menu); right: auto; left: 0; top: calc(100% + 7px); min-width: 220px; max-height: 360px; overflow: auto; }
.ml-drop > .ml-pop { left: auto; right: 0; }
.ml-menu-wide { width: 340px; }
.ml-rowmenu { position: relative; display: flex; justify-content: flex-end; }
#ml-pop-host .ml-pop { position: fixed; z-index: var(--al-z-attached); max-height: calc(100vh - 16px); }
.ml-pop-title { padding: 6px 10px 4px; margin: 0; }
.ml-pop-note { padding: 6px 10px 8px; color: var(--al-text-2); }
.ml-pop hr { height: 1px; border: 0; background: var(--al-divider); color: var(--al-divider); margin: 6px 4px; }
.ml-mi { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.ml-mi small { font-size: 12px; color: var(--al-text-2); }
.ml-pop-link { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: var(--al-r-chip); color: var(--al-text) !important; }
.ml-pop-link:hover { background: var(--al-selected); text-decoration: none !important; }
.ml-pop-link .n { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.ml-pop-link .r { display: block; font-size: 12px; color: var(--al-text-2); font-family: 'DM Mono', monospace; }
.ml-pop-link .w { flex: none; font-size: 12px; color: var(--al-text-2); }
.ml-view-row { display: flex; align-items: center; gap: 2px; border-radius: var(--al-r-control); padding: 2px 4px 2px 0; }
.ml-view-row:hover { background: var(--al-selected); }
.ml-view-main { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 6px 6px 6px 10px; cursor: pointer; font: inherit; color: var(--al-text); }
.ml-view-main .nm, .ml-view-main .ds { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-view-main .ds { font-size: 12px; color: var(--al-text-2); }
.ml-facet-menu { width: 280px; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.ml-facet-search { padding: 8px; border-bottom: 1px solid var(--al-divider); }
.ml-facet-search input { width: 100%; min-height: 34px; padding: 6px 10px; border: 1px solid var(--al-line-control); border-radius: var(--al-r-control); font: 400 var(--al-fs-label)/20px var(--al-font-ui); background: var(--al-field); color: var(--al-text); }
.ml-facet-list { overflow: auto; padding: 5px; max-height: 250px; }
.ml-opt { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--al-r-chip); cursor: pointer; }
.ml-opt:hover { background: var(--al-selected); }
.ml-opt .lab { flex: 1; min-width: 0; }
.ml-opt .ct { color: var(--al-text-2); }
.ml-facet-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--al-divider); font-size: 12px; white-space: nowrap; }
.ml-sugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); padding: 4px; z-index: 95; max-height: 220px; overflow: auto; min-width: 0; }
.ml-sugg button { gap: 8px; }
.alf-menu .alf-button { width: auto; min-height: 34px; padding: 7px 12px; justify-content: center; }
.alf-menu .alf-button--compact { min-height: 32px; padding: 6px 8px; }

/* the matter rows: package row blocks, a sentence-case head, one mark per workstream */
.ml-tbl { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; }
.ml-cols { display: grid; grid-template-columns: minmax(190px, 1.6fr) 100px minmax(120px, 1fr) minmax(150px, 1.3fr) 176px minmax(150px, 170px) 38px; column-gap: 14px; align-items: center; }
.ml-cols.no-resp { grid-template-columns: minmax(190px, 1.6fr) 100px minmax(150px, 1.3fr) 176px minmax(150px, 170px) 38px; }
.ml-colhead { flex: none; height: var(--al-row-compact); padding: 0 15px; border-bottom: 1px solid var(--al-divider); font-size: var(--al-fs-label); font-weight: 600; color: var(--al-text-2); }
.ml-ws-h { display: flex; align-items: center; gap: 6px; }
.ml-body { position: relative; flex: 0 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 6px; }
.ml-body-state { padding: 0; }
.ml-row-item.depth-row { position: relative; display: grid; height: var(--al-row-2line); padding: 8px 9px; cursor: pointer; }
.ml-row-item.depth-row:hover { background: var(--al-selected); }
.ml-row-item.depth-row.is-selected { background: var(--al-selected); }
.ml-row-item.open { z-index: 40; background: var(--al-selected); }
.ml-row-item > * { min-width: 0; }
.ml-cell-name { display: block; font-weight: 500; color: var(--al-text) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-cell-sub { display: flex; gap: 6px; font-size: 12px; color: var(--al-text-2); min-width: 0; }
.ml-cell-sub .ml-clamp { min-width: 0; }
.ml-cell-sub .ml-mono { flex: none; white-space: nowrap; }
.ml-cell-1 { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-cell-1.b { font-weight: 500; }
.ml-cell-1.m { color: var(--al-text-2); }
.ml-cell-2 { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--al-fs-label); color: var(--al-text-2); }
.ml-cell-2.bad { color: var(--al-attention); }
.ml-cell-2.wrap { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.ml-group { display: flex; gap: 6px; align-items: baseline; padding: 14px 9px 4px; font-size: 13px; font-weight: 500; color: var(--al-text-2); }
.ml-dots { display: flex; align-items: center; gap: 0; flex-wrap: nowrap; padding: 16px 0; margin: -16px 0; }
.ml-dot-slot { flex: none; width: 28px; height: 8px; display: flex; justify-content: center; }
.ml-dot-slot.is-hidden { width: 28px; height: 8px; font: 400 12px/8px var(--v3-font); color: var(--al-text-3); text-align: center; display: block; }
.ml-dot { display: block; width: 8px; height: 8px; border-radius: 50%; box-sizing: border-box; }
.ml-dot[data-s="clear"] { background: var(--al-success); }
/* ML3-02 / O1 (RULES 19): the state is never colour alone: needs-attention is a filled dot inside a ring, done is a filled dot, started a ring, not started a pale ring */
.ml-dot[data-s="attention"], .ml-dot[data-s="exception"] { background: var(--al-attention); box-shadow: 0 0 0 2px var(--al-card), 0 0 0 3.5px var(--al-attention); }
.ml-dot[data-s="pending"] { background: transparent; box-shadow: inset 0 0 0 1.5px var(--al-action); }
.ml-dot[data-s="notstarted"] { background: transparent; box-shadow: inset 0 0 0 1.5px var(--al-line-control); }
.ml-ws-w { display: inline-flex; align-items: center; gap: 8px; }
.ml-skel-row { padding: 14px 9px; }
.ml-skel { display: block; height: 10px; background: var(--al-divider); border-radius: var(--al-r-chip); }
.ml-skel.s { height: 8px; background: var(--al-divider); }
.ml-skel-stack { display: flex; flex-direction: column; gap: 6px; }
.ml-state { padding: 56px 20px; }
.ml-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--al-divider); font-size: 12px; }
.ml-pager { display: flex; align-items: center; gap: 8px; flex: none; }

/* the relationship panel: the package reader surface over a dimmed page (the same behaviour as Post-sale) */
.ml-scrim { position: fixed; top: var(--al-topbar-h); left: 0; right: 0; bottom: 0; z-index: 69; background: var(--v3-scrim); }
.ml-panel { position: fixed; top: var(--al-topbar-h); right: 0; bottom: 0; width: 460px; max-width: 100vw; z-index: 70; background: var(--al-raised); box-shadow: var(--al-shadow-menu); display: flex; flex-direction: column; }
.ml-panel * { box-sizing: border-box; }
.ml-panel a { color: var(--al-action); text-decoration: none; }
.ml-panel a:hover { text-decoration: underline; }
.ml-panel-head { flex: none; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; min-height: var(--al-sticky-h); padding: 16px 24px 12px; }
.ml-panel-head h2 { margin: 0; font: 600 var(--al-fs-card)/1.3 var(--al-font-ui); color: var(--al-text); overflow-wrap: anywhere; }
.ml-panel-meta { margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--al-text-2); }
.ml-panel-acts { display: flex; align-items: center; gap: 6px; flex: none; }
.ml-panel-body { position: relative; flex: 1; min-height: 0; overflow: auto; padding: 0 24px 20px; overscroll-behavior: contain; scrollbar-width: thin; }
.ml-sec { padding: 14px 0; }
.ml-sec .alf-label { margin: 0 0 8px; font-size: var(--v3-fs-label); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--al-text-2); }   /* ML3-07: the pack's label style */
.ml-ws { display: grid; grid-template-columns: 92px 128px minmax(0, 1fr); gap: 8px; padding: 6px 0; align-items: center; }
.ml-deed { display: grid; grid-template-columns: 96px minmax(0, 1fr); row-gap: 6px; column-gap: 8px; }
.ml-deed span:nth-child(odd) { color: var(--al-text-2); }
.ml-prior { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.ml-prior .w { flex: 0 1 auto; min-width: 0; text-align: right; overflow-wrap: anywhere; font-size: 12px; color: var(--al-text-2); }   /* ML3-W3: the match reason wraps instead of being cut */
.ml-doc { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.ml-doc span:first-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-doc span:last-child { flex: none; color: var(--al-text-2); }

/* dialogs: the package dialog, one confirm width, one form width */
.ml-overlay { position: fixed; inset: 0; z-index: 400; background: var(--v3-scrim); display: grid; place-items: center; font: 400 var(--al-fs-ui)/var(--al-lh-ui) var(--al-font-ui); color: var(--al-text); }
.ml-overlay * { box-sizing: border-box; }
.ml-overlay a { color: var(--al-action); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
body.ml-dlg-open { overflow: hidden; }
.ml-dlg.depth-dialog { width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.ml-dlg.depth-dialog.ml-dlg-form { width: min(560px, calc(100vw - 32px)); }
.ml-dlg .depth-dialog-header { padding: 24px 25px 4px; }
.ml-dlg .depth-dialog-header h2 { margin: 0; font: 800 var(--v3-fs-section)/1.25 var(--al-font-ui); color: var(--v3-navy); }   /* K2 (RULES 11) */
.ml-dlg .depth-dialog-header p { margin: 4px 0 0; }
.ml-dlg-body { position: relative; flex: 1; min-height: 0; overflow: auto; padding: 14px 25px 6px; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; scrollbar-width: thin; }
.ml-dlg .depth-dialog-actions { flex: none; margin: 0; padding: 14px 25px 22px; }
.ml-grants { position: relative; display: flex; flex-direction: column; gap: 10px; max-height: min(380px, 44vh); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; flex: none; }
.ml-gr-person { display: flex; flex-direction: column; }
.ml-gr-name { display: flex; align-items: baseline; gap: 8px; padding: 4px 9px; }
.ml-gr-row { display: flex; align-items: center; gap: 12px; padding: 4px 9px; min-height: 40px; border-radius: var(--al-r-control); }
.ml-gr-row:hover { background: var(--al-selected); }
.ml-gr-row > span:first-child { flex: 1; min-width: 0; }
.ml-gr-new { margin: 6px 0 -4px; }
.ml-grant-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.ml-pickwrap { position: relative; }

/* wide screens keep the type size and give the width to the columns */
@media (min-width: 1600px) {

  .ml-cols { column-gap: 20px; grid-template-columns: minmax(220px, 1.5fr) 120px minmax(150px, 1fr) minmax(200px, 1.5fr) 176px minmax(160px, 190px) 38px; }
  .ml-cols.no-resp { grid-template-columns: minmax(220px, 1.5fr) 120px minmax(200px, 1.5fr) 176px minmax(160px, 190px) 38px; }
}
@media (max-width: 1360px) {
  .ml-cols { grid-template-columns: minmax(170px, 1.5fr) 92px minmax(110px, 1fr) minmax(130px, 1.2fr) 176px minmax(140px, 160px) 38px; column-gap: 12px; }
  .ml-cols.no-resp { grid-template-columns: minmax(170px, 1.5fr) 92px minmax(130px, 1.2fr) 176px minmax(140px, 160px) 38px; }
}

/* the new-matter wizard: the package dialog that sizes to its step, numbered steps, labelled fields (L19-L26) */
.ml-wiz.depth-dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.ml-wiz-head { flex: none; display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 25px 10px; gap: 12px; }
.ml-wiz-head h2 { margin: 0; font: 800 var(--v3-fs-section)/1.25 var(--al-font-ui); color: var(--v3-navy); }   /* K2 (RULES 11): a dialog title is a section title, 20/800 */
.ml-wiz-head p { margin: 2px 0 0; color: var(--al-text-2); }
.ml-steps { flex: none; display: flex; align-items: center; gap: 24px; min-height: 56px; padding: 0 25px; flex-wrap: wrap; }
.ml-step { display: inline-flex; align-items: center; gap: 8px; color: var(--al-text-2); font: 400 var(--al-fs-ui)/1 var(--al-font-ui); }
.ml-step .n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; box-sizing: border-box; box-shadow: inset 0 0 0 1.5px var(--al-line-control); font-size: var(--al-fs-label); font-weight: 600; background: transparent; color: var(--al-text-2); }
.ml-step .n svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.ml-step.is-done { color: var(--al-text); font-weight: 500; }
.ml-step.is-done .n { box-shadow: inset 0 0 0 1.5px var(--al-action); color: var(--al-action); }
.ml-step.is-current { color: var(--al-text); font-weight: 600; }
.ml-step.is-current .n { background: var(--al-action); box-shadow: none; color: var(--al-text-inverse); }
.ml-step-btn { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; border-radius: var(--al-r-control); }
.ml-step-btn:hover .l { text-decoration: underline; }
.ml-step-btn:focus-visible { outline: none; box-shadow: var(--al-focus); }
.ml-wiz-body { position: relative; flex: 0 1 auto; min-height: 0; overflow: auto; padding: 20px 25px; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; scrollbar-width: thin; }
.ml-wiz-foot { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 25px 20px; border-top: 1px solid var(--al-divider); }
.ml-wiz-foot > div { display: flex; gap: 8px; align-items: center; }
.ml-foot-why { font-size: 13px; }
.ml-drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 220px; border: 1.5px dashed var(--al-line-control); border-radius: var(--al-r-card); padding: 32px; text-align: center; background: var(--al-card); }
.ml-drop-zone.over { border-color: var(--al-action); background: var(--al-selected); }
.ml-drop-zone b { font-weight: 500; display: block; }
.ml-drop-zone p { margin: 0 0 12px; color: var(--al-text-2); }
.ml-files { border-radius: var(--al-r-card); background: var(--al-card); padding: 4px; }
.ml-files > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 8px 4px 12px; min-height: 40px; }
.ml-files span:last-child { color: var(--al-text-2); display: inline-flex; align-items: center; gap: 4px; }
.ml-prog { display: flex; gap: 10px; align-items: center; }
.ml-prog .d { width: 16px; height: 16px; border-radius: 50%; background: var(--al-success); display: grid; place-items: center; flex: none; }
.ml-prog .n { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--al-selected); border-top-color: var(--al-action); flex: none; animation: ml-spin 900ms linear infinite; }
@keyframes ml-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ml-prog .n { animation: none; border-top-color: var(--al-action); } }
.ml-chat { display: flex; gap: 10px; }
.ml-chat.me { align-self: flex-end; }
.ml-avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--al-shell); color: var(--al-brass); display: grid; place-items: center; font-family: 'Cormorant Garamond', serif; font-size: 15px; flex: none; }
.ml-bubble { background: var(--al-selected); border-radius: var(--al-r-card); padding: 10px 12px; max-width: 520px; white-space: pre-wrap; }
.ml-chat.me .ml-bubble { background: var(--al-selected); max-width: 480px; }
.ml-reply { display: flex; gap: 8px; margin-top: auto; align-items: flex-start; }
.ml-review { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.ml-src { font-size: 12px; font-weight: 400; color: var(--al-text-2); display: inline-flex; align-items: flex-start; gap: 5px; }
.ml-src.is-attn { color: var(--al-attention); font-weight: 500; }
.ml-src .alf-icon { width: 13px; height: 13px; margin-top: 2px; flex: none; }

/* scroll areas: the pack's 6px thumb, no fade over rows or buttons (RULES section 4) */
.ml-body, .ml-panel-body, .ml-dlg-body, .ml-grants, .ml-wiz-body, .ml-facet-list, .ml-pop { scrollbar-width: thin; scrollbar-color: var(--al-scroll-thumb) transparent; }

/* critical actions in dialogs are the one filled button (B6); a field never floats in a taller grid row; the panel header stacks without a dangling separator */
.ml-dlg .alf-button--danger, .ml-wiz .alf-button--danger { background: var(--al-critical); color: var(--al-text-inverse); box-shadow: none; }
.ml-dlg .alf-button--danger:hover, .ml-wiz .alf-button--danger:hover { background: var(--al-critical); box-shadow: 0 0 0 2px var(--al-critical-wash); }
.ml-wiz .alf-field { align-content: start; }
.ml-panel-meta { flex-direction: column; align-items: flex-start; gap: 2px; }
.ml-panel-meta > span:nth-child(2) { display: none; }

/* C10: selected on the page background (view tabs, scope chips) = card fill + card shadow + action text 600; on a card the plate stays */
.ml-tabsrow .alf-tab[aria-selected=true] { background: none; box-shadow: inset 0 -2px 0 var(--al-brass); color: var(--al-action); font-weight: 700; }
.ml-tabsrow .alf-filter[aria-pressed=true] { background: var(--al-selected); box-shadow: inset 0 0 0 1px var(--al-action); color: var(--al-action); font-weight: 700; }

.ml-tabsrow .alf-filter:not([aria-pressed=true]) { box-shadow: none; background: transparent; }
.ml-tabsrow .alf-filter:not([aria-pressed=true]):hover { box-shadow: none; background: var(--al-selected); }
/* P1-4: a menu item with a sub-label is one 64px block, 8px padding */
#ml-pop-host .ml-pop button { min-height: var(--al-row-compact); padding: 8px 12px; }
#ml-pop-host .ml-pop button:has(small) { min-height: var(--al-row-2line); }
/* P1-5: the fade returns, with 24px of space under the last row so nothing sits in it */
.ml-body, .ml-panel-body, .ml-dlg-body, .ml-grants { padding-bottom: 24px; }
.ml-panel-body.has-more-below, .ml-dlg-body.has-more-below, .ml-grants.has-more-below { -webkit-mask-image: linear-gradient(black calc(100% - 48px), transparent); mask-image: linear-gradient(black calc(100% - 48px), transparent); }
/* P2-18: counts are text-2, amber is attention only; P2-19 no resize grip */
.ml-opt .ct, .ml-count { color: var(--al-text-2); }
.ml-dlg textarea, .ml-wiz textarea, .ml-overlay textarea { resize: none; }

/* situation sub-line is one line (CD P1-1a); the head stats wrap with the dot trailing the item before it, never leading a line */
.ml-cell-2.wrap { white-space: nowrap; display: block; }
.ml-stats { gap: 0 8px; }

/* round 2 (CD audit L1, L3, L6): rows at 1366 — 56px two-line rows, search and filters on one 40px row, one-line stat line */
.ml-stats { flex-wrap: nowrap; white-space: nowrap; }
.ml-completing { color: var(--al-text-2); margin-right: 12px; white-space: nowrap; font-size: var(--al-fs-label); }
.ml-tabsrow .alf-filters { display: flex; align-items: center; }
.ml-tools { flex-wrap: nowrap; align-items: center; }
.ml-tools > #ml-row1 { flex: 1 1 360px; min-width: 200px; }
.ml-tools > #ml-row2 { flex: 0 1 auto; min-width: 0; flex-wrap: nowrap; }
.ml-tools .ml-search input, .ml-tools .alf-filter, .ml-tools select, .ml-tools .alf-button { height: 40px; min-height: 40px; box-sizing: border-box; }
.ml-tools select.is-compact { max-width: 200px; text-overflow: ellipsis; }
@media (max-width: 1180px) { .ml-tools { flex-wrap: wrap; } .ml-tools > #ml-row2 { flex-wrap: wrap; } }
.ml-row-item.depth-row { height: 56px; min-height: 56px; padding: 9px 9px; }
.ml-row-item .ml-cell-name, .ml-row-item .ml-cell-1 { font-size: var(--al-fs-read); line-height: 20px; }
.ml-row-item .ml-cell-sub, .ml-row-item .ml-cell-2 { font-size: var(--al-fs-label); line-height: 18px; }
.ml-cell-2.wrap { -webkit-line-clamp: 1; }
.ml-cols.is-hist { grid-template-columns: minmax(240px, 2fr) 110px minmax(160px, 1.4fr) 150px 38px; }
.ml-cols.is-hist.no-resp { grid-template-columns: minmax(240px, 2fr) 110px 150px 38px; }

/* L2: the main action keeps its primary form when it cannot be used yet: navy at 40% with white text; Cancel stays quiet */
.ml-wiz-foot .alf-button--primary[aria-disabled=true], .ml-wiz-foot .alf-button--primary:disabled { background: var(--al-action); color: var(--al-text-inverse); box-shadow: none; opacity: .45; }

/* L4: grants — the person is a group heading, every grant row has a hairline, "Quitar" is a quiet button with a visible hover; no box round the date icon */
.ml-gr-person + .ml-gr-person { margin-top: 8px; }
.ml-gr-name { gap: 8px; padding: 8px 9px 4px; font-size: var(--al-fs-label); font-weight: 600; color: var(--al-text-2); }
.ml-gr-name .b { color: var(--al-text-2); font-weight: 600; }
.ml-gr-name .ml-muted { font-weight: 400; }
.ml-gr-row { border-radius: 0; border-bottom: 1px solid var(--al-divider); }
.ml-gr-row:last-child { border-bottom: 0; }
.ml-gr-row .alf-button--quiet { color: var(--al-action); }
.ml-gr-row .alf-button--quiet:hover { background: var(--al-selected); box-shadow: none; }
.ml-overlay .fe-date-button, #ml-wizard-host .fe-date-button, #ml-overlay-host .fe-date-button { background: transparent; box-shadow: none; }
.ml-overlay .fe-date-button:hover, #ml-overlay-host .fe-date-button:hover { background: var(--al-selected); }

/* L5: the panel's workstream rows are two columns; the note sits under the status on its own line */
.ml-ws { grid-template-columns: 140px minmax(0, 1fr); align-items: start; }
.ml-ws-st { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ml-ws-note { font-size: var(--al-fs-label); overflow-wrap: anywhere; }

/* L7: a group header is a section label — 13px 600, a hairline above it, sticky under the column heads */
.ml-group { position: sticky; top: -6px; z-index: 2; background: var(--al-card); font-weight: 600; padding: 12px 9px 6px; border-top: 1px solid var(--al-divider); margin-top: 4px; }
.ml-body > .ml-group:first-child { border-top: 0; margin-top: 0; }

/* L1 (second pass): six rows at 1366 — the space above the first row is spent only on what is needed */
.ml-well { gap: 16px; }
.ml-tools { padding: 8px 16px; }
.ml-body { padding-top: 0; }
.ml-body > .ml-row-item + .ml-row-item { margin-top: 0; }

/* L1 (third pass): the 6th row fits whole at 1366 — the card ends 6px above the pill, the tools row is tighter */
#view-cases .ml { max-height: calc(100vh - var(--al-topbar-h) - var(--well-t) - 80px); }
.ml-tools { padding: 6px 16px 8px; }

/* L1/L6 (fourth pass, Spanish seat): the sort and group controls shrink to fit the card; every field is 40 high; a placeholder that is still too long ends in an ellipsis */
.ml-tools { gap: 8px 8px; }
.ml-row2 { gap: 8px; }
.ml-sel-label { gap: 6px; flex: none; }
.ml-sel-label .alf-select { width: auto; min-width: 0; }
.ml-sel-label .alf-select .fe-choice { min-height: 40px; height: 40px; }
.ml-sel-label:first-of-type .alf-select { max-width: 164px; }
.ml-sel-label:last-of-type .alf-select { max-width: 100px; }
.ml-sel-label .alf-select .fe-choice > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ml-search input { text-overflow: ellipsis; }
.ml-search input::placeholder { text-overflow: ellipsis; }

/* L1 (filter applied, Spanish 1366): the search gives way first so the tools row never runs past the card */
.ml-tools > #ml-row1 { flex: 1 1 360px; min-width: 120px; }
.ml-tools .ml-search { min-width: 0; }
.ml-tools > #ml-row2 { flex-shrink: 1; }
.ml-tools > #ml-row2 .ml-facet-wrap, .ml-tools > #ml-row2 .ml-sel-label { flex: none; }
.ml-tools > #ml-row2 { flex: 0 0 auto; }

/* GB-21: the group heading is sticky directly under the column heads, 13/600 text-2 on the card surface, a hairline below it while stuck */
.ml-group { top: 0; font-size: 13px; font-weight: 600; color: var(--al-text-2); background: var(--al-card); border-bottom: 1px solid transparent; }
.ml-group.is-stuck { border-bottom-color: var(--al-divider); }
/* GB-22: Borrar in the facet menu is off (text-3, no hover) until a value is selected */
.ml-facet-foot [aria-disabled="true"] { color: var(--al-text-3); background: none; box-shadow: none; pointer-events: none; cursor: default; }
.ml-sel-label:has(select[data-a="group"]) .alf-select, .ml-sel-label select[data-a="group"] { min-width: 160px; }
/* GB N1 (CD, gb1c audit): the Ordenar select shows its whole value */
.ml-tools select.is-compact[data-a="sort"] { max-width: none; }
.ml-sel-label:has(select[data-a="sort"]) .alf-select, .ml-sel-label select[data-a="sort"] { min-width: 232px; max-width: none; }

/* step 4, area 2: the six dots are one tab stop; the focus ring is the pack's */
.ml-dots:focus-visible { outline: 0; box-shadow: var(--al-focus-ring, 0 0 0 2px var(--al-card), 0 0 0 4px var(--al-action)); border-radius: var(--al-r-control); }

/* step 4, area 2: in Spanish at 1366 nothing may run past the screen: the figures line wraps before the actions move, the scope row and the tools row wrap, the search gives way first */
.ml-stats { flex-wrap: wrap; white-space: normal; }
.ml-stats > span { white-space: nowrap; }
.ml-tabsrow { flex-wrap: wrap; }
.ml-tools { flex-wrap: wrap; }
.ml-tools > #ml-row1 { flex: 1 1 290px; min-width: 290px; }
.ml-tools > #ml-row2 { display: contents; }

/* the other-matters link in the panel has a full row's hit area without moving the row */
.ml-prior a.ml-mono { display: inline-block; padding: 12px 0; margin: -12px 0; }

/* ML-16 (CD r2a): in Archived the Type column fits "NIE/Residency"; the Outcome column ("Archived", "Closed") needs less than the dots did */
.ml-cols.is-arch { grid-template-columns: minmax(190px, 1.6fr) 128px minmax(120px, 1fr) minmax(150px, 1.3fr) 104px minmax(120px, 150px) 38px; }
.ml-cols.is-arch.no-resp { grid-template-columns: minmax(190px, 1.6fr) 128px minmax(150px, 1.3fr) 104px minmax(120px, 150px) 38px; }
@media (max-width: 1360px) {
  .ml-cols.is-arch { grid-template-columns: minmax(160px, 1.5fr) 124px minmax(100px, 1fr) minmax(120px, 1.2fr) 96px minmax(110px, 130px) 38px; }
  .ml-cols.is-arch.no-resp { grid-template-columns: minmax(160px, 1.5fr) 124px minmax(120px, 1.2fr) 96px minmax(110px, 130px) 38px; }
}
/* ML-20 (CD r2a): a separator never starts a line; it ends the piece before it, so a wrap leaves it at the end of line 1 */
.ml-stats > span + span::before { content: none; }
.ml-stats > span:not(:last-child)::after { content: "·"; margin-left: 8px; color: var(--al-text-2); }
/* ML3-02 / O1: the six names sit over the six dots */
.ml-ws-h { gap: 0; }
.ml-ws-abbr { flex: none; width: 28px; text-align: center; font-size: var(--v3-fs-label); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
/* ML3-D1 (CD, 17 Oct): a row that needs attention is given weight: its reason is in the attention colour and heavier than the quiet lines around it */
.ml-cell-2.reason { font-weight: 600; }
/* ML3-O2 (CD, 17 Oct): the type and the client's side read on one line, 'Purchase / Buyer' */
.ml-side { color: var(--al-text-2); }
/* ML3-08: the grants dialog has a search and a count over the list */
.ml-gr-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.ml-gr-bar input { flex: 1; min-width: 0; }
.ml-gr-bar .ml-muted { flex: none; white-space: nowrap; }
.ml-gr-person[hidden], .ml-gr-row[hidden] { display: none; }
/* ML3-02 (Codex r1, live): the column head sits outside the scrolling list, so a list long enough to scroll lost a scrollbar's width on its rows and the workstream names sat 10 px off their dots. Both reserve the same gutter, whether or not the list scrolls */
.ml-body { scrollbar-gutter: stable; }
.ml-colhead { overflow-y: hidden; scrollbar-gutter: stable; scrollbar-width: thin; }
/* ML3-11 (Codex r1, CD level 2): the list does not fade its last rows (a fade reads as disabled, and hides readable text while more rows exist); a soft shadow along the bottom edge says there is more, the text stays whole */
.ml-body.has-more-below { box-shadow: inset 0 -10px 8px -8px rgba(15, 23, 42, .22); }
