:root {
    --blue: #0B3D91;
    --blue-dark: #061E45;
    --blue-mid: #123B73;
    --blue-soft: #EAF1FF;
    --gold: #D4AF37;
    --gold-soft: #FFF6D8;
    --white: #FFFFFF;
    --bg: #F4F7FB;
    --text: #172033;
    --muted: #667085;
    --border: #DFE7F2;
    --success: #16A34A;
    --success-soft: #DCFCE7;
    --warning: #F59E0B;
    --warning-soft: #FEF3C7;
    --danger: #DC2626;
    --danger-soft: #FEE2E2;
    --purple: #7C3AED;
    --purple-soft: #F3E8FF;
    --gray-soft: #E5E7EB;
    --radius: 24px;
    --shadow: 0 24px 70px rgba(15, 23, 42, 0.10);
    --shadow-strong: 0 34px 90px rgba(15, 23, 42, 0.16);
    --sidebar-width: 282px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: radial-gradient(circle at top right, rgba(212, 175, 55, 0.13), transparent 30%), radial-gradient(circle at bottom left, rgba(11, 61, 145, 0.10), transparent 34%), var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

.finance-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
}

/* SIDEBAR */

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: radial-gradient(circle at top left, rgba(212, 175, 55, 0.22), transparent 32%), linear-gradient(180deg, var(--blue-dark), #08295C);
    color: var(--white);
    padding: 22px;
    display: flex;
    flex-direction: column;
    z-index: 80;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 34px;
}

.brand-badge {
    width: 54px;
    height: 54px;
    border-radius: 19px;
    background: var(--gold);
    color: var(--blue-dark);
    display: grid;
    place-items: center;
    font-weight: 950;
    box-shadow: 0 14px 34px rgba(212, 175, 55, 0.24);
    flex: 0 0 auto;
}

.sidebar-brand strong,
.sidebar-brand span {
    display: block;
}

.sidebar-brand strong {
    font-size: 18px;
    line-height: 1.15;
}

.sidebar-brand span {
    color: #CBD5E1;
    font-size: 13px;
    margin-top: 3px;
    line-height: 1.45;
}

.sidebar-nav {
    display: grid;
    gap: 9px;
}

    .sidebar-nav a,
    .sidebar-footer a {
        min-height: 50px;
        padding: 0 14px;
        border-radius: 16px;
        display: flex;
        align-items: center;
        gap: 12px;
        color: #E5E7EB;
        font-weight: 850;
        transition: 0.2s ease;
    }

        .sidebar-nav a:hover,
        .sidebar-nav a.active,
        .sidebar-footer a:hover {
            background: rgba(255, 255, 255, 0.13);
            color: var(--white);
            transform: translateX(3px);
        }

        .sidebar-nav a.active {
            box-shadow: inset 4px 0 0 var(--gold);
        }

    .sidebar-nav span,
    .sidebar-footer span {
        color: var(--gold);
    }

.sidebar-footer {
    margin-top: auto;
    padding-top: 24px;
}

    .sidebar-footer a {
        color: #FECACA;
    }

/* MAIN */

.main {
    padding: 28px;
    overflow: hidden;
}

.topbar {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(223, 231, 242, 0.88);
    border-radius: 30px;
    padding: 22px 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 24px;
}

.menu-button {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    background: var(--blue-soft);
    color: var(--blue);
    display: none;
    place-items: center;
    flex: 0 0 auto;
}

.topbar-copy {
    min-width: 0;
}

.page-kicker,
.panel-kicker,
.modal-kicker {
    color: var(--gold);
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: 0.08em;
}

.topbar h1 {
    font-size: clamp(28px, 3vw, 38px);
    color: var(--blue-dark);
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.topbar p {
    color: var(--muted);
    margin-top: 5px;
    line-height: 1.55;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.ghost-button,
.primary-button,
.secondary-button,
.danger-button {
    min-height: 46px;
    padding: 0 15px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 950;
    transition: 0.2s ease;
}

.ghost-button {
    background: var(--blue-soft);
    color: var(--blue);
}

.primary-button {
    background: var(--blue);
    color: var(--white);
    box-shadow: 0 14px 32px rgba(11, 61, 145, 0.22);
}

.secondary-button {
    background: var(--blue-soft);
    color: var(--blue);
}

.danger-button {
    background: var(--danger-soft);
    color: #991B1B;
}

    .ghost-button:hover,
    .primary-button:hover,
    .secondary-button:hover,
    .danger-button:hover {
        transform: translateY(-2px);
    }

.primary-button:hover {
    background: var(--blue-dark);
}

.secondary-button:hover {
    background: #DCEAFF;
}

.danger-button:hover {
    background: var(--danger);
    color: var(--white);
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled {
    opacity: 0.72;
    cursor: wait;
    transform: none;
}

.user-chip {
    min-height: 54px;
    padding: 8px 14px;
    border-radius: 18px;
    background: var(--white);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

    .user-chip > span {
        color: var(--blue);
    }

    .user-chip strong,
    .user-chip small {
        display: block;
    }

    .user-chip strong {
        color: var(--blue-dark);
    }

    .user-chip small {
        color: var(--muted);
        font-weight: 750;
    }

/* HERO */

.hero-summary {
    position: relative;
    background: radial-gradient(circle at top right, rgba(212, 175, 55, 0.25), transparent 28%), linear-gradient(135deg, var(--blue-dark), var(--blue-mid));
    color: var(--white);
    border-radius: 34px;
    padding: 32px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 28px;
    align-items: center;
    box-shadow: var(--shadow-strong);
    overflow: hidden;
    margin-bottom: 24px;
}

    .hero-summary::after {
        content: "";
        position: absolute;
        inset: 0;
        background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
        background-size: 42px 42px;
        mask-image: radial-gradient(circle at center, black, transparent 72%);
        opacity: 0.5;
    }

    .hero-summary > * {
        position: relative;
        z-index: 2;
    }

.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--gold);
    padding: 9px 14px;
    border-radius: 999px;
    font-weight: 950;
    margin-bottom: 18px;
}

.hero-summary h2 {
    font-size: clamp(30px, 4vw, 50px);
    line-height: 1.02;
    letter-spacing: -0.045em;
    max-width: 840px;
}

.hero-summary p {
    color: #D8E2F0;
    margin-top: 14px;
    max-width: 760px;
    line-height: 1.7;
}

.summary-card {
    width: 270px;
    background: rgba(255, 255, 255, 0.13);
    border: 1px solid rgba(255, 255, 255, 0.17);
    border-radius: 28px;
    padding: 24px;
    backdrop-filter: blur(12px);
}

    .summary-card > span {
        color: var(--gold);
        font-size: 46px;
    }

    .summary-card strong,
    .summary-card small {
        display: block;
    }

    .summary-card strong {
        font-size: clamp(20px, 2vw, 25px);
        margin: 12px 0 6px;
        letter-spacing: -0.04em;
        overflow-wrap: anywhere;
    }

    .summary-card small {
        color: #D8E2F0;
    }

/* ALERT */

.finance-alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    font-weight: 850;
    line-height: 1.5;
}

    .finance-alert.success {
        background: var(--success-soft);
        color: #166534;
    }

    .finance-alert.error {
        background: var(--danger-soft);
        color: #991B1B;
    }

    .finance-alert.info {
        background: var(--blue-soft);
        color: var(--blue);
    }

/* STATS */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: 0.22s ease;
    min-height: 154px;
    min-width: 0;
    overflow: hidden;
}

    .stat-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-strong);
    }

.stat-icon {
    width: clamp(52px, 4vw, 62px);
    height: clamp(52px, 4vw, 62px);
    border-radius: 22px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

    .stat-icon span {
        font-size: clamp(30px, 3vw, 36px);
    }

    .stat-icon.total {
        background: var(--blue-soft);
        color: var(--blue);
    }

    .stat-icon.pending {
        background: var(--warning-soft);
        color: #92400E;
    }

    .stat-icon.paid {
        background: var(--success-soft);
        color: #166534;
    }

    .stat-icon.income {
        background: var(--gold-soft);
        color: #92400E;
    }

.stat-card > div:not(.stat-icon) {
    min-width: 0;
}

.stat-card span {
    display: block;
    max-width: 100%;
    color: var(--muted);
    font-weight: 850;
    line-height: 1.35;
}

.stat-card strong {
    display: block;
    max-width: 100%;
    color: var(--blue-dark);
    font-size: clamp(26px, 2.55vw, 38px);
    line-height: 0.98;
    margin-top: 8px;
    letter-spacing: -0.055em;
    white-space: normal;
    overflow-wrap: anywhere;
}

    .stat-card strong[id*="Income"],
    .stat-card strong[id*="Amount"] {
        font-size: clamp(24px, 2.25vw, 36px);
        letter-spacing: -0.06em;
    }

.stat-card small {
    display: block;
    max-width: 100%;
    color: var(--muted);
    margin-top: 8px;
    line-height: 1.35;
}

/* PANELS */

.panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 20px;
}

    .panel-header h2 {
        color: var(--blue-dark);
        font-size: 24px;
        letter-spacing: -0.025em;
        line-height: 1.1;
        margin-top: 3px;
    }

    .panel-header p {
        color: var(--muted);
        margin-top: 6px;
        line-height: 1.55;
    }

.panel-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 0 0 auto;
}

.bottom-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

/* TOOLBAR */

.finance-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}

.search-box {
    min-height: 52px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
}

    .search-box span {
        color: var(--blue);
    }

    .search-box input {
        width: 100%;
        border: 0;
        outline: none;
        background: transparent;
        color: var(--text);
        font-weight: 750;
    }

        .search-box input::placeholder {
            color: #7A8496;
        }

    .search-box:focus-within {
        border-color: var(--blue);
        background: var(--white);
        box-shadow: 0 0 0 4px rgba(11, 61, 145, 0.12);
    }

.finance-select,
.form-group select,
.form-group input {
    min-height: 52px;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 0 14px;
    background: var(--bg);
    color: var(--blue-dark);
    font-weight: 850;
    outline: none;
}

.finance-select,
.form-group select {
    padding-right: 42px;
    appearance: none;
    background: linear-gradient(45deg, transparent 50%, var(--blue) 50%), linear-gradient(135deg, var(--blue) 50%, transparent 50%), var(--bg);
    background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

    .finance-select:focus,
    .form-group select:focus,
    .form-group input:focus {
        border-color: var(--blue);
        background-color: var(--white);
        box-shadow: 0 0 0 4px rgba(11, 61, 145, 0.12);
    }

.table-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

    .table-meta div {
        display: flex;
        align-items: center;
        gap: 8px;
        color: var(--muted);
        font-weight: 850;
    }

        .table-meta div span:first-child {
            color: var(--blue);
        }

/* TABLE */

.table-wrapper {
    overflow-x: auto;
}

.finance-table {
    width: 100%;
    min-width: 1200px;
    border-collapse: collapse;
}

    .finance-table th,
    .finance-table td {
        padding: 15px 13px;
        border-bottom: 1px solid var(--border);
        text-align: left;
        vertical-align: middle;
    }

    .finance-table th {
        color: var(--muted);
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        font-weight: 950;
    }

    .finance-table td {
        color: var(--text);
        font-size: 14px;
    }

.student-cell,
.activity-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.student-avatar,
.activity-icon {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.student-avatar {
    background: var(--blue-soft);
    color: var(--blue);
    font-weight: 950;
}

.activity-icon {
    background: var(--gold-soft);
    color: #92400E;
}

    .activity-icon span {
        font-size: 28px;
    }

.student-info strong,
.student-info small,
.activity-info strong,
.activity-info small {
    display: block;
}

.student-info strong,
.activity-info strong {
    color: var(--blue-dark);
}

.student-info small,
.activity-info small,
.table-subtext {
    color: var(--muted);
    margin-top: 3px;
    line-height: 1.4;
}

.money-value {
    color: var(--blue-dark);
    font-weight: 950;
    letter-spacing: -0.02em;
}

.status-badge,
.validation-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 950;
    line-height: 1.1;
    white-space: nowrap;
}

.status-pagado {
    background: var(--success-soft);
    color: #166534;
}

.status-pendiente {
    background: var(--warning-soft);
    color: #92400E;
}

.status-vencido {
    background: var(--danger-soft);
    color: #991B1B;
}

.validation-manual {
    background: var(--blue-soft);
    color: var(--blue);
}

.validation-excel {
    background: var(--success-soft);
    color: #166534;
}

.validation-revisar {
    background: var(--warning-soft);
    color: #92400E;
}

.validation-empty {
    background: var(--gray-soft);
    color: #374151;
}

.action-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.icon-action {
    min-height: 38px;
    padding: 0 11px;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 950;
    transition: 0.2s ease;
}

    .icon-action span {
        font-size: 18px;
    }

    .icon-action:hover {
        transform: translateY(-2px);
        background: var(--blue);
        color: var(--white);
    }

    .icon-action.paid {
        background: var(--success-soft);
        color: #166534;
    }

        .icon-action.paid:hover {
            background: var(--success);
            color: var(--white);
        }

    .icon-action.expired {
        background: var(--danger-soft);
        color: #991B1B;
    }

        .icon-action.expired:hover {
            background: var(--danger);
            color: var(--white);
        }

/* LISTS */

.list {
    display: grid;
    gap: 12px;
}

.list-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 13px;
}

.list-icon {
    width: 42px;
    height: 42px;
    border-radius: 15px;
    background: var(--warning-soft);
    color: #92400E;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.list-content strong {
    display: block;
    color: var(--blue-dark);
    margin-bottom: 4px;
}

.list-content span {
    display: block;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

/* QUICK ACTIONS */

.quick-actions {
    display: grid;
    gap: 12px;
}

    .quick-actions a,
    .quick-actions button {
        min-height: 56px;
        border-radius: 18px;
        background: var(--bg);
        border: 1px solid var(--border);
        color: var(--blue-dark);
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 0 16px;
        font-weight: 900;
        transition: 0.2s ease;
        text-align: left;
    }

        .quick-actions a:hover,
        .quick-actions button:hover {
            background: var(--blue-soft);
            transform: translateX(4px);
        }

    .quick-actions span {
        color: var(--blue);
    }

.empty-message {
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: 18px;
    padding: 20px;
    color: var(--muted);
    font-weight: 850;
    text-align: center;
}

/* MODAL */

.payment-modal {
    width: min(900px, calc(100% - 30px));
    border: 0;
    border-radius: 30px;
    padding: 0;
    background: transparent;
}

    .payment-modal::backdrop {
        background: rgba(8, 31, 69, 0.62);
        backdrop-filter: blur(8px);
    }

.modal-card {
    position: relative;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 28px;
    box-shadow: var(--shadow-strong);
    max-height: calc(100vh - 36px);
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--blue-soft);
    color: var(--blue);
    display: grid;
    place-items: center;
}

    .modal-close:hover {
        background: #DCEAFF;
    }

.modal-heading {
    padding-right: 46px;
    margin-bottom: 20px;
}

    .modal-heading h2 {
        color: var(--blue-dark);
        font-size: 30px;
        letter-spacing: -0.035em;
        line-height: 1.05;
        margin-top: 4px;
    }

    .modal-heading p {
        color: var(--muted);
        margin-top: 6px;
        line-height: 1.55;
    }

.payment-detail-card {
    background: radial-gradient(circle at top right, rgba(212, 175, 55, 0.16), transparent 30%), var(--bg);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.detail-icon {
    width: 56px;
    height: 56px;
    border-radius: 19px;
    background: var(--gold-soft);
    color: #92400E;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

    .detail-icon span {
        font-size: 34px;
    }

.payment-detail-card strong,
.payment-detail-card span,
.payment-detail-card small {
    display: block;
}

.payment-detail-card strong {
    color: var(--blue-dark);
    font-size: 18px;
}

.payment-detail-card span {
    color: var(--muted);
    margin-top: 4px;
}

.payment-detail-card small {
    color: var(--blue);
    font-weight: 950;
    margin-top: 6px;
}

.payment-form {
    display: grid;
    gap: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-group {
    display: grid;
    gap: 8px;
}

    .form-group label {
        color: var(--blue-dark);
        font-weight: 900;
    }

    .form-group input::placeholder {
        color: #7A8496;
    }

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.save-button {
    min-width: 170px;
}

.hidden {
    display: none !important;
}

.sidebar-backdrop {
    display: none;
}

/* RESPONSIVE */

@media (max-width: 1320px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-card strong {
        font-size: clamp(30px, 4vw, 40px);
    }

        .stat-card strong[id*="Income"],
        .stat-card strong[id*="Amount"] {
            font-size: clamp(28px, 3.6vw, 38px);
        }

    .bottom-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1180px) {
    .hero-summary {
        grid-template-columns: 1fr;
    }

    .summary-card {
        width: 100%;
    }
}

@media (max-width: 860px) {
    .finance-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -292px;
        top: 0;
        width: var(--sidebar-width);
        transition: 0.25s ease;
    }

        .sidebar.open {
            left: 0;
        }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(8, 31, 69, 0.52);
        backdrop-filter: blur(4px);
        z-index: 70;
    }

        .sidebar-backdrop.show {
            display: block;
        }

    .menu-button {
        display: grid;
    }

    .topbar {
        align-items: flex-start;
    }

    .topbar-actions {
        display: none;
    }

    .finance-toolbar {
        grid-template-columns: 1fr;
    }

    .panel-header,
    .table-meta {
        display: grid;
    }

    .panel-actions {
        display: grid;
        width: 100%;
    }

        .panel-actions a,
        .panel-actions button {
            width: 100%;
        }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        display: grid;
    }

        .modal-actions button {
            width: 100%;
        }
}

@media (max-width: 620px) {
    .main {
        padding: 18px;
    }

    .topbar,
    .hero-summary,
    .panel,
    .modal-card {
        border-radius: 22px;
    }

    .hero-summary {
        padding: 24px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 18px;
        align-items: center;
    }

        .stat-card strong,
        .stat-card strong[id*="Income"],
        .stat-card strong[id*="Amount"] {
            font-size: clamp(30px, 10vw, 42px);
        }

    .finance-select {
        width: 100%;
    }
}
