/* Portal Empresas Nova */
:root {
    --emp-ink: #0A0A0A;
    --emp-paper: #F4F7FB;
    --emp-card: #FFFFFF;
    --emp-muted: #5B6472;
    --emp-line: rgba(10, 10, 10, 0.12);
    --emp-accent: #0EA5E9;
    --emp-ok: #15803D;
    --emp-warn: #B45309;
    --emp-font: "Montserrat", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body.emp-body {
    margin: 0;
    font-family: var(--emp-font);
    background: var(--emp-paper);
    color: var(--emp-ink);
    min-height: 100vh;
}

.emp-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.emp-side {
    background: linear-gradient(180deg, #0A0A0A 0%, #141820 100%);
    color: #fff;
    padding: 1.5rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.emp-brand {
    display: block;
    text-decoration: none;
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.95rem;
}

.emp-brand span {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: rgba(255,255,255,0.55);
    text-transform: none;
}

.emp-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.emp-nav a {
    color: rgba(255,255,255,0.78);
    text-decoration: none;
    padding: 0.7rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-left: 2px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.emp-nav a:hover,
.emp-nav a.is-active {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-left-color: var(--emp-accent);
    text-decoration: none;
}

.emp-side__foot {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: auto;
    padding-top: 0.75rem;
}

.emp-side__foot a {
    color: rgba(255,255,255,0.55);
    font-size: 0.8rem;
    text-decoration: none;
}

.emp-side__foot a:hover { color: #fff; }

.emp-side-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.7rem 0.85rem;
    font-family: var(--emp-font);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none !important;
    border: 0;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
}

.emp-side-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    color: #fff !important;
}

.emp-side-btn--catalog {
    background: #16A34A;
    color: #fff !important;
}

.emp-side-btn--logout {
    background: #DC2626;
    color: #fff !important;
}

.emp-main {
    padding: 1.5rem clamp(1rem, 3vw, 2.25rem) 2.5rem;
}

.emp-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.emp-top h1 {
    margin: 0;
    font-size: clamp(1.4rem, 3vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.emp-top p {
    margin: 0.35rem 0 0;
    color: var(--emp-muted);
    font-size: 0.92rem;
}

.emp-kicker {
    margin: 0 0 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--emp-accent);
}

.emp-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 1.5rem;
}

.emp-stat {
    background: var(--emp-card);
    border: 1px solid var(--emp-line);
    padding: 1.1rem 1.15rem;
}

.emp-stat strong {
    display: block;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.emp-stat span {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--emp-muted);
    font-weight: 500;
}

.emp-stat--debt strong {
    color: #DC2626;
}

.emp-stat--debt {
    border-color: rgba(220, 38, 38, 0.28);
    background: #FEF2F2;
}

.emp-stat--credit strong {
    color: #15803D;
}

.emp-stat--credit {
    border-color: rgba(21, 128, 61, 0.28);
    background: #ECFDF5;
}

.emp-panel {
    background: var(--emp-card);
    border: 1px solid var(--emp-line);
    padding: 1.25rem 1.35rem;
    margin-bottom: 1.25rem;
}

.emp-panel h2 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    font-weight: 800;
}

.emp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.emp-table th,
.emp-table td {
    text-align: left;
    padding: 0.7rem 0.5rem;
    border-bottom: 1px solid var(--emp-line);
    vertical-align: top;
}

.emp-table th {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--emp-muted);
    font-weight: 700;
}

.emp-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #E5E7EB;
}

.emp-badge--ok { background: #DCFCE7; color: var(--emp-ok); }
.emp-badge--warn { background: #FFEDD5; color: var(--emp-warn); }
.emp-badge--info { background: #E0F2FE; color: #0369A1; }

.emp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}

.emp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.1rem;
    font-family: var(--emp-font);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    border: 1px solid var(--emp-ink);
    background: transparent;
    color: var(--emp-ink);
    cursor: pointer;
}

.emp-btn:hover {
    background: var(--emp-ink);
    color: #fff;
    text-decoration: none;
}

.emp-btn--fill {
    background: var(--emp-ink);
    color: #fff;
}

.emp-btn--fill:hover {
    background: var(--emp-accent);
    border-color: var(--emp-accent);
}

.emp-btn--block { width: 100%; }

.emp-label {
    display: block;
    margin: 0.85rem 0 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.emp-input,
.emp-textarea,
.emp-select {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--emp-line);
    background: #fff;
    font-family: var(--emp-font);
    font-size: 0.95rem;
}

.emp-textarea { min-height: 110px; resize: vertical; }

.emp-msg-err {
    display: block;
    margin-bottom: 0.85rem;
    padding: 0.75rem 0.9rem;
    background: #FEF2F2;
    color: #991B1B;
    font-size: 0.9rem;
    font-weight: 600;
}

.emp-msg-ok {
    display: block;
    margin-bottom: 0.85rem;
    padding: 0.75rem 0.9rem;
    background: #ECFDF5;
    color: #065F46;
    font-size: 0.9rem;
    font-weight: 600;
}

.emp-muted { color: var(--emp-muted); font-size: 0.9rem; }

.emp-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(ellipse 70% 50% at 50% 0%, rgba(14, 165, 233, 0.18), transparent 60%),
        linear-gradient(165deg, #0A0A0A 0%, #151820 100%);
}

.emp-login {
    width: min(420px, 100%);
    background: #fff;
    padding: 2rem 1.75rem;
}

.emp-login h1 {
    margin: 0 0 0.4rem;
    font-size: 1.45rem;
    font-weight: 800;
}

.emp-login__sub {
    margin: 0 0 1.25rem;
    color: var(--emp-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.emp-login__foot {
    margin: 1.25rem 0 0;
    text-align: center;
    font-size: 0.85rem;
}

.emp-login__foot a {
    color: var(--emp-ink);
    font-weight: 600;
    text-decoration: none;
}

.emp-login__foot a:hover {
    color: var(--emp-accent);
}

/* —— Auth simple (Login) —— */
body.emp-login-body {
    margin: 0;
    font-family: var(--emp-font);
    background: #0A0A0A;
    min-height: 100vh;
}

.emp-auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
}

.emp-auth--simple .emp-auth__panel {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(ellipse 70% 45% at 50% 0%, rgba(14, 165, 233, 0.16), transparent 55%),
        linear-gradient(165deg, #050505 0%, #12151C 55%, #0B1220 100%);
}

.emp-auth__card {
    width: min(400px, 100%);
    background: #fff;
    border: 1px solid rgba(10, 10, 10, 0.08);
    padding: 2.25rem 1.75rem 1.75rem;
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.28);
}

.emp-auth__card-logo {
    display: flex;
    justify-content: center;
    margin: 0 0 1.5rem;
    text-decoration: none;
}

.emp-auth__card-logo img {
    max-height: 72px;
    width: auto;
    display: block;
    background: transparent;
    padding: 0;
}

.emp-auth__card h1 {
    margin: 0 0 1.35rem;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-align: center;
    color: var(--emp-ink);
}

.emp-auth__submit {
    margin-top: 1.35rem;
}

.emp-login__foot {
    margin: 1.25rem 0 0;
    text-align: center;
    font-size: 0.85rem;
}

.emp-login__foot a {
    color: var(--emp-muted);
    font-weight: 600;
    text-decoration: none;
}

.emp-login__foot a:hover {
    color: var(--emp-accent);
}

.emp-brand-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.55rem;
    text-decoration: none;
    color: #fff;
}

.emp-brand-logo img {
    max-height: 44px;
    width: auto;
    background: transparent;
}

.emp-brand-logo span,
.emp-brand-user {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.92);
    text-transform: none;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.emp-profile-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 900px) {
    .emp-profile-grid {
        grid-template-columns: 1.1fr 0.9fr;
    }
}

.emp-chat {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-height: 320px;
    overflow: auto;
}

.emp-chat__bubble {
    max-width: 78%;
    padding: 0.7rem 0.9rem;
    font-size: 0.88rem;
    line-height: 1.45;
    border-radius: 12px;
    word-break: break-word;
}

/* Mensajes propios (derecha) vs del otro (izquierda) */
.emp-chat__bubble--mine {
    align-self: flex-end;
    background: #E0F2FE;
    color: #0C4A6E;
    border-bottom-right-radius: 4px;
}

.emp-chat__bubble--other {
    align-self: flex-start;
    background: #F3F4F6;
    color: #111827;
    border-bottom-left-radius: 4px;
}

/* Compatibilidad con clases viejas */
.emp-chat__bubble--empresa {
    align-self: flex-end;
    background: #E0F2FE;
    color: #0C4A6E;
}

.emp-chat__bubble--nova {
    align-self: flex-start;
    background: #F3F4F6;
    color: #111827;
}

.emp-chat__meta {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.7rem;
    opacity: 0.7;
}

.emp-split {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 880px) {
    .emp-split { grid-template-columns: 1fr 1fr; }
}

.emp-empty {
    padding: 1.5rem 0;
    color: var(--emp-muted);
    font-size: 0.95rem;
}

/* —— Mobile portal —— */
.emp-side__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
}

.emp-nav-toggle {
    display: none;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    width: 48px;
    height: 48px;
    min-width: 48px;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.emp-nav-toggle:hover,
.emp-nav-toggle:focus {
    background: rgba(255, 255, 255, 0.22);
    outline: none;
}

@media (max-width: 900px) {
    html, body.emp-body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .emp-shell {
        display: block;
        min-height: 100vh;
        width: 100%;
        max-width: 100vw;
    }

    .emp-side {
        position: sticky;
        top: 0;
        z-index: 100;
        width: 100%;
        padding: 0.7rem 0.85rem;
        gap: 0;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
    }

    .emp-side__head {
        min-height: 52px;
    }

    .emp-brand-logo {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: left !important;
        gap: 0.55rem !important;
        min-width: 0;
        flex: 1;
        max-width: calc(100% - 56px);
    }

    .emp-brand-logo img {
        max-height: 32px !important;
        width: auto;
        flex-shrink: 0;
    }

    .emp-brand-user {
        text-align: left !important;
        font-size: 0.75rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .emp-nav-toggle {
        display: inline-flex !important;
    }

    .emp-nav,
    .emp-side__foot {
        display: none !important;
        width: 100%;
    }

    .emp-side.is-open {
        gap: 0.65rem;
        padding-bottom: 1rem;
    }

    .emp-side.is-open .emp-nav,
    .emp-side.is-open .emp-side__foot {
        display: flex !important;
    }

    .emp-nav {
        flex-direction: column;
        max-height: min(65vh, 480px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        margin-top: 0.35rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: 0.45rem;
    }

    .emp-nav a {
        padding: 0.9rem 0.85rem;
        font-size: 1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
        border-left: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .emp-nav a.is-active {
        background: rgba(14, 165, 233, 0.2);
        border-left: 0;
        border-bottom-color: transparent;
    }

    .emp-side__foot {
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 0.35rem;
        padding-top: 0.65rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .emp-side-btn {
        min-height: 48px;
        font-size: 0.8rem;
    }

    .emp-main {
        display: block;
        width: 100%;
        padding: 1rem 0.85rem 2.5rem;
        max-width: 100%;
    }

    .emp-top {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
        margin-bottom: 1rem;
    }

    .emp-top h1 {
        font-size: 1.35rem;
        word-break: break-word;
    }

    .emp-top p {
        font-size: 0.88rem;
    }

    .emp-top .emp-btn,
    .emp-actions .emp-btn {
        width: 100%;
        text-align: center;
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.85rem;
    }

    .emp-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
        margin-bottom: 1rem;
    }

    .emp-stat {
        padding: 0.9rem 0.7rem;
        min-width: 0;
    }

    .emp-stat strong {
        font-size: clamp(1rem, 5vw, 1.3rem);
        word-break: break-word;
    }

    .emp-stat span {
        font-size: 0.72rem;
        line-height: 1.25;
    }

    .emp-panel {
        padding: 1rem 0.8rem;
        margin-bottom: 0.85rem;
        width: 100%;
        max-width: 100%;
        overflow: visible;
    }

    .emp-panel h2 {
        font-size: 1.05rem;
        margin-bottom: 0.75rem;
    }

    /* Tablas → tarjetas apiladas en móvil */
    .emp-table {
        width: 100% !important;
        min-width: 0 !important;
        border-collapse: collapse;
        font-size: 0.88rem;
    }

    .emp-table thead {
        display: none;
    }

    .emp-table tbody,
    .emp-table tr,
    .emp-table td {
        display: block;
        width: 100%;
    }

    .emp-table tr {
        background: #fff;
        border: 1px solid var(--emp-line);
        margin-bottom: 0.65rem;
        padding: 0.75rem 0.85rem;
    }

    .emp-table td {
        border: 0 !important;
        border-bottom: 1px solid rgba(10, 10, 10, 0.06) !important;
        padding: 0.4rem 0 !important;
        white-space: normal !important;
        text-align: left !important;
        word-break: break-word;
    }

    .emp-table td:last-child {
        border-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    .emp-table td:first-child {
        font-weight: 700;
        font-size: 0.95rem;
        padding-top: 0 !important;
    }

    .emp-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        margin-top: 0.85rem;
    }

    .emp-split {
        grid-template-columns: 1fr !important;
        gap: 0.85rem;
    }

    .emp-input,
    .emp-textarea,
    .emp-select {
        width: 100%;
        max-width: 100%;
        font-size: 16px;
        min-height: 48px;
        padding: 0.7rem 0.85rem;
    }

    .emp-textarea {
        min-height: 120px;
    }

    .emp-btn {
        font-size: 16px;
        min-height: 48px;
    }

    .emp-btn--block {
        width: 100%;
    }

    .emp-chat {
        max-height: none;
        min-height: 280px;
    }

    .emp-profile-grid {
        grid-template-columns: 1fr !important;
    }

    .emp-auth__panel {
        padding: 1rem 0.85rem;
        align-items: flex-start;
        padding-top: 2rem;
    }

    .emp-auth__card {
        width: 100%;
        max-width: 100%;
        padding: 1.35rem 1.1rem 1.15rem;
        box-shadow: none;
    }

    .emp-auth__card-logo img {
        max-height: 52px;
    }

    .emp-auth__card h1 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .emp-grid {
        grid-template-columns: 1fr;
    }

    .emp-brand-user {
        max-width: 140px;
    }

    .emp-top h1 {
        font-size: 1.2rem;
    }
}

.emp-table-wrap {
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}
.emp-table-wrap .emp-table { margin: 0; }
.emp-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
}
.emp-pager__info { font-size: 0.85rem; color: #64748b; font-weight: 600; }
.emp-pager__btns { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.emp-pager__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #0f172a;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.84rem;
}
a.emp-pager__btn:hover { border-color: #0284c7; color: #0284c7; }
.emp-pager__btn.is-active { background: #0369a1; border-color: #0369a1; color: #fff; }
.emp-pager__btn.is-disabled { opacity: 0.45; pointer-events: none; }
