:root {
    --primary: #2f8f6e;
    --primary-dark: #24735a;
    --bg: #fbf8f2;
    --card: #ffffff;
    --text: #2b2b2b;
    --muted: #6b7280;
    --danger: #dc2626;
    --success: #16a34a;
    --border: #e7e2d6;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 17px;
    line-height: 1.5;
}

.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary);
    text-decoration: none;
}
nav a {
    margin-left: 16px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.95rem;
}
nav a:hover { color: var(--primary); }
.hello { margin-left: 16px; color: var(--muted); font-size: 0.9rem; }

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
    flex: 1;
    width: 100%;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}

.form-narrow {
    max-width: 400px;
    margin: 0 auto;
}

h1 { font-size: 1.6rem; margin-top: 0; }
h2 { font-size: 1.25rem; }

label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

input[type=text], input[type=email], input[type=password], textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    margin-bottom: 16px;
    font-family: inherit;
}
textarea { min-height: 150px; resize: vertical; }

button, .btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
}
button:hover, .btn:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: var(--muted); }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 0.9rem;
}
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }

.muted { color: var(--muted); font-size: 0.9rem; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
}
th, td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
th { background: #f9fafb; font-weight: 600; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-admin { background: #ede9fe; color: #6d28d9; }
.badge-user { background: #e0f2fe; color: #0369a1; }
.badge-published { background: #dcfce7; color: #166534; }
.badge-draft { background: #fef9c3; color: #854d0e; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-blocked { background: #fee2e2; color: #991b1b; }

.actions a, .actions button { margin-right: 8px; }

.top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-tabs { margin-bottom: 24px; }
.admin-tabs a {
    margin-right: 20px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    padding-bottom: 6px;
}
.admin-tabs a.active { color: var(--primary); border-bottom: 2px solid var(--primary); }

.footer {
    text-align: center;
    padding: 20px;
    color: var(--muted);
    font-size: 0.85rem;
}

/* Accesos rápidos del inicio */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}
.quick-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 16px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.quick-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    border-color: var(--primary);
}
.quick-icon { font-size: 2.2rem; }
.quick-label { font-weight: 600; font-size: 1rem; }

@media (max-width: 700px) {
    .quick-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Navegación de fecha (asistencia / planificación) */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Línea de tiempo de actividades planificadas */
.timeline {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.timeline-item {
    display: flex;
    gap: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    background: #fdfcf9;
}
.timeline-hour {
    flex: 0 0 110px;
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 0.95rem;
}
.timeline-content h3 { margin: 0 0 6px 0; font-size: 1.05rem; }
.timeline-content p { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* Calendario mensual */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.calendar-head {
    text-align: center;
    font-weight: 700;
    color: var(--muted);
    font-size: 0.8rem;
    padding-bottom: 6px;
}
.calendar-cell {
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.8rem;
    min-height: 64px;
}
.calendar-cell:hover { border-color: var(--primary); }
.calendar-cell.empty { border: none; }
.calendar-cell.is-today { border-color: var(--primary); background: #eef8f3; }
.calendar-daynum { font-weight: 700; }
.calendar-badge {
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    padding: 2px 6px;
    font-size: 0.65rem;
    align-self: flex-start;
}

@media (max-width: 700px) {
    .calendar-cell { font-size: 0.7rem; min-height: 48px; }
    .calendar-badge { font-size: 0.55rem; }
}

/* Ficha de alumno */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 800px) {
    .summary-grid, .two-col { grid-template-columns: 1fr; }
}

.log-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #fdfcf9;
}
.log-date { font-weight: 700; font-size: 0.8rem; color: var(--primary-dark); margin-bottom: 4px; }
.log-text { font-size: 0.92rem; margin-bottom: 8px; }
.log-item form { display: inline; }

/* Impresión */
.print-sheet { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-top: 20px; }
.print-day { margin-bottom: 22px; }
.print-day h3 { margin-bottom: 6px; text-transform: capitalize; }
.print-title { margin-top: 0; }

@media print {
    .topbar, .footer, .no-print { display: none !important; }
    .container { padding: 0; max-width: 100%; }
    .print-sheet { border: none; padding: 0; }
    body { background: #fff; font-size: 13px; }
}

/* Ficha de alumno / notas */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
@media (max-width: 800px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.inline-form textarea { min-height: 80px; }

.average-box {
    background: #eef8f3;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 18px;
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.average-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.stat-box {
    background: #fdfcf9;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}
.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.obs-list { display: flex; flex-direction: column; gap: 12px; }
.obs-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    background: #fdfcf9;
}

.week-day {
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.week-day:last-child { border-bottom: none; }
.week-day h3 { margin: 0 0 10px 0; color: var(--primary-dark); }

/* Impresión */
@media print {
    .topbar, .footer, .no-print, form button, .actions { display: none !important; }
    body { background: #fff; }
    .card, .print-card { border: none; box-shadow: none; padding: 0; }
    .container { padding: 0; max-width: 100%; }
}
/* ===== Logo y marca ===== */

.brand{
    display:flex;
    align-items:center;
    gap:12px;
    text-decoration:none;
    color:var(--primary);
    font-weight:700;
    font-size:1.3rem;
}

.brand img,
.header-logo{
    width:42px !important;
    height:42px !important;
    min-width:42px;
    min-height:42px;
    max-width:42px;
    max-height:42px;
    object-fit:contain;
    display:block;
    flex-shrink:0;
}

.brand span{
    color:var(--primary);
    font-size:1.3rem;
    font-weight:700;
}

.hero-logo{
    width:150px;
    height:auto;
    display:block;
    margin:0 auto 20px;
}