/* WebEngine only (loaded after app.css / components.css): the design system's rules for what the DevExpress / Bootstrap theme leaves out.
   Additive on purpose - it adds a visible keyboard focus and respects reduced motion, and restyles nothing else yet. */

/* One primary blue for the whole app (the theme's #007bff is 3.98:1 on white and fails AA; #0d6efd is 4.5:1). The dark theme keeps its own
   lighter blue, set on html.erp-dark, which is more specific than :root. */
:root {
    --action-primary: var(--terra-primary) !important;
}

/* Keyboard focus: one blue ring everywhere (the theme's own focus is a 1px dotted line, or nothing). Mouse clicks show none. */
:where(a, button, [role="button"], [role="tab"], [role="menuitem"], summary, input, select, textarea, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 2px solid var(--terra-primary, #0d6efd);
    outline-offset: 2px;
}

/* Grid cells and tree rows manage their own focus frame; a ring around the whole cell would hide it. */
.dxbl-grid td:focus-visible,
.dxbl-treelist td:focus-visible,
.dxbl-grid tr:focus-visible {
    outline-offset: -2px;
}

/* Reduced motion: smooth scrolling off. Animation and transition durations are NOT overridden on every element (*):
   that made every style recalculation of a page ~6x slower (9 -> 60 ms for 8,000 grid cells), and Windows reports
   reduced motion in every RDP session - there a list load froze for 20-50 s and the loader circle stood still (it was
   cut to one 0.01 ms turn). A component that animates honours prefers-reduced-motion in its own rule. */
@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
    }
}

/* Toasts: solid colour cards. Every fill reaches 4.5 : 1 or better with its text (the old pastels were 1.9 to 2.9 : 1); the amber one
   takes dark text. Light and dark have their own set. */
.ui_toast {
    min-width: 20rem;
    border-radius: 10px;
    overflow: hidden;
    color: #fff;
    box-shadow: 0 6px 18px rgba(20, 30, 50, .22);
}
/* Light theme: the app's own clean colours (the same blue, green and red as the buttons). */
.ui_toast-info    { background-color: #0d6efd; }
.ui_toast-success { background-color: #198754; }
.ui_toast-warning { background-color: #ffc107; color: #212529; }
.ui_toast-error   { background-color: #dc3545; }
/* Dark theme: slightly deeper, so they do not glare against the dark page. */
html.erp-dark .ui_toast-info    { background-color: #0b7285; }
html.erp-dark .ui_toast-success { background-color: #2b8a3e; }
html.erp-dark .ui_toast-warning { background-color: #fab005; color: #2b2000; }
html.erp-dark .ui_toast-error   { background-color: #c92a2a; }
.ui_toast-header { min-height: 0; padding: 0.75rem 3rem 0.25rem 1.25rem; }
.ui_toast-header h5 { font-size: 1rem; font-weight: 700; line-height: 1.3; }
.ui_toast-message { padding: 0 3rem 0.85rem 1.25rem; font-size: 0.875rem; line-height: 1.45; color: inherit; opacity: .95; word-break: normal; overflow-wrap: anywhere; }
.ui_toast-icon { align-items: flex-end; padding-bottom: 0.85rem; box-sizing: border-box; color: inherit; }
html.erp-dark .ui_toast { box-shadow: 0 8px 24px rgba(0, 0, 0, .6); }

/* One primary action per screen is a solid button: Save (green) and Search / the blue one-click buttons. Everything else stays an outline,
   so the eye finds the main action first. The red "Uždaryti" stays an outline. */
.ButtonDropdownGreen {
    background-color: #00693E;
    border-color: #00693E;
    color: #fff;
}

.ButtonDropdownGreen .ButtonDropdownSide,
.ButtonDropdownGreen .ButtonDropdownSideText {
    color: #fff;
}

.ButtonDropdownGreen .ButtonDropdownSide:hover,
.ButtonDropdownSideGreen:hover {
    background-color: #004d2e !important;
    color: #fff;
}

.ButtonDropdownBlue {
    background-color: var(--action-primary);
    border-color: var(--action-primary);
    color: #fff;
}

.ButtonDropdownBlue .ButtonDropdownSide,
.ButtonDropdownBlue .ButtonDropdownSideText {
    color: #fff;
}

.ButtonDropdownBlue .ButtonDropdownSide:hover,
.ButtonDropdownSideBlue:hover {
    background-color: color-mix(in srgb, var(--action-primary) 80%, #000) !important;
    color: #fff;
}

/* Dark theme: the accents are the lighter greens / blues, so the text on them is dark (as on the existing hover state). */
.erp-dark .ButtonDropdownGreen {
    background-color: var(--erp-save);
    border-color: var(--erp-save);
    color: var(--erp-on-accent);
}

.erp-dark .ButtonDropdownGreen .ButtonDropdownSide,
.erp-dark .ButtonDropdownGreen .ButtonDropdownSideText {
    color: var(--erp-on-accent);
}

.erp-dark .ButtonDropdownGreen .ButtonDropdownSide:hover,
.erp-dark .ButtonDropdownSideGreen:hover {
    background-color: color-mix(in srgb, var(--erp-save) 85%, #fff) !important;
    color: var(--erp-on-accent);
}

.erp-dark .ButtonDropdownBlue,
.erp-dark .ButtonDropdownBlue .ButtonDropdownSide,
.erp-dark .ButtonDropdownBlue .ButtonDropdownSideText {
    color: var(--erp-on-accent);
}

.erp-dark .ButtonDropdownBlue .ButtonDropdownSide:hover,
.erp-dark .ButtonDropdownSideBlue:hover {
    background-color: color-mix(in srgb, var(--action-primary) 85%, #fff) !important;
    color: var(--erp-on-accent);
}

/* Link text in grids and on the dashboard: #009efb on white is 2.9 : 1 and fails AA. A deeper blue of the same hue reaches 5.2 : 1.
   Light theme only; the dark theme has its own link colour (--erp-link). */
html:not(.erp-dark) .app_a-color4,
html:not(.erp-dark) .ui_color-5,
html:not(.erp-dark) .DashboardLink {
    color: #0070b8;
}

/* Kanban in dark mode: the board has its own palette (--kanban-*, set on :root in kanban.css) that never had a dark twin, so the board,
   cards and filter panel stayed white. html.erp-dark is more specific than :root, so these win. */
html.erp-dark {
    --kanban-page-bg: #252930;
    --kanban-card-bg: #2e323b;
    --kanban-cell-bg: rgba(255, 255, 255, .04);
    --kanban-cell-bg-hover: rgba(255, 255, 255, .09);
    --kanban-border: #3a3f4a;
    --kanban-grid-line: #3a3f4a;
    --kanban-accent: #6ea8fe;
    --kanban-text: #e3e6eb;
    --kanban-text-muted: #9aa3b2;
    --kanban-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .5);
    --kanban-shadow-hover: 0 8px 20px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
    --kanban-shadow-drag: 0 16px 32px rgba(0, 0, 0, .65), 0 4px 8px rgba(0, 0, 0, .45);
}

/* The panels whose white is written as a literal in Kanban.razor's own <style> block (it comes later in the page, hence !important). */
html.erp-dark .kanban-filter-panel,
html.erp-dark .kanban-lane-label,
html.erp-dark .kanban-view-toggle {
    background: var(--erp-surface, #1c1f25) !important;
    border-color: var(--erp-border, #3a3f4a) !important;
    color: var(--erp-text, #e3e6eb);
}

/* Calendar in dark mode: the cells outside working time (weekends) were the light theme's grey. */
html.erp-dark .dxbl-scheduler-disabled-color {
    background-color: var(--erp-tab-inactive, #2a2e36) !important;
}

/* Kanban column headers: white is a literal in kanban.css. */
html.erp-dark .kanban-column-header {
    background: var(--kanban-card-bg) !important;
    border-color: var(--kanban-border) !important;
    color: var(--kanban-text);
}

/* Task checklist ("Užduotys" in the task form): its scoped stylesheet is a light Trello palette (#f1f2f4 buttons, #fff popup).
   !important because scoped rules carry an attribute selector and their :hover variants outrank a plain override. */
html.erp-dark .acl-wrap { color: var(--erp-text) !important; }
html.erp-dark .acl-list-dragover { background: var(--erp-hover) !important; }
html.erp-dark .acl-title-text:hover,
html.erp-dark .acl-item:hover,
html.erp-dark .acl-add-trigger:hover,
html.erp-dark .acl-cancel:hover,
html.erp-dark .acl-modal-close:hover { background: var(--erp-hover) !important; color: var(--erp-text) !important; }
html.erp-dark .acl-pct,
html.erp-dark .acl-add-trigger,
html.erp-dark .acl-cancel,
html.erp-dark .acl-modal-label,
html.erp-dark .acl-modal-close,
html.erp-dark .acl-del,
html.erp-dark .acl-done .acl-item-text { color: var(--erp-text-muted) !important; }
html.erp-dark .acl-progress { background: var(--erp-border) !important; }
html.erp-dark .acl-progress-bar { background: #8993a4 !important; }
html.erp-dark .acl-del:hover { background: rgba(255, 107, 120, .16) !important; color: var(--erp-danger) !important; }
html.erp-dark .acl-add-input,
html.erp-dark .acl-modal-input,
html.erp-dark .acl-modal-select { background: var(--erp-surface) !important; color: var(--erp-text) !important; border-color: var(--erp-border-editor) !important; }
html.erp-dark .acl-footer { border-top-color: var(--erp-border) !important; }
html.erp-dark .acl-add-list-btn { background: var(--erp-hover-neutral) !important; color: var(--erp-text) !important; }
html.erp-dark .acl-add-list-btn:hover { background: var(--erp-selected) !important; }
html.erp-dark .acl-modal { background: var(--erp-surface) !important; color: var(--erp-text) !important; }

/* ---------------------------------------------------------------------------------------------------------------------------------
   Dark theme for components that carry their own light palette in a <style> block / .razor.css. One section per component; the
   html.erp-dark prefix outranks their single-class rules. Palette: --erp-surface / --erp-strip / --erp-hover / --erp-border / --erp-text.
   --------------------------------------------------------------------------------------------------------------------------------- */

/* UploadPhotos (photo gallery + upload) */
html.erp-dark .gallery-page,
html.erp-dark .upload-icon,
html.erp-dark .loading-card,
html.erp-dark .qr-corner,
html.erp-dark .qr-action-btn { background-color: var(--erp-surface); background: var(--erp-surface); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .photo-limit-info,
html.erp-dark .drop-zone,
html.erp-dark .add-photo,
html.erp-dark .photo-cell,
html.erp-dark .selection-bar { background-color: var(--erp-strip); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .drop-zone:hover,
html.erp-dark .add-photo:hover { background-color: var(--erp-hover); }
html.erp-dark .page-title,
html.erp-dark .upload-title,
html.erp-dark .loading-title { color: var(--erp-text); }
html.erp-dark .upload-subtitle,
html.erp-dark .loading-subtitle { color: var(--erp-text-muted); }
html.erp-dark .loading-overlay { background: rgba(19, 21, 26, .82); }
html.erp-dark .remove-photo { background: rgba(28, 31, 37, .92); color: var(--erp-text); }
html.erp-dark .selection-delete { color: var(--erp-danger); border-color: var(--erp-danger); }

/* Help windows (Help list + the form help panel) */
html.erp-dark .help-groups-container { border-color: var(--erp-border); }
html.erp-dark .help-group__header { color: var(--erp-text); }
html.erp-dark .help-card,
html.erp-dark .help-type-switcher__menu { background: var(--erp-strip); border-color: var(--erp-border); }
html.erp-dark .help-card--disabled { background: var(--erp-surface); }
html.erp-dark .help-card__code,
html.erp-dark .help-card__desc { color: var(--erp-text-muted); }
html.erp-dark .help-card__name,
html.erp-dark .help-type-switcher__item { color: var(--erp-text); }
html.erp-dark .help-card__action-btn,
html.erp-dark .help-link-header__close,
html.erp-dark .help-type-switcher__toggle { background: var(--erp-hover-neutral); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .help-card__action-btn:hover,
html.erp-dark .help-type-switcher__toggle:hover { background: var(--erp-selected); }
html.erp-dark .help-type-switcher__item:hover { background: var(--erp-hover); }
html.erp-dark .help-card__badge--inactive { background: rgba(255, 107, 120, .18); color: var(--erp-danger); }
html.erp-dark .help-card__action-btn--danger { color: var(--erp-danger); }
html.erp-dark .help-card__action-btn--danger:hover,
html.erp-dark .help-link-header__close:hover { background: rgba(255, 107, 120, .18); color: var(--erp-danger); }

/* Activity form: cover strip and its popover */
html.erp-dark .activity-cover-bar { border-bottom-color: var(--erp-border); }
html.erp-dark .activity-cover-popover { background: var(--erp-surface); border-color: var(--erp-border); }
html.erp-dark .acp-pop-head { color: var(--erp-text); }
html.erp-dark .acp-pop-refresh { background: var(--erp-hover-neutral); color: var(--erp-text-muted); }
html.erp-dark .acp-pop-refresh:hover { background: var(--erp-selected); color: var(--erp-text); }
html.erp-dark .acp-tile { background: var(--erp-strip); border-color: var(--erp-border); }
html.erp-dark .acp-tile:hover { border-color: var(--erp-border-editor); }
html.erp-dark .acp-noprev,
html.erp-dark .acp-empty { color: var(--erp-text-muted); }
html.erp-dark .acp-remove { background: rgba(255, 107, 120, .12); border-color: rgba(255, 107, 120, .4); color: var(--erp-danger); }
html.erp-dark .activity-form-section { border-top-color: var(--erp-border); }

/* Object import */
html.erp-dark .oi-section,
html.erp-dark .oi-banner { border-color: var(--erp-border); }
html.erp-dark .oi-chip { background: var(--erp-strip); border-color: var(--erp-border); }
html.erp-dark .oi-section-title,
html.erp-dark .oi-note { color: var(--erp-text-muted); }

/* User security tab */
html.erp-dark .sec-row { border-bottom-color: var(--erp-border); }
html.erp-dark .sec-row-title { color: var(--erp-text); }
html.erp-dark .sec-row-sub,
html.erp-dark .sec-muted,
html.erp-dark .sec-key { color: var(--erp-text-muted); }
html.erp-dark .sec-provider-icon,
html.erp-dark .sec-device-icon { background: var(--erp-strip); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .sec-badge { background: var(--erp-hover-neutral); color: var(--erp-text); }
html.erp-dark .sec-2fa-setup { background: var(--erp-strip); border-color: var(--erp-border); }
html.erp-dark .sec-recovery { background: rgba(255, 193, 7, .1); border-color: rgba(255, 193, 7, .35); }

/* Kanban: the remaining literal light surfaces in Kanban.razor's <style> block */
html.erp-dark .kanban-lane-count,
html.erp-dark .kanban-collapsed-count,
html.erp-dark .kb-card-avatar-more,
html.erp-dark .kb-card-cover { background: var(--erp-hover-neutral) !important; color: var(--erp-text-muted); }
html.erp-dark .kb-card-progress { background: var(--erp-border) !important; }
html.erp-dark .kanban-column-more { background: var(--erp-strip) !important; color: var(--erp-text-muted); }
html.erp-dark .kanban-column-more:hover,
html.erp-dark .kanban-column-draggable.col-dragover,
html.erp-dark .kanban-view-toggle .kvt:hover { background: var(--erp-hover) !important; }
html.erp-dark .kanban-lane-cards-collapsed { background: linear-gradient(100deg, #2a2e36 30%, #323741 50%, #2a2e36 70%) !important; }
html.erp-dark .kanban-column-nodevice .kanban-column-body { background: repeating-linear-gradient(45deg, #252930, #252930 10px, #2e323b 10px, #2e323b 20px) !important; }

/* Store statistics */
html.erp-dark .ss-card { background: var(--erp-strip); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .ss-table thead th,
html.erp-dark .ss-table tr.ss-band td { background: var(--erp-hover-neutral); color: var(--erp-text); }
html.erp-dark .ss-table .ss-total { background: rgba(47, 174, 110, .12); }
html.erp-dark .ss-table tr.ss-band td.ss-total { background: rgba(47, 174, 110, .2); }

/* ---- TimeTracker (tt2-*) ---- */
html.erp-dark .tt2-month-btn,
html.erp-dark .tt2-icon-btn,
html.erp-dark .tt2-back,
html.erp-dark .tt2-picker-month { background: var(--erp-strip); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .tt2-month-btn:hover,
html.erp-dark .tt2-icon-btn:hover,
html.erp-dark .tt2-picker-month:hover { background: var(--erp-hover); }
html.erp-dark .tt2-picker { background: var(--erp-surface); border-color: var(--erp-border); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
html.erp-dark .tt2-kpi { background: var(--erp-strip); border-color: var(--erp-border); }
html.erp-dark .tt2-kpi span,
html.erp-dark .tt2-chev,
html.erp-dark .tt2-hint,
html.erp-dark .tt2-list-head,
html.erp-dark .tt2-month-title small,
html.erp-dark .tt2-month-sum small,
html.erp-dark .tt2-day-title small,
html.erp-dark .tt2-range,
html.erp-dark .tt2-entry-note,
html.erp-dark .tt2-form-title,
html.erp-dark .tt2-emp-name small,
html.erp-dark .tt2-dn { color: var(--erp-text-muted); }
html.erp-dark .tt2-kpi b { color: var(--erp-text-emph); }
html.erp-dark .tt2-kpi b.tt2-warn { color: #f0a347; }
html.erp-dark .tt2-list-head { border-bottom-color: var(--erp-border); }
html.erp-dark .tt2-emp { background: var(--erp-surface); border-bottom-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .tt2-emp:hover { background: var(--erp-hover); }
html.erp-dark .tt2-emp.tt2-emp-active { background: var(--erp-selected); }
html.erp-dark .tt2-t { background: #323741; }
html.erp-dark .tt2-t-off { background: #2a2e36; }
html.erp-dark .tt2-dow,
html.erp-dark .tt2-legend { color: var(--erp-text-muted); }
html.erp-dark .tt2-day { background: var(--erp-strip); border-color: var(--erp-border); color: var(--erp-text-muted); }
html.erp-dark .tt2-d-full { background: rgba(47, 174, 110, .2); color: #7fdba6; }
html.erp-dark .tt2-d-less { background: rgba(255, 193, 7, .18); color: #ffd866; }
html.erp-dark .tt2-d-more { background: rgba(210, 162, 122, .22); color: #e6bd95; }
html.erp-dark .tt2-d-abs { background: rgba(76, 157, 255, .2); color: #8cc0ff; }
html.erp-dark .tt2-d-off { background: var(--erp-surface); color: #6c7585; }
html.erp-dark .tt2-worktime { background: rgba(76, 157, 255, .1); border-color: rgba(76, 157, 255, .35); }
html.erp-dark .tt2-entry { border-color: var(--erp-border); }
html.erp-dark .tt2-entry.tt2-entry-active { background: var(--erp-selected); }

/* ---- Attendance (att-*) ---- */
html.erp-dark .att-cal-day,
html.erp-dark .att-cal-today-btn,
html.erp-dark .att-team { background: var(--erp-strip); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .att-cal-today-btn { color: var(--action-primary); }
html.erp-dark .att-cal-day:hover,
html.erp-dark .att-team:hover { background: var(--erp-hover); }
html.erp-dark .att-cal-we { color: var(--erp-danger); }
html.erp-dark .att-cal-day.att-cal-on,
html.erp-dark .att-team.att-team-on { background: var(--action-primary); border-color: var(--action-primary); color: var(--erp-on-accent); }
html.erp-dark .att-dn,
html.erp-dark .att-updated,
html.erp-dark .att-cal-wd,
html.erp-dark .att-tile span,
html.erp-dark .att-tile b small,
html.erp-dark .att-note,
html.erp-dark .att-line small,
html.erp-dark .att-role,
html.erp-dark .att-line .fa-regular,
html.erp-dark .att-where .fa-solid,
html.erp-dark .att-muted { color: var(--erp-text-muted); }
html.erp-dark .att-tile { background: var(--erp-strip); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .att-tile:hover { background: var(--erp-hover); }
html.erp-dark .att-note-off { background: var(--erp-hover-neutral); color: var(--erp-text-muted); }
html.erp-dark .att-card { background: var(--erp-strip); border-color: var(--erp-border); }
html.erp-dark .att-card.att-s-absent { background: color-mix(in srgb, var(--erp-strip) 90%, #ff6b78 10%); }
html.erp-dark .att-who b,
html.erp-dark .att-line { color: var(--erp-text); }
html.erp-dark .att-badge { background: var(--erp-hover-neutral); color: var(--erp-text-muted); }
html.erp-dark .att-working,
html.erp-dark .att-s-present .att-badge { background: rgba(47, 174, 110, .2); color: #7fdba6; }
html.erp-dark .att-s-present.att-late .att-badge,
html.erp-dark .att-s-excused .att-badge { background: rgba(255, 193, 7, .18); color: #ffd866; }
html.erp-dark .att-s-absent .att-badge { background: rgba(255, 107, 120, .18); color: var(--erp-danger); }
html.erp-dark .att-s-pending .att-badge { background: var(--erp-hover-neutral); color: var(--erp-text-muted); }
html.erp-dark .att-col-head { background: var(--erp-strip); color: var(--erp-text); }
html.erp-dark .att.att-tv { background: var(--erp-surface); }

/* ---- Monitoring TV (/monitoring-tv) ---- */
html.erp-dark .MonitoringTv { background-color: #13151a; color: var(--erp-text); }
html.erp-dark .MonitoringTvHeader,
html.erp-dark .MonitoringTvEmpty,
html.erp-dark .MonitoringTvLane { background-color: var(--erp-surface); border-color: var(--erp-border); }
html.erp-dark .MonitoringTvLaneHead { background-color: var(--erp-strip); border-bottom-color: var(--erp-border); }
html.erp-dark .MonitoringTvCard { background-color: var(--erp-strip); border-color: var(--erp-border); }
html.erp-dark .MonitoringTvLaneBody .MonitoringTvCard { border-color: var(--erp-border); }
html.erp-dark .MonitoringTvName,
html.erp-dark .MonitoringTvClock,
html.erp-dark .MonitoringTvKpiValue,
html.erp-dark .MonitoringTvLaneTitle h2 { color: var(--erp-text-emph); }
html.erp-dark .MonitoringTvMuted,
html.erp-dark .MonitoringTvKpiLabel,
html.erp-dark .MonitoringTvEmpty,
html.erp-dark .MonitoringTvExit { color: var(--erp-text-muted); }
html.erp-dark .MonitoringTvLost,
html.erp-dark .MonitoringTvBad,
html.erp-dark .MonitoringTvKpiValue.MonitoringTvBad { color: var(--erp-danger); }
html.erp-dark .MonitoringTvKpiDivider { background-color: var(--erp-border); }
html.erp-dark .MonitoringTvExit { border-color: var(--erp-border); }
html.erp-dark .MonitoringTvExit:hover { background-color: var(--erp-hover); }
html.erp-dark .MonitoringTvChip { background-color: var(--erp-hover-neutral); color: var(--erp-text-muted); }
html.erp-dark .MonitoringTvTrack { background-color: var(--erp-border); }

/* ---- Rampų kalendorius TV (/ramp-tv), inside Monitoring TV's shell ---- */
html.erp-dark .RampTvBoard { background-color: var(--erp-surface); border-color: var(--erp-border); }
html.erp-dark .RampTvBoardHead,
html.erp-dark .RampTvListHead { background-color: var(--erp-strip); border-bottom-color: var(--erp-border); color: var(--erp-text-muted); }
html.erp-dark .RampTvRow,
html.erp-dark .RampTvListRow { border-bottom-color: var(--erp-border); }
html.erp-dark .RampTvCell { border-left-color: var(--erp-border); }
html.erp-dark .RampTvLate { background-color: rgba(255, 107, 120, .14); box-shadow: inset 6px 0 0 var(--erp-danger); }
html.erp-dark .RampTvListRow.RampTvLate { box-shadow: inset 8px 0 0 var(--erp-danger); }
html.erp-dark .RampTvRampName,
html.erp-dark .RampTvCount,
html.erp-dark .RampTvNo,
html.erp-dark .RampTvTime,
html.erp-dark .RampTvListTime { color: var(--erp-text-emph); }
html.erp-dark .RampTvPlate { border-color: var(--erp-text-emph); color: var(--erp-text-emph); }
html.erp-dark .RampTvText,
html.erp-dark .RampTvListFoot { color: var(--erp-text-muted); }
html.erp-dark .RampTvIn { color: #5aa9ff; }
html.erp-dark .RampTvOut { color: #6fcf73; }

/* ---- Venta product import (vpi-*) ---- */
html.erp-dark .vpi-grid,
html.erp-dark .vpi-tabs,
html.erp-dark .vpi-actions { border-color: var(--erp-border); }
html.erp-dark .vpi-table th { background: var(--erp-hover-neutral); border-bottom-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .vpi-table td { border-top-color: var(--erp-border); }
html.erp-dark .vpi-table td:first-child,
html.erp-dark .vpi-section-sub,
html.erp-dark .vpi-label,
html.erp-dark .vpi-chip-field,
html.erp-dark .vpi-status { color: var(--erp-text-muted); }
html.erp-dark .vpi-hint { background: var(--erp-strip); border-color: var(--erp-border-editor); color: var(--erp-text-muted); }
html.erp-dark .vpi-file .XFileUpload { border-color: var(--erp-border-editor); }
html.erp-dark .vpi-tab { color: var(--erp-text-muted); }
html.erp-dark .vpi-tab:hover,
html.erp-dark .vpi-tab.active,
html.erp-dark .vpi-file .XFileUpload .dropzone { color: var(--action-primary); }
html.erp-dark .vpi-chip,
html.erp-dark .vpi-filter { background: var(--erp-strip); border-color: var(--erp-border-editor); color: var(--erp-text); }
html.erp-dark .vpi-chip.vpi-chip-empty { background: rgba(224, 168, 0, .12); border-color: #e0a800; }
html.erp-dark .vpi-filter.active { border-color: var(--action-primary); color: var(--action-primary); }
html.erp-dark .vpi-actions .vpi-btn-close,
html.erp-dark .vpi-actions .vpi-btn-outline { background-color: var(--erp-strip) !important; border-color: var(--erp-border-editor) !important; color: var(--erp-text) !important; }
html.erp-dark .vpi-actions .vpi-btn-outline { border-color: var(--action-primary) !important; color: var(--action-primary) !important; }
html.erp-dark .vpi-actions .vpi-btn-outline:hover,
html.erp-dark .vpi-actions .vpi-btn-text:hover { background-color: var(--erp-hover) !important; }
html.erp-dark .vpi-actions .vpi-btn-primary { background-color: var(--action-primary) !important; border-color: var(--action-primary) !important; color: var(--erp-on-accent) !important; }
html.erp-dark .vpi-actions .vpi-btn-text { color: var(--action-primary) !important; }

/* ---- Gantt / scheduler panes ---- */
html.erp-dark .SchedulerFilterFieldsPanel,
html.erp-dark .scheduler-main-container,
html.erp-dark .scheduler-treeview-pane,
html.erp-dark .gantt-overlay-pane { border-color: var(--erp-border) !important; }
html.erp-dark .scheduler-treeview-pane,
html.erp-dark .chart-content-pane,
html.erp-dark .gantt-overlay-pane,
html.erp-dark .scheduler-scroll-container { background-color: var(--erp-surface); }
html.erp-dark .gantt-overlay-resize-handle { background: linear-gradient(180deg, var(--erp-strip) 0%, var(--erp-hover-neutral) 100%); border-bottom-color: var(--erp-border); }
html.erp-dark .loading-overlay { background-color: rgba(19, 21, 26, .8); }

/* ---- Provider order items: the order / project link dropdown ---- */
html.erp-dark .custom-order-dropdown { background: var(--erp-surface); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .order-link:hover,
html.erp-dark .project-link:hover { background-color: var(--erp-hover) !important; }

/* ---- New e-mail: attachments and the Cc / Bcc toggle ---- */
html.erp-dark .attachment-container { background: var(--erp-strip); border-color: var(--erp-border-editor); }
html.erp-dark .attachment-item { background: var(--erp-surface); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .no-attachments { color: var(--erp-text-muted); }
html.erp-dark .attachment-remove { color: var(--erp-danger); }
html.erp-dark .cc-bcc-btn { color: var(--erp-text-muted); }
html.erp-dark .cc-bcc-btn:hover { background: var(--erp-hover); color: var(--erp-text); }
html.erp-dark .cc-bcc-btn.active { color: var(--action-primary); }

/* ---- Document import grid ---- */
html.erp-dark .oi-docgrid input.oi-cell:hover { border-color: var(--erp-border-editor); }
html.erp-dark .oi-docgrid input.oi-cell:focus { background: var(--erp-surface); }
html.erp-dark .oi-docgrid .oi-st-err { color: var(--erp-danger); }

/* ---- Chat: remaining small controls ---- */
html.erp-dark .terra-chat-mic,
html.erp-dark .terra-chat-panel .dxbl-chatui-submitarea .dxbl-upload-file-btn { color: var(--erp-text-muted) !important; }
html.erp-dark .terra-chat-resizer::before { background: var(--erp-border); }
html.erp-dark .terra-chat-newbtn { background: var(--erp-strip); border-color: var(--erp-border-editor); color: var(--erp-text); }
html.erp-dark .terra-chat-item:hover { background: var(--erp-hover); }
html.erp-dark .terra-chat-item__title { color: var(--erp-text); }

/* ---------------------------------------------------------------------------------------------------------------------------------
   Shared surfaces found by scanning app.css / components.css / panel.css for light backgrounds with no .erp-dark counterpart.
   --------------------------------------------------------------------------------------------------------------------------------- */

/* Menus and popups */
html.erp-dark .userMenuDropDown,
html.erp-dark .DropdownSubmenuPanel,
html.erp-dark .ui_select-options-container { background-color: var(--erp-surface); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .tab-picker-sheet,
html.erp-dark .page-form-window { background: var(--erp-surface) !important; }
html.erp-dark .tab-picker-sheet button { background: var(--erp-surface); border-bottom-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .tab-picker-sheet button:disabled { color: var(--erp-text-muted); }
html.erp-dark .app-connected-user-summary-row:hover { background-color: var(--erp-hover); }
html.erp-dark .ui_treeviewItem { background-color: var(--erp-strip); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .ui_treeviewItem:hover,
html.erp-dark .ui_treeviewItem.focused { background-color: var(--erp-hover); }
html.erp-dark .ui_input-disabled { background-color: var(--erp-hover-neutral); }
html.erp-dark .XPasswordRevealIcon { color: var(--erp-text-muted); }
html.erp-dark .XPasswordRevealIcon:hover,
html.erp-dark .ListFullMapPin:hover { background-color: var(--erp-hover); }

/* Loading cover while a list or tab opens (white flashed in dark mode) */
html.erp-dark .MainFormTabsLoaderContrainer,
html.erp-dark .ListTemplateLoaderContrainer,
html.erp-dark .ListTemplateLeftPanelResize { background-color: var(--erp-surface); }

/* Search history popup */
html.erp-dark .SearchHistoryInput,
html.erp-dark .SearchHistorySelect,
html.erp-dark .SearchHistoryButton,
html.erp-dark .SearchHistoryList { background-color: var(--erp-strip); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .SearchHistoryButton:hover:not(:disabled),
html.erp-dark .SearchHistoryRow:hover { background-color: var(--erp-hover); }
html.erp-dark .SearchHistoryGroupHeader { background-color: var(--erp-hover-neutral); border-bottom-color: var(--erp-border); color: var(--erp-text-muted); }
html.erp-dark .SearchHistoryRow { border-bottom-color: var(--erp-border); }
html.erp-dark .SearchHistoryButton.Danger { color: var(--erp-danger); }

/* Other */
html.erp-dark .co-edit-banner { background-color: rgba(76, 157, 255, .14); border-color: rgba(76, 157, 255, .4); color: #9cc7ff; }
html.erp-dark .calendar-week-strip button { background: var(--erp-strip); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .calendar-week-strip button span:first-child { color: var(--erp-text-muted); }
html.erp-dark .calendar-week-strip button.today { background: rgba(76, 157, 255, .16); border-color: var(--action-primary); color: var(--action-primary); }
html.erp-dark .ncp-switch button { background: var(--erp-strip); color: var(--action-primary); }
html.erp-dark .ncp-switch button.active { background: var(--action-primary); color: var(--erp-on-accent); }
html.erp-dark .kanban-column-count { background: var(--erp-hover-neutral); color: var(--erp-text-muted); }
html.erp-dark .externalLoginButton { background-color: var(--erp-strip); border-color: var(--erp-border-editor); color: var(--erp-text); }
html.erp-dark .externalLoginButton:hover { background-color: var(--erp-hover); }

/* Spreadsheet tab */
html.erp-dark .spreadsheet-name.editing,
html.erp-dark .spreadsheet-loading-card,
html.erp-dark .spreadsheet-action-button.secondary { background: var(--erp-strip); border-color: var(--erp-border-editor); color: var(--erp-text); }
html.erp-dark .spreadsheet-action-button.secondary:not(:disabled):hover { background: var(--erp-hover); }

/* The older timesheet matrix (tt-*), still used by the work-time windows */
html.erp-dark .tt-matrix { background: var(--erp-surface); border-color: var(--erp-border); }
html.erp-dark .tt-grid th,
html.erp-dark .tt-grid td { background: var(--erp-surface); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .tt-grid thead th { background: var(--erp-strip); color: var(--erp-text); }
html.erp-dark .tt-grid .tt-weekend { background: var(--erp-hover-neutral); }
html.erp-dark .tt-grid .tt-holiday { background: rgba(255, 193, 7, .12); }
html.erp-dark .tt-grid td.tt-today { background: rgba(76, 157, 255, .14); }
html.erp-dark .tt-entry { background: var(--erp-strip); border-color: var(--erp-border); }

/* Dropdown-menu items: the light rule turns the text black on hover, which is black on the dark hover colour. */
html.erp-dark .xbutton[data-role="DropdownMenu"],
html.erp-dark .xbutton[data-role="DropdownMenu"]:hover,
html.erp-dark .xbutton.admin[data-role="DropdownMenu"]:hover { color: var(--erp-text); }
html.erp-dark .xbutton.admin[data-role="DropdownMenu"]:hover { background-color: var(--erp-hover) !important; }

/* New user: the QR / barcode generate tiles (the generated image itself stays on white so it scans). */
html.erp-dark .code-area { background: linear-gradient(135deg, var(--erp-strip) 0%, var(--erp-hover-neutral) 100%); border-color: var(--erp-border-editor); box-shadow: none; }
html.erp-dark .code-placeholder { color: var(--erp-text-muted); }
html.erp-dark .code-button:hover .code-area { border-color: var(--erp-text-muted); }
html.erp-dark .code-icon { stroke: var(--erp-text-muted); }

/* Calendar appointments (tint + stripe, see Calendar.razor): the tint mixes into the page surface, the text is the theme text. */
html.erp-dark .demo-sc-apt { --apt-surface: var(--erp-surface); --apt-text: var(--erp-text); }

/* DevExpress secondary buttons in dark mode (calendar toolbar, prev / next / today, the pencil and bin in the appointment popup, the
   date drop-down button) kept the light theme's grey-white fill. !important: DevExpress sets the fill from state selectors. */
html.erp-dark .dxbl-btn.dxbl-btn-secondary,
html.erp-dark .dxbl-btn.dxbl-btn-outline-secondary {
    background-color: var(--erp-hover-neutral) !important;
    border-color: var(--erp-border-editor) !important;
    color: var(--erp-text) !important;
}
html.erp-dark .dxbl-btn.dxbl-btn-secondary:hover,
html.erp-dark .dxbl-btn.dxbl-btn-outline-secondary:hover,
html.erp-dark .dxbl-btn.dxbl-btn-secondary.dxbl-active { background-color: var(--erp-selected) !important; }
html.erp-dark .dxbl-btn.dxbl-btn-secondary:disabled { color: var(--erp-text-muted) !important; opacity: .6; }

/* The date drop-down's calendar */
html.erp-dark .dxbl-calendar { background-color: var(--erp-surface); color: var(--erp-text); border-color: var(--erp-border); }
html.erp-dark .dxbl-calendar .dxbl-btn { color: var(--erp-text); }
html.erp-dark .dxbl-calendar td:hover,
html.erp-dark .dxbl-calendar .dxbl-calendar-day:hover { background-color: var(--erp-hover); }
html.erp-dark .dxbl-popup-content,
html.erp-dark .dxbl-dropdown-dialog { background-color: var(--erp-surface); color: var(--erp-text); }

/* Calendar slots: hovering or selecting a cell turned it white in dark mode. A light veil of the text colour instead. */
html.erp-dark .dxbl-sc-time-cell:hover,
html.erp-dark .dxbl-sc-time-cell.dxbl-hover,
html.erp-dark .dxbl-sc-time-cell.dxbl-selected,
html.erp-dark .dxbl-sc-time-cell[data-selected],
html.erp-dark .dxbl-sc-time-cell:focus {
    background-color: rgba(255, 255, 255, .09) !important;
}
html.erp-dark .dxbl-sc-time-cell.dxbl-scheduler-disabled-color:hover { background-color: rgba(255, 255, 255, .13) !important; }
html.erp-dark .dxbl-sc-all-day-area:hover,
html.erp-dark .dxbl-sc-all-day-area.dxbl-hover,
html.erp-dark .dxbl-sc-all-day-area:focus,
html.erp-dark .dxbl-sc-all-day-area[data-selected] {
    background-color: rgba(255, 255, 255, .09) !important;
}

/* ---------------------------------------------------------------------------------------------------------------------------------
   One button system, every coloured button SOLID: Save (green), Search / Filter / Action (blue), Close (red). Neutral buttons are a
   plain grey fill. Hover darkens. No bare outlines, no tints.
   --------------------------------------------------------------------------------------------------------------------------------- */
.xbutton[data-role="Filter"],
.xbutton[data-role="Action"],
.xbutton[data-role="SavePanelAction"] { background-color: var(--action-primary) !important; border-color: var(--action-primary) !important; color: #fff !important; }
.xbutton[data-role="Filter"]:hover,
.xbutton[data-role="Action"]:hover,
.xbutton[data-role="SavePanelAction"]:hover { background-color: color-mix(in srgb, var(--action-primary) 80%, #000) !important; border-color: color-mix(in srgb, var(--action-primary) 80%, #000) !important; color: #fff !important; }

.xbutton[data-role="SavePanelClose"],
.xbutton[data-role="SavePanelClose"].dxbl-btn-outline-danger { background-color: #dc3545 !important; border-color: #dc3545 !important; color: #fff !important; }
.xbutton[data-role="SavePanelClose"]:hover { background-color: #b02a37 !important; border-color: #b02a37 !important; color: #fff !important; }

.xbutton.dxbl-btn-outline-secondary { background-color: #eef1f5; }
.xbutton.dxbl-btn-outline-secondary:hover { background-color: #e1e6ed; }
.ButtonDropdown.ButtonDropdownDefault:not([style*="border: 0px"]) { background-color: #f3f5f8; }

/* Dark theme: the lighter accents carry dark text, as on the Save and Search buttons. */
/* The dark DevExpress secondary rule above also matches these buttons and is as specific as a plain role rule, so the fill is restated here:
   without it the dark text landed on the grey secondary fill (dark on dark). */
html.erp-dark .xbutton[data-role="Filter"],
html.erp-dark .xbutton[data-role="Action"],
html.erp-dark .xbutton[data-role="SavePanelAction"] { background-color: var(--action-primary) !important; border-color: var(--action-primary) !important; color: var(--erp-on-accent) !important; }
html.erp-dark .xbutton[data-role="Filter"]:hover,
html.erp-dark .xbutton[data-role="Action"]:hover,
html.erp-dark .xbutton[data-role="SavePanelAction"]:hover { background-color: color-mix(in srgb, var(--action-primary) 85%, #fff) !important; border-color: color-mix(in srgb, var(--action-primary) 85%, #fff) !important; color: var(--erp-on-accent) !important; }
html.erp-dark .xbutton[data-role="SavePanelClose"],
html.erp-dark .xbutton[data-role="SavePanelClose"].dxbl-btn-outline-danger { background-color: var(--erp-danger-button) !important; border-color: var(--erp-danger-button) !important; color: var(--erp-on-accent) !important; }
html.erp-dark .xbutton[data-role="SavePanelClose"]:hover { background-color: var(--erp-danger) !important; border-color: var(--erp-danger) !important; color: var(--erp-on-accent) !important; }
html.erp-dark .xbutton.dxbl-btn-outline-secondary { background-color: var(--erp-hover-neutral); }
html.erp-dark .xbutton.dxbl-btn-outline-secondary:hover { background-color: var(--erp-selected); }
html.erp-dark .ButtonDropdown.ButtonDropdownDefault:not([style*="border: 0px"]) { background-color: var(--erp-hover-neutral); }

/* Spreadsheet tab: the frame around the sheet follows the dark theme (the Univer sheet itself stays light until it can be switched). */
html.erp-dark .inner-form-window .spreadsheet-tab-content { background: var(--erp-surface); }
html.erp-dark .spreadsheet-toolbar { background: var(--erp-strip); border-bottom-color: var(--erp-border); }
html.erp-dark .spreadsheet-toolbar-icon { background: rgba(47, 174, 110, .18); color: #7fdba6; }
html.erp-dark .spreadsheet-title { color: var(--erp-text-emph); }
html.erp-dark .spreadsheet-subtitle,
html.erp-dark .spreadsheet-autosave-status { color: var(--erp-text-muted); }
html.erp-dark .spreadsheet-autosave-status.saved { color: #4ade80; }
html.erp-dark .spreadsheet-autosave-status.saving { color: #7fb4ff; }
html.erp-dark .spreadsheet-autosave-status.pending { color: #f0a347; }
html.erp-dark .inner-form-window .spreadsheet-wrapper { background: var(--erp-surface); border-color: var(--erp-border); }
html.erp-dark .spreadsheet-loading-overlay { background: rgba(19, 21, 26, .82); }

/* Univer's ribbon tab ("Pradžia"): its dark palette flips the black chip to a white one. A dark-grey chip with light text instead. */
html.erp-dark a.\!univer-rounded-full.univer-bg-gray-700 {
    background-color: var(--erp-hover-neutral, #2e323b) !important;
    color: var(--erp-text, #e3e6eb) !important;
}
html.erp-dark a.\!univer-rounded-full.univer-bg-gray-700 .univerjs-icon { color: var(--erp-text-muted, #9aa3b2) !important; }

/* Photo / logo upload on client, provider, user and project forms: the empty tile was a light grey block in dark mode. A loaded image keeps
   its white backing so transparent logos stay readable. */
html.erp-dark .avatar-circle:not(.has-image),
html.erp-dark .avatar-rectangle {
    background: var(--erp-hover-neutral);
    box-shadow: inset 0 0 0 1px var(--erp-border);
}
html.erp-dark .drag-drop-hint { color: var(--erp-text-muted); }

/* The client / provider logo tile uses its own class (avatar-rentangle, spelled so in NewClient.razor and the Frutsorta copy) and the
   style block there is declared with a plain class, so it needs the same treatment. A loaded logo keeps its white backing. */
html.erp-dark .avatar-rentangle {
    background: var(--erp-hover-neutral);
    box-shadow: inset 0 0 0 1px var(--erp-border);
}
html.erp-dark .avatar-rentangle:has(> .avatar-img) { background: #fff; }

/* The same rule for every other coloured outline button (the "Patvirtinti" in the import window is an outline Success button, and
   Primary / Danger / Warning / Info ones exist elsewhere): coloured means solid, so no screen mixes outlines and fills. */
.xbutton.dxbl-btn-outline-success { background-color: #198754 !important; border-color: #198754 !important; color: #fff !important; }
.xbutton.dxbl-btn-outline-success:hover { background-color: #146c43 !important; border-color: #146c43 !important; color: #fff !important; }
.xbutton.dxbl-btn-outline-primary { background-color: var(--action-primary) !important; border-color: var(--action-primary) !important; color: #fff !important; }
.xbutton.dxbl-btn-outline-primary:hover { background-color: color-mix(in srgb, var(--action-primary) 80%, #000) !important; color: #fff !important; }
.xbutton.dxbl-btn-outline-danger { background-color: #dc3545 !important; border-color: #dc3545 !important; color: #fff !important; }
.xbutton.dxbl-btn-outline-danger:hover { background-color: #b02a37 !important; border-color: #b02a37 !important; color: #fff !important; }
.xbutton.dxbl-btn-outline-warning { background-color: #ffc107 !important; border-color: #ffc107 !important; color: #212529 !important; }
.xbutton.dxbl-btn-outline-warning:hover { background-color: #e0a800 !important; border-color: #e0a800 !important; color: #212529 !important; }
.xbutton.dxbl-btn-outline-info { background-color: #0dcaf0 !important; border-color: #0dcaf0 !important; color: #212529 !important; }
.xbutton.dxbl-btn-outline-info:hover { background-color: #0aa8c9 !important; border-color: #0aa8c9 !important; color: #212529 !important; }

html.erp-dark .xbutton.dxbl-btn-outline-success { background-color: var(--erp-save) !important; border-color: var(--erp-save) !important; color: var(--erp-on-accent) !important; }
html.erp-dark .xbutton.dxbl-btn-outline-success:hover { background-color: color-mix(in srgb, var(--erp-save) 85%, #fff) !important; border-color: color-mix(in srgb, var(--erp-save) 85%, #fff) !important; }
html.erp-dark .xbutton.dxbl-btn-outline-primary { color: var(--erp-on-accent) !important; }
html.erp-dark .xbutton.dxbl-btn-outline-primary:hover { background-color: color-mix(in srgb, var(--action-primary) 85%, #fff) !important; color: var(--erp-on-accent) !important; }
html.erp-dark .xbutton.dxbl-btn-outline-danger { background-color: var(--erp-danger-button) !important; border-color: var(--erp-danger-button) !important; color: var(--erp-on-accent) !important; }
html.erp-dark .xbutton.dxbl-btn-outline-danger:hover { background-color: var(--erp-danger) !important; border-color: var(--erp-danger) !important; }

/* Gantt: the load column's "0%" (scheduler progress-bar value) was drawn in black. */
html.erp-dark .b-percent-bar-value,
html.erp-dark .b-percent-bar-value label { color: var(--erp-text-muted, #9aa3b2) !important; }

/* Gantt popup chart (resource load). The grid lines are #d3d3d3 paths (white on the dark page) and the capacity line is a black stroke. The
   stroke-width 12 paths are DevExpress's invisible hover areas, left alone. */
html.erp-dark .chart-visual-body svg path[stroke="#d3d3d3"] { stroke: #3a3f4a; }
html.erp-dark .chart-visual-body svg :is(path, line, polyline)[stroke="#000000"],
html.erp-dark .chart-visual-body svg :is(path, line, polyline)[stroke="#000"],
html.erp-dark .chart-visual-body svg :is(path, line, polyline)[stroke="black"],
html.erp-dark .chart-visual-body svg :is(path, line, polyline)[stroke="Black"],
html.erp-dark .chart-visual-body svg :is(path, line, polyline)[stroke^="rgb(0, 0, 0"],
html.erp-dark .chart-visual-body svg :is(path, line, polyline)[stroke^="rgb(0,0,0"],
html.erp-dark .chart-visual-body svg :is(path, line, polyline)[stroke^="rgba(0, 0, 0"],
html.erp-dark .chart-visual-body svg :is(path, line, polyline)[stroke^="rgba(0,0,0"] { stroke: #7fb0ff; }
html.erp-dark .chart-visual-body svg g[stroke="#000000"] path:not([stroke]),
html.erp-dark .chart-visual-body svg g[stroke="black"] path:not([stroke]),
html.erp-dark .chart-visual-body svg g[stroke^="rgb(0"] path:not([stroke]) { stroke: #7fb0ff; }

/* Constructor product form: the header strip above the product list and above the selected product (it was an inline light grey). */
.ctor-pane-head { padding: 12px 16px; background-color: #f8f9fa; border-bottom: 1px solid #dee2e6; }
html.erp-dark .ctor-pane-head { background-color: var(--erp-strip); border-bottom-color: var(--erp-border); color: var(--erp-text); }

/* Launcher tab after its window was closed (LauncherClosedCard) */
.launcher-closed { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; margin: 12vh auto 0; max-width: 28rem; padding: 2rem; text-align: center; border: 1px solid #dfdfdf; border-radius: 12px; background: #fff; color: #212529; }
.launcher-closed__icon { font-size: 2rem; color: #6c757d; }
.launcher-closed__title { margin: 0; font-size: 1.25rem; font-weight: 600; }
.launcher-closed__text { margin: 0 0 0.75rem; color: #6c757d; }
.launcher-closed__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
.launcher-closed__btn { height: 2.25rem; padding: 0 1rem; border: 1px solid #dee2e6; border-radius: 6px; background: #eef1f5; color: #212529; font: inherit; cursor: pointer; }
.launcher-closed__btn:hover { background: #e1e6ed; }
.launcher-closed__btn--primary { background: var(--action-primary); border-color: var(--action-primary); color: #fff; font-weight: 600; }
.launcher-closed__btn--primary:hover { background: color-mix(in srgb, var(--action-primary) 80%, #000); }
html.erp-dark .launcher-closed { background: var(--erp-strip); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .launcher-closed__icon, html.erp-dark .launcher-closed__text { color: var(--erp-text-muted); }
html.erp-dark .launcher-closed__btn { background: var(--erp-hover-neutral); border-color: var(--erp-border-editor); color: var(--erp-text); }
html.erp-dark .launcher-closed__btn--primary { background: var(--action-primary); border-color: var(--action-primary); color: var(--erp-on-accent); }

/* Areas of activity window: header strip, tree on the left, edit card on the right (ActivityFields.razor). */
.af-head { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; padding: 0 0 4px; }
.af-head .af-btn { white-space: nowrap; padding: 0 10px; }
.af-head__count { font-size: 12px; color: #6c757d; }
.af-head__spacer { flex: 1 1 auto; }
.af-btn { height: 32px; padding: 0 12px; border: 1px solid #dee2e6; border-radius: 6px; background: #f3f5f8; color: #212529; font: inherit; font-size: 13px; cursor: pointer; }
.af-btn:hover:not(:disabled) { background: #e5eaf0; }
.af-btn:disabled { opacity: .5; cursor: default; }
.af-btn--primary { background: var(--action-primary); border-color: var(--action-primary); color: #fff; font-weight: 600; }
.af-btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--action-primary) 80%, #000); }
.af-split { display: grid; grid-template-columns: minmax(0, 1fr) 500px; gap: 16px; align-items: start; }
.af-tree { min-width: 0; border: 1px solid #dfdfdf; border-radius: 10px; overflow: hidden; background: #fff; }
.af-tree table th:first-child, .af-tree table td:first-child { width: 44px; min-width: 44px; max-width: 44px; padding-left: 0; padding-right: 0; text-align: center; }
.af-tree table th:nth-child(2), .af-tree table td:nth-child(2) { width: 2.5rem; min-width: 2.5rem; padding: 0; text-align: center; }
.af-tree table td { padding-top: 4px; padding-bottom: 4px; }
.af-tree td.dxbl-grid-row-drag-anchor-cell { position: relative !important; width: 44px !important; min-width: 44px !important; max-width: 44px !important; padding: 0 !important; }
.af-tree td.dxbl-grid-row-drag-anchor-cell > svg { position: absolute !important; top: 50% !important; left: 50% !important; margin: 0 !important; transform: translate(-50%, -50%) !important; }
.af-detail { position: sticky; top: 0; display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid #dfdfdf; border-radius: 10px; background: #fff; }
.af-detail__hint { padding: 24px 8px; text-align: center; color: #6c757d; font-size: 13px; }
.af-detail__title { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.af-field { display: flex; flex-direction: column; gap: 3px; margin: 0; }
.af-field > span { font-size: 11px; color: #5b6472; }
.af-field input, .af-field select, .af-field textarea { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid #dee2e6; border-radius: 4px; background: #fff; color: #212529; font: inherit; font-size: 14px; }
.af-field input:focus, .af-field select:focus, .af-field textarea:focus { outline: 2px solid var(--action-primary); outline-offset: 1px; }
.af-check { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
@media (max-width: 899.98px) { .af-split { grid-template-columns: minmax(0, 1fr); } .af-detail { position: static; } }
html.erp-dark .af-count, html.erp-dark .af-head__count, html.erp-dark .af-detail__hint { color: var(--erp-text-muted); }
html.erp-dark .af-btn { background: var(--erp-hover-neutral); border-color: var(--erp-border-editor); color: var(--erp-text); }
html.erp-dark .af-btn:hover:not(:disabled) { background: var(--erp-selected); }
html.erp-dark .af-btn--primary { background: var(--action-primary); border-color: var(--action-primary); color: var(--erp-on-accent); }
html.erp-dark .af-tree { background: var(--erp-strip); border-color: var(--erp-border); }
html.erp-dark .af-detail { background: var(--erp-strip); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .af-field > span { color: var(--erp-text-muted); }
html.erp-dark .af-field input, html.erp-dark .af-field select, html.erp-dark .af-field textarea { background: var(--erp-surface); border-color: var(--erp-border-editor); color: var(--erp-text); }

/* Tree list status chips (BoolAsChip) */
.tl-chip { display: inline-block; font-size: 11px; line-height: 1.5; padding: 1px 9px; border-radius: 999px; font-weight: 500; }
.tl-chip--on { background: #d1e7dd; color: #146c43; }
.tl-chip--off { background: #eef1f5; color: #495057; }
html.erp-dark .tl-chip--on { background: rgba(47,174,110,.2); color: #6fd3a0; }
html.erp-dark .tl-chip--off { background: var(--erp-hover-neutral); color: var(--erp-text-muted); }

/* Tabs in dark: clear selected / inactive / disabled states */
html.erp-dark .dxbl-tabs-item { border-left-color: var(--erp-border) !important; }
html.erp-dark .dxbl-scroll-viewer-content ul { border-bottom-color: var(--erp-border) !important; }
html.erp-dark .dxbl-tabs > .dxbl-tabs-tablist > .dxbl-scroll-viewer > .dxbl-scroll-viewer-content > ul > li > .dxbl-tabs-item.dxbl-active::after,
html.erp-dark .dxbl-tabs > .dxbl-tabs-tablist > ul > li > .dxbl-tabs-item.dxbl-active::after { background-color: var(--erp-surface) !important; }
html.erp-dark .dxbl-tabs-item.dxbl-active { background-color: var(--erp-surface) !important; color: var(--erp-text-emph) !important; font-weight: 600; box-shadow: inset 0 3px 0 var(--action-primary); }
html.erp-dark .dxbl-tabs-item:not(.dxbl-active) { background-color: var(--erp-strip) !important; color: var(--erp-text-muted) !important; font-weight: 400; }
html.erp-dark .dxbl-tabs-item:not(.dxbl-active):hover { background-color: var(--erp-hover-neutral) !important; color: var(--erp-text) !important; }
html.erp-dark .dxbl-tabs-item.DisabledXTab { background-color: transparent !important; color: var(--erp-text-muted) !important; opacity: .45; border: 2px dashed var(--erp-border) !important; }

/* Document types window reuses the .af-* layout */
.af-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 12px; }
.af-head--end { justify-content: flex-end; padding-top: 4px; }
.af-field input:disabled { opacity: .6; cursor: not-allowed; }
.tl-chip--info { background: #dbe7ff; color: #1f4fb8; margin-left: 4px; }
html.erp-dark .tl-chip--info { background: rgba(76,157,255,.2); color: #8bbcff; }

.DocTypes, .DocTypes .af-split { width: 100%; box-sizing: border-box; }
.DocTypes .af-tree .dxbl-grid { width: 100%; }

/* File uploader (XFileUploader) in dark: used by every import window */
html.erp-dark .XFileUpload { background-color: var(--erp-strip) !important; border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .XFileUpload .dropzone { background-color: var(--erp-surface) !important; border-color: var(--erp-border-editor); color: var(--erp-text-muted) !important; }
html.erp-dark .XFileUpload .dropzone *, html.erp-dark .XFileUpload .uploadtip, html.erp-dark .XFileUpload .uploadtip p { color: var(--erp-text-muted) !important; }
html.erp-dark .XFileUpload .dropzone .browse, html.erp-dark .XFileUpload label label { color: var(--action-primary) !important; }
html.erp-dark .XFileUpload label { background-color: var(--erp-surface); color: var(--erp-text); }
html.erp-dark .XFileUpload .filedata, html.erp-dark .XFileUpload .filedata span { color: var(--erp-text); }
html.erp-dark .XFileUpload i { color: var(--erp-text-muted); }

.af-inline { display: flex; gap: 6px; align-items: center; }
.af-inline input { flex: 1 1 auto; min-width: 0; }
.af-inline .af-btn { flex: 0 0 auto; }
.af-trans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.af-trans__item { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.af-trans__item b { font-size: 10px; font-weight: 600; color: #5b6472; }
.af-trans__item input { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid #dee2e6; border-radius: 4px; background: #fff; color: #212529; font: inherit; font-size: 14px; }
html.erp-dark .af-trans__item b { color: var(--erp-text-muted); }
html.erp-dark .af-trans__item input { background: var(--erp-surface); border-color: var(--erp-border-editor); color: var(--erp-text); }
.af-row { grid-template-columns: minmax(0, 1fr) 210px; }

.af-field--pop { position: relative; }
.af-btn--icon { width: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.af-pop { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; margin-top: 4px; display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid #dfdfdf; border-radius: 8px; background: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.af-pop__row { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 8px; margin: 0; }
.af-pop__row b { font-size: 11px; color: #5b6472; }
.af-pop__row input { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid #dee2e6; border-radius: 4px; background: #fff; color: #212529; font: inherit; font-size: 14px; }
html.erp-dark .af-pop { background: var(--erp-strip); border-color: var(--erp-border); box-shadow: 0 6px 20px rgba(0,0,0,.5); }
html.erp-dark .af-pop__row b { color: var(--erp-text-muted); }
html.erp-dark .af-pop__row input { background: var(--erp-surface); border-color: var(--erp-border-editor); color: var(--erp-text); }

/* Globe button sits inside the name box */
.af-inline--merged { gap: 0; border: 1px solid #dee2e6; border-radius: 4px; background: #fff; }
.af-inline--merged:focus-within { outline: 2px solid var(--action-primary); outline-offset: 1px; }
.af-inline--merged input { border: 0 !important; outline: none !important; background: transparent !important; }
.af-inline--merged .af-glob { height: 30px; width: 32px; border: 0; background: transparent; color: #6c757d; border-radius: 0 4px 4px 0; }
.af-inline--merged .af-glob:hover { color: var(--action-primary); background: transparent; }
.af-inline--merged .af-glob[aria-expanded="true"] { color: var(--action-primary); }
html.erp-dark .af-inline--merged { background: var(--erp-surface); border-color: var(--erp-border-editor); }
html.erp-dark .af-inline--merged .af-glob { background: transparent; border: 0; color: var(--erp-text-muted); }
html.erp-dark .af-inline--merged .af-glob:hover, html.erp-dark .af-inline--merged .af-glob[aria-expanded="true"] { color: var(--action-primary); background: transparent; }

/* Colour picker dropdown in dark */
html.erp-dark .dropdown-template-color-palette { background-color: var(--erp-surface); border-color: var(--erp-border); }

.DeviceGrp, .DeviceGrp .af-split { width: 100%; box-sizing: border-box; }
.DeviceGrp .af-tree .dxbl-grid { width: 100%; }

.ItemGrp, .ItemGrp .af-split { width: 100%; box-sizing: border-box; }
.ItemGrp .af-tree .dxbl-grid { width: 100%; }

/* User signature tile in dark (the signature image itself stays on white) */
html.erp-dark .signature-area { background: var(--erp-strip) !important; border-color: var(--erp-border-editor) !important; box-shadow: none; }
html.erp-dark .signature-placeholder { color: var(--erp-text-muted); }
html.erp-dark .signature-icon { stroke: var(--erp-text-muted); }
html.erp-dark .signature-button:hover .signature-area { border-color: var(--action-primary) !important; }

/* User group window (NewUserCategory.razor) */
.ug-split { display: grid; grid-template-columns: 430px minmax(0, 1fr); gap: 16px; align-items: start; }
.ug-left { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ug-card { border: 1px solid #dfdfdf; border-radius: 10px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ug-card__title { font-size: 13px; font-weight: 600; color: #5b6472; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.ug-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; }
.ug-group { font-size: 12px; font-weight: 600; margin-top: 8px; }
.ug-right__body { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 0; border-top: 1px solid #eef1f5; margin: 0 -14px -14px; }
.ug-tree { max-height: 640px; overflow: auto; padding: 12px 8px; border-right: 1px solid #eef1f5; }
.ug-detail { padding: 14px 16px; min-width: 0; }
.ug-detail__title { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.ug-hint { padding: 24px 8px; text-align: center; color: #6c757d; font-size: 13px; }
.ug-perms { border: 1px solid #eef1f5; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.ug-perms__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ug-perms__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; }
.ug-fields-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ug-counts { display: flex; gap: 6px; font-size: 11px; }
.ug-count { padding: 2px 9px; border-radius: 999px; background: #eef1f5; color: #495057; }
.ug-count--off { background: #fbe4e6; color: #b02a37; }
.ug-count--on { background: #dbe7ff; color: #1f4fb8; }
.ug-bulk { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; margin-bottom: 10px; }
.ug-btn { height: 28px; padding: 0 10px; border: 1px solid #dee2e6; border-radius: 6px; background: #f3f5f8; color: #212529; font: inherit; font-size: 13px; cursor: pointer; }
.ug-btn:hover:not(:disabled) { background: #e5eaf0; }
.ug-btn:disabled { opacity: .4; cursor: default; }
.ug-btn--icon { width: 28px; padding: 0; }
.ug-fields { border: 1px solid #eef1f5; border-radius: 8px; overflow: hidden; }
.ug-field { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 4px 12px; border-bottom: 1px solid #eef1f5; }
.ug-field:last-child { border-bottom: 0; }
.ug-field__name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.ug-order { display: inline-flex; gap: 4px; }
.ug-seg { display: inline-flex; flex: 0 0 auto; border: 1px solid #dee2e6; border-radius: 6px; overflow: hidden; }
.ug-seg__btn { padding: 5px 12px; border: 0; border-left: 1px solid #dee2e6; background: transparent; color: #212529; font: inherit; font-size: 12px; cursor: pointer; }
.ug-seg__btn:first-child { border-left: 0; }
.ug-seg__btn.is-active { background: #495057; color: #fff; font-weight: 600; }
.ug-seg__btn--off.is-active { background: #dc3545; }
.ug-seg__btn--on.is-active { background: var(--action-primary); color: #fff; }
@media (max-width: 1099.98px) { .ug-split, .ug-right__body { grid-template-columns: minmax(0, 1fr); } .ug-tree { border-right: 0; border-bottom: 1px solid #eef1f5; } }
html.erp-dark .ug-card { background: var(--erp-strip); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .ug-card__title, html.erp-dark .ug-hint { color: var(--erp-text-muted); }
html.erp-dark .ug-right__body, html.erp-dark .ug-tree, html.erp-dark .ug-perms, html.erp-dark .ug-fields, html.erp-dark .ug-field { border-color: var(--erp-border); }
html.erp-dark .ug-count { background: var(--erp-hover-neutral); color: var(--erp-text-muted); }
html.erp-dark .ug-count--off { background: rgba(255,107,120,.2); color: #ff9aa4; }
html.erp-dark .ug-count--on { background: rgba(76,157,255,.2); color: #8bbcff; }
html.erp-dark .ug-btn { background: var(--erp-hover-neutral); border-color: var(--erp-border-editor); color: var(--erp-text); }
html.erp-dark .ug-btn:hover:not(:disabled) { background: var(--erp-selected); }
html.erp-dark .ug-seg { border-color: var(--erp-border-editor); }
html.erp-dark .ug-seg__btn { border-left-color: var(--erp-border-editor); color: var(--erp-text-muted); }
html.erp-dark .ug-seg__btn.is-active { background: #5a6170; color: #fff; }
html.erp-dark .ug-seg__btn--off.is-active { background: #ff6b78; color: #2a0509; }
html.erp-dark .ug-seg__btn--on.is-active { background: var(--action-primary); color: #0b1220; }

/* User group window: the left-hand cards fold shut (desktop; the phone tabs show them open) and the app menu is a grid of switch tiles */
.ug-fold { display: flex; align-items: center; gap: 8px; width: 100%; padding: 0; border: 0; background: none; font-family: inherit; text-align: left; cursor: pointer; }
.ug-fold .ug-count { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; }
.ug-fold__chev { display: inline-block; transition: transform .15s; }
.ug-card--fold { gap: 0; }
.ug-card__body { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.ug-bulk__btns { display: flex; flex-wrap: nowrap; gap: 8px; }
.ug-group--count { display: flex; align-items: center; justify-content: space-between; }
.ug-count--part { background: #fff1d6; color: #9a5b00; }
html.erp-dark .ug-count--part { background: rgba(255,170,60,.2); color: #ffc069; }
.ug-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ug-tile { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 10px; border: 1px solid #dee2e6; border-radius: 8px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ug-tile:hover { background: #f3f5f8; }
.ug-tile__sw { position: relative; flex: 0 0 auto; width: 32px; height: 18px; border-radius: 999px; background: #adb5bd; transition: background .15s; }
.ug-tile__sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; }
.ug-tile__name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ug-tile[aria-pressed="true"] { border-color: var(--action-primary); background: rgba(13, 110, 253, .06); }
.ug-tile[aria-pressed="true"] .ug-tile__sw { background: var(--action-primary); }
.ug-tile[aria-pressed="true"] .ug-tile__sw::after { left: 16px; }
.ug-tile[aria-pressed="false"] .ug-tile__name { color: #6c757d; text-decoration: line-through; }
html.erp-dark .ug-tile { border-color: var(--erp-border-editor); }
html.erp-dark .ug-tile:hover { background: var(--erp-hover-neutral); }
html.erp-dark .ug-tile__sw { background: #4a5160; }
html.erp-dark .ug-tile[aria-pressed="true"] { border-color: rgba(76,157,255,.55); background: rgba(76,157,255,.08); }
html.erp-dark .ug-tile[aria-pressed="true"] .ug-tile__sw { background: var(--action-primary); }
html.erp-dark .ug-tile[aria-pressed="false"] .ug-tile__name { color: var(--erp-text-muted); }
@media (min-width: 768px) {
    .ug-card--fold.is-collapsed > .ug-card__body { display: none; }
    .ug-card--fold.is-collapsed .ug-fold__chev { transform: rotate(-90deg); }
}
@media (max-width: 767.98px) {
    .ug-card--rights.ug-card--app > .ug-card__title { display: flex; cursor: default; }
    .ug-fold__chev { display: none; }
    .ug-tiles { grid-template-columns: minmax(0, 1fr); }
    .ug-bulk__btns { flex: 1 1 100%; }
    .ug-bulk__btns .ug-btn { flex: 1 1 0; }
    .ug-tile { min-height: 48px; }
}

/* The general dark rules above were painting over the colour variants; restate them after. */
html.erp-dark .MonitoringTvChip.MonitoringTvChipGood { background-color: rgba(47, 174, 110, .28); color: #8be0b0; }
html.erp-dark .MonitoringTvChip.MonitoringTvChipBad { background-color: rgba(255, 107, 120, .26); color: #ff9aa4; }
html.erp-dark .tt2-t.tt2-t-full { background: #5fae78; }
html.erp-dark .tt2-t.tt2-t-less { background: #d9b73f; }
html.erp-dark .tt2-t.tt2-t-more { background: #c08f66; }
html.erp-dark .tt2-t.tt2-t-abs { background: #6aa2cf; }
html.erp-dark .tt2-t.tt2-t-off { background: #2a2e36; }

/* Config window: settings hub (Config.razor) */
.cfg-hub { padding: 6px 4px 0; display: flex; flex-direction: column; gap: 18px; }
.cfg-hub__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.cfg-hub__head h2 { margin: 0; font-size: 22px; font-weight: 600; }
.cfg-hub__head p { margin: 4px 0 0; color: #5b6472; font-size: 13px; }
.cfg-hub__search { width: 340px; height: 40px; box-sizing: border-box; border: 1px solid #dee2e6; border-radius: 8px; padding: 0 14px; background: #fff; color: #212529; font: inherit; }
.cfg-hub__search:focus { outline: 2px solid var(--action-primary); outline-offset: 1px; }
.cfg-group { display: flex; flex-direction: column; gap: 6px; }
.cfg-group__title { font-size: 11px; font-weight: 600; color: #5b6472; text-transform: uppercase; letter-spacing: .05em; }
.cfg-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.cfg-tile { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid #dfdfdf; border-radius: 10px; background: #fff; color: #212529; font: inherit; text-align: left; cursor: pointer; }
.cfg-tile:hover { border-color: var(--action-primary); box-shadow: 0 2px 10px rgba(13, 110, 253, .12); }
.cfg-tile b { display: block; font-weight: 600; }
.cfg-tile__desc { display: block; margin-top: 2px; font-size: 12px; color: #5b6472; }
.cfg-tile__icon { width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.cfg-tile__icon--0 { background: #e7f0ff; color: #0b5ed7; }
.cfg-tile__icon--1 { background: #fff0d6; color: #8a5a00; }
.cfg-tile__icon--2 { background: #d9f2e4; color: #146c43; }
.cfg-tile__icon--3 { background: #efe3fb; color: #6f42c1; }
.cfg-tile__icon--4 { background: #eef1f5; color: #495057; }
.cfg-pagehead { display: flex; align-items: center; gap: 14px; padding: 4px 4px 12px; font-size: 16px; }
.cfg-back { height: 32px; padding: 0 12px; border: 1px solid #dee2e6; border-radius: 6px; background: #f3f5f8; color: #212529; font: inherit; font-size: 13px; cursor: pointer; }
.cfg-back:hover { background: #e5eaf0; }
.cfg-page .dxbl-tabs-tablist { display: none !important; }
html.erp-dark .cfg-hub__head p, html.erp-dark .cfg-group__title, html.erp-dark .cfg-tile__desc { color: var(--erp-text-muted); }
html.erp-dark .cfg-hub__search { background: var(--erp-surface); border-color: var(--erp-border-editor); color: var(--erp-text); }
html.erp-dark .cfg-tile { background: var(--erp-strip); border-color: var(--erp-border); color: var(--erp-text); }
html.erp-dark .cfg-tile:hover { border-color: var(--action-primary); box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
html.erp-dark .cfg-tile__icon--0 { background: rgba(76,157,255,.18); color: #8bbcff; }
html.erp-dark .cfg-tile__icon--1 { background: rgba(240,163,71,.18); color: #f0c27a; }
html.erp-dark .cfg-tile__icon--2 { background: rgba(47,174,110,.18); color: #6fd3a0; }
html.erp-dark .cfg-tile__icon--3 { background: rgba(160,120,230,.2); color: #c9a8f5; }
html.erp-dark .cfg-tile__icon--4 { background: var(--erp-hover-neutral); color: var(--erp-text-muted); }
html.erp-dark .cfg-back { background: var(--erp-hover-neutral); border-color: var(--erp-border-editor); color: var(--erp-text); }
html.erp-dark .cfg-back:hover { background: var(--erp-selected); }

/* The window's own scroll area scrolls the tiles, so they reach down to the save bar at any window height */
.cfg-hub { padding-right: 8px; }

/* Config pages (inside .cfg-page): sections as cards, inputs in a grid, options as switch rows */
.cfg-page .card { border: 1px solid #dfdfdf; border-radius: 10px; background: #fff; box-shadow: none; margin-bottom: 14px; }
.cfg-page .card .card-content-wrapper { padding: 14px 16px !important; }
.cfg-page .card-subtitle { margin: 0 0 12px; font-size: 12px; font-weight: 600; color: #5b6472 !important; text-transform: uppercase; letter-spacing: .05em; }
.cfg-page .inputcard-contentspannedgroup { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important; gap: 14px 20px !important; align-items: start !important; }
.cfg-page .inputcard-contentspannedgroup .inputcard-contentspannedgroup { grid-column: 1 / -1; }
.cfg-page .inputcard-contentspannedgroup > * { min-width: 0; }
.cfg-page .cw-320, .cfg-page .XLookUpEdit, .cfg-page .XTextEdit, .cfg-page .XMemo { width: 100% !important; max-width: none !important; }
/* options: one row each, after the inputs, label left, switch right */
.cfg-page .inputcard-contentspannedgroup > div:has(> chbox) { order: 5; grid-column: 1 / -1; display: block !important; width: 100%; border-top: 1px solid #eef1f5; }
.cfg-page .inputcard-contentspannedgroup > div:has(> chbox) > chbox { display: flex !important; flex-direction: row-reverse; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 40px; cursor: pointer; }
.cfg-page .inputcard-contentspannedgroup > div:has(> chbox):hover { background: #f8f9fa; }
.cfg-page chbox .dxbl-checkbox-check-element { position: relative; flex: 0 0 auto; width: 38px !important; height: 22px !important; border: 0 !important; border-radius: 999px !important; background: #ced4da !important; transition: background .15s ease; }
.cfg-page chbox .dxbl-checkbox-check-element::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s ease; }
.cfg-page chbox.dxbl-checkbox-checked .dxbl-checkbox-check-element { background: var(--action-primary) !important; }
.cfg-page chbox.dxbl-checkbox-checked .dxbl-checkbox-check-element::after { transform: translateX(16px); }
.cfg-page chbox .dxbl-checkbox-check-element .dxbl-image { display: none !important; }
.cfg-page chbox .dxbl-text { margin: 0 !important; flex: 1 1 auto; }
html.erp-dark .cfg-page .card { background: var(--erp-strip); border-color: var(--erp-border); }
html.erp-dark .cfg-page .card-subtitle { color: var(--erp-text-muted) !important; }
html.erp-dark .cfg-page .inputcard-contentspannedgroup > div:has(> chbox) { border-top-color: var(--erp-border); }
html.erp-dark .cfg-page .inputcard-contentspannedgroup > div:has(> chbox):hover { background: var(--erp-hover); }
html.erp-dark .cfg-page chbox .dxbl-checkbox-check-element { background: #4a505c !important; }
html.erp-dark .cfg-page chbox.dxbl-checkbox-checked .dxbl-checkbox-check-element { background: var(--action-primary) !important; }

/* A group that holds the section cards is a plain stack, not an input grid (it made gaps between cards). */
.cfg-page .inputcard-contentspannedgroup:has(> .card) { display: flex !important; flex-direction: column !important; gap: 0 !important; grid-template-columns: none !important; align-items: stretch !important; }
.cfg-page .card { min-width: 0 !important; width: 100%; box-sizing: border-box; }

/* app.css paints every checkbox ::after in the accent colour; on a switch that hid the knob */
.cfg-page chbox .dxbl-checkbox-check-element::after { background-color: #fff !important; }

/* Filter panel + toolbar card shared with the Calendar (Calendar.razor declares the same in its own <style>) */
.SchedulerFilterFieldsPanel { display: flex; flex-direction: row; border: 1px solid #dfdfdf !important; position: relative; padding: 0.5rem; min-height: 60.83px; border-top-left-radius: 6px; border-top-right-radius: 6px; width: 100%; flex-shrink: 0; box-sizing: border-box; }
.SchedulerFilterSelectionPanel { width: 100% !important; display: flex; flex-direction: column; align-items: start; justify-content: center; gap: 0.5rem; }
.SchedulerFilterSelectionPanel.FilterHidden { display: none; }
.SchedulerFilterFieldsPanel .ListTemplateFilterFieldsPanelControlWrapper { display: inline-flex; flex-direction: row; justify-content: end; min-width: 0; }
.SchedulerFilterFieldsPanel .ListTemplateFitlerPanelButtons { display: flex !important; flex-direction: row !important; justify-content: center !important; align-items: center !important; margin: 0 1rem !important; gap: 10px !important; height: 42px; }
.SchedulerFilterFieldsPanel .FilterPanelSettings { display: flex !important; flex-direction: row !important; align-items: center !important; justify-content: center !important; gap: 1rem !important; width: fit-content !important; height: 43px; }
.SchedulerFilterFieldsPanel .FilterPanelSettings button { height: 45px !important; width: fit-content !important; }
.tt2-pick-inline .tt2-picker { position: static !important; box-shadow: none !important; border: 0 !important; background: transparent !important; width: 280px; }
.tt2-pick-inline .tt2-picker-backdrop { display: none; }

/* The Kanban view switch (Kanban.razor declares it in its own <style>); the same control is used in TimeTracker and Attendance */
.kanban-view-toggle { display: inline-flex; flex: 0 0 auto; align-self: center; border: 1px solid #e2e6ec; border-radius: 8px; overflow: hidden; background: #fff; }
.kanban-view-toggle .kvt { display: inline-flex; align-items: center; gap: 0.35rem; border: none; background: transparent; padding: 0.4rem 0.7rem; font-size: 0.78rem; font-weight: 600; color: #667085; cursor: pointer; transition: background-color .15s ease, color .15s ease; white-space: nowrap; }
.kanban-view-toggle .kvt + .kvt { border-left: 1px solid #e2e6ec; }
.kanban-view-toggle .kvt:hover { background: #f2f4f7; color: #1d2939; }
.kanban-view-toggle .kvt.active { background: #2E5EAA; color: #fff; }
html.erp-dark .kanban-view-toggle .kvt { color: var(--erp-text-muted); }
html.erp-dark .kanban-view-toggle .kvt + .kvt { border-left-color: var(--erp-border); }
html.erp-dark .kanban-view-toggle .kvt:hover { color: var(--erp-text); }
html.erp-dark .kanban-view-toggle .kvt.active { background: var(--action-primary) !important; color: var(--erp-on-accent); }
.SchedulerFilterFieldsPanel .ListTemplateFilterFieldsPanelControlWrapper { align-items: center; }
/* Attendance column pager */
.att-pager { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; margin-right: 10px; font-size: .75rem; font-weight: 500; }
.att-pager em { font-style: normal; opacity: .85; }
.att-pager-btn { width: 22px; height: 22px; padding: 0; border: 1px solid currentColor; border-radius: 4px; background: transparent; color: inherit; font: inherit; line-height: 1; cursor: pointer; opacity: .8; }
.att-pager-btn:disabled { opacity: .25; cursor: default; }
.att.att-tv .att-pager { font-size: 1.4rem; }

/* Space between the view switch, the refresh button and the eye */
.SchedulerFilterFieldsPanel .ListTemplateFilterFieldsPanelControlWrapper { gap: 12px !important; flex: 0 0 auto; padding-right: 4px; }
.SchedulerFilterFieldsPanel .ListTemplateFilterFieldsPanelControlWrapper .ListTemplateFitlerPanelButtons { margin: 0 !important; }
.SchedulerFilterFieldsPanel .ListTemplateFilterFieldsPanelControlWrapper .kanban-view-toggle { margin: 0; }

/* Attendance columns hold one screen of people each; the board itself no longer scrolls */
.att-board .att-col { overflow-y: hidden; }

/* Config groups: two columns (a group that asks for more gets them), and groups that follow each other keep a gap */
.cfg-page .inputcard-contentspannedgroup { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.cfg-page .inputcard-contentspannedgroup[data-column-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.cfg-page .inputcard-contentspannedgroup[data-column-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
.cfg-page .inputcard-contentspannedgroup[data-column-count="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
.cfg-page .inputcard-contentspannedgroup + .inputcard-contentspannedgroup { margin-top: 14px; }
.cfg-page .inputcard-contentspannedgroup:has(> .card) { grid-template-columns: none !important; }
@media (max-width: 760px) { .cfg-page .inputcard-contentspannedgroup:not(:has(> .card)) { grid-template-columns: minmax(0, 1fr) !important; } }

/* Keep the filter fields and the button group apart */
.SchedulerFilterFieldsPanel { gap: 16px; }
.SchedulerFilterFieldsPanel > .SchedulerFilterSelectionPanel { flex: 1 1 auto; min-width: 0; }
.SchedulerFilterFieldsPanel > .ListTemplateFilterFieldsPanelControlWrapper { margin-left: 8px; }

/* A group that keeps its controls in the order they are written (switch, then the list it controls) */
.cfg-page .cfg-seq { grid-template-columns: minmax(0, 1fr) !important; }
.cfg-page .cfg-seq > *, .cfg-page .cfg-seq > div:has(> chbox) { order: 0 !important; }

/* Dashboard on a phone: nothing clipped or overlapping */
@media (max-width: 768px) {
    .DashboardHeader { flex-wrap: wrap !important; gap: 8px !important; }
    .DashboardHeader .DashboardSpacer { display: none; }
    .DashboardViewPicker { min-width: 0; flex: 1 1 auto; }
    .DashboardViewTitle { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .DashboardViewCount { white-space: nowrap; }
    .DashboardHeader .DashboardHeaderButton { flex: 1 1 auto; white-space: nowrap; justify-content: center; }
    .DashboardStages { flex-wrap: wrap; row-gap: 12px; }
    .DashboardStage { flex: 1 1 30%; min-width: 0; }
    .DashboardStageName { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
    .DashboardStageArrow { display: none; }
    .DashboardTable { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .DashboardTable th, .DashboardTable td { white-space: nowrap; }
    .DashboardPanel svg text { font-size: 9px !important; }
}

/* Dashboard on a phone: exactly the screen's width, and every other month label so they do not run together */
@media (max-width: 768px) {
    html:has(.DashboardPanel), body:has(.DashboardPanel) { overflow-x: hidden !important; max-width: 100vw; }
    .DashboardPanel { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; overflow-x: hidden; }
    .DashboardPanel > *, .DashboardPanel .card, .DashboardPanel [class*="DashboardCard"] { max-width: 100%; min-width: 0; box-sizing: border-box; }
    .DashboardTrendLabels span:nth-child(even) { visibility: hidden; }
}

/* Dashboard on a phone, second pass: tables as cards (label left, value right), the filter card at full width */
@media (max-width: 768px) {
    .DashboardTable { display: block; overflow: visible; }
    .DashboardTable thead { display: none; }
    .DashboardTable tbody, .DashboardTable tr { display: block; }
    .DashboardTable tr { padding: 10px 0; border-bottom: 1px solid #dee2e6; }
    .DashboardTable tr:last-child { border-bottom: 0; }
    .DashboardTable td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; height: auto; padding: 3px 0; border: 0; font-size: 0.85rem; text-align: right; white-space: normal; }
    .DashboardTable td::before { content: attr(data-label); flex: 0 0 38%; text-align: left; color: #6c757d; font-weight: 600; font-size: 0.75rem; }
    .DashboardTable td:not([data-label])::before { content: none; }
    .DashboardTable td.DashboardAlertObject { font-weight: 600; }
    .DashboardTable .DashboardNumeric { text-align: right; }
    .DashboardFilterBar { flex-direction: column; align-items: stretch; }
    .DashboardFilterField, .DashboardFilterDates { width: 100% !important; max-width: none; }
    .DashboardFilterBar .DashboardUpdated { margin-left: 0; justify-content: space-between; }
}
html.erp-dark .DashboardTable td::before { color: var(--erp-text-muted); }
html.erp-dark .DashboardTable tr { border-bottom-color: var(--erp-border); }

/* Phone, dark theme: list rows shown as cards and the tab picker were left white */
@media (max-width: 767.98px) {
    html.erp-dark tr[data-card-row] { background: var(--erp-strip) !important; border-color: var(--erp-border) !important; color: var(--erp-text); }
    html.erp-dark tr[data-card-row] > td { color: var(--erp-text); }
    html.erp-dark tr[data-card-row] > td[data-label]::before { color: var(--erp-text-muted); }
    html.erp-dark tr[data-card-row] > td[data-card-title] { color: var(--erp-text-emph); }
    html.erp-dark tr[data-card-row] a, html.erp-dark tr[data-card-row] .DashboardLink { color: var(--action-primary); }
    html.erp-dark .dxbl-tabs-tablist:not(.dxbl-date-time-edit-tabs *):is([data-tab-picker], :has(ul > li:nth-child(2))) .dxbl-tabs-item {
        background: var(--erp-strip) !important;
        border-color: var(--action-primary) !important;
        color: var(--erp-text-emph) !important;
        box-shadow: none;
    }
    html.erp-dark .tab-picker-sheet, html.erp-dark .tab-picker-menu { background-color: var(--erp-surface); color: var(--erp-text); }
}

/* List boxes with checkboxes (user lists, "Leisti skaityti laiškus"): a ticked row was dark text on a dark fill in dark theme */
html.erp-dark .dxbl-listbox {
    --dxbl-listbox-item-multi-selected-bg: rgba(76, 157, 255, .18);
    --dxbl-listbox-item-multi-selected-color: var(--erp-text-emph);
    --dxbl-listbox-item-multi-selected-hover-bg: rgba(76, 157, 255, .28);
    --dxbl-listbox-item-multi-selected-hover-color: var(--erp-text-emph);
    --dxbl-listbox-item-selected-bg: rgba(76, 157, 255, .18);
    --dxbl-listbox-item-selected-color: var(--erp-text-emph);
    --dxbl-listbox-item-selected-hover-bg: rgba(76, 157, 255, .28);
    --dxbl-listbox-item-selected-hover-color: var(--erp-text-emph);
    --dxbl-listbox-item-hover-bg: var(--erp-hover);
    --dxbl-listbox-item-hover-color: var(--erp-text);
    --dxbl-listbox-item-active-color: var(--erp-text);
}
html.erp-dark .dxbl-listbox .dxbl-listbox-item { color: var(--erp-text); }
html.erp-dark .dxbl-listbox .dxbl-listbox-item.dxbl-selected, html.erp-dark .dxbl-listbox .dxbl-listbox-item[aria-selected="true"] { color: var(--erp-text-emph); background-color: rgba(76, 157, 255, .18); }

/* Same fix, by what is inside the row: a ticked checkbox makes the whole row readable whatever class DevExpress puts on it */
html.erp-dark .dxbl-listbox li:has(.dxbl-checkbox-checked, input:checked),
html.erp-dark .dxbl-listbox .dxbl-listbox-item:has(.dxbl-checkbox-checked, input:checked) {
    background-color: rgba(76, 157, 255, .18) !important;
    color: var(--erp-text-emph) !important;
}
html.erp-dark .dxbl-listbox li:has(.dxbl-checkbox-checked, input:checked) *:not(.dxbl-checkbox-check-element):not(.dxbl-checkbox-check-element *) { color: var(--erp-text-emph) !important; }

/* The real class of a ticked row in a checkbox list is dxbl-list-box-item-selected (an <li>) */
html.erp-dark li.dxbl-list-box-item-selected,
html.erp-dark .dxbl-list-box li[aria-selected="true"] { background-color: rgba(76, 157, 255, .18) !important; color: var(--erp-text-emph) !important; }
html.erp-dark li.dxbl-list-box-item-selected:hover { background-color: rgba(76, 157, 255, .28) !important; }

/* Phone: the search box, "Atnaujinti" and the eye share one line (Calendar, TimeTracker, Attendance, Kanban-style panels) */
@media (max-width: 767.98px) {
    .SchedulerFilterFieldsPanel { flex-direction: row !important; align-items: flex-start !important; gap: 6px !important; }
    .SchedulerFilterFieldsPanel > .SchedulerFilterSelectionPanel { flex: 1 1 0 !important; min-width: 0; width: auto !important; }
    .SchedulerFilterFieldsPanel > .ListTemplateFilterFieldsPanelControlWrapper { flex: 0 0 auto; margin-left: 0 !important; align-items: center; gap: 4px !important; padding-top: 0; }
    .SchedulerFilterFieldsPanel .ListTemplateFitlerPanelButtons { margin: 0 !important; height: 43px; }
    .SchedulerFilterFieldsPanel .FilterPanelSettings { gap: 0 !important; height: 43px; }
    .SchedulerFilterFieldsPanel .FilterPanelSettings button { height: 43px !important; padding-inline: 8px; }
    .SchedulerFilterFieldsPanel .ListTemplateFitlerPanelButtons .xbutton, .SchedulerFilterFieldsPanel .ListTemplateFitlerPanelButtons button { padding-inline: 12px; white-space: nowrap; }
}

/* Phone: one line only while the filters are folded away; opened, the fields take the full width and the buttons go below them */
@media (max-width: 767.98px) {
    .SchedulerFilterFieldsPanel:not(:has(> .SchedulerFilterSelectionPanel > .hidden)) { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; }
    .SchedulerFilterFieldsPanel:not(:has(> .SchedulerFilterSelectionPanel > .hidden)) > .SchedulerFilterSelectionPanel { flex: 0 0 auto !important; width: 100% !important; }
    .SchedulerFilterFieldsPanel:not(:has(> .SchedulerFilterSelectionPanel > .hidden)) > .ListTemplateFilterFieldsPanelControlWrapper { justify-content: flex-start; margin-left: 0 !important; }
    .SchedulerFilterFieldsPanel:not(:has(> .SchedulerFilterSelectionPanel > .hidden)) .FilterPanelSettings { gap: 8px !important; }
}

/* Phone, dark theme: the "show more" strip at the bottom of a list card was a pale blue bar */
@media (max-width: 767.98px) {
    html.erp-dark tr[data-card-row][data-card-more]::after { background: var(--erp-hover-neutral); border-top-color: var(--erp-border); color: var(--action-primary); }
}

/* The AI credits badge (added by others) had no dark theme. (The subscription page draws itself from tokens since
   2026-11-25 - SubscriptionPage.razor.css - so its rules here are gone.) */
html.erp-dark .plan-usage-title, html.erp-dark .plan-usage-muted { color: var(--erp-text-muted); }
html.erp-dark .plan-usage-pop { background: var(--erp-surface); color: var(--erp-text); border-color: var(--erp-border); box-shadow: 0 6px 18px rgba(0, 0, 0, .5); }
html.erp-dark .plan-usage-bar { background: var(--erp-hover-neutral); }

/* ---- "Parašyti mums" dialog: the system's blue instead of black, in both themes ---- */
.feedback-kind.is-active { background: var(--action-primary) !important; border-color: var(--action-primary) !important; color: #fff !important; }
.feedback-send { background: var(--action-primary); border-color: var(--action-primary); color: #fff; }
.feedback-send:hover:not(:disabled) { background: color-mix(in srgb, var(--action-primary) 85%, #000); border-color: color-mix(in srgb, var(--action-primary) 85%, #000); }
.feedback-send:disabled { background: #ced4da; border-color: #ced4da; color: #6c757d; }
.feedback-input:focus, .feedback-textarea:focus { border-color: var(--action-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--action-primary) 22%, transparent); }
html.erp-dark .feedback-kind.is-active { background: var(--action-primary) !important; border-color: var(--action-primary) !important; color: var(--erp-on-accent) !important; }
html.erp-dark .feedback-send { background: var(--action-primary); border-color: var(--action-primary); color: var(--erp-on-accent); }
html.erp-dark .feedback-send:disabled { background: var(--erp-hover-neutral); border-color: var(--erp-border-editor); color: var(--erp-text-muted); }
html.erp-dark .feedback-input:focus, html.erp-dark .feedback-textarea:focus { border-color: var(--action-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--action-primary) 30%, transparent); }

/* ---- Virtual assistant: its own purple replaced by the shared accent (purple is the logo's colour only) ---- */
html .terra-chat-root, html.erp-dark .terra-chat-root { --terra-chat-accent: var(--action-primary); --terra-chat-accent-2: color-mix(in srgb, var(--action-primary) 70%, #fff); }

/* ---- A disabled solid button (invoice import "Prisegti failą" before a file is chosen) reads as disabled ---- */
.import-upload > .xbutton:disabled, .import-upload > .dxbl-btn.dxbl-disabled, .import-upload > button.dxbl-disabled { background: #e9ecef !important; border-color: #dee2e6 !important; color: #8a9099 !important; opacity: 1; }
html.erp-dark .import-upload > .xbutton:disabled, html.erp-dark .import-upload > .dxbl-btn.dxbl-disabled, html.erp-dark .import-upload > button.dxbl-disabled { background: var(--erp-hover-neutral) !important; border-color: var(--erp-border) !important; color: var(--erp-text-muted) !important; }

/* The AI-credits and storage icons (PlanUsageBadge) were their own bright blue; they now match the icons beside them. A warning or exhausted state keeps its colour. */
.plan-usage-icon:not(.warn):not(.over) { color: #6c757d !important; }
.terra-chat-header .plan-usage-icon:not(.warn):not(.over) { color: rgba(255, 255, 255, .85) !important; }
html.erp-dark .plan-usage-icon:not(.warn):not(.over) { color: var(--erp-text-muted) !important; }
html.erp-dark .terra-chat-header .plan-usage-icon:not(.warn):not(.over) { color: rgba(255, 255, 255, .85) !important; }
.plan-usage:hover .plan-usage-icon:not(.warn):not(.over), .plan-usage:focus .plan-usage-icon:not(.warn):not(.over) { color: var(--action-primary) !important; }

/* Phone: a tab's own icon-only actions (the upload icon in the "Dokumentai" tabs) stay on the toolbar row with print and columns,
   instead of getting a full-width row of their own. Actions with a caption or an input still get their own row. */
@media (max-width: 767.98px) {
    .ListTemplateActionPanel > div:has(> .CustomActionPanel:not(:has(.ButtonDropdownSideText, .xbutton, .XTextEdit, .XLookUpEdit, .XMemo))) {
        width: auto !important;
        flex: 0 0 auto !important;
        order: 0 !important;
    }
    .ListTemplateActionPanel .CustomActionPanel:not(:has(.ButtonDropdownSideText, .xbutton, .XTextEdit, .XLookUpEdit, .XMemo)) {
        order: 0 !important;
        flex: 0 0 auto !important;
        flex-wrap: nowrap;
        width: auto !important;
    }
    .ListTemplateActionPanel .CustomActionPanel:not(:has(.ButtonDropdownSideText, .xbutton, .XTextEdit, .XLookUpEdit, .XMemo)) > * {
        flex: 0 0 auto !important;
        width: auto !important;
    }
}

/* ...and make the toolbar row itself fit: no wrapping, tighter gaps, so print, upload and columns share one line on a narrow phone */
@media (max-width: 767.98px) {
    .ListTemplateActionPanel:has(> div > .CustomActionPanel:not(:has(.ButtonDropdownSideText, .xbutton, .XTextEdit, .XLookUpEdit, .XMemo))) {
        flex-wrap: nowrap !important;
        gap: 4px !important;
        padding-inline: 0.25rem !important;
    }
    .ListTemplateActionPanel:has(> div > .CustomActionPanel:not(:has(.ButtonDropdownSideText, .xbutton, .XTextEdit, .XLookUpEdit, .XMemo))) > div {
        min-width: 0;
        gap: 4px !important;
    }
    .ListTemplateActionPanel:has(> div > .CustomActionPanel:not(:has(.ButtonDropdownSideText, .xbutton, .XTextEdit, .XLookUpEdit, .XMemo))) > div:first-child { flex: 1 1 auto !important; }
}

/* The list toolbar on a phone is a three-column grid (components.css); a page's own action goes to a second row there.
   An icon-only action (the upload icon) stays in the middle column of the first row. */
@media (max-width: 767.98px) {
    /* (:has() cannot be nested inside :has(), so: match the icon, then hand back every panel that also holds text or inputs) */
    .ListTemplateActionPanel > div:nth-child(2):has(.CustomActionPanel .ButtonDropdownSideIcon) {
        grid-column: 2 !important;
        grid-row: 1 !important;
        width: auto !important;
        justify-self: start;
    }
    .ListTemplateActionPanel > div:nth-child(2):has(.CustomActionPanel .ButtonDropdownSideIcon):has(.ButtonDropdownSideText, .xbutton, .XTextEdit, .XLookUpEdit, .XMemo, .dxbl-text-edit, .dxbl-combo-box, select, textarea) {
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
        width: 100% !important;
        justify-self: stretch;
    }
}

/* The round "new item" and "tree" buttons on a phone use the assistant button's colours */
@media (max-width: 767.98px) {
    .phone-grid-new[data-show], .phone-tree-toggle, .phone-tree-close {
        background: linear-gradient(135deg, #2b2f3a 0%, #1e2129 100%) !important;
        color: #fff;
        box-shadow: 0 4px 14px rgba(15, 23, 42, .28);
    }
    html.erp-dark .phone-grid-new[data-show], html.erp-dark .phone-tree-toggle, html.erp-dark .phone-tree-close {
        background: linear-gradient(135deg, #343a48 0%, #23262f 100%) !important;
        border: 1px solid var(--erp-border);
    }
}

/* Column settings: the long "reset to system settings" caption wraps inside its button instead of spilling out of it */
.listsettings-footer-divider .xbutton, .listsettings-footer-divider .xbutton .dxbl-btn { height: auto !important; min-height: 2rem; white-space: normal !important; line-height: 1.2; padding-block: 0.4rem; text-align: center; overflow-wrap: anywhere; }

/* Phone Kanban, filters hidden: Raktas, Ieškoti and the eye share one line, as in the Calendar. The view switch shows icons only there. */
@media (max-width: 767.98px) {
    .kanban-page .kanban-filter-panel:has(.kanban-filter-secondary.FilterHidden) { flex-direction: row !important; flex-wrap: wrap !important; align-items: center !important; }
    .kanban-page .kanban-filter-panel:has(.kanban-filter-secondary.FilterHidden) > .kanban-filter-fields { flex: 1 1 0 !important; width: auto !important; min-width: 0; }
    .kanban-page .kanban-filter-panel:has(.kanban-filter-secondary.FilterHidden) > .kanban-filter-actions { flex: 0 0 auto !important; width: auto !important; flex-wrap: nowrap !important; gap: 4px; align-items: center; }
    .kanban-page .kanban-filter-panel:has(.kanban-filter-secondary.FilterHidden) .kanban-view-toggle .kvt span { display: none; }
    .kanban-page .kanban-filter-panel:has(.kanban-filter-secondary.FilterHidden) .kanban-view-toggle .kvt { padding: 0.4rem 0.5rem; }
}

/* Phone save bar: equal-width buttons. Up to three share one row; four (Reports, Actions, Save, Close) make a tidy 2 x 2. */
@media (max-width: 767.98px) {
    .innerform-savepanel > [data-column-count] {
        display: grid !important;
        grid-template-columns: none !important;
        grid-auto-flow: column !important;
        grid-auto-columns: minmax(0, 1fr) !important;
        gap: 0.4rem !important;
    }
    .innerform-savepanel > [data-column-count]:has(> :nth-child(5)) {
        grid-auto-flow: row !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-columns: auto !important;
    }
    .innerform-savepanel > [data-column-count] > * { width: 100% !important; min-width: 0 !important; }
}

/* Phone save bar: Reports / Actions fold behind a "..." button; Save and Close stay on show */
.innerform-savepanel > .savepanel-more { display: none; }
@media (max-width: 767.98px) {
    .innerform-savepanel:has(> .savepanel-more) { display: flex; align-items: flex-start; gap: 0.4rem; }
    .innerform-savepanel:has(> .savepanel-more) > [data-column-count] { flex: 1 1 0; min-width: 0; }
    .innerform-savepanel > .savepanel-more { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; border: 1px solid var(--erp-border, #ced4da); border-radius: 6px; background: var(--erp-surface, #fff); color: var(--erp-text, #212529); cursor: pointer; }
    .innerform-savepanel.more-open > .savepanel-more { background: var(--erp-hover-neutral, #e9ecef); }
}

/* Phone save bar, folded: Save and Close share the row equally (a flex row, not the grid the open state uses) */
@media (max-width: 767.98px) {
    .innerform-savepanel:not(.more-open) > [data-column-count] {
        display: flex !important;
        gap: 0.4rem !important;
    }
    .innerform-savepanel:not(.more-open) > [data-column-count] > :not([style*="width: 10px"]) {
        flex: 1 1 0 !important;
        width: auto !important;
        min-width: 0 !important;
    }
}

/* Phone save bar: each dropdown button fills its cell (the inline "fit-content" / justify-items:start left them narrow) */
@media (max-width: 767.98px) {
    .innerform-savepanel > [data-column-count] { justify-items: stretch !important; align-items: stretch !important; }
    .innerform-savepanel .ButtonDropdown { width: 100% !important; display: flex !important; }
    .innerform-savepanel .ButtonDropdown > .OneClickAction { flex: 1 1 auto; justify-content: center; }
    .innerform-savepanel .xbutton[data-role="SavePanelClose"] { width: 100% !important; }
}

/* Phone save bar, one grid of two columns.
   Save + Close always; with both Reports and Actions the "..." button swaps the pair for Reports + Actions.
   With only one of them (three buttons) it sits alone on the first line, Save and Close on the second. */
@media (max-width: 767.98px) {
    .innerform-savepanel > [data-column-count] {
        display: grid !important;
        grid-auto-flow: row !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-columns: auto !important;
        gap: 0.4rem !important;
    }
    .innerform-savepanel:not(:has(> .savepanel-more)) > [data-column-count]:has(> :nth-child(4)) > :first-child { grid-column: 1 / -1; }
    .innerform-savepanel:has(> .savepanel-more):not(.more-open) > [data-column-count] > :has(~ div[style*="width: 10px"]) { display: none !important; }
    .innerform-savepanel.more-open > [data-column-count] > :not(:has(~ div[style*="width: 10px"])):not(div[style*="width: 10px"]) { display: none !important; }
}

/* Phone: the list-tree overlay was a white sheet with near-white text in dark mode */
html.erp-dark [data-tree-pane][data-tree-open] { background: var(--erp-surface) !important; color: var(--erp-text); }
html.erp-dark [data-tree-pane][data-tree-open] .ListTemplateLeftPanel { background: transparent !important; }
html.erp-dark [data-tree-pane][data-tree-open] *:not([class*="selected"], [class*="selected"] *, [class*="focus"], svg, svg *) { color: var(--erp-text) !important; }
html.erp-dark [data-tree-pane][data-tree-open] [class*="expand"], html.erp-dark [data-tree-pane][data-tree-open] [class*="toggle"] { color: var(--erp-text-muted) !important; }
html.erp-dark [data-tree-pane][data-tree-open] [class*="selected"] { background-color: var(--erp-selected) !important; }
html.erp-dark [data-tree-pane][data-tree-open] [class*="selected"], html.erp-dark [data-tree-pane][data-tree-open] [class*="selected"] * { color: var(--erp-text-emph, #fff) !important; }
html.erp-dark [data-tree-pane][data-tree-open] [style*="dashed"], html.erp-dark [data-tree-pane][data-tree-open] [class*="line"] { border-color: var(--erp-border) !important; }

/* Phone tab list, dark: enabled tabs read as bright text, disabled ones are dim, italic and crossed out */
html.erp-dark .tab-picker-sheet button:not(:disabled) { color: var(--erp-text-emph) !important; font-weight: 500; }
html.erp-dark .tab-picker-sheet button.active:not(:disabled) { color: var(--action-primary) !important; font-weight: 600; }
html.erp-dark .tab-picker-sheet button:disabled { color: var(--erp-text-muted) !important; opacity: .5; font-style: italic; text-decoration: line-through; }

/* Phone list toolbar: a page's own text (e.g. an item name) must wrap inside the screen, not widen the bar */
@media (max-width: 767.98px) {
    .ListTemplateActionPanel,
    .ListTemplateActionPanel > div,
    .ListTemplateActionPanel > div > div,
    .ListTemplateActionPanel .CustomActionPanel,
    .ListTemplateActionPanel .CustomActionPanel > * { min-width: 0 !important; max-width: 100% !important; box-sizing: border-box; }
    .ListTemplateActionPanel .CustomActionPanel[data-column-count="1"] { grid-template-columns: minmax(0, 1fr) !important; width: 100% !important; }
    .ListTemplateActionPanel .CustomActionPanel p { white-space: normal !important; overflow-wrap: anywhere; word-break: break-word; max-width: 100%; }
}

/* Purchase document footer (payments left, totals right): readable in dark mode, and on a phone the two blocks stack, totals first */
html.erp-dark .InvoiceItemsSummaryRow > span:first-child { color: var(--erp-text-muted); }
html.erp-dark .InvoiceItemsSummaryRow > span:last-child { color: var(--erp-text-emph); }
html.erp-dark .InvoiceItemsSummaryTotal { border-top-color: var(--erp-border); }
html.erp-dark .InvoiceItemsSummaryTotal > span:first-child { color: var(--erp-text-emph); }
html.erp-dark .InvoiceItemsSummaryBlock:first-child { border-right-color: var(--erp-border); }
html.erp-dark .ListFullSummaryContent { border-color: var(--erp-border); }
@media (max-width: 767.98px) {
    .InvoiceItemsSummary { flex-direction: column; gap: 0.5rem; padding-block: 8px; }
    .InvoiceItemsSummaryBlock { width: 100%; }
    .InvoiceItemsSummaryBlock:last-child { order: 1; }
    .InvoiceItemsSummaryBlock:first-child { order: 2; padding-right: 0; padding-top: 8px; border-right: 0; border-top: 1px solid #dfdfdf; }
    html.erp-dark .InvoiceItemsSummaryBlock:first-child { border-top-color: var(--erp-border); }
    .InvoiceItemsSummaryRow > span:first-child { font-size: 0.8125rem; }
    .InvoiceItemsSummaryRow > span:last-child { font-size: 0.9375rem; }
    .InvoiceItemsSummaryTotal > span:last-child { font-size: 1.25rem; }
}

/* Phone: the footer folds to two lines (total with PVM, unpaid sum); the chevron opens every line */
.InvoiceItemsSummaryToggle { display: none; }
@media (max-width: 767.98px) {
    .InvoiceItemsSummary { gap: 2px; padding-block: 4px; position: relative; }
    .InvoiceItemsSummaryBlock { gap: 2px; }
    .InvoiceItemsSummaryBlock:first-child { padding-top: 0; border-top: 0; }
    .InvoiceItemsSummary:not(.open) .InvoiceItemsSummaryRow:not(.InvoiceItemsSummaryTotal):not(.InvoiceItemsSummaryStrong) { display: none; }
    .InvoiceItemsSummary:not(.open) .InvoiceItemsSummaryTotal { margin-top: 0; padding-top: 0; border-top: 0; }
    .InvoiceItemsSummary.open .InvoiceItemsSummaryBlock:first-child { padding-top: 6px; margin-top: 4px; border-top: 1px solid #dfdfdf; }
    html.erp-dark .InvoiceItemsSummary.open .InvoiceItemsSummaryBlock:first-child { border-top-color: var(--erp-border); }
    .InvoiceItemsSummaryToggle { display: flex; order: 3; align-items: center; justify-content: center; width: 100%; height: 22px; border: 0; background: transparent; color: var(--erp-text-muted, #6c757d); cursor: pointer; }
}

/* Phone list cards: the yes/no fields go last, under the other values (and above the expand arrow) */
@media (max-width: 767.98px) {
    tr[data-card-row] > td[data-card-bool]:not([data-card-util]) { order: 5; }
    tr[data-card-row][data-card-more]::after { order: 9; }
}

/* Product technology tree: key field and Filter button share a line; the colour legend is a wrapping row of chips */
.bom-filter { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; max-width: 100%; }
.bom-filter > * { min-width: 0; width: auto !important; max-width: 100%; }
.bom-filter .XTextEdit, .bom-filter .dxbl-text-edit, .bom-filter input { width: 100% !important; min-width: 0 !important; }
.bom-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.bom-legend > div { font-size: 0.8125rem; white-space: nowrap; }
@media (min-width: 768px) {
    .bom-filter { max-width: 40rem; }
}

/* Phone: the technology tree tab is as wide as the screen; the tree scrolls sideways inside its own box */
@media (max-width: 767.98px) {
    .bom-root { width: calc(100vw - 2.75rem); max-width: 100%; box-sizing: border-box; overflow-x: hidden; }
    .bom-root .bom-tree { min-width: 0; max-width: 100%; overflow-x: auto; }
}

/* Technology tree, phone: the action sheet that opens from a tapped row */
.bom-sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 3000; }
.bom-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3001; background: var(--erp-surface, #fff); color: var(--erp-text, #212529); border-radius: 14px 14px 0 0; border-top: 1px solid var(--erp-border, #dfdfdf); padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 -8px 24px rgba(0, 0, 0, .3); }
.bom-sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--erp-border, #ced4da); align-self: center; }
.bom-sheet-title { border-left: 4px solid #7be07b; padding-left: 10px; font-size: 15px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.bom-sheet button { min-height: 52px; border-radius: 8px; font-size: 16px; cursor: pointer; }
.bom-sheet-primary { border: 0; background: var(--action-primary, #0d6efd); color: #fff; font-weight: 600; }
.bom-sheet-secondary { border: 1px solid var(--erp-border, #ced4da); background: var(--erp-hover-neutral, #f1f3f5); color: inherit; }
.bom-sheet-cancel { min-height: 44px !important; border: 0; background: transparent; color: var(--erp-text-muted, #6c757d); font-size: 14px !important; }

/* Technology tree, phone: fully coloured rows that fit the screen width - names wrap, no sideways scrolling */
@media (max-width: 767.98px) {
    .bom-root .bom-tree, .bom-root .bom-tree * { scrollbar-width: none; }
    .bom-root .bom-tree { overflow-x: hidden !important; }
    .bom-root .bom-tree .dxbl-scroll-viewer-content, .bom-root .bom-tree .dxbl-grid, .bom-root .bom-tree .dxbl-treelist { overflow-x: hidden !important; max-width: 100% !important; }
    .bom-root .bom-tree table { width: 100% !important; max-width: 100% !important; table-layout: auto !important; min-width: 0 !important; }
    .bom-root .bom-tree colgroup { display: none; }
    .bom-root .bom-tree td, .bom-root .bom-tree th { white-space: normal !important; overflow-wrap: anywhere; padding: 8px 10px !important; font-size: 14px; line-height: 1.25; }
    .bom-root .bom-tree td:not(:first-child):not(:nth-child(2)) { white-space: nowrap !important; font-size: 12px; }
    .bom-root .bom-tree thead { display: none; }
}

/* Technology tree, phone: every column fits - the name takes what is left, the others get a fixed share */
@media (max-width: 767.98px) {
    .bom-root .bom-tree table { table-layout: fixed !important; }
    .bom-root .bom-tree td:nth-child(2), .bom-root .bom-tree th:nth-child(2) { width: 15% !important; }
    .bom-root .bom-tree td:nth-child(3), .bom-root .bom-tree th:nth-child(3) { width: 23% !important; }
    .bom-root .bom-tree td:nth-child(4), .bom-root .bom-tree th:nth-child(4) { width: 25% !important; }
    .bom-root .bom-tree td:nth-child(n+5), .bom-root .bom-tree th:nth-child(n+5) { display: none; }
    .bom-root .bom-tree td { padding: 8px 6px !important; }
    .bom-root .bom-tree td:not(:first-child) { text-align: right; font-size: 12px; }
}

/* Technology tree, phone: the name cell is a flex row (indent, arrow, text) so the text wraps beside the arrow, not under it */
@media (max-width: 767.98px) {
    .bom-root .bom-tree td { vertical-align: middle !important; }
    .bom-root .bom-tree td:first-child { text-align: left !important; }
    .bom-root .bom-tree td:first-child, .bom-root .bom-tree td:first-child > div { display: flex !important; align-items: center; flex-wrap: nowrap; gap: 4px; min-width: 0; }
    .bom-root .bom-tree td:first-child > div { width: 100%; }
    .bom-root .bom-tree td:first-child .dxbl-btn, .bom-root .bom-tree td:first-child svg { flex: 0 0 auto; }
    .bom-root .bom-tree td:first-child .dxbl-text, .bom-root .bom-tree td:first-child span:last-child { flex: 1 1 0; min-width: 0; text-align: left; }
}

/* Technology tree, phone: names wrap again (the inner text boxes kept the grid's one-line / ellipsis setting) */
@media (max-width: 767.98px) {
    .bom-root .bom-tree td:first-child, .bom-root .bom-tree td:first-child * { white-space: normal !important; text-overflow: clip !important; overflow-wrap: anywhere; }
    .bom-root .bom-tree td:first-child > div, .bom-root .bom-tree td:first-child span { overflow: visible !important; max-height: none !important; height: auto !important; -webkit-line-clamp: unset !important; }
    .bom-root .bom-tree tr, .bom-root .bom-tree td { height: auto !important; }
}

/* Technology tree, phone: a row that opens the action sheet ends in an arrow */
@media (max-width: 767.98px) {
    .bom-root .bom-tree td.bom-openable { cursor: pointer; }
    .bom-root .bom-tree td.bom-openable::after { content: "\203A"; flex: 0 0 auto; margin-left: auto; padding-left: 6px; font-size: 26px; line-height: 1; font-weight: 600; opacity: .65; }
}

/* Technology tree, phone: a row is one coloured block - the name (arrow, indent, text) on the full width, unit / quantity / time running on under it */
@media (max-width: 767.98px) {
    .bom-root .bom-tree table, .bom-root .bom-tree tbody { display: block !important; width: 100% !important; }
    .bom-root .bom-tree tr { display: flex !important; flex-wrap: wrap; align-items: center; width: 100%; }
    .bom-root .bom-tree td, .bom-root .bom-tree td:nth-child(2), .bom-root .bom-tree td:nth-child(3), .bom-root .bom-tree td:nth-child(4) { border: 0 !important; width: auto !important; flex: 0 0 auto; padding: 0 8px 6px !important; text-align: left !important; font-size: 12px; white-space: nowrap !important; }
    .bom-root .bom-tree td:nth-child(4) { flex: 1 1 auto !important; }
    .bom-root .bom-tree td:first-child { flex: 1 1 100% !important; display: flex !important; align-items: flex-start; padding: 8px 8px 2px !important; font-size: 14px; white-space: normal !important; }
    .bom-root .bom-tree td:first-child > div { width: auto !important; flex: 0 0 auto; }
    .bom-root .bom-tree .dxbl-grid-tree-node-indent, .bom-root .bom-tree .dxbl-grid-tree-node-empty-indent { width: 12px !important; min-width: 0 !important; overflow: hidden; }
    .bom-root .bom-tree .dxbl-grid-tree-node-expand-button-placeholder { min-width: 0 !important; }
    .bom-root .bom-tree td.dxbl-grid-empty-cell { display: none !important; }
}

/* Technology tree, phone: the unit / quantity / time line starts under the name text (indent per level + arrow width) */
@media (max-width: 767.98px) {
    .bom-root .bom-tree tr { --bom-lvl: 0; }
    .bom-root .bom-tree tr:has(.dxbl-grid-tree-node-indents-container > :nth-child(1)) { --bom-lvl: 1; }
    .bom-root .bom-tree tr:has(.dxbl-grid-tree-node-indents-container > :nth-child(2)) { --bom-lvl: 2; }
    .bom-root .bom-tree tr:has(.dxbl-grid-tree-node-indents-container > :nth-child(3)) { --bom-lvl: 3; }
    .bom-root .bom-tree tr:has(.dxbl-grid-tree-node-indents-container > :nth-child(4)) { --bom-lvl: 4; }
    .bom-root .bom-tree tr:has(.dxbl-grid-tree-node-indents-container > :nth-child(5)) { --bom-lvl: 5; }
    .bom-root .bom-tree tr:has(.dxbl-grid-tree-node-indents-container > :nth-child(6)) { --bom-lvl: 6; }
    .bom-root .bom-tree tr:has(.dxbl-grid-tree-node-indents-container > :nth-child(7)) { --bom-lvl: 7; }
    .bom-root .bom-tree tr:has(.dxbl-grid-tree-node-indents-container > :nth-child(8)) { --bom-lvl: 8; }
    .bom-root .bom-tree tr:has(.dxbl-grid-tree-node-indents-container > :nth-child(9)) { --bom-lvl: 9; }
    .bom-root .bom-tree tr:has(.dxbl-grid-tree-node-indents-container > :nth-child(10)) { --bom-lvl: 10; }
    .bom-root .bom-tree .dxbl-grid-tree-node-expand-controls-container > :last-child { width: 22px !important; min-width: 22px !important; flex: 0 0 22px !important; }
    .bom-root .bom-tree .dxbl-grid-tree-node-indent, .bom-root .bom-tree .dxbl-grid-tree-node-empty-indent { box-sizing: border-box !important; flex: 0 0 16px !important; width: 16px !important; min-width: 16px !important; max-width: 16px !important; padding: 0 !important; margin: 0 !important; font-size: 0 !important; overflow: hidden; }
    .bom-root .bom-tree td:nth-child(2) { padding-left: calc(var(--bom-off, 70px) + 8px) !important; }
}

/* Technology tree, phone: tighten the value line so its first item sits exactly on the name text's left edge */
@media (max-width: 767.98px) {
    .bom-root .bom-tree td:nth-child(2) { padding-left: calc(var(--bom-off, 70px) + 8px) !important; padding-right: 0 !important; }
    .bom-root .bom-tree td:nth-child(3) { padding-left: 0 !important; padding-right: 12px !important; }
    .bom-root .bom-tree td:nth-child(4) { padding-left: 0 !important; }
}

/* Technology tree, phone: DevExpress's grid-cell padding rule has a long :not() chain and out-ranks the rules above, so the value line's indent is set here with an ID-weight selector */
@media (max-width: 767.98px) {
    .bom-root .bom-tree tr > td:not(#_):first-child { padding: 8px 8px 2px !important; }
    .bom-root .bom-tree tr > td:not(#_):nth-child(2) { padding: 0 0 6px calc(var(--bom-off, 70px) + 14px) !important; }
    .bom-root .bom-tree tr > td:not(#_):nth-child(3) { padding: 0 12px 6px 0 !important; }
    .bom-root .bom-tree tr > td:not(#_):nth-child(4) { padding: 0 8px 6px 0 !important; }
}

/* Areas of activity, phone: the list fills the screen; a tapped row opens its card full screen over it (back arrow / OK return), "+ new" floats */
.af-phone-tools, .af-fab, .af-phone-bar, .af-phone-actions { display: none; }
@media (max-width: 767.98px) {
    .af-split { display: block; }
    .af-phone-tools { display: flex; gap: 8px; padding: 8px; }
    .af-phone-tools .af-btn { flex: 1; height: 44px; font-size: 14px; }
    .af-tree td:not(#_) { padding-top: 10px !important; padding-bottom: 10px !important; font-size: 16px; }
    .af-fab { display: flex; align-items: center; gap: 8px; position: fixed; right: 16px; bottom: 96px; z-index: 1200; height: 56px; padding: 0 20px; border: 0; border-radius: 28px; background: var(--action-primary); color: var(--erp-on-accent, #fff); font-size: 15px; font-weight: 600; box-shadow: 0 6px 18px rgba(0, 0, 0, .45); }
    .af-detail { display: none !important; }
    .af-detail.af-detail--open { display: flex !important; position: fixed; inset: 0; z-index: 3000; gap: 16px; padding: 0 16px 16px; border: 0; border-radius: 0; overflow: auto; background: var(--erp-surface, #fff); }
    .af-detail .af-head, .af-detail .af-detail__hint, .af-detail .af-detail__title { display: none; }
    .af-phone-bar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 1; flex: none; height: 56px; margin: 0 -16px; padding: 0 8px; border-bottom: 1px solid var(--erp-border, #dfdfdf); background: var(--erp-strip, #fff); }
    .af-phone-back { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; background: transparent; color: inherit; }
    .af-phone-bar__title { flex: 1; min-width: 0; font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .af-detail .af-field > span { font-size: 13px; }
    .af-detail .af-field input:not(#_), .af-detail .af-field select:not(#_) { height: 52px; padding: 0 14px; font-size: 16px; border-radius: 10px; }
    .af-detail .af-field textarea:not(#_) { min-height: 120px; padding: 12px 14px; font-size: 16px; border-radius: 10px; }
    .af-detail .af-check { min-height: 56px; gap: 14px; font-size: 16px; }
    .af-detail .af-check input { width: 24px; height: 24px; }
    .af-phone-actions { display: flex; gap: 12px; position: sticky; bottom: 0; margin: auto -16px -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--erp-border, #dfdfdf); background: var(--erp-strip, #fff); }
    .af-phone-actions .af-btn { height: 52px; flex: 1; font-size: 16px; border-radius: 12px; }
}

/* Document types, phone: same full-screen card as the areas of activity; the form's two-column row stacks */
@media (max-width: 767.98px) {
    .DocTypes .dt-chips { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
    .DocTypes .dt-chips .tl-chip { margin-left: 0; }
    .af-detail .af-row { grid-template-columns: minmax(0, 1fr); }
    .af-detail .af-pop { position: static; }
    .af-detail .af-inline .af-btn { height: 52px; }
}

/* Phone cards: the edit / delete icon rule (svg 20px + 10px padding) also matched the tick inside the check box, making it 40px and drawing it 14px right and 15px down from its box; the tick gets its own size and the box centres it */
@media (max-width: 767.98px) {
    tr[data-card-row] > td .dxbl-checkbox-check-element { position: relative; display: flex; align-items: center; justify-content: center; }
    tr[data-card-row] > td .dxbl-checkbox-check-element > input[type="checkbox"] { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; margin: 0 !important; opacity: 0; }
    tr[data-card-row] > td .dxbl-checkbox-unchecked .dxbl-checkbox-check-element .dxbl-image { display: none !important; }
    tr[data-card-row] > td .dxbl-checkbox-check-element .dxbl-image { display: flex; align-items: center; justify-content: center; width: auto !important; height: auto !important; margin: 0 !important; line-height: 0; }
    tr[data-card-row] > td .dxbl-checkbox-check-element svg { display: block; width: 12px !important; height: 12px !important; padding: 0 !important; margin: 0 !important; box-sizing: border-box !important; }
    tr[data-card-row] > td[data-card-util] .dxbl-checkbox-check-element { width: 22px !important; height: 22px !important; }
    tr[data-card-row] > td[data-card-util] .dxbl-checkbox-check-element svg { width: 16px !important; height: 16px !important; }
}

/* User group form, phone: the three cards are tabs; a component's rights (permissions + fields) open full screen over the tree */
.ug-tabs, .ug-phone-bar { display: none; }
@media (max-width: 767.98px) {
    .ug-tabs { display: flex; position: sticky; top: 0; z-index: 5; margin: 0 0 12px; border-bottom: 1px solid var(--erp-border, #dfdfdf); background: var(--erp-strip, #fff); }
    .ug-tab { flex: 1; min-width: 0; min-height: 48px; padding: 0 4px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--erp-text-muted, #6c757d); font: inherit; font-size: 13px; font-weight: 600; line-height: 1.15; }
    .ug-tab.is-active { color: var(--action-primary); border-bottom-color: var(--action-primary); }
    .ug-split { display: block; }
    .ug[data-tab="0"] .ug-card--rights, .ug[data-tab="0"] .ug-right,
    .ug[data-tab="1"] .ug-card--group, .ug[data-tab="1"] .ug-right,
    .ug[data-tab="2"] .ug-left { display: none; }
    .ug-card--group .ug-card__title, .ug-card--rights .ug-card__title, .ug-right > .ug-card__title { display: none; }
    .ug-card--rights chbox, .ug-card--rights .dxbl-checkbox { min-height: 48px; }
    .ug-card--rights .ug-group { margin-top: 14px; }
    .ug-right__body { display: block; margin: 0 -14px -14px; }
    .ug-tree { max-height: none; padding: 4px 0; border: 0; }
    .ug-detail { display: none; }
    .ug-detail.ug-detail--open { display: block; position: fixed; inset: 0; z-index: 3000; overflow: auto; padding: 0 16px 24px; background: var(--erp-surface, #fff); color: var(--erp-text, inherit); }
    .ug-detail__title, .ug-hint { display: none; }
    .ug-phone-bar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 2; height: 56px; margin: 0 -16px 12px; padding: 0 8px; border-bottom: 1px solid var(--erp-border, #dfdfdf); background: var(--erp-strip, #fff); }
    .ug-phone-back { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; background: transparent; color: inherit; }
    .ug-phone-bar__title { flex: 1; min-width: 0; font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .ug-phone-ok { flex: none; height: 44px; padding: 0 20px; border: 0; border-radius: 12px; background: var(--action-primary); color: var(--erp-on-accent, #fff); font: inherit; font-size: 15px; font-weight: 600; }
    .ug-perms__grid chbox, .ug-perms__grid .dxbl-checkbox { min-height: 48px; }
    .ug-fields-head { flex-wrap: wrap; gap: 8px; }
    .ug-counts { flex-wrap: wrap; font-size: 12px; }
    .ug-count { padding: 4px 10px; }
    .ug-bulk { gap: 8px; }
    .ug-bulk > span { flex: 1 1 100%; }
    .ug-bulk .ug-btn { flex: 1 1 0; min-height: 44px; }
    .ug-field { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
    .ug-field__name { flex: 1 1 0; font-size: 16px; }
    .ug-order .ug-btn--icon { width: 44px; height: 44px; }
    .ug-seg { display: flex; flex: 1 1 100%; }
    .ug-seg__btn { flex: 1; min-height: 44px; font-size: 14px; }
}

/* Settings hub, phone: the title and text use the full width with the filter under them, and the tile list has no height limit of its own: the form's scroll area scrolls it, so nothing is left between the list and the save bar */
@media (max-width: 767.98px) {
    .cfg-hub__head { flex-direction: column; align-items: stretch; gap: 12px; }
    .cfg-hub__head > div { width: 100%; }
    .cfg-hub__search { width: 100%; height: 48px; font-size: 16px; }
    .cfg-hub { max-height: none; overflow: visible; padding-right: 4px; }
}

/* Phone: the save / close bar is just its two buttons, without a bar behind them */
@media (max-width: 767.98px) {
    .save-panel-holder { background: transparent !important; border-top: 0 !important; box-shadow: none !important; padding: 0 !important; }
    .innerform-savepanel { padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom)) !important; background: transparent !important; }
}

/* Settings page header, phone: the back button stays on one line and tall enough for its text */
@media (max-width: 767.98px) {
    .cfg-back { flex: none; height: auto; min-height: 44px; padding: 0 14px; font-size: 14px; white-space: nowrap; }
}

/* Monitoring TV on a phone: the TV's fixed grid of lanes becomes one scrolling page - sticky header with the counters, lane chips, every lane stacked, one card per person with the operation text wrapping instead of running as a ticker */
.MonitoringTvChips { display: none; }
@media (max-width: 767.98px) {
    .MonitoringTv { overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px; gap: 12px; font-size: 15px; }
    .MonitoringTv .MonitoringTvHeader { position: sticky; top: 0; z-index: 5; flex: none; flex-wrap: wrap; align-items: center; gap: 8px 10px; height: auto; padding: 10px 12px; }
    .MonitoringTv .MonitoringTvTitle { order: 1; flex: 1 1 0; }
    .MonitoringTv .MonitoringTvName { font-size: 20px; }
    .MonitoringTv .MonitoringTvClock { order: 2; font-size: 28px; }
    .MonitoringTv .MonitoringTvExit { order: 3; width: 44px; height: 44px; }
    .MonitoringTv .MonitoringTvSpacer { order: 4; flex: 1 1 100%; height: 0; }
    .MonitoringTv .MonitoringTvKpi { order: 5; flex: 1 1 0; min-width: 0; padding: 8px 10px; background: #f6f7f9; border: 1px solid #e4e8ee; border-radius: 10px; }
    .MonitoringTv .MonitoringTvKpi { overflow: hidden; }
    .MonitoringTv .MonitoringTvKpiLabel { font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
    .MonitoringTv .MonitoringTvKpiValue { font-size: 20px; overflow: hidden; text-overflow: ellipsis; }
    .MonitoringTv .MonitoringTvKpiDivider { display: none; }
    .MonitoringTv .MonitoringTvChips { display: flex; flex: none; gap: 8px; overflow-x: auto; scrollbar-width: none; }
    .MonitoringTv .MonitoringTvPill { flex: none; height: 40px; padding: 0 16px; border: 1px solid #c9d0da; border-radius: 20px; background: #fff; color: #2b2f3a; font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; }
    .MonitoringTv .MonitoringTvPill.is-active { background: #2b2f3a; border-color: #2b2f3a; color: #fff; }
    .MonitoringTv .MonitoringTvEmpty { flex: none; padding: 28px 20px; font-size: 18px; text-align: center; }
    .MonitoringTv .MonitoringTvLanes { display: grid; flex: none; grid-template-columns: minmax(0, 1fr) !important; gap: 12px; }
    .MonitoringTv .MonitoringTvLane { overflow: visible; }
    .MonitoringTv .MonitoringTvLaneHead { padding: 12px 14px; }
    .MonitoringTv .MonitoringTvLaneTitle h2 { font-size: 19px; }
    .MonitoringTv .MonitoringTvLaneBody { display: flex; flex-direction: column; grid-template-columns: none !important; grid-template-rows: none !important; }
    .MonitoringTv .MonitoringTvLaneBody .MonitoringTvCard { justify-content: flex-start; gap: 6px; padding: 12px 14px; border-width: 0 0 1px 0; }
    .MonitoringTv .MonitoringTvCardName { font-size: 17px; }
    .MonitoringTv .MonitoringTvCardInfo { white-space: normal; }
    .MonitoringTv .MonitoringTvCardInfo > span { display: block; animation: none; transform: none; }
    .MonitoringTv .MonitoringTvCardTimes { flex-wrap: wrap; white-space: normal; gap: 4px 12px; }
}

/* Monitoring TV on a phone, dark theme: the counters and lane chips follow the theme instead of the light TV colours */
@media (max-width: 767.98px) {
    html.erp-dark .MonitoringTv .MonitoringTvKpi { background: var(--erp-strip); border-color: var(--erp-border); }
    html.erp-dark .MonitoringTv .MonitoringTvPill { background: var(--erp-surface); border-color: var(--erp-border-editor); color: var(--erp-text); }
    html.erp-dark .MonitoringTv .MonitoringTvPill.is-active { background: var(--action-primary); border-color: var(--action-primary); color: var(--erp-on-accent, #0b1220); }
}

/* Timesheet, phone: the four totals are compact (label and value on one line) and a slim bar folds them away */
.tt2-kpi-toggle { display: none; }
@media (max-width: 767.98px) {
    .tt2-kpi-toggle { display: flex; align-items: center; justify-content: center; width: 100%; height: 28px; padding: 0; border: 0; background: transparent; color: var(--erp-text-muted, #6c757d); }
    .tt2-kpis { gap: 6px; }
    .tt2-kpis.tt2-kpis--hidden { display: none; }
    .tt2-kpi { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; }
    .tt2-kpi span { font-size: 11px; line-height: 1.15; }
    .tt2-kpi b { font-size: 18px; line-height: 1.1; }
    .tt2.tt2-has-sel .tt2-kpi-toggle { display: none; }
}

/* Timesheet table (Bendra lentele), phone: a narrow pinned name and total, 44px day columns with the weekday under the date, so about six days show at once */
.tt2-ov-dow { display: none; }
@media (max-width: 767.98px) {
    .tt2-overview { max-height: calc(100dvh - 15rem); }
    .tt2-ov { font-size: 11px; }
    .tt2-ov th, .tt2-ov td { min-width: 44px; width: 44px; }
    .tt2-ov thead th { padding: 4px 0; line-height: 1.15; }
    .tt2-ov-dow { display: block; font-size: 10px; font-weight: 500; opacity: .7; }
    .tt2-ov .tt2-ov-name { width: 96px; min-width: 96px; max-width: 96px; padding: 6px 8px; font-size: 13px; line-height: 1.2; white-space: normal; text-overflow: clip; overflow-wrap: anywhere; }
    .tt2-ov .tt2-ov-name small { font-size: 11px; }
    .tt2-ov thead .tt2-ov-name { font-size: 12px; }
    .tt2-ov .tt2-ov-sum { width: 56px; min-width: 56px; padding: 0 4px; font-size: 12px; }
    .tt2-ov-cell { min-height: 44px; font-size: 11px; font-weight: 600; }
}

/* Attendance, phone: the two selects share a row under the search box, and the status columns stack with every card showing - the page scrolls, not each column inside a box that cut them to one card */
@media (max-width: 767.98px) {
    #AttendanceFilterSelectionPanel { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
    #AttendanceFilterSelectionPanel > [data-column-count]:not(.hidden) { display: contents !important; }
    #AttendanceFilterSelectionPanel > [data-column-count]:first-child > :first-child { grid-column: 1 / -1; }
    .att { flex: none; min-height: auto; }
    .att-board { display: flex; flex-direction: column; flex: none; gap: 10px; overflow: visible; }
    .att-col { flex: none; min-height: auto; overflow: visible; padding: 8px; gap: 8px; }
    .att-col-head { position: static; padding: 8px 12px; }
    .att-col-head b { font-size: 1.25rem; }
    .att-board .att-card { animation: none; }
    .att-path { white-space: normal; }
    .att-path > span { display: block; animation: none; transform: none; }
}
