* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

body {
    background: #0f1115;
    color: #eaeaea;
}

a {
    color: inherit;
}

.topbar {
    background: #171a21;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2b2f3a;
    gap: 20px;
    flex-wrap: wrap;
}

.brand h1 {
    font-size: 28px;
    margin-bottom: 4px;
}

.brand p {
    color: #9aa4b2;
    font-size: 14px;
}

.topnav {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.topnav a {
    text-decoration: none;
    color: #ddd;
    padding: 8px 12px;
    border-radius: 8px;
}

.topnav a:hover {
    background: #1f2430;
}

.container {
    padding: 24px 30px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-header h2 {
    font-size: 28px;
    margin-bottom: 4px;
}

.subtitle {
    color: #9aa4b2;
    font-size: 14px;
}

.flash-container {
    margin-bottom: 20px;
    display: grid;
    gap: 10px;
}

.flash {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #2b2f3a;
}

.flash-success {
    background: rgba(25, 135, 84, 0.15);
    border-color: rgba(25, 135, 84, 0.4);
}

.flash-error {
    background: rgba(220, 53, 69, 0.15);
    border-color: rgba(220, 53, 69, 0.4);
}

.anios-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.anio-btn {
    background: none;
    color: #9aa4b2;
    border: 1px solid #2a2d35;
    padding: 4px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.anio-btn:hover {
    color: white;
    border-color: #6f42c1;
}

.anio-btn.activo {
    color: white;
    border-color: #6f42c1;
    background: #1a1240;
}

.meses-nav-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
}

.meses-nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    overflow-x: scroll;
    flex: 1;
    scrollbar-width: none;
}

.meses-nav::-webkit-scrollbar {
    display: none;
}

.mes-nav-arrow {
    color: #9aa4b2;
    text-decoration: none;
    font-size: 24px;
    line-height: 1;
    padding: 0 4px;
    border-radius: 6px;
}

.mes-nav-arrow:hover {
    color: white;
    background: #2a2d35;
}

.mes-chip {
    background: #1f2430;
    color: #ddd;
    padding: 8px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    border: 1px solid transparent;
}

.mes-chip:hover {
    border-color: #6f42c1;
}

.mes-chip.activo {
    background: #6f42c1;
    color: white;
}

.resumen {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.card {
    background: #171a21;
    border: 1px solid #2b2f3a;
    border-radius: 12px;
    padding: 16px;
    min-width: 220px;
}

.card h3 {
    font-size: 14px;
    color: #aaa;
    margin-bottom: 8px;
}

.card p {
    font-size: 24px;
    font-weight: bold;
}

.card.total {
    border-color: #6f42c1;
}

.tabla-seccion {
    margin-bottom: 36px;
}

.tabla-titulo {
    font-size: 16px;
    font-weight: 600;
    color: #9aa4b2;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
}

.tabla-wrapper {
    overflow-x: auto;
    background: #171a21;
    border-radius: 12px;
    border: 1px solid #2b2f3a;
}

.fila-pago-tarjeta td {
    color: #f0a500;
}

.form-pago-tarjeta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.input-inline {
    background: #1f2430;
    border: 1px solid #444c56;
    color: #f0a500;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    width: 110px;
}

.input-inline:focus {
    outline: none;
    border-color: #6f42c1;
}

.btn-inline-save {
    background: #2a2d35;
    color: #c9d1d9;
    border: 1px solid #444c56;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-inline-save:hover {
    border-color: #6f42c1;
    color: white;
}

.hint-calculado {
    display: block;
    font-size: 11px;
    color: #6a737d;
    margin-top: 2px;
}

.tabla-gastos {
    width: 100%;
    border-collapse: collapse;
}

.tabla-gastos th,
.tabla-gastos td {
    padding: 12px;
    border-bottom: 1px solid #2b2f3a;
    text-align: left;
    white-space: nowrap;
    vertical-align: middle;
}

.tabla-gastos th {
    background: #1b1f27;
}

.badge {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
}

.badge.debito {
    background: #0d6efd;
    color: white;
}

.badge.credito {
    background: #d63384;
    color: white;
}

.badge.estado.pagada {
    background: rgba(25, 135, 84, 0.2);
    color: #7ce6a3;
    border: 1px solid rgba(25, 135, 84, 0.4);
}

.badge.estado.pendiente {
    background: rgba(255, 193, 7, 0.15);
    color: #ffd666;
    border: 1px solid rgba(255, 193, 7, 0.35);
}

.form-card {
    background: #171a21;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #2b2f3a;
    max-width: 980px;
}

.small-form {
    max-width: 480px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.full {
    grid-column: 1 / -1;
}

.input {
    width: 100%;
    margin-top: 6px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #0f1115;
    color: white;
}

.textarea {
    min-height: 90px;
    resize: vertical;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-primary,
.btn-primary-link {
    margin-top: 20px;
    background: #6f42c1;
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-primary-link {
    margin-top: 0;
}

.btn-secondary {
    background: #2a2d35;
    color: #c9d1d9;
    border: 1px solid #444c56;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.btn-secondary:hover {
    border-color: #6f42c1;
    color: white;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.acciones a,
.acciones button {
    margin-right: 8px;
    color: #8ab4ff;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.acciones button:hover,
.acciones a:hover {
    text-decoration: underline;
}

.empty {
    text-align: center;
    color: #999;
}

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

    .container {
        padding: 18px;
    }

    .topbar {
        padding: 18px;
    }
}

/* ---- Hamburger menu ---- */

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.hamburger-wrapper {
    position: relative;
}

/* On login/register pages (no topbar), keep it fixed */
.login-body .hamburger-wrapper {
    position: fixed;
    top: 18px;
    right: 20px;
    z-index: 100;
}

.hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: #171a21;
    border: 1px solid #2b2f3a;
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
}

.hamburger-btn span {
    display: block;
    height: 2px;
    background: #c9d1d9;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.hamburger-btn.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}
.hamburger-btn.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.hamburger-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #171a21;
    border: 1px solid #2b2f3a;
    border-radius: 10px;
    min-width: 210px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.hamburger-menu.open {
    display: flex;
    flex-direction: column;
}

.hamburger-menu a {
    padding: 12px 16px;
    font-size: 14px;
    color: #c9d1d9;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.12s;
}

.hamburger-menu a:hover {
    background: #1f2330;
    color: white;
}

.hamburger-menu a + a {
    border-top: 1px solid #2b2f3a;
}

/* ---- Register / admin usuarios ---- */

.login-alt {
    margin-top: 18px;
    text-align: center;
    font-size: 13px;
    color: #9aa4b2;
}

.login-alt a {
    color: #a78bfa;
    text-decoration: none;
}

.login-alt a:hover {
    text-decoration: underline;
}

.badge-you {
    background: #2b2f3a;
    color: #9aa4b2;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 999px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.user-name {
    font-weight: 500;
}

.btn-danger-sm {
    background: none;
    color: #f87171;
    border: 1px solid #f87171;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.btn-danger-sm:hover {
    background: rgba(248, 113, 113, 0.12);
}

/* ---- Auth ---- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: #171a21;
    border: 1px solid #2b2f3a;
    border-radius: 14px;
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-brand h1 {
    font-size: 26px;
    margin-bottom: 6px;
}

.login-brand p {
    color: #9aa4b2;
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: #9aa4b2;
}

.login-btn {
    margin-top: 6px;
    width: 100%;
    text-align: center;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.topbar-username {
    font-size: 13px;
    color: #9aa4b2;
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-username-link {
    color: #c9d1d9;
    text-decoration: none;
}

.topbar-username-link:hover {
    color: #a78bfa;
    text-decoration: underline;
}

.badge-admin {
    background: #6f42c1;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-logout {
    background: none;
    color: #9aa4b2;
    border: 1px solid #2b2f3a;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.btn-logout:hover {
    color: white;
    border-color: #6f42c1;
}

/* ---- Import page ---- */

.import-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.mapeo-card,
.upload-card {
    background: #171a21;
    border: 1px solid #2b2f3a;
    border-radius: 12px;
    padding: 20px;
}

.mapeo-tabla-wrapper {
    overflow-x: auto;
}

.mapeo-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.mapeo-tabla th,
.mapeo-tabla td {
    padding: 9px 12px;
    border-bottom: 1px solid #2b2f3a;
    text-align: left;
    white-space: nowrap;
}

.mapeo-tabla th {
    background: #1b1f27;
    color: #9aa4b2;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.mapeo-tabla .fila-ignorada td {
    color: #555e6b;
}

.mapeo-tabla code {
    background: #1b1f27;
    border: 1px solid #2b2f3a;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    color: #c9d1d9;
}

.mapeo-tabla .fila-ignorada code {
    color: #555e6b;
    border-color: #252930;
}

.col-csv { width: 40%; }
.col-arrow { width: 6%; text-align: center; color: #9aa4b2; }
.col-app { width: 30%; }
.col-nota { color: #6a737d; font-size: 12px; }

.ignorado-label {
    color: #555e6b;
    font-style: italic;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 2px dashed #2b2f3a;
    border-radius: 10px;
    padding: 30px 20px;
    cursor: pointer;
    transition: border-color 0.15s;
    text-align: center;
}

.upload-area:hover {
    border-color: #6f42c1;
}

.upload-icon {
    font-size: 32px;
}

.upload-text {
    font-size: 14px;
    color: #c9d1d9;
}

.upload-hint {
    font-size: 12px;
    color: #6a737d;
}

.advertencias-box {
    background: rgba(255, 193, 7, 0.08);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #ffd666;
}

.advertencias-box ul {
    margin-top: 8px;
    padding-left: 20px;
}

.advertencias-box li {
    margin-bottom: 4px;
}

.confirmar-form {
    margin-top: 10px;
}

@media (max-width: 768px) {
    .import-layout {
        grid-template-columns: 1fr;
    }
}

