/* 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;
    --erp-radius: 20px;
    --erp-radius-sm: 10px;
    --erp-shadow: 0 3px 14px rgba(8, 50, 53, 0.05);
    --erp-shadow-md: 0 8px 24px rgba(11, 44, 47, 0.08);
    --erp-shadow-lg: 0 20px 60px rgba(7, 37, 40, 0.12);
    --erp-page-max: 1240px;
    --erp-header-h: 56px;
    --erp-sidebar-w: 240px;
    --erp-sidebar-w-collapsed: 64px;
    --erp-space-1: 0.25rem;
    --erp-space-2: 0.5rem;
    --erp-space-3: 0.75rem;
    --erp-space-4: 1rem;
    --erp-space-5: 1.5rem;
    --erp-space-6: 2rem;
    --erp-transition: 160ms ease;
    --erp-type-page: 1.5rem;
    --erp-type-section: 0.95rem;
    --erp-type-card: 0.82rem;
    --erp-type-label: 0.7rem;
    --erp-type-meta: 0.78rem;
}

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: 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: 48px;
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 12px;
    padding-right: 12px;
    line-height: 1.35;
    border-radius: 10px;
    box-sizing: border-box;
}
.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: 700;
    border-radius: 10px;
}

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-radius-sm);
    padding: 0.45rem 0.85rem;
    font-size: 0.875rem;
    transition: background var(--erp-transition), border-color var(--erp-transition), color var(--erp-transition), box-shadow var(--erp-transition);
}

.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-radius-sm);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    background-color: #fff;
    background-clip: padding-box;
    box-shadow: none;
}
.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: 0.8rem 0.9rem;
    border-bottom-color: var(--erp-border);
    vertical-align: middle;
}
.table thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--erp-muted);
    font-weight: 700;
    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: 2rem;
}

.erp-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.6rem;
    padding-bottom: 0;
    border-bottom: none;
}

.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: 0.85rem 0.25rem 0.85rem;
    border-bottom: 1px solid var(--erp-border);
}

.erp-page-title {
    font-size: 1.55rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    color: var(--erp-text);
}

.erp-page-subtitle {
    color: var(--erp-muted);
    font-size: 0.95rem;
    margin-top: 0.3rem;
    line-height: 1.4;
}

.erp-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
}
.erp-actions-primary { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.erp-actions-secondary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-left: 0.65rem;
    margin-left: 0.15rem;
    border-left: 1px solid var(--erp-border);
}

/* ——— Summary stats ——— */
.erp-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 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: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    padding: 1.15rem 1.2rem;
    box-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: 1rem;
}
.erp-section-grid > * { 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-card {
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow);
    overflow: hidden;
    min-width: 0;
}
.erp-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.1rem;
    padding: 1.1rem 1.25rem 0.85rem;
    border-bottom: 1px solid var(--erp-border);
    background: var(--erp-surface);
}
.erp-card-title {
    font-size: 0.95rem;
    font-weight: 650;
    margin: 0;
    letter-spacing: -0.01em;
}
.erp-card-body { padding: 1.15rem 1.25rem; min-width: 0; overflow-wrap: break-word; }
.erp-card-body.compact { padding: 0.85rem 1.15rem; }
.erp-card-footer {
    padding: 0.85rem 1.25rem;
    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: 0.85rem 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 .span-2 { grid-column: 1 / -1; }

.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: 0.15rem;
    overflow-x: auto;
    padding: 0.2rem;
    margin-bottom: 1.1rem;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: 999px;
    box-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: 0.8125rem;
    font-weight: 550;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    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-shadow);
    font-weight: 700;
}

/* ——— Badges (soft pills) ——— */
.erp-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    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; }

/* ——— 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: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-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;
}
.erp-table-shell tbody tr a.erp-row-link:hover {
    color: var(--erp-primary, #087f7b);
    text-decoration: underline;
}
.erp-table-shell tbody tr:hover {
    background: var(--erp-surface-2);
}

.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: 0.85rem 1rem;
    align-items: flex-end;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--erp-border);
    background: var(--erp-surface);
}
.erp-toolbar-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
    gap: 0.35rem;
    min-width: 8.5rem;
}
.erp-toolbar-field.flex-1 {
    flex: 1 1 14rem;
    min-width: 12rem;
}
.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%;
    min-height: 2.4rem;
}
.erp-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.55rem;
    margin-left: auto;
}

/* ——— 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; }
.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; }
.erp-address-search { position: relative; }
.erp-address-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.25rem);
    z-index: 40;
    margin: 0;
    padding: 0.25rem;
    list-style: none;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    box-shadow: var(--erp-shadow-md);
    max-height: 16rem;
    overflow-y: auto;
}
.erp-address-suggestion {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.65rem 0.75rem;
    min-height: 2.75rem;
    border-radius: var(--erp-radius-sm);
    cursor: pointer;
}
.erp-address-suggestion:hover,
.erp-address-suggestion.active {
    background: color-mix(in srgb, var(--erp-accent, #1B5E9C) 12%, #fff);
}
.erp-address-suggestion.muted {
    cursor: default;
    color: var(--erp-muted);
    font-size: 0.875rem;
}
.erp-address-line1 { font-weight: 600; font-size: 0.9rem; }
.erp-address-line2 { font-size: 0.8rem; color: var(--erp-muted); margin-top: 0.1rem; }
.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-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.65rem 1rem 1rem;
}
.erp-line-row {
    display: grid;
    grid-template-columns: auto minmax(9rem, 1.3fr) minmax(9rem, 1.1fr) 10.5rem 4.5rem 5rem 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);
}
.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-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-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-price, .erp-line-net {
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    margin-top: 0.35rem;
}
.erp-line-qty {
    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;
}
.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-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-net {
    font-weight: 650;
    color: var(--erp-text);
    width: 7.25rem;
    min-width: 7.25rem;
    text-align: right;
    margin-top: 0;
}
.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-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: nowrap;
    gap: 0.3rem;
    margin-top: 0;
    justify-content: flex-end;
}
.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: 768px) {
    .erp-line-row {
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "drag product actions"
            "drag locations actions"
            "drag qty actions"
            "drag net actions";
    }
    .erp-line-drag { grid-area: drag; }
    .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-cell { justify-content: flex-start; }
    .erp-line-price { display: none; }
    .erp-line-net { grid-area: net; text-align: left; }
    .erp-line-actions { grid-area: actions; }
}

/* ——— 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); }

/* ——— 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 */
.erp-ctx-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1080;
    background: transparent;
}
.erp-ctx-menu {
    --erp-ctx-margin: var(--erp-space-2); /* 8px viewport edge margin (positioning JS/C#) */
    position: fixed;
    z-index: 1081;
    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);
}
.erp-type-seg {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}
.erp-type-seg .btn {
    border-radius: 999px;
    font-weight: 600;
}
.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) */
.erp-planning-page.is-map-fs {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: var(--erp-page-bg, var(--erp-bg));
    padding: 0.85rem 1rem 1rem;
    margin: 0;
    max-width: none;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    outline: none;
}
.erp-planning-page.is-map-fs .erp-page-header {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
}
.erp-planning-page.is-map-fs .erp-toolbar,
.erp-planning-page.is-map-fs .alert {
    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(260px, 0.9fr);
    gap: 0.75rem;
    overflow: hidden;
}
.erp-planning-page.is-map-fs .erp-planning-split-main {
    min-width: 0;
    min-height: 0;
    overflow: auto;
}
.erp-planning-page.is-map-fs .erp-planning-split-map {
    min-width: 0;
    min-height: 0;
    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 {
    flex: 1 1 auto;
    min-height: 0;
}
.erp-planning-page.is-map-fs .erp-planning-split-map .erp-location-map--side {
    flex: 1 1 auto;
    height: 100%;
    min-height: 280px;
}
.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 {
    max-height: none;
    position: static;
}
@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: 18rem 1fr;
    gap: 1rem;
    align-items: start;
}
.erp-planning-filters { flex-wrap: wrap; }
.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: .75rem .5rem;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
}
.erp-planning-backlog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 .5rem .4rem;
}
.erp-planning-backlog-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.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-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-week {
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    overflow: auto;
    max-height: calc(100vh - 12rem);
}
.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);
}
.erp-planning-dialog {
    z-index: 1055; /* Bootstrap modal band; below context menu (1080+) */
}
.erp-planning-dialog .modal-dialog {
    max-width: 36rem;
}


/* Dialog «Åbn e-mail» — viewport overlay (escape article.content overflow/stack, same as Generér leads) */
.erp-dialog-mail-modal.modal {
    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;
}
.erp-dialog-mail-modal .modal-dialog {
    position: relative !important;
    z-index: 2001;
    margin: auto !important;
    max-width: min(56rem, calc(100vw - 2rem));
    width: 100%;
    pointer-events: auto;
}
.erp-dialog-mail-modal .modal-content {
    position: relative;
    background: #fff !important;
    background-color: var(--erp-surface, #fff) !important;
    color: var(--erp-text, #0f172a);
    border: 1px solid var(--erp-border, #e2e8f0);
    border-radius: var(--erp-radius, 12px);
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
}
.erp-dialog-mail-modal .modal-header,
.erp-dialog-mail-modal .modal-body,
.erp-dialog-mail-modal .modal-footer {
    background: #fff !important;
    background-color: var(--erp-surface, #fff) !important;
}
.erp-dialog-mail-modal .modal-body {
    max-height: min(70vh, 48rem);
    overflow-x: hidden;
    overflow-y: auto;
}
.erp-dialog-mail-body {
    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 — viewport overlay above sidebar (escape article.content scroll/stack) */
.erp-generate-leads-dialog.modal {
    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;
}
.erp-generate-leads-dialog .modal-dialog {
    position: relative !important;
    z-index: 2001;
    margin: auto !important;
    max-width: min(72rem, calc(100vw - 2rem));
    width: 100%;
    pointer-events: auto;
}
.erp-generate-leads-dialog .modal-content,
.erp-generate-leads-dialog .erp-gen-leads {
    position: relative;
    background: #fff !important;
    background-color: var(--erp-surface, #fff) !important;
    color: var(--erp-text, #0f172a);
    border: 1px solid var(--erp-border, #e2e8f0);
    border-radius: var(--erp-radius, 12px);
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}
.erp-generate-leads-dialog .modal-header,
.erp-generate-leads-dialog .modal-body,
.erp-generate-leads-dialog .modal-footer {
    background: #fff !important;
    background-color: var(--erp-surface, #fff) !important;
}
.erp-generate-leads-dialog .modal-body {
    max-height: min(70vh, 48rem);
    overflow-x: hidden;
    overflow-y: auto;
}
.erp-generate-leads-dialog .erp-gen-panel,
.erp-generate-leads-dialog .erp-code-tree,
.erp-generate-leads-dialog .erp-code-tree-body {
    position: relative;
    z-index: 0;
}
.erp-gen-leads .modal-header {
    align-items: flex-start;
    border-bottom-color: var(--erp-border);
}
.erp-gen-leads-sub {
    margin-top: .2rem;
    font-size: .875rem;
    color: var(--erp-text-muted);
}
.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; }
    .erp-planning-backlog { position: static; max-height: none; }
    .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-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-dialog { z-index: 1055; }
.erp-time-dialog .modal-dialog { max-width: 36rem; }
.erp-time-dialog-footer { 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;
}
