:root {
    /* Neutrale Premium-Palette; Firmenfarben bleiben im Tenant-Theme. */
    --premium-canvas: #f7f8fa;
    --premium-canvas-deep: #eef0f3;
    --premium-surface: #ffffff;
    --premium-surface-subtle: #f8f9fa;
    --premium-surface-quiet: #f5f6f7;
    --premium-ink-strong: #15171b;
    --premium-ink: #292d34;
    --premium-ink-muted: #626873;
    --premium-ink-subtle: #68707c;
    --premium-border: rgba(21, 23, 27, 0.1);
    --premium-border-strong: rgba(21, 23, 27, 0.16);
    --premium-border-on-dark: rgba(255, 255, 255, 0.1);
    --premium-sidebar: #191b20;
    --premium-sidebar-deep: #14161a;
    --premium-sidebar-text: rgba(255, 255, 255, 0.72);
    --premium-sidebar-text-strong: #ffffff;
    --premium-sidebar-label: rgba(255, 255, 255, 0.54);
    --premium-sidebar-hover: rgba(255, 255, 255, 0.06);
    --premium-overlay: rgba(15, 17, 21, 0.52);

    /*
     * Semantischer Firmenakzent.
     * Die Company-Theme-Datei wird nach dem Premium-Layer geladen. Durch die
     * var()-Indirektion folgen diese Rollen daher jedem Firmenprofil, ohne
     * Erfolgs-, Warn- oder Fehlerfarben mit der CI-Farbe zu vermischen.
     */
    --brand-accent-action: var(--theme-primary-action);
    --brand-accent-action-hover: var(--theme-primary-action-hover);
    --brand-accent-on-action: var(--theme-on-primary-action);
    --brand-accent-on-action-hover: var(--theme-on-primary-action-hover);
    --brand-accent-text: var(--theme-primary-readable);
    --brand-accent-text-hover: var(--theme-primary-readable-hover);
    --brand-accent-strong: var(--theme-primary-strong);
    --brand-accent-rgb: var(--theme-primary-rgb);
    --brand-accent-soft: rgba(var(--brand-accent-rgb), 0.08);
    --brand-accent-soft-strong: rgba(var(--brand-accent-rgb), 0.1);
    --brand-accent-border: var(--theme-primary-soft-border);
    --brand-accent-focus: rgba(var(--brand-accent-rgb), 0.22);
    --brand-accent-navigation-indicator: var(--theme-primary);
    --brand-accent-navigation-on-dark: color-mix(
        in srgb,
        var(--theme-primary-action) 55%,
        var(--premium-sidebar-text-strong)
    );
    --brand-accent-navigation-surface: var(--brand-accent-soft-strong);
    --premium-sidebar-active: var(--brand-accent-navigation-surface);
    --premium-accent-soft: var(--brand-accent-soft);
    --premium-accent-soft-strong: var(--brand-accent-soft-strong);
    --premium-focus-color: var(--brand-accent-focus);

    /* Rhythmus und Geometrie. */
    --premium-space-2xs: calc(0.25rem * var(--app-surface-density-ratio));
    --premium-space-xs: calc(0.5rem * var(--app-surface-density-ratio));
    --premium-space-sm: calc(0.75rem * var(--app-surface-density-ratio));
    --premium-space-md: calc(1rem * var(--app-surface-density-ratio));
    --premium-space-lg: calc(1.5rem * var(--app-surface-density-ratio));
    --premium-space-xl: calc(2rem * var(--app-surface-density-ratio));
    --premium-space-2xl: calc(3rem * var(--app-surface-density-ratio));
    --premium-space-page: clamp(1rem, 2vw, 2rem);
    --premium-radius-xs: calc(0.375rem * var(--app-surface-radius-ratio));
    --premium-radius-sm: calc(0.5rem * var(--app-surface-radius-ratio));
    --premium-radius-md: calc(0.75rem * var(--app-surface-radius-ratio));
    --premium-radius-lg: calc(1rem * var(--app-surface-radius-ratio));
    --premium-radius-pill: 999rem;
    --premium-border-width: 0.0625rem;
    --premium-navigation-sidebar-width-de: 18rem;
    --premium-navigation-sidebar-width-en: 20rem;
    --premium-navigation-sidebar-width-fr: 21.5rem;
    --premium-navigation-sidebar-width: var(--premium-navigation-sidebar-width-de);
    --premium-sidebar-width: var(--premium-navigation-sidebar-width);
    --premium-sidebar-collapsed-width: 5.25rem;
    --premium-control-height: calc(2.75rem * var(--app-surface-density-ratio));
    --premium-control-height-sm: calc(2.25rem * var(--app-surface-density-ratio));
    --premium-icon-control-size: calc(2.5rem * var(--app-surface-density-ratio));
    --premium-table-cell-y: calc(0.75rem * var(--app-surface-density-ratio));
    --premium-table-cell-x: calc(1rem * var(--app-surface-density-ratio));
    --premium-full-size: 100%;
    --premium-zero: 0;
    --premium-transparent: transparent;
    --premium-content-max-width: var(--premium-full-size);
    --premium-content-readable-max-width: 72rem;
    --premium-content-form-max-width: 54rem;
    --premium-content-measure: 72ch;
    --premium-content-width: calc(var(--premium-full-size) - var(--premium-sidebar-width));
    --premium-content-width-collapsed: calc(var(--premium-full-size) - var(--layout-sidebar-collapsed-margin));
    --premium-dashboard-context-grid: repeat(2, minmax(var(--premium-zero), 1fr));
    --premium-dashboard-focus-layout: minmax(var(--premium-zero), 1fr);
    --premium-project-menu-max-width: 28rem;
    --premium-page-header-min-height: var(--premium-control-height);
    --premium-header-control-height: max(var(--premium-touch-target-min), calc(2.5rem * var(--app-surface-density-ratio)));
    --premium-mobile-header-height: var(--layout-mobile-header-height, 3.5rem);
    --premium-mobile-navigation-breakpoint: 74.99875rem;
    --premium-mobile-scroll-context-threshold: 0.75rem;
    --premium-mobile-logo-max-width: 6rem;
    --premium-mobile-logo-max-height: 2.125rem;
    --premium-shell-menu-open-overflow: hidden;
    --premium-shell-menu-open-overscroll: none;
    --premium-touch-target-min: 2.75rem;
    --premium-disabled-opacity: 0.52;
    --premium-focus-ring-inner-width: var(--premium-border-width);
    --premium-focus-ring-outer-width: calc(var(--premium-border-width) * 3);
    --premium-focus-contrast: var(--brand-accent-text);
    --premium-dialog-backdrop-opacity: 0.56;
    --premium-skip-link-inset: var(--premium-space-md);
    --premium-skip-link-hidden-offset: calc(-100% - var(--premium-space-lg));
    --premium-skip-link-z-index: 1400;
    --premium-document-scroll-padding: calc(var(--premium-mobile-header-height) + var(--premium-space-md));

    /* Gemeinsame Workspace-Primitiven fuer operative Unterseiten. */
    --premium-workspace-gap: var(--premium-space-lg);
    --premium-workspace-section-gap: var(--premium-space-xl);
    --premium-workspace-compact-gap: var(--premium-space-sm);
    --premium-workspace-panel-padding: var(--premium-space-lg);
    --premium-workspace-panel-padding-mobile: var(--premium-space-md);
    --premium-workspace-grid: minmax(var(--premium-zero), 1fr);
    --premium-workspace-divider: var(--premium-border-width) solid var(--premium-border);
    --premium-workspace-accent-width: calc(var(--premium-border-width) * 3);
    --premium-workspace-sticky-offset: var(--premium-space-md);
    --premium-workspace-sticky-z-index: 20;
    --premium-workspace-header-action-max-width: 36rem;
    /* Makroabstand bleibt grosszuegig; Daten und Werkzeugleisten bilden engere Gruppen. */
    --premium-command-padding-y: var(--premium-space-sm);
    --premium-command-padding-x: var(--premium-space-md);
    --premium-data-header-padding-y: var(--premium-space-sm);
    --premium-data-header-padding-x: var(--premium-space-md);
    --premium-command-grid: repeat(12, minmax(var(--premium-zero), 1fr));
    --premium-invoice-filter-grid:
        minmax(var(--premium-zero), 2fr)
        repeat(4, minmax(var(--premium-zero), 1fr))
        max-content;
    --premium-command-column-wide: span 4;
    --premium-command-column-medium: span 3;
    --premium-command-column-compact: span 2;
    --premium-command-column-action: span 2;
    --premium-command-column-auto: auto;
    --premium-command-tablet-search: span 6;
    --premium-command-tablet-field: span 3;
    --premium-command-mobile-full: 1 / -1;
    --premium-command-min-field-width: 12rem;
    --premium-command-search-min-width: 18rem;
    --premium-command-summary-min-height: var(--premium-control-height-sm);
    --premium-command-label-gap: var(--premium-space-xs);
    --premium-data-row-min-height: max(var(--premium-touch-target-min), calc(3rem * var(--app-surface-density-ratio)));
    --premium-data-empty-min-height: 12rem;
    --premium-data-action-gap: var(--premium-space-xs);
    --premium-data-sticky-top: var(--premium-zero);
    --premium-form-section-gap: var(--premium-space-lg);
    --premium-form-field-gap: var(--premium-space-xs);
    --premium-form-readable-width: 48rem;
    --premium-form-help-width: 64ch;
    --premium-dialog-max-width: 56rem;
    --premium-dialog-body-max-height: 72vh;
    --premium-dialog-footer-action-gap: var(--premium-space-md);
    --premium-dialog-footer-button-width: 15rem;
    --premium-dialog-footer-button-width-mobile: var(--premium-full-size);
    --premium-dialog-footer-z-index: 5;
    --premium-settings-sidebar-width: 14.5rem;
    --premium-settings-save-copy-min-width: 16rem;
    --premium-settings-actions-min-width: 20rem;
    --premium-settings-layout-columns: minmax(var(--premium-settings-sidebar-width), var(--premium-settings-sidebar-width))
        minmax(var(--premium-zero), 1fr);
    --premium-mobile-grid-columns: minmax(var(--premium-zero), 1fr);
    --premium-mobile-action-width: var(--premium-full-size);
    --premium-mobile-dialog-radius: var(--premium-zero);
    --premium-mobile-dialog-height: var(--viewport-height, 100dvh);
    --premium-mobile-dialog-margin: var(--premium-zero);
    --premium-mobile-dialog-max-width: var(--premium-full-size);
    --premium-mobile-section-nav-width: var(--premium-full-size);
    --premium-mobile-primary-order: -1;
    --premium-map-control-opacity: 0.98;

    /* Ruhige Tiefe statt Glow- und Lift-Effekten. */
    --premium-shadow-xs: 0 calc(0.0625rem * var(--app-surface-shadow-ratio)) calc(0.125rem * var(--app-surface-shadow-ratio)) rgba(15, 17, 21, calc(0.025 * var(--app-surface-shadow-ratio)));
    --premium-shadow-sm: 0 calc(0.0625rem * var(--app-surface-shadow-ratio)) calc(0.1875rem * var(--app-surface-shadow-ratio)) rgba(15, 17, 21, calc(0.035 * var(--app-surface-shadow-ratio))), 0 calc(0.5rem * var(--app-surface-shadow-ratio)) calc(1.5rem * var(--app-surface-shadow-ratio)) rgba(15, 17, 21, calc(0.025 * var(--app-surface-shadow-ratio)));
    --premium-shadow-md: 0 calc(0.125rem * var(--app-surface-shadow-ratio)) calc(0.375rem * var(--app-surface-shadow-ratio)) rgba(15, 17, 21, calc(0.045 * var(--app-surface-shadow-ratio))), 0 calc(1rem * var(--app-surface-shadow-ratio)) calc(2.5rem * var(--app-surface-shadow-ratio)) rgba(15, 17, 21, calc(0.045 * var(--app-surface-shadow-ratio)));
    --premium-shadow-focus:
        0 0 0 var(--premium-focus-ring-inner-width) var(--premium-surface),
        0 0 0 var(--premium-focus-ring-outer-width) var(--premium-focus-contrast);
    --premium-shadow-none: none;
    --premium-depth-workspace: var(--premium-shadow-none);
    --premium-depth-workspace-hover: var(--premium-depth-workspace);
    --premium-depth-data: var(--premium-shadow-none);
    --premium-depth-detail: var(--premium-shadow-md);

    /* Typografie. */
    --premium-font-body: var(--app-font-body);
    --premium-font-heading: var(--app-font-heading);
    --premium-font-display: var(--app-font-display);
    --premium-font-size-xs: 0.75rem;
    --premium-font-size-sm: 0.875rem;
    --premium-font-size-base: 0.9375rem;
    --premium-font-size-md: 1rem;
    --premium-font-size-lg: 1.125rem;
    --premium-font-size-xl: clamp(1.5rem, 2vw, 1.75rem);
    --premium-font-weight-normal: 400;
    --premium-font-weight-medium: 500;
    --premium-font-weight-semibold: 600;
    --premium-type-page-size: var(--premium-font-size-xl);
    --premium-type-section-size: var(--premium-font-size-lg);
    --premium-type-data-size: var(--premium-font-size-sm);
    --premium-type-label-size: var(--premium-font-size-sm);
    --premium-type-meta-size: var(--premium-font-size-xs);
    --premium-line-height-tight: 1.2;
    --premium-line-height-base: 1.55;
    --premium-tracking-tight: -0.025em;
    --premium-tracking-label: 0.075em;
    --premium-tabular-numbers: tabular-nums lining-nums;
    --premium-transition: 160ms cubic-bezier(0.16, 1, 0.3, 1);

    /* Einheitliche Systemmeldungen: Ton, Dichte und Position bleiben CI-weit steuerbar. */
    --message-stack-offset: var(--premium-space-lg);
    --message-stack-offset-mobile: var(--premium-space-md);
    --message-stack-gap: var(--premium-space-sm);
    --message-stack-width: 28rem;
    --message-stack-width-mobile: var(--premium-full-size);
    --message-stack-z-index: 1200;
    --message-mobile-action-clearance: calc(var(--premium-control-height) + var(--premium-space-md));
    --message-surface: var(--premium-surface);
    --message-border-width: var(--premium-border-width);
    --message-border: var(--premium-border);
    --message-radius: var(--premium-radius-md);
    --message-shadow: var(--premium-shadow-md);
    --message-padding-y: var(--premium-space-md);
    --message-padding-x: var(--premium-space-md);
    --message-content-gap: var(--premium-space-sm);
    --message-icon-size: var(--premium-icon-control-size);
    --message-icon-radius: var(--premium-radius-sm);
    --message-close-size: var(--premium-control-height-sm);
    --message-action-padding-y: var(--premium-space-xs);
    --message-action-padding-x: var(--premium-space-sm);
    --message-title-color: var(--premium-ink-strong);
    --message-text-color: var(--premium-ink);
    --message-detail-color: var(--premium-ink-muted);
    --message-success-bg: var(--message-surface);
    --message-success-border: var(--action-tone-success-border);
    --message-success-icon-bg: var(--icon-surface-success-bg);
    --message-success-icon-color: var(--icon-surface-success-color);
    --message-warning-bg: var(--message-surface);
    --message-warning-border: var(--action-tone-warning-border);
    --message-warning-icon-bg: var(--icon-surface-warning-bg);
    --message-warning-icon-color: var(--icon-surface-warning-color);
    --message-error-bg: var(--message-surface);
    --message-error-border: var(--action-tone-danger-border);
    --message-error-icon-bg: var(--icon-surface-danger-bg);
    --message-error-icon-color: var(--icon-surface-danger-color);
    --message-info-bg: var(--message-surface);
    --message-info-border: var(--action-tone-info-border);
    --message-info-icon-bg: var(--icon-surface-info-bg);
    --message-info-icon-color: var(--icon-surface-info-color);

    /* Bestehende semantische Tokens zentral veredeln. */
    --layout-sidebar-width: var(--premium-sidebar-width);
    --layout-sidebar-collapsed-width: var(--premium-sidebar-collapsed-width);
    --layout-sidebar-collapsed-margin: calc(var(--premium-sidebar-collapsed-width) + var(--premium-space-sm));
    --layout-content-padding: var(--premium-space-page);
    --layout-content-padding-mobile: var(--premium-space-md);
    --layout-content-max-width: var(--premium-content-max-width);
    --layout-app-bg: var(--premium-canvas);
    --surface-color: var(--premium-surface);
    --surface-muted: var(--premium-surface-subtle);
    --text-color: var(--premium-ink-strong);
    --secondary-text-color: var(--premium-ink-muted);
    --text-ink-strong: var(--premium-ink-strong);
    --text-ink: var(--premium-ink);
    --text-ink-soft: var(--premium-ink);
    --text-ink-muted: var(--premium-ink-muted);
    --text-ink-subtle: var(--premium-ink-subtle);
    --text-ink-faint: var(--premium-ink-subtle);
    --text-ink-label: var(--premium-ink-muted);
    --text-ink-caption: var(--premium-ink-muted);
    --border-color: var(--premium-border);
    --panel-border-subtle: var(--premium-border);
    --panel-border-soft: var(--premium-border);
    --panel-border-strong: var(--premium-border-strong);
    --panel-shadow-soft: var(--premium-depth-data);
    --panel-shadow-hover: var(--premium-depth-data);
    --panel-shadow-strong: var(--premium-shadow-md);
    --panel-shadow-strong-hover: var(--premium-shadow-md);
    --action-tone-brand-shadow: var(--premium-shadow-none);
    --action-tone-neutral-shadow: var(--premium-shadow-none);
    --action-tone-success-shadow: var(--premium-shadow-none);
    --action-tone-warning-shadow: var(--premium-shadow-none);
    --action-tone-danger-shadow: var(--premium-shadow-none);
    --action-tone-info-shadow: var(--premium-shadow-none);
    --action-control-press-scale: 1;
    --card-bg: var(--premium-surface);
    --card-bg-muted: var(--premium-surface-subtle);
    --card-border-color: var(--premium-border);
    --card-border-color-strong: var(--premium-border-strong);
    --card-radius: var(--premium-radius-md);
    --card-radius-lg: var(--premium-radius-lg);
    --card-shadow: var(--premium-depth-data);
    --card-shadow-hover: var(--premium-depth-data);
    --card-padding: var(--premium-space-lg);
    --card-padding-sm: var(--premium-space-md);
    --section-panel-bg: var(--premium-surface);
    --section-panel-border: var(--premium-border-width) solid var(--premium-border);
    --section-panel-radius: var(--premium-radius-md);
    --section-panel-shadow: var(--premium-depth-data);
    --section-panel-header-bg: var(--premium-surface);
    --section-panel-header-border: var(--premium-border-width) solid var(--premium-border);
    --page-header-bg: var(--premium-transparent);
    --page-header-border: var(--premium-zero);
    --page-header-radius: var(--premium-zero);
    --page-header-shadow: var(--premium-shadow-none);
    --page-header-padding-y: var(--premium-zero);
    --page-header-padding-x: var(--premium-zero);
    --page-header-title-size: var(--premium-type-page-size);
    --page-header-icon-size: var(--premium-control-height-sm);
    --page-header-icon-radius: var(--premium-zero);
    --page-header-title-color: var(--premium-ink-strong);
    --page-header-subtitle-color: var(--premium-ink-muted);
    --btn-radius: var(--premium-radius-sm);
    --input-height: max(var(--premium-control-height), var(--premium-touch-target-min));
    --input-border-color: var(--premium-border-strong);
    --input-border-radius: var(--premium-radius-sm);
    --input-bg: var(--premium-surface);
    --input-focus-ring: var(--premium-shadow-focus);
    --input-focus-shadow: var(--premium-shadow-focus);
    --modal-radius: var(--premium-radius-lg);
    --modal-border-color: var(--premium-border);
    --table-cell-padding: var(--premium-table-cell-y) var(--premium-table-cell-x);
    --table-header-bg: var(--premium-surface-subtle);
    --table-header-border: var(--premium-border-width) solid var(--premium-border);
    --table-row-border: var(--premium-border-width) solid var(--premium-border);
    --table-panel-header-color: var(--premium-ink-muted);
    --table-panel-row-border: var(--premium-border-width) solid var(--premium-border);
    --table-panel-row-hover: var(--premium-surface-subtle);
    --sidebar-bg: var(--premium-sidebar);
    --sidebar-header-bg: var(--premium-sidebar);
    --sidebar-link-color: var(--premium-sidebar-text);
    --sidebar-link-hover-bg: var(--premium-sidebar-hover);
    --sidebar-link-hover-color: var(--premium-sidebar-text-strong);
    --sidebar-link-active-bg: var(--premium-sidebar-active);
    --sidebar-submenu-bg: var(--premium-sidebar-deep);
    --sidebar-border: var(--premium-border-on-dark);
    --sidebar-role-color: var(--premium-sidebar-label);
    --focus-ring: var(--premium-shadow-focus);
    --focus-ring-shadow: var(--premium-shadow-focus);
    --action-control-size: max(var(--premium-control-height), var(--premium-touch-target-min));
    --action-control-size-sm: max(var(--premium-control-height-sm), var(--premium-touch-target-min));
    --action-control-size-mobile: var(--premium-touch-target-min);
}

html[lang='en-GB'] {
    --premium-navigation-sidebar-width: var(--premium-navigation-sidebar-width-en);
}

html[lang='fr-FR'] {
    --premium-navigation-sidebar-width: var(--premium-navigation-sidebar-width-fr);
}
