:root {
    --bg: #f3f6fb;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #ffffff;
    --text: #142132;
    --muted: #6b7788;
    --primary: #0f4c81;
    --primary-strong: #0a3b63;
    --accent: #31b7d2;
    --success: #12826a;
    --danger: #c94a4a;
    --shadow: 0 24px 60px rgba(14, 38, 64, 0.12);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Manrope', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(49, 183, 210, 0.12), transparent 30%),
        radial-gradient(circle at right center, rgba(15, 76, 129, 0.12), transparent 24%),
        var(--bg);
}

a {
    text-decoration: none;
}

.login-body {
    background:
        radial-gradient(circle at top, rgba(49, 183, 210, 0.2), transparent 40%),
        linear-gradient(180deg, #081423 0%, #0c1d31 100%);
    color: #ecf3fa;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
}

.login-panel {
    width: min(1180px, 100%);
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 28px;
    align-items: stretch;
}

.login-copy,
.login-card,
.panel-card,
.hero-card,
.module-header-card,
.stat-card {
    border-radius: var(--radius);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
}

.login-copy {
    padding: 56px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.login-logo {
    display: block;
    width: min(100%, 520px);
    height: min(100%, 370px);
    /*height: auto;*/
    margin-top: 22px;
    border-radius: 28px;
    box-shadow: 0 24px 48px rgba(8, 20, 35, 0.28);
    -webkit-mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0.9) 82%, rgba(0, 0, 0, 0) 100%);
    mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0.9) 82%, rgba(0, 0, 0, 0) 100%);
}

.login-copy h1 {
    font-size: clamp(2.4rem, 4vw, 4rem);
    line-height: 1.05;
    margin: 16px 0;
}

.login-copy p {
    color: rgba(236, 243, 250, 0.8);
    max-width: 560px;
    font-size: 1.05rem;
}

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

.login-metrics article,
.demo-box {
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.login-metrics strong,
.demo-box strong {
    display: block;
    font-size: 0.95rem;
}

.login-metrics span,
.demo-box span {
    display: block;
    font-size: 0.9rem;
    color: rgba(236, 243, 250, 0.78);
    margin-top: 6px;
}

.login-card {
    padding: 36px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--text);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 300px 1fr;
}

.sidebar {
    flex-direction: column;
    padding: 28px 20px;
    background: #081423;
    color: white;
}

.brand-block {
    display: flex;
    gap: 14px;
    align-items: center;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: white;
    background: linear-gradient(160deg, var(--accent), var(--primary));
}

.brand-eyebrow,
.topbar-eyebrow,
.panel-eyebrow {
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.72rem;
    color: var(--muted);
}

.brand-eyebrow {
    color: rgba(255, 255, 255, 0.6);
}

.brand-title {
    margin: 2px 0 0;
    font-size: 1.1rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    color: rgba(255, 255, 255, 0.82);
    transition: 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    justify-content: space-between;
    text-align: left;
}

.sidebar-toggle:hover,
.sidebar-toggle.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.sidebar-caret {
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.sidebar-toggle[aria-expanded="true"] .sidebar-caret {
    transform: rotate(180deg);
}

.sidebar-submenu {
    margin-top: 8px;
    margin-left: 12px;
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 6px 0;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.95rem;
    transition: 0.2s ease;
}

.sidebar-sublink:hover,
.sidebar-sublink.active {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

.content-shell {
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.topbar-title {
    font-size: 1.8rem;
    font-weight: 800;
}

.page-content {
    display: grid;
    gap: 24px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(16, 32, 48, 0.08);
}

.user-chip-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--primary), var(--accent));
    color: white;
    font-weight: 800;
}

.user-chip small {
    display: block;
    color: var(--muted);
}

.hero-card,
.module-header-card {
    padding: 28px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.82));
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
}

.hero-card h3,
.module-header-card h3 {
    margin: 10px 0;
    font-size: clamp(1.5rem, 2vw, 2.4rem);
    max-width: 780px;
}

.hero-card p,
.module-header-card p {
    margin: 0;
    color: var(--muted);
    max-width: 720px;
}

.hero-badge {
    min-width: 180px;
    padding: 20px;
    border-radius: 20px;
    color: white;
    background: linear-gradient(145deg, var(--primary), #162f4a);
}

.hero-badge span {
    display: block;
    opacity: 0.7;
}

.hero-badge strong {
    font-size: 1.9rem;
}

.stats-grid,
.content-grid {
    display: grid;
    gap: 20px;
}

.stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat-card {
    padding: 22px;
    background: rgba(255, 255, 255, 0.9);
}

.stat-card small {
    display: block;
    color: var(--muted);
    margin: 14px 0 8px;
}

.stat-card strong {
    font-size: 1.9rem;
}

.stat-card.accent {
    background: linear-gradient(145deg, #0f4c81, #11263d);
    color: white;
}

.stat-card.accent small {
    color: rgba(255, 255, 255, 0.72);
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: inline-grid;
    place-items: center;
    border-radius: 16px;
    font-size: 1.2rem;
    background: rgba(15, 76, 129, 0.12);
    color: var(--primary);
}

.panel-card {
    padding: 24px;
    background: rgba(255, 255, 255, 0.88);
}

.content-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
}

.panel-header,
.detail-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.panel-header h4,
.detail-head h5 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 16px;
    background: #eef3f8;
}

.search-box input {
    border: 0;
    background: transparent;
    box-shadow: none !important;
}

.table-modern thead th {
    padding: 14px 12px;
    color: var(--muted);
    border-bottom-color: rgba(16, 32, 48, 0.1);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.table-modern tbody td {
    padding: 16px 12px;
    border-bottom-color: rgba(16, 32, 48, 0.06);
}

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

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: capitalize;
}

.status-activo,
.status-timbrada {
    background: rgba(18, 130, 106, 0.12);
    color: var(--success);
}

.status-inactivo,
.status-cancelada,
.status-error_timbrado {
    background: rgba(201, 74, 74, 0.12);
    color: var(--danger);
}

.status-emitida,
.status-borrador {
    background: rgba(15, 76, 129, 0.12);
    color: var(--primary);
}

.btn-primary {
    background: linear-gradient(145deg, var(--primary), var(--primary-strong));
    border-color: transparent;
    border-radius: 16px;
    padding-inline: 18px;
}

.btn-surface {
    background: #eef3f8;
    border: 0;
    border-radius: 14px;
    color: var(--text);
}

.pill-label {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    color: white;
    background: linear-gradient(145deg, var(--accent), var(--primary));
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pill-dark {
    background: linear-gradient(145deg, #0f4c81, #13283d);
}

.secondary-panel {
    background: linear-gradient(145deg, #0f1d30, #152b44);
    color: #e8f1fb;
}

.secondary-panel .panel-eyebrow,
.secondary-panel p,
.secondary-panel span {
    color: rgba(232, 241, 251, 0.72);
}

.check-list,
.process-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 14px;
}

.check-list li,
.process-list li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.info-banner {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
}

.notes-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 22px;
}

.totals-panel {
    margin-left: auto;
    max-width: 340px;
    display: grid;
    gap: 12px;
}

.totals-panel > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-radius: 16px;
    background: #eff4f9;
}

.totals-panel .total-line {
    background: linear-gradient(145deg, #0f4c81, #11263d);
    color: white;
}

.sidebar-footer {
    padding-top: 24px;
}

.form-control,
.form-select {
    border-radius: 16px;
    border-color: rgba(17, 38, 61, 0.12);
    min-height: 48px;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(15, 76, 129, 0.4);
    box-shadow: 0 0 0 0.2rem rgba(15, 76, 129, 0.12);
}

.modal-content {
    border-radius: 28px;
}

@media (max-width: 1199.98px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .content-grid,
    .notes-layout {
        grid-template-columns: 1fr;
    }

    .login-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991.98px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .content-shell {
        padding: 20px;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-card,
    .module-header-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .login-logo {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .login-page {
        padding: 18px;
    }

    .login-copy,
    .login-card,
    .panel-card,
    .hero-card,
    .module-header-card,
    .stat-card {
        padding: 20px;
    }

    .login-metrics,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .panel-header,
    .detail-head {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        width: 100%;
    }
}
