/* timebase / time company CI. Colors are approximated from supplied website
   references; Segoe UI is a system fallback, not an asserted brand webfont.
   Domain colors (shifts, leave, sickness, financial signs) remain module-owned. */
:root {
    color-scheme: dark;
    --tb-navy: #061b3a;
    --tb-navy-soft: #07234b;
    --tb-navy-deep: #05152d;
    --tb-on-navy: #f8fbff;
    --tb-cyan: #90d7eb;
    --tb-accent: #ec2949;
    --tb-action: #cf1738;
    --tb-action-hover: #b91432;
    --tb-on-action: #ffffff;
    --tb-bg: #05152d;
    /* Defaults belong to the protected dark shell; work areas bind these below. */
    --tb-table-head: var(--tb-navy);
    --tb-table-head-soft: var(--tb-navy-soft);
    --tb-table-ink: var(--tb-on-navy);
    --tb-purple: #c7b5f6;
    --tb-on-dark-muted: #b7c8db;
    --tb-surface: #061b3a;
    --tb-surface-soft: #0c294e;
    --tb-surface-hover: #14365d;
    --tb-input-bg: #081f40;
    --tb-border: #345071;
    --tb-border-strong: #617c9d;
    /* Light edge accents for internal work pages; surfaces keep their CI colors. */
    --tb-work-border: rgb(255 255 255 / 34%);
    --tb-work-divider: rgb(255 255 255 / 24%);
    --tb-work-card-border: rgb(255 255 255 / 26%);
    --tb-work-header-sheen: linear-gradient(180deg, rgb(255 255 255 / 12%), transparent 18px);
    --tb-work-row-sheen: linear-gradient(180deg, rgb(255 255 255 / 5.5%), transparent 10px);
    --tb-work-card-sheen: linear-gradient(180deg, rgb(255 255 255 / 7%), transparent 16px);
    --tb-text: #f8fbff;
    --tb-text-dim: #b7c8db;
    --tb-link: #90d7eb;
    --tb-focus: #ec2949;
    --tb-danger: #ff9aa9;
    --tb-success: #8bd7ad;
    --tb-warning: #f5ce82;
    --tb-info: #90d7eb;
    --tb-shadow-sm: 0 2px 6px rgb(0 9 24 / 18%);
    --tb-shadow: 0 10px 30px rgb(0 9 24 / 28%);
    --tb-card-bg: linear-gradient(155deg, #0d2b51, #061b3a 68%, #0a284a);
    --tb-dialog-bg: linear-gradient(150deg, #0e2c4c, #071a35 70%, #0a2445);
    --tb-radius-sm: 4px;
    --tb-radius: 6px;
    --tb-radius-lg: 10px;
    --tb-space-1: .25rem;
    --tb-space-2: .5rem;
    --tb-space-3: .75rem;
    --tb-space-4: 1rem;
    --tb-space-6: 1.5rem;
    --tb-font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --tb-aurora: radial-gradient(ellipse 54% 34% at 4% 22%, rgb(25 85 130 / 16%), transparent 80%), radial-gradient(ellipse 50% 32% at 96% 4%, rgb(236 41 73 / 6%), transparent 80%);
}
/* Root propagation also themes overlays attached outside MainLayout. The public
   customer portal has no theme switch and deliberately starts in light mode. */
:root:has(.customer-portal-layout):not(:has(.tb-theme-dark)),
.customer-portal-layout {
    color-scheme: light;
    --tb-bg: #f3f6fa;
    --tb-surface: #ffffff;
    --tb-surface-soft: #edf2f7;
    --tb-surface-hover: #e3ebf4;
    --tb-input-bg: #ffffff;
    --tb-border: #cbd5e1;
    --tb-border-strong: #8194ad;
    --tb-text: #102b4c;
    --tb-text-dim: #52657c;
    --tb-link: #07234b;
    --tb-focus: #cf1738;
    --tb-danger: #b61939;
    --tb-success: #17653d;
    --tb-warning: #865700;
    --tb-info: #175c80;
    --tb-shadow-sm: 0 2px 6px rgb(6 27 58 / 6%);
    --tb-shadow: 0 10px 30px rgb(6 27 58 / 12%);
    --tb-card-bg: #ffffff;
    --tb-dialog-bg: #ffffff;
    --tb-aurora: radial-gradient(ellipse at 95% 0%, rgb(236 41 73 / 3%), transparent 48%), radial-gradient(ellipse at 0% 0%, rgb(7 35 75 / 3%), transparent 50%);
}
/* Personal light appearance: light work surfaces inside the dark application shell.
   Screen-only so existing print palettes remain authoritative. Newsletter,
   public customer layouts and personal driver pages keep their original palette.
   These are semantic definitions, not a layer of component overrides. */
@media screen {
    .tb-root-layout[data-tb-appearance="light"]:not(.tb-personal-driver-layout) .tb-main-shell:not(:has(.tb-newsletter-page, .driver-portal:not(.driver-times-review):not(.transport-route-page))),
    body:has(.tb-root-layout[data-tb-appearance="light"]:not(.tb-personal-driver-layout)) :is(.tb-update-dialog, .tb-toast, .tb-global-busy, .kpi-reminder-card, .cp-urgent-card) {
        color-scheme: light;
        --tb-surface: #f1f3f6;
        --tb-surface-soft: #edf3fc;
        --tb-surface-hover: #e3ecf8;
        --tb-input-bg: #ffffff;
        --tb-border: #cbd9ea;
        --tb-border-strong: #9bb6d8;
        --tb-work-border: #bfd0e5;
        --tb-work-divider: #dfe8f4;
        --tb-work-card-border: #cbd9ea;
        --tb-work-header-sheen: linear-gradient(180deg, #f7faff, #edf3fc);
        --tb-work-row-sheen: linear-gradient(180deg, rgb(255 255 255 / 30%), transparent 10px);
        --tb-work-card-sheen: linear-gradient(180deg, rgb(255 255 255 / 35%), transparent 16px);
        --tb-text: #081d3e;
        --tb-text-dim: #526985;
        --tb-link: #183e71;
        --tb-danger: #a21a38;
        --tb-success: #17653d;
        --tb-warning: #805200;
        --tb-info: #175c80;
        --tb-purple: #644198;
        --tb-table-head: #edf3fc;
        --tb-table-head-soft: #e5edf8;
        --tb-table-ink: #081d3e;
        --tb-shadow-sm: 0 8px 25px rgb(6 29 60 / 5.5%);
        --tb-shadow: 0 10px 30px rgb(6 27 58 / 12%);
        --tb-card-bg: #f1f3f6;
        --tb-dialog-bg: linear-gradient(145deg, #f7faff, #edf3fc);
        --tb-radius-sm: 8px;
        --tb-radius: 12px;
        --tb-radius-lg: 15px;
        /* Component values changed by the newsletter redesign; their local fallbacks
           preserve the previous dark appearance without duplicating stylesheets. */
        --tb-light-table-ink: var(--tb-table-ink);
        --tb-light-table-head: var(--tb-table-head);
        --tb-light-purple: var(--tb-purple);
        --tb-light-on-action: var(--tb-on-action);
        --tb-light-danger: var(--tb-danger);
        --tb-light-success: var(--tb-success);
        --tb-light-info: var(--tb-info);
        --tb-light-warning: var(--tb-warning);
        --tb-light-text-dim: var(--tb-text-dim);
        --tb-light-kpi-success-bg: color-mix(in srgb, var(--tb-success) 8%, var(--tb-surface));
        --tb-light-kpi-danger-bg: color-mix(in srgb, var(--tb-danger) 8%, var(--tb-surface));
        --tb-light-table-head-soft: var(--tb-table-head-soft);
        --tb-light-table-sheen: var(--tb-work-header-sheen) var(--tb-table-head);
        --tb-light-corporate-bg: var(--tb-aurora), var(--tb-bg);
        --tb-light-on-navy: var(--tb-on-navy);
        --tb-light-on-dark-muted: var(--tb-on-dark-muted);
        --tb-light-danger-zone-bg: color-mix(in srgb, var(--tb-danger) 6%, var(--tb-surface));
        --tb-light-surface: var(--tb-surface);
        --tb-light-text: var(--tb-text);
        --tb-light-color-scheme: light;
        --tb-light-panel-border: 1px solid var(--tb-border);
        --tb-light-panel-top-border: 2px solid var(--tb-border-strong);
        --tb-light-input-bg: var(--tb-input-bg);
        --tb-light-border: var(--tb-border);
        --tb-light-surface-soft: var(--tb-surface-soft);
        --tb-light-history-work: #125137;
        --tb-light-history-holiday: #7b2429;
        --tb-light-history-vacation: #69277e;
        --tb-light-history-sick: #7f2020;
        --tb-light-history-flex: #163e75;
        --tb-light-history-free: #354153;
        --tb-light-history-absent: #48540b;
        --tb-light-history-unpaid: #7e1d4c;
        --tb-light-strong-border: 1px solid var(--tb-border-strong);
        --tb-light-action: var(--tb-action);
        --tb-light-scrollbar: #617c9d var(--tb-input-bg);
        --tb-light-surface-hover: var(--tb-surface-hover);
        --tb-driver-filter-padding: 14px 16px;
        --tb-driver-work-padding: 20px;
        --tb-driver-panel-border: 1px solid var(--tb-border);
        --tb-driver-panel-radius: var(--tb-radius-lg);
        --tb-driver-panel-bg: var(--tb-surface);

    }
    /* Existing page heroes retain their dark identity and their internal contrast.
       This does not select the topbar, navigation, logo or newsletter header. */
    .tb-main-shell :is(.pd-hero, .weekly-hero, .recruiting-hero, .sales-assist-hero,
        .admin-users-hero, .mon-hero, .fahrplan-hero, .dq-hero,
        .watchlist-hero, .cpm-hero, .settings-hero, .driver-times-review .driver-portal-hero, .transport-route-page .driver-portal-hero) {
        color-scheme: dark;
        --tb-surface: #061b3a;
        --tb-surface-soft: #0c294e;
        --tb-surface-hover: #14365d;
        --tb-input-bg: #081f40;
        --tb-border: #345071;
        --tb-border-strong: #617c9d;
        --tb-card-bg: linear-gradient(155deg, #0d2b51, #061b3a 68%, #0a284a);
        --tb-text: #f8fbff;
        --tb-text-dim: #b7c8db;
        --tb-link: #90d7eb;
        --tb-success: #8bd7ad;
        --tb-danger: #ff9aa9;
        --tb-warning: #f5ce82;
        --tb-info: #90d7eb;
        --tb-radius: 6px;
        --tb-radius-lg: 10px;
        --tb-shadow-sm: 0 2px 6px rgb(0 9 24 / 18%);
    }
}

/* Compatibility names resolve at each work/hero boundary when the appearance changes. */
:root, .tb-theme-dark, .customer-portal-layout,
.tb-root-layout[data-tb-appearance="light"]:not(.tb-personal-driver-layout) .tb-main-shell:not(:has(.tb-newsletter-page, .driver-portal:not(.driver-times-review):not(.transport-route-page))),
body:has(.tb-root-layout[data-tb-appearance="light"]:not(.tb-personal-driver-layout)) :is(.tb-update-dialog, .tb-toast, .tb-global-busy, .kpi-reminder-card, .cp-urgent-card),
.tb-main-shell :is(.pd-hero, .weekly-hero, .recruiting-hero, .sales-assist-hero, .admin-users-hero, .mon-hero, .fahrplan-hero, .dq-hero, .watchlist-hero, .cpm-hero, .settings-hero, .driver-times-review .driver-portal-hero, .transport-route-page .driver-portal-hero) {
    --tb-muted: var(--tb-text-dim);
    --tb-theme-page: var(--tb-bg);
    --tb-theme-surface: var(--tb-surface);
    --tb-theme-surface-soft: var(--tb-surface-soft);
    --tb-theme-border: var(--tb-border);
    --tb-theme-text: var(--tb-text);
    --tb-theme-muted: var(--tb-text-dim);
    --tb-theme-accent: var(--tb-accent);
    --tb-theme-table-head-a: var(--tb-table-head);
    --tb-theme-table-head-b: var(--tb-table-head-soft);
    --tb-ov-backdrop: rgb(5 21 45 / 68%);
    --tb-ov-surface-1: var(--tb-surface);
    --tb-ov-surface-2: var(--tb-surface-soft);
    --tb-ov-border: var(--tb-border-strong);
    --tb-ov-shadow: var(--tb-shadow);
    --tb-ov-radius: var(--tb-radius-lg);
    --tb-ci-navy: var(--tb-navy);
    --tb-ci-red: var(--tb-accent);
    --tb-ci-cyan: var(--tb-cyan);
    --tb-ci-surface: var(--tb-surface);
    --tb-ci-text: var(--tb-text);
    --tb-ci-border: var(--tb-border);
    --tb-signature-line: var(--tb-accent);
    --tb-signature-shadow: transparent;
    --tb-surface-tint-1: var(--tb-surface-soft);
    --tb-surface-tint-2: var(--tb-surface);
    --tb-dark: var(--tb-navy);
    --tb-dark-soft: var(--tb-surface-soft);
    --tb-dark-border: var(--tb-border);
    --tb-grey: var(--tb-text-dim);
    --tb-red: var(--tb-danger);
    --tb-red-bg: color-mix(in srgb, var(--tb-danger) 10%, var(--tb-surface));
    --tb-red-border: color-mix(in srgb, var(--tb-danger) 40%, var(--tb-border));
    --tb2-header-ink: var(--tb-navy);
    --tb2-header-ink-2: var(--tb-navy-soft);
    --tb2-header-line: rgb(248 251 255 / 22%);
    --tb2-header-soft: rgb(248 251 255 / 8%);
    --tb2-header-soft-2: rgb(248 251 255 / 14%);
    --tb2-brand: var(--tb-action);
    --tb2-brand-2: var(--tb-accent);
}
