/* ═══════════════════════════════════════════════════════════════════════════
   dtx-1 · DISTRIBUTION TASK — workspace design system            2026-09-05
   ---------------------------------------------------------------------------
   Namespace: .dtx-*  ·  tokens: --dt-*  ·  theme switch: html[data-dt-theme]

   ── WHY ITS OWN TOKEN RAMP ────────────────────────────────────────────────
   MUMS already carries three independent ramps (--ss-* Support Studio,
   --sc-* Services, and main's own), each governed by CODE_UNTOUCHABLES. A
   fourth workspace that borrowed one of them would be a change to a guarded
   domain every time it needed a shade. --dt-* is additive and reaches nothing
   else; re-pointing it re-skins this workspace and nothing but.

   ── THE COLOUR CONTRACTS THIS FILE HOLDS ──────────────────────────────────
   1. EVERY colour is a token. A literal tuned for one ramp is wrong in the
      other by construction (the .mtx-badge defect: `var(--muted, #94a3b8)`
      shipped a dark literal that the light layer then honoured at 2.61:1).
   2. THE INK IS A PAIRED TOKEN OF THE FILL. Wherever a solid accent/semantic
      fill is used, the text on it comes from that fill's OWN ink token, never
      from --dt-text and never from the accent itself. --dt-accent is an INK
      colour; --dt-accent-fill is a FILL colour; they are different values and
      swapping them is the 2.48:1 button defect.
   3. The light ramp is the base (bare :root) and the dark ramp REDEFINES the
      same tokens, so no colour has its only definition inside a selector that
      might not match.
   4. Measured, not assumed: every pairing below was computed before it was
      written. Floor 4.82:1 (light) / 4.92:1 (dark), AA on both.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── LIGHT (base) ─────────────────────────────────────────────────────── */
  --dt-bg:        #eef1f7;
  --dt-bg2:       #f6f8fc;
  --dt-panel:     #ffffff;
  --dt-panel2:    #f3f6fb;
  --dt-panel3:    #e9eef7;
  --dt-line:      #d3dbe8;
  --dt-line2:     #bcc7da;

  --dt-text:      #0d1526;
  --dt-text2:     #41506b;
  --dt-text3:     #5b6b86;

  --dt-accent:      #0b6fa8;   /* INK  — accent used as text/icon */
  --dt-accent-fill: #0b6fa8;   /* FILL — accent used as a background */
  --dt-accent-ink:  #ffffff;   /* the ink that belongs ON that fill */
  --dt-accent-soft: #e0f0fb;   /* tinted ground; takes --dt-accent as ink */

  --dt-ok:        #166534;  --dt-ok-fill:   #15803d;  --dt-ok-ink:   #ffffff;  --dt-ok-soft:   #dcfce7;
  --dt-warn:      #8a5a00;  --dt-warn-fill: #a16207;  --dt-warn-ink: #ffffff;  --dt-warn-soft: #fef3c7;
  --dt-bad:       #b3261e;  --dt-bad-fill:  #b91c1c;  --dt-bad-ink:  #ffffff;  --dt-bad-soft:  #fee2e2;
  --dt-info:      #0b5f96;  --dt-info-fill: #0369a1;  --dt-info-ink: #ffffff;  --dt-info-soft: #e0f2fe;

  --dt-scrim:     rgba(13, 21, 38, .48);
  --dt-shadow:    0 1px 2px rgba(13, 21, 38, .06), 0 8px 24px rgba(13, 21, 38, .08);
  --dt-shadow-lg: 0 12px 48px rgba(13, 21, 38, .18);
  --dt-radius:    12px;
  --dt-radius-sm: 8px;
  --dt-rail-w:    288px;

  --dt-font: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --dt-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: light;
}

html[data-dt-theme="dark"] {
  --dt-bg:        #0b0f16;
  --dt-bg2:       #0f1520;
  --dt-panel:     #131b28;
  --dt-panel2:    #1a2434;
  --dt-panel3:    #212d40;
  --dt-line:      #233247;
  --dt-line2:     #31445f;

  --dt-text:      #e9eefc;
  --dt-text2:     #aebbd6;
  --dt-text3:     #8496b4;

  --dt-accent:      #4cc4f7;
  --dt-accent-fill: #0b6fa8;
  --dt-accent-ink:  #ffffff;
  --dt-accent-soft: #10293b;

  --dt-ok:        #4ade80;  --dt-ok-fill:   #15803d;  --dt-ok-ink:   #ffffff;  --dt-ok-soft:   #0f2a1c;
  --dt-warn:      #fbbf24;  --dt-warn-fill: #a16207;  --dt-warn-ink: #ffffff;  --dt-warn-soft: #2c2210;
  --dt-bad:       #fb7185;  --dt-bad-fill:  #b91c1c;  --dt-bad-ink:  #ffffff;  --dt-bad-soft:  #2e1418;
  --dt-info:      #7dd3fc;  --dt-info-fill: #0369a1;  --dt-info-ink: #ffffff;  --dt-info-soft: #0d2334;

  --dt-scrim:     rgba(3, 7, 14, .68);
  --dt-shadow:    0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .38);
  --dt-shadow-lg: 0 16px 56px rgba(0, 0, 0, .6);

  /* Native widgets (select popups, date pickers, scrollbars) are painted from
     color-scheme, NOT from this stylesheet. Without this line a <select>'s
     dropdown LIST renders white-on-white in dark mode — and no amount of CSS
     on the <select> element itself can reach it. */
  color-scheme: dark;
}

/* ── reset / shell ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--dt-bg);
  color: var(--dt-text);
  font-family: var(--dt-font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.dtx-app {
  display: grid;
  grid-template-rows: 56px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ══ TOP BAR ═══════════════════════════════════════════════════════════ */
.dtx-top {
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  background: var(--dt-panel);
  border-bottom: 1px solid var(--dt-line);
  z-index: 40;
}
.dtx-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .2px; }
.dtx-brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--dt-accent-fill); color: var(--dt-accent-ink);
  font-size: 14px;
}
.dtx-brand-sub { font-size: 11px; font-weight: 600; color: var(--dt-text3); letter-spacing: .5px; text-transform: uppercase; }
.dtx-top-sp { flex: 1; }

.dtx-live {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--dt-line);
  background: var(--dt-panel2);
  font-size: 11.5px; font-weight: 700; color: var(--dt-text2);
}
.dtx-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dt-text3); }
.dtx-live[data-state="live"] .dtx-live-dot { background: var(--dt-ok); }
.dtx-live[data-state="live"] { color: var(--dt-ok); border-color: var(--dt-ok); }
.dtx-live[data-state="poll"] .dtx-live-dot { background: var(--dt-warn); }
.dtx-live[data-state="poll"] { color: var(--dt-warn); border-color: var(--dt-warn); }
.dtx-live[data-state="off"]  .dtx-live-dot { background: var(--dt-bad); }
.dtx-live[data-state="off"]  { color: var(--dt-bad); border-color: var(--dt-bad); }

/* ══ BUTTONS ═══════════════════════════════════════════════════════════ */
.dtx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--dt-radius-sm);
  border: 1px solid var(--dt-line2);
  background: var(--dt-panel2);
  color: var(--dt-text);
  font: inherit; font-size: 13px; font-weight: 650;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
  white-space: nowrap;
}
.dtx-btn:hover:not(:disabled) { background: var(--dt-panel3); border-color: var(--dt-accent); }
.dtx-btn:focus-visible { outline: 2px solid var(--dt-accent); outline-offset: 2px; }
.dtx-btn:disabled { opacity: .5; cursor: not-allowed; }

/* THE PAIRED-INK RULE. Each solid fill states its own ink in the same
   declaration. Listing these selectors under one colour would be a lie: the
   fill differs per ramp, so the ink has to travel with it. */
.dtx-btn--primary { background: var(--dt-accent-fill); border-color: var(--dt-accent-fill); color: var(--dt-accent-ink); }
.dtx-btn--primary:hover:not(:disabled) { filter: brightness(1.12); background: var(--dt-accent-fill); border-color: var(--dt-accent-fill); color: var(--dt-accent-ink); }
.dtx-btn--ok      { background: var(--dt-ok-fill);     border-color: var(--dt-ok-fill);     color: var(--dt-ok-ink); }
.dtx-btn--danger  { background: var(--dt-bad-fill);    border-color: var(--dt-bad-fill);    color: var(--dt-bad-ink); }
.dtx-btn--danger:hover:not(:disabled) { filter: brightness(1.12); background: var(--dt-bad-fill); border-color: var(--dt-bad-fill); color: var(--dt-bad-ink); }
.dtx-btn--ghost   { background: transparent; border-color: transparent; color: var(--dt-text2); }
.dtx-btn--ghost:hover:not(:disabled) { background: var(--dt-panel2); color: var(--dt-text); border-color: var(--dt-line); }
.dtx-btn--sm { padding: 5px 10px; font-size: 12px; }
.dtx-btn--icon { padding: 7px; width: 32px; }

/* ══ BODY: rail + main ═════════════════════════════════════════════════ */
.dtx-body { display: grid; grid-template-columns: var(--dt-rail-w) 1fr; min-height: 0; }
.dtx-app[data-rail="off"] .dtx-body { grid-template-columns: 0 1fr; }
.dtx-app[data-rail="off"] .dtx-rail { display: none; }

.dtx-rail {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--dt-panel);
  border-right: 1px solid var(--dt-line);
}
.dtx-rail-head { padding: 12px 12px 8px; border-bottom: 1px solid var(--dt-line); }
.dtx-search {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--dt-radius-sm);
  border: 1px solid var(--dt-line); background: var(--dt-panel2);
}
.dtx-search i { color: var(--dt-text3); font-size: 12px; }
.dtx-search input {
  flex: 1; min-width: 0; border: 0; background: transparent;
  color: var(--dt-text); font: inherit; font-size: 13px; outline: none;
}
.dtx-search input::placeholder { color: var(--dt-text3); }

.dtx-scopes { display: flex; gap: 4px; margin-top: 9px; flex-wrap: wrap; }
.dtx-scope {
  padding: 4px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--dt-line); background: transparent;
  color: var(--dt-text2); font: inherit; font-size: 11.5px; font-weight: 650;
}
.dtx-scope:hover { color: var(--dt-text); border-color: var(--dt-line2); }
.dtx-scope[aria-pressed="true"] {
  background: var(--dt-accent-fill); border-color: var(--dt-accent-fill); color: var(--dt-accent-ink);
}

.dtx-rail-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.dtx-rail-foot { padding: 10px 12px; border-top: 1px solid var(--dt-line); }

.dtx-card {
  display: block; width: 100%; text-align: left;
  padding: 10px 11px; border-radius: var(--dt-radius);
  border: 1px solid var(--dt-line); background: var(--dt-panel2);
  color: var(--dt-text); font: inherit; cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.dtx-card:hover { border-color: var(--dt-line2); background: var(--dt-panel3); }
.dtx-card[aria-current="true"] { border-color: var(--dt-accent); background: var(--dt-accent-soft); }
.dtx-card-top { display: flex; align-items: center; gap: 8px; }
.dtx-card-ic {
  width: 26px; height: 26px; border-radius: 8px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 12px;
  background: var(--dt-panel3); color: var(--dt-accent);
}
.dtx-card-title { font-weight: 700; font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dtx-card-meta { margin-top: 6px; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--dt-text3); }
.dtx-card-meta b { color: var(--dt-text2); font-weight: 700; }

/* ══ MAIN ══════════════════════════════════════════════════════════════ */
.dtx-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--dt-bg); }

.dtx-head {
  padding: 14px 18px 0; background: var(--dt-panel); border-bottom: 1px solid var(--dt-line);
}
.dtx-head-row { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.dtx-head-ic {
  width: 40px; height: 40px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 17px;
  background: var(--dt-accent-soft); color: var(--dt-accent);
}
.dtx-head-txt { flex: 1; min-width: 200px; }
.dtx-head-title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.2px; }
.dtx-head-desc { margin: 3px 0 0; font-size: 12.5px; color: var(--dt-text2); max-width: 90ch; }
.dtx-head-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }

.dtx-tabs { display: flex; gap: 2px; margin-top: 12px; overflow-x: auto; }
.dtx-tab {
  padding: 9px 14px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--dt-text2);
  font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
}
.dtx-tab:hover { color: var(--dt-text); }
.dtx-tab[aria-selected="true"] { color: var(--dt-accent); border-bottom-color: var(--dt-accent); }
.dtx-tab-count {
  min-width: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--dt-panel3); color: var(--dt-text2);
  font-size: 10.5px; font-weight: 800; line-height: 17px; text-align: center;
}

.dtx-panes { flex: 1; min-height: 0; position: relative; }
.dtx-pane { position: absolute; inset: 0; overflow: auto; padding: 16px 18px 24px; }
.dtx-pane[hidden] { display: none !important; }

/* ══ CHIPS / AVATARS / BARS  (shared with My Task) ═════════════════════ */
.dtx-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--dt-line2); background: var(--dt-panel2);
  color: var(--dt-text); font-size: 11.5px; font-weight: 650; white-space: nowrap;
}
.dtx-chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--chip, var(--dt-text3)); flex: 0 0 auto; }
/* The chip ground is a TINT, so the label keeps --dt-text (a fill's ink rule
   only applies to SOLID fills; a tint takes the page's own ink correctly). */
.dtx-chip--done     { background: var(--dt-ok-soft);   border-color: var(--dt-ok); }
.dtx-chip--progress { background: var(--dt-info-soft); border-color: var(--dt-info); }
.dtx-chip--blocked  { background: var(--dt-bad-soft);  border-color: var(--dt-bad); }
.dtx-chip--open     { background: var(--dt-panel2);    border-color: var(--dt-line2); }

.dtx-av {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--dt-accent-fill); color: var(--dt-accent-ink);
  font-size: 10px; font-weight: 800; letter-spacing: .3px; flex: 0 0 auto;
}
.dtx-av--none { background: var(--dt-panel3); color: var(--dt-text3); }

.dtx-bar { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: var(--dt-panel3); width: 100%; }
/* A bar segment is GEOMETRY, not typography: it never contains text, so it
   states no ink. Each modifier restates the height so that fact is legible in
   the block itself rather than only in the cascade — the paired-ink gate reads
   one declaration block at a time, and so does the next person. */
.dtx-bar-seg { display: block; height: 100%; }
.dtx-bar-seg--done { background: var(--dt-ok-fill); height: 100%; }
.dtx-bar-seg--progress { background: var(--dt-info-fill); height: 100%; }
.dtx-bar-seg--blocked { background: var(--dt-bad-fill); height: 100%; }
.dtx-bar-seg--open { background: var(--dt-line2); height: 100%; }

/* ══ GRID (Sheet Data) ═════════════════════════════════════════════════ */
.dtx-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px;
  border: 1px solid var(--dt-line); border-radius: var(--dt-radius);
  background: var(--dt-panel);
}
.dtx-toolbar-sp { flex: 1; }
.dtx-sel-note { font-size: 12px; font-weight: 700; color: var(--dt-accent); }

.dtx-grid-wrap {
  border: 1px solid var(--dt-line); border-radius: var(--dt-radius);
  background: var(--dt-panel); overflow: auto; max-height: calc(100vh - 260px);
}
.dtx-grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.dtx-grid thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--dt-panel2); color: var(--dt-text2);
  font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  text-align: left; padding: 9px 10px; white-space: nowrap;
  border-bottom: 1px solid var(--dt-line); cursor: pointer; user-select: none;
}
.dtx-grid thead th:hover { color: var(--dt-text); }
.dtx-grid thead th.dtx-th-static { cursor: default; }
/* The operational block (assignment + progress) is the grid's own, not the
   sheet's. A hairline says so, which is what stops "Status" and "My Status"
   reading as two attempts at the same column. */
.dtx-grid thead th.dtx-th-op { border-left: 1px solid var(--dt-line2); }
.dtx-grid thead th .dtx-sort { color: var(--dt-accent); margin-left: 5px; }
.dtx-grid tbody td {
  padding: 0; border-bottom: 1px solid var(--dt-line);
  color: var(--dt-text); vertical-align: middle;
}
.dtx-grid tbody tr:hover td { background: var(--dt-panel2); }
.dtx-grid tbody tr[data-sel="1"] td { background: var(--dt-accent-soft); }
.dtx-grid tbody tr[data-mine="1"] td:first-child { box-shadow: inset 3px 0 0 var(--dt-accent); }

.dtx-cell {
  display: block; width: 100%; min-height: 34px; padding: 8px 10px;
  border: 0; background: transparent; color: inherit;
  font: inherit; font-size: 13px; outline: none; resize: none;
  white-space: pre-wrap; word-break: break-word;
}
.dtx-cell:focus { background: var(--dt-panel2); box-shadow: inset 0 0 0 2px var(--dt-accent); border-radius: 4px; }
.dtx-cell[readonly] { color: var(--dt-text2); cursor: default; }
.dtx-cell--num { text-align: right; font-variant-numeric: tabular-nums; }

.dtx-rownum {
  width: 46px; text-align: center; color: var(--dt-text3);
  font-size: 11px; font-variant-numeric: tabular-nums; user-select: none;
}
.dtx-chk { width: 34px; text-align: center; }
.dtx-chk input { accent-color: var(--dt-accent-fill); width: 15px; height: 15px; cursor: pointer; }

.dtx-picker {
  width: 100%; padding: 6px 8px; border-radius: 6px;
  border: 1px solid var(--dt-line); background: var(--dt-panel2);
  color: var(--dt-text); font: inherit; font-size: 12.5px; cursor: pointer;
}
.dtx-picker:disabled { opacity: .55; cursor: not-allowed; }
.dtx-picker:focus-visible { outline: 2px solid var(--dt-accent); outline-offset: 1px; }

.dtx-empty {
  padding: 46px 24px; text-align: center; color: var(--dt-text2);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.dtx-empty i { font-size: 30px; color: var(--dt-text3); }
.dtx-empty h3 { margin: 0; font-size: 15px; color: var(--dt-text); }
.dtx-empty p { margin: 0; max-width: 52ch; font-size: 13px; line-height: 1.6; }

/* ══ DASHBOARD ═════════════════════════════════════════════════════════ */
.dtx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 14px; }
.dtx-kpi {
  padding: 14px; border-radius: var(--dt-radius);
  border: 1px solid var(--dt-line); background: var(--dt-panel);
}
.dtx-kpi-l { font-size: 10.5px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; color: var(--dt-text3); }
.dtx-kpi-v { margin-top: 6px; font-size: 27px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.dtx-kpi-s { margin-top: 6px; font-size: 11.5px; color: var(--dt-text2); }
.dtx-kpi--ok   .dtx-kpi-v { color: var(--dt-ok); }
.dtx-kpi--warn .dtx-kpi-v { color: var(--dt-warn); }
.dtx-kpi--bad  .dtx-kpi-v { color: var(--dt-bad); }
.dtx-kpi--info .dtx-kpi-v { color: var(--dt-accent); }

.dtx-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; }
.dtx-panelbox { border: 1px solid var(--dt-line); border-radius: var(--dt-radius); background: var(--dt-panel); overflow: hidden; }
.dtx-panelbox-h {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border-bottom: 1px solid var(--dt-line); background: var(--dt-panel2);
  font-size: 12px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--dt-text2);
}
.dtx-panelbox-h i { color: var(--dt-accent); }
.dtx-panelbox-h .dtx-ph-sp { flex: 1; }
.dtx-panelbox-b { padding: 13px 14px; }

.dtx-dist { display: flex; flex-direction: column; gap: 9px; }
.dtx-dist-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.dtx-dist-l { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.dtx-dist-sw { width: 10px; height: 10px; border-radius: 3px; background: var(--sw, var(--dt-text3)); flex: 0 0 auto; }
.dtx-dist-n { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 12.5px; }
.dtx-dist-track { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--dt-panel3); overflow: hidden; }
.dtx-dist-fill { height: 100%; background: var(--sw, var(--dt-accent-fill)); border-radius: 999px; }

.dtx-wl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dtx-wl th {
  text-align: left; padding: 6px 8px; color: var(--dt-text3);
  font-size: 10.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  border-bottom: 1px solid var(--dt-line);
}
.dtx-wl td { padding: 8px; border-bottom: 1px solid var(--dt-line); }
.dtx-wl tr:last-child td { border-bottom: 0; }
.dtx-wl-who { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.dtx-wl-n { text-align: right; font-variant-numeric: tabular-nums; }

.dtx-att { display: flex; flex-direction: column; gap: 8px; }
.dtx-att-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: var(--dt-radius-sm);
  border: 1px solid var(--dt-line); background: var(--dt-panel2);
  cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit;
}
.dtx-att-row:hover { border-color: var(--dt-accent); }
.dtx-att-why { display: flex; gap: 5px; flex-wrap: wrap; }
/* The title and its subtitle are two <span>s inside a block. Without an
   explicit display they run on ONE line and read as "001203Unknown status" —
   caught by browser QA, invisible to any DOM-presence assertion. */
.dtx-att-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dtx-att-title { display: block; font-size: 12.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dtx-att-sub { display: block; font-size: 11px; color: var(--dt-text3); }
.dtx-flag {
  padding: 2px 7px; border-radius: 5px; font-size: 10px; font-weight: 800;
  letter-spacing: .3px; text-transform: uppercase;
}
.dtx-flag--overdue    { background: var(--dt-bad-fill);  color: var(--dt-bad-ink); }
.dtx-flag--blocked    { background: var(--dt-warn-fill); color: var(--dt-warn-ink); }
.dtx-flag--unassigned { background: var(--dt-panel3);    color: var(--dt-text2); }
.dtx-flag--urgent     { background: var(--dt-bad-fill);  color: var(--dt-bad-ink); }

/* ══ GUIDE (instruction wiki) ══════════════════════════════════════════ */
.dtx-guide { display: grid; grid-template-columns: 250px 1fr; gap: 14px; height: 100%; min-height: 0; }
.dtx-guide[data-rail="off"] { grid-template-columns: 0 1fr; }
.dtx-guide[data-rail="off"] .dtx-gr { display: none; }

.dtx-gr {
  border: 1px solid var(--dt-line); border-radius: var(--dt-radius);
  background: var(--dt-panel); display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.dtx-gr-h { padding: 10px; border-bottom: 1px solid var(--dt-line); display: flex; gap: 6px; align-items: center; }
.dtx-gr-list { flex: 1; overflow-y: auto; padding: 6px; }
.dtx-gr-row {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 6px 8px; border-radius: 7px; border: 0; background: transparent;
  color: var(--dt-text2); font: inherit; font-size: 12.5px; cursor: pointer; text-align: left;
}
.dtx-gr-row:hover { background: var(--dt-panel2); color: var(--dt-text); }
.dtx-gr-row[aria-current="true"] { background: var(--dt-accent-soft); color: var(--dt-accent); font-weight: 700; }
.dtx-gr-tw {
  width: 18px; height: 18px; flex: 0 0 auto; border: 0; background: transparent;
  color: var(--dt-text3); cursor: pointer; font-size: 10px; border-radius: 4px;
}
.dtx-gr-tw:hover { background: var(--dt-panel3); color: var(--dt-text); }
.dtx-gr-tw[data-leaf="1"] { visibility: hidden; }
.dtx-gr-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dtx-gr-n { font-size: 10px; color: var(--dt-text3); font-variant-numeric: tabular-nums; }

.dtx-doc {
  border: 1px solid var(--dt-line); border-radius: var(--dt-radius);
  background: var(--dt-panel); overflow-y: auto; min-height: 0; padding: 20px 26px 40px;
}
.dtx-doc-h { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.dtx-doc-title { margin: 0; font-size: 21px; font-weight: 800; flex: 1; min-width: 200px; }
.dtx-doc-crumb { font-size: 11.5px; color: var(--dt-text3); margin-bottom: 14px; }
.dtx-doc-body { max-width: 78ch; }

.dtx-w { margin: 0 0 16px; }
.dtx-w-h {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--dt-text3);
}
.dtx-w-h .dtx-w-sp { flex: 1; }
.dtx-rt { font-size: 14px; line-height: 1.72; color: var(--dt-text); }
.dtx-rt h3 { font-size: 16px; margin: 20px 0 8px; }
.dtx-rt h4 { font-size: 14px; margin: 16px 0 6px; color: var(--dt-text2); }
.dtx-rt p { margin: 0 0 11px; }
.dtx-rt ul, .dtx-rt ol { margin: 0 0 12px; padding-left: 22px; }
.dtx-rt li { margin: 3px 0; }
.dtx-rt a { color: var(--dt-accent); }
.dtx-rt code { font-family: var(--dt-mono); font-size: .9em; background: var(--dt-panel2); padding: 1px 5px; border-radius: 4px; }
.dtx-rt img { max-width: 100%; height: auto; border-radius: var(--dt-radius-sm); border: 1px solid var(--dt-line); }
.dtx-rt blockquote { margin: 0 0 12px; padding: 8px 14px; border-left: 3px solid var(--dt-accent); background: var(--dt-panel2); color: var(--dt-text2); }
.dtx-rt table { border-collapse: collapse; width: 100%; margin: 0 0 12px; font-size: 13px; }
.dtx-rt th, .dtx-rt td { border: 1px solid var(--dt-line); padding: 6px 9px; text-align: left; }
.dtx-rt th { background: var(--dt-panel2); }

.dtx-editor {
  width: 100%; min-height: 220px; padding: 12px 14px;
  border: 1px solid var(--dt-accent); border-radius: var(--dt-radius-sm);
  background: var(--dt-panel2); color: var(--dt-text);
  font: inherit; font-size: 14px; line-height: 1.72; outline: none;
}
.dtx-editor:focus { box-shadow: 0 0 0 3px var(--dt-accent-soft); }

.dtx-callout {
  padding: 11px 14px; border-radius: var(--dt-radius-sm);
  border: 1px solid var(--dt-line2); background: var(--dt-panel2);
  border-left-width: 4px; font-size: 13.5px; line-height: 1.66;
}
.dtx-callout--info    { border-left-color: var(--dt-info); background: var(--dt-info-soft); }
.dtx-callout--success { border-left-color: var(--dt-ok);   background: var(--dt-ok-soft); }
.dtx-callout--warn    { border-left-color: var(--dt-warn); background: var(--dt-warn-soft); }
.dtx-callout--danger  { border-left-color: var(--dt-bad);  background: var(--dt-bad-soft); }

.dtx-steps { counter-reset: dtxstep; list-style: none; margin: 0; padding: 0; }
.dtx-steps li {
  counter-increment: dtxstep; position: relative;
  padding: 3px 0 12px 38px; font-size: 13.5px; line-height: 1.62;
}
.dtx-steps li::before {
  content: counter(dtxstep); position: absolute; left: 0; top: 0;
  width: 25px; height: 25px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 800;
  background: var(--dt-accent-fill); color: var(--dt-accent-ink);
}
.dtx-check { list-style: none; margin: 0; padding: 0; }
.dtx-check li { display: flex; gap: 9px; align-items: flex-start; padding: 4px 0; font-size: 13.5px; }
.dtx-check input { margin-top: 3px; accent-color: var(--dt-accent-fill); }

.dtx-code {
  font-family: var(--dt-mono); font-size: 12.5px; line-height: 1.62;
  background: var(--dt-panel2); border: 1px solid var(--dt-line);
  border-radius: var(--dt-radius-sm); padding: 11px 13px;
  overflow-x: auto; white-space: pre; color: var(--dt-text);
}
.dtx-kbd { display: inline-flex; gap: 4px; }
.dtx-kbd kbd {
  font-family: var(--dt-mono); font-size: 11px; padding: 2px 7px;
  border: 1px solid var(--dt-line2); border-bottom-width: 2px;
  border-radius: 5px; background: var(--dt-panel2); color: var(--dt-text);
}

/* ══ MODALS  (body-level portal — never inside a transformed ancestor) ══ */
.dtx-scrim {
  position: fixed; inset: 0; z-index: 9000;
  background: var(--dt-scrim);
  display: grid; place-items: center; padding: 22px;
  overflow-y: auto;
}
.dtx-scrim[hidden] { display: none !important; }
.dtx-modal {
  width: min(760px, 100%); max-height: calc(100vh - 44px);
  display: flex; flex-direction: column;
  border: 1px solid var(--dt-line2); border-radius: 16px;
  background: var(--dt-panel); box-shadow: var(--dt-shadow-lg);
}
.dtx-modal--wide { width: min(1040px, 100%); }
.dtx-modal-h {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--dt-line);
}
.dtx-modal-h h2 { margin: 0; font-size: 15.5px; font-weight: 800; flex: 1; }
.dtx-modal-b { padding: 16px 18px; overflow-y: auto; }
.dtx-modal-f {
  display: flex; gap: 8px; justify-content: flex-end; align-items: center;
  padding: 13px 18px; border-top: 1px solid var(--dt-line); background: var(--dt-panel2);
  border-radius: 0 0 16px 16px; flex-wrap: wrap;
}
.dtx-modal-f .dtx-mf-sp { flex: 1; }

/* dtx-2 · A CLICK OUTSIDE IS ACKNOWLEDGED, NOT OBEYED.
   These dialogs hold typed work, so a stray click on the dim area must not
   discard it. But silently swallowing a gesture reads as broken — the card
   nudges and the footer says why, so the rule is learned in one click instead
   of costing a form. */
.dtx-modal-hint {
  margin-right: auto;
  font-size: 11.5px; line-height: 1.45;
  color: var(--dt-text2);
  max-width: 46ch;
}
.dtx-modal-hint[hidden] { display: none !important; }

@keyframes dtx-nudge {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(3px); }
}
.dtx-modal.is-nudge { animation: dtx-nudge .26s ease; }
/* Reduced motion still needs the acknowledgement, just not the movement. */
@media (prefers-reduced-motion: reduce) {
  .dtx-modal.is-nudge { animation: none; outline: 2px solid var(--dt-accent); outline-offset: 3px; }
}

/* The Save button's four states. Each states its own ink with its fill, and
   the "unsaved" count rides the existing chip so it stays legible in both. */
.dtx-btn[data-state="error"] .dtx-tab-count { background: var(--dt-bad-fill); color: var(--dt-bad-ink); }
.dtx-btn[data-state="dirty"] .dtx-tab-count { background: var(--dt-accent-ink); color: var(--dt-accent-fill); }

/* ══ FORMS ═════════════════════════════════════════════════════════════ */
.dtx-field { margin-bottom: 14px; }
.dtx-field > label { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--dt-text3); margin-bottom: 6px; }
.dtx-field .dtx-hint { margin-top: 5px; font-size: 11.5px; color: var(--dt-text3); line-height: 1.55; }
.dtx-input, .dtx-select, .dtx-textarea {
  width: 100%; padding: 9px 11px; border-radius: var(--dt-radius-sm);
  border: 1px solid var(--dt-line2); background: var(--dt-panel2);
  color: var(--dt-text); font: inherit; font-size: 13.5px; outline: none;
}
.dtx-textarea { min-height: 76px; resize: vertical; line-height: 1.6; }
.dtx-input:focus, .dtx-select:focus, .dtx-textarea:focus {
  border-color: var(--dt-accent); box-shadow: 0 0 0 3px var(--dt-accent-soft);
}
.dtx-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 620px) { .dtx-grid2 { grid-template-columns: 1fr; } }

.dtx-radios { display: flex; flex-direction: column; gap: 8px; }
.dtx-radio {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; border-radius: var(--dt-radius-sm);
  border: 1px solid var(--dt-line); background: var(--dt-panel2); cursor: pointer;
}
.dtx-radio:hover { border-color: var(--dt-line2); }
.dtx-radio input { margin-top: 3px; accent-color: var(--dt-accent-fill); }
.dtx-radio-t { font-size: 13px; font-weight: 700; }
.dtx-radio-d { font-size: 11.5px; color: var(--dt-text2); margin-top: 3px; line-height: 1.5; }
.dtx-radio:has(input:checked) { border-color: var(--dt-accent); background: var(--dt-accent-soft); }

.dtx-rowlist { display: flex; flex-direction: column; gap: 8px; }
.dtx-rowitem {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--dt-radius-sm);
  border: 1px solid var(--dt-line); background: var(--dt-panel2);
}
.dtx-rowitem .dtx-ri-sp { flex: 1; min-width: 0; }
.dtx-swatch {
  width: 30px; height: 30px; padding: 0; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--dt-line2); background: var(--dt-panel);
}

/* ══ TOASTS ════════════════════════════════════════════════════════════ */
.dtx-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 9500; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.dtx-toast {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; border-radius: var(--dt-radius-sm);
  border: 1px solid var(--dt-line2); background: var(--dt-panel);
  box-shadow: var(--dt-shadow); font-size: 13px; color: var(--dt-text);
  animation: dtx-in .18s ease;
}
@keyframes dtx-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.dtx-toast i { margin-top: 2px; }
.dtx-toast--ok   { border-left: 3px solid var(--dt-ok); }
.dtx-toast--ok i { color: var(--dt-ok); }
.dtx-toast--bad  { border-left: 3px solid var(--dt-bad); }
.dtx-toast--bad i { color: var(--dt-bad); }
.dtx-toast--warn { border-left: 3px solid var(--dt-warn); }
.dtx-toast--warn i { color: var(--dt-warn); }
.dtx-toast--info { border-left: 3px solid var(--dt-accent); }
.dtx-toast--info i { color: var(--dt-accent); }
.dtx-toast b { display: block; margin-bottom: 2px; }
.dtx-toast small { color: var(--dt-text2); font-size: 11.5px; line-height: 1.5; }

/* ══ MISC ══════════════════════════════════════════════════════════════ */
.dtx-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 800;
  letter-spacing: .4px; text-transform: uppercase;
  background: var(--dt-panel3); color: var(--dt-text2);
}
.dtx-tag--private    { background: var(--dt-panel3);    color: var(--dt-text2); }
.dtx-tag--restricted { background: var(--dt-warn-fill); color: var(--dt-warn-ink); }
.dtx-tag--public     { background: var(--dt-ok-fill);   color: var(--dt-ok-ink); }
.dtx-tag--readonly   { background: var(--dt-panel3);    color: var(--dt-text2); }
.dtx-tag--mine       { background: var(--dt-accent-fill); color: var(--dt-accent-ink); }

.dtx-spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--dt-line2); border-top-color: var(--dt-accent); border-radius: 50%; animation: dtx-spin .7s linear infinite; }
@keyframes dtx-spin { to { transform: rotate(360deg); } }

.dtx-drop {
  border: 2px dashed var(--dt-line2); border-radius: var(--dt-radius);
  padding: 30px 20px; text-align: center; color: var(--dt-text2);
  background: var(--dt-panel2); cursor: pointer;
}
.dtx-drop:hover, .dtx-drop[data-over="1"] { border-color: var(--dt-accent); background: var(--dt-accent-soft); color: var(--dt-text); }
.dtx-drop i { font-size: 26px; color: var(--dt-accent); display: block; margin-bottom: 9px; }

.dtx-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* A table always scrolls inside its own box; the page body never scrolls
   sideways, at any width. */
.dtx-scroll-x { overflow-x: auto; }

@media (max-width: 1000px) {
  :root { --dt-rail-w: 240px; }
  .dtx-guide { grid-template-columns: 200px 1fr; }
}
@media (max-width: 760px) {
  .dtx-body { grid-template-columns: 1fr; }
  .dtx-rail { display: none; }
  .dtx-guide { grid-template-columns: 1fr; }
  .dtx-guide .dtx-gr { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
