/* WT UI enhances the existing application DOM and event handlers. */
html { background: var(--wt-page); scroll-padding-top: calc(var(--wt-topbar) + var(--wt-space-4)); }
body { background: var(--wt-page); color: var(--wt-text); font-family: var(--wt-font); font-size: var(--wt-text-base); line-height: 1.55; }
button, input, select, textarea { font-family: inherit; font-size: var(--wt-text-base); }
button, .button-link { min-height: var(--wt-control); border: 1px solid var(--wt-border); border-radius: var(--wt-radius); background: var(--wt-subtle); color: var(--wt-text); padding: var(--wt-space-2) var(--wt-space-3); transition: background var(--wt-duration) var(--wt-ease); }
button:hover, .button-link:hover { filter: none; background: var(--wt-accent-surface); color: var(--wt-text); }
button:disabled { cursor: default; opacity: .6; }
button.primary, .primary, .panelhead button.primary { background: var(--wt-action); border-color: transparent; color: var(--wt-surface); font-weight: var(--wt-weight-strong); }
button.primary:hover, .primary:hover { background: var(--wt-action-hover); }
:root[data-color-mode=dark] .primary, :root[data-color-mode=dark] .panelhead button.primary, :root[data-color-mode=dark] button.primary { color: var(--wt-petroleum); }
:is(button,a,input,select,textarea,summary,[tabindex]):focus-visible { outline: 2px solid var(--wt-focus); outline-offset: 3px; box-shadow: none; }
input, select, textarea { background: var(--wt-surface); color: var(--wt-text); border: 1px solid var(--wt-border); border-radius: var(--wt-radius); min-height: var(--wt-control); padding: var(--wt-space-2) var(--wt-space-3); }
input[type=checkbox], input[type=radio] { min-height: 20px; width: 20px; height: 20px; accent-color: var(--wt-action); padding: 0; }
label { color: var(--wt-text); font-size: var(--wt-text-sm); font-weight: var(--wt-weight-medium); }
textarea { resize: vertical; }
h1, h2, h3, h4, strong { color: var(--wt-text); }
h1, body[data-view=dia] .pagehead h1 { font-size: var(--wt-text-title); letter-spacing: -.6px; line-height: 1.25; font-weight: var(--wt-weight-strong); }
h2, .panelhead h2 { font-size: var(--wt-text-lg); font-weight: var(--wt-weight-strong); }
p, small, .muted { color: var(--wt-secondary); }
.eyebrow { color: var(--wt-secondary); font-size: var(--wt-text-xs); font-weight: var(--wt-weight-strong); letter-spacing: 1px; }
.shell { margin-left: var(--wt-sidebar); padding-top: var(--wt-topbar); }
body header { position: fixed; inset: 0 0 auto var(--wt-sidebar); height: var(--wt-topbar); min-height: var(--wt-topbar); z-index: var(--wt-layer-header); padding: 0 var(--wt-space-6); background: var(--wt-surface); border-bottom: 1px solid var(--wt-border); box-shadow: none; gap: var(--wt-space-4); }
header > .brand, header > .portal-title, header > .demo { display: none; }
header .breadcrumb { display: flex; min-width: 0; color: var(--wt-secondary); font-size: var(--wt-text-sm); }
.breadcrumb #crumb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#menu-toggle { display: inline-flex; align-items: center; justify-content: center; border-color: var(--wt-border); width: var(--wt-control); height: var(--wt-control); flex: 0 0 auto; color: var(--wt-text); }
body aside { inset: 0 auto 0 0; width: var(--wt-sidebar); height: 100dvh; padding: var(--wt-space-4) var(--wt-space-3); background: var(--wt-petroleum); color: #d7e4ef; border: 0; z-index: var(--wt-layer-sidebar); transform: none; box-shadow: none; }
.wt-sidebar-brand { display: flex; align-items: center; gap: var(--wt-space-3); min-height: 56px; margin: 0 var(--wt-space-1) var(--wt-space-6); }
.wt-sidebar-brand img { object-fit: contain; width: 44px; height: 44px; background: white; border-radius: var(--wt-radius); }
.wt-sidebar-brand strong { display: block; color: white; font-size: var(--wt-text-base); white-space: nowrap; }
.wt-sidebar-brand small { display: block; font-size: var(--wt-text-xs); color: #a8bfd2; }
aside .navlabel { display: none !important; }
aside nav { display: flex; flex-direction: column; gap: var(--wt-space-1); overflow: visible; }
aside nav button, :root[data-color-mode=dark] aside nav button:not(.active) { min-height: 42px; padding: var(--wt-space-2) var(--wt-space-3); gap: var(--wt-space-3); border: 0; color: #bcd0df; background: transparent; border-radius: var(--wt-radius); width: 100%; font-size: var(--wt-text-sm); }
aside nav button:hover, :root[data-color-mode=dark] aside nav button:hover { color: white; background: #ffffff0d; }
aside nav button.active { color: white; background: #2878e338; border: 0; box-shadow: inset 3px 0 var(--wt-blue); }
aside .nav-group { margin: var(--wt-space-2) 0 0; }
aside .nav-group > summary { padding: var(--wt-space-3); color: #a8bfd2; font-size: var(--wt-text-xs); font-weight: var(--wt-weight-medium); letter-spacing: .4px; }
aside .nav-group > summary:hover { background: #ffffff0d; }
aside .nav-group > button { margin-left: 0; width: 100%; }
aside .aside-bottom { border-top: 1px solid #ffffff1a; color: #d7e4ef; margin-top: var(--wt-space-6); padding: var(--wt-space-4) var(--wt-space-2) 0; }
aside .aside-bottom small { color: #a8bfd2; }
aside .aside-bottom .avatar { background: #ffffff14; color: white; }
.ui-icon { width: 18px; height: 18px; max-width: 24px; max-height: 24px; }
body main, body[data-view=dia] main { max-width: 1920px; padding: var(--wt-space-8); min-width: 0; }
.pagehead, body[data-view=dia] .pagehead { margin-bottom: var(--wt-space-6); align-items: flex-start; }
.pagehead p, body[data-view=dia] .pagehead p { font-size: var(--wt-text-base); margin-top: var(--wt-space-2); }
.workspace-filters, body[data-view=dia] .workspace-filters { padding: var(--wt-space-3) var(--wt-space-4); margin-bottom: var(--wt-space-5); border-radius: var(--wt-radius); background: var(--wt-surface); border: 1px solid var(--wt-border); }
.panel, .workcard, .kpi, .portal-section, .overview-chart, .portal-chart-panel { background: var(--wt-surface); color: var(--wt-text); border: 1px solid var(--wt-border); border-radius: var(--wt-radius-lg); box-shadow: none; }
.panel { padding: var(--wt-space-5); margin-bottom: var(--wt-space-5); }
.panelhead { margin-bottom: var(--wt-space-4); align-items: flex-start; flex-wrap: wrap; }
.panelhead button { color: var(--wt-action); background: var(--wt-subtle); font-size: var(--wt-text-sm); min-height: 36px; padding: var(--wt-space-2) var(--wt-space-3); }
.kpis { gap: var(--wt-space-3); grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); }
.kpi { padding: var(--wt-space-4); }
.kpi > strong { font-size: 1.5rem; letter-spacing: -.5px; font-variant-numeric: tabular-nums; color: var(--wt-text); }
.kpi-icon { background: var(--wt-accent-surface); color: var(--wt-action); border-radius: var(--wt-radius); width: 32px; height: 32px; }
.kpi > small, .kpi-top > span:first-child { font-size: var(--wt-text-xs); color: var(--wt-secondary); }
.tag, :root[data-color-mode=dark] .tag { background: var(--wt-accent-surface); color: var(--wt-action); padding: var(--wt-space-1) var(--wt-space-2); border-radius: var(--wt-space-1); font-size: var(--wt-text-xs); font-weight: var(--wt-weight-medium); }
.tag.green, :root[data-color-mode=dark] .tag.green { background: var(--wt-success-surface); color: var(--wt-success-text); }
.tag.amber, :root[data-color-mode=dark] .tag.amber { background: var(--wt-warning-surface); color: var(--wt-warning-text); }
.tag.red, :root[data-color-mode=dark] .tag.red { background: var(--wt-danger-surface); color: var(--wt-danger-text); }
:is(.task-card,.file-card,.purchase-card,.quote,.diary-entry,.message,.conversation-context,.conversation-compose,.conversation-toolbar,.site-overview,.work-meta,.report-visual,.notice,.automation-item) { border-color: var(--wt-border); color: var(--wt-text); }
.notice, .automation-internal { background: var(--wt-warning-surface); color: var(--wt-warning-text); }
progress { accent-color: var(--wt-blue); border-radius: var(--wt-space-1); }
progress::-webkit-progress-bar { background: var(--wt-border); }
progress::-webkit-progress-value { background: var(--wt-blue); }
dialog { background: var(--wt-surface); color: var(--wt-text); border: 1px solid var(--wt-border); border-radius: var(--wt-radius-lg); box-shadow: var(--wt-shadow-overlay); max-height: calc(100dvh - var(--wt-space-8)); overflow-y: auto; padding: var(--wt-space-6); }
dialog::backdrop { background: #0b253a80; backdrop-filter: blur(2px); }
.dialoghead { padding-bottom: var(--wt-space-4); border-bottom: 1px solid var(--wt-border); }
.dialog-actions, .dialog-actions { padding-top: var(--wt-space-4); border-top: 1px solid var(--wt-border); display: flex; justify-content: flex-end; gap: var(--wt-space-2); }
fieldset { border: 1px solid var(--wt-border); border-radius: var(--wt-radius); margin: var(--wt-space-4) 0; padding: var(--wt-space-4); }
legend { padding: 0 var(--wt-space-2); color: var(--wt-secondary); font-size: var(--wt-text-sm); }
.wt-required { margin-left: var(--wt-space-1); color: var(--wt-danger-text); }
.wt-field-error { display: block; margin-top: var(--wt-space-1); color: var(--wt-danger-text); font-size: var(--wt-text-xs); }
[aria-invalid=true] { border-color: var(--wt-danger); }
[role=alert], #module-error, #login-error, #password-error { color: var(--wt-danger-text); }
form[aria-busy=true] { cursor: progress; }
form[aria-busy=true] button[type=submit] { opacity: .65; }
#toast { z-index: var(--wt-layer-toast); background: var(--wt-petroleum); color: white; border: 1px solid #ffffff26; box-shadow: var(--wt-shadow); border-radius: var(--wt-radius); font-size: var(--wt-text-base); }
.wt-search-button { display: flex; align-items: center; gap: var(--wt-space-2); margin-left: auto; color: var(--wt-secondary); min-width: 200px; text-align: left; }
.wt-search-button kbd { margin-left: auto; color: var(--wt-secondary); border: 1px solid var(--wt-border); padding: 0 var(--wt-space-1); border-radius: var(--wt-space-1); font: inherit; font-size: var(--wt-text-xs); }
.session-bar { gap: var(--wt-space-2); margin: 0; }
.wt-profile { position: relative; margin: 0; }
.wt-profile > summary { display: flex; align-items: center; gap: var(--wt-space-2); font-size: var(--wt-text-sm); color: var(--wt-text); padding: var(--wt-space-2); border-radius: var(--wt-radius); }
.wt-profile > summary::after { content: '⌄'; color: var(--wt-secondary); }
.wt-profile > summary::-webkit-details-marker { display: none; }
.wt-profile-menu { position: absolute; inset: calc(100% + var(--wt-space-2)) 0 auto auto; min-width: 200px; background: var(--wt-surface); border: 1px solid var(--wt-border); box-shadow: var(--wt-shadow); border-radius: var(--wt-radius); padding: var(--wt-space-2); }
.wt-profile-menu button { display: block; width: 100%; text-align: left; margin: var(--wt-space-1) 0; }
.wt-command { width: 640px; }
.wt-command > input { margin: var(--wt-space-4) 0; }
.wt-command-results { display: flex; flex-direction: column; gap: var(--wt-space-1); max-height: 50dvh; overflow-y: auto; }
.wt-command-results button { text-align: left; display: flex; align-items: center; justify-content: space-between; }
.wt-command-results small { font-size: var(--wt-text-xs); }
.wt-skip-link { position: fixed; top: -100px; left: var(--wt-space-4); z-index: var(--wt-layer-toast); padding: var(--wt-space-3); background: var(--wt-surface); color: var(--wt-action); }
.wt-skip-link:focus { top: var(--wt-space-4); }
.wt-grid { margin-top: var(--wt-space-3); }
.wt-grid-toolbar, .wt-grid-footer { display: flex; align-items: center; flex-wrap: wrap; gap: var(--wt-space-3); padding: var(--wt-space-3) 0; font-size: var(--wt-text-xs); }
.wt-grid-toolbar label { display: flex; align-items: center; gap: var(--wt-space-2); margin: 0; font-size: var(--wt-text-xs); }
.wt-grid-toolbar input, .wt-grid-toolbar select, .wt-grid-footer select { margin: 0; width: auto; min-height: 36px; font-size: var(--wt-text-sm); max-width: 240px; }
.wt-grid-toolbar input { width: 220px; }
.wt-grid-toolbar .wt-grid-density { margin-left: auto; }
.wt-grid-footer { justify-content: flex-end; }
.wt-grid-footer [role=status] { margin-right: auto; color: var(--wt-secondary); }
.wt-grid-footer button { min-height: 36px; font-size: var(--wt-text-sm); }
.tablewrap { max-width: 100%; border: 1px solid var(--wt-border); border-radius: var(--wt-radius); }
table { width: 100%; font-size: var(--wt-text-sm); font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; z-index: 1; background: var(--wt-subtle); color: var(--wt-secondary); font-size: var(--wt-text-xs); text-align: left; padding: var(--wt-space-3); font-weight: var(--wt-weight-strong); border-bottom: 1px solid var(--wt-border); white-space: nowrap; }
td { color: var(--wt-text); padding: var(--wt-space-3); border-bottom: 1px solid var(--wt-border); vertical-align: middle; }
td small { color: var(--wt-secondary); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:is(:hover,:focus-within) > td { background: var(--wt-accent-surface); color: var(--wt-text); }
tbody tr:is(:hover,:focus-within) > td small { color: var(--wt-secondary); }
.wt-grid[data-density=compact] td { padding-top: var(--wt-space-2); padding-bottom: var(--wt-space-2); }
.wt-grid .tablewrap { max-height: 65dvh; }
.wt-sort { background: transparent; color: inherit; border: 0; min-height: 32px; padding: var(--wt-space-1) 0; font-size: inherit; font-weight: inherit; text-align: left; display: flex; gap: var(--wt-space-2); align-items: center; }
.wt-sort::after { content: '↕'; color: var(--wt-secondary); font-weight: normal; }
th[aria-sort=ascending] .wt-sort::after { content: '↑'; }
th[aria-sort=descending] .wt-sort::after { content: '↓'; }
.wt-grid-empty { padding: var(--wt-space-6); text-align: center; color: var(--wt-secondary); border: 1px solid var(--wt-border); }
td .wt-row-actions { position: relative; display: inline-block; margin: 0; }
.wt-row-actions > summary { min-height: 36px; color: var(--wt-secondary); font-size: var(--wt-text-sm); padding: var(--wt-space-2); }
.wt-row-actions[open] { display: flex; flex-wrap: wrap; gap: var(--wt-space-1); }
.wt-row-actions[open] > summary { flex-basis: 100%; }
.wt-row-actions button { min-height: 36px; font-size: var(--wt-text-xs); margin: 0; }
.wt-skeleton { background: var(--wt-border); border-radius: var(--wt-space-1); min-height: 1em; }
.wt-empty-state { padding: var(--wt-space-6); border: 1px dashed var(--wt-border); border-radius: var(--wt-radius); color: var(--wt-secondary); text-align: center; }
.wt-error-state { padding: var(--wt-space-4); border: 1px solid var(--wt-danger-text); background: var(--wt-danger-surface); color: var(--wt-danger-text); border-radius: var(--wt-radius); }
/* Executive composition, based on the existing operational records. */
.nx-dashboard { --nx-bg: var(--wt-page); --nx-panel: var(--wt-surface); --nx-border: var(--wt-border); --nx-ink: var(--wt-text); --nx-muted: var(--wt-secondary); }
.nx-dashboard .nx-welcome-row { grid-template-columns: minmax(0,1fr) 280px; gap: var(--wt-space-5); }
.nx-dashboard .nx-welcome, .nx-dashboard .nx-today { border: 1px solid var(--wt-border); background: var(--wt-surface); border-radius: var(--wt-radius-lg); min-height: 180px; }
.nx-dashboard .nx-welcome-copy { padding: var(--wt-space-6); }
.nx-dashboard .nx-welcome h2 { font-size: 1.5rem; margin: var(--wt-space-2) 0; }
.nx-dashboard .nx-welcome p { color: var(--wt-secondary); font-size: var(--wt-text-base); }
.nx-dashboard .nx-welcome-note, .nx-dashboard .nx-skyline, .nx-dashboard .nx-today-icon { display: none; }
.nx-dashboard .nx-eyebrow { color: var(--wt-secondary); letter-spacing: 1px; }
.nx-dashboard .nx-hero-stats { gap: var(--wt-space-6); margin-top: var(--wt-space-5); }
.nx-dashboard .nx-hero-stats svg { color: var(--wt-action); width: 18px; height: 18px; }
.nx-dashboard .nx-hero-stats strong { font-size: var(--wt-text-lg); }
.nx-dashboard .nx-hero-stats small { color: var(--wt-secondary); }
.nx-dashboard .nx-today { padding: var(--wt-space-5); }
.nx-dashboard .nx-today strong { font-size: var(--wt-text-base); }
.nx-dashboard .nx-today p { color: var(--wt-text); }
.nx-dashboard .nx-today small { color: var(--wt-secondary); }
.nx-dashboard .nx-metrics { border: 1px solid var(--wt-border); background: var(--wt-surface); border-radius: var(--wt-radius-lg); gap: 0; margin: var(--wt-space-5) 0; }
.nx-dashboard .nx-metric { border: 0; border-right: 1px solid var(--wt-border); border-radius: 0; box-shadow: none; background: transparent; padding: var(--wt-space-5); }
.nx-dashboard .nx-metric:last-child { border-right: 0; }
.nx-dashboard .nx-metric strong { font-size: 1.375rem; color: var(--wt-text); }
.nx-dashboard .nx-metric small, .nx-dashboard .nx-metric div > span { color: var(--wt-secondary); }
.nx-dashboard .nx-metric-icon { background: var(--wt-accent-surface); color: var(--wt-action); width: 34px; height: 34px; border: 0; box-shadow: none; }
.nx-dashboard .nx-main-grid { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(280px,1fr); gap: var(--wt-space-5); align-items: start; }
.nx-dashboard .nx-column { display: contents; }
.nx-dashboard .nx-column:first-child > section:first-child { grid-column: 1; grid-row: 1; }
.nx-dashboard .nx-column:first-child > section:nth-child(2) { grid-column: 1; grid-row: 2; }
.nx-dashboard .nx-feature { grid-column: 2; grid-row: 1 / span 2; }
.nx-dashboard .nx-column:last-child { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(3,minmax(0,1fr)); gap: var(--wt-space-5); }
.nx-dashboard .nx-panel { background: var(--wt-surface); border: 1px solid var(--wt-border); border-radius: var(--wt-radius-lg); box-shadow: none; padding: var(--wt-space-5); margin: 0; }
.nx-dashboard .nx-feature { min-height: 0; background: var(--wt-surface); }
.nx-dashboard .nx-feature::before { display: none; }
.nx-dashboard .nx-feature-content { padding: var(--wt-space-4) 0 0; background: transparent; }
.nx-dashboard .nx-feature-content h2 { font-size: 1.375rem; }
.nx-dashboard .nx-feature-progress strong { color: var(--wt-action); font-size: 2.25rem; }
.nx-dashboard .nx-feature-link, .nx-dashboard .nx-section-head button { color: var(--wt-action); background: transparent; border: 0; }
.nx-dashboard .nx-section-head h2 { font-size: var(--wt-text-lg); }
.nx-dashboard .nx-note, .nx-dashboard .nx-feature p, .nx-dashboard .nx-feature-facts strong, .nx-dashboard .nx-feature-facts span { color: var(--wt-secondary); }
.nx-dashboard .nx-work, .nx-dashboard .nx-task, .nx-dashboard .nx-alert { color: var(--wt-text); background: transparent; border-color: var(--wt-border); padding: var(--wt-space-3) 0; border-radius: 0; }
.nx-dashboard .nx-work:hover, .nx-dashboard .nx-task:hover, .nx-dashboard .nx-alert:hover { background: var(--wt-subtle); }
.nx-dashboard .nx-work-icon { color: var(--wt-action); background: var(--wt-accent-surface); border-radius: var(--wt-radius); }
.nx-dashboard .nx-module-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.nx-dashboard .nx-module-grid button, .nx-dashboard .nx-actions button { color: var(--wt-text); background: var(--wt-subtle); border: 1px solid var(--wt-border); border-radius: var(--wt-radius); box-shadow: none; }
.nx-dashboard .nx-module-grid button svg, .nx-dashboard .nx-actions button svg { color: var(--wt-action); }
.nx-dashboard .nx-reimbursements strong { color: var(--wt-text); }
.nx-dashboard .nx-calm { color: var(--wt-secondary); background: transparent; padding: var(--wt-space-5); }
.nx-dashboard .nx-calm svg { color: var(--wt-success-text); }
.nx-dashboard .nx-alert svg { color: var(--wt-warning-text); }
.nx-dashboard .nx-chart { height: 280px; }
.finance-tabs button[aria-pressed=true], .chart-mode-buttons button[aria-pressed=true], .chart-widget[data-theme=light] .chart-mode-buttons button[aria-pressed=true], .chart-widget[data-theme=dark] .chart-mode-buttons button[aria-pressed=true] { background: var(--wt-accent-surface); color: var(--wt-action); border-color: var(--wt-action); }
.chart-widget, .chart-widget[data-theme=dark], .chart-widget[data-theme=light], :root[data-color-mode=dark] .chart-widget { background: var(--wt-surface); border-color: var(--wt-border); color: var(--wt-text); }
.chart-widget .chart-view-caption, .chart-widget .chart-visible-values, .finance-chart-card h3 { color: var(--wt-secondary); }
.chart-widget .chart-visible-values strong { color: var(--wt-text); }
.chart-widget button, .chart-widget select { color: var(--wt-text); background: var(--wt-subtle); border-color: var(--wt-border); }
.finance-chart-grid { gap: var(--wt-space-3); }
.finance-chart-card { background: var(--wt-surface); border-color: var(--wt-border); border-radius: var(--wt-radius); }
/* Institutional login, existing form and authentication flow retained. */
#login-screen { background: var(--wt-page); padding: var(--wt-space-8); }
#login-screen .login-card { position: relative; width: min(1020px,100%); max-width: 1020px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 64px; padding: 48px; border: 1px solid var(--wt-border); border-radius: var(--wt-radius-lg); background: var(--wt-surface); box-shadow: var(--wt-shadow); overflow: hidden; }
#login-screen .login-card > :not(.wt-login-story) { grid-column: 2; }
#login-screen .login-card::before { content: ''; position: absolute; inset: 0 50% 0 0; background: var(--wt-petroleum); }
.wt-login-story { position: absolute; top: 56px; left: 40px; width: calc(50% - 80px); z-index: 1; color: white; }
.wt-login-story h2 { color: white; font-size: 2rem; letter-spacing: -1px; line-height: 1.3; margin-top: var(--wt-space-8); }
.wt-login-story p { color: #bcd0df; font-size: var(--wt-text-base); margin-top: var(--wt-space-4); }
.wt-login-story .wt-wordmark { color: #bcd0df; font-size: var(--wt-text-xs); letter-spacing: 2px; }
#login-screen .login-card > .login-logo { object-fit: contain; width: 180px; height: 100px; margin: 0 0 var(--wt-space-5); border-radius: var(--wt-radius); background: white; }
#login-screen h1 { font-size: 1.375rem; color: var(--wt-text); }
#login-screen p { color: var(--wt-secondary); }
#login-screen .login-note { font-size: var(--wt-text-xs); }
.wt-login-story footer { color: #a8bfd2; margin-top: 72px; display: block; }
.wt-environment { color: var(--wt-warning-text); background: var(--wt-warning-surface); font-size: var(--wt-text-xs); border-radius: var(--wt-space-1); padding: var(--wt-space-1) var(--wt-space-2); white-space: nowrap; }
@media (min-width:801px) {
  :root[data-sidebar-collapsed=true] body aside { width: var(--wt-sidebar-mini); padding-inline: var(--wt-space-2); transform: none; visibility: visible; }
  :root[data-sidebar-collapsed=true] .shell { margin-left: var(--wt-sidebar-mini); }
  :root[data-sidebar-collapsed=true] body header { left: var(--wt-sidebar-mini); }
  :root[data-sidebar-collapsed=true] .wt-sidebar-brand { margin-inline: 0; justify-content: center; }
  :root[data-sidebar-collapsed=true] .wt-sidebar-brand > span,
  :root[data-sidebar-collapsed=true] aside nav button > span,
  :root[data-sidebar-collapsed=true] aside .nav-group > summary,
  :root[data-sidebar-collapsed=true] aside .aside-bottom { display: none !important; }
  :root[data-sidebar-collapsed=true] aside .nav-group > button { display: flex; }
  :root[data-sidebar-collapsed=true] aside .nav-group { margin: 0; }
  :root[data-sidebar-collapsed=true] aside nav button { justify-content: center; min-height: 44px; }
}
@media (max-width:1280px) {
  body main, body[data-view=dia] main { padding: var(--wt-space-6); }
  header .breadcrumb { display: none; }
  .wt-search-button { min-width: 180px; }
  .nx-dashboard .nx-main-grid { grid-template-columns: minmax(0,1.3fr) minmax(260px,1fr); }
}
@media (max-width:1024px) {
  .nx-dashboard .nx-column:last-child { grid-template-columns: 1fr; }
  .nx-dashboard .nx-metric { padding: var(--wt-space-4); }
  header .session-bar > #refresh { display: none; }
}
@media (max-width:800px) {
  body header { left: 0; padding: 0 var(--wt-space-4); gap: var(--wt-space-2); }
  .shell, :root[data-sidebar-collapsed=true] .shell { margin-left: 0; }
  body aside { top: var(--wt-topbar); height: calc(100dvh - var(--wt-topbar)); transform: translateX(-100%); visibility: hidden; }
  body aside.mobile-open { transform: translateX(0); visibility: visible; box-shadow: var(--wt-shadow-overlay); }
  body main, body[data-view=dia] main { padding: var(--wt-space-5) var(--wt-space-4); }
  .wt-search-button { min-width: 0; width: 40px; padding: var(--wt-space-2); justify-content: center; margin-left: auto; }
  .wt-search-button span, .wt-search-button kbd, .session-bar > #theme-toggle, header .wt-environment { display: none; }
  .session-bar #session-name { max-width: 100px; font-size: var(--wt-text-xs); }
  .nx-dashboard .nx-welcome-row, .nx-dashboard .nx-main-grid { grid-template-columns: 1fr; }
  .nx-dashboard .nx-column, .nx-dashboard .nx-column:last-child { display: contents; }
  .nx-dashboard .nx-main-grid > *, .nx-dashboard .nx-column > * { grid-column: auto !important; grid-row: auto !important; }
  .nx-dashboard .nx-today { min-height: 0; }
  .nx-dashboard .nx-today small { display: none; }
  .nx-dashboard .nx-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .nx-dashboard .nx-metric { border-bottom: 1px solid var(--wt-border); }
  .pagehead, body[data-view=dia] .pagehead { gap: var(--wt-space-3); flex-wrap: wrap; }
  .formgrid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .kpi > strong { font-size: 1.125rem; overflow-wrap: anywhere; }
  .wt-grid-toolbar input { width: min(100%,220px); }
  .wt-grid-toolbar .wt-grid-density { margin-left: 0; }
  .wt-grid-toolbar label { flex-wrap: wrap; }
  #login-screen { padding: var(--wt-space-4); }
  #login-screen .login-card { padding: var(--wt-space-6); grid-template-columns: 1fr; }
  #login-screen .login-card > :not(.wt-login-story) { grid-column: 1; }
  #login-screen .login-card::before, .wt-login-story { display: none; }
  .wt-command { padding: var(--wt-space-4); }
}
@media print {
  body header, body aside, .wt-grid-toolbar, .wt-grid-footer, .wt-profile, .wt-search-button, .wt-skip-link { display: none !important; }
  .shell, :root[data-sidebar-collapsed=true] .shell { margin: 0; padding: 0; }
  body main { padding: 0; }
  .wt-grid .tablewrap { max-height: none; overflow: visible; }
  .wt-grid tr[data-wt-filtered=false] { display: table-row !important; }
  .wt-grid tr[data-wt-filtered=true] { display: none !important; }
  .wt-row-actions { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0ms !important; transition-duration: 0ms !important; }
}


:root[data-color-mode=dark] aside nav button:not(.active) { background: transparent; color: #bcd0df; }
:root[data-color-mode=dark] aside nav button.active { background: #2878e338; color: white; }
:root[data-color-mode=dark] .nx-dashboard :is(.nx-module-grid button,.nx-actions button) { background: var(--wt-subtle); color: var(--wt-text); }

/* Specificity bridges for earlier page-level themes. */
.signed-out #login-screen { background: var(--wt-page); }
#login-screen .wt-login-story p { color: #bcd0df; }
#login-screen .wt-login-story footer { color: #a8bfd2; }
:root[data-color-mode] :is(.primary,.panelhead button.primary,.login-card .primary) { background: var(--wt-action); color: var(--wt-surface); }
:root[data-color-mode=dark] :is(.primary,.panelhead button.primary,.login-card .primary) { color: var(--wt-petroleum); }
:root[data-color-mode] :is(button.primary,.panelhead button.primary,.login-card .primary):not(:disabled):is(:hover,:focus-visible) { background: var(--wt-action-hover) !important; color: var(--wt-surface) !important; }
:root[data-color-mode=dark] :is(button.primary,.panelhead button.primary,.login-card .primary):not(:disabled):is(:hover,:focus-visible) { color: var(--wt-petroleum) !important; }
body header { flex-wrap: nowrap; }
body .session-bar { width: auto; flex: 0 0 auto; }
body[data-view=dia] { --accent: var(--wt-action); --accent-soft: var(--wt-accent-surface); }
.nx-dashboard .nx-welcome { height: auto; }
:root[data-color-mode] aside .nav-group > summary:hover { color: white; background: #ffffff0d; }

.session-bar .wt-profile #session-name { display: inline !important; color: var(--wt-text); }
.wt-profile-menu #theme-toggle { display: block !important; width: 100%; margin: var(--wt-space-1) 0; text-align: left; }
.wt-search-button { white-space: nowrap; }
.wt-loading { padding: var(--wt-space-4); margin-bottom: var(--wt-space-4); color: var(--wt-secondary); font-size: var(--wt-text-sm); }
.wt-loading .wt-skeleton { height: 6px; margin-top: var(--wt-space-2); }
@media (max-width:1280px) { header .wt-environment { display: none; } }
@media (max-width:1100px) {
  .wt-search-button { min-width: var(--wt-control); width: var(--wt-control); justify-content: center; }
  .wt-search-button > span, .wt-search-button > kbd { display: none; }
}

.automation-shortcut { display: grid; grid-template-columns: 1fr auto; gap: var(--wt-space-1) var(--wt-space-4); align-items: center; margin-top: var(--wt-space-5); }
.automation-shortcut h2 { font-size: var(--wt-text-base); }
.automation-shortcut p { font-size: var(--wt-text-sm); margin: 0; }
.automation-shortcut button { grid-column: 2; grid-row: 1 / span 2; }
.chart-widget[data-theme=light] { --wt-surface:#ffffff; --wt-subtle:#f8fafc; --wt-text:#17212b; --wt-secondary:#64748b; --wt-border:#e2e8f0; --wt-action:#2167c5; --wt-accent-surface:#eaf2fe; }
.chart-widget[data-theme=dark] { --wt-surface:#172737; --wt-subtle:#1e3143; --wt-text:#edf3fa; --wt-secondary:#afbed0; --wt-border:#344b60; --wt-action:#78b4ff; --wt-accent-surface:#203e5e; }
@media(max-width:800px) {
  .automation-shortcut { grid-template-columns:1fr; }
  .automation-shortcut button { grid-column:auto; grid-row:auto; justify-self:start; margin-top:var(--wt-space-2); }
}
.nx-dashboard .nx-feature.nx-has-photo::before { content:""; display:block; position:static; height:160px; margin-bottom:var(--wt-space-4); border-radius:var(--wt-radius); background:var(--nx-photo) center/cover; }

.wt-grid td .wt-row-select { display:inline-block; width:18px; height:18px; min-height:18px; margin:0 var(--wt-space-3) 0 0; vertical-align:middle; }
.wt-grid tr[aria-selected=true] > td { background:var(--wt-accent-surface); }
.wt-grid-toolbar input[type=checkbox] { width:18px; height:18px; min-height:18px; }
@media print { .wt-row-select { display:none !important; } }
