:root {
    --emc-ink: #0a1f2c;
    --emc-ink-2: #12384f;
    --emc-blue: #0d6efd;
    --emc-cyan: #26d9ff;
    --emc-green: #19c37d;
    --emc-bg: #eef3f8;
    --emc-card: rgba(255, 255, 255, .92);
    --emc-border: rgba(148, 163, 184, .22);
    --emc-shadow: 0 24px 70px rgba(15, 23, 42, .13);
}

* { box-sizing: border-box; }

body.contador-portal,
body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(38, 217, 255, .16), transparent 34%),
        radial-gradient(circle at top right, rgba(13, 110, 253, .15), transparent 30%),
        linear-gradient(180deg, #f8fbff 0%, var(--emc-bg) 100%) !important;
    color: #1f2937;
}

.portal-topbar {
    background: linear-gradient(135deg, var(--emc-ink) 0%, var(--emc-ink-2) 62%, #0f5fa8 100%) !important;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .10);
    box-shadow: 0 18px 50px rgba(10, 31, 44, .26);
    position: relative;
    overflow: hidden;
}

.portal-topbar::after {
    content: "";
    position: absolute;
    inset: auto -10% -60px auto;
    width: 360px;
    height: 160px;
    background: rgba(38, 217, 255, .14);
    filter: blur(8px);
    border-radius: 999px;
    transform: rotate(-12deg);
}

.portal-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 26px 24px;
    position: relative;
    z-index: 1;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portal-brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    letter-spacing: -.04em;
    background: linear-gradient(135deg, rgba(38, 217, 255, .95), rgba(13, 110, 253, .95));
    box-shadow: 0 16px 38px rgba(13, 110, 253, .35);
}

.portal-page-title {
    padding: 18px 0 8px;
}

.portal-page-title h3,
.portal-page-title h2 {
    font-weight: 800;
    color: #102033;
    letter-spacing: -.03em;
}

.stat-card,
.card.stat-card,
.portal-card {
    border: 1px solid var(--emc-border) !important;
    border-radius: 22px !important;
    background: var(--emc-card) !important;
    box-shadow: var(--emc-shadow) !important;
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.card-header.bg-white {
    background: rgba(255, 255, 255, .78) !important;
    border-bottom: 1px solid rgba(148, 163, 184, .18) !important;
    padding: 18px 22px;
}

.card-body { padding: 22px; }

.form-control,
.form-select,
.input-group .form-control {
    border-radius: 14px;
    border-color: #d9e2ec;
    min-height: 44px;
}

.input-group .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-right-radius: 14px; border-bottom-right-radius: 14px; }

.btn {
    border-radius: 14px;
    font-weight: 700;
}

.btn-success {
    background: linear-gradient(135deg, #16a34a, var(--emc-green));
    border: 0;
    box-shadow: 0 14px 30px rgba(25, 195, 125, .22);
}

.btn-primary {
    background: linear-gradient(135deg, var(--emc-blue), #22c1ff);
    border: 0;
    box-shadow: 0 14px 30px rgba(13, 110, 253, .24);
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, .35);
    background: rgba(255, 255, 255, .08);
}

.btn-outline-light:hover { color: var(--emc-ink); }

.stat-icon {
    font-size: 2.4rem;
    opacity: .28;
    color: var(--emc-blue);
}

.module-card {
    border: 1px solid rgba(148, 163, 184, .30) !important;
    border-radius: 18px !important;
    padding: 14px !important;
    background: #fff;
    transition: .18s ease;
}

.module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 35px rgba(15, 23, 42, .08);
    background: #f8fbff !important;
}

.table { --bs-table-bg: transparent; }
.table thead th {
    color: #64748b;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.portal-footer {
    max-width: 1180px;
    margin: 18px auto 0;
    padding: 18px 24px 28px;
    color: #64748b;
    font-size: .9rem;
    text-align: center;
}

.portal-login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 10%, rgba(38, 217, 255, .28), transparent 34%),
        radial-gradient(circle at 85% 15%, rgba(13, 110, 253, .30), transparent 34%),
        linear-gradient(135deg, #06151f 0%, #0c202c 46%, #123c56 100%) !important;
}

.portal-login-page .portal-card {
    width: min(470px, 100%);
    margin: auto;
}

.portal-login-page .portal-header {
    background: linear-gradient(135deg, rgba(12, 32, 44, .98), rgba(18, 60, 86, .98));
    color: #fff;
    padding: 34px 30px;
    text-align: center;
}

.portal-login-page .portal-header img {
    max-height: 64px;
    margin-bottom: 14px;
}

.portal-login-page .portal-body {
    padding: 30px;
    background: rgba(255, 255, 255, .98);
}

.portal-login-page .portal-footer {
    color: rgba(255, 255, 255, .78);
    margin-top: 0;
}

@media (max-width: 768px) {
    .portal-shell { padding: 18px 14px; }
    .portal-topbar .portal-shell { gap: 14px; align-items: flex-start !important; flex-direction: column; }
    .portal-topbar .d-flex.gap-2 { flex-wrap: wrap; }
    .card-body { padding: 18px; }
}
