/* ============================================================
   RealityOS · Dashboard design (approved design-preview, v2)
   Loaded only by dashboard.html, after app.css. Every rule is scoped:
   tokens live on body.dx, classes use the dx- prefix, so other pages,
   ui.js modals/menus/toasts and the ⌘K palette keep app.css styling.
   Tokens mirror the Figma file (Theme/Light + Theme/Dark, Tokens,
   text styles, Shadow/xs–lg). Light/dark follow the system setting,
   like the rest of the app. Breakpoints: ≥1280 expanded sidebar ·
   768–1279 icon rail + drawer · <768 phone header + bottom nav.
   ============================================================ */

/* ── Colour tokens ── */
.dx {
  --bg-canvas: #F6F7F9; --bg-surface: #FFFFFF; --bg-subtle: #F9FAFB; --bg-muted: #F1F3F6; --bg-hover: #F3F5F8;
  --nav-bg: #0B1B3A; --nav-item-active: #1B2E57; --nav-text: #C7D0E0; --nav-text-muted: #8A96AE; --nav-text-active: #FFFFFF; --nav-border: #1B2B4D;
  --text-primary: #0B1B3A; --text-secondary: #4F596C; --text-tertiary: #5F6779; --text-inverse: #FFFFFF; --text-link: #1A56D6;
  --border-default: #E6E8EC; --border-strong: #D5D9E0; --border-subtle: #EEF0F3;
  --brand-primary: var(--primary, #1D62EE); --brand-primary-hover: #1A56D6; --brand-primary-soft: #EAF1FF; --brand-navy: #0B1B3A; --brand-navy-2: #13254A; --brand-accent-ink: #8FB2FF;
  --status-hot: #CB2D32; --status-hot-bg: #FDECEC; --status-warm: #A16000; --status-warm-bg: #FFF4E0;
  --status-cold: #0A7891; --status-cold-bg: #E3F7FB; --status-booked: #6B46D9; --status-booked-bg: #F1ECFF;
  --status-success: #0C7C55; --status-success-bg: #E5F6EE; --status-neutral: #4F596C; --status-neutral-bg: #F1F3F6;
  --chart-1: #1D62EE; --chart-2: #0EA5A0; --chart-3: #F59E0B; --chart-4: #8B5CF6; --chart-5: #E5484D; --chart-track: #EEF0F3;
  --shadow-xs: 0 1px 2px rgba(11, 27, 58, .05);
  --shadow-sm: 0 1px 3px rgba(11, 27, 58, .08), 0 1px 2px rgba(11, 27, 58, .04);
  --shadow-md: 0 4px 12px -2px rgba(11, 27, 58, .10);
  --shadow-lg: 0 16px 40px -12px rgba(11, 27, 58, .25);
  --overlay: rgba(11, 27, 58, .45);
  color-scheme: light;
}
[data-theme="dark"] .dx {
  --bg-canvas: #080C14; --bg-surface: #0F1522; --bg-subtle: #121A29; --bg-muted: #172033; --bg-hover: #182235;
  --nav-bg: #070B12; --nav-item-active: #131C2E; --nav-text: #B7C1D4; --nav-text-muted: #7F8AA3; --nav-text-active: #FFFFFF; --nav-border: #161E2E;
  --text-primary: #EEF1F6; --text-secondary: #AEB7C7; --text-tertiary: #8791A4; --text-inverse: #FFFFFF; --text-link: #8FB2FF;
  --border-default: #1E2636; --border-strong: #2A3447; --border-subtle: #182030;
  --brand-primary: var(--primary, #2F6BEF); --brand-primary-hover: #4A80F5; --brand-primary-soft: #15223F; --brand-navy: #13254A; --brand-navy-2: #1B3160; --brand-accent-ink: #8FB2FF;
  --status-hot: #FF8A8D; --status-hot-bg: #3A1719; --status-warm: #F7B955; --status-warm-bg: #3A2A0E;
  --status-cold: #5FD4E8; --status-cold-bg: #0E2E36; --status-booked: #B9A0FF; --status-booked-bg: #2A2147;
  --status-success: #5AD19A; --status-success-bg: #0F2E22; --status-neutral: #AEB7C7; --status-neutral-bg: #1B2130;
  --chart-1: #4A86FF; --chart-2: #2DD4BF; --chart-3: #FBBF24; --chart-4: #A78BFA; --chart-5: #FF6B6E; --chart-track: #1A2233;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 40px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .05);
  --overlay: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ── Spacing / radius / type tokens (Figma "Tokens" collection + text styles) ── */
.dx {
  --space-2: 2px; --space-4: 4px; --space-6: 6px; --space-8: 8px; --space-12: 12px; --space-16: 16px;
  --space-20: 20px; --space-24: 24px; --space-32: 32px; --space-40: 40px; --space-48: 48px;
  --radius-xs: 4px; --radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px; --radius-xl: 16px; --radius-full: 999px;
  --font: 'Inter', -apple-system, system-ui, sans-serif; --font-display: 'Lexend', 'Inter', sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
}
.dx-t-display { font: 600 28px/34px var(--font-display); letter-spacing: -0.6px; }
.dx-t-heading { font: 600 20px/26px var(--font-display); letter-spacing: -0.4px; }
.dx-t-kpi { font: 600 28px/32px var(--font-display); letter-spacing: -0.6px; }
.dx-t-kpi-sm { font: 600 22px/28px var(--font-display); letter-spacing: -0.4px; }
.dx-t-title { font: 600 16px/24px var(--font); letter-spacing: -0.2px; }
.dx-t-subtitle { font: 600 14px/20px var(--font); letter-spacing: -0.1px; }
.dx-t-body { font: 400 14px/20px var(--font); }
.dx-t-body-sm { font: 400 13px/18px var(--font); }
.dx-t-label { font: 500 13px/18px var(--font); }
.dx-t-label-sm { font: 500 12px/16px var(--font); }
.dx-t-caption { font: 500 11px/14px var(--font); letter-spacing: .2px; }
.dx-t-overline { font: 600 11px/14px var(--font); letter-spacing: .6px; text-transform: uppercase; }

/* ── Base (scoped; app.dx-css keeps the global reset) ── */
:where(.dx-app) button, :where(.dx-app) input, :where(.dx-app) select { font: inherit; color: inherit; background: none; border: 0; }
:where(.dx-app) button { cursor: pointer; }
:where(.dx-app) a { color: inherit; text-decoration: none; }
.dx-num { font-variant-numeric: tabular-nums; }
/* ════════ App shell ════════ */
.dx-app { display: grid; grid-template-columns: 248px minmax(0, 1fr); height: 100%; font: 400 13px/18px var(--font); }
.dx-main { display: flex; flex-direction: column; min-width: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scroll-behavior: smooth; }

/* Sidebar · Layout=Expanded */
/* The sidebar matches every other page (app.css .sidebar: light #fbfbfc, dark #0e131c).
   Its --nav-* tokens are re-pointed here only; the navy Reality AI panels keep the navy ones. */
.dx .dx-side {
  --nav-bg: var(--sidebar); --nav-item-active: var(--bg-active); --nav-border: var(--border);
  --nav-text: var(--text-2); --nav-text-muted: var(--text-3); --nav-text-active: var(--text);
  --brand-accent-ink: var(--primary);
}
.dx-side { background: var(--nav-bg); color: var(--nav-text); display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-16); overflow-y: auto; scrollbar-width: none; }
.dx-logo { display: flex; align-items: center; gap: 10px; padding: var(--space-8); font: 600 17px/1 var(--font-display); color: var(--nav-text-active); }
.dx-logo em { font-style: normal; color: var(--brand-accent-ink); }
.dx-logo svg { width: 28px; height: 20px; }
.dx-logo.dx-on-light { color: var(--text-primary); } .dx-logo.dx-on-light em { color: var(--brand-primary); }
.dx-ws { display: flex; align-items: center; gap: 10px; padding: var(--space-8); border: 1px solid var(--nav-border); border-radius: var(--radius-md); background: var(--bg); text-align: left; width: 100%; }
.dx-ws-logo { width: 32px; height: 32px; border-radius: var(--radius-md); background: var(--brand-primary); color: #fff; display: grid; place-items: center; font: 500 12px/16px var(--font); flex-shrink: 0; }
.dx-ws-text { min-width: 0; flex: 1; display: grid; }
.dx-ws-name { color: var(--nav-text-active); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-ws-sub { color: var(--nav-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-ws > svg { color: var(--nav-text-muted); }
.dx-nav-sec { color: var(--nav-text-muted); padding: 16px 12px 6px; }
.dx-nav-item { position: relative; display: flex; align-items: center; gap: var(--space-12); height: 34px; padding: 0 var(--space-12); border-radius: var(--radius-md); color: var(--nav-text); width: 100%; text-align: left; transition: background .15s; }
.dx-nav-item svg { width: 18px; height: 18px; color: var(--nav-text-muted); }
.dx-nav-item .dx-nav-label { flex: 1; min-width: 0; }
.dx-nav-item:hover { background: color-mix(in srgb, var(--nav-item-active) 55%, transparent); color: var(--nav-text-active); }
.dx-nav-item[aria-current="page"] { background: var(--nav-item-active); color: var(--nav-text-active); }
.dx-nav-item[aria-current="page"] svg { color: var(--brand-accent-ink); }
.dx-nav-item[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 8px; width: 3px; height: 18px; border-radius: 2px; background: var(--brand-accent-ink); }
.dx-nav-count { padding: 0 6px; min-width: 18px; text-align: center; border-radius: var(--radius-full); background: var(--brand-primary); color: #fff; }
.dx-side-spacer { flex: 1; min-height: 16px; }
.dx-ai-ready { display: grid; gap: var(--space-8); padding: var(--space-12); border-radius: var(--radius-lg); background: var(--nav-item-active); }
.dx-ai-ready-top { display: flex; align-items: center; gap: 8px; color: var(--nav-text-active); }
.dx-ai-ready-top svg { width: 16px; height: 16px; color: var(--brand-accent-ink); }
.dx-ai-track { height: 6px; border-radius: var(--radius-full); background: var(--nav-border); overflow: hidden; }
.dx-ai-track i { display: block; height: 100%; border-radius: 3px; background: var(--brand-accent-ink); transition: width .6s var(--ease); }
.dx-ai-ready .dx-t-caption { color: var(--nav-text-muted); }

/* Header · Device=Desktop */
.dx-hdr { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-12); height: 64px; padding: 0 var(--space-24); background: var(--bg-surface); border-bottom: 1px solid var(--border-default); flex-shrink: 0; }
.dx-crumb { display: flex; align-items: center; gap: 8px; color: var(--text-primary); }
.dx-crumb svg { width: 16px; height: 16px; color: var(--text-tertiary); }
.dx-hdr-spacer { flex: 1; }
.dx-hdr-logo { padding: 0; grid-auto-flow: column; align-items: center; }
.dx-search { display: flex; align-items: center; gap: 8px; width: 360px; height: 36px; padding: 0 var(--space-12); border-radius: var(--radius-md); background: var(--bg-muted); color: var(--text-tertiary); text-align: left; transition: box-shadow .15s; }
.dx-search:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.dx-search svg { width: 16px; height: 16px; }
.dx-search .dx-grow { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dx-kbd { padding: 2px 6px; border-radius: var(--radius-xs); background: var(--bg-surface); border: 1px solid var(--border-default); }
.dx-icon-btn { position: relative; width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius-md); border: 1px solid var(--border-default); background: var(--bg-surface); color: var(--text-secondary); flex-shrink: 0; transition: background .15s, border-color .15s; }
.dx-icon-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.dx-icon-btn svg { width: 18px; height: 18px; }
.dx-icon-btn .dx-unread { position: absolute; top: 7px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--status-hot); box-shadow: 0 0 0 1.5px var(--bg-surface); }
.dx-only-rail, .dx-only-mobile { display: none !important; }
.dx-user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--radius-md); text-align: left; }
.dx-user-chip:hover, .dx-user-chip[aria-expanded="true"] { background: var(--bg-hover); }
.dx-user-chip svg { width: 16px; height: 16px; color: var(--text-tertiary); }
.dx-user-chip .dx-who { display: grid; }
.dx-user-chip .dx-who .dx-t-caption { color: var(--text-tertiary); }
.dx-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-muted); color: var(--text-secondary); font: 500 12px/16px var(--font); flex-shrink: 0; }
.dx-avatar.dx-sm { width: 24px; height: 24px; font: 500 11px/14px var(--font); }
.dx-avatar.dx-lg { width: 40px; height: 40px; font: 600 14px/20px var(--font); }

/* Popovers (user menu, notifications, dropdown filters) */
.dx-pop-wrap { position: relative; }
.dx-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 240px; padding: var(--space-6); border-radius: var(--radius-lg); background: var(--bg-surface); border: 1px solid var(--border-default); box-shadow: var(--shadow-lg); display: grid; gap: var(--space-2); animation: pop .16s var(--ease); }
.dx-pop.dx-left { right: auto; left: 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.dx-pop-head { padding: var(--space-8) var(--space-12); display: grid; gap: 2px; }
.dx-pop-head .dx-t-body-sm { color: var(--text-tertiary); }
.dx-pop-div { height: 1px; background: var(--border-subtle); margin: 2px 0; }
.dx-pop-item { display: flex; align-items: center; gap: 10px; padding: var(--space-8) var(--space-12); border-radius: var(--radius-md); color: var(--text-primary); text-align: left; width: 100%; }
.dx-pop-item svg { width: 16px; height: 16px; color: var(--text-secondary); }
.dx-pop-item:hover, .dx-pop-item:focus-visible, .dx-pop-item[aria-selected="true"] { background: var(--bg-hover); }
.dx-pop-item.dx-danger, .dx-pop-item.dx-danger svg { color: var(--status-hot); }
.dx-pop-item .dx-check { margin-left: auto; color: var(--brand-primary); }
.dx-pop-empty { padding: var(--space-24) var(--space-16); text-align: center; display: grid; gap: 4px; justify-items: center; color: var(--text-tertiary); }
.dx-pop-empty svg { width: 20px; height: 20px; }

/* ════════ Content ════════ */
.dx-content { display: grid; gap: var(--space-32); padding: var(--space-32); align-content: start; }
.dx-page-head { display: flex; align-items: flex-end; gap: var(--space-16); flex-wrap: wrap; }
.dx-greet { flex: 1; min-width: 260px; display: grid; gap: 4px; }
.dx-greet .dx-t-body { color: var(--text-secondary); }
.dx-actions { display: flex; align-items: center; gap: var(--space-8); flex-wrap: wrap; }

/* Button · Style=Primary/Secondary/Ghost */
.dx-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-6); height: 36px; padding: 0 var(--space-12); border-radius: var(--radius-md); font: 500 13px/18px var(--font); white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.dx-btn svg { width: 16px; height: 16px; }
.dx-btn:active { transform: translateY(1px); }
.dx-btn-primary { background: var(--brand-primary); color: var(--text-inverse); box-shadow: var(--shadow-xs); }
.dx-btn-primary:hover { background: var(--brand-primary-hover); }
.dx-btn-secondary { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-default); box-shadow: var(--shadow-xs); }
.dx-btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.dx-btn-ghost { color: var(--text-primary); }
.dx-btn-ghost:hover { background: var(--bg-hover); }
.dx-btn-sm { height: 32px; padding: 0 10px; }

/* Period selector (Segment option) */
.dx-segs { display: inline-flex; gap: var(--space-2); padding: var(--space-2); border-radius: var(--radius-md); background: var(--bg-muted); }
.dx-segs button { height: 28px; padding: 0 var(--space-12); border-radius: var(--radius-sm); color: var(--text-secondary); font: 500 12px/16px var(--font); white-space: nowrap; transition: background .15s, color .15s; }
.dx-segs button:hover { color: var(--text-primary); }
.dx-segs button[aria-pressed="true"] { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* Filter dropdown */
.dx-filter { display: inline-flex; align-items: center; gap: var(--space-8); height: 32px; padding: 0 var(--space-12); border-radius: var(--radius-md); background: var(--bg-surface); border: 1px solid var(--border-default); color: var(--text-primary); font: 500 13px/18px var(--font); white-space: nowrap; }
.dx-filter:hover, .dx-filter[aria-expanded="true"] { border-color: var(--border-strong); background: var(--bg-hover); }
.dx-filter svg { width: 16px; height: 16px; color: var(--text-tertiary); }
.dx-filter.dx-active { border-color: color-mix(in srgb, var(--brand-primary) 45%, transparent); background: var(--brand-primary-soft); }

/* Badge · Tone=… */
.dx-badge { display: inline-flex; align-items: center; gap: var(--space-6); padding: var(--space-2) var(--space-8); border-radius: var(--radius-full); font: 500 12px/16px var(--font); white-space: nowrap; background: var(--brand-primary-soft); color: var(--text-link); }
.dx-badge .dx-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dx-badge svg { width: 12px; height: 12px; }
.dx-tone-hot, .dx-tone-danger { background: var(--status-hot-bg); color: var(--status-hot); }
.dx-tone-warm, .dx-tone-warning { background: var(--status-warm-bg); color: var(--status-warm); }
.dx-tone-cold { background: var(--status-cold-bg); color: var(--status-cold); }
.dx-tone-booked { background: var(--status-booked-bg); color: var(--status-booked); }
.dx-tone-success { background: var(--status-success-bg); color: var(--status-success); }
.dx-tone-neutral { background: var(--status-neutral-bg); color: var(--status-neutral); }

/* Needs attention · Alert item */
.dx-attn { display: grid; gap: 10px; }
.dx-attn-label { display: flex; align-items: center; gap: 8px; color: var(--text-tertiary); }
.dx-attn-label svg { width: 14px; height: 14px; color: var(--status-warm); }
.dx-alerts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-12); }
.dx-alert { display: flex; align-items: center; gap: var(--space-12); padding: var(--space-12) var(--space-16); border-radius: var(--radius-lg); background: var(--bg-surface); border: 1px solid var(--border-default); transition: border-color .15s, box-shadow .15s, transform .15s; }
.dx-alert:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.dx-alert-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.dx-alert-ic svg { width: 18px; height: 18px; }
.dx-alert-text { flex: 1; min-width: 0; display: grid; }
.dx-alert-text .dx-t-body-sm { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-alert > svg { width: 16px; height: 16px; color: var(--text-tertiary); }
.dx-alert.dx-tone-danger .dx-alert-ic { background: var(--status-hot-bg); color: var(--status-hot); }
.dx-alert.dx-tone-warning .dx-alert-ic { background: var(--status-warm-bg); color: var(--status-warm); }
.dx-alert.dx-tone-info .dx-alert-ic { background: var(--brand-primary-soft); color: var(--text-link); }
.dx-alert.dx-tone-neutral .dx-alert-ic { background: var(--status-neutral-bg); color: var(--status-neutral); }
.dx-alert[class*="tone-"] { background: var(--bg-surface); color: inherit; }

/* KPI card */
.dx-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-16); }
.dx-kpi { display: grid; gap: var(--space-12); align-content: start; padding: var(--space-20); border-radius: var(--radius-lg); background: var(--bg-surface); border: 1px solid var(--border-default); box-shadow: var(--shadow-xs); min-width: 0; }
.dx-kpi-top { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); min-width: 0; }
.dx-kpi-top .dx-t-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-kpi-ic { width: 32px; height: 32px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--brand-primary-soft); color: var(--brand-primary); flex-shrink: 0; }
[data-theme="dark"] .dx-kpi-ic { color: var(--brand-accent-ink); }
.dx-kpi-ic svg { width: 16px; height: 16px; }
.dx-kpi-scope { margin-left: auto; color: var(--text-tertiary); white-space: nowrap; }
.dx-kpi-val { display: flex; align-items: baseline; gap: var(--space-8); flex-wrap: wrap; }
.dx-delta { display: inline-flex; align-items: center; gap: 2px; padding: var(--space-2) var(--space-6); border-radius: var(--radius-full); font: 500 12px/16px var(--font); }
.dx-delta svg { width: 12px; height: 12px; }
.dx-delta.dx-up { background: var(--status-success-bg); color: var(--status-success); }
.dx-delta.dx-down { background: var(--status-hot-bg); color: var(--status-hot); }
.dx-delta.dx-flat { background: var(--status-neutral-bg); color: var(--status-neutral); }
.dx-kpi-foot { color: var(--text-tertiary); }

/* Card + Card header */
.dx-card { display: flex; flex-direction: column; min-width: 0; border-radius: var(--radius-lg); background: var(--bg-surface); border: 1px solid var(--border-default); box-shadow: var(--shadow-xs); overflow: hidden; }
.dx-card-head { display: flex; align-items: center; gap: var(--space-12); padding: var(--space-16) var(--space-20); border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; }
.dx-card-titles { flex: 1; min-width: 160px; display: grid; gap: 2px; }
.dx-card-titles .dx-t-body-sm { color: var(--text-tertiary); }
.dx-card-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-link); font: 500 13px/18px var(--font); white-space: nowrap; }
.dx-card-link svg { width: 14px; height: 14px; transition: transform .15s; }
.dx-card-link:hover svg { transform: translateX(2px); }
.dx-card-body { padding: var(--space-20); flex: 1; }
.dx-card-tools { display: flex; align-items: center; gap: var(--space-8); }

.dx-row { display: grid; gap: var(--space-16); }
.dx-row-ai { grid-template-columns: 400px minmax(0, 1fr); }
.dx-row-charts { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); }
.dx-row-ops { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dx-row-tables { grid-template-columns: minmax(0, 1fr); }

/* Reality AI brief */
.dx-brief { position: relative; display: flex; flex-direction: column; gap: var(--space-16); padding: var(--space-24); border-radius: var(--radius-lg); background: var(--brand-navy); color: var(--nav-text); overflow: hidden; isolation: isolate; }
.dx-brief::after { content: ""; position: absolute; inset: auto -80px -120px auto; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(closest-side, rgba(143, 178, 255, .16), transparent); z-index: -1; }
.dx-brief-tag { display: flex; align-items: center; gap: 6px; color: var(--brand-accent-ink); }
.dx-brief-tag svg { width: 14px; height: 14px; }
.dx-brief h2 { color: var(--text-inverse); }
.dx-brief ul { list-style: none; display: grid; gap: var(--space-12); }
.dx-brief li { display: flex; gap: 10px; }
.dx-brief li svg { width: 16px; height: 16px; color: var(--brand-accent-ink); margin-top: 1px; }
.dx-brief li b { color: var(--nav-text-active); font-weight: 600; }
.dx-brief-more { display: grid; gap: var(--space-12); padding-top: var(--space-12); border-top: 1px solid rgba(255, 255, 255, .08); }
.dx-brief-why { padding: var(--space-12); border-radius: var(--radius-md); background: rgba(255, 255, 255, .05); color: var(--nav-text); }
.dx-brief-why b { color: var(--nav-text-active); display: block; margin-bottom: 2px; }
.dx-brief-foot { display: flex; align-items: center; gap: var(--space-12); margin-top: auto; }
.dx-brief-foot .dx-t-caption { color: var(--nav-text-muted); flex: 1; }
.dx-brief-toggle { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border-radius: var(--radius-md); color: var(--nav-text-active); background: rgba(255, 255, 255, .08); font: 500 12px/16px var(--font); white-space: nowrap; }
.dx-brief-toggle:hover { background: rgba(255, 255, 255, .14); }
.dx-brief-toggle svg { width: 14px; height: 14px; transition: transform .2s; }
.dx-brief-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.dx-brief .dx-sk { background: rgba(255, 255, 255, .1); }

/* List rows */
.dx-list { display: flex; flex-direction: column; }
.dx-li { display: flex; align-items: center; gap: var(--space-12); padding: var(--space-12) var(--space-20); border-bottom: 1px solid var(--border-subtle); min-width: 0; transition: background .12s; }
.dx-li:last-child { border-bottom: 0; }
.dx-li:hover { background: var(--bg-subtle); }
.dx-li-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.dx-li-title { display: flex; align-items: center; gap: var(--space-8); min-width: 0; color: var(--text-primary); }
.dx-li-title .dx-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-li-sub { color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-li-sub .dx-act { color: var(--text-link); font-weight: 500; }
.dx-li-meta { color: var(--text-tertiary); white-space: nowrap; font: 500 12px/16px var(--font); }
.dx-li-btns { display: flex; gap: var(--space-6); }
.dx-sq { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-md); border: 1px solid var(--border-default); background: var(--bg-surface); color: var(--text-secondary); transition: background .15s; }
.dx-sq:hover { background: var(--bg-hover); }
.dx-sq svg { width: 16px; height: 16px; }
.dx-sq.dx-primary { background: var(--brand-primary); border-color: var(--brand-primary); color: var(--text-inverse); }
.dx-sq.dx-primary:hover { background: var(--brand-primary-hover); }
.dx-when { width: 64px; flex-shrink: 0; display: grid; }
.dx-when b { font: 600 13px/18px var(--font); color: var(--text-primary); }
.dx-when span { font: 500 12px/16px var(--font); color: var(--text-tertiary); }
.dx-li-badges { display: flex; gap: var(--space-6); flex-wrap: wrap; justify-content: flex-end; }

/* Tabs */
.dx-swlist { display: flex; gap: var(--space-4); padding: 0 var(--space-20); border-bottom: 1px solid var(--border-subtle); }
.dx-sw { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 var(--space-4); margin-right: var(--space-12); color: var(--text-tertiary); font: 500 13px/18px var(--font); }
.dx-sw:hover { color: var(--text-primary); }
.dx-sw[aria-selected="true"] { color: var(--text-primary); }
.dx-sw[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand-primary); }
.dx-sw .dx-n { padding: 0 6px; border-radius: var(--radius-full); background: var(--bg-muted); color: var(--text-secondary); font: 500 11px/16px var(--font); }

/* Charts */
.dx-funnel { display: grid; gap: var(--space-8); }
.dx-f-row { display: grid; grid-template-columns: 136px minmax(0, 1fr) 36px 40px; align-items: center; gap: var(--space-12); min-height: 28px; }
.dx-f-label { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dx-f-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.dx-f-track { height: 10px; border-radius: var(--radius-full); background: var(--chart-track); overflow: hidden; }
.dx-f-fill { height: 100%; border-radius: var(--radius-full); transform-origin: left; animation: grow .7s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.dx-f-n { text-align: right; font: 600 13px/18px var(--font); }
.dx-f-pct { text-align: right; color: var(--text-tertiary); font: 500 12px/16px var(--font); }

.dx-donut-wrap { display: flex; align-items: center; gap: var(--space-24); flex-wrap: wrap; justify-content: center; }
.dx-donut { position: relative; width: 148px; height: 148px; flex-shrink: 0; }
.dx-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dx-donut circle { fill: none; stroke-width: 16; transition: opacity .2s, stroke-width .2s; }
.dx-donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.dx-donut-center .dx-t-caption { color: var(--text-tertiary); }
.dx-legend { display: grid; gap: var(--space-8); flex: 1; min-width: 150px; }
.dx-lg { display: grid; grid-template-columns: 10px 1fr auto 40px; align-items: center; gap: var(--space-8); padding: 4px 6px; margin: -4px -6px; border-radius: var(--radius-sm); text-align: left; }
.dx-lg:hover, .dx-lg.dx-on { background: var(--bg-hover); }
.dx-lg i { width: 10px; height: 10px; border-radius: 3px; }
.dx-lg .dx-t-label { color: var(--text-secondary); }
.dx-lg .dx-pct { color: var(--text-tertiary); text-align: right; font: 500 12px/16px var(--font); }
.dx-donut-wrap.dx-focus circle:not(.dx-on) { opacity: .25; }
.dx-donut-wrap.dx-focus circle.dx-on { stroke-width: 19; }

.dx-bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; gap: var(--space-8); height: 172px; padding-top: 18px; }
.dx-bar { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; height: 100%; gap: 6px; min-width: 0; }
.dx-bar-col { width: 100%; max-width: 28px; align-self: end; border-radius: 6px 6px 2px 2px; background: var(--chart-1); opacity: .9; transform-origin: bottom; animation: rise .7s var(--ease) both; min-height: 2px; }
.dx-bar-col.dx-zero { background: var(--chart-track); opacity: 1; }
.dx-bar:hover .dx-bar-col { opacity: 1; filter: brightness(1.08); }
@keyframes rise { from { transform: scaleY(0); } }
.dx-bar-v { font: 600 12px/16px var(--font); color: var(--text-primary); }
.dx-bar-x { font: 500 11px/14px var(--font); color: var(--text-tertiary); white-space: nowrap; }
.dx-chart-foot { display: flex; gap: var(--space-16); flex-wrap: wrap; margin-top: var(--space-16); color: var(--text-tertiary); }
.dx-chart-foot b { color: var(--text-primary); font-weight: 600; }

/* Inventory */
.dx-inv { display: grid; gap: var(--space-16); }
.dx-inv-p { display: grid; gap: var(--space-8); }
.dx-inv-top { display: flex; align-items: baseline; gap: var(--space-8); }
.dx-inv-top .dx-t-subtitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-inv-top .dx-t-label-sm { color: var(--text-tertiary); white-space: nowrap; }
.dx-stack { display: flex; height: 10px; border-radius: var(--radius-full); overflow: hidden; background: var(--chart-track); gap: 2px; }
.dx-stack i { display: block; height: 100%; transform-origin: left; animation: grow .7s var(--ease) both; }
.dx-inv-meta { display: flex; gap: var(--space-12); flex-wrap: wrap; color: var(--text-tertiary); font: 500 12px/16px var(--font); }
.dx-inv-meta span { display: inline-flex; align-items: center; gap: 6px; }
.dx-inv-meta i { width: 8px; height: 8px; border-radius: 2px; }
.dx-inv-sub { color: var(--text-tertiary); }

/* Tables */
.dx-tbl-wrap { overflow-x: auto; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: collapse; font: 400 13px/18px var(--font); }
th { height: 36px; padding: 0 var(--space-16); background: var(--bg-subtle); color: var(--text-tertiary); font: 500 12px/16px var(--font); text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border-subtle); }
th.dx-r, td.dx-r { text-align: right; }
th button { display: inline-flex; align-items: center; gap: 4px; color: inherit; font: inherit; height: 100%; }
th button:hover { color: var(--text-primary); }
th button svg { width: 12px; height: 12px; opacity: .45; }
th[aria-sort="ascending"] button, th[aria-sort="descending"] button { color: var(--text-primary); }
th[aria-sort="ascending"] button svg, th[aria-sort="descending"] button svg { opacity: 1; color: var(--brand-primary); }
td { height: 52px; padding: 0 var(--space-16); border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
td.dx-strong { color: var(--text-primary); font-weight: 500; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--bg-subtle); }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { height: 44px; background: var(--bg-subtle); color: var(--text-primary); font-weight: 600; border-top: 1px solid var(--border-default); border-bottom: 0; }
.dx-cell-p { display: flex; align-items: center; gap: var(--space-12); min-width: 0; }
.dx-cell-p > div { display: grid; min-width: 0; }
.dx-cell-p .dx-t-body-sm { color: var(--text-tertiary); }
.dx-minibar { display: inline-block; width: 56px; height: 4px; border-radius: 2px; background: var(--chart-track); vertical-align: middle; margin-right: 8px; overflow: hidden; }
.dx-minibar i { display: block; height: 100%; background: var(--chart-1); }

/* Empty / loading / error states */
.dx-state { display: grid; justify-items: center; gap: var(--space-8); padding: var(--space-32) var(--space-24); text-align: center; }
.dx-state-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-muted); color: var(--text-tertiary); }
.dx-state-ic svg { width: 20px; height: 20px; }
.dx-state .dx-t-body-sm { color: var(--text-tertiary); max-width: 300px; }
.dx-state.dx-error .dx-state-ic { background: var(--status-hot-bg); color: var(--status-hot); }
.dx-state .dx-btn { margin-top: 4px; }
.dx-sk { display: block; border-radius: 4px; background: var(--bg-muted); position: relative; overflow: hidden; }
.dx-sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--bg-surface) 55%, transparent), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.dx-sk-row { display: flex; align-items: center; gap: var(--space-12); padding: var(--space-12) var(--space-20); border-bottom: 1px solid var(--border-subtle); }
.dx-sk-lines { display: grid; gap: 8px; flex: 1; }
.dx-sk-bars { display: flex; align-items: flex-end; gap: var(--space-12); height: 160px; }
.dx-sk-bars .dx-sk { flex: 1; }
.dx-unavail { display: inline-flex; align-items: center; gap: 4px; color: var(--text-tertiary); }
.dx-unavail svg { width: 12px; height: 12px; }

/* Mobile tab bar */
.dx-bottomnav { display: none; }

/* Drawer, modal, palette, toast */
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(-100%); } }

/* ── v2: sections, scope chips, alerts, KPI, brief ── */
.dx-block { display: grid; gap: var(--space-12); min-width: 0; }
.dx-sec-head { display: flex; align-items: center; gap: var(--space-12); }
.dx-sec-label { display: inline-flex; align-items: center; gap: 8px; color: var(--text-tertiary); }
.dx-sec-label svg { width: 14px; height: 14px; color: var(--status-warm); }
.dx-sec-head::after { content: ""; flex: 1; height: 1px; background: var(--border-default); order: 1; }
.dx-sec-note { order: 2; color: var(--text-tertiary); white-space: nowrap; }

/* Scope chip: every number says whether it is a period, a snapshot, upcoming or all-time */
.dx-scope { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--radius-full); font: 500 11px/14px var(--font); letter-spacing: .1px; white-space: nowrap; border: 1px solid var(--border-default); color: var(--text-secondary); background: var(--bg-surface); }
.dx-scope svg { width: 12px; height: 12px; color: var(--text-tertiary); }
.dx-scope-period { border-color: color-mix(in srgb, var(--brand-primary) 28%, transparent); background: var(--brand-primary-soft); color: var(--text-link); }
.dx-scope-period svg { color: var(--text-link); }
.dx-scope .dx-live { width: 6px; height: 6px; border-radius: 50%; background: var(--status-success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-success) 22%, transparent); }
.dx-scope-all { border-style: dashed; }
.dx-scope-slot:empty { display: none; }

/* Needs attention: count · what · severity · action */
.dx-alert { position: relative; align-items: flex-start; padding: var(--space-16); overflow: hidden; }
.dx-alert::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.dx-alert.dx-sev-high::before { background: var(--status-hot); }
.dx-alert.dx-sev-med::before { background: var(--status-warm); }
.dx-alert-text { gap: 2px; }
.dx-alert-top { display: flex; align-items: center; gap: var(--space-8); }
.dx-sev { font: 600 11px/14px var(--font); letter-spacing: .3px; padding: 2px 6px; border-radius: var(--radius-xs); }
.dx-sev-high .dx-sev { color: var(--status-hot); background: var(--status-hot-bg); }
.dx-sev-med .dx-sev { color: var(--status-warm); background: var(--status-warm-bg); }
.dx-sev-clear .dx-sev { color: var(--status-success); background: var(--status-success-bg); }
.dx-sev-na .dx-sev { color: var(--status-neutral); background: var(--status-neutral-bg); }
.dx-alert-text .dx-t-body-sm { color: var(--text-primary); }
.dx-alert-cta { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--text-link); font: 500 12px/16px var(--font); }
.dx-alert-cta svg { width: 12px; height: 12px; transition: transform .15s; }
.dx-alert:hover .dx-alert-cta svg { transform: translateX(2px); }
.dx-sev-clear .dx-alert-cta, .dx-sev-na .dx-alert-cta { color: var(--text-tertiary); }
.dx-alert.dx-sev-high .dx-alert-ic { background: var(--status-hot-bg); color: var(--status-hot); }
.dx-alert.dx-sev-med .dx-alert-ic { background: var(--status-warm-bg); color: var(--status-warm); }
.dx-alert.dx-sev-clear .dx-alert-ic, .dx-alert.dx-sev-na .dx-alert-ic { background: var(--status-neutral-bg); color: var(--status-neutral); }

/* KPI v2 */
.dx-kpi-val .dx-t-kpi { color: var(--text-primary); }
.dx-kpi-meta { display: grid; gap: 6px; }
.dx-kpi-meta .dx-kpi-foot { display: block; }
.dx-kpi-today { display: flex; align-items: flex-start; gap: 6px; padding-top: var(--space-8); border-top: 1px dashed var(--border-default); color: var(--text-secondary); font: 400 12px/16px var(--font); }
.dx-kpi-today b { color: var(--text-primary); font-weight: 600; }

/* Reality AI brief v2: summary → insight → recommended action */
.dx-brief { gap: var(--space-16); }
.dx-brief-head { display: flex; align-items: center; gap: var(--space-8); }
.dx-brief-mark { width: 28px; height: 28px; border-radius: var(--radius-md); display: grid; place-items: center; background: rgba(143, 178, 255, .16); color: var(--brand-accent-ink); }
.dx-brief-mark svg { width: 16px; height: 16px; }
.dx-brief-head .dx-t-subtitle { color: var(--text-inverse); }
.dx-brief-head .dx-t-caption { margin-left: auto; color: var(--nav-text-muted); }
.dx-brief-sum { display: grid; gap: 6px; }
.dx-brief-sum p { color: var(--nav-text); }
.dx-brief-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid rgba(255, 255, 255, .08); border-radius: var(--radius-md); overflow: hidden; }
.dx-brief-stats div { display: grid; gap: 2px; padding: var(--space-8) var(--space-12); }
.dx-brief-stats div + div { border-left: 1px solid rgba(255, 255, 255, .08); }
.dx-brief-stats b { font: 600 20px/26px var(--font-display); color: var(--text-inverse); }
.dx-brief-stats span { font: 500 11px/14px var(--font); color: var(--nav-text-muted); }
.dx-brief-k { display: flex; align-items: center; gap: 6px; color: var(--brand-accent-ink); margin-bottom: 6px; }
.dx-brief-k svg { width: 13px; height: 13px; }
.dx-brief-insight p { color: var(--nav-text-active); }
.dx-brief-insight p span { color: var(--nav-text); }
.dx-brief-rec { display: grid; gap: var(--space-12); padding: var(--space-16); border-radius: var(--radius-lg); background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); }
.dx-rec-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dx-rec-who .dx-avatar { background: rgba(255, 255, 255, .1); color: var(--nav-text-active); }
.dx-rec-who > div { display: grid; min-width: 0; }
.dx-rec-who .dx-t-label { color: var(--nav-text-active); }
.dx-rec-who .dx-t-caption { color: var(--nav-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-rec-score { margin-left: auto; padding: 2px 8px; border-radius: var(--radius-full); background: rgba(143, 178, 255, .16); color: var(--brand-accent-ink); font: 600 12px/16px var(--font); white-space: nowrap; }
.dx-rec-act { color: var(--text-inverse); }
.dx-rec-why { color: var(--nav-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dx-rec-btns { display: flex; gap: var(--space-8); flex-wrap: wrap; }
.dx-btn-onnavy { background: rgba(255, 255, 255, .08); color: var(--nav-text-active); border: 1px solid rgba(255, 255, 255, .12); }
.dx-btn-onnavy:hover { background: rgba(255, 255, 255, .14); }
.dx-brief-more ul { list-style: none; display: grid; gap: var(--space-8); }

.dx-card-foot { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; margin-top: auto; border-top: 1px solid var(--border-subtle); color: var(--text-link); font: 500 13px/18px var(--font); }
.dx-card-foot svg { width: 14px; height: 14px; }
.dx-card-foot:hover { background: var(--bg-subtle); }
.dx-chart-warn { display: flex; align-items: flex-start; gap: 6px; margin-top: var(--space-12); padding: 8px 10px; border-radius: var(--radius-md); border: 1px dashed color-mix(in srgb, var(--status-warm) 45%, transparent); color: var(--text-secondary); font: 400 12px/16px var(--font); }
.dx-chart-warn svg { width: 14px; height: 14px; color: var(--status-warm); flex-shrink: 0; margin-top: 1px; }
.dx-dedupe { display: flex; align-items: center; gap: 6px; padding: 8px 20px; color: var(--text-tertiary); font: 400 12px/16px var(--font); border-top: 1px solid var(--border-subtle); background: var(--bg-subtle); }
.dx-dedupe svg { width: 12px; height: 12px; }

/* Tooltips for the rail */
[data-tip] { position: relative; }

/* ════════ Tablet · 768–1279 (Sidebar=Rail, Header=Tablet) ════════ */
@media (max-width: 1279px) {
  .dx-app { grid-template-columns: 72px minmax(0, 1fr); }
  .dx-app > .dx-side { align-items: center; padding: var(--space-16) var(--space-12); }
  .dx-app > .dx-side .dx-logo span.dx-word, .dx-app > .dx-side .dx-ws, .dx-app > .dx-side .dx-nav-label, .dx-app > .dx-side .dx-nav-count, .dx-app > .dx-side .dx-ai-ready, .dx-app > .dx-side .dx-nav-sec { display: none; }
  .dx-app > .dx-side .dx-logo { padding: 4px 0 16px; }
  .dx-app > .dx-side .dx-nav-sep { display: block; width: 24px; height: 1px; background: var(--nav-border); margin: 8px 0; }
  .dx-app > .dx-side .dx-nav-item { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .dx-app > .dx-side .dx-nav-item svg { width: 20px; height: 20px; }
  .dx-app > .dx-side .dx-nav-item[aria-current="page"]::before { display: none; }
  .dx-app > .dx-side .dx-nav-item.dx-has-count::after { content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-primary); }
  .dx-app > .dx-side .dx-nav-item:hover::before { content: attr(data-label); display: block; position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); width: auto; height: auto; padding: 4px 8px; border-radius: var(--radius-sm); background: var(--text-primary); color: var(--bg-surface); font: 500 12px/16px var(--font); white-space: nowrap; z-index: 30; pointer-events: none; }
  .dx-only-rail { display: grid !important; }
  .dx-search { width: 260px; }
  .dx-content { padding: var(--space-24); gap: var(--space-20); }
  .dx-page-head { align-items: flex-start; }
  .dx-greet { flex-basis: 100%; }
  .dx-alerts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dx-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .dx-kpi { grid-column: span 2; }
  .dx-kpi:nth-child(n+4) { grid-column: span 3; }
  .dx-row-ai { grid-template-columns: minmax(0, 1fr); }
  .dx-row-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dx-row-charts > .dx-card:first-child { grid-column: 1 / -1; }
  .dx-row-ops { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dx-row-ops > .dx-card:last-child { grid-column: 1 / -1; }
  .dx-row-ops > .dx-card:last-child .dx-inv { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-20); }
  .dx-row-tables { grid-template-columns: minmax(0, 1fr); }
  .dx-user-chip .dx-who, .dx-user-chip > svg { display: none; }
}
.dx-nav-sep { display: none; }

/* ════════ Phone · <768 (Header=Mobile + Mobile tab bar) ════════ */
@media (max-width: 767px) {
  .dx-app { display: flex; flex-direction: column; }
  .dx-app > .dx-side { display: none; }
  .dx-only-rail { display: none !important; }
  .dx-only-mobile { display: grid !important; }
  .dx-hide-mobile { display: none !important; }
  .dx-hdr { height: 56px; padding: 0 var(--space-16); gap: var(--space-8); }
  .dx-main { flex: 1; }
  .dx-content { padding: var(--space-16) var(--space-16) var(--space-24); gap: var(--space-16); }
  .dx-greet { min-width: 0; }
  .dx-greet .dx-t-display { font-size: 22px; line-height: 28px; letter-spacing: -0.4px; }
  .dx-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .dx-actions .dx-segs { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); }
  .dx-actions .dx-segs button { height: 36px; }
  .dx-actions .dx-btn { height: 44px; }
  .dx-alerts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-8); }
  .dx-alert { padding: var(--space-12); gap: var(--space-8); flex-direction: column; align-items: flex-start; }
  .dx-alert > svg { display: none; }
  .dx-alert-ic { width: 32px; height: 32px; }
  .dx-alert-text .dx-t-body-sm { white-space: normal; }
  .dx-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-8); }
  .dx-kpi, .dx-kpi:nth-child(n+4) { grid-column: auto; padding: var(--space-16); gap: var(--space-8); }
  .dx-kpi:first-child { grid-column: 1 / -1; }
  .dx-kpi .dx-kpi-ic { width: 28px; height: 28px; }
  .dx-kpi .dx-t-kpi { font-size: 24px; line-height: 28px; }
  .dx-kpi-scope { display: none; }
  .dx-row-charts, .dx-row-ops { grid-template-columns: minmax(0, 1fr); }
  .dx-row-ops > .dx-card:last-child .dx-inv { grid-template-columns: minmax(0, 1fr); }
  .dx-brief { padding: var(--space-20); }
  .dx-brief h2 { font-size: 18px; line-height: 24px; }
  .dx-card-head { padding: var(--space-12) var(--space-16); }
  .dx-card-body { padding: var(--space-16); }
  .dx-li { padding: var(--space-12) var(--space-16); align-items: flex-start; flex-wrap: wrap; }
  .dx-li .dx-li-btns { width: 100%; padding-left: 44px; }
  .dx-li .dx-li-btns .dx-sq { width: 40px; height: 40px; }
  .dx-li-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .dx-f-row { grid-template-columns: 104px minmax(0, 1fr) 28px; gap: var(--space-8); }
  .dx-f-pct { display: none; }
  .dx-donut { width: 120px; height: 120px; }
  .dx-bars { height: 140px; gap: 4px; }
  .dx-swlist { padding: 0 var(--space-16); }
  .dx-sw { height: 44px; }
  .dx-filter { height: 36px; }
  th:first-child, td:first-child { position: sticky; left: 0; z-index: 1; background: var(--bg-surface); box-shadow: 1px 0 0 var(--border-subtle); }
  th:first-child { background: var(--bg-subtle); }
  tfoot td:first-child { background: var(--bg-subtle); }
  .dx-tbl-hint { display: flex !important; }
  .dx-bottomnav { display: flex; justify-content: space-between; align-items: center; height: 64px; padding: 0 var(--space-16) var(--space-4); background: var(--bg-surface); border-top: 1px solid var(--border-default); flex-shrink: 0; }
  .dx-bottomnav .dx-bn { position: relative; width: 64px; height: 48px; display: grid; place-items: center; align-content: center; gap: 2px; color: var(--text-tertiary); font: 500 11px/14px var(--font); border-radius: var(--radius-md); }
  .dx-bottomnav .dx-bn svg { width: 22px; height: 22px; }
  .dx-bottomnav .dx-bn[aria-current="page"] { color: var(--brand-primary); }
  [data-theme="dark"] .dx-bottomnav .dx-bn[aria-current="page"] { color: var(--brand-accent-ink); }
  .dx-bottomnav .dx-tb-count { position: absolute; top: 2px; left: 36px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--status-hot); color: #fff; font: 600 10px/16px var(--font); box-shadow: 0 0 0 2px var(--bg-surface); }
}
.dx-tbl-hint { display: none; align-items: center; gap: 6px; padding: 8px 16px; color: var(--text-tertiary); font: 500 11px/14px var(--font); border-top: 1px solid var(--border-subtle); }
.dx-tbl-hint svg { width: 12px; height: 12px; }

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

/* ── v2 responsive: spacing + 44px touch targets on phones ── */
@media (max-width: 1279px) {
  .dx-content { gap: var(--space-24); }
}
@media (max-width: 767px) {
  .dx-content { gap: var(--space-24); }
  .dx-sec-note { display: none; }
  .dx-hdr .dx-icon-btn { width: 44px; height: 44px; }
  .dx-user-chip { min-height: 44px; padding: 6px; }
  .dx-actions .dx-segs button, .dx-filter, .dx-btn-sm, .dx-brief-toggle, .dx-rec-btns .dx-btn { height: 44px; }
  .dx-li .dx-li-btns .dx-sq { width: 44px; height: 44px; }
  .dx-card-link { min-height: 44px; }
  th { height: 44px; }
  th button { min-height: 44px; min-width: 44px; }
  .dx-lg { min-height: 44px; }
  .dx-pop-item { min-height: 44px; }
  .dx-alert { padding: var(--space-12); }
  .dx-alert .dx-alert-top { flex-wrap: wrap; gap: 4px 8px; }
  .dx-alert-cta { min-height: 20px; }
  .dx-brief-stats b { font-size: 18px; line-height: 24px; }
  .dx-dedupe { padding: 8px 16px; }
}
.dx-kpi-meta { justify-items: start; }
.dx-li-tags { display: flex; gap: var(--space-6); flex-wrap: wrap; margin-top: 4px; }
.dx-bar-x { overflow: hidden; text-overflow: clip; max-width: 100%; }
/* Tablet and phone: tables scroll sideways with the first column pinned */
@media (max-width: 1279px) {
  th:first-child, td:first-child { position: sticky; left: 0; z-index: 1; background: var(--bg-surface); box-shadow: 1px 0 0 var(--border-subtle); }
  th:first-child, tfoot td:first-child { background: var(--bg-subtle); }
  .dx-tbl-hint { display: flex !important; }
}
.dx-kpi-today svg { width: 14px; height: 14px; margin-top: 1px; color: var(--text-tertiary); }
.dx-bar-x { display: grid; justify-items: center; line-height: 14px; }
.dx-bar-x em { font-style: normal; color: var(--text-tertiary); opacity: .8; }
.dx-kpi-meta .dx-unavail { display: inline-flex; }


/* ════════ Real app shell: document scroll, sticky chrome ════════ */
body.dx { background: var(--bg-canvas); color: var(--text-primary); }
.dx-app { height: auto; min-height: 100vh; min-height: 100dvh; }
.dx-main { overflow: visible; overflow-x: clip; overscroll-behavior: auto; scroll-behavior: auto; }
.dx-side { position: sticky; top: 0; height: 100vh; height: 100dvh; }
.dx-bn { text-decoration: none; }
.dx-bottomnav a.dx-bn[aria-current="page"] { color: var(--brand-primary); }
.dx-scrim { display: none; }

/* app.css also styles the hook classes session.js / branding.js / experience.js look for
   (.sidebar, .nav-item, .org-*, .user-*). Neutralise those rules inside the dashboard. */
.dx .sidebar { transform: none; box-shadow: none; transition: none; width: auto; inset: 0 auto auto auto; z-index: auto; }
.dx .nav-item { font-weight: 500; cursor: pointer; }
.dx .nav-item.active { background: none; }
.dx .org-logo { width: 32px; height: 32px; border-radius: var(--radius-md); background: var(--brand-primary); color: #fff; font: 500 12px/16px var(--font); }
.dx .org-sub { display: block; font-size: inherit; }
.dx .user-avatar { width: 32px; height: 32px; background: var(--bg-muted); color: var(--text-secondary); font: 500 12px/16px var(--font); }
.dx .user-name { font: 500 13px/18px var(--font); }
.dx .user-role { font: 500 11px/14px var(--font); letter-spacing: .2px; color: var(--text-tertiary); }

/* Rail / phone: the sidebar opens as a drawer */
@media (max-width: 1279px) {
  .dx-app.dx-drawer-open > .dx-scrim { display: block; position: fixed; inset: 0; z-index: 60; background: var(--overlay); animation: dx-fade .2s both; }
  .dx-app.dx-drawer-open > .dx-side { display: flex; position: fixed; top: 0; bottom: 0; left: 0; height: auto; z-index: 61; width: min(280px, 86vw); align-items: stretch; padding: var(--space-16); box-shadow: var(--shadow-lg); animation: dx-slide .25s var(--ease) both; }
  .dx-app.dx-drawer-open > .dx-side .dx-word, .dx-app.dx-drawer-open > .dx-side .dx-nav-label, .dx-app.dx-drawer-open > .dx-side .dx-nav-sec { display: block; }
  .dx-app.dx-drawer-open > .dx-side .dx-ws, .dx-app.dx-drawer-open > .dx-side .dx-nav-count { display: flex; }
  .dx-app.dx-drawer-open > .dx-side .dx-ai-ready { display: grid; }
  .dx-app.dx-drawer-open > .dx-side .dx-nav-sep { display: none; }
  .dx-app.dx-drawer-open > .dx-side .dx-logo { padding: var(--space-8); }
  .dx-app.dx-drawer-open > .dx-side .dx-nav-item { width: 100%; height: 40px; padding: 0 var(--space-12); justify-content: flex-start; }
  .dx-app.dx-drawer-open > .dx-side .dx-nav-item svg { width: 18px; height: 18px; }
  .dx-app.dx-drawer-open > .dx-side .dx-nav-item:hover::before { display: none; }
  .dx-app.dx-drawer-open > .dx-side .dx-nav-item[aria-current="page"]::before { display: block; content: ""; left: 0; top: 11px; width: 3px; height: 18px; padding: 0; background: var(--brand-accent-ink); transform: none; }
  .dx-app.dx-drawer-open > .dx-side .dx-nav-item.dx-has-count::after { display: none; }
}
@keyframes dx-fade { from { opacity: 0; } }
@keyframes dx-slide { from { transform: translateX(-100%); } }

/* Phone: fixed bottom navigation, content clears it */
@media (max-width: 767px) {
  .dx-bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: auto; min-height: 64px; padding: 4px var(--space-16) calc(4px + env(safe-area-inset-bottom)); }
  .dx-content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .dx-bottomnav .dx-bn { width: 64px; min-height: 48px; }
  .dx-bottomnav a.dx-bn[aria-current="page"] { color: var(--brand-primary); }
}
@media (max-width: 767px) { [data-theme="dark"] .dx-bottomnav a.dx-bn[aria-current="page"] { color: var(--brand-accent-ink); } }
.dx-li .dx-name:hover { text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 767px) {
  /* 44px hit areas for inline links without changing the row layout */
  .dx-li .dx-name { display: inline-block; padding: 13px 0; margin: -13px 0; }
  .dx-hdr-logo { min-height: 44px; }
}
