/* ==========================================================================
   Shared presentational components (token-driven so both themes resolve)
   ========================================================================== */

.erp-state {
    background: var(--erp-surface);
}

.erp-section + .erp-section {
    margin-top: 1rem;
}

/* --- KPI / stat cards ------------------------------------------------- */
.erp-stat {
    border: 1px solid var(--erp-border);
    border-left: 3px solid var(--erp-brand);
    border-radius: var(--erp-radius);
    background: var(--erp-surface);
    padding: .9rem 1rem;
}

.erp-stat-label {
    color: var(--erp-muted);
    font-size: .875rem;
    margin-bottom: .25rem;
}

.erp-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--erp-text);
}

/* A neutral, muted variant for KPI cards representing data this project
   genuinely does not have — used instead of fabricating a number. */
.erp-stat-unavailable {
    border-left-color: var(--erp-border);
    opacity: .75;
}

.erp-stat-unavailable .erp-stat-value {
    color: var(--erp-muted);
    font-size: 1rem;
}

/* --- Avatar -------------------------------------------------------- */
.erp-avatar {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--erp-brand-tint);
    color: var(--erp-brand-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.erp-welcome-card {
    background: linear-gradient(105deg, var(--erp-surface) 0%, var(--erp-brand-wash) 100%);
}

.erp-quick-actions .btn {
    padding-inline: .85rem;
}

/* --- Filter + results cards (applied by the shared shell) ------------ */
.erp-filter-card {
    border: 0;
    background: var(--erp-surface);
    box-shadow: var(--erp-shadow-md) !important;
}

.erp-filter-card .card-body {
    padding: 1rem 1.1rem;
}

.erp-filter-card .btn-primary {
    min-width: 6.25rem;
}

.erp-results-card {
    overflow: hidden;
}

.erp-results-card .table-responsive {
    min-height: 9rem;
}

.erp-results-card tbody tr {
    transition: background-color var(--erp-transition);
}

.erp-results-card tbody tr:hover {
    background: var(--erp-brand-wash);
}

/* --- Form pages -------------------------------------------------- */
.erp-form-page {
    max-width: 1120px;
}

.erp-form-page .erp-form-card {
    border-left: 3px solid var(--erp-brand-light);
}

.erp-form-page .erp-form-card .card-body {
    padding: 1.2rem;
}

.erp-form-page .erp-form-card h2,
.erp-form-page .erp-form-card h3 {
    color: var(--erp-brand-text);
    font-weight: 700;
}

/* Sticky primary action bar for long forms. On mobile it hugs the bottom
   navigation instead of the viewport edge. */
.erp-form-actions {
    position: sticky;
    bottom: .75rem;
    z-index: 2;
    padding: .75rem;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-lg);
    background: var(--erp-surface);
    box-shadow: var(--erp-shadow-md);
}

@media (max-width: 991.98px) {
    .erp-has-bottomnav .erp-form-actions {
        bottom: calc(var(--erp-bottomnav-height) + .5rem);
    }
}

/* --- Profile / detail pages -------------------------------------- */
.erp-profile-hero {
    border-left: 4px solid var(--erp-brand);
    background: linear-gradient(110deg, var(--erp-surface) 0%, var(--erp-brand-wash) 100%);
}

.erp-profile-grid .card-body {
    padding: 1.05rem;
}

.erp-profile-grid dt {
    color: var(--erp-muted);
    font-weight: 600;
}

.erp-profile-grid dd {
    font-weight: 500;
}

/* ==========================================================================
   Notification bell + Notification Center
   ========================================================================== */
.erp-notif-badge {
    background: var(--erp-brand);
    color: var(--erp-on-brand);
    font-size: .65rem;
    font-weight: 700;
}

.erp-notif-bell .btn {
    font-size: 1rem;
    line-height: 1;
}

.erp-notif-panel {
    width: 340px;
    max-width: calc(100vw - 1.5rem);
}

.erp-notif-panel [data-notif-bell-list] {
    max-height: 360px;
    overflow-y: auto;
}

.erp-notif-item {
    background: transparent;
    color: inherit;
}

.erp-notif-item:hover,
.erp-notif-item:focus {
    background: var(--erp-body-bg);
}

.erp-notif-item-unread {
    background: var(--erp-brand-tint);
}

.erp-notif-dot {
    flex: 0 0 auto;
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: var(--erp-brand);
}

.erp-notif-category {
    font-size: .62rem;
    letter-spacing: .04em;
    font-weight: 700;
    color: var(--erp-brand-text);
}

.erp-notif-viewall {
    color: var(--erp-brand-text);
}

.erp-notif-viewall:hover {
    background: var(--erp-body-bg);
}

.min-w-0 {
    min-width: 0;
}

/* ==========================================================================
   ERPUI component library (Phase B) — see components.js
   ========================================================================== */

/* --- Toast --------------------------------------------------------- */
.erp-toast {
    background: var(--erp-surface);
    color: var(--erp-text);
    border-left: 4px solid var(--erp-border);
    box-shadow: var(--erp-shadow-md);
    border-radius: var(--erp-radius);
}

.erp-toast-success { border-left-color: var(--erp-success); }
.erp-toast-info { border-left-color: var(--erp-info); }
.erp-toast-warning { border-left-color: var(--erp-warning); }
.erp-toast-danger { border-left-color: var(--erp-danger); }

.btn-close-sm {
    padding: .25rem;
    background-size: .65em;
}

/* --- Slide-over --------------------------------------------------- */
.erp-slideover {
    width: min(440px, 92vw);
    background: var(--erp-surface);
    color: var(--erp-text);
}

.erp-slideover.erp-slideover-lg {
    width: min(640px, 96vw);
}

.erp-slideover .offcanvas-footer {
    background: var(--erp-surface);
}

/* --- Skeleton --------------------------------------------------- */
.erp-skeleton,
.erp-skeleton-table {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.erp-skeleton-row {
    display: flex;
    gap: .75rem;
}

.erp-skeleton-line,
.erp-skeleton-cell {
    height: .8rem;
    border-radius: var(--erp-radius-sm);
    background: linear-gradient(90deg, var(--erp-surface-3) 25%, var(--erp-surface-2) 37%, var(--erp-surface-3) 63%);
    background-size: 400% 100%;
    animation: erp-skeleton-shimmer 1.4s ease infinite;
}

.erp-skeleton-cell {
    flex: 0 0 auto;
}

.erp-skeleton-row .erp-skeleton-cell:last-child {
    flex: 1 1 auto;
}

@keyframes erp-skeleton-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
    .erp-skeleton-line,
    .erp-skeleton-cell {
        animation: none;
        background: var(--erp-surface-3);
    }
}

/* --- Empty state ---------------------------------------------- */
.erp-empty {
    border: 1px dashed var(--erp-border-strong);
    border-radius: var(--erp-radius-lg);
    background: var(--erp-surface);
}

.erp-empty-icon {
    font-size: 2rem;
    line-height: 1;
}

/* --- Status timeline ---------------------------------------- */
.erp-timeline {
    position: relative;
    padding-left: 1.25rem;
}

.erp-timeline-item {
    position: relative;
    padding: 0 0 1rem 1rem;
}

.erp-timeline-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: .3rem;
    bottom: -.3rem;
    width: 2px;
    background: var(--erp-border);
}

.erp-timeline-item:last-child::before {
    display: none;
}

.erp-timeline-dot {
    position: absolute;
    left: -5px;
    top: .25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--erp-surface);
    border: 2px solid var(--erp-border-strong);
}

.erp-timeline-done .erp-timeline-dot { background: var(--erp-success); border-color: var(--erp-success); }
.erp-timeline-current .erp-timeline-dot { background: var(--erp-brand); border-color: var(--erp-brand); box-shadow: 0 0 0 .2rem var(--erp-brand-tint); }
.erp-timeline-rejected .erp-timeline-dot { background: var(--erp-danger); border-color: var(--erp-danger); }

/* --- Stepper ------------------------------------------------ */
.erp-stepper {
    gap: .25rem 0;
    counter-reset: erp-step;
}

.erp-step {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex: 1 1 auto;
    min-width: 0;
    color: var(--erp-muted);
    font-size: .82rem;
    font-weight: 600;
}

.erp-step:not(:last-child)::after {
    content: "";
    flex: 1 1 1.5rem;
    height: 2px;
    margin: 0 .5rem;
    background: var(--erp-border);
}

.erp-step-index {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 2px solid var(--erp-border-strong);
    background: var(--erp-surface);
    font-size: .75rem;
}

.erp-step-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.erp-step-current { color: var(--erp-text); }
.erp-step-current .erp-step-index { border-color: var(--erp-brand); color: var(--erp-brand-text); }
.erp-step-done .erp-step-index { background: var(--erp-brand); border-color: var(--erp-brand); color: var(--erp-on-brand); }
.erp-step-done:not(:last-child)::after { background: var(--erp-brand); }

@media (max-width: 575.98px) {
    .erp-step-label {
        display: none;
    }
    .erp-step:not(:last-child)::after {
        flex-basis: .5rem;
    }
    .erp-step-current .erp-step-label {
        display: inline;
    }
}

/* --- Searchable select ------------------------------------- */
.erp-select {
    position: relative;
}

.erp-select-toggle {
    width: 100%;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.erp-select-menu {
    max-width: none;
}

.erp-select-list {
    max-height: 15rem;
    overflow-y: auto;
}

.erp-select-option {
    border-radius: var(--erp-radius-sm);
    white-space: normal;
}

.erp-select-option.active {
    background: var(--erp-brand);
    color: var(--erp-on-brand);
}

/* --- Topbar icon buttons ----------------------------------- */
.erp-icon-btn {
    min-width: 2.35rem;
    line-height: 1;
}

.erp-icon-btn[data-page-help-open] {
    font-weight: 700;
}

/* --- Global search ---------------------------------------- */
.erp-search-group {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--erp-muted);
    padding: .6rem .25rem .25rem;
}

[data-search-results] .list-group-item {
    border-inline: 0;
    border-radius: var(--erp-radius-sm);
}

[data-search-results] .list-group-item:hover,
[data-search-results] .list-group-item:focus {
    background: var(--erp-surface-2);
}

/* --- First-login tour ---------------------------------- */
.erp-tour-list {
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.erp-tour-list li {
    line-height: 1.45;
}

kbd {
    background: var(--erp-surface-3);
    color: var(--erp-text);
    border-radius: var(--erp-radius-sm);
    padding: .05rem .35rem;
    font-size: .8em;
    border: 1px solid var(--erp-border);
}

/* --- Responsive table -> cards ----------------------------- */
@media (max-width: 767.98px) {
    table.erp-cardify thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    table.erp-cardify,
    table.erp-cardify tbody,
    table.erp-cardify tr,
    table.erp-cardify td {
        display: block;
        width: 100%;
    }

    table.erp-cardify tr {
        border: 1px solid var(--erp-border);
        border-radius: var(--erp-radius);
        margin-bottom: .6rem;
        padding: .35rem .2rem;
        background: var(--erp-surface);
    }

    table.erp-cardify td {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        border: 0;
        padding: .4rem .75rem;
        text-align: right;
    }

    table.erp-cardify td::before {
        content: attr(data-label);
        font-size: .72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .03em;
        color: var(--erp-muted);
        text-align: left;
        flex: 0 0 40%;
    }

    table.erp-cardify td:empty {
        display: none;
    }

    table.erp-cardify td.text-end,
    table.erp-cardify td:last-child {
        justify-content: flex-end;
    }
}

