/* ===================================================
   YEMMA ISP — Variables y estilos globales
   =================================================== */

:root {
    /* Paleta oscura: azules profundos sobre negro/carbón */
    --navy:          #2C7BE5;
    --navy-light:    #4E9BFF;
    --navy-dark:     #0A1A2F;
    --ink:           #E7EEF6;
    --muted:         #8095AC;
    --line:          #1E2C40;
    --bg:            #060B14;
    --bg-elevated:   #0A1220;
    --surface:       #0F1B2E;
    --surface-hover: #13233A;
    --paid:          #35C48A;
    --paid-bg:       rgba(53, 196, 138, 0.12);
    --warn:          #F0864D;
    --warn-bg:       rgba(240, 134, 77, 0.12);
    --suspended:     #E2555B;
    --suspended-bg:  rgba(226, 85, 91, 0.12);
    --shadow-sm:     0 2px 10px -4px rgba(0, 0, 0, 0.55);
    --shadow-md:     0 6px 20px -6px rgba(0, 0, 0, 0.6);
    --shadow-lg:     0 14px 38px -10px rgba(0, 0, 0, 0.7);
    --glow-navy:     0 0 0 3px rgba(44, 123, 229, 0.25);
    --radius-sm:     8px;
    --radius-md:     12px;
    --radius-lg:     16px;
    --radius-xl:     24px;
    --font-body:     'Inter', system-ui, sans-serif;
    --font-mono:     'IBM Plex Mono', 'Courier New', monospace;
    --font-display:  'Special Elite', Georgia, serif;
    --ease:          cubic-bezier(.4,0,.2,1);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    color-scheme: dark;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background:
        radial-gradient(circle at 15% -10%, rgba(44, 123, 229, 0.10) 0%, transparent 45%),
        radial-gradient(circle at 100% 0%, rgba(78, 155, 255, 0.06) 0%, transparent 40%),
        var(--bg);
    background-attachment: fixed;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ===================================================
   Animaciones globales
   =================================================== */

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

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(44, 123, 229, 0.35); }
    50%      { box-shadow: 0 0 0 6px rgba(44, 123, 229, 0); }
}

.app-main > * { animation: fadeInUp .35s var(--ease) both; }

/* Hover elevado reutilizable — solo en dispositivos que soportan hover real */
@media (hover: hover) and (pointer: fine) {
    .hover-lift, .metric-card, .finance-card, .client-card, .user-card,
    .expense-card, .quick-btn, .reclamo-card {
        transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
    }
    .hover-lift:hover, .metric-card:hover, .finance-card:hover, .client-card:hover,
    .user-card:hover, .expense-card:hover, .quick-btn:hover, .reclamo-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-md);
        border-color: var(--navy);
    }

    button:not(:disabled), a.nav-item, a.quick-btn, .metodo-btn, .tipo-btn,
    .filter-btn, .btn-primary-sm, .btn-save, .btn-cancel, .btn-danger, .btn-icon,
    .client-suggestion, a.btn-primary-sm {
        transition: transform .15s var(--ease), box-shadow .15s var(--ease),
                    background-color .15s var(--ease), color .15s var(--ease),
                    border-color .15s var(--ease), opacity .15s var(--ease);
    }
    button:not(:disabled):hover, a.nav-item:hover, a.quick-btn:hover,
    .btn-primary-sm:hover, .btn-save:hover, .btn-icon:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }
    .btn-cancel:hover { border-color: var(--navy); color: var(--ink); }
    .metodo-btn:hover, .tipo-btn:hover, .filter-btn:hover { border-color: var(--navy); color: var(--ink); }
    .client-suggestion:hover { background: var(--surface-hover); }
}

/* ===================================================
   Layout
   =================================================== */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    background: radial-gradient(circle at 25% 15%, #101d33 0%, #060b14 55%, #030509 100%);
    padding: 1rem;
}

.app-body {
    padding-top: calc(56px + env(safe-area-inset-top));
}

.app-main {
    max-width: 560px;
    margin: 0 auto;
    padding: 16px 14px;
}

/* ===================================================
   Barra superior fija
   =================================================== */

.app-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: env(safe-area-inset-top) 14px 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 4px 20px -8px rgba(0, 0, 0, 0.55);
    z-index: 150;
}

.topbar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    color: var(--navy);
    border-radius: var(--radius-sm);
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.topbar-toggle svg {
    width: 24px;
    height: 24px;
}

.topbar-toggle:active {
    background: var(--bg);
}

.topbar-brand {
    font-family: var(--font-display);
    font-size: 1.05rem;
    color: var(--navy);
}

/* ===================================================
   Sidebar deslizable
   =================================================== */

.app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 260px;
    max-width: 82vw;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 300;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    overflow-y: auto;
}

.app-sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.sidebar-brand {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--navy);
}

.sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--muted);
    border-radius: var(--radius-sm);
    -webkit-tap-highlight-color: transparent;
}

.sidebar-close:active {
    background: var(--bg);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 2px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 8px;
    border-top: 1px solid var(--line);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 12, 0.7);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 250;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.nav-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border: none;
    background: none;
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    border-radius: var(--radius-sm);
    transition: color .15s ease, background .15s ease;
    min-height: 44px;
    width: 100%;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
    flex-shrink: 0;
    color: var(--muted);
}

.nav-item.active {
    color: var(--navy);
    background: var(--paid-bg);
}

.nav-item.active svg {
    stroke-width: 2.2;
    color: var(--navy);
}

.nav-logout {
    color: var(--muted);
}

/* ===================================================
   Flash / Toast
   =================================================== */

.flash-toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
    animation: toastIn .25s ease;
    transition: opacity .3s ease, transform .3s ease;
}

.flash-success { background: var(--paid); color: #fff; }
.flash-error   { background: var(--warn); color: #fff; }
.flash-info    { background: var(--navy); color: #fff; }

.flash-hide {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===================================================
   Login
   =================================================== */

.login-wrap {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
}

.login-logo svg { width: 100%; height: 100%; }

.login-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--navy);
    margin-bottom: .25rem;
}

.login-subtitle {
    font-size: 0.78rem;
    font-family: var(--font-mono);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    margin-top: .5rem;
    box-shadow: var(--shadow-md);
    transition: background .15s ease, transform .1s ease;
    min-height: 48px;
}

.btn-login:active { background: var(--navy-dark); transform: scale(.98); }

/* ===================================================
   Formularios
   =================================================== */

.form-label {
    display: block;
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

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

.form-input {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--ink);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    -webkit-appearance: none;
}

.form-input:focus {
    border-color: var(--navy);
    box-shadow: var(--glow-navy);
}

.form-input::placeholder { color: #4C627D; }

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

.form-input-lg {
    font-size: 1.4rem;
    font-family: var(--font-mono);
    font-weight: 700;
    text-align: center;
    padding: 14px;
}

/* ===================================================
   Modales / Bottom Sheets
   =================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 36, 56, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.modal-sheet {
    background: var(--surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 560px;
    max-height: 92dvh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.show .modal-sheet {
    transform: translateY(0);
}

.modal-handle {
    width: 40px;
    height: 4px;
    background: var(--line);
    border-radius: 999px;
    margin: 12px auto 4px;
}

.modal-body {
    padding: 8px 20px 32px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--navy);
    margin-bottom: 1.2rem;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 1.25rem;
}

/* ===================================================
   Botones
   =================================================== */

.btn-primary-sm {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: 8px 16px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: var(--shadow-sm);
    transition: background .15s;
    min-height: 36px;
}

.btn-primary-sm:active { background: var(--navy-dark); }

.btn-cancel {
    flex: 1;
    padding: 13px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-weight: 600;
    font-size: .9rem;
    min-height: 48px;
}

.btn-save {
    flex: 1.4;
    padding: 13px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--navy);
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
    box-shadow: var(--shadow-sm);
    min-height: 48px;
    transition: background .15s, opacity .15s;
}

.btn-save:disabled { opacity: .5; cursor: not-allowed; }
.btn-save:active   { background: var(--navy-dark); }

.btn-danger {
    width: 100%;
    margin-top: .75rem;
    padding: 11px;
    border-radius: var(--radius-sm);
    border: 1.5px solid rgba(226, 85, 91, 0.35);
    background: var(--warn-bg);
    color: var(--warn);
    font-weight: 600;
    font-size: .82rem;
    min-height: 44px;
}

.btn-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(44, 123, 229, 0.14);
    color: var(--navy);
    border-radius: 50%;
    transition: background .15s;
}

.btn-icon svg { width: 20px; height: 20px; }
.btn-icon:active { background: rgba(44, 123, 229, 0.28); }

/* ===================================================
   Dashboard
   =================================================== */

.dashboard { padding-bottom: 1rem; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--navy);
}

.page-sub {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 1px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 1.25rem;
}

.metric-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 14px 10px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.metric-num {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
}

.metric-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    margin-top: 4px;
}

.metric-active    .metric-num { color: var(--paid); }
.metric-suspended .metric-num { color: var(--warn); }
.metric-baja      .metric-num { color: var(--muted); }

.section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.finance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.finance-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.finance-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    margin-bottom: 6px;
}

.finance-amount {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
}

.finance-amount.finance-green { color: var(--paid); }
.finance-amount.finance-navy  { color: var(--navy); }

.finance-sub {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 4px;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--navy);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
    min-height: 80px;
    justify-content: center;
    transition: border-color .15s, background .15s;
}

.quick-btn svg { width: 24px; height: 24px; stroke-width: 1.8; }
.quick-btn:active { background: var(--surface-hover); border-color: var(--navy); }

/* ===================================================
   Usuarios
   =================================================== */

.page-wrap { padding-bottom: 1rem; }

.user-list { display: flex; flex-direction: column; gap: 8px; }

.user-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.user-name {
    font-weight: 600;
    font-size: .9rem;
    color: var(--ink);
}

.user-meta {
    font-size: .75rem;
    color: var(--muted);
    margin-top: 2px;
}

.status-active   { font-size: .7rem; font-weight: 700; color: var(--paid); }
.status-inactive { font-size: .7rem; font-weight: 700; color: var(--muted); }

.user-card { flex-wrap: wrap; gap: 10px; }

.user-pending-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.user-pending-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.user-pending-form .form-input {
    padding: 6px 8px;
    font-size: .8rem;
    width: auto;
}
