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

:root {
    --verde:        #1a4731;
    --verde-medio:  #2d6a4f;
    --verde-suave:  #d8f3dc;
    --blanco:       #ffffff;
    --fondo:        #f4f7f5;
    --borde:        #e2e8e5;
    --texto:        #1f2937;
    --texto-suave:  #6b7280;
    --radio:        16px;
    --sombra:       0 1px 4px rgba(0,0,0,0.07);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--fondo);
    color: var(--texto);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Splash ────────────────────────────────────────────── */
.splash {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--verde);
    gap: 36px;
}

.splash-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.logo-mark {
    width: 72px;
    height: 72px;
    background: white;
    color: var(--verde);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -1px;
}

.logo-text {
    color: rgba(255,255,255,0.9);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.4px;
}

.splash-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255,255,255,0.25);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Header ────────────────────────────────────────────── */
.header {
    background: var(--verde);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-brand {
    color: rgba(255,255,255,0.9);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.avatar {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.18);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    border: 1.5px solid rgba(255,255,255,0.3);
}

/* ── Main ──────────────────────────────────────────────── */
.main {
    padding: 24px 16px 120px;
    max-width: 500px;
    margin: 0 auto;
}

/* ── Saludo ────────────────────────────────────────────── */
.greeting {
    margin-bottom: 22px;
}

.greeting-name {
    font-size: 28px;
    font-weight: 800;
    color: var(--texto);
    margin-bottom: 5px;
    line-height: 1.2;
}

.greeting-sub {
    font-size: 14px;
    color: var(--texto-suave);
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
    background: var(--blanco);
    border-radius: var(--radio);
    padding: 22px;
    margin-bottom: 14px;
    box-shadow: var(--sombra);
}

/* ── Card Fase ─────────────────────────────────────────── */
.fase-badge {
    display: inline-block;
    padding: 4px 13px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 14px;
    letter-spacing: 0.3px;
}

.fase-nombre {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 10px;
    line-height: 1.2;
    color: var(--texto);
}

.fase-descripcion {
    font-size: 14px;
    color: var(--texto-suave);
    line-height: 1.65;
    margin-bottom: 22px;
}

/* Progress steps */
.progress-track {
    display: flex;
    gap: 6px;
}

.progress-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
}

.step-dot {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--borde);
    transition: background 0.3s;
}

.progress-step.done .step-dot   { background: var(--verde-medio); }
.progress-step.active .step-dot { background: var(--verde); }

.step-label {
    font-size: 10px;
    color: var(--texto-suave);
    text-align: center;
    line-height: 1.2;
}

.progress-step.done .step-label,
.progress-step.active .step-label {
    color: var(--verde);
    font-weight: 700;
}

/* ── Card Días ─────────────────────────────────────────── */
.card-dias {
    display: flex;
    align-items: center;
    gap: 18px;
}

.dias-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.dias-body {
    flex: 1;
}

.dias-numero {
    font-size: 42px;
    font-weight: 900;
    color: var(--verde);
    line-height: 1;
    letter-spacing: -1px;
}

.dias-label {
    font-size: 13px;
    color: var(--texto-suave);
    margin-top: 3px;
}

.dias-fecha {
    font-size: 12px;
    color: var(--texto-suave);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--borde);
}

/* ── Card Contacto ─────────────────────────────────────── */
.card-contacto {
    text-align: center;
}

.contacto-texto {
    font-size: 14px;
    color: var(--texto-suave);
    margin-bottom: 14px;
    line-height: 1.5;
}

.btn-contacto {
    display: block;
    background: var(--verde);
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    transition: background 0.15s;
}

.btn-contacto:active { background: var(--verde-medio); }

/* ── Banner instalar ───────────────────────────────────── */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--verde);
    color: white;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
}

.install-banner span { flex: 1; font-size: 14px; font-weight: 500; }

.install-banner .btn-instalar {
    background: white;
    color: var(--verde);
    border: none;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.install-banner .btn-cerrar-banner {
    background: transparent;
    color: rgba(255,255,255,0.7);
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

/* ── Navegación inferior ───────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: white;
    border-top: 1px solid var(--borde);
    display: flex;
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--texto-suave);
    transition: color 0.15s;
}

.nav-btn.active { color: var(--verde); }
.nav-icon { font-size: 22px; line-height: 1; }
.nav-label { font-size: 11px; font-weight: 600; }

/* ── Tab Tracking ──────────────────────────────────────────── */
.tracking-header { margin-bottom: 16px; }

.tracking-titulo {
    font-size: 24px;
    font-weight: 800;
    color: var(--texto);
    margin-bottom: 3px;
}

.tracking-fecha {
    font-size: 14px;
    color: var(--texto-suave);
    text-transform: capitalize;
}

.tracking-card { margin-bottom: 14px; }

.section-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--verde);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

.tracking-momento { margin-bottom: 14px; }
.tracking-momento:last-child { margin-bottom: 0; }

.momento-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--texto-suave);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--borde);
}

.check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    cursor: pointer;
    border-bottom: 1px solid var(--fondo);
}

.check-item:last-child { border-bottom: none; }
.check-item input[type="checkbox"] { display: none; }

.check-box {
    width: 22px; height: 22px;
    border: 2px solid var(--borde);
    border-radius: 6px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}

.check-item input:checked ~ .check-box {
    background: var(--verde);
    border-color: var(--verde);
}

.check-item input:checked ~ .check-box::after {
    content: '✓';
    color: white;
    font-size: 13px;
    font-weight: 700;
}

.check-info { display: flex; flex-direction: column; gap: 2px; }
.check-nombre { font-size: 15px; font-weight: 600; color: var(--texto); }
.check-dosis  { font-size: 12px; color: var(--texto-suave); }

.sintomas-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.check-sintoma { padding: 9px 0; }
.check-sintoma .check-nombre { font-size: 14px; font-weight: 500; }

.bienestar-row { display: flex; gap: 6px; }

.bienstar-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    background: var(--fondo);
    border: 2px solid var(--borde);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.bienstar-btn.active {
    background: var(--verde-suave);
    border-color: var(--verde);
}

.bw-num { font-size: 18px; font-weight: 800; color: var(--texto); }
.bw-label { font-size: 9px; color: var(--texto-suave); text-align: center; line-height: 1.2; }
.bienstar-btn.active .bw-num,
.bienstar-btn.active .bw-label { color: var(--verde); }

.nota-textarea {
    width: 100%;
    min-height: 90px;
    padding: 12px;
    border: 1px solid var(--borde);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--texto);
    resize: vertical;
    background: var(--fondo);
}

.nota-textarea:focus { outline: none; border-color: var(--verde); background: white; }

.btn-guardar {
    width: 100%;
    background: var(--verde);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background 0.15s;
}

.btn-guardar:disabled { background: var(--texto-suave); cursor: not-allowed; }
.btn-guardar:active:not(:disabled) { background: var(--verde-medio); }

.msg-guardado {
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
}

.msg-ok    { background: var(--verde-suave); color: var(--verde); }
.msg-error { background: #fee2e2; color: #b91c1c; }

.loading-inline {
    display: flex; align-items: center; gap: 8px;
    padding: 24px; color: var(--texto-suave); font-size: 14px;
}

.spinner-sm {
    width: 18px; height: 18px;
    border: 2px solid var(--borde);
    border-top-color: var(--verde);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.error-inline { padding: 20px; color: #b91c1c; font-size: 14px; }
.tracking-empty { font-size: 13px; color: var(--texto-suave); padding: 8px 0; }

/* ── Pantalla de error ─────────────────────────────────── */
.error-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 28px;
    text-align: center;
}

.error-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 48px;
}

.error-logo .logo-mark {
    background: var(--verde);
    color: white;
}

.error-logo .logo-text {
    color: var(--texto);
    font-size: 16px;
    font-weight: 600;
}

.error-icon { font-size: 52px; margin-bottom: 20px; }

.error-msg {
    font-size: 17px;
    font-weight: 600;
    color: var(--texto);
    margin-bottom: 10px;
    line-height: 1.4;
}

.error-sub {
    font-size: 14px;
    color: var(--texto-suave);
    line-height: 1.5;
}
