/* Dossiers: viewport workspace, shared controls and compact status matrix. */
.dx-page {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: .75rem;
  height: calc(100vh - var(--topbar-h) - 4.5rem);
  height: calc(100dvh - var(--topbar-h) - 4.5rem);
  min-height: 0;
  min-width: 0;
}
.dx-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.dx-head .page-head { margin: 0; }
.dx-head .page-head h2 { font-size: 1.3rem; }
.dx-head .subtitle { font-size: .82rem; }
.dx-head-actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.dx-secondary { position: relative; }
.dx-secondary > summary { cursor: pointer; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .45rem .65rem; font-size: .82rem; background: var(--panel); }
.dx-secondary-menu { position: absolute; right: 0; top: calc(100% + .4rem); width: min(340px, 85vw); padding: .85rem; display: grid; gap: .65rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 45; }
.dx-secondary-menu > button { white-space: normal; }
.dx-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.dx-metric { justify-content: flex-start; gap: .75rem; text-align: left; padding: .65rem .85rem; background: var(--panel); border-color: var(--line); border-radius: var(--radius); white-space: normal; }
.dx-metric strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; color: var(--dx-color); line-height: 1.1; }
.dx-metric span { font-size: .8rem; color: var(--ink-2); }
.dx-metric[aria-pressed="true"] { border-color: var(--dx-color); background: var(--dx-soft); box-shadow: inset 0 0 0 1px var(--dx-color); }
.dx-toolbar { position: sticky; top: calc(var(--topbar-h) + .4rem); z-index: 20; padding: .7rem .85rem .35rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.dx-controls { display: flex; gap: .65rem; align-items: flex-end; flex-wrap: wrap; }
.dx-controls > :first-child { flex: 1 1 190px; }
.dx-controls input[type="search"] { width: 100%; }
.dx-controls > label { margin: 0; min-width: 0; }
.dx-controls label { font-size: .78rem; }
.dx-controls select { max-width: 185px; }
.dx-action-check { align-self: center; max-width: 220px; white-space: normal; line-height: 1.4; }
.dx-modes { margin-left: auto; flex-shrink: 0; }
.dx-modes button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.dx-type-row { display: flex; gap: .65rem; align-items: flex-start; margin-top: .65rem; }
.dx-type-row > span { padding-top: .3rem; }
.dx-types { display: flex; gap: .35rem; flex-wrap: wrap; min-width: 0; }
.dx-type { border-radius: 100px; padding: .2rem .6rem; min-height: 28px; font-size: .75rem; border-color: var(--line); box-shadow: none; }
.dx-type[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.dx-context { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .35rem; }
.dx-workspace { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.dx-scroll { min-height: 0; min-width: 0; overflow: scroll; scrollbar-gutter: stable; overscroll-behavior: contain; scrollbar-width: auto; scrollbar-color: var(--line-strong) var(--panel-2); position: relative; }
.dx-scroll::-webkit-scrollbar { width: 12px; height: 12px; }
.dx-scroll::-webkit-scrollbar-track { background: var(--panel-2); }
.dx-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border: 3px solid var(--panel-2); border-radius: 10px; }
.dx-scroll[aria-busy="true"] { opacity: .6; pointer-events: none; }
.dx-scroll > p { padding: 1rem; }
.dx-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .8rem; }
.dx-table th, .dx-table td { border-bottom: 1px solid var(--line); padding: .45rem .65rem; white-space: nowrap; vertical-align: middle; }
.dx-table thead th { position: sticky; top: 0; z-index: 3; background: var(--panel-2); box-shadow: 0 1px 0 var(--line-strong); height: 42px; color: var(--ink-2); font-weight: 600; }
.dx-table tbody th, .dx-table tbody td { background: var(--panel); }
.dx-table tbody tr:hover > *, .dx-table tbody tr:focus-within > * { background: var(--accent-soft); }
.dx-matrix { width: max-content; min-width: 100%; }
.dx-matrix th:not(:first-child) { min-width: 148px; max-width: 210px; white-space: normal; }
.dx-matrix th:first-child { position: sticky; left: 0; z-index: 2; min-width: 215px; max-width: 265px; border-right: 1px solid var(--line-strong); }
.dx-matrix thead th:first-child { z-index: 4; }
.dx-agent { display: flex; flex-direction: column; gap: .1rem; text-align: left; font-weight: 400; }
.dx-agent a { color: var(--ink); font-weight: 600; white-space: normal; overflow-wrap: anywhere; }
.dx-cell { width: 100%; min-height: 31px; justify-content: flex-start; gap: .45rem; border: 1px solid transparent; background: var(--dx-soft); color: var(--dx-color); box-shadow: none; font-size: .76rem; padding: .3rem .5rem; }
.dx-cell:hover { background: var(--dx-soft); border-color: var(--dx-color); color: var(--dx-color); }
.dx-cell-alert { font-size: .65rem; font-weight: 650; margin-left: auto; }
.dx-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--dx-color); }
.dx-ok { --dx-color: var(--ok); --dx-soft: var(--ok-soft); }
.dx-warn { --dx-color: var(--warn); --dx-soft: var(--warn-soft); }
.dx-bad { --dx-color: var(--bad); --dx-soft: var(--bad-soft); }
.dx-info { --dx-color: var(--info); --dx-soft: var(--info-soft); }
.dx-neutral { --dx-color: var(--muted); --dx-soft: var(--soft); }
.dx-dim { color: var(--faint); text-align: center; }
.dx-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .35rem .75rem; padding: .5rem .75rem; border-top: 1px solid var(--line); background: var(--panel-2); }
.dx-foot nav { width: 100%; justify-content: flex-end; }
.dx-foot nav > span:first-child { margin-right: auto; }
.dx-legend { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; font-size: .72rem; color: var(--muted); }
.dx-legend > span { display: inline-flex; gap: .3rem; align-items: center; }
.dx-list { min-width: 900px; }
.dx-list tbody tr { cursor: pointer; }
.dx-list thead button { color: var(--ink-2); font-weight: 600; }
.dx-list .dx-open { white-space: normal; text-align: left; justify-content: flex-start; color: var(--accent); padding: .2rem 0; }
.dx-table .dx-overdue { color: var(--bad); font-weight: 650; }
.dx-page :focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 1100px) {
  .dx-head { align-items: flex-start; }
  .dx-head-actions { flex-wrap: wrap; justify-content: flex-end; }
  .dx-action-check { max-width: none; }
  .dx-metric { gap: .4rem; padding: .5rem; }
  .dx-metric strong { font-size: 1.25rem; }
}
@media (max-width: 700px) {
  .dx-page { height: calc(100dvh - var(--topbar-h) - 3.5rem); gap: .5rem; min-height: 0; }
  .dx-head { flex-direction: column; gap: .45rem; }
  .dx-head-actions { width: 100%; justify-content: space-between; }
  .dx-metrics { display: flex; overflow-x: auto; padding-bottom: .2rem; }
  .dx-metric { min-width: 150px; flex: 1 0 150px; }
  .dx-metric span { font-size: .74rem; }
  .dx-toolbar { padding: .5rem; }
  .dx-controls { gap: .4rem; }
  .dx-controls > label:not(.check) { flex: 1 1 42%; }
  .dx-controls > label:first-child { flex-basis: 100%; }
  .dx-controls select { width: 100%; max-width: none; }
  .dx-action-check { flex: 1 1 55%; }
  .dx-types { flex-wrap: nowrap; overflow-x: auto; padding: .15rem 0 .4rem; }
  .dx-type { flex-shrink: 0; }
  .dx-context { align-items: flex-start; }
  .dx-context > span { font-size: .72rem; }
  .dx-matrix th:first-child { min-width: 155px; max-width: 175px; }
  .dx-table th, .dx-table td { padding: .35rem .45rem; }
  .dx-foot { padding: .35rem .5rem; }
  .dx-legend { gap: .3rem .6rem; font-size: .65rem; }
}
