.erp-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.erp-hero,
.erp-panel,
.erp-stat,
.erp-module-card {
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 14px 36px rgba(15, 23, 42, .055);
}

.erp-hero {
    padding: 26px 28px;
    border-radius: 22px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 62%, #eef5ff 100%);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.erp-eyebrow {
    display: inline-flex;
    padding: 7px 12px;
    border-radius: 999px;
    background: #eaf1ff;
    color: #1d4ed8;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: .7rem;
    font-weight: 900;
}

.erp-hero h2 {
    margin: 8px 0 8px;
    color: #1e293b;
    font-size: clamp(1.55rem, 2vw, 2rem);
    font-weight: 900;
}

.erp-hero p {
    max-width: 850px;
    margin: 0;
    color: #64748b;
    line-height: 1.65;
}

.erp-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

.erp-stat {
    min-height: 126px;
    padding: 18px;
    border-radius: 18px;
    border-left: 4px solid #2563eb;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.erp-stat.green { border-left-color: #10b981; }
.erp-stat.slate { border-left-color: #64748b; }
.erp-stat.amber { border-left-color: #f59e0b; }

.erp-stat small {
    color: #94a3b8;
    font-size: .68rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.erp-stat span {
    color: #475569;
    line-height: 1.35;
}

.erp-stat strong {
    margin-top: auto;
    color: #0f172a;
    font-size: clamp(1.35rem, 1.8vw, 1.8rem);
    font-weight: 900;
    line-height: 1;
    word-break: break-word;
}

.erp-panel {
    border-radius: 20px;
    overflow: hidden;
}

.erp-panel-head {
    padding: 18px 20px;
    border-bottom: 1px solid #edf2f7;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.erp-panel-head h3 {
    margin: 0;
    color: #1e293b;
    font-size: 1.18rem;
    font-weight: 900;
}

.erp-panel-head p {
    margin: 6px 0 0;
    color: #64748b;
    line-height: 1.55;
}

.erp-panel-body {
    padding: 20px;
}

.erp-toolbar {
    padding: 20px;
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 210px 210px auto;
    gap: 14px;
    align-items: end;
}

.erp-toolbar.compact {
    grid-template-columns: minmax(240px, 1fr) 210px auto;
}

.erp-field label {
    display: block;
    margin-bottom: 6px;
    color: #64748b;
    font-size: .72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.erp-field .form-control,
.erp-field .form-select {
    min-height: 46px;
    border-radius: 14px;
}

.erp-toolbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

.erp-module-card {
    min-height: 180px;
    padding: 20px;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.erp-module-card h4 {
    margin: 0;
    color: #1e293b;
    font-size: 1.05rem;
    font-weight: 900;
}

.erp-module-card p {
    margin: 0;
    color: #64748b;
    line-height: 1.55;
}

.erp-module-card .erp-module-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.erp-badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 900;
    white-space: nowrap;
}

.erp-badge.enabled {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.erp-badge.pending {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.erp-table-wrap {
    padding: 0 18px 18px;
    overflow-x: auto;
}

.erp-table {
    margin: 0;
    min-width: 960px;
    font-size: .92rem;
}

.erp-table th,
.erp-table td {
    vertical-align: middle;
}

.erp-table .wrap {
    min-width: 220px;
    white-space: normal;
}

.erp-role-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.erp-role {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: .68rem;
    font-weight: 900;
}

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

.erp-col-12 { grid-column: span 12; }
.erp-col-8 { grid-column: span 8; }
.erp-col-6 { grid-column: span 6; }
.erp-col-4 { grid-column: span 4; }
.erp-col-3 { grid-column: span 3; }

.erp-checks {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
}

.erp-empty {
    padding: 52px 20px;
    text-align: center;
    color: #64748b;
}

.erp-empty strong {
    display: block;
    margin-bottom: 6px;
    color: #1e293b;
}

.erp-json {
    margin: 0;
    padding: 16px;
    border-radius: 14px;
    background: #0f172a;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: .82rem;
}

@media (max-width: 1280px) {
    .erp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .erp-modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .erp-toolbar,
    .erp-toolbar.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .erp-stats,
    .erp-modules,
    .erp-toolbar,
    .erp-toolbar.compact { grid-template-columns: 1fr; }
    .erp-hero,
    .erp-panel-body,
    .erp-toolbar { padding: 18px; }
    .erp-col-8,
    .erp-col-6,
    .erp-col-4,
    .erp-col-3 { grid-column: span 12; }
}

/* Clientes / proveedores -------------------------------------------------- */
.erp-role.muted {
    background: #f1f5f9;
    color: #64748b;
}

.third-party-required-note {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    background: #eff6ff;
    color: #475569;
    line-height: 1.5;
}

.third-party-required-note strong {
    color: #1e3a8a;
}

.third-party-upload-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr);
    gap: 18px;
    align-items: center;
    padding: 20px;
    border: 1px dashed #93c5fd;
    border-radius: 18px;
    background: linear-gradient(135deg, #f8fbff 0%, #eff6ff 100%);
}

.third-party-upload-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.third-party-upload-copy strong {
    color: #1e293b;
    font-size: 1rem;
}

.third-party-upload-copy span {
    color: #64748b;
    line-height: 1.55;
}

.third-party-upload-control {
    min-width: 0;
}

.third-party-import-result-table {
    min-width: 760px;
}

.third-party-import-row-error {
    background: #fffaf5;
}

@media (max-width: 980px) {
    .third-party-upload-box {
        grid-template-columns: 1fr;
    }
}

.erp-shortcut-panel {
    border-style: dashed;
}

.erp-shortcut-panel .erp-panel-body {
    padding: 16px 20px;
}

.erp-inline-search {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.erp-inline-search-main {
    min-width: 0;
}

.erp-inline-search-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.erp-aging-page .erp-panel .erp-panel-head + .erp-panel-body {
    padding-top: 18px;
}

@media (max-width: 992px) {
    .erp-inline-search {
        grid-template-columns: 1fr;
    }
}
