.erp-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.erp-user-avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255,255,255,.94);
    color: var(--slw-red-dark);
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
    font-weight: 800;
}

.erp-user-copy {
    min-width: 110px;
}

.erp-user-copy strong {
    display: block;
    color: #fff;
    font-size: 13px;
}

.erp-logout {
    padding: 7px 10px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: var(--slw-radius-sm);
    color: #fff;
    text-decoration: none;
    font-size: 12px;
}

.erp-logout:hover {
    background: rgba(255,255,255,.1);
    border-color: rgba(255,255,255,.38);
}

.erp-user-action {
    color: rgba(255,255,255,.78);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.erp-user-action:hover {
    color: #fff;
}

.erp-sidebar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 9px;
    background: linear-gradient(105deg, #9e1119, #d81b25);
    box-shadow: 0 8px 20px rgba(112,8,14,.24);
    color: #fff;
}

.erp-sidebar-title-mark {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255,255,255,.85);
    border-radius: 50%;
}

.erp-sidebar-title small,
.erp-sidebar-title strong {
    display: block;
}

.erp-sidebar-title small {
    margin-bottom: 3px;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .72;
}

.erp-sidebar-title strong {
    font-size: 13px;
}

.erp-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.erp-sidebar-link {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 7px;
    color: #d2d2d2;
    text-decoration: none;
    border: 1px solid transparent;
}

.erp-sidebar-link:hover {
    transform: translateX(2px);
    background: #2b3038;
    color: #fff;
}

.erp-sidebar-link.is-active {
    background: rgba(201,20,29,.16);
    border-color: rgba(232,73,82,.24);
    color: #fff;
}

.erp-sidebar-link.is-active .erp-sidebar-icon {
    background: var(--slw-red);
    color: #fff;
}

.erp-sidebar-link-disabled,
.erp-sidebar-link-disabled:hover {
    padding-left: 10px;
    cursor: not-allowed;
    opacity: .5;
    background: transparent;
    color: #d2d2d2;
}

.erp-sidebar-icon {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    flex: 0 0 24px;
    border-radius: 6px;
    background: #333;
    color: #bbb;
    font-size: 10px;
    font-weight: 800;
}

.erp-sidebar-empty {
    padding: 14px 10px;
    color: #777;
    font-size: 12px;
}

.erp-page-heading {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.erp-page-heading h1 {
    margin-bottom: 7px;
    font-size: clamp(25px, 2.2vw, 32px);
    line-height: 1.12;
    color: #1d1d1d;
}

.erp-page-heading p {
    margin-bottom: 0;
    color: var(--slw-gray-700);
}

.erp-eyebrow {
    display: block;
    margin-bottom: 5px;
    color: var(--slw-red);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.erp-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.erp-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.erp-card {
    background: #fff;
    border: 1px solid var(--slw-gray-200);
    border-radius: var(--slw-radius);
    box-shadow: var(--slw-shadow);
}

.erp-kpi-card {
    min-height: 130px;
    padding: 18px;
    position: relative;
    overflow: hidden;
    border-top: 0;
}

.erp-kpi-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, var(--slw-red), var(--slw-red-dark));
}

.erp-kpi-label {
    display: block;
    color: var(--slw-gray-700);
    font-size: 12px;
}

.erp-kpi-value {
    display: block;
    margin: 12px 0 10px;
    font-size: clamp(28px, 2.7vw, 36px);
    color: var(--slw-black);
}

.erp-kpi-card small {
    color: var(--slw-gray-500);
}

.erp-card-header {
    padding: 18px 20px 0;
}

.erp-card-header h2 {
    margin-bottom: 0;
    font-size: 18px;
}

.erp-status-list {
    padding: 12px 20px 20px;
    max-height: clamp(180px, 32vh, 360px);
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.erp-status-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 11px 0;
    border-bottom: 1px solid #ededed;
}

.erp-status-row strong {
    color: #19713d;
    font-size: 12px;
}

.erp-feature-panel {
    margin: 14px 20px 20px;
    padding: 18px;
    border-radius: var(--slw-radius);
    background: var(--slw-red-soft);
    border-left: 4px solid var(--slw-red);
}

.erp-feature-panel strong {
    display: block;
    margin-bottom: 8px;
    color: var(--slw-red-dark);
    font-size: 18px;
}

.erp-feature-panel p {
    margin-bottom: 0;
    color: #555;
    line-height: 1.5;
}



/* Fase 1 / Paso 7: mensajes de estado */

.erp-flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.erp-flash {
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: var(--slw-radius-sm);
    font-size: 13px;
}

.erp-flash-success {
    background: #edf8f0;
    border-color: #bcdcc5;
    color: #216238;
}

.erp-flash-error {
    background: #fff0f0;
    border-color: #e7bcbc;
    color: #8b1b1b;
}

.erp-flash-warning {
    background: #fff8e5;
    border-color: #ead49a;
    color: #72540a;
}

/* Fase 2: componentes de modulos operativos */

.erp-module-card {
    padding: 20px;
    margin-bottom: 18px;
}

.erp-filter-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    gap: 14px;
    align-items: end;
}

.erp-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.erp-field-wide {
    grid-column: 1 / -1;
}

.erp-check-field {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--slw-gray-700);
    font-weight: 600;
}

.erp-check-field input {
    width: 18px;
    height: 18px;
}

.erp-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.erp-toolbar-spaced {
    justify-content: flex-end;
    margin-bottom: 14px;
}

.erp-error-list {
    margin: 8px 0 0;
    padding-left: 20px;
}

.erp-field {
    display: grid;
    gap: 6px;
}

.erp-field span,
.erp-data-list dt {
    color: var(--slw-gray-700);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.erp-field input,
.erp-field select,
.erp-field textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #cfcfcf;
    border-radius: var(--slw-radius-sm);
    background: #fff;
    color: var(--slw-gray-900);
}

.erp-field input:focus,
.erp-field select:focus,
.erp-field textarea:focus {
    outline: 0;
    border-color: var(--slw-red);
    box-shadow: var(--slw-focus);
}

.erp-filter-actions,
.erp-detail-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.erp-button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
    box-shadow: var(--slw-shadow-sm);
}

.erp-button-primary {
    background: var(--slw-red);
    color: #fff;
}

.erp-button-primary:hover {
    background: var(--slw-red-dark);
    transform: translateY(-1px);
}

.erp-button-secondary {
    border-color: #cfcfcf;
    background: #fff;
    color: #333;
}

.erp-button-secondary:hover {
    border-color: #aeb4bd;
    background: #f8f9fa;
}

.erp-button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.erp-list-summary {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    margin-bottom: 16px;
}

.erp-list-summary strong {
    font-size: 17px;
}

.erp-list-summary p {
    margin: 0;
    color: var(--slw-gray-700);
}

.erp-table-wrap {
    width: 100%;
    max-height: clamp(280px, calc(100vh - 470px), 560px);
    overflow: auto;
    border: 1px solid #e4e4e4;
    border-radius: var(--slw-radius-sm);
    scrollbar-gutter: stable;
}

.erp-table-wrap:focus-visible {
    outline: 3px solid rgba(161, 0, 0, .2);
    outline-offset: 2px;
}

.erp-table-wrap .erp-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 0 #e4e4e4;
}

.erp-table-wrap .erp-table tbody tr:last-child td {
    border-bottom: 0;
}

.erp-orders-results-card {
    margin-bottom: 0;
}

.erp-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.erp-table th,
.erp-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e9e9e9;
    text-align: left;
    vertical-align: middle;
}

.erp-table th {
    background: #f6f7f9;
    color: var(--slw-gray-700);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.erp-table tbody tr:hover {
    background: #fff6f6;
}

.erp-text-right {
    text-align: right !important;
}

.erp-table-link {
    color: var(--slw-red-dark);
    font-weight: 700;
    text-underline-offset: 3px;
}

.erp-table-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-height: 34px;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 6px;
}

.erp-table-link-icon::before {
    content: "";
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

.erp-table-link-view::before {
    background-image: url('/assets/icons/view-detail.png');
}

.erp-table-link-labels::before {
    background-image: url('/assets/icons/barcode-labels.png');
}

.erp-table-link-icon:hover::before,
.erp-table-link-icon:focus-visible::before {
    filter: brightness(.92);
    transform: translateY(-1px) scale(1.04);
}

.erp-table-action-group {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.erp-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.erp-badge-success {
    background: #e8f6ed;
    color: #216238;
}

.erp-badge-neutral {
    background: #ededed;
    color: #555;
}

.erp-badge-warning {
    background: #fff2d5;
    color: #795200;
}

.erp-kpi-location {
    font-size: 22px;
}

.erp-empty-state {
    padding: 36px 20px;
    border: 1px dashed var(--slw-gray-300);
    background: #fafbfc;
    border-radius: var(--slw-radius-sm);
    text-align: center;
    color: var(--slw-gray-700);
}

.erp-pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
}

.erp-pagination > :last-child {
    justify-self: end;
}

.erp-detail-toolbar {
    justify-content: space-between;
    margin-bottom: 18px;
}

.erp-export-toolbar {
    padding: 12px 14px;
    border: 1px solid #d8d8d8;
    border-radius: var(--slw-radius-sm);
    background: #fff;
    color: var(--slw-gray-700);
}

.erp-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.erp-detail-grid .erp-module-card {
    margin-bottom: 0;
}

.erp-detail-wide {
    grid-column: 1 / -1;
}

.erp-data-list {
    display: grid;
    gap: 0;
    margin: 12px 0 0;
}

.erp-data-list-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 28px;
}

.erp-data-list div {
    display: grid;
    grid-template-columns: minmax(130px, .8fr) minmax(0, 1.2fr);
    gap: 16px;
    padding: 11px 0;
    border-bottom: 1px solid #ededed;
}

.erp-data-list dd {
    margin: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.erp-readiness-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
    padding: 16px 18px;
    border: 1px solid #efcf91;
    border-left: 4px solid #d69216;
    border-radius: var(--slw-radius);
    background: #fff9eb;
}

.erp-readiness-banner strong {
    display: block;
    color: #664500;
    font-size: 16px;
}

.erp-readiness-banner p {
    margin: 0;
    color: #745c2b;
}

.erp-service-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
    padding: 12px 20px 20px;
}

.erp-service-grid div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px solid #ededed;
}

.erp-service-grid span {
    color: var(--slw-gray-700);
}

.erp-service-grid strong {
    color: #19713d;
}

.erp-dashboard-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 18px;
    padding: 20px;
    background: linear-gradient(120deg, #fff, #fff7f7);
}

.erp-dashboard-action h2 {
    margin-bottom: 6px;
}

.erp-dashboard-action p {
    margin-bottom: 0;
    color: var(--slw-gray-700);
}

.erp-access-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.erp-access-card {
    min-height: 82px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--slw-gray-200);
    border-radius: var(--slw-radius);
    background: #fff;
    color: var(--slw-gray-900);
    text-decoration: none;
}

.erp-access-card:hover {
    transform: translateY(-2px);
    border-color: rgba(201,20,29,.28);
    box-shadow: var(--slw-shadow);
}

.erp-access-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--slw-red-soft);
    color: var(--slw-red-dark);
    font-weight: 850;
}

.erp-access-card strong,
.erp-access-card small {
    display: block;
}

.erp-access-card small {
    margin-top: 4px;
    color: var(--slw-gray-500);
}

.erp-access-arrow {
    color: var(--slw-red);
    font-size: 19px;
}

.erp-timeline {
    position: relative;
    display: grid;
    gap: 0;
    margin: 18px 0 0;
    padding: 0 0 0 20px;
    list-style: none;
}

.erp-timeline::before {
    content: '';
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 25px;
    width: 2px;
    background: #e1e1e1;
}

.erp-timeline li {
    position: relative;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 12px;
    padding: 0 0 22px;
}

/* Acceso y seguridad */
.erp-auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 82% 12%, rgba(201,20,29,.22), transparent 30%),
        linear-gradient(135deg, #111318 0%, #20242b 55%, #52090e 100%);
}

.erp-auth-shell {
    width: min(920px, 100%);
    min-height: 520px;
    display: grid;
    grid-template-columns: minmax(280px, .9fr) minmax(340px, 1.1fr);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--slw-radius-lg);
    background: #fff;
    box-shadow: var(--slw-shadow-lg);
}

.erp-auth-brand {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(28px, 5vw, 54px);
    background:
        linear-gradient(180deg, rgba(255,255,255,.03), transparent),
        #171a20;
    color: #fff;
}

.erp-auth-brand-mark {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border: 2px solid rgba(255,255,255,.86);
    border-radius: 17px;
    font-weight: 850;
    letter-spacing: .08em;
}

.erp-auth-brand h1 {
    margin: auto 0 12px;
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1;
}

.erp-auth-brand p {
    margin-bottom: 0;
    color: rgba(255,255,255,.62);
}

.erp-auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(30px, 6vw, 68px);
}

.erp-auth-panel h2 {
    margin-bottom: 8px;
    font-size: 28px;
}

.erp-auth-panel > p {
    margin-bottom: 28px;
    color: var(--slw-gray-700);
}

.erp-auth-form {
    display: grid;
    gap: 18px;
}

.erp-auth-form .erp-button {
    width: 100%;
    min-height: 44px;
    margin-top: 4px;
}

.erp-auth-help {
    margin-top: 18px;
    color: var(--slw-gray-500);
    font-size: 13px;
    line-height: 1.55;
    text-align: center;
}

.erp-auth-link {
    color: var(--slw-red-dark);
    font-weight: 750;
    text-decoration: none;
}

.erp-auth-link:hover,
.erp-auth-link:focus-visible {
    text-decoration: underline;
}

.erp-auth-meta {
    margin-top: 22px;
    color: var(--slw-gray-500);
    font-size: 12px;
    text-align: center;
}

.erp-timeline-dot {
    z-index: 1;
    width: 12px;
    height: 12px;
    margin-top: 4px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--slw-red);
    box-shadow: 0 0 0 2px var(--slw-red);
}

.erp-timeline p {
    margin: 5px 0;
    color: var(--slw-gray-700);
}

.erp-timeline small {
    color: var(--slw-gray-500);
}
