/* =========================================================
   REVOLT — Portal de residentes
   Móvil primero. Paleta continua con PleAPP para que el
   residente reconozca el producto en web y en app.
   Los tokens se pueden sobrescribir por residencial (white-label).
   ========================================================= */

:root {
    --rv-nav: #0F4C81;
    --rv-nav-ink: #FFFFFF;
    --rv-bg: #E4EBF3;
    --rv-surface: #FFFFFF;
    --rv-ink: #132A3E;
    --rv-muted: #55697D;
    --rv-line: #C9D6E3;
    --rv-accent: #29B6F6;
    --rv-danger: #C62828;
    --rv-danger-bg: #FDECEA;

    --rv-radius: 12px;
    --rv-radius-lg: 18px;
    --rv-tabs-h: 64px;
    --rv-font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--rv-bg);
    color: var(--rv-ink);
    font-family: var(--rv-font);
    font-size: 17px;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

:focus-visible { outline: 3px solid var(--rv-accent); outline-offset: 2px; }
h1:focus { outline: none; }

/* ---------- Estructura ---------- */

.rv-shell { min-height: 100dvh; display: flex; flex-direction: column; }

.rv-top {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
    background: var(--rv-nav); color: var(--rv-nav-ink);
}
.rv-top__community {
    font-weight: 700; font-size: 1.05rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rv-top__out {
    flex: none; min-height: 36px; padding: 6px 14px;
    background: transparent; color: inherit;
    border: 1px solid rgba(255, 255, 255, .45); border-radius: 999px;
    font: inherit; font-size: .9rem; cursor: pointer;
}

.rv-main {
    flex: 1; width: 100%; max-width: 640px; margin: 0 auto;
    padding: 20px 16px calc(var(--rv-tabs-h) + env(safe-area-inset-bottom, 0px) + 24px);
}

.rv-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: var(--rv-surface); border-top: 1px solid var(--rv-line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.rv-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    height: var(--rv-tabs-h);
    color: var(--rv-muted); text-decoration: none; font-size: .78rem;
}
.rv-tab i { font-size: 1.25rem; }
.rv-tab.active { color: var(--rv-nav); font-weight: 700; }

/* ---------- Tipografía de página ---------- */

.rv-title { font-size: 1.5rem; line-height: 1.2; margin: 4px 0 16px; }

.rv-greeting { margin: 4px 0 20px; }
.rv-greeting h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; }
.rv-greeting p { margin: 4px 0 0; color: var(--rv-muted); }

.rv-link { color: var(--rv-nav); font-weight: 700; }

/* ---------- Acción principal: el pase ---------- */

.rv-primary {
    display: flex; align-items: center; gap: 16px;
    width: 100%; padding: 22px 20px;
    background: var(--rv-nav); color: #FFFFFF;
    border-radius: var(--rv-radius-lg); text-decoration: none;
}
.rv-primary:active { transform: scale(.99); }
.rv-primary__icon {
    flex: none; display: grid; place-items: center;
    width: 56px; height: 56px; border-radius: 14px;
    background: var(--rv-accent); color: var(--rv-nav); font-size: 1.6rem;
}
.rv-primary__text strong { display: block; font-size: 1.2rem; }
.rv-primary__text span { display: block; font-size: .95rem; opacity: .85; }

/* ---------- Lista de accesos ---------- */

.rv-list {
    margin: 24px 0 0; padding: 0; list-style: none;
    background: var(--rv-surface); border-radius: var(--rv-radius); overflow: hidden;
}
.rv-list li + li { border-top: 1px solid var(--rv-line); }
.rv-list a {
    display: flex; align-items: center; gap: 14px;
    min-height: 60px; padding: 16px;
    color: var(--rv-ink); text-decoration: none;
}
.rv-list a > span { flex: 1; }
.rv-list a > i:first-child { width: 24px; text-align: center; color: var(--rv-nav); font-size: 1.15rem; }
.rv-list a > i:last-child { color: var(--rv-muted); font-size: .85rem; }

/* ---------- Login / pantallas sin navegación ---------- */

.rv-login {
    min-height: 100dvh;
    display: flex; flex-direction: column; justify-content: center;
    padding: calc(env(safe-area-inset-top, 0px) + 32px) 20px 32px;
    background: var(--rv-nav); color: #FFFFFF;
}
.rv-login__panel { width: 100%; max-width: 400px; margin: 0 auto; }
.rv-login__brand { font-size: 2rem; line-height: 1.1; margin: 0 0 8px; letter-spacing: .02em; }
.rv-login__lead { margin: 0 0 28px; opacity: .85; }
.rv-login .validation-message { margin: -10px 0 14px; color: #FFD7D2; font-size: .9rem; }

/* ---------- Formularios ---------- */

.rv-field { display: block; margin-bottom: 16px; }
.rv-field > span { display: block; margin-bottom: 6px; font-size: .95rem; }
.rv-field input,
.rv-field select,
.rv-field textarea {
    width: 100%; min-height: 52px; padding: 12px 14px;
    background: #FFFFFF; color: var(--rv-ink);
    border: 2px solid var(--rv-line); border-radius: var(--rv-radius);
    font: inherit;
}
.rv-field input:focus,
.rv-field select:focus,
.rv-field textarea:focus { border-color: var(--rv-accent); outline: none; }

.rv-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 52px; padding: 12px 18px;
    border: 0; border-radius: var(--rv-radius);
    font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.rv-btn--accent { background: var(--rv-accent); color: var(--rv-nav); }
.rv-btn--primary { background: var(--rv-nav); color: #FFFFFF; }
.rv-btn[disabled] { opacity: .6; cursor: default; }

/* ---------- Estados ---------- */

.rv-error {
    margin: 0 0 16px; padding: 12px 14px;
    background: var(--rv-danger-bg); color: var(--rv-danger);
    border-radius: var(--rv-radius);
}
.rv-empty { padding: 48px 16px; text-align: center; color: var(--rv-muted); }
.rv-empty i { display: block; margin-bottom: 12px; font-size: 2rem; color: var(--rv-nav); }
.rv-loading { padding: 48px 16px; text-align: center; color: var(--rv-muted); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
    .rv-primary:active { transform: none; }
}
