:root {
    color-scheme: dark;
    --bg: #060816;
    --panel: rgba(10, 16, 32, 0.88);
    --panel-strong: rgba(14, 22, 42, 0.98);
    --text: #f5f7ff;
    --muted: #9ab2d6;
    --accent: #6dcdff;
    --accent-2: #8a7cff;
    --success: #3ad6a8;
    --warning: #ffb54d;
    --danger: #ff7b82;
    --border: rgba(255, 255, 255, 0.12);
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top left, rgba(109, 205, 255, 0.14), transparent 24%),
                radial-gradient(circle at 80% 10%, rgba(124, 108, 255, 0.14), transparent 22%),
                linear-gradient(180deg, #091225 0%, var(--bg) 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

main {
    padding-bottom: 6rem;
}

.container {
    width: min(100% - 1.5rem, 1180px);
    margin: 0 auto;
}

.glass {
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(24px);
}

.hero,
.panel,
.card,
.stat-card,
.sidebar,
.auth-card {
    border-radius: 28px;
}

.hero {
    padding: 1rem 0 1.2rem;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0.15rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 1.05rem;
    font-weight: 700;
}

.nav-links {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.95rem 1.1rem;
    border-radius: 999px;
    border: 0;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
    font-weight: 600;
    min-height: 44px;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    box-shadow: 0 18px 35px rgba(101, 214, 255, 0.18);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.btn-tertiary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
}

.btn-small {
    min-height: 38px;
    padding: 0.62rem 0.8rem;
    font-size: 0.86rem;
}

.grid {
    display: grid;
    gap: 1rem;
}

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

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

.info-list {
    padding-left: 1.1rem;
    margin: 0.85rem 0 0;
    color: var(--muted);
}

.info-list li {
    margin-bottom: 0.85rem;
    line-height: 1.55;
}

.hero-grid {
    display: grid;
    gap: 1rem;
}

.hero h1 {
    font-size: clamp(1.9rem, 2.5vw, 2.6rem);
    margin: 0.35rem 0 0.75rem;
    line-height: 1.1;
}

.hero p,
.card p,
.sidebar p,
.muted {
    color: var(--muted);
    line-height: 1.65;
}

.preview-card {
    padding: 1.3rem;
}

.stat-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 1rem;
}

.stat-card {
    padding: 1rem;
    min-height: 110px;
}

.stat-card strong {
    display: block;
    font-size: 1.1rem;
    margin-top: 0.45rem;
}

.section {
    padding: 1.1rem 0;
}

.section h2 {
    margin-bottom: 0.9rem;
    font-size: 1.2rem;
}

.card,
.auth-card,
.sidebar {
    padding: 1.1rem;
}

.card h3,
.card h2,
.sidebar h3 {
    margin-top: 0;
}

.plan-grid {
    grid-template-columns: 1fr;
}

.badge,
.recommendation-badge,
.metric-pill,
.risk-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(101, 214, 255, 0.15);
    color: var(--accent);
    font-size: 0.8rem;
}

.dashboard-shell {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0 1.25rem;
}

.sidebar {
    display: block;
    min-width: 240px;
    max-width: 260px;
    align-self: flex-start;
    position: sticky;
    top: 1rem;
}

.sidebar a {
    display: block;
    color: var(--muted);
    padding: 0.9rem 1rem;
    margin: 0.35rem 0;
    border-radius: 18px;
    transition: background 180ms ease, color 180ms ease;
}

.sidebar a:hover,
.sidebar a.active {
    background: rgba(101, 214, 255, 0.12);
    color: white;
}

.main-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

.auth-card {
    max-width: 520px;
    margin: 1rem auto;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--muted);
    font-size: 0.95rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 1rem 1rem;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,.05);
    color: var(--text);
    font-size: 0.96rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(101,214,255,.25);
}

.flash {
    padding: 0.95rem 1rem;
    border-radius: 18px;
    margin-bottom: 0.9rem;
    font-size: 0.95rem;
}

.flash.success {
    background: rgba(51,214,166,.16);
    color: #b1f5d6;
}

.flash.error {
    background: rgba(255,181,77,.18);
    color: #ffe4b3;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255,255,255,.03);
    border-radius: 18px;
    overflow: hidden;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.table th,
.table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-align: left;
    font-size: 0.92rem;
}

.table thead th {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-size: 0.8rem;
}

.small {
    color: var(--muted);
    font-size: 0.9rem;
}

.admin-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.admin-tabs,
.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: capitalize;
}

.notice {
    padding: 0.9rem;
    border-radius: 18px;
    background: rgba(101, 214, 255, 0.1);
    border: 1px solid rgba(101, 214, 255, 0.18);
}

.notice p {
    margin: 0.25rem 0 0;
}

.status-aprobada {
    background: rgba(51,214,166,0.16);
    color: #a5f2d4;
}

.status-rechazada {
    background: rgba(255,123,130,0.16);
    color: #ffc1c5;
}

.status-pendiente {
    background: rgba(255,181,77,0.16);
    color: #ffe0aa;
}

.account-list {
    display: grid;
    gap: 0.85rem;
}

.account-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.2fr) minmax(130px, 0.7fr) minmax(150px, 0.9fr) auto;
    gap: 0.85rem;
    align-items: end;
    padding: 0.9rem;
    border-radius: 18px;
}

.account-main {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.2rem;
}

.mt-2 {
    margin-top: 0.95rem;
}

footer {
    padding: 1.35rem 0 5.5rem;
    color: var(--muted);
    font-size: 0.9rem;
}

footer p {
    margin: 0;
}

.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0.7rem calc(0.75rem + env(safe-area-inset-bottom));
    background: rgba(6, 8, 22, 0.92);
    border-top: 1px solid rgba(255,255,255,.08);
    backdrop-filter: blur(18px);
    z-index: 20;
}

.mobile-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    color: var(--muted);
    font-size: 0.72rem;
    min-width: 3.8rem;
}

.mobile-nav a.active,
.mobile-nav a:hover {
    color: var(--text);
}

.mobile-nav .icon {
    font-size: 1.05rem;
}

.mobile-hero {
    padding: 0.6rem 0 0.9rem;
}

.mobile-card,
.card,
.auth-card,
.sidebar {
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.mobile-card:hover,
.card:hover,
.auth-card:hover,
.sidebar:hover {
    transform: translateY(-1px);
}

.mobile-actions {
    display: grid;
    gap: 0.85rem;
}

.mobile-actions .btn {
    width: 100%;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.action-buttons input {
    flex: 1 1 260px;
    min-width: 0;
}

.action-buttons .btn {
    flex: 0 0 auto;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.1rem;
    background: rgba(2, 8, 23, 0.82);
    z-index: 40;
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    width: min(100%, 520px);
    padding: 1.2rem;
    border-radius: 26px;
    animation: modalEnter 180ms ease;
    border: 1px solid rgba(101,214,255,0.22);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.modal-close {
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 1.35rem;
    cursor: pointer;
}

.recommendation-card {
    border: 1px solid rgba(101, 214, 255, 0.24);
}

.market-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
}

.market-card,
.referral-item {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 18px;
    padding: 0.95rem;
}

.market-label {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.market-card strong {
    font-size: 1.05rem;
    display: block;
}

.market-change {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.82rem;
}

.market-change.up {
    color: var(--success);
}

.market-change.down {
    color: var(--danger);
}

.simulator-topbar,
.referral-item {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    align-items: center;
}

.referral-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.metric-pill {
    display: inline-flex;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    font-size: 0.82rem;
}

.metric-pill.success {
    background: rgba(51,214,166,0.18);
    color: #8ff0c2;
}

@keyframes modalEnter {
    from {
        transform: translateY(12px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (min-width: 960px) {
    .hero-grid {
        grid-template-columns: 1.15fr 0.85fr;
        align-items: stretch;
    }

    .dashboard-shell {
        flex-direction: row;
    }

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

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

@media (max-width: 900px) {
    .sidebar {
        display: none;
    }

    .dashboard-shell {
        flex-direction: column;
    }

    .admin-head,
    .account-row {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 760px) {
    .container {
        width: min(100% - 1rem, 100%);
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .hero p {
        font-size: 0.96rem;
    }

    .btn {
        padding: 0.95rem 1rem;
    }

    .table th,
    .table td {
        padding: 0.7rem;
        font-size: 0.85rem;
    }

    .market-board {
        grid-template-columns: 1fr 1fr;
    }

    .simulator-topbar,
    .referral-item {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-tabs .btn,
    .admin-actions .btn,
    .account-row .btn {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .hero-grid,
    .grid-2,
    .grid-3,
    .plan-grid {
        grid-template-columns: 1fr;
    }

    .navbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .nav-links {
        justify-content: center;
    }

    .mobile-nav {
        position: fixed;
        display: flex;
    }

    main {
        padding-bottom: 7rem;
    }

    .hero,
    .panel,
    .card,
    .stat-card,
    .sidebar,
    .auth-card {
        border-radius: 20px;
    }

    .card,
    .auth-card,
    .sidebar {
        padding: 0.95rem;
    }

    .table {
        background: transparent;
    }

    .table thead {
        display: none;
    }

    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100%;
    }

    .table tr {
        margin-bottom: 0.85rem;
        border: 1px solid rgba(255,255,255,.08);
        border-radius: 18px;
        background: rgba(255,255,255,.04);
        overflow: hidden;
    }

    .table td {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        text-align: right;
    }

    .table td::before {
        content: attr(data-label);
        color: var(--muted);
        text-align: left;
        font-weight: 600;
    }

    .table td[colspan]::before {
        content: "";
    }
}
