:root {
    --bg: #FBF7EF;
    --surface: #FFFFFF;
    --surface-soft: #F3EEE0;
    --ink: #23303A;
    --ink-muted: #6B7680;
    --border: #E4DDC9;

    --azul: #2E5266;
    --azul-suave: #E3ECEF;
    --coral: #C96E4E;
    --coral-suave: #FBEAE2;
    --verde: #4C7A5D;
    --verde-suave: #E7F0E9;
    --rojo: #B5432F;
    --rojo-suave: #F8E6E1;

    --radius: 12px;
    --radius-lg: 18px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 600; margin: 0; }
p { margin: 0; }

.contenedor {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 16px 32px;
    min-height: 100vh;
}

@media (min-width: 900px) {
    .contenedor {
        max-width: 900px;
        padding: 32px 32px 60px;
    }
}

/* --- Header unificado --- */
.header-app {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0 14px;
    margin-bottom: 4px;
}
.header-app .logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.header-app .marca {
    font-size: 15px;
    font-weight: 600;
    color: var(--azul);
    line-height: 1.25;
}
.header-app .subtitulo {
    font-size: 13px;
    color: var(--ink-muted);
    margin-top: 3px;
}
.header-app .subtitulo a {
    color: var(--rojo);
    font-weight: 600;
    text-decoration: none;
}

/* --- Navegación por pestañas (unificada, usada arriba en todas las páginas) --- */
.nav-principal {
    display: flex;
    gap: 4px;
    background: var(--surface-soft);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 18px;
}
.nav-principal a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-muted);
    text-decoration: none;
    padding: 9px 0;
    border-radius: 9px;
    transition: background 0.15s, color 0.15s;
}
.nav-principal a i { font-size: 16px; }
.nav-principal a.activo {
    background: var(--surface);
    color: var(--azul);
    box-shadow: 0 1px 2px rgba(35,48,58,0.08);
}

@media (min-width: 900px) {
    .header-app { margin-bottom: 8px; }
    .header-app .marca { font-size: 17px; }
    .nav-principal { max-width: 420px; margin-bottom: 28px; }
}

/* --- Tabs inferior (solo mobile, accesos rápidos fijos) --- */
.tabbar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    padding: 6px 0 10px;
    z-index: 20;
}
.tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    color: var(--ink-muted);
    text-decoration: none;
    padding: 6px 0;
}
.tabbar a.activo { color: var(--azul); font-weight: 600; }
.tabbar i { font-size: 20px; }

@media (min-width: 900px) {
    .tabbar { display: none; }
}

/* --- Cards --- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.card + .card { margin-top: 10px; }

/* --- Calendario --- */
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.cal-header button {
    background: none;
    border: none;
    color: var(--ink-muted);
    font-size: 20px;
    cursor: pointer;
}
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cal-dia-nombre {
    text-align: center;
    font-size: 11px;
    color: var(--ink-muted);
    padding-bottom: 6px;
}
.cal-celda {
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    position: relative;
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--ink);
    transition: background 0.12s;
}
.cal-celda:hover { background: var(--surface-soft); }
.cal-celda.hoy { border: 1.5px solid var(--azul); }
.cal-celda.con-clases { background: var(--azul-suave); font-weight: 600; color: var(--azul); }
.cal-celda.con-clases:hover { background: var(--azul-suave); filter: brightness(0.97); }
.cal-celda.con-clases.solo-eventual { background: var(--coral-suave); color: var(--coral); }
.cal-celda.seleccionado { background: var(--azul); color: #fff; font-weight: 600; }
.cal-celda.seleccionado:hover { background: var(--azul); }
.cal-celda .contador-dia {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    border-radius: 7px;
    background: var(--azul);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.cal-celda.solo-eventual .contador-dia { background: var(--coral); }
.cal-celda.seleccionado .contador-dia { background: #fff; color: var(--azul); }

.leyenda { display: flex; gap: 14px; font-size: 12px; color: var(--ink-muted); padding: 10px 2px 0; }
.leyenda span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.fija { background: var(--azul); }
.dot.eventual { background: var(--coral); }

/* --- Fila de clase --- */
.clase-fila {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
}
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    background: var(--azul-suave);
    color: var(--azul);
}
.avatar.eventual { background: var(--coral-suave); color: var(--coral); }
.clase-info { flex: 1; min-width: 0; }
.clase-info .nombre { font-weight: 600; font-size: 14px; }
.clase-info .detalle { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.badge {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
}
.badge.fija { background: var(--azul-suave); color: var(--azul); }
.badge.eventual { background: var(--coral-suave); color: var(--coral); }

/* --- Semáforo contable --- */
.badge.al-dia { background: var(--verde-suave); color: var(--verde); }
.badge.debe { background: var(--rojo-suave); color: var(--rojo); }
.badge.pausado { background: var(--surface-soft); color: var(--ink-muted); }

/* --- Botones --- */
.btn-primario {
    width: 100%;
    background: var(--azul);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    height: 46px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn-secundario {
    width: 100%;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    height: 46px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* --- Formularios --- */
label { font-size: 13px; color: var(--ink-muted); display: block; margin-bottom: 4px; }
input, select, textarea {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    margin-bottom: 14px;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--azul);
}

/* --- Utilidades --- */
.text-muted { color: var(--ink-muted); font-size: 13px; }
.fecha-titulo { font-size: 13px; font-weight: 600; color: var(--ink-muted); margin: 18px 0 10px; }
