:root {
    --primary: #1a73e8;
    --success: #2e7d32;
    --warning: #d97706;
    --danger: #dc2626;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --text: #333333;
    --border: #dadce0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 16px;
    padding-bottom: 80px;
}
.container { max-width: 850px; margin: 0 auto; }
header { text-align: center; margin-bottom: 20px; }
h1 { font-size: 1.5rem; color: var(--primary); margin: 0 0 4px 0; }
.subtitle { font-size: 0.9rem; color: #666; }
.tabs-container {
    display: flex;
    align-items: center;
    background: #e4e7eb;
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 20px;
}
.tabs-wrapper {
    overflow-x: auto;
    white-space: nowrap;
    flex-grow: 1;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.tabs-wrapper::-webkit-scrollbar { height: 4px; }
.tabs-wrapper::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.tabs { display: inline-flex; gap: 6px; min-width: 100%; }
.tab-btn {
    padding: 10px 14px;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    border-radius: 8px;
    text-align: center;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
@media (min-width: 768px) {
    .tabs { justify-content: space-between; width: 100%; }
    .tab-btn { flex-grow: 1; padding: 10px 4px; font-size: 0.8rem; }
}
.tab-content { display: none; }
.tab-content.active { display: block; }
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
}
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
select, textarea, input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
    margin-bottom: 12px;
    background: #fff;
}
textarea { height: 80px; resize: vertical; }
.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    width: 100%;
    cursor: pointer;
}
.btn:active { opacity: 0.85; }
.btn-success { background: var(--success); margin-top: 8px; }
.btn-secondary { background: #64748b; margin-bottom: 15px; }
.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 6px;
    border-radius: 4px;
}
.btn-icon:hover { background: #e4e7eb; }
.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    color: white;
}
.entry-list { margin-top: 10px; }

/* HORARIO */
.horario-scroll {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
}
.table-horario {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    text-align: center;
    background: white;
    min-width: 650px;
}
.table-horario th {
    background: #f1f5f9;
    padding: 8px 4px;
    border: 1px solid var(--border);
    font-weight: bold;
    color: #334155;
    white-space: nowrap;
}
.table-horario td {
    padding: 7px 3px;
    border: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}
.cell-recreo { background-color: #cbd5e1 !important; font-weight: bold; color: #334155; }
.cell-guardia { background-color: #e0f2fe; font-weight: bold; color: #0284c7; }
.cell-tutoria { background-color: #fef08a; font-weight: bold; color: #854d0e; }
.cell-ap { color: #65a30d; font-style: italic; font-weight: 600; }
.horario-grupo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

/* LISTADOS TRADICIONALES CON SCROLL */
.student-row { background: white; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--border); margin-bottom: 6px; font-size: 0.9rem; }
.student-row.clickable { cursor: pointer; transition: background 0.2s; }
.student-row.clickable:hover { background: #f8f9fa; }
.student-header-line { display: flex; justify-content: space-between; align-items: center; }
.student-obs { font-size: 0.8rem; color: var(--danger); font-weight: 600; background: #fef2f2; padding: 6px 10px; border-radius: 4px; margin-top: 8px; border-left: 3px solid var(--danger); }
.student-convalidacion { font-size: 0.8rem; color: var(--success); font-weight: 600; background: #f0fdf4; padding: 6px 10px; border-radius: 4px; margin-top: 8px; border-left: 3px solid var(--success); display: flex; align-items: center; gap: 6px; }

/* FOTO DEL ALUMNO DESPLEGABLE */
.student-card-expanded {
    display: flex;
    gap: 14px;
    align-items: center;
    background: #f1f3f4;
    padding: 10px;
    border-radius: 8px;
    margin-top: 8px;
}
.student-photo-slot {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #cbd5e1;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.student-photo-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* UDS Y SEGUIMIENTO */
.ud-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}
.ud-title-bar {
    background: #f8f9fa;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--primary);
}
.ud-main-info { cursor: pointer; flex-grow: 1; user-select: none; }
.ud-name { font-size: 1.05rem; font-weight: 700; color: var(--primary); display: block; margin-bottom: 2px; }
.ud-meta { font-size: 0.8rem; color: #666; }
.ud-actions { display: flex; align-items: center; gap: 2px; }
.ud-body { display: none; padding: 14px; border-top: 1px solid var(--border); background: #fafafa; }
.ud-body.open { display: block; }
.sesion-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 10px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 0.85rem;
    border-left: 3px solid var(--success);
}
.sesion-header { font-weight: bold; color: var(--success); display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.grid-grupos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 15px; }
.grid-grupos button { background: #f1f5f9; border: 1px solid #cbd5e1; padding: 14px; border-radius: 8px; font-size: 1rem; font-weight: bold; color: #334155; cursor: pointer; transition: all 0.2s; }
.grid-grupos button:hover { background: var(--primary); color: white; border-color: var(--primary); }
.grid-uds { display: flex; flex-direction: column; gap: 10px; margin-bottom: 15px; }
.grid-uds button { background: #f8fafc; border: 1px solid #94a3b8; border-left: 4px solid var(--primary); padding: 12px; border-radius: 6px; font-size: 1rem; font-weight: bold; color: #1e293b; text-align: left; cursor: pointer; }

.tabla-comparativa { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: white; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.tabla-comparativa th { background: #f1f5f9; padding: 12px; border: 1px solid var(--border); text-align: left; color: #334155; }
.tabla-comparativa td { padding: 12px; border: 1px solid var(--border); vertical-align: top; color: #475569; }
.badge-fecha { display: inline-flex; align-items: center; font-size: 0.75rem; background: #dcfce7; color: #166534; padding: 3px 6px; border-radius: 4px; margin-bottom: 6px; font-weight: bold; }

.progreso-curso-title { font-size: 1.05rem; color: #334155; border-bottom: 2px solid #e2e8f0; padding-bottom: 5px; margin-bottom: 12px; font-weight: bold; }
.progreso-grupo { margin-bottom: 12px; background: #f8fafc; padding: 10px; border-radius: 8px; border: 1px solid #e2e8f0; }
.progreso-grupo-name { font-size: 0.9rem; font-weight: bold; color: #475569; margin-bottom: 8px; }
.progreso-bar-container { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.progreso-ud-name { font-size: 0.8rem; color: #64748b; width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; font-weight: 600; }
.progreso-track { flex-grow: 1; background: #cbd5e1; height: 14px; border-radius: 8px; overflow: hidden; position: relative; }
.progreso-fill { background: var(--primary); height: 100%; border-radius: 8px; transition: width 0.4s ease; }
.progreso-fill.completado { background: var(--success); }
.progreso-text { font-size: 0.75rem; font-weight: bold; color: #475569; width: 35px; text-align: right; flex-shrink: 0; }

.mic-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 15px 20px;
    font-size: 1.1rem;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
    cursor: pointer;
    z-index: 1000;
}