/* Operational UI layer. Brand/marketing tokens remain generated and unchanged.
   Loaded after page styles so the shared dashboard has one surface hierarchy. */
[data-theme="uo-light"], [data-theme="light"][data-ultimateos-shell] {
    color-scheme: light;
    /* Light contrast floor (2026-09-24): every text token reads at 7:1 or more
       on white and on its own tint (WCAG AAA); form-control borders at 3:1+.
       Quiet Ledger (2026-09-25): neutral ink, hairline borders, no card shadow;
       shadows stay only on floating layers (menus, modals, popovers). */
    /* Color only marks state (Joel 2026-10-07, "color sólo en un puntito"):
       status backgrounds are one neutral, green/red stay as text at 7:1, and
       amber never colours text, because amber at 7:1 is brown.
       ponytail: --warning/--caution keep their names but paint ink on purpose;
       the amber lives in --warning-mark (dots, bars, icons, borders). */
    --color-success: #0A5D3B;
    --success: #0A5D3B;
    --success-bg: #f7f7f8;
    --danger: #A40E26;
    --danger-bg: #f7f7f8;
    --warning: #1a1d29;
    --warning-bg: #f7f7f8;
    --warning-mark: #B7791F;
    --caution: #1a1d29;
    --caution-bg: #f7f7f8;
    --su: 42.4% 0.0931 159.1;
    --wa: 62.6% 0.1248 70.4;
    --er: 45.9% 0.1777 21.9;
    --in: 43.3589% 0.172266 260.5475;
    --info: #0948AD;
    --color-info: #0948AD;
    --accent-blue: #0948AD;
    --chart-grid: rgba(20, 24, 40, .12);
    --overlay-bg: rgba(15, 17, 21, .32);
    --color-danger: #A40E26;
    --color-warning: #1a1d29;
    --color-primary: #0948AD;
    --p: 43.3589% 0.172266 260.5475;
    --pf: 38% .15 260.55;
    --sf: var(--pf);
    --nf: 100% 0 0;
    --n: 97.59% .0029 264.54;
    --nc: 23.59% .023 273.8;
    --bc: var(--nc);
    --chart-1: #0948AD;
    --chart-2: #1A1D29;
    --chart-3: #3B6FD4;
    --chart-4: #6B6F76;
    --chart-5: #949AA6;
    --shadow-elevated: 0 12px 36px rgba(20, 24, 40, .10);
    --a: 43.3589% 0.172266 260.5475;
    --s: 43.3589% 0.172266 260.5475;
    --pc: 100% 0 0;
    --ac: 100% 0 0;
    --sc: 100% 0 0;
    --color-text: #1a1d29;
    --color-surface: #ffffff;
    --bg-input: #ffffff;
    --bg-input-focus: #ffffff;
    --accent-primary-bg: #eef2f9;  /* opaque: white + 7% blue, keeps 7:1 on the grey page */
    --accent-primary-border: rgba(9, 72, 173, .28);
    --text-on-accent: #ffffff;
    --color-page: #f4f4f4;  /* 2026-09-30 contrast: grey page, white cards */
    --color-surface-2: #ededed;
    --bg-page: var(--color-page);
    --bg-sidebar: #ffffff;
    --bg-card-hover: var(--color-surface-2);
    --color-text-muted: #3a4050;
    --text-muted: var(--color-text-muted);
    --text-secondary: #2e3340;
    --border-default: rgba(20, 24, 40, .16);
    --border-strong: rgba(20, 24, 40, .26);
    --border-input: #7b8494;
    --shadow-card: none;
    --shadow-card-hover: var(--shadow-card);
    --b1: 100% 0 0;
    --b2: 100% 0 0;
    --b3: 97.59% .0029 264.54;
}
[data-theme="uo-dark"], [data-theme="dark"][data-ultimateos-shell] {
    color-scheme: dark;
    --color-success: #3FB950;
    --color-danger: #F85149;
    --color-warning: #eceef2;
    --success: #3FB950;
    --danger: #F85149;
    --warning: #eceef2;
    --warning-mark: #D6A534;
    --caution: #eceef2;
    --success-bg: #161616;
    --danger-bg: #161616;
    --warning-bg: #161616;
    --caution-bg: #161616;
    --su: 69.5% 0.1809 145.6;
    --wa: 74.8% 0.1365 83.9;
    --er: 66.5% 0.2046 27.0;
    --in: 71.3740% 0.143381 254.6240;
    --color-primary: #60a5fa;
    --p: 71.3740% 0.143381 254.6240;
    --pf: 66% .14 254.62;
    --sf: var(--pf);
    --nf: 17.7638% 0 0;
    --n: 22.6450% 0 0;
    --nc: 94.87% .006 264.53;
    --bc: var(--nc);
    --chart-1: #60A5FA;
    --chart-2: #ECEEF2;
    --chart-3: #A9C8FB;
    --chart-4: #6B6F76;
    --chart-5: #949AA6;
    --shadow-elevated: 0 12px 36px rgba(0, 0, 0, .35);
    --pc: 0% 0 0;
    --a: var(--p);
    --s: var(--p);
    --ac: 0% 0 0;
    --sc: 0% 0 0;
    --color-text: #eceef2;
    --bg-input: #111111;
    --bg-input-focus: #1c1c1c;
    --accent-primary-bg: rgba(96, 165, 250, .12);
    --accent-primary-border: rgba(96, 165, 250, .28);
    --text-on-accent: #000000;
    --color-page: #000000;
    --color-surface: #111111;
    --color-surface-2: #1c1c1c;
    --bg-page: var(--color-page);
    --bg-sidebar: #000000;
    --bg-card: var(--color-surface);
    --bg-card-hover: var(--color-surface-2);
    --color-text-muted: #afb6c2;
    --text-muted: var(--color-text-muted);
    --text-secondary: #b9bfca;
    --border-default: rgba(255, 255, 255, .14);
    --border-strong: rgba(255, 255, 255, .22);
    --shadow-card: none;
    --shadow-card-hover: var(--shadow-card);
    --b1: 0% 0 0;
    --b2: 17.7638% 0 0;
    --b3: 22.6450% 0 0;
}
[data-theme="uo-dark"], [data-theme="dark"][data-ultimateos-shell], [data-theme="uo-light"], [data-theme="light"][data-ultimateos-shell] {
    --font-body: 'Manrope', Inter, -apple-system, BlinkMacSystemFont, sans-serif;
    --accent-primary: var(--color-primary);
    --accent-secondary: var(--color-primary);
    --accent-secondary-bg: var(--accent-primary-bg);
    --accent: var(--color-primary);
    --deep-purple: var(--color-primary);
    --accent-teal: var(--color-primary);
    --accent-teal-bg: var(--accent-primary-bg);
    --border-accent: var(--accent-primary-border);
    --text-primary: var(--color-text);
    --bg-card: var(--color-surface);
    --chart-text: var(--text-secondary);
    --font-display: var(--font-body);
    --font-size-sm: .875rem;
    /* Quiet Ledger (2026-09-25): 6px for controls and cards, 8px for panels,
       12px only for floating layers (tailwind rounded-2xl). Badges are not pills. */
    --rounded-box: .5rem;
    --rounded-btn: .375rem;
    --rounded-badge: .3125rem;
    --tab-radius: .375rem;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --noise-opacity: 0;
    --glow-primary: transparent;
    --glow-success: transparent;
}

/* Working tables share readable defaults; queue density remains locally owned. */
:root {
    --table-font-size: .875rem;
    --table-heading-size: .75rem;
    --table-cell-block: .625rem;
    --table-cell-inline: .75rem;
    --control-min-height: 2.25rem;
}

/* ── Dark-mode restorations (feat/dark-mode-toggle) ──────────────────────
   357f5fb7 made the app white-only by overwriting these values in place.
   White stays the default everywhere; the values below bring back the
   pre-357f5fb7 dark look, scoped under [data-theme="uo-dark"] so the toggle
   controls them instead of a forced theme. See uo-theme.js for the engine. */

/* Dashboard date/time inputs — components/_base_styles.html (~283). */
[data-theme="uo-dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="uo-dark"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="uo-dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.45;
}

/* Dashboard login — templates/login.html .login-mesh-fallback. */
[data-theme="uo-dark"] .login-mesh-fallback {
    background: var(--bg-page);
}

/* Deals dashboard — templates/deals/dashboard.html .view-pill.active. */
[data-theme="uo-dark"] .view-pill.active {
    background: var(--accent-primary);
    color: var(--text-on-accent);
    box-shadow: none;
}

/* Portal home — static/css/portal-home.css .po-chip--primary already carries
   its own dark rule there; nothing to add here. */

/* Contracts Portal — login.html .btn-login and components/_contracts_styles.html
   .btn-gold are the shared primary button in both themes (coherence 6b): a flat
   accent, no gradient. The dark gradient that lived here ended on #06347F, under
   the dark theme's dark on-accent text. */

/* Contracts Portal — components/_inbox_workspace_styles.html reads
   --bg-elevated and --border, which no stylesheet defines; only their
   var(_, fallback) literals ever rendered. Light = today's fallback,
   dark = the pre-357f5fb7 fallback. */
[data-theme="uo-light"] {
    --bg-elevated: #ffffff;
    --border: #d0d5dd;
}
[data-theme="uo-dark"] {
    --bg-elevated: #1c1c1c;
    --border: rgba(255, 255, 255, .12);
}

/* Form controls must be findable on a white page (WCAG 1.4.11: 3:1 boundary). */
[data-theme="uo-light"] :is(.form-input, .input, .select, .textarea, select, textarea, input:is(:not([type]), [type=text], [type=email], [type=search], [type=number], [type=password], [type=tel], [type=url], [type=date], [type=time], [type=datetime-local], [type=month])),
[data-theme="light"][data-ultimateos-shell] :is(.form-input, .input, .select, .textarea, select, textarea) {
    border-color: var(--border-input);
}
[data-theme="uo-light"] .menu-title, [data-theme="light"][data-ultimateos-shell] .menu-title { color: var(--text-muted); }
