/* Scan360 ERP ? design system (SaaS/B2B) */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --erp-font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
    --erp-bg: #f3f7f8;
    --erp-page-bg: #f3f7f8;
    --erp-surface: #ffffff;
    --erp-surface-elevated: #ffffff;
    --erp-surface-2: #f7fafb;
    --erp-border: #d9e3e5;
    --erp-border-strong: #c5d2d5;
    --erp-text: #102a2d;
    --erp-text-primary: #102a2d;
    --erp-text-secondary: #475569;
    --erp-text-muted: #64777c;
    --erp-muted: #64777c;
    /* Brand tokens (overridden at runtime by ThemeStyle from Theme.* settings) */
    --erp-primary: #087f7b;
    --erp-primary-hover: #066c69;
    --erp-primary-pressed: #055a57;
    --erp-primary-subtle: #e4f5f3;
    --erp-primary-fg: #ffffff;
    --erp-accent: #0aa39e;
    --erp-accent-hover: #066c69;
    --erp-accent-soft: #e4f5f3;
    /* Semantic status ? not configurable via Branding V1 */
    --erp-danger: #b42318;
    --erp-danger-soft: #fef3f2;
    --erp-warning: #9a6700;
    --erp-warning-soft: #fff8e1;
    --erp-success: #059669;
    --erp-success-soft: #d1fae5;
    --erp-info: #2563eb;
    --erp-info-soft: #dbeafe;
    --erp-sidebar: #082d2f;
    --erp-sidebar-bg: #082d2f;
    --erp-sidebar-text: #c5d5d7;
    --erp-sidebar-text-muted: #829296;
    --erp-sidebar-muted: #829296;
    --erp-sidebar-active: #e4f5f3;
    --erp-sidebar-active-bg: #e4f5f3;
    --erp-sidebar-active-text: #056c68;
    --erp-sidebar-hover-bg: #0d3a3d;
    --erp-sidebar-hover-text: #f8fafc;
    /* Content tabs / segments ? primary teal pill; never reuse sidebar (can be light) */
    --erp-tab-active-bg: #087f7b;
    --erp-tab-active-fg: #ffffff;
    /* Density tokens ? Nordic Pro defaults (FOUC baseline; ThemeStyle overrides per profile) */
    --erp-sidebar-width: 248px;
    --erp-sidebar-item-height: 2.4rem;
    --erp-sidebar-item-gap: 0.15rem;
    --erp-sidebar-group-gap: 0.65rem;
    --erp-topbar-height: 52px;
    --erp-page-padding-x: 1.15rem;
    --erp-page-padding-y: 0.9rem;
    --erp-page-section-gap: 0.95rem;
    --erp-card-padding: 1rem;
    --erp-card-header-padding: 0.7rem 1rem;
    --erp-card-radius: 8px;
    --erp-card-border-width: 1px;
    --erp-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    --erp-control-height: 2.35rem;
    --erp-control-padding-x: 0.65rem;
    --erp-control-radius: 6px;
    --erp-button-height: 2.3rem;
    --erp-button-padding-x: 0.8rem;
    --erp-button-radius: 6px;
    --erp-tab-height: 2.1rem;
    --erp-tab-padding-x: 0.8rem;
    --erp-tab-gap: 0.12rem;
    --erp-tab-radius: 7px;
    --erp-tab-bar-radius: 10px;
    --erp-table-row-height: 2.4rem;
    --erp-table-cell-padding-x: 0.7rem;
    --erp-table-cell-padding-y: 0.38rem;
    --erp-form-row-gap: 0.8rem;
    --erp-form-column-gap: 0.95rem;
    --erp-modal-width: 36rem;
    --erp-modal-width-sm: 28rem;
    --erp-modal-width-lg: 42rem;
    --erp-modal-header-padding: 0.85rem 1.1rem;
    --erp-modal-body-padding: 1rem 1.1rem;
    --erp-modal-footer-padding: 0.75rem 1.1rem;
    --erp-modal-section-gap: 0.95rem;
    --erp-modal-radius: var(--erp-card-radius, 8px);
    --erp-modal-shadow: var(--erp-card-shadow, 0 1px 2px rgba(15, 23, 42, 0.04));
    --erp-helper-font-size: var(--erp-font-size-sm, 0.8125rem);
    --erp-label-gap: 0.35rem;
    --erp-font-size-base: 14px;
    --erp-font-size-sm: 0.8125rem;
    --erp-heading-scale: 1;
    --erp-focus-ring-size: 3px;
    --erp-feed-item-padding-y: 0.8rem;
    --erp-toolbar-gap: 0.5rem;
    --erp-stat-padding: 0.75rem 0.9rem;
    --erp-stat-gap: 0.7rem;
    --erp-badge-radius: 6px;
    --erp-sidebar-link-padding-y: 0.4rem;
    --erp-sidebar-link-padding-x: 0.65rem;
    --erp-sidebar-link-gap: 0.6rem;
    --erp-control-padding-y: 0.35rem;
    --erp-border-emphasis: 1px;
    --erp-radius: 8px;
    --erp-radius-sm: 5px;
    --erp-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    --erp-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.06);
    --erp-shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.08);
    --erp-page-max: 1240px;
    --erp-header-h: var(--erp-topbar-height);
    --erp-sidebar-w: var(--erp-sidebar-width);
    --erp-sidebar-w-collapsed: 68px;
    --erp-space-1: 0.25rem;
    --erp-space-2: 0.5rem;
    --erp-space-3: 0.7rem;
    --erp-space-4: 0.95rem;
    --erp-space-5: 1.35rem;
    --erp-space-6: 1.85rem;
    --erp-transition: 160ms ease;
    --erp-type-page: 1.4rem;
    --erp-type-section: 0.95rem;
    --erp-type-card: 0.82rem;
    --erp-type-label: 0.7rem;
    --erp-type-meta: 0.78rem;
}

/* Auth resolving state (AuthorizeRouteView Authorizing ? no layout yet) */
.auth-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
    margin: 0;
    color: var(--erp-muted);
    font-size: 0.95rem;
    font-family: var(--erp-font);
}

html, body {
    height: 100%;
    margin: 0;
    font-family: var(--erp-font);
    color: var(--erp-text);
    background: var(--erp-page-bg, var(--erp-bg));
    font-size: var(--erp-font-size-base, 14px);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

@media (min-width: 641px) {
    html, body {
        overflow: hidden;
    }
}

/* Sidebar nav ? strict vertical list (global; beats Blazor isolation / Bootstrap wrap) */
.sidebar .nav-root,
.sidebar .nav-group {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    width: 100%;
    min-width: 0;
}
.sidebar .nav-root { gap: 0; }
.sidebar .nav-group { gap: 0; }
.sidebar .nav-group-label {
    display: block;
    width: 100%;
    flex: 0 0 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar .nav-link,
.sidebar a.nav-link {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: flex-start;
    width: 100% !important;
    max-width: 100%;
    flex: 0 0 auto;
    float: none !important;
    clear: both;
    min-height: var(--erp-sidebar-item-height, 2.5rem);
    padding: var(--erp-sidebar-link-padding-y, 0.4rem) var(--erp-sidebar-link-padding-x, 0.65rem);
    line-height: 1.2;
    border-radius: var(--erp-control-radius, var(--erp-radius-sm));
    box-sizing: border-box;
    font-size: var(--erp-font-size-sm, 0.875rem);
    gap: var(--erp-sidebar-link-gap, 0.6rem);
    margin-bottom: var(--erp-sidebar-item-gap, 0.2rem);
}
.sidebar .nav-link span,
.sidebar a.nav-link span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.sidebar .nav-link.active,
.sidebar a.nav-link.active {
    font-weight: 600;
    border-radius: var(--erp-control-radius, var(--erp-radius-sm));
}
@media (max-width: 640.98px) {
    .sidebar .nav-link,
    .sidebar a.nav-link {
        min-height: max(44px, var(--erp-sidebar-item-height, 2.5rem));
    }
}

h1, h2, h3, h4, .h1, .h2, .h3, .h4 {
    font-family: var(--erp-font);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--erp-text);
}

a { color: var(--erp-primary, var(--erp-accent)); text-decoration: none; }
a:hover { color: var(--erp-primary-hover, var(--erp-accent-hover)); }

/* ??? Bootstrap overrides ??? */
.btn {
    font-family: var(--erp-font);
    font-weight: 550;
    border-radius: var(--erp-button-radius, var(--erp-radius-sm));
    padding: var(--erp-control-padding-y, 0.35rem) var(--erp-button-padding-x, 0.85rem);
    min-height: var(--erp-button-height, 2.35rem);
    font-size: var(--erp-font-size-sm, 0.875rem);
    transition: background var(--erp-transition), border-color var(--erp-transition), color var(--erp-transition), box-shadow var(--erp-transition);
}
.btn:focus-visible {
    outline: var(--erp-focus-ring-size, 3px) solid color-mix(in srgb, var(--erp-primary) 45%, transparent);
    outline-offset: 2px;
}

.btn-primary {
    color: var(--erp-primary-fg, #fff);
    background-color: var(--erp-primary, var(--erp-accent));
    border-color: var(--erp-primary, var(--erp-accent));
}
.btn-primary:hover, .btn-primary:focus {
    color: var(--erp-primary-fg, #fff);
    background-color: var(--erp-primary-hover, var(--erp-accent-hover));
    border-color: var(--erp-primary-hover, var(--erp-accent-hover));
}
.btn-primary:active {
    color: var(--erp-primary-fg, #fff);
    background-color: var(--erp-primary-pressed, var(--erp-primary-hover));
    border-color: var(--erp-primary-pressed, var(--erp-primary-hover));
}

.btn-outline-primary {
    color: var(--erp-primary, var(--erp-accent));
    border-color: var(--erp-primary-subtle, #99f6e4);
    background: #fff;
}
.btn-outline-primary:hover {
    color: var(--erp-primary-fg, #fff);
    background: var(--erp-primary, var(--erp-accent));
    border-color: var(--erp-primary, var(--erp-accent));
}

.btn-outline-secondary {
    color: var(--erp-text-secondary);
    border-color: var(--erp-border-strong);
    background: #fff;
}
.btn-outline-secondary:hover {
    background: var(--erp-surface-2);
    border-color: var(--erp-border-strong);
    color: var(--erp-text);
}

.btn-outline-danger {
    color: var(--erp-danger);
    border-color: #fecaca;
    background: #fff;
}
.btn-outline-danger:hover {
    background: var(--erp-danger);
    border-color: var(--erp-danger);
    color: #fff;
}

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8125rem; }

.btn:focus, .btn:active:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--erp-primary, #087f7b) 22%, transparent);
}

/* Use background-color (not shorthand) so Bootstrap keeps background-clip/select chevron. */
.form-control, .form-select {
    border-color: var(--erp-border-strong);
    border-radius: var(--erp-control-radius, var(--erp-radius-sm));
    font-size: var(--erp-font-size-sm, 0.875rem);
    min-height: var(--erp-control-height, 2.4rem);
    padding: var(--erp-control-padding-y, 0.35rem) var(--erp-control-padding-x, 0.7rem);
    background-color: #fff;
    background-clip: padding-box;
    box-shadow: none;
    box-sizing: border-box;
}
.form-control-sm,
.input-group-sm > .form-control,
.input-group-sm > .form-select {
    min-height: calc(1.5em + 0.5rem + 2px);
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
    border-radius: var(--erp-radius-sm);
}
.form-control:disabled, .form-select:disabled {
    background-color: var(--erp-surface-2);
    color: var(--erp-muted);
}
/* Keep currency/unit addons on one line; cramped tables used to wrap DKK under the input. */
.input-group {
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
    min-width: 0;
}
.input-group > .form-control,
.input-group > .form-select {
    min-width: 0;
    position: relative;
    z-index: 1;
}
.input-group-text {
    background-color: var(--erp-surface-2);
    border-color: var(--erp-border-strong);
    color: var(--erp-muted);
    white-space: nowrap;
}
/* Re-assert connected radii ? our .form-control radius must not float as a second box. */
.input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    margin-left: calc(-1 * var(--bs-border-width, 1px));
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.input-group > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--erp-text-secondary);
    margin-bottom: 0.3rem;
}

/* Bootstrap Icons: keep glyph font even if body font / Leaflet CSS loads later */
.bi::before,
[class^="bi-"]::before,
[class*=" bi-"]::before {
    font-family: "bootstrap-icons" !important;
    font-style: normal;
    font-weight: normal !important;
    speak: never;
}

.table {
    font-size: 0.875rem;
    --bs-table-bg: transparent;
}
.table > :not(caption) > * > * {
    padding: var(--erp-table-cell-padding-y, 0.4rem) var(--erp-table-cell-padding-x, 0.75rem);
    border-bottom-color: var(--erp-border);
    vertical-align: middle;
    height: var(--erp-table-row-height, auto);
}
.table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--erp-muted);
    font-weight: 600;
    background: var(--erp-surface-2);
    border-bottom: 1px solid var(--erp-border);
    white-space: nowrap;
}

.alert {
    border-radius: var(--erp-radius);
    border: 1px solid transparent;
    font-size: 0.875rem;
    overflow-wrap: break-word;
    word-wrap: break-word;
}
.alert-danger { background: var(--erp-danger-soft); border-color: #fecaca; color: #991b1b; }
.alert-success { background: var(--erp-success-soft); border-color: #a7f3d0; color: #065f46; }
.alert-warning { background: var(--erp-warning-soft); border-color: #fde68a; color: #92400e; }

/* ??? Page shell ??? */
.erp-page {
    max-width: var(--erp-page-max);
    margin: 0 auto;
    padding-bottom: var(--erp-space-2, 0.5rem);
}

.erp-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--erp-page-section-gap, 1rem);
    margin-bottom: var(--erp-page-section-gap, 1.25rem);
    padding-bottom: var(--erp-page-section-gap, 1rem);
    border-bottom: var(--erp-border-emphasis, 1px) solid var(--erp-border);
}

.erp-page-header.sticky {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--erp-page-bg, var(--erp-bg)) 92%, white);
    backdrop-filter: blur(8px);
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    padding: var(--erp-space-3, 0.75rem) 0.25rem;
    border-bottom: var(--erp-border-emphasis, 1px) solid var(--erp-border);
}

.erp-page-title {
    font-size: calc(var(--erp-type-page, 1.4rem) * var(--erp-heading-scale, 1));
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: var(--erp-space-3, 0.65rem);
    flex-wrap: wrap;
    color: var(--erp-text);
}

.erp-page-subtitle {
    color: var(--erp-muted);
    font-size: var(--erp-font-size-sm, 0.875rem);
    margin-top: var(--erp-space-1, 0.25rem);
    line-height: 1.4;
}

.erp-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--erp-toolbar-gap, 0.65rem);
}
.erp-actions-primary { display: flex; flex-wrap: wrap; gap: var(--erp-toolbar-gap, 0.5rem); }
.erp-actions-secondary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--erp-space-2, 0.4rem);
    padding-left: var(--erp-space-3, 0.65rem);
    margin-left: 0.15rem;
    border-left: var(--erp-border-emphasis, 1px) solid var(--erp-border);
}

/* ??? Summary stats ??? */
.erp-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--erp-stat-gap, 0.75rem);
    margin-bottom: var(--erp-page-section-gap, 1.25rem);
}
@media (min-width: 768px) {
    .erp-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
    .erp-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.erp-stat {
    background: var(--erp-surface);
    border: var(--erp-border-emphasis, 1px) solid var(--erp-border);
    border-radius: var(--erp-card-radius, var(--erp-radius));
    padding: var(--erp-stat-padding, 0.85rem 1rem);
    box-shadow: var(--erp-card-shadow, var(--erp-shadow));
    min-width: 0;
}
.erp-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--erp-muted);
    margin-bottom: 0.25rem;
}
.erp-stat-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--erp-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.erp-stat-value.lg { font-size: 1.35rem; letter-spacing: -0.02em; }
.erp-stat.warn .erp-stat-value { color: var(--erp-danger); }
.erp-stat.accent .erp-stat-value { color: var(--erp-accent); }

/* ??? Cards / sections ??? */
.erp-section-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--erp-page-section-gap, 1rem);
    /* Content-height cards ? avoid Bootstrap-style equal-height empty panels */
    align-items: start;
}
.erp-section-grid > * { min-width: 0; }
.erp-section-stack {
    display: flex;
    flex-direction: column;
    gap: var(--erp-page-section-gap, 1rem);
    min-width: 0;
}
@media (min-width: 900px) {
    .erp-section-grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .erp-section-grid.aside { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
    .erp-section-grid.form-main { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
}

.erp-card {
    background: var(--erp-surface);
    border: var(--erp-card-border-width, 1px) solid var(--erp-border);
    border-radius: var(--erp-card-radius, var(--erp-radius));
    box-shadow: var(--erp-card-shadow, var(--erp-shadow));
    overflow: hidden;
    min-width: 0;
    height: auto;
    align-self: start;
}
.erp-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--erp-toolbar-gap, 0.75rem);
    padding: var(--erp-card-header-padding, 0.8rem 1.05rem);
    border-bottom: var(--erp-border-emphasis, 1px) solid var(--erp-border);
    background: var(--erp-surface-2);
}
.erp-card-title {
    font-size: calc(var(--erp-type-card, 0.82rem) * var(--erp-heading-scale, 1));
    font-weight: 650;
    margin: 0;
    letter-spacing: -0.01em;
}
.erp-card-body { padding: var(--erp-card-padding, 1.05rem); min-width: 0; overflow-wrap: break-word; }
.erp-card-body.compact { padding: calc(var(--erp-card-padding, 1.05rem) * 0.85); }
.erp-card-footer {
    padding: var(--erp-card-header-padding, 0.75rem 1.1rem);
    border-top: 1px solid var(--erp-border);
    background: var(--erp-surface-2);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.erp-field-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--erp-form-row-gap, 0.85rem) var(--erp-form-column-gap, 1rem);
}
.erp-field-grid > * { min-width: 0; }
@media (min-width: 640px) {
    .erp-field-grid.cols-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .erp-field-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .erp-field-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.erp-field-grid .span-2,
.erp-field-grid .span-3,
.erp-field-grid .span-4 { grid-column: 1 / -1; }
@media (min-width: 640px) {
    .erp-field-grid.cols-3 .span-2,
    .erp-field-grid.cols-4 .span-2 { grid-column: span 2; }
    .erp-field-grid.cols-3 .span-3,
    .erp-field-grid.cols-4 .span-3 { grid-column: span 3; }
    .erp-field-grid.cols-4 .span-4 { grid-column: 1 / -1; }
}

/* Field width semantics ? constrain short codes without stretching the grid cell */
.erp-field-w-xs { max-width: 5.5rem; }
.erp-field-w-sm { max-width: 9rem; }
.erp-field-w-md { max-width: 14rem; }
.erp-field-w-lg { max-width: 22rem; }
.erp-field-w-xl { max-width: 32rem; }

.erp-color-field {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.erp-color-field .form-control:not(.form-control-color) {
    flex: 1 1 8rem;
    min-width: 0;
    max-width: 12rem;
}
.form-control-color {
    width: 3rem;
    height: var(--erp-control-height, 2.4rem);
    padding: 0.15rem;
    flex: 0 0 auto;
}

.erp-logo-preview {
    background: var(--erp-sidebar-bg, #0B1220);
    padding: 0.65rem 0.85rem;
    border-radius: var(--erp-radius-sm);
    display: inline-flex;
    align-items: center;
    max-width: 100%;
}
.erp-logo-preview img {
    height: 28px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
}

.erp-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.85rem;
    color: var(--erp-text-secondary);
    font-size: 0.875rem;
}

/* ??? Tabs ??? */
.erp-tabs {
    display: flex;
    gap: var(--erp-tab-gap, 0.15rem);
    overflow-x: auto;
    padding: 0.2rem;
    margin-bottom: var(--erp-page-section-gap, 1.1rem);
    background: var(--erp-surface);
    border: var(--erp-border-emphasis, 1px) solid var(--erp-border);
    border-radius: var(--erp-tab-bar-radius, 10px);
    box-shadow: var(--erp-card-shadow, var(--erp-shadow));
    -webkit-overflow-scrolling: touch;
}
.erp-tab {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--erp-muted);
    font-family: var(--erp-font);
    font-size: var(--erp-font-size-sm, 0.8125rem);
    font-weight: 550;
    min-height: var(--erp-tab-height, 2.2rem);
    padding: 0.35rem var(--erp-tab-padding-x, 0.85rem);
    border-radius: var(--erp-tab-radius, 7px);
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--erp-transition), color var(--erp-transition);
}
.erp-tab:hover { color: var(--erp-text); background: var(--erp-surface-2); }
.erp-tab.active {
    color: var(--erp-tab-active-fg, var(--erp-primary-fg, #fff));
    background: var(--erp-tab-active-bg, var(--erp-primary, #087f7b));
    box-shadow: var(--erp-card-shadow, var(--erp-shadow));
    font-weight: 700;
}

/* ??? Badges (soft pills / profile radius) ??? */
.erp-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.65rem;
    border-radius: var(--erp-badge-radius, 6px);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.3;
    border: 1px solid transparent;
    white-space: nowrap;
}
.erp-badge-neutral { background: #f3f4f6; color: #374151; border-color: transparent; }
.erp-badge-draft { background: #f3f4f6; color: #4b5563; border-color: transparent; }
.erp-badge-new { background: var(--erp-info-soft); color: #1d4ed8; border-color: transparent; }
.erp-badge-planned { background: #e0e7ff; color: #3730a3; border-color: transparent; }
.erp-badge-progress { background: var(--erp-warning-soft); color: #92400e; border-color: transparent; }
.erp-badge-ready { background: var(--erp-primary-subtle, var(--erp-accent-soft)); color: #056c68; border-color: transparent; }
.erp-badge-success { background: var(--erp-success-soft); color: #065f46; border-color: transparent; }
.erp-badge-warning { background: var(--erp-warning-soft); color: #92400e; border-color: transparent; }
.erp-badge-info { background: var(--erp-info-soft); color: #1d4ed8; border-color: transparent; }
.erp-badge-danger { background: var(--erp-danger-soft); color: #912018; border-color: transparent; }
.erp-badge-dark { background: #1f2937; color: #f9fafb; border-color: transparent; }
.erp-badge-overdue { background: var(--erp-danger-soft); color: #912018; border-color: transparent; }
.erp-badge-muted {
    background: var(--erp-surface-2);
    color: var(--erp-text-secondary);
    border-color: var(--erp-border);
}

.erp-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.erp-feed {
    margin: 0;
    padding: 0;
}

.erp-feed-item {
    padding: var(--erp-feed-item-padding-y, 0.85rem) 0;
    border-bottom: 1px solid var(--erp-border);
}

.erp-feed-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.erp-feed-item:first-child {
    padding-top: 0;
}

/* ??? Kanban ??? */
.erp-kanban {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
    align-items: start;
}
@media (min-width: 768px) {
    .erp-kanban.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .erp-kanban.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.erp-kanban-col {
    background: var(--erp-surface-2);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    padding: 0.65rem;
    min-height: 18rem;
}
.erp-kanban-col-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--erp-muted);
    padding: 0.35rem 0.4rem 0.7rem;
}
.erp-kanban-card {
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.5rem;
    cursor: grab;
    box-shadow: var(--erp-shadow);
    transition: border-color var(--erp-transition), box-shadow var(--erp-transition), transform var(--erp-transition);
}
.erp-kanban-card:hover {
    border-color: #99f6e4;
    box-shadow: var(--erp-shadow-md);
    transform: translateY(-1px);
}
.erp-kanban-card strong { font-size: 0.875rem; }
.erp-kanban-card .meta { font-size: 0.78rem; color: var(--erp-muted); margin-top: 0.15rem; }

/* ??? Data table shell ??? */
/* Sticky thead was removed: overflow + sticky desynced header/body columns in Chromium. */
.erp-table-shell {
    background: var(--erp-surface);
    border: var(--erp-border-emphasis, 1px) solid var(--erp-border);
    border-radius: var(--erp-card-radius, var(--erp-radius));
    box-shadow: var(--erp-card-shadow, var(--erp-shadow));
    overflow: hidden;
}
.erp-table-shell .table {
    margin-bottom: 0;
    width: 100%;
    min-width: 720px;
}
.erp-table-shell .table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}
.erp-table-shell thead th {
    background: var(--erp-surface-2);
}
.erp-table-shell tbody tr {
    cursor: pointer;
    transition: background var(--erp-transition);
}
.erp-table-shell tbody tr a.erp-row-link {
    color: inherit;
    text-decoration: none;
    font-weight: 650;
}
/* Secondary cells (phone/email/company): same link behavior, normal weight */
.erp-table-shell tbody tr a.erp-row-link-plain {
    color: inherit;
    text-decoration: none;
    font-weight: inherit;
}
.erp-table-shell tbody tr a.erp-row-link:hover,
.erp-table-shell tbody tr a.erp-row-link-plain:hover {
    color: var(--erp-primary, #087f7b);
    text-decoration: underline;
}
.erp-table-shell tbody tr:hover {
    background: var(--erp-surface-2);
}

/* Note hint on list rows (Planlagte opkald etc.) */
.erp-note-hint {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: var(--erp-muted, #6b7280);
    cursor: default;
    flex-shrink: 0;
}
.erp-note-hint > .bi {
    font-size: 0.95rem;
    line-height: 1;
}
.erp-note-hint:hover,
.erp-note-hint:focus-within {
    color: var(--erp-primary, #087f7b);
}
.erp-note-hint-popup {
    display: none;
    position: absolute;
    left: 50%;
    top: calc(100% + 0.35rem);
    transform: translateX(-50%);
    z-index: 50;
    min-width: 14rem;
    max-width: min(22rem, 70vw);
    max-height: 16rem;
    overflow-y: auto;
    padding: 0.55rem 0.7rem;
    background: var(--erp-surface, #fff);
    border: 1px solid var(--erp-border, #e5e7eb);
    border-radius: var(--erp-radius-sm, 0.4rem);
    box-shadow: var(--erp-shadow-md, 0 8px 24px rgba(0, 0, 0, 0.12));
    white-space: normal;
    text-align: left;
    pointer-events: none;
}
.erp-note-hint:hover .erp-note-hint-popup,
.erp-note-hint:focus-within .erp-note-hint-popup {
    display: block;
}
.erp-note-hint-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.35rem 0;
}
.erp-note-hint-item + .erp-note-hint-item {
    border-top: 1px solid var(--erp-border, #e5e7eb);
}
.erp-note-hint-date {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--erp-muted, #6b7280);
}
.erp-note-hint-text {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--erp-text, #111827);
    white-space: pre-wrap;
}

/* Dialog history hover preview (Opkald / Kundeliste Virksomhed) */
.erp-dialog-hover {
    position: relative;
    display: inline-flex;
    max-width: 100%;
    vertical-align: baseline;
}
.erp-dialog-hover-trigger {
    display: inline-flex;
    max-width: 100%;
    min-width: 0;
}
.erp-dialog-hover-popup {
    position: absolute;
    left: 0;
    top: calc(100% + 0.35rem);
    z-index: 60;
    width: min(28rem, 85vw);
    max-height: min(22rem, 55vh);
    display: flex;
    flex-direction: column;
    background: var(--erp-surface, #fff);
    border: 1px solid var(--erp-border, #e5e7eb);
    border-radius: var(--erp-radius-sm, 0.4rem);
    box-shadow: var(--erp-shadow-md, 0 8px 24px rgba(0, 0, 0, 0.12));
    text-align: left;
    white-space: normal;
}
.erp-dialog-hover-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--erp-border, #e5e7eb);
    flex-shrink: 0;
}
.erp-dialog-hover-head strong {
    font-size: 0.875rem;
    font-weight: 650;
    color: var(--erp-text, #111827);
}
.erp-dialog-hover-body {
    overflow-y: auto;
    padding: 0.35rem 0.75rem 0.65rem;
    flex: 1 1 auto;
    min-height: 0;
}
.erp-dialog-hover-feed .erp-feed-item {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}
.erp-dialog-hover-feed .erp-feed-item:first-child {
    padding-top: 0.35rem;
}

/* Full dialog note/mail body — wrap to content height; never clamp/ellipsis */
.erp-dialog-entry-body {
    white-space: pre-wrap;
    overflow: visible;
    text-overflow: unset;
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

/* Allow hover popup to escape clipped table shells */
.erp-table-shell:has(.erp-note-hint:hover),
.erp-table-shell:has(.erp-note-hint:focus-within),
.table-responsive:has(.erp-note-hint:hover),
.table-responsive:has(.erp-note-hint:focus-within),
.erp-table-shell:has(.erp-dialog-hover.is-open),
.table-responsive:has(.erp-dialog-hover.is-open) {
    overflow: visible;
}

.erp-identity {
    display: flex;
    min-width: 11rem;
    flex-direction: column;
    gap: 0.1rem;
}
.erp-identity strong {
    color: var(--erp-text);
    font-weight: 650;
    font-size: 0.9rem;
}
.erp-identity span,
.erp-identity small {
    color: var(--erp-muted);
    font-size: 0.8125rem;
    line-height: 1.3;
}

.erp-data-table-pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1.15rem;
    border-top: 1px solid var(--erp-border);
    background: var(--erp-surface);
}
.erp-data-table-pager .btn {
    white-space: nowrap;
}

.erp-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--erp-toolbar-gap, 0.55rem);
    align-items: flex-end;
    padding: var(--erp-card-padding, 0.85rem) var(--erp-card-padding, 1rem);
    border-bottom: 1px solid var(--erp-border);
    background: var(--erp-surface-2);
}
.erp-toolbar-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
    gap: 0.25rem;
    min-width: 8rem;
    /* Do not stretch controls to match tall siblings */
    align-self: flex-end;
}
.erp-toolbar-field.flex-1 {
    flex: 1 1 12rem;
    min-width: 10rem;
}
.erp-toolbar-field .form-label {
    display: block;
    margin-bottom: 0;
    line-height: 1.2;
}
.erp-toolbar-field .form-control,
.erp-toolbar-field .form-select {
    width: 100%;
    /* Fixed control height ? search fields must not grow with flex stretch */
    min-height: var(--erp-control-height, 2.4rem);
    height: var(--erp-control-height, 2.4rem);
    max-height: var(--erp-control-height, 2.4rem);
    box-sizing: border-box;
}
.erp-toolbar-field textarea.form-control {
    height: auto;
    max-height: none;
    min-height: 4.5rem;
}
.erp-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.55rem;
    margin-left: auto;
    align-self: flex-end;
}

/* ??? Segmented control ??? */
.erp-segment {
    display: inline-flex;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: 999px;
    padding: 0.15rem;
}
.erp-segment button {
    appearance: none;
    border: none;
    background: transparent;
    font-family: var(--erp-font);
    font-size: 0.8125rem;
    font-weight: 550;
    color: var(--erp-muted);
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    cursor: pointer;
}
.erp-segment button.active {
    background: var(--erp-tab-active-bg, var(--erp-primary, #087f7b));
    color: var(--erp-tab-active-fg, var(--erp-primary-fg, #fff));
    font-weight: 700;
}

/* ??? Empty / loading ??? */
.erp-empty {
    text-align: center;
    color: var(--erp-muted);
    padding: 2.5rem 1rem;
    font-size: 0.9rem;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.erp-loading { color: var(--erp-muted); padding: 2rem 0; }

/* Trappepris editor ? keep # / inputs / currency on one aligned row */
.erp-tier-editor .table > :not(caption) > * > * {
    vertical-align: middle;
    padding: 0.45rem 0.5rem;
}
.erp-tier-editor .table .form-control,
.erp-tier-editor .table .input-group {
    min-width: 0;
}
.erp-tier-editor .input-group-text {
    font-size: 0.75rem;
    padding-left: 0.45rem;
    padding-right: 0.5rem;
}
.erp-tier-editor td.text-muted {
    width: 2.25rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ??? Validation (Blazor) ??? */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--erp-success); }
.invalid { outline: 1px solid var(--erp-danger); }
.validation-message { color: var(--erp-danger); font-size: 0.8rem; }

.blazor-error-boundary {
    background: var(--erp-danger);
    padding: 1rem 1rem 1rem 1.25rem;
    color: white;
    border-radius: var(--erp-radius);
}
.blazor-error-boundary::after { content: "Der opstod en uventet fejl."; }

.darker-border-checkbox.form-check-input { border-color: #929292; }

/* ??? Entity detail workspace ??? */
.erp-entity-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--erp-border);
}
.erp-entity-header.sticky {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--erp-bg) 92%, white);
    backdrop-filter: blur(8px);
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    padding: 0.85rem 0.25rem 0.85rem;
}
.erp-entity-header-main {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}
.erp-entity-header-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 1.25rem;
    padding: 0.85rem 1rem;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow);
}
@media (min-width: 768px) {
    .erp-entity-header-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
    .erp-entity-header-meta { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.erp-entity-meta-item { min-width: 0; }
.erp-entity-meta-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--erp-muted);
    margin-bottom: 0.15rem;
}
.erp-entity-meta-value {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--erp-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.erp-entity-meta-value.accent { color: var(--erp-accent); }
.erp-entity-meta-value.warn { color: var(--erp-danger); }

.erp-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 900px) {
    .erp-info-grid { grid-template-columns: 1fr 1fr; }
}
.erp-info-grid .span-full { grid-column: 1 / -1; }

.erp-kv {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}
@media (min-width: 480px) {
    .erp-kv.cols-2 { grid-template-columns: 1fr 1fr; }
}
.erp-kv-item { min-width: 0; }
.erp-kv .span-2 { grid-column: 1 / -1; }
.erp-kv-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--erp-muted);
    margin-bottom: 0.12rem;
}
.erp-kv-value {
    display: block;
    font-size: 0.875rem;
    color: var(--erp-text);
    word-break: break-word;
}

.erp-card-action {
    font-size: 0.8125rem;
    font-weight: 550;
    padding: 0;
    text-decoration: none;
}

.erp-dropdown { position: relative; }
/* Personal list column order (Kolonner popover) */
/* Table shells clip absolute menus via overflow:hidden (border-radius). */
.erp-table-shell:has(.erp-column-order-menu) {
    overflow: visible;
}
.erp-column-order-menu {
    padding-top: 0.25rem;
    max-height: min(24rem, 70vh);
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 40;
}
.erp-column-order-hint {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem 0.4rem;
}
.erp-column-order-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: grab;
    user-select: none;
}
.erp-column-order-row .erp-line-drag { margin-top: 0; flex-shrink: 0; }
.erp-column-order-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
    margin: 0;
    cursor: pointer;
}
.erp-column-order-check input {
    flex-shrink: 0;
    margin: 0;
}
.erp-column-order-row .erp-column-order-title { flex: 1; min-width: 0; }
.erp-column-order-row.is-hidden-col .erp-column-order-title { color: var(--erp-muted, #6b7280); }
.erp-column-order-row.is-dragging { opacity: 0.45; }
.erp-column-order-row.is-drag-over { background: var(--erp-surface-2); box-shadow: inset 0 2px 0 0 var(--erp-primary, #0d9488); }
.erp-column-order-row:active { cursor: grabbing; }
.erp-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    min-width: 11rem;
    padding: 0.35rem;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    box-shadow: var(--erp-shadow-md);
    z-index: 30;
}
.erp-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    appearance: none;
    border: none;
    background: transparent;
    font-family: var(--erp-font);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--erp-text);
    padding: 0.45rem 0.65rem;
    border-radius: var(--erp-radius-sm);
    cursor: pointer;
}
.erp-dropdown-item:hover { background: var(--erp-surface-2); }
.erp-dropdown-item.danger { color: var(--erp-danger); }

/* Shared physical address autocomplete (ErpAddressInput) */
.erp-address-input { position: relative; z-index: 1; }
.erp-address-search { position: relative; }
.erp-address-search-field { position: relative; }
/* Cards clip absolute dropdowns — allow address suggestions to paint outside. */
.erp-card:has(.erp-address-input),
.erp-card-body:has(.erp-address-input) {
    overflow: visible;
}
.erp-address-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.25rem);
    z-index: 1200;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    background: var(--erp-surface, #fff);
    border: 1px solid var(--erp-border, #cbd5e1);
    border-radius: var(--erp-radius-sm, 8px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
    max-height: 16rem;
    overflow-x: hidden;
    overflow-y: auto;
}
.erp-address-suggestion {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    text-align: left;
    padding: 0.7rem 0.85rem;
    min-height: 2.75rem;
    border-radius: var(--erp-radius-sm, 8px);
    cursor: pointer;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.erp-address-suggestion:hover,
.erp-address-suggestion.active {
    background: color-mix(in srgb, var(--erp-primary, #0f766e) 14%, #fff);
}
.erp-address-suggestion.muted {
    cursor: default;
    color: var(--erp-muted, #64748b);
    font-size: 0.875rem;
}
.erp-address-line1 { font-weight: 650; font-size: 0.95rem; color: var(--erp-text, #0f172a); }
.erp-address-line2 { font-size: 0.85rem; color: var(--erp-text-muted, #475569); margin-top: 0.15rem; }
.erp-address-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-surface-2, #f8fafc);
}
.erp-address-selected-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.erp-address-manual-badge {
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: #92400e;
}
.erp-address-fallback {
    margin-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}
.erp-address-fallback-end { margin-left: auto; }
.erp-address-manual-actions { display: flex; gap: 0.5rem; }

.content { padding-top: 0; }
h1:focus { outline: none; }

/* ??? Workspace headers ??? */
.erp-workspace-header .erp-workspace-identity { min-width: 0; flex: 1; }
.erp-workspace-id {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 0.45rem;
}
.erp-workspace-number {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--erp-text);
}
.erp-workspace-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.erp-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 550;
    color: var(--erp-text-secondary);
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    white-space: nowrap;
}
.erp-meta-chip.accent {
    color: #115e59;
    background: var(--erp-accent-soft);
    border-color: #99f6e4;
}
.erp-meta-chip.warn {
    color: #991b1b;
    background: var(--erp-danger-soft);
    border-color: #fecaca;
}
.erp-meta-chip strong { font-weight: 650; color: var(--erp-text); }

/* ??? Product line rows ??? */
.erp-line-add-toolbar {
    flex-wrap: nowrap;
    align-items: center;
}
.erp-line-add-product {
    min-width: 14rem;
    flex: 1 1 auto;
}
.erp-line-add-qty {
    width: 6rem;
    flex: 0 0 6rem;
}
.erp-line-add-reason {
    min-width: 10rem;
    flex: 1 1 12rem;
}
.erp-line-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.65rem 1rem 1rem;
    overflow-x: auto;
}
/* Shared column tracks for tilbud/ordre Linjer — header + rows must stay identical.
   drag | sku | product | locations | estimat | revit | price | discount | net | actions */
.erp-line-list-sales {
    /* Wider numeric cols so B (header left / value right) is obvious */
    --erp-line-cols: auto 3.25rem minmax(7rem, 1.2fr) minmax(7rem, 1fr) 7.75rem 8.25rem 6.25rem 5.5rem minmax(6.75rem, 7.75rem) auto;
    --erp-line-cols-no-loc: auto 3.25rem minmax(7rem, 1.4fr) 7.75rem 8.25rem 6.25rem 5.5rem minmax(6.75rem, 7.75rem) auto;
}
.erp-line-header {
    display: none;
}
.erp-line-list-sales .erp-line-header {
    display: grid;
    grid-template-columns: var(--erp-line-cols);
    align-items: center;
    column-gap: 0.65rem;
    row-gap: 0.5rem;
    padding: var(--erp-table-cell-padding-y, 0.38rem) var(--erp-table-cell-padding-x, 0.7rem);
    /* Match .table thead th / .erp-table-shell thead (not warning-soft yellow). */
    background: var(--erp-surface-2);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--erp-muted);
    white-space: nowrap;
    min-width: 0;
}
.erp-line-list-sales .erp-line-header > * {
    margin-top: 0;
    text-align: left;
    justify-self: start;
    width: auto;
    min-width: 0;
    max-width: none;
}
.erp-line-list-sales .erp-line-header .erp-line-drag {
    visibility: hidden;
}
.erp-line-list-sales .erp-line-header.no-locations,
.erp-line-list-sales .erp-line-row.no-locations {
    grid-template-columns: var(--erp-line-cols-no-loc);
}
.erp-line-row {
    display: grid;
    grid-template-columns: auto minmax(7rem, 1.2fr) minmax(7rem, 1fr) 10.5rem 4.5rem 4.5rem minmax(6.5rem, 7.25rem) auto;
    align-items: center;
    gap: 0.5rem 0.65rem;
    padding: 0.5rem 0.65rem;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    transition: border-color var(--erp-transition), box-shadow var(--erp-transition);
    min-width: 0;
}
.erp-line-list-sales .erp-line-row {
    grid-template-columns: var(--erp-line-cols);
    column-gap: 0.65rem;
    row-gap: 0.5rem;
    padding: var(--erp-table-cell-padding-y, 0.38rem) var(--erp-table-cell-padding-x, 0.7rem);
}
.erp-line-row:hover {
    border-color: #99f6e4;
    box-shadow: var(--erp-shadow);
}
.erp-line-row.text-line {
    grid-template-columns: auto 1fr auto;
    align-items: center;
}
.erp-line-list-sales .erp-line-row.text-line {
    grid-template-columns: auto 3.25rem 1fr auto;
}
.erp-line-drag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    color: var(--erp-muted);
    cursor: grab;
    font-size: 0.95rem;
    letter-spacing: -0.12em;
    user-select: none;
    line-height: 1;
    margin-top: 0.35rem;
}
.erp-line-row:active .erp-line-drag { cursor: grabbing; }
.erp-line-sku {
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    color: var(--erp-muted);
    min-width: 0;
}
.erp-line-product { min-width: 0; }
.erp-line-product-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--erp-text);
}
.erp-line-product-desc {
    font-size: 0.78rem;
    color: var(--erp-muted);
    margin-top: 0.1rem;
}
.erp-line-locations {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.erp-line-locations-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--erp-muted);
}
.erp-line-locations-summary {
    font-size: 0.78rem;
    color: var(--erp-text-secondary);
    line-height: 1.25;
}
.erp-line-locations-pick {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-height: 7.5rem;
    overflow: auto;
    padding: 0.35rem 0.45rem;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-bg, #fafafa);
}
.erp-line-locations-pick .form-check {
    margin: 0;
    min-height: 0;
}
.erp-line-locations-pick .form-check-label {
    font-size: 0.78rem;
}
.erp-line-qty, .erp-line-qty-revit, .erp-line-price, .erp-line-net, .erp-line-discount {
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    margin-top: 0.35rem;
}
.erp-line-qty, .erp-line-qty-revit {
    color: var(--erp-text-secondary);
    width: 10.5rem;
    min-width: 10.5rem;
    max-width: 10.5rem;
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: stretch;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.erp-line-list-sales .erp-line-qty,
.erp-line-list-sales .erp-line-qty-revit {
    width: auto;
    min-width: 0;
    max-width: none;
}
/* B: headers left in full column; numeric row cells flush right */
.erp-line-list-sales .erp-line-header > .erp-line-qty,
.erp-line-list-sales .erp-line-header > .erp-line-qty-revit,
.erp-line-list-sales .erp-line-header > .erp-line-price,
.erp-line-list-sales .erp-line-header > .erp-line-discount,
.erp-line-list-sales .erp-line-header > .erp-line-net {
    display: block;
    width: 100%;
    max-width: none;
    justify-self: stretch;
    text-align: left;
    justify-content: flex-start;
}
.erp-line-list-sales .erp-line-row > .erp-line-qty,
.erp-line-list-sales .erp-line-row > .erp-line-qty-revit {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    justify-self: stretch;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    text-align: right;
}
.erp-line-list-sales .erp-line-row > .erp-line-price,
.erp-line-list-sales .erp-line-row > .erp-line-discount,
.erp-line-list-sales .erp-line-row > .erp-line-net {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-self: stretch;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    text-align: right;
}
.erp-line-list-sales .erp-line-qty-cell {
    grid-template-columns: auto auto;
    width: max-content;
    max-width: 100%;
    margin-left: auto; /* pack qty+unit to the right under left header */
}
.erp-line-list-sales .erp-line-qty-cell.is-readonly {
    grid-template-columns: auto auto;
}
.erp-line-list-sales .erp-line-qty-num,
.erp-line-list-sales .erp-line-qty-num-input {
    text-align: right;
}
.erp-line-qty-cell {
    display: grid;
    grid-template-columns: minmax(3.25rem, 1fr) 2.1rem 2.6rem;
    align-items: center;
    column-gap: 0.2rem;
    width: 100%;
    min-height: 1.75rem;
}
.erp-line-qty-cell.is-readonly {
    grid-template-columns: minmax(3.25rem, 1fr) 2.1rem;
}
.erp-line-qty-num {
    font-variant-numeric: tabular-nums;
    text-align: right;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.erp-line-qty-num-input {
    min-width: 0;
    width: 100%;
    text-align: right;
    font-variant-numeric: tabular-nums;
    padding-left: 0.3rem;
    padding-right: 0.3rem;
}
.erp-line-qty-unit {
    font-size: 0.75rem;
    color: var(--erp-muted);
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}
.erp-line-qty-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.05rem;
    width: 2.6rem;
    min-width: 2.6rem;
}
.erp-line-qty-action {
    --bs-btn-padding-x: 0.15rem;
    --bs-btn-padding-y: 0.1rem;
    line-height: 1;
    color: var(--erp-muted);
    flex: 0 0 auto;
}
.erp-line-qty-action:hover { color: var(--erp-accent); }
.erp-line-qty-action .bi { font-size: 0.85rem; vertical-align: -0.05em; }
.erp-order-line-qty {
    width: 10.5rem;
    min-width: 10.5rem;
    max-width: 12rem;
    vertical-align: middle;
}
.erp-line-price { color: var(--erp-muted); width: 4.5rem; text-align: right; margin-top: 0; }
.erp-line-price.erp-line-price-live { color: var(--erp-accent); }
.erp-line-discount {
    min-width: 4.25rem;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    white-space: normal;
}
.erp-line-discount-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--erp-muted);
}
.erp-line-discount-value {
    color: var(--erp-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.erp-line-discount-value.has-discount {
    color: var(--erp-text);
    font-weight: 600;
}
.erp-line-net {
    font-weight: 650;
    color: var(--erp-text);
    width: 7.25rem;
    min-width: 6.5rem;
    text-align: right;
    margin-top: 0;
    white-space: normal;
}
.erp-line-list-sales .erp-line-row .erp-line-total-num {
    text-align: right;
    display: block;
    width: 100%;
}
.erp-line-list-sales .erp-line-row .erp-line-net-after {
    text-align: right;
    width: 100%;
}
.erp-line-net-after {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--erp-muted);
    margin-top: 0.15rem;
    font-variant-numeric: tabular-nums;
}
.erp-line-total-cell {
    display: grid;
    grid-template-columns: minmax(3.5rem, 1fr) 2.6rem;
    align-items: center;
    column-gap: 0.15rem;
    width: 100%;
    min-height: 1.75rem;
}
.erp-line-total-cell.is-readonly {
    grid-template-columns: minmax(3.5rem, 1fr);
}
.erp-line-total-num {
    font-variant-numeric: tabular-nums;
    font-weight: 650;
    text-align: right;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.erp-line-total-input {
    min-width: 0;
    width: 100%;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 650;
    padding-left: 0.3rem;
    padding-right: 0.3rem;
}
.erp-line-total-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.05rem;
    width: 2.6rem;
    min-width: 2.6rem;
}
.erp-line-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0;
    justify-content: flex-end;
}
.erp-line-action-btn {
    min-width: 2.1rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
}
.erp-line-action-btn .bi {
    font-size: 0.95rem;
    vertical-align: -0.05em;
}
.erp-line-drive-btn {
    min-width: 2.1rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    font-size: 1.05rem;
    line-height: 1;
}
.erp-line-drive-btn .bi {
    font-size: 1.1rem;
    vertical-align: -0.1em;
}
.erp-line-move {
    display: inline-flex;
    flex-direction: column;
    gap: 0.1rem;
}
.erp-line-move button {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--erp-muted);
    padding: 0;
    line-height: 1;
    font-size: 0.7rem;
    cursor: pointer;
}
.erp-line-move button:hover { color: var(--erp-accent); }

@media (max-width: 1200px) {
    .erp-line-add-toolbar {
        flex-wrap: wrap;
    }
    .erp-line-list-sales {
        --erp-line-cols: auto 3rem minmax(6rem, 1fr) minmax(6rem, 0.9fr) 5.75rem 6.25rem 4.5rem 4.25rem minmax(5.5rem, 6.5rem);
        --erp-line-cols-no-loc: auto 3rem minmax(6.5rem, 1fr) 5.75rem 6.25rem 4.5rem 4.25rem minmax(5.5rem, 6.5rem);
    }
    .erp-line-row {
        grid-template-columns: auto minmax(6.5rem, 1fr) minmax(6rem, 0.9fr) 10.5rem 4.25rem 4.25rem minmax(6rem, 7rem);
        grid-template-areas:
            "drag product locations qty price discount net"
            "drag actions actions actions actions actions actions";
    }
    .erp-line-list-sales .erp-line-header,
    .erp-line-list-sales .erp-line-row {
        grid-template-columns: var(--erp-line-cols);
        grid-template-areas:
            "drag sku product locations qty revit price discount net"
            "drag sku actions actions actions actions actions actions actions";
    }
    .erp-line-list-sales .erp-line-header.no-locations,
    .erp-line-list-sales .erp-line-row.no-locations {
        grid-template-columns: var(--erp-line-cols-no-loc);
        grid-template-areas:
            "drag sku product qty revit price discount net"
            "drag sku actions actions actions actions actions actions";
    }
    .erp-line-drag { grid-area: drag; align-self: start; }
    .erp-line-sku { grid-area: sku; }
    .erp-line-product { grid-area: product; }
    .erp-line-locations { grid-area: locations; }
    .erp-line-qty { grid-area: qty; }
    .erp-line-qty-revit { grid-area: revit; }
    .erp-line-price { grid-area: price; }
    .erp-line-discount { grid-area: discount; }
    .erp-line-net { grid-area: net; }
    .erp-line-actions {
        grid-area: actions;
        justify-content: flex-start;
        max-width: none;
    }
    .erp-line-row.text-line {
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "drag product"
            "drag actions";
    }
    .erp-line-list-sales .erp-line-row.text-line {
        grid-template-columns: auto 3rem 1fr;
        grid-template-areas:
            "drag sku product"
            "drag sku actions";
    }
}

@media (max-width: 768px) {
    .erp-line-list-sales .erp-line-header { display: none; }
    .erp-line-row {
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "drag product"
            "drag locations"
            "drag qty"
            "drag price"
            "drag discount"
            "drag net"
            "drag actions";
    }
    .erp-line-list-sales .erp-line-row {
        grid-template-areas:
            "drag product"
            "drag sku"
            "drag locations"
            "drag qty"
            "drag revit"
            "drag price"
            "drag discount"
            "drag net"
            "drag actions";
    }
    .erp-line-list-sales .erp-line-row.no-locations {
        grid-template-areas:
            "drag product"
            "drag sku"
            "drag qty"
            "drag revit"
            "drag price"
            "drag discount"
            "drag net"
            "drag actions";
    }
    .erp-line-drag { grid-area: drag; }
    .erp-line-sku { grid-area: sku; }
    .erp-line-product { grid-area: product; }
    .erp-line-locations { grid-area: locations; }
    .erp-line-qty {
        grid-area: qty;
        justify-content: flex-start;
        width: 100%;
        max-width: none;
        min-width: 0;
    }
    .erp-line-qty-revit {
        grid-area: revit;
        justify-content: flex-start;
        width: 100%;
        max-width: none;
        min-width: 0;
    }
    .erp-line-qty-cell { justify-content: flex-start; }
    .erp-line-price {
        grid-area: price;
        width: auto;
        text-align: left;
        display: block;
    }
    .erp-line-discount { grid-area: discount; }
    .erp-line-list-sales .erp-line-discount { text-align: left; }
    .erp-line-net { grid-area: net; text-align: left; width: auto; min-width: 0; }
    .erp-line-actions { grid-area: actions; justify-content: flex-start; }
    .erp-line-action-label { display: none; }
}

/* ??? Kanban enhancements ??? */
.erp-kanban-col-meta {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--erp-muted);
    padding: 0 0.4rem 0.55rem;
    margin-top: -0.35rem;
}
.erp-kanban-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.erp-kanban-card-top strong {
    font-size: 0.875rem;
    line-height: 1.3;
    min-width: 0;
}
.erp-kanban-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.55rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--erp-border);
    font-size: 0.72rem;
    color: var(--erp-muted);
}
.erp-kanban-card-amount {
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    color: var(--erp-text);
    font-size: 0.8125rem;
}
.erp-kanban-empty-col {
    text-align: center;
    color: var(--erp-muted);
    font-size: 0.78rem;
    padding: 1.25rem 0.5rem;
    border: 1px dashed var(--erp-border);
    border-radius: var(--erp-radius-sm);
    margin-top: 0.25rem;
}

/* ??? CRM overview ??? */
.erp-overview-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
@media (min-width: 900px) {
    .erp-overview-grid { grid-template-columns: 1fr 1fr; }
}
.erp-overview-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.erp-overview-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--erp-border);
    font-size: 0.875rem;
}
.erp-overview-list li:last-child { border-bottom: none; }
.erp-overview-list a { font-weight: 550; }

.erp-col-amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ??? Mobile ??? */
@media (max-width: 640px) {
    .erp-page-title { font-size: 1.2rem; }
    .erp-actions-secondary {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        width: 100%;
    }
    .erp-tabs { border-radius: var(--erp-radius); }
}

/* ??? Typography scale ??? */
.erp-section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--erp-space-4);
    margin: var(--erp-space-5) 0 var(--erp-space-3);
}
.erp-section-title {
    font-size: var(--erp-type-section);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}
.erp-section-sub {
    margin: 0.15rem 0 0;
    color: var(--erp-muted);
    font-size: var(--erp-type-meta);
}
.erp-section-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.mb-section { margin-bottom: var(--erp-space-5); }
.mt-section { margin-top: var(--erp-space-5); }

/* ??? Metric cards ??? */
.erp-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}
@media (min-width: 900px) {
    .erp-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .erp-metric-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.erp-metric {
    display: block;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    padding: 1.05rem 1.1rem;
    box-shadow: var(--erp-shadow);
    color: inherit;
    text-decoration: none;
    transition: border-color var(--erp-transition), box-shadow var(--erp-transition), transform var(--erp-transition);
    position: relative;
    overflow: hidden;
}
a.erp-metric:hover {
    border-color: #99f6e4;
    box-shadow: var(--erp-shadow-md);
    transform: translateY(-1px);
    color: inherit;
}
.erp-metric-top {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.45rem;
}
.erp-metric-icon {
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--erp-surface-2);
    color: var(--erp-text-secondary);
    font-size: 0.9rem;
}
.erp-metric-label {
    flex: 1;
    font-size: var(--erp-type-label);
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--erp-muted);
}
.erp-metric-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: var(--erp-border-strong);
}
.erp-metric-value {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
}
.erp-metric-secondary {
    margin-top: 0.3rem;
    font-size: var(--erp-type-meta);
    color: var(--erp-muted);
}
.erp-metric-positive .erp-metric-dot { background: var(--erp-success); }
.erp-metric-positive .erp-metric-icon { background: var(--erp-success-soft); color: var(--erp-success); }
.erp-metric-positive .erp-metric-value { color: #047857; }
.erp-metric-attention {
    border-color: #fde68a;
    background: linear-gradient(180deg, #fffbeb 0%, #fff 55%);
}
.erp-metric-attention .erp-metric-dot { background: var(--erp-warning); }
.erp-metric-attention .erp-metric-icon { background: var(--erp-warning-soft); color: var(--erp-warning); }
.erp-metric-attention .erp-metric-value { color: #b45309; }
.erp-metric-critical {
    border-color: #fecaca;
    background: linear-gradient(180deg, #fef2f2 0%, #fff 55%);
}
.erp-metric-critical .erp-metric-dot { background: var(--erp-danger); }
.erp-metric-critical .erp-metric-icon { background: var(--erp-danger-soft); color: var(--erp-danger); }
.erp-metric-critical .erp-metric-value { color: var(--erp-danger); }
.erp-metric-info .erp-metric-dot { background: var(--erp-info); }
.erp-metric-info .erp-metric-icon { background: var(--erp-info-soft); color: var(--erp-info); }

/* ??? Action list ??? */
.erp-action-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.erp-action-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    padding: 0.85rem 1rem;
    box-shadow: var(--erp-shadow);
    text-decoration: none;
    color: inherit;
    transition: border-color var(--erp-transition), box-shadow var(--erp-transition), transform var(--erp-transition);
}
.erp-action-item:hover {
    border-color: #99f6e4;
    box-shadow: var(--erp-shadow-md);
    transform: translateY(-1px);
    color: inherit;
}
.erp-action-rail {
    width: 4px;
    align-self: stretch;
    border-radius: 999px;
    background: var(--erp-border-strong);
}
.severity-danger .erp-action-rail { background: var(--erp-danger); }
.severity-warning .erp-action-rail { background: var(--erp-warning); }
.severity-info .erp-action-rail { background: var(--erp-info); }
.erp-action-body { flex: 1; min-width: 0; }
.erp-action-title { font-weight: 650; font-size: 0.92rem; }
.erp-action-sub { color: var(--erp-muted); font-size: var(--erp-type-meta); margin-top: 0.1rem; }
.erp-action-cta {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--erp-accent);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

/* ??? Quick actions / create ??? */
.erp-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}
@media (min-width: 900px) {
    .erp-quick-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.erp-qa-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    padding: 1.1rem 1rem;
    box-shadow: var(--erp-shadow);
    text-decoration: none;
    color: inherit;
    transition: border-color var(--erp-transition), box-shadow var(--erp-transition), transform var(--erp-transition);
}
.erp-qa-card i { font-size: 1.25rem; color: var(--erp-accent); margin-bottom: 0.35rem; }
.erp-qa-title { font-weight: 650; font-size: 0.92rem; }
.erp-qa-sub { font-size: var(--erp-type-meta); color: var(--erp-muted); }
.erp-qa-card:hover {
    border-color: #99f6e4;
    box-shadow: var(--erp-shadow-md);
    transform: translateY(-1px);
    color: inherit;
}

.erp-quick-create {
    position: relative;
    z-index: 60;
    display: inline-block;
}
.erp-quick-create > summary {
    list-style: none;
}
.erp-quick-create > summary::-webkit-details-marker {
    display: none;
}
.erp-quick-create-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 2.1rem;
    cursor: pointer;
}
.erp-qc-chevron { font-size: 0.7rem; opacity: 0.85; transition: transform 0.15s ease; }
.erp-quick-create[open] .erp-qc-chevron { transform: rotate(180deg); }
/* Absolute under header ? header sits outside workspace-body overflow, so menu cannot clip. */
.erp-quick-create-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    min-width: 12.5rem;
    max-height: min(70vh, 24rem);
    overflow-y: auto;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow-lg);
    padding: 0.35rem;
    z-index: 5000;
}
.erp-qc-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 0;
    border-radius: var(--erp-radius-sm);
    background: transparent;
    color: var(--erp-text);
    text-decoration: none;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 550;
    line-height: 1.25;
    cursor: pointer;
}
.erp-qc-item:hover,
.erp-qc-item:focus-visible {
    background: var(--erp-surface-2);
    color: var(--erp-text);
    outline: none;
}
@media (max-width: 640.98px) {
    .erp-quick-create-menu {
        position: fixed;
        top: calc(var(--erp-header-h, 3.25rem) + 0.35rem);
        left: 0.75rem;
        right: 0.75rem;
        width: auto;
        min-width: 0;
        max-width: none;
    }
}
.erp-admin-hub-card .erp-metric-label {
    font-size: 0.95rem;
    font-weight: 650;
    color: var(--erp-text);
}
.erp-admin-hub-card .erp-metric-secondary {
    margin-top: 0.15rem;
    line-height: 1.35;
}

/* ??? Empty / skeleton ??? */
.erp-empty-state {
    text-align: center;
    padding: 2.5rem 1.25rem;
}
.erp-empty-icon {
    width: 2.75rem;
    height: 2.75rem;
    margin: 0 auto 0.85rem;
    border-radius: 999px;
    background: var(--erp-surface-2);
    color: var(--erp-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}
.erp-empty-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 0.35rem; }
.erp-empty-desc { color: var(--erp-muted); margin: 0 0 1rem; font-size: 0.9rem; }
.erp-empty-actions { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; }

.erp-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
.erp-skeleton {
    height: 5.5rem;
    border-radius: var(--erp-radius);
    background: linear-gradient(90deg, #eef1f5 25%, #f8fafc 50%, #eef1f5 75%);
    background-size: 200% 100%;
    animation: erp-shimmer 1.2s infinite linear;
}
@keyframes erp-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.erp-card-quiet { background: #f8fafc; }
.erp-quiet-ok {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--erp-success);
    font-weight: 550;
    font-size: 0.9rem;
}

/* ??? Udl?g kvitterings-preview ??? */
.erp-receipt-preview {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    background: var(--erp-surface-2, #f8fafc);
    padding: 0.75rem;
}
.erp-receipt-preview__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}
.erp-receipt-preview__name {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    font-size: 0.875rem;
    color: var(--erp-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.erp-receipt-preview__actions {
    display: flex;
    flex-shrink: 0;
    gap: 0.35rem;
}
.erp-receipt-preview__img {
    display: block;
    width: 100%;
    max-height: 22rem;
    object-fit: contain;
    border-radius: calc(var(--erp-radius) - 2px);
    background: #fff;
    border: 1px solid var(--erp-border);
}
.erp-receipt-preview__pdf {
    display: block;
    width: 100%;
    height: 22rem;
    border: 1px solid var(--erp-border);
    border-radius: calc(var(--erp-radius) - 2px);
    background: #fff;
}
.erp-receipt-preview__fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 8rem;
    padding: 1.25rem;
    color: var(--erp-text-secondary);
    text-align: center;
}
.erp-receipt-list-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    padding: 0.15rem 0.35rem;
    margin: 0 -0.35rem;
    border: 1px solid transparent;
    border-radius: var(--erp-radius);
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: inherit;
}
.erp-receipt-list-item:hover {
    background: var(--erp-surface-2, #f8fafc);
}
.erp-receipt-list-item.is-selected {
    border-color: var(--erp-border);
    background: var(--erp-surface-2, #f1f5f9);
}
.erp-receipt-list-item__main { min-width: 0; }
.erp-receipt-list-item__amount {
    flex-shrink: 0;
    font-weight: 600;
    white-space: nowrap;
}

/* ??? Dist bars / link lists ??? */
.erp-dist { display: flex; flex-direction: column; gap: 0.65rem; }
.erp-dist-meta {
    display: flex;
    justify-content: space-between;
    font-size: var(--erp-type-meta);
    color: var(--erp-text-secondary);
    margin-bottom: 0.2rem;
}
.erp-dist-bar {
    height: 0.4rem;
    background: var(--erp-surface-2);
    border-radius: 999px;
    overflow: hidden;
}
.erp-dist-fill { height: 100%; border-radius: 999px; background: #94a3b8; }
.erp-dist-fill.tone-info { background: var(--erp-info); }
.erp-dist-fill.tone-warn { background: var(--erp-warning); }
.erp-dist-fill.tone-danger { background: var(--erp-danger); }
.erp-dist-fill.tone-neutral { background: #94a3b8; }

.erp-link-list { list-style: none; margin: 0; padding: 0; }
.erp-link-list li { border-bottom: 1px solid var(--erp-border); }
.erp-link-list li:last-child { border-bottom: none; }
.erp-link-list a {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.15rem 0.75rem;
    padding: 0.75rem 1.1rem;
    text-decoration: none;
    color: inherit;
    transition: background var(--erp-transition);
}
.erp-link-list a:hover { background: #f0fdfa; color: inherit; }
.erp-link-title { font-weight: 650; font-size: 0.875rem; grid-column: 1; }
.erp-link-sub { font-size: var(--erp-type-meta); color: var(--erp-muted); grid-column: 1; }
.erp-link-amt {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    font-weight: 650;
    font-size: 0.82rem;
    color: var(--erp-text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ??? Entity workspace header ??? */
.erp-entity-header {
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow);
    padding: 1.15rem 1.25rem;
    margin-bottom: 1.1rem;
}
.erp-entity-kicker {
    font-size: var(--erp-type-label);
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--erp-muted);
    margin-bottom: 0.25rem;
}
.erp-entity-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem 0.75rem;
    margin-bottom: 0.35rem;
}
.erp-entity-title {
    font-size: 1.45rem;
    font-weight: 750;
    letter-spacing: -0.03em;
    margin: 0;
}
.erp-entity-customer {
    font-size: 1rem;
    font-weight: 600;
    color: var(--erp-text-secondary);
    margin: 0 0 0.75rem;
}
.erp-entity-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 1.25rem;
}
@media (min-width: 900px) {
    .erp-entity-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.erp-kv-label {
    display: block;
    font-size: var(--erp-type-label);
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--erp-muted);
    margin-bottom: 0.15rem;
}
.erp-kv-value {
    font-size: 0.9rem;
    font-weight: 550;
    color: var(--erp-text);
}
.erp-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
}
@media (min-width: 900px) {
    .erp-info-grid.two { grid-template-columns: 1fr 1fr; }
}

/* ??? Kanban v2 ??? */
.erp-kanban-card {
    position: relative;
    padding-left: 1.35rem;
}
.erp-kanban-card::before {
    content: "";
    position: absolute;
    left: 0.45rem;
    top: 0.85rem;
    bottom: 0.85rem;
    width: 3px;
    border-radius: 999px;
    background: #cbd5e1;
}
.erp-kanban-card .drag-affordance {
    position: absolute;
    right: 0.45rem;
    top: 0.45rem;
    color: #cbd5e1;
    font-size: 0.85rem;
}
.erp-kanban-card.dragging {
    opacity: 0.55;
    transform: scale(1.02);
    box-shadow: var(--erp-shadow-lg);
}
.erp-kanban-col.drop-target {
    outline: 2px dashed #2dd4bf;
    outline-offset: 2px;
    background: #f0fdfa;
}
.erp-kanban-col-title .col-value {
    font-weight: 600;
    color: var(--erp-text-secondary);
    text-transform: none;
    letter-spacing: 0;
}
.erp-kanban-card .amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-top: 0.35rem;
    font-size: 0.875rem;
}

/* ??? Table polish ??? */
.erp-num { text-align: right; font-variant-numeric: tabular-nums; }
.erp-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: var(--erp-accent-soft);
    color: #115e59;
    font-size: 0.75rem;
    font-weight: 600;
}
.erp-toast {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1080;
    background: #0f172a;
    color: #f8fafc;
    padding: 0.75rem 1rem;
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow-lg);
    font-size: 0.875rem;
    font-weight: 550;
}

/* Context menu ? above viewport modals (2000) so Genkald/lists stay usable;
   scroll-dismiss is armed after open (see erpContextMenu.js) to avoid focus race. */
.erp-ctx-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2600;
    background: transparent;
}
.erp-ctx-menu {
    --erp-ctx-margin: var(--erp-space-2); /* 8px viewport edge margin (positioning JS/C#) */
    position: fixed;
    z-index: 2601;
    min-width: 12.5rem;
    max-width: min(18rem, calc(100vw - 2 * var(--erp-ctx-margin)));
    padding: .35rem;
    border-radius: .65rem;
    background: var(--erp-surface, #fff);
    border: 1px solid var(--erp-border, #e2e8f0);
    box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
    display: flex;
    flex-direction: column;
    gap: .1rem;
}
.erp-ctx-menu.is-measuring {
    visibility: hidden;
    pointer-events: none;
}
.erp-ctx-item {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: .55rem .7rem;
    border-radius: .45rem;
    color: var(--erp-text, #0f172a);
    font-size: .92rem;
    font-weight: 500;
}
.erp-ctx-item span {
    flex: 1;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.erp-ctx-item i {
    flex-shrink: 0;
    margin-top: .1rem;
}
.erp-ctx-item:hover:not(.disabled),
.erp-ctx-item:focus-visible:not(.disabled) {
    background: rgba(15, 118, 110, .1);
    outline: none;
}
.erp-ctx-item.disabled { opacity: .45; cursor: not-allowed; }
.erp-ctx-item.is-danger { color: #b91c1c; }
.erp-ctx-item.is-danger:hover:not(.disabled) { background: rgba(185, 28, 28, .1); }
.erp-ctx-sep {
    height: 1px;
    margin: .25rem .35rem;
    background: var(--erp-border, #e2e8f0);
}
/* DEPRECATED: use .erp-choice-group / ErpChoiceGroup ? kept as thin alias for any residual markup. */
.erp-type-seg {
    display: flex;
    width: 100%;
    gap: 0.2rem;
    padding: 0.2rem;
    background: var(--erp-surface-2, #f8fafc);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-control-radius, var(--erp-radius-sm, 6px));
}
.erp-type-seg .btn {
    flex: 1 1 0;
    min-width: 0;
    border: none !important;
    border-radius: calc(var(--erp-control-radius, 6px) - 1px);
    font-weight: 550;
    min-height: calc(var(--erp-control-height, 2.35rem) - 0.25rem);
}
.erp-type-seg .btn.btn-outline-secondary {
    background: transparent;
    color: var(--erp-muted);
}
.erp-type-seg .btn.btn-primary {
    background: var(--erp-tab-active-bg, var(--erp-primary, #087f7b));
    color: var(--erp-tab-active-fg, var(--erp-primary-fg, #fff));
    font-weight: 700;
}
.erp-badge-type {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    padding: .15rem .45rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
}
.erp-badge-type.order { background: #ccfbf1; color: #0f766e; }
.erp-badge-type.internal { background: #e0e7ff; color: #3730a3; }
.erp-badge-type.flex { background: #fef3c7; color: #92400e; }
.erp-badge-type.sick { background: #fee2e2; color: #991b1b; }
.erp-badge-type.child { background: #fce7f3; color: #9d174d; }
.erp-week-page .erp-actions {
    align-items: flex-end;
}
.erp-week-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}
.erp-week-nav-label {
    font-size: 0.95rem;
    font-weight: 650;
    line-height: 1.2;
    color: var(--erp-text);
    white-space: nowrap;
}
.erp-week-sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    padding: .85rem 0;
    background: linear-gradient(180deg, transparent, var(--erp-bg, #f8fafc) 35%);
}
.erp-timeline-row {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem 0;
    border-bottom: 1px solid var(--erp-border, #e2e8f0);
    cursor: context-menu;
}
.erp-timeline-row:last-child { border-bottom: 0; }

/* ??? Picker with inline create action ??? */
.erp-picker-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: .5rem;
}
.erp-picker-row > .form-select { flex: 1 1 14rem; min-width: 0; }
.erp-picker-action {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    white-space: nowrap;
}
@media (max-width: 575.98px) {
    .erp-picker-row > .form-select,
    .erp-picker-action { flex: 1 1 100%; }
    .erp-picker-action { justify-content: center; }
}

/* ??? Side drawer (create-in-context) ??? */
.erp-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1070;
    background: rgba(15, 23, 42, .35);
}
.erp-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1071;
    width: min(32rem, 100vw);
    display: flex;
    flex-direction: column;
    background: var(--erp-surface, #fff);
    border-left: 1px solid var(--erp-border, #e2e8f0);
    box-shadow: -12px 0 32px rgba(15, 23, 42, .18);
}
.erp-drawer-header,
.erp-drawer-footer {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.25rem;
    background: var(--erp-surface, #fff);
}
.erp-drawer-header {
    justify-content: space-between;
    border-bottom: 1px solid var(--erp-border, #e2e8f0);
}
.erp-drawer-footer {
    border-top: 1px solid var(--erp-border, #e2e8f0);
    flex-wrap: wrap;
}
.erp-drawer-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 750;
    letter-spacing: -0.02em;
}
.erp-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.15rem 1.25rem;
}
.erp-drawer-section {
    margin: 1.35rem 0 .65rem;
    font-size: var(--erp-type-label);
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--erp-muted);
}
.erp-drawer-note {
    margin: 1.25rem 0 0;
    font-size: var(--erp-type-meta);
    color: var(--erp-muted);
}
@media (max-width: 640px) {
    .erp-drawer {
        width: 100vw;
        border-left: none;
    }
}

/* ?? Fase 6: lokationer, planl?gning, Revit ????????????????????????????????? */

.erp-sort {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
}
.erp-sort:hover { color: var(--erp-accent); text-decoration: underline; }

.erp-subheading {
    font-size: var(--erp-type-label);
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--erp-muted);
    margin: 0 0 .5rem;
}

.erp-breadcrumb {
    display: flex;
    gap: .4rem;
    font-size: var(--erp-type-meta);
    color: var(--erp-muted);
    margin-bottom: .25rem;
}
.erp-breadcrumb a { color: var(--erp-muted); }
.erp-breadcrumb a:hover { color: var(--erp-accent); }

.erp-dl {
    display: grid;
    grid-template-columns: minmax(7rem, auto) 1fr;
    gap: .4rem 1rem;
    margin: 0;
}
.erp-dl dt { color: var(--erp-muted); font-size: var(--erp-type-meta); font-weight: 500; }
.erp-dl dd { margin: 0; font-size: .875rem; }

/* Progress bar on the order overview */
.erp-progress {
    height: .6rem;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}
.erp-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--erp-accent), #14b8a6);
    transition: width .25s ease;
}
.erp-progress-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: .6rem;
    font-size: var(--erp-type-meta);
    color: var(--erp-muted);
}

/* Import wizard */
.erp-import-steps { display: flex; flex-wrap: wrap; gap: .5rem; }
.erp-import-step {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: var(--erp-type-meta);
    color: var(--erp-muted);
}
.erp-import-step-no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: #e5e7eb;
    color: #4b5563;
    font-weight: 650;
}
.erp-import-step.active { color: var(--erp-text); font-weight: 600; }
.erp-import-step.active .erp-import-step-no { background: var(--erp-accent); color: #fff; }
.erp-import-step.done .erp-import-step-no { background: #a7f3d0; color: #065f46; }
.erp-import-rows { max-height: 26rem; overflow-y: auto; }

/* Revit hierarchy */
.erp-revit-node { border-bottom: 1px solid var(--erp-border); }
.erp-revit-node:last-child { border-bottom: 0; }
.erp-revit-node-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .8rem 1.1rem;
    background: none;
    border: 0;
    text-align: left;
    cursor: pointer;
}
.erp-revit-node-head:hover { background: #f0fdfa; }
.erp-revit-node-title { font-weight: 600; }
.erp-revit-node-metrics {
    display: flex;
    gap: .9rem;
    margin-left: auto;
    font-size: var(--erp-type-meta);
    color: var(--erp-muted);
}
.erp-revit-empty {
    padding: .6rem 1.1rem 1rem 2.6rem;
    color: var(--erp-muted);
    font-size: var(--erp-type-meta);
}
.erp-revit-model {
    padding: .6rem 1.1rem .9rem 2.6rem;
    border-top: 1px dashed var(--erp-border);
}
.erp-revit-model-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin-bottom: .35rem;
}
.erp-revit-versions { font-size: var(--erp-type-meta); }

/* Location map tooltips (Leaflet appends to body ? must be global) */
.erp-map-leaflet-tooltip {
    background: #0f172a;
    color: #f8fafc;
    border: none;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
    padding: 0;
}
.erp-map-leaflet-tooltip::before {
    border-top-color: #0f172a;
}
.erp-map-tooltip {
    padding: 0.55rem 0.7rem;
    max-width: 16rem;
    font-size: 0.78rem;
    line-height: 1.35;
}
.erp-map-tip-title { font-weight: 650; margin-bottom: 0.15rem; }
.erp-map-tip-order { font-weight: 550; opacity: 0.95; }
.erp-map-tip-line { margin-top: 0.1rem; }
.erp-map-tip-muted { margin-top: 0.1rem; opacity: 0.75; }
.erp-map-tip-status { margin-top: 0.35rem; font-weight: 550; }
.erp-map-tip-next { margin-top: 0.25rem; opacity: 0.9; }

.erp-dashboard-map-body .erp-location-map--compact {
    border-radius: 0 0 var(--erp-radius) var(--erp-radius);
}

/* Planning + map split (fullscreen when Vis kort).
 * Size with inset:0 only — do NOT set height:100vh (overflows and clips the toolbar).
 * z-index must beat MainLayout .top-row (200) or the shell chrome covers this header
 * and the planning toolbar appears to "disappear" in map mode. Stay below modals (2000). */
.erp-planning-page.is-map-fs {
    position: fixed;
    inset: 0;
    z-index: 250;
    background: var(--erp-page-bg, var(--erp-bg));
    padding: 0.85rem 1rem 1rem;
    margin: 0;
    max-width: none;
    width: auto;
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    outline: none;
}
/* Toolbar (Normal/Tilbud, Dag/Uge/Måned, date nav, Vis weekend, Vis kort) must stay visible. */
.erp-planning-page.is-map-fs .erp-page-header {
    flex: 0 0 auto;
    flex-shrink: 0;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 5;
    display: flex;
    visibility: visible;
    opacity: 1;
    background: var(--erp-page-bg, var(--erp-bg));
}
.erp-planning-page.is-map-fs .erp-page-header .erp-actions {
    display: flex;
    visibility: visible;
    opacity: 1;
    flex-wrap: wrap;
}
.erp-planning-page.is-map-fs .erp-toolbar,
.erp-planning-page.is-map-fs .alert {
    flex: 0 0 auto;
    flex-shrink: 0;
}
.erp-planning-split {
    display: block;
    min-height: 0;
}
.erp-planning-page.is-map-fs .erp-planning-split.with-map {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.95fr);
    gap: 0.75rem;
    overflow: hidden;
}
.erp-planning-page.is-map-fs .erp-planning-split-main {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.erp-planning-page.is-map-fs .erp-planning {
    flex: 1;
    min-height: 0;
    height: 100%;
    max-height: none;
}
.erp-planning-page.is-map-fs .erp-planning-backlog {
    height: 100%;
    max-height: none;
}
.erp-planning-page.is-map-fs .erp-planning-split-map {
    min-width: 0;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    padding: 0.65rem;
    overflow: hidden;
}
/* Same flex fill as Lokationer side map — host must have a real box before Leaflet inits. */
.erp-planning-page.is-map-fs .erp-planning-split-map .location-map-view,
.erp-planning-page.is-map-fs .erp-planning-split-map .scan360-map-root {
    flex: 1 1 auto;
    min-height: 360px;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.erp-planning-page.is-map-fs .erp-planning-split-map .location-map-view-card,
.erp-planning-page.is-map-fs .erp-planning-split-map .scan360-map-shell {
    flex: 1 1 auto;
    min-height: 320px;
}
.erp-planning-page.is-map-fs .erp-planning-split-map .scan360-map-host--side,
.erp-planning-page.is-map-fs .erp-planning-split-map .erp-location-map--side {
    flex: 1 1 auto;
    height: 100%;
    min-height: 320px;
}
.erp-planning-page.is-map-fs .erp-planning-split-map .scan360-map-host--side .leaflet-container,
.erp-planning-page.is-map-fs .erp-planning-split-map .erp-location-map--side .leaflet-container,
.erp-planning-page.is-map-fs .erp-planning-split-map .leaflet-container {
    width: 100%;
    height: 100%;
    min-height: 320px;
}
.erp-planning-map-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}
.erp-planning-page.is-map-fs .erp-planning-backlog {
    position: static;
    height: 100%;
    max-height: none;
}
@media (max-width: 960px) {
    .erp-planning-page.is-map-fs .erp-planning-split.with-map {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) minmax(220px, 0.55fr);
    }
}

/* Planning calendar — time-grid week scheduler */
.erp-planning {
    display: grid;
    grid-template-columns: minmax(14rem, 17rem) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
    min-height: calc(100vh - 10.5rem);
    height: calc(100vh - 10.5rem);
    max-height: calc(100vh - 10.5rem);
    overflow: hidden;
}
.erp-planning-weekend {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
    font-size: var(--erp-type-meta);
    color: var(--erp-muted);
    white-space: nowrap;
}
.erp-planning-backlog {
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    padding: .65rem .45rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: calc(100vh - 10.5rem);
    height: calc(100vh - 10.5rem);
    overflow: hidden;
    position: sticky;
    top: 0.75rem;
}
.erp-planning-backlog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 .5rem .35rem;
    flex-shrink: 0;
}
.erp-planning-backlog-search {
    display: flex;
    align-items: center;
    gap: .25rem;
    padding: 0 .5rem .45rem;
    flex-shrink: 0;
}
.erp-planning-backlog-search .form-control {
    min-width: 0;
    flex: 1 1 auto;
}
.erp-planning-backlog-hint {
    flex-shrink: 0;
}
.erp-planning-backlog-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 .15rem .15rem;
    overscroll-behavior: contain;
}
.erp-planning-backlog-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.erp-planning-order-group {
    border: 1px solid var(--erp-border);
    border-radius: .5rem;
    background: color-mix(in srgb, var(--erp-surface-2, #f8fafc) 70%, #fff);
    overflow: hidden;
}
.erp-planning-order-group-head {
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: .55rem .65rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .15rem .5rem;
    cursor: pointer;
}
.erp-planning-order-group-head .erp-planning-order-group-title {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
    grid-column: 1;
}
.erp-planning-order-group-head .meta {
    grid-column: 1;
    font-size: var(--erp-type-meta);
    color: var(--erp-muted);
}
.erp-planning-order-group-summary {
    grid-column: 1;
    font-size: var(--erp-type-meta);
    color: var(--erp-text);
    font-weight: 550;
}
.erp-planning-order-group-head > .bi {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
    color: var(--erp-muted);
}
.erp-planning-order-group-locations {
    list-style: none;
    margin: 0;
    padding: 0 .45rem .55rem;
    display: grid;
    gap: .4rem;
}
.erp-planning-chip {
    border: 1px solid var(--erp-border);
    border-left: 3px solid var(--erp-accent);
    border-radius: .5rem;
    padding: .5rem .6rem;
    background: #fff;
    cursor: grab;
}
.erp-planning-chip.is-planned { border-left-color: #6366f1; }
.erp-planning-chip.is-unplanned { border-left-color: var(--erp-accent); }
.erp-planning-chip.is-needs-replanning { border-left-color: #d97706; background: color-mix(in srgb, #d97706 8%, var(--erp-surface)); }
.erp-planning-chip.is-dragging { opacity: .5; }
.erp-planning-chip-top { display: flex; justify-content: space-between; gap: .4rem; align-items: center; }
.erp-planning-chip .meta { font-size: var(--erp-type-meta); color: var(--erp-muted); margin-top: .1rem; }
.erp-planning-chip-plan {
    margin-top: .35rem;
    font-size: var(--erp-type-meta);
    color: var(--erp-text);
    font-weight: 550;
}
.erp-planning-chip-foot {
    display: flex;
    justify-content: space-between;
    font-size: var(--erp-type-meta);
    color: var(--erp-muted);
    margin-top: .3rem;
}

.erp-planning-grid { display: grid; gap: .5rem; }
.erp-planning-grid.cols-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.erp-planning-day {
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    min-height: 9rem;
    padding: .45rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.erp-planning-day.is-weekend { background: #fafafa; }
.erp-planning-day.is-today { border-color: var(--erp-accent); box-shadow: 0 0 0 1px var(--erp-accent) inset; }
.erp-planning-day-head {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: var(--erp-type-meta);
    color: var(--erp-muted);
}
.erp-planning-day-name { font-weight: 650; text-transform: capitalize; color: var(--erp-text); }
.erp-planning-day-num { margin-right: auto; }
.erp-planning-card {
    border: 1px solid var(--erp-border);
    border-left: 3px solid #9ca3af;
    border-radius: .45rem;
    padding: .35rem .45rem;
    background: #fff;
    cursor: pointer;
    font-size: .8rem;
    text-align: left;
    width: 100%;
}
.erp-planning-card.status-planned { border-left-color: #6366f1; }
.erp-planning-card.status-inprogress { border-left-color: #f59e0b; }
.erp-planning-card.status-completed { border-left-color: #10b981; }
.erp-planning-card.status-cancelled { border-left-color: #ef4444; opacity: .65; }
.erp-planning-card-time { font-weight: 650; }
.erp-planning-card-title { font-weight: 600; margin-top: .1rem; }

/* Week / day time grid */
.erp-planning-grid-wrap {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
.erp-week {
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
}
/* Planning calendar: fill available height; never scroll vertically (only Opgaver scrolls). */
.erp-planning .erp-week.erp-week--fit {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.erp-planning .erp-week.erp-week--fit .erp-week-head {
    flex-shrink: 0;
    position: static;
}
.erp-planning .erp-week.erp-week--fit .erp-week-body {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    min-width: 0;
}
.erp-planning .erp-week.erp-week--fit .erp-week-times {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}
.erp-planning .erp-week.erp-week--fit .erp-week-hour-label {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
}
.erp-planning .erp-week.erp-week--fit .erp-week-daycol {
    height: 100%;
    min-height: 0;
}
.erp-week-head {
    display: grid;
    grid-template-columns: 3.5rem repeat(auto-fit, minmax(0, 1fr));
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--erp-surface);
    border-bottom: 1px solid var(--erp-border);
}
.erp-week-day-head {
    padding: .55rem .4rem;
    text-align: center;
    border-left: 1px solid var(--erp-border);
}
.erp-week-day-head.is-today { background: color-mix(in srgb, var(--erp-accent) 10%, #fff); }
.erp-week-day-head.is-weekend { background: #fafafa; }
.erp-week-day-name {
    display: block;
    font-weight: 650;
    text-transform: capitalize;
    font-size: var(--erp-type-meta);
}
.erp-week-day-num { font-size: var(--erp-type-meta); color: var(--erp-muted); }
.erp-week-body {
    display: grid;
    grid-template-columns: 3.5rem repeat(auto-fit, minmax(0, 1fr));
    position: relative;
    min-width: 52rem;
}
.erp-week-gutter { background: var(--erp-surface); }
.erp-week-times {
    position: sticky;
    left: 0;
    z-index: 2;
    border-right: 1px solid var(--erp-border);
}
.erp-week-hour-label {
    font-size: .7rem;
    color: var(--erp-muted);
    padding: 0 .25rem;
    transform: translateY(-.45rem);
}
.erp-week-daycol {
    position: relative;
    border-left: 1px solid var(--erp-border);
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent calc(var(--hour-h) - 1px),
            rgba(15, 23, 42, .12) calc(var(--hour-h) - 1px),
            rgba(15, 23, 42, .12) var(--hour-h)
        );
}
.erp-week-daycol.is-weekend { background-color: #fafafa; }
.erp-week-daycol.is-today { background-color: color-mix(in srgb, var(--erp-accent) 4%, #fff); }
.erp-week-daycol.is-drop-target { outline: 2px dashed var(--erp-accent); outline-offset: -2px; }
.erp-week-slotline {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    pointer-events: none;
}
.erp-week-slotline.is-hour { border-top: 1px solid rgba(15, 23, 42, .14); }
.erp-week-slotline.is-quarter { border-top: 1px solid rgba(15, 23, 42, .06); }
.erp-week-now {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 2px solid #ef4444;
    z-index: 2;
    pointer-events: none;
}
.erp-week-now::before {
    content: "";
    position: absolute;
    left: -3px;
    top: -4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}
.erp-week-drop-ghost,
.erp-week-move-ghost {
    position: absolute;
    left: 2px;
    right: 2px;
    z-index: 4;
    box-sizing: border-box;
    border: 2px dashed var(--erp-accent);
    border-radius: .4rem;
    background: color-mix(in srgb, var(--erp-accent) 14%, #fff);
    color: var(--erp-accent);
    font-size: .75rem;
    font-weight: 700;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: .2rem .35rem;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}
.erp-week-move-ghost {
    background: color-mix(in srgb, var(--erp-accent) 20%, #fff);
    border-style: solid;
}
.erp-week-event {
    position: absolute;
    z-index: 1;
    box-sizing: border-box;
    border: 1px solid var(--erp-border);
    border-left: 3px solid #6366f1;
    border-radius: .4rem;
    background: #fff;
    padding: .25rem .35rem .45rem;
    overflow: hidden;
    cursor: grab;
    font-size: .72rem;
    line-height: 1.25;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
    touch-action: none;
    user-select: none;
}
.erp-week-event.is-moving {
    opacity: .35;
    cursor: grabbing;
}
.erp-week-event:active { cursor: grabbing; }
.erp-week-event-edit {
    position: absolute;
    top: .2rem;
    right: .2rem;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    border: 1px solid rgba(15, 23, 42, .12);
    background: rgba(255, 255, 255, .92);
    color: var(--erp-text);
    border-radius: .35rem;
    padding: .15rem .35rem;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}
.erp-week-event-edit:hover,
.erp-week-event-edit:focus-visible {
    background: #fff;
    border-color: var(--erp-accent);
    color: var(--erp-accent);
    outline: none;
}
.erp-week-event-edit span { display: none; }
.erp-week-event.is-compact .erp-week-event-edit {
    top: 50%;
    transform: translateY(-50%);
    padding: .1rem .3rem;
}
@media (max-width: 900px) {
    .erp-week-event-edit {
        padding: .35rem .5rem;
        font-size: .8rem;
        min-height: 2rem;
    }
    .erp-week-event-edit span { display: inline; }
}
.erp-week-event:focus-visible { outline: 2px solid var(--erp-accent); outline-offset: 1px; }
.erp-week-event.status-planned { border-left-color: #6366f1; background: #eef2ff; }
.erp-week-event.status-inprogress { border-left-color: #f59e0b; background: #fffbeb; }
.erp-week-event.status-completed { border-left-color: #10b981; background: #ecfdf5; }
.erp-week-event.status-cancelled { border-left-color: #ef4444; opacity: .65; }
.erp-week-event.is-compact { padding: .15rem .3rem; }
.erp-week-event.is-resizing {
    z-index: 5;
    box-shadow: 0 0 0 1px var(--erp-accent);
    cursor: ns-resize;
}
.erp-week-event-time { font-weight: 700; }
.erp-week-event-title { font-weight: 650; margin-top: .1rem; }
.erp-week-event-meta { color: var(--erp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.erp-week-event-line { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.erp-week-event-preview {
    margin-top: .2rem;
    font-weight: 700;
    color: var(--erp-accent);
}
.erp-week-resize {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 12px;
    cursor: ns-resize;
    touch-action: none;
    z-index: 2;
    background: linear-gradient(to bottom, transparent 35%, rgba(15, 23, 42, .1));
}
.erp-week-resize::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 3px;
    width: 28px;
    height: 3px;
    margin-left: -14px;
    border-radius: 2px;
    background: rgba(15, 23, 42, .35);
}
.erp-week-event:hover .erp-week-resize::after,
.erp-week-event.is-resizing .erp-week-resize::after {
    background: var(--erp-accent);
}
/* Planning dialogs use ErpModal; legacy class kept for selectors only (no z-index override). */
.erp-planning-dialog .modal-dialog,
.erp-planning-dialog .erp-modal-dialog {
    max-width: min(var(--erp-modal-width, 36rem), calc(100vw - 2rem));
}


/*
 * Canonical ERP dialogs ? ROOT FIX for ?grey full-width form? / inline-under-list modals.
 *
 * After shell single-scroll (5e51e67: .workspace-body overflow), Bootstrap position:fixed
 * dialogs rendered inside @Body were trapped in the scroll stack. The modal?s own
 * backdrop colour (inline background:rgba(0,0,0,.4) or Bootstrap dim) then painted a
 * huge grey block in document flow (Customer Contact edit, Genkald Registrer opkald).
 *
 * Force viewport overlay for every .modal.show.d-block (incl. ErpModal).
 * Content modifiers (.erp-generate-leads, .erp-dialog-mail) refine body chrome only.
 * !important is required to beat Bootstrap + scroll containing-block quirks — documented.
 */
.modal.show.d-block {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    inset: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    margin: 0 !important;
    padding: 1rem !important;
    z-index: 2000 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}
.modal.show.d-block .modal-dialog {
    position: relative !important;
    z-index: 2001;
    margin: auto !important;
    max-width: min(40rem, calc(100vw - 2rem));
    width: 100%;
    pointer-events: auto;
}
.modal.show.d-block .modal-dialog.modal-lg,
.modal.show.d-block .modal-dialog.modal-xl {
    max-width: min(72rem, calc(100vw - 2rem));
}
.modal.show.d-block .modal-dialog.modal-sm {
    max-width: min(24rem, calc(100vw - 2rem));
}
.modal.show.d-block .modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    background: var(--erp-surface, #fff) !important;
    color: var(--erp-text, #0f172a);
    border: 1px solid var(--erp-border, #e2e8f0);
    border-radius: var(--erp-card-radius, var(--erp-radius, 12px));
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
}
.modal.show.d-block .modal-header,
.modal.show.d-block .modal-body,
.modal.show.d-block .modal-footer {
    background: var(--erp-surface, #fff) !important;
}
.modal.show.d-block .modal-body {
    max-height: min(70vh, 40rem);
    overflow-x: hidden;
    overflow-y: auto;
}

/* Alias kept for markup clarity (Genkald / CrmActivityPanel). */
.erp-viewport-modal.modal { /* inherits .modal.show.d-block */ }

/*
 * FORM + MODAL STANDARD
 * Use ErpModal / ErpFormGrid / ErpField / ErpChoiceGroup / ErpModalFooter
 * (or matching erp-* classes). Width is content-driven (~560?720px), never near full-screen.
 * Do not use modal-fullscreen-sm-down, inline backdrop, or form-control-lg in new dialogs.
 */
.erp-modal.modal { /* inherits .modal.show.d-block viewport escape */ }
.modal.show.d-block .modal-dialog.erp-modal-dialog,
.modal.show.d-block .erp-modal-dialog {
    width: 100%;
    margin: auto !important;
}
.modal.show.d-block .erp-modal-dialog.erp-modal--sm {
    max-width: min(var(--erp-modal-width-sm, 28rem), calc(100vw - 2rem));
}
.modal.show.d-block .erp-modal-dialog.erp-modal--md {
    max-width: min(var(--erp-modal-width, 36rem), calc(100vw - 2rem));
}
.modal.show.d-block .erp-modal-dialog.erp-modal--lg {
    max-width: min(var(--erp-modal-width-lg, 42rem), calc(100vw - 2rem));
}
.modal.show.d-block .erp-modal-dialog.erp-modal--xl {
    max-width: min(var(--erp-modal-width-xl, 72rem), calc(100vw - 2rem));
}
/* Cap legacy fullscreen-sm-down so it cannot become near full-screen on small tablets. */
.modal.show.d-block .modal-dialog.modal-fullscreen-sm-down {
    max-width: min(var(--erp-modal-width, 36rem), calc(100vw - 2rem));
    width: 100%;
    height: auto;
    margin: auto !important;
}
@media (max-width: 575.98px) {
    .modal.show.d-block .modal-dialog.modal-fullscreen-sm-down {
        max-width: calc(100vw - 1.5rem);
    }
}

.erp-modal-header.modal-header,
.modal.show.d-block .erp-modal-header {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    padding: var(--erp-modal-header-padding, 0.85rem 1.1rem);
    gap: 0.75rem;
    border-bottom: 1px solid var(--erp-border);
    /* Clip any leftover glyph/chrome so it cannot paint a sliver under the title. */
    overflow: hidden;
}
.erp-modal-header-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
/* Title-only headers: never introduce column gap / empty slot chrome under the title. */
.erp-modal-header:not(.erp-modal-header--extras) > .modal-title {
    display: block;
}
.erp-modal-header .modal-title {
    margin: 0;
    padding: 0;
    border: 0;
    border-bottom: 0;
    outline: none;
    box-shadow: none;
    text-decoration: none;
    background: transparent;
    background-image: none;
    line-height: 1.3;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}
.erp-modal-header .modal-title::before,
.erp-modal-header .modal-title::after {
    content: none !important;
    display: none !important;
    border: 0 !important;
    width: 0 !important;
    height: 0 !important;
}
.erp-modal-subtitle {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: var(--erp-font-size-sm, 0.875rem);
    color: var(--erp-muted, var(--erp-text-muted));
    line-height: 1.35;
}
.erp-modal-subtitle:empty {
    display: none;
}
/* Visible ? close ? never empty Bootstrap .btn-close (SVG bg = empty box/sliver). */
.erp-modal-close {
    flex: 0 0 auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--erp-control-radius, var(--erp-radius-sm, 6px));
    background: transparent;
    background-image: none;
    color: var(--erp-muted, var(--erp-text-muted));
    font-size: 1.35rem;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
}
.erp-modal-close > span {
    display: block;
    line-height: 1;
    transform: translateY(-0.05em);
}
.erp-modal-close::before,
.erp-modal-close::after {
    content: none !important;
    display: none !important;
    background: none !important;
    border: 0 !important;
}
.erp-modal-close:hover {
    color: var(--erp-text);
    background: var(--erp-surface-2, #f8fafc);
}
.erp-modal-close:focus-visible {
    outline: var(--erp-focus-ring-size, 3px) solid color-mix(in srgb, var(--erp-primary) 45%, transparent);
    outline-offset: 2px;
}
.erp-modal-body.modal-body,
.modal.show.d-block .erp-modal-body {
    padding: var(--erp-modal-body-padding, 1rem 1.1rem);
    display: flex;
    flex-direction: column;
    gap: var(--erp-modal-section-gap, var(--erp-form-row-gap, 0.85rem));
}
.erp-modal-footer.modal-footer,
.modal.show.d-block .erp-modal-footer {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    align-self: stretch;
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: var(--erp-modal-footer-padding, 0.75rem 1.1rem);
    gap: 0.5rem;
    border-top: 1px solid var(--erp-border);
    background: var(--erp-surface-2, var(--erp-surface)) !important;
}
/* Bootstrap .modal-footer > * margins inset the bar visually — use gap only. */
.erp-modal-footer.modal-footer > *,
.modal.show.d-block .erp-modal-footer > * {
    margin: 0;
}
.erp-modal-footer-start {
    margin-right: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.erp-modal-footer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-left: auto;
}
.erp-modal-footer .btn {
    min-height: var(--erp-button-height, 2.3rem);
    padding-left: var(--erp-button-padding-x, 0.8rem);
    padding-right: var(--erp-button-padding-x, 0.8rem);
}

/*
 * ErpModal + modal-dialog-scrollable: real flex height chain.
 * Bootstrap sets height:100% on .modal-dialog-scrollable (unreliable under our
 * flex-centered .modal.show.d-block). .erp-modal-body is a flex column, so
 * children default flex-shrink:1 and .erp-card { overflow:hidden } clips
 * content while the body never overflows — no scrollbar (Godkendelser Vis).
 * Must live in app.css (not Blazor scoped CSS): ErpModal is a child component
 * outside any page-scoped ancestor, so Approvals.razor.css ::deep never matched.
 */
.modal.show.d-block .erp-modal-dialog.modal-dialog-scrollable {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: min(90vh, calc(100dvh - 2rem));
    overflow: hidden;
}
.modal.show.d-block .erp-modal-dialog.modal-dialog-scrollable .modal-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(90vh, calc(100dvh - 2rem));
    overflow: hidden;
}
.modal.show.d-block .erp-modal-dialog.modal-dialog-scrollable .erp-modal-header,
.modal.show.d-block .erp-modal-dialog.modal-dialog-scrollable .erp-modal-footer,
.modal.show.d-block .erp-modal-dialog.modal-dialog-scrollable .modal-header,
.modal.show.d-block .erp-modal-dialog.modal-dialog-scrollable .modal-footer {
    flex: 0 0 auto;
}
.modal.show.d-block .erp-modal-dialog.modal-dialog-scrollable .erp-modal-body,
.modal.show.d-block .erp-modal-dialog.modal-dialog-scrollable .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow-x: hidden;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Make the scrollport obvious when content exceeds the dialog. */
    scrollbar-gutter: stable;
}
.modal.show.d-block .erp-modal-dialog.modal-dialog-scrollable .erp-modal-body > *,
.modal.show.d-block .erp-modal-dialog.modal-dialog-scrollable .modal-body > * {
    flex-shrink: 0;
}

/* Godkendelser Vis (xl): same chain, explicit hook for tests / future overrides. */
.modal.show.d-block .erp-approvals-week-dialog {
    max-height: min(90vh, calc(100dvh - 2rem));
}
.modal.show.d-block .erp-approvals-week-dialog .modal-content {
    max-height: min(90vh, calc(100dvh - 2rem));
}
.modal.show.d-block .erp-approvals-week-dialog .erp-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow-y: auto !important;
}
.modal.show.d-block .erp-approvals-week-dialog .erp-modal-body > * {
    flex-shrink: 0;
}

.erp-field {
    display: flex;
    flex-direction: column;
    gap: var(--erp-label-gap, 0.35rem);
    min-width: 0;
}
.erp-field > .form-label {
    margin-bottom: 0;
}

.erp-form-section {
    display: flex;
    flex-direction: column;
    gap: var(--erp-form-row-gap, 0.85rem);
    min-width: 0;
}
.erp-form-section + .erp-form-section {
    margin-top: 0.15rem;
    padding-top: var(--erp-modal-section-gap, 0.95rem);
    border-top: 1px solid var(--erp-border);
}
.erp-form-section-title {
    margin: 0;
    font-size: var(--erp-font-size-sm, 0.8125rem);
    font-weight: 650;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--erp-muted, var(--erp-text-muted));
    line-height: 1.3;
}

.erp-form-context {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-control-radius, var(--erp-radius-sm, 6px));
    background: var(--erp-surface-2, #f8fafc);
}
.erp-form-context-title {
    font-weight: 650;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
}
.erp-form-context-meta {
    font-size: var(--erp-helper-font-size, var(--erp-font-size-sm, 0.8125rem));
    color: var(--erp-muted, var(--erp-text-muted));
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
}

.erp-readonly-value {
    min-height: var(--erp-control-height, 2.35rem);
    display: flex;
    align-items: center;
    padding: 0 var(--erp-control-padding-x, 0.7rem);
    border: 1px solid transparent;
    border-radius: var(--erp-control-radius, var(--erp-radius-sm, 6px));
    background: var(--erp-surface-2, #f8fafc);
    color: var(--erp-text);
    font-weight: 550;
    line-height: 1.3;
}

.erp-helper-text {
    margin: 0;
    font-size: var(--erp-helper-font-size, var(--erp-font-size-sm, 0.8125rem));
    color: var(--erp-muted, var(--erp-text-muted));
    line-height: 1.4;
}
.erp-helper-text--info {
    color: var(--erp-info, var(--erp-muted));
}
.erp-helper-text--warning {
    color: var(--erp-warning, #b45309);
}

.erp-check-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--erp-control-height, 2.35rem);
}
.erp-check-row .form-check {
    margin: 0;
    min-height: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.erp-check-row .form-check-input {
    margin-top: 0;
}

.erp-modal .modal-content {
    border-radius: var(--erp-modal-radius, var(--erp-card-radius, 8px));
    box-shadow: var(--erp-modal-shadow, var(--erp-card-shadow));
}

/* Even-width segmented choice for forms (Type = Ordre / Intern / ?). */
.erp-choice-group {
    display: flex;
    width: 100%;
    gap: 0.2rem;
    padding: 0.2rem;
    background: var(--erp-surface-2, #f8fafc);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-control-radius, var(--erp-radius-sm, 6px));
}
.erp-choice-group button {
    appearance: none;
    flex: 1 1 0;
    min-width: 0;
    border: none;
    background: transparent;
    font-family: var(--erp-font);
    font-size: var(--erp-font-size-sm, 0.8125rem);
    font-weight: 550;
    color: var(--erp-muted);
    min-height: calc(var(--erp-control-height, 2.35rem) - 0.25rem);
    padding: 0.3rem 0.45rem;
    border-radius: calc(var(--erp-control-radius, 6px) - 1px);
    cursor: pointer;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.erp-choice-group button:hover:not(:disabled):not(.active) {
    color: var(--erp-text);
    background: color-mix(in srgb, var(--erp-surface) 70%, transparent);
}
.erp-choice-group button.active {
    background: var(--erp-tab-active-bg, var(--erp-primary, #087f7b));
    color: var(--erp-tab-active-fg, var(--erp-primary-fg, #fff));
    font-weight: 700;
}
.erp-choice-group button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.erp-choice-group button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 var(--erp-focus-ring-size, 3px) color-mix(in srgb, var(--erp-primary, #087f7b) 28%, transparent);
}
html[data-design-profile="executive"] .erp-choice-group {
    border-radius: var(--erp-tab-bar-radius, 999px);
    padding: 0.25rem;
}
html[data-design-profile="executive"] .erp-choice-group button {
    border-radius: 999px;
}
html[data-design-profile="operations"] .erp-choice-group {
    border-radius: var(--erp-card-radius, 2px);
    border-width: var(--erp-border-emphasis, 1.5px);
}
html[data-design-profile="operations"] .erp-choice-group button {
    border-radius: 0;
}

/* Coherent search + select lookup (ordre picker). */
.erp-lookup {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
}
.erp-lookup-status {
    font-size: var(--erp-font-size-sm, 0.8125rem);
    color: var(--erp-muted);
}

/* Follow-up / quick-offset chips inside ErpField (Registrer opkald). */
.erp-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.erp-chip-row .btn {
    min-height: 2rem;
}

/* Checkbox / switch callout block (finish-order, whole-day, ?). */
.erp-check-block {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-control-radius, var(--erp-radius-sm));
    background: var(--erp-surface-2, #f8fafc);
}
.erp-check-block .form-check {
    margin: 0;
    min-height: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}
.erp-check-block .form-check-input {
    margin-top: 0.2rem;
}
.erp-check-block .form-text {
    margin: 0 0 0 1.65rem;
}

@media (max-width: 639.98px) {
    .erp-choice-group {
        flex-wrap: wrap;
    }
    .erp-choice-group button {
        flex: 1 1 calc(50% - 0.2rem);
        white-space: normal;
    }
}

/* Profile structural variants ? beyond token sizes (tabs / tables / cards). */
html[data-design-profile="nordic-pro"] .erp-tabs {
    background: var(--erp-surface);
    box-shadow: none;
}
html[data-design-profile="executive"] .erp-tabs {
    background: color-mix(in srgb, var(--erp-surface-2) 80%, var(--erp-surface));
    padding: 0.35rem;
    border-radius: var(--erp-tab-bar-radius, 999px);
}
html[data-design-profile="executive"] .erp-card {
    box-shadow: var(--erp-card-shadow);
}
html[data-design-profile="operations"] .erp-tabs {
    background: var(--erp-surface);
    border-radius: var(--erp-tab-bar-radius, 4px);
    padding: 0;
    gap: 0;
    box-shadow: none;
}
html[data-design-profile="operations"] .erp-tab {
    border-radius: 0;
    border-right: var(--erp-border-emphasis, 1.5px) solid var(--erp-border);
}
html[data-design-profile="operations"] .erp-tab:last-child { border-right: none; }
html[data-design-profile="operations"] .erp-tab.active {
    box-shadow: none;
}
html[data-design-profile="operations"] .erp-table-shell {
    border-width: var(--erp-border-emphasis, 1.5px);
    border-radius: var(--erp-card-radius, 4px);
    box-shadow: none;
}
html[data-design-profile="operations"] .erp-table-shell .table > :not(caption) > * > * {
    border-bottom-width: 1px;
    border-color: var(--erp-border);
}
html[data-design-profile="operations"] .erp-card {
    box-shadow: none;
}

/* Mail viewer body (shell = ErpModal) */
.erp-dialog-mail .modal-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 2.5rem);
}
.erp-dialog-mail .erp-dialog-mail-body {
    background: var(--erp-surface-2, #f8fafc);
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.45;
    font-size: 0.95rem;
}
.erp-dialog-mail-body.is-text {
    white-space: pre-wrap;
}
.erp-dialog-mail-body.is-html {
    white-space: normal;
}
.erp-dialog-mail-body.is-html p {
    margin: 0 0 0.75em;
}
.erp-dialog-mail-body.is-html p:last-child {
    margin-bottom: 0;
}
.erp-dialog-mail-body.is-html blockquote {
    margin: 0.75em 0;
    padding-left: 0.75rem;
    border-left: 3px solid var(--erp-border, #cbd5e1);
    color: var(--erp-text-muted, #475569);
}
.erp-dialog-mail-body.is-html pre {
    white-space: pre-wrap;
    margin: 0.75em 0;
}
.erp-dialog-mail-body.is-html table {
    width: 100%;
    margin: 0.75em 0;
    border-collapse: collapse;
}
.erp-dialog-mail-body.is-html td,
.erp-dialog-mail-body.is-html th {
    padding: 0.25rem 0.5rem;
    vertical-align: top;
}

/* Generér leads content (shell = ErpModal xl) */
.erp-generate-leads .erp-gen-panel,
.erp-generate-leads .erp-code-tree,
.erp-generate-leads .erp-code-tree-body {
    position: relative;
    z-index: 0;
}
.erp-gen-steps {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}
.erp-gen-steps li {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--erp-text-muted);
}
.erp-gen-steps li.is-active { color: var(--erp-primary); }
.erp-gen-steps li.is-done { color: var(--erp-text-secondary); }
.erp-gen-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 999px;
    font-size: .75rem;
    background: var(--erp-surface-2);
    color: inherit;
}
.erp-gen-steps li.is-active .erp-gen-step-num {
    background: var(--erp-primary);
    color: var(--erp-primary-fg);
}
.erp-gen-section {
    margin-bottom: 1.1rem;
}
.erp-gen-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .55rem;
}
.erp-gen-section-title {
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
    color: var(--erp-text);
}
.erp-gen-fields .form-label {
    font-size: .8rem;
    color: var(--erp-text-secondary);
    margin-bottom: .2rem;
}
.erp-gen-panel {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm, 8px);
    background: var(--erp-surface);
    padding: .65rem .75rem .75rem;
    height: 100%;
}
.erp-gen-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .45rem;
    font-weight: 700;
    font-size: .9rem;
}
.erp-gen-search-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: .85rem;
}
.erp-gen-placeholder {
    border: 1px dashed var(--erp-border-strong);
    border-radius: var(--erp-radius-sm, 8px);
    padding: 1.25rem 1rem;
    color: var(--erp-text-muted);
    font-size: .9rem;
    background: var(--erp-surface-2);
}
.erp-gen-results-table {
    max-height: 18rem;
    overflow: auto;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm, 8px);
}
.erp-gen-results-table thead {
    background: var(--erp-surface-2);
}
.erp-gen-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    border-top-color: var(--erp-border);
}
.erp-code-tree-toolbar {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: .45rem;
}
.erp-code-tree-toolbar .form-control {
    flex: 1 1 10rem;
    min-width: 8rem;
}
.erp-code-tree-count { white-space: nowrap; font-size: .8rem; }
.erp-code-tree-body {
    max-height: 14rem;
    overflow: auto;
    border: 1px solid var(--erp-border);
    border-radius: 6px;
    padding: .2rem 0;
    background: var(--erp-surface);
}
.erp-code-tree-group-head {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .5rem;
    position: sticky;
    top: 0;
    background: var(--erp-surface);
    z-index: 1;
}
.erp-code-tree-toggle {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    border: 0;
    background: transparent;
    padding: .1rem 0;
    text-align: left;
    flex: 1 1 auto;
    min-width: 0;
    font: inherit;
    color: inherit;
}
.erp-code-tree-toggle:hover { color: var(--erp-primary); }
.erp-code-tree-chevron {
    width: 1rem;
    color: var(--erp-text-muted);
}
.erp-code-tree-group-label {
    font-weight: 600;
    font-size: .875rem;
}
.erp-code-tree-select-all {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    white-space: nowrap;
}
.erp-code-tree-children {
    display: flex;
    flex-direction: column;
    gap: .05rem;
    padding: 0 .5rem .3rem 1.5rem;
}
.erp-code-tree-leaf {
    display: flex;
    align-items: flex-start;
    gap: .35rem;
    margin: 0;
    padding: .08rem 0;
    font-size: .84rem;
}
.erp-code-tree-leaf .form-check-label { line-height: 1.3; }

@media (max-width: 1100px) {
    .erp-planning {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
        min-height: 0;
        overflow: visible;
    }
    .erp-planning-backlog {
        position: static;
        height: auto;
        max-height: min(22rem, 45vh);
    }
    .erp-planning .erp-week.erp-week--fit {
        height: min(70vh, 36rem);
        min-height: 22rem;
    }
    .erp-week-body { min-width: 40rem; }
    .erp-planning-grid.cols-7 { grid-template-columns: 1fr; }
    .erp-planning-day { min-height: auto; }
}

/* Time registration calendar ? reuses .erp-week* grid; type colors + mobile day strip */
.erp-time-reg .erp-page-header { gap: .75rem; }
.erp-time-lock-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .5rem;
}
.erp-time-grid-wrap { margin-bottom: 1.5rem; }
.erp-time-week.is-day .erp-week-body { min-width: 0; }
.erp-time-week .erp-week-event {
    cursor: pointer;
    touch-action: manipulation;
}
.erp-time-week .erp-week-event.is-readonly { cursor: default; opacity: .92; }
.erp-time-week .erp-week-daycol.is-locked { cursor: not-allowed; }
.erp-time-week .erp-week-daycol:not(.is-locked) { cursor: pointer; }

.erp-week-event.type-order { border-left-color: #0f766e; background: #ccfbf1; }
.erp-week-event.type-internal { border-left-color: #3730a3; background: #e0e7ff; }
.erp-week-event.type-flex { border-left-color: #92400e; background: #fef3c7; }
.erp-week-event.type-sick { border-left-color: #991b1b; background: #fee2e2; }
.erp-week-event.type-vacation { border-left-color: #1d4ed8; background: #dbeafe; }
.erp-week-event.type-extra-vacation { border-left-color: #6d28d9; background: #ede9fe; }
.erp-week-event.type-child { border-left-color: #9d174d; background: #fce7f3; }

.erp-time-daystrip {
    display: flex;
    gap: .4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: .15rem 0 .75rem;
    margin-bottom: .25rem;
    scrollbar-width: thin;
}
.erp-time-daychip {
    flex: 1 0 3.85rem;
    min-width: 3.85rem;
    min-height: 5.35rem;
    border: 1px solid var(--erp-border);
    border-radius: .55rem;
    background: var(--erp-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .1rem;
    padding: .35rem .2rem .3rem;
    color: var(--erp-text);
    cursor: pointer;
    user-select: none;
}
.erp-time-daychip .name {
    font-size: .7rem;
    font-weight: 650;
    text-transform: uppercase;
    color: var(--erp-muted);
}
.erp-time-daychip .num { font-size: 1.05rem; font-weight: 700; line-height: 1.1; }
.erp-time-daychip-sum {
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--erp-text);
    white-space: nowrap;
}
.erp-time-daychip-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    font-size: .62rem;
    line-height: 1.15;
    color: var(--erp-muted);
}
.erp-time-daychip-meta > span {
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.erp-time-daychip-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .12rem;
    margin-top: .05rem;
}
.erp-time-daychip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: .4rem;
    background: color-mix(in srgb, var(--erp-accent) 10%, #fff);
    color: var(--erp-accent);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
}
.erp-time-daychip-icon:hover:not(:disabled) {
    background: color-mix(in srgb, var(--erp-accent) 22%, #fff);
    border-color: color-mix(in srgb, var(--erp-accent) 35%, #fff);
}
.erp-time-daychip-icon:disabled {
    opacity: .45;
    cursor: not-allowed;
}
.erp-time-daychip.active .erp-time-daychip-icon {
    background: color-mix(in srgb, var(--erp-accent) 18%, #fff);
}
.erp-time-daychip.is-today { box-shadow: 0 0 0 1px var(--erp-accent) inset; }
.erp-time-daychip.active {
    border-color: var(--erp-accent);
    background: color-mix(in srgb, var(--erp-accent) 12%, #fff);
    font-weight: 700;
}
.erp-time-daychip.active .name { color: var(--erp-accent); font-weight: 700; }
.erp-time-daychip.active .erp-time-daychip-sum { color: var(--erp-accent); }

.erp-time-allday {
    display: grid;
    border-bottom: 1px solid var(--erp-border);
    background: var(--erp-surface);
}
.erp-time-allday-label {
    font-size: .7rem;
    color: var(--erp-muted);
    padding: .45rem .25rem;
    display: flex;
    align-items: center;
}
.erp-time-allday-cell {
    border-left: 1px solid var(--erp-border);
    padding: .35rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
    min-height: 2.4rem;
}
.erp-time-allday-chip {
    border: 1px solid var(--erp-border);
    border-left-width: 3px;
    border-radius: .4rem;
    padding: .35rem .45rem;
    font-size: .78rem;
    font-weight: 600;
    text-align: left;
    background: #fff;
    min-height: 2.25rem;
}
.erp-time-allday-chip.type-order { border-left-color: #0f766e; background: #ccfbf1; }
.erp-time-allday-chip.type-internal { border-left-color: #3730a3; background: #e0e7ff; }
.erp-time-allday-chip.type-flex { border-left-color: #92400e; background: #fef3c7; }
.erp-time-allday-chip.type-sick { border-left-color: #991b1b; background: #fee2e2; }
.erp-time-allday-chip.type-child { border-left-color: #9d174d; background: #fce7f3; }
.erp-time-allday-chip.type-vacation { border-left-color: #1d4ed8; background: #dbeafe; }
.erp-time-allday-chip.type-extra-vacation { border-left-color: #6d28d9; background: #ede9fe; }

/* Time dialogs use ErpModal + erp-modal--md; legacy class kept for selectors only (no z-index override). */
.erp-time-dialog .modal-dialog,
.erp-leave-dialog .modal-dialog {
    max-width: min(var(--erp-modal-width, 36rem), calc(100vw - 2rem));
}
.erp-time-dialog-footer { /* deprecated ? use ErpModalFooter */ flex-wrap: wrap; gap: .5rem; }

@media (min-width: 900px) {
    .erp-time-reg .erp-actions .erp-segment { order: 0; }
}

@media (max-width: 640px) {
    .erp-time-reg .erp-page-header .erp-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: .5rem;
    }
    .erp-time-reg .erp-page-header .erp-actions .btn-lg {
        min-height: 2.75rem;
    }
    .erp-time-week .erp-week-event-edit {
        padding: .4rem .55rem;
        min-height: 2.25rem;
    }
}

/* ??? Tid statistik ??? */
.sidebar .nav-subgroup-label {
    display: block;
    width: 100%;
    margin: 0.35rem 0.65rem 0.15rem 1.35rem;
    padding: 0;
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--erp-sidebar-text-muted, var(--erp-sidebar-muted));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar .nav-link.nav-link-nested,
.sidebar a.nav-link.nav-link-nested {
    padding-left: 1.55rem;
}
.sidebar.is-collapsed .nav-link.nav-link-nested,
.sidebar.is-collapsed a.nav-link.nav-link-nested {
    padding-left: 12px;
}

button.erp-metric-btn {
    appearance: none;
    border: 1px solid var(--erp-border);
    cursor: pointer;
    text-align: left;
    font: inherit;
    width: 100%;
}
button.erp-metric-btn:hover {
    border-color: #99f6e4;
    box-shadow: var(--erp-shadow-md);
    transform: translateY(-1px);
}
button.erp-metric-btn.is-active {
    border-color: var(--erp-primary, var(--erp-accent));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--erp-primary, var(--erp-accent)) 28%, transparent);
}

.erp-stats-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 1000px) {
    .erp-stats-charts {
        grid-template-columns: 1fr 1fr;
    }
}

.erp-css-chart-legend {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.65rem;
    font-size: 0.75rem;
    font-weight: 650;
}
.erp-css-lg::before {
    content: "";
    display: inline-block;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 2px;
    margin-right: 0.35rem;
    vertical-align: middle;
}
.erp-css-lg-prod::before { background: var(--erp-primary, #087F7B); }
.erp-css-lg-int::before { background: #94a3b8; }
.erp-css-lg-mile::before { background: #0ea5e9; }
.erp-css-lg-exp::before { background: #ca8a04; }
.erp-css-lg-sick::before { background: #ef4444; }
.erp-css-lg-vac::before { background: #eab308; }

.erp-css-chart {
    display: flex;
    align-items: stretch;
    gap: 0.25rem;
    min-height: 160px;
    width: 100%;
}
.erp-css-col {
    flex: 1 1 0;
    min-width: 0;
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}
.erp-css-col:hover .erp-css-bar { opacity: 0.85; }
.erp-css-bars {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    min-height: 120px;
    border-bottom: 1px solid var(--erp-border);
    padding-bottom: 2px;
}
.erp-css-bar {
    width: 42%;
    max-width: 14px;
    min-height: 2px;
    border-radius: 3px 3px 0 0;
    background: var(--erp-primary, #087F7B);
}
.erp-css-bar-prod { background: var(--erp-primary, #087F7B); }
.erp-css-bar-int { background: #94a3b8; }
.erp-css-bar-mile { background: #0ea5e9; }
.erp-css-bar-exp { background: #ca8a04; }
.erp-css-bar-sick { background: #ef4444; }
.erp-css-bar-vac { background: #eab308; }
.erp-css-bar-flex-pos { background: #059669; width: 55%; max-width: 18px; }
.erp-css-bar-flex-neg { background: #d97706; width: 55%; max-width: 18px; border-radius: 0 0 3px 3px; }

.erp-css-chart-split .erp-css-split-bars {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 120px;
}
.erp-css-split-top,
.erp-css-split-bot {
    flex: 1;
    display: flex;
    justify-content: center;
}
.erp-css-split-top { align-items: flex-end; }
.erp-css-split-bot { align-items: flex-start; }
.erp-css-split-mid {
    height: 1px;
    background: var(--erp-border);
    width: 100%;
}

.erp-css-col-label {
    font-size: 0.68rem;
    color: var(--erp-muted);
    font-weight: 600;
}

.erp-line-chart {
    width: 100%;
}
.erp-line-lg {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 650;
}
.erp-line-lg-swatch {
    display: inline-block;
    width: 0.85rem;
    height: 0.28rem;
    border-radius: 2px;
}
.erp-line-chart-plot {
    width: 100%;
}
.erp-line-chart-svg {
    width: 100%;
    height: 160px;
    display: block;
}
.erp-line-grid {
    stroke: var(--erp-border);
    stroke-width: 1;
    stroke-dasharray: 3 3;
    vector-effect: non-scaling-stroke;
}
.erp-line-zero {
    stroke: color-mix(in srgb, var(--erp-muted) 55%, transparent);
    stroke-width: 1.25;
    vector-effect: non-scaling-stroke;
}
.erp-line-path {
    vector-effect: non-scaling-stroke;
}
.erp-line-hit {
    cursor: pointer;
}
.erp-line-hit:hover .erp-line-dot {
    r: 5;
}
.erp-line-chart-labels {
    display: flex;
    justify-content: space-between;
    gap: 0.15rem;
    margin-top: 0.35rem;
}
.erp-line-xlabel {
    flex: 1 1 0;
    min-width: 0;
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    font-size: 0.68rem;
    color: var(--erp-muted);
    font-weight: 600;
    text-align: center;
}
.erp-line-xlabel:hover {
    color: var(--erp-primary, #087F7B);
}

.erp-stats-week-bar-row-compact {
    grid-template-columns: 2.5rem 1fr;
}
.erp-stats-week-bar-row-compact .erp-stats-week-val {
    text-align: left;
}

.erp-stats-week-bars {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.erp-stats-week-bar-row {
    display: grid;
    grid-template-columns: 2.5rem 1fr 5.5rem;
    gap: 0.5rem;
    align-items: center;
}
.erp-stats-week-label {
    font-size: 0.75rem;
    color: var(--erp-muted);
    font-weight: 600;
}
.erp-stats-week-track {
    height: 0.55rem;
    background: var(--erp-surface-2, #f1f5f9);
    border-radius: 999px;
    overflow: hidden;
}
.erp-stats-week-fill {
    height: 100%;
    background: var(--erp-primary, #087F7B);
    border-radius: 999px;
    min-width: 0;
}
.erp-stats-week-fill.neg {
    background: var(--erp-warning, #d97706);
}
.erp-stats-week-val {
    font-size: 0.75rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
 * TIME INPUT STANDARD ? ErpTimePicker (HH:mm, minute precision)
 * ============================================================ */
.erp-time-picker {
    position: relative;
    width: 100%;
}
.erp-time-picker-field {
    position: relative;
    display: flex;
    align-items: stretch;
}
.erp-time-picker-field .form-control {
    padding-right: 2.5rem;
    font-variant-numeric: tabular-nums;
    min-width: 0;
}
.erp-time-picker-toggle {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--erp-muted, #6c757d);
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--erp-control-radius, var(--erp-radius-sm, 0.375rem));
    padding: 0;
    line-height: 1;
}
.erp-time-picker-toggle:hover:not(:disabled) {
    color: var(--erp-primary, #087f7b);
    background: color-mix(in srgb, var(--erp-primary, #087f7b) 10%, transparent);
}
.erp-time-picker-toggle:disabled { opacity: 0.5; }
.erp-time-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2050;
    background: transparent;
}
.erp-time-picker-popup {
    position: absolute;
    left: 0;
    top: calc(100% + 0.35rem);
    z-index: 2051;
    min-width: 14.5rem;
    padding: var(--erp-space-3, 0.7rem);
    background: var(--erp-surface, #fff);
    border: 1px solid var(--erp-border-strong, var(--erp-border, #ced4da));
    border-radius: var(--erp-control-radius, var(--erp-radius-sm, 0.5rem));
    box-shadow: var(--erp-shadow, 0 8px 24px rgba(0, 0, 0, 0.14));
}
.erp-time-picker-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--erp-space-2, 0.5rem);
}
.erp-time-picker-col-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--erp-muted, #6c757d);
    text-align: center;
    margin-bottom: 0.25rem;
}
.erp-time-picker-list {
    max-height: 11.5rem;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--erp-border, #e2e8f0);
    border-radius: var(--erp-radius-sm, 0.375rem);
    background: var(--erp-surface-2, #f8fafc);
    padding: 0.2rem;
}
.erp-time-picker-option {
    display: flex;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--erp-text, #212529);
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
    padding: 0.35rem 0.45rem;
    border-radius: var(--erp-radius-sm, 0.3rem);
    justify-content: center;
    line-height: 1.2;
}
.erp-time-picker-option:hover:not(.selected) {
    background: color-mix(in srgb, var(--erp-primary, #087f7b) 12%, transparent);
}
.erp-time-picker-option.selected {
    background: var(--erp-primary, #087f7b);
    color: #fff;
    font-weight: 600;
}
.erp-time-picker-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: var(--erp-space-2, 0.5rem);
}
.erp-time-picker-actions-end {
    display: flex;
    gap: 0.35rem;
}
.erp-time-picker.is-invalid .form-control {
    border-color: var(--erp-danger, #dc3545);
}
/* Registrer tid: allow date/time popups to escape modal body clip */
.erp-time-dialog.modal.show.d-block .modal-body,
.erp-time-dialog .erp-modal-body {
    overflow: visible;
    max-height: none;
}
