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

:root {
    --navy:          #0D4A77;
    --navy-light:    #1A6499;
    --navy-dark:     #092F4D;
    --ink:           #1C2B36;
    --muted:         #6B8FA8;
    --line:          #D0DDE8;
    --bg:            #DFE9F0;
    --surface:       #FFFFFF;
    --paid:          #2F9E63;
    --paid-bg:       rgba(47, 158, 99, 0.09);
    --warn:          #D95B2A;
    --warn-bg:       #FDF1EC;
    --suspended:     #9B3B3B;
    --suspended-bg:  #FDF0F0;
    --shadow-sm:     0 2px 8px -4px rgba(13, 74, 119, 0.18);
    --shadow-md:     0 4px 16px -6px rgba(13, 74, 119, 0.28);
    --shadow-lg:     0 10px 32px -8px rgba(13, 74, 119, 0.35);
    --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;
}

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

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

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    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; }

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

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

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

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

/* ===================================================
   Navegación inferior
   =================================================== */

.app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px -8px rgba(13, 74, 119, 0.18);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 16px;
    border: none;
    background: none;
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    transition: color .15s ease;
    min-height: 44px;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.nav-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
}

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

.nav-item.active svg {
    stroke-width: 2.2;
}

.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: #fff;
    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: 0 0 0 3px rgba(13, 74, 119, 0.1);
}

.form-input::placeholder { color: #B4C8D6; }

.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;
    pointer-events: none;
    transition: opacity .25s ease;
}

.modal-overlay.show {
    opacity: 1;
    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;
    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 #F3C9BA;
    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(13, 74, 119, 0.08);
    color: var(--navy);
    border-radius: 50%;
    transition: background .15s;
}

.btn-icon svg { width: 20px; height: 20px; }
.btn-icon:active { background: rgba(13, 74, 119, 0.16); }

/* ===================================================
   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;
}

.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: #f0f5f9; 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); }
