/* Mi Deuda v1.1 — split landing + dashboard tipografía moderada */
:root {
    --color-primary: #1A3A5C;
    --color-accent: #f18c21;
    --color-accent-hover: #d97b1c;
    --color-bg: #F8FAFB;
    --color-surface: #FFFFFF;
    --color-text: #1C2B3A;
    --color-muted: #6B7E8F;
    --color-success: #22C55E;
    --color-warning: #FBBF24;
    --color-danger: #EF4444;
    --color-border: #E2E8F0;
    --color-blue-logo: #046ca4;
    --color-orange-logo: #f18c21;
}

* {
    box-sizing: border-box;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    margin: 0;
    font-family: 'Montserrat', system-ui, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    font-weight: 500;
    font-size: 0.95rem;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: min(1120px, 92%);
    margin: 0 auto;
}

/* Header */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.site-header .inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-header img {
    height: 48px;
    width: auto;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-actions .btn-outline {
    padding: 0.55rem 1.25rem;
    font-size: 0.875rem;
}

/* Cards */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 24px rgba(26, 58, 92, 0.06);
}

.card-enter {
    animation: cardEnter 0.3s ease-out;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    border-radius: 999px;
    padding: 0.85rem 1.75rem;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--color-accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    color: #fff;
}

.btn-secondary {
    background: var(--color-primary);
    color: #fff;
}

.btn-success {
    background: var(--color-success);
    color: #fff;
}

.btn-success:hover {
    background: #1aad4f;
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-full {
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    background: #fff;
}

.form-control:focus {
    outline: 2px solid rgba(245, 166, 35, 0.35);
    border-color: var(--color-accent);
}

/* Landing — pantalla dividida (1/3 panel + 2/3 imagen) */
body.landing-page {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background: var(--color-surface);
    overflow-x: hidden;
}

body.landing-page .grecaptcha-badge {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.split-landing {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
}

.split-panel {
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: var(--color-surface);
    flex: 1 1 auto;
    padding:
        max(1rem, env(safe-area-inset-top))
        max(1.25rem, env(safe-area-inset-right))
        max(1rem, env(safe-area-inset-bottom))
        max(1.25rem, env(safe-area-inset-left));
}

.split-panel-inner {
    width: 100%;
    max-width: 22.5rem;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1.1rem;
    min-height: 100%;
}

.split-brand {
    flex-shrink: 0;
}

.split-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.split-logo img {
    height: 2.75rem;
    width: auto;
    display: block;
}

.split-content {
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    width: 100%;
}

.split-headline {
    margin: 0 0 0.4rem;
    font-size: clamp(1.5rem, 5.2vw, 1.875rem);
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.split-headline .brand-name {
    color: var(--color-blue-logo);
    white-space: nowrap;
}

.split-sub {
    margin: 0 0 1.25rem;
    font-size: 0.925rem;
    font-weight: 500;
    color: var(--color-muted);
    line-height: 1.45;
}

.split-form {
    width: 100%;
    text-align: left;
}

.split-form .form-group {
    margin-bottom: 0.65rem;
}

.split-form .form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.35rem;
}

.form-control-dni {
    font-size: 1rem;
    letter-spacing: 0.04em;
    text-align: center;
    padding: 0.95rem 1rem;
    min-height: 3.1rem;
    border-radius: 14px;
}

.split-motivation {
    margin: 0 0 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-muted);
    font-style: italic;
    text-align: center;
    line-height: 1.4;
}

/* Pantalla de verificación de identidad — fondo blanco, sin imagen */
.verify-page {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    background: #FFFFFF;
    padding:
        max(1.25rem, env(safe-area-inset-top))
        max(1.25rem, env(safe-area-inset-right))
        max(1.25rem, env(safe-area-inset-bottom))
        max(1.25rem, env(safe-area-inset-left));
}

.verify-back {
    position: absolute;
    top: max(1rem, env(safe-area-inset-top));
    right: max(1rem, env(safe-area-inset-right));
    z-index: 2;
    padding: 0.45rem 1rem;
    font-size: 0.8rem;
    border-width: 1.5px;
    gap: 0.35rem;
}

.verify-back i,
.verify-back svg {
    width: 0.95rem;
    height: 0.95rem;
}

.verify-inner {
    width: 100%;
    max-width: 22.5rem;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1.1rem;
    min-height: 100%;
    padding-top: 0.5rem;
}

.verify-hints {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin: 0 0 1.25rem;
    width: 100%;
}

.verify-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    text-align: center;
}

.verify-hint-label {
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94A3B8;
}

.verify-hint-value {
    font-size: 0.8rem;
    font-weight: 500;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    letter-spacing: 0.05em;
    color: #94A3B8;
    word-break: break-all;
}

.btn-cta {
    min-height: 3.1rem;
    font-size: 0.95rem;
    border-radius: 14px;
    padding: 0.9rem 1.25rem;
}

.split-help {
    margin: 1rem 0 0;
    font-size: 0.875rem;
    text-align: center;
}

.split-help a {
    color: var(--color-primary);
    font-weight: 600;
}

.split-help a:hover {
    color: var(--color-blue-logo);
}

.split-footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    margin-top: auto;
    padding-top: 0.75rem;
}

.split-back {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-muted);
}

.split-back:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.split-legal {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--color-muted);
    opacity: 0.85;
}

.split-hero {
    position: relative;
    order: -1;
    flex: 0 0 auto;
    height: clamp(15rem, 42vh, 20rem);
    overflow: hidden;
    background: var(--color-primary);
}

.split-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 35%;
    display: block;
}

.split-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(26, 58, 92, 0.18) 0%,
        rgba(26, 58, 92, 0.35) 100%
    );
    pointer-events: none;
}

.alert-not-found {
    background: #F8FAFB;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    text-align: center;
}

.alert-actions {
    margin-top: 0.75rem;
}

/* Tablet: banner un poco más alto, panel más aireado */
@media (min-width: 640px) and (max-width: 899px) {
    .split-hero {
        height: clamp(16rem, 40vh, 22rem);
    }

    .split-panel {
        padding: 1.75rem 2rem 1.5rem;
    }

    .split-panel-inner {
        max-width: 24rem;
        gap: 1.5rem;
    }

    .split-logo img {
        height: 3rem;
    }

    .split-headline {
        font-size: 1.875rem;
    }
}

/* Desktop: 1/3 + 2/3 a pantalla completa */
@media (min-width: 900px) {
    .split-landing {
        flex-direction: row;
        align-items: stretch;
    }

    .split-panel {
        order: 0;
        width: 34%;
        max-width: 28rem;
        flex: 0 0 34%;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 2.5rem 2.25rem;
        align-items: center;
    }

    .split-panel-inner {
        max-width: 21.5rem;
        min-height: min(36rem, calc(100dvh - 5rem));
        justify-content: space-between;
        gap: 1.75rem;
    }

    .split-content {
        flex: 1 1 auto;
        justify-content: center;
    }

    .split-logo img {
        height: 3.25rem;
    }

    .split-headline {
        font-size: clamp(1.75rem, 2vw, 2.125rem);
        margin-bottom: 0.5rem;
    }

    .split-sub {
        margin-bottom: 1.5rem;
        font-size: 0.95rem;
    }

    .split-motivation {
        margin-bottom: 1.15rem;
        font-size: 0.85rem;
    }

    .split-help {
        margin-top: 1.15rem;
    }

    .split-footer {
        margin-top: 0;
        padding-top: 0.25rem;
    }

    .split-hero {
        order: 0;
        display: block;
        width: 66%;
        flex: 1 1 66%;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .split-hero-img {
        object-position: center center;
    }

    .split-hero-overlay {
        background: var(--color-primary);
        opacity: 0.18;
    }
}

/* Pantallas anchas: panel un poco más cómodo */
@media (min-width: 1200px) {
    .split-panel {
        width: 33.333%;
        max-width: none;
        flex: 0 0 33.333%;
        padding: 3rem 2.75rem;
    }

    .split-panel-inner {
        max-width: 22rem;
    }

    .split-hero {
        width: 66.667%;
        flex: 1 1 66.667%;
    }
}

/* Móviles bajos: priorizar el formulario sin scroll */
@media (max-width: 899px) and (max-height: 700px) {
    .split-hero {
        height: 12rem;
    }

    .split-panel {
        padding-top: 0.85rem;
        padding-bottom: 0.85rem;
    }

    .split-panel-inner {
        gap: 0.75rem;
    }

    .split-logo img {
        height: 2.35rem;
    }

    .split-headline {
        font-size: 1.4rem;
    }

    .split-sub {
        margin-bottom: 0.85rem;
        font-size: 0.85rem;
    }

    .form-control-dni,
    .btn-cta {
        min-height: 2.85rem;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .split-motivation {
        margin-bottom: 0.75rem;
        font-size: 0.75rem;
    }

    .split-help {
        margin-top: 0.75rem;
    }
}

/* Móviles muy estrechos */
@media (max-width: 380px) {
    .split-panel {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .split-headline {
        font-size: 1.35rem;
    }

    .btn-cta {
        font-size: 0.9rem;
    }
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: left;
}

.alert-error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-info {
    background: #EFF6FF;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

.alert-success {
    background: #F0FDF4;
    color: #166534;
    border: 1px solid #BBF7D0;
}

/* Dashboard — tipografía moderada (v1.1) */
.dashboard-page {
    line-height: 1.45;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding: 1.5rem 0 2.5rem;
}

@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 3fr 2fr;
    }
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 0;
    flex-wrap: wrap;
}

.dashboard-welcome {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.dashboard-name {
    margin: 0.2rem 0 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary);
    line-height: 1.3;
}

.amount {
    font-size: 1.625rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--color-primary);
    margin: 0.2rem 0 0.5rem;
    line-height: 1.2;
}

.amount-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0.2rem 0 0;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #DCFCE7; color: #166534; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-info { background: #DBEAFE; color: #1E40AF; }
.badge-accent { background: #FEF3C7; color: #B45309; }

.historial-pago {
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    margin-bottom: 0.75rem;
    background: var(--color-bg);
}

.historial-pago:last-child {
    margin-bottom: 0;
}

.historial-meta {
    margin: 0.4rem 0 0;
    font-size: 0.85rem;
    color: var(--color-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.historial-meta a {
    color: var(--color-primary);
    font-weight: 600;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.125rem;
    margin: 0 0 0.85rem;
    color: var(--color-primary);
    line-height: 1.35;
}

.savings {
    background: #FFFBEB;
    border: 1px dashed var(--color-accent);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin: 0.85rem 0;
    font-size: 0.9rem;
}

.savings strong {
    color: var(--color-accent);
    font-size: 1rem;
    font-weight: 700;
}

/* Upload zone */
.dropzone {
    border: 2px dashed var(--color-border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--color-accent);
    background: #FFFBEB;
}

.dropzone input {
    display: none;
}

.preview-box {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--color-bg);
    border-radius: 12px;
    font-size: 0.9rem;
}

/* Admin layout */
.admin-body {
    margin: 0;
    min-height: 100vh;
    background: var(--color-bg);
}

.admin-login-body {
    min-height: 100vh;
    background: var(--color-bg);
}

.admin-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    box-sizing: border-box;
}

.admin-sidebar-brand {
    padding: 0.25rem 0.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 1rem;
}

.admin-sidebar-brand strong {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
}

.admin-sidebar-brand span {
    display: block;
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.15rem;
}

.admin-sidebar-user {
    padding: 0.75rem 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-bottom: 1rem;
}

.admin-sidebar-user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.admin-sidebar-user-login {
    font-size: 0.8rem;
    opacity: 0.75;
    margin-top: 0.15rem;
}

.admin-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.admin-sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.7rem 0.75rem;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}

.admin-sidebar-nav a i,
.admin-sidebar-logout i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.admin-sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.admin-sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-weight: 600;
}

.admin-sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.admin-sidebar-logout {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.7rem 0.75rem;
    border-radius: 8px;
}

.admin-sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.admin-main {
    flex: 1;
    min-width: 0;
    padding: 1.5rem 1.75rem 2.5rem;
}

.admin-page {
    max-width: 1100px;
}

@media (max-width: 768px) {
    .admin-shell {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem;
    }

    .admin-sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        flex: none;
    }

    .admin-sidebar-footer {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
    }

    .admin-main {
        padding: 1.25rem 1rem 2rem;
    }
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem 1rem;
}

@media (min-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.table-wrap {
    overflow-x: auto;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.stat-card .number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-primary);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
    padding: 0.65rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}

.admin-table th {
    background: var(--color-bg);
    font-weight: 600;
}

.admin-table tr.row-pagada {
    background: #ECFDF5;
}

.admin-table tr.row-pagada td {
    border-bottom-color: #BBF7D0;
    color: #166534;
}

.site-footer {
    background: var(--color-primary);
    color: rgba(255, 255, 255, 0.85);
    padding: 2rem 0;
    margin-top: auto;
    font-size: 0.85rem;
}

.site-footer a {
    color: #fff;
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}
