/* IFX Dense Neutral Workbench foundation. Scoped to application containers; never theme html/body. */
[data-ifx-application-layout][data-ifx-theme="dnw-light"] {
    color-scheme: light;
    --ifx-color-canvas: #eef1f4;
    --ifx-color-surface: #ffffff;
    --ifx-color-surface-muted: #f7f8fa;
    --ifx-color-surface-selected: #e7eef3;
    --ifx-color-text: #20262e;
    --ifx-color-text-muted: #56616c;
    --ifx-color-border: #d5dae0;
    --ifx-color-border-strong: #bac2cb;
    --ifx-color-control-border: #7b8590;
    --ifx-color-brand: #17324d;
    --ifx-color-on-brand: #ffffff;
    --ifx-color-on-brand-muted: #d9e4ee;
    --ifx-color-action: #315f7a;
    --ifx-color-action-hover: #274c62;
    --ifx-color-danger: #7a3038;
    --ifx-color-warning: #6f4a10;
    --ifx-color-success: #365340;
    --ifx-color-info: #2d526a;
    --ifx-color-focus: #356b8f;
    /* Rebind legacy schedule aliases here: custom properties declared at :root
       have already resolved there and do not follow descendant token changes. */
    --ifx-color-accent: var(--ifx-color-action);
    --ifx-color-muted: var(--ifx-color-text-muted);
    --ifx-color-accent-surface: #e8f0f5;
    --ifx-color-focus-surface: #e8f0f5;
    --ifx-control-height: 30px;
    --ifx-grid-header-height: 32px;
    --ifx-grid-row-height: 30px;
    --ifx-panel-header-height: 34px;
    --ifx-space-1: 4px;
    --ifx-space-2: 8px;
    --ifx-space-3: 12px;
    --ifx-space-4: 16px;
    --ifx-radius-control: 3px;
    --ifx-radius-panel: 5px;
    --ifx-shadow-overlay: 0 16px 44px rgb(23 50 77 / 22%);
    --ifx-focus-ring: 2px solid var(--ifx-color-focus);
    --ifx-font-sans: Inter, "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
    --ifx-size-control-min: var(--ifx-control-height);
    font-family: var(--ifx-font-sans);
    font-size: 14px;
    line-height: 1.35;
    color: var(--ifx-color-text);
    background: var(--ifx-color-canvas);
}

[data-ifx-application-layout][data-ifx-density="compact"] {
    --ifx-page-padding: 12px;
}

[data-ifx-application-layout] *,
[data-ifx-application-layout] *::before,
[data-ifx-application-layout] *::after { box-sizing: border-box; }

[data-ifx-application-layout] :where(button, input, select, textarea) {
    font: inherit;
}

[data-ifx-application-layout] :where(button, input, select, textarea, a):focus-visible {
    outline: var(--ifx-focus-ring);
    outline-offset: 2px;
}

[data-ifx-application-layout] :where(h1, h2, h3, p) { margin-block: 0; }

/* History is not a business state. Keep links stable after navigation;
   component navigation/button rules retain their more specific treatment. */
[data-ifx-application-layout] :where(a:any-link) { color: var(--ifx-color-action); }
[data-ifx-application-layout] :where(a:any-link):hover { text-decoration: underline; }

.ifx-button,
[data-ifx-application-layout] button:where(:not(.ifx-schedule__cell):not(.ifx-schedule__event)) {
    min-block-size: var(--ifx-control-height);
    padding: 0 10px;
    border: 1px solid var(--ifx-color-control-border);
    border-radius: var(--ifx-radius-control);
    color: var(--ifx-color-text);
    background: var(--ifx-color-surface);
    cursor: pointer;
}

[data-ifx-application-layout] button.ifx-button--primary,
.ifx-button--primary {
    border-color: var(--ifx-color-action);
    color: #fff;
    background: var(--ifx-color-action);
    text-decoration: none;
}

[data-ifx-application-layout] button.ifx-button--primary:hover,
.ifx-button--primary:hover { background: var(--ifx-color-action-hover); text-decoration: none; }

.ifx-button--quiet { border-color: transparent; background: transparent; }
.ifx-button--danger { color: #fff; border-color: var(--ifx-color-danger); background: var(--ifx-color-danger); }

.ifx-icon-button {
    display: inline-grid;
    inline-size: var(--ifx-control-height);
    min-inline-size: var(--ifx-control-height);
    place-items: center;
    padding: 0;
}

.ifx-icon { inline-size: 16px; block-size: 16px; stroke-linecap: round; stroke-linejoin: round; }

.ifx-field,
[data-ifx-application-layout] :where(input, select, textarea) {
    min-block-size: var(--ifx-control-height);
    padding: 4px 8px;
    border: 1px solid var(--ifx-color-control-border);
    border-radius: var(--ifx-radius-control);
    color: var(--ifx-color-text);
    background: var(--ifx-color-surface);
}

.ifx-panel {
    border: 1px solid var(--ifx-color-border);
    border-radius: var(--ifx-radius-panel);
    background: var(--ifx-color-surface);
}

.ifx-panel__header,
.ifx-toolbar {
    display: flex;
    align-items: center;
    min-block-size: var(--ifx-panel-header-height);
    padding-inline: var(--ifx-space-2);
    border-block-end: 1px solid var(--ifx-color-border);
    gap: var(--ifx-space-2);
}

.ifx-status {
    display: inline-flex;
    align-items: center;
    min-block-size: 20px;
    padding-inline: 6px;
    border-radius: 999px;
    color: var(--ifx-color-text-muted);
    background: var(--ifx-color-surface-muted);
    font-size: 12px;
    font-weight: 650;
}

.ifx-empty-state,
.ifx-error-state { padding: var(--ifx-space-4); color: var(--ifx-color-text-muted); text-align: center; }
.ifx-error-state { color: var(--ifx-color-danger); }

@media (prefers-reduced-motion: reduce) {
    [data-ifx-application-layout] *,
    [data-ifx-application-layout] *::before,
    [data-ifx-application-layout] *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
