/* ═══════════════════════════════════════════════════════════════
   StudyDash — tema "Moodle" (imitación del Boost/Junta de Andalucía)
   Claro · navy + azul Moodle · Roboto · componentes tipo Bootstrap.
   Reescrito 2026-09-21. Mismos nombres de clase (JS intacto).
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
  --font: 'Roboto', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-display: var(--font);
  --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --page: #ebedf0;        /* fondo de página (gris claro Moodle) */
  --surface: #ffffff;     /* contenido / cards */
  --surface-2: #f8f9fa;   /* cajas gris claro / celdas etiqueta */
  --line: #dee2e6;        /* borde Bootstrap */
  --line-soft: #e9ecef;

  --ink: #1d2125;         /* texto principal */
  --muted: #6c757d;       /* secundario (gris Bootstrap) */
  --faint: #929aa3;

  --navy: #16284a;        /* navy (activo, cabeceras, footer) */
  --navy-2: #1f3a63;
  --brand: #0f6cbf;       /* azul Moodle (enlaces, primario) */
  --brand-dark: #0a4f8f;
  --brand-soft: #e7f1fb;  /* tinte azul claro */

  --ok: #1e7e34;   --ok-bg: #e6f4ea;   --ok-line: #b7dfc0;
  --warn: #8a6d3b; --warn-bg: #fcf3e3; --warn-line: #f0e0bf;
  --danger: #b02a37; --danger-bg: #fbe7e9; --danger-line: #f1c4c9;
  --info: #0f6cbf; --info-bg: #e7f1fb;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 2px 6px rgba(20,40,80,.08);
  --shadow-md: 0 4px 14px rgba(20,40,80,.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font); color: var(--ink); line-height: 1.5; background: var(--page); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
a { text-decoration: none; color: var(--brand); }
a:hover { text-decoration: underline; }
::selection { background: rgba(15,108,191,.2); }

/* ── Login (Moodle-like) ──────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(160deg, var(--navy), #0e1c36); }
.login-card { background: var(--surface); border-radius: 10px; padding: 2.5rem 2rem; width: 100%; max-width: 370px; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo .logo-icon { font-size: 2.5rem; }
.login-logo h1 { font-size: 1.6rem; font-weight: 700; color: var(--navy); margin-top: .3rem; }
.login-logo p { color: var(--muted); font-size: .9rem; }
.error-msg { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-line); border-radius: 6px; padding: .6rem .8rem; font-size: .85rem; margin-bottom: .8rem; }
.btn-full { width: 100%; }

/* ── App layout ───────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* ── Sidebar (como el índice de curso de Moodle) ──────────── */
.sidebar { width: 240px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line);
  color: var(--ink); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar-header { padding: 1.15rem 1.2rem .8rem; border-bottom: 1px solid var(--line-soft); }
.sidebar-logo { display: block; font-size: 1.25rem; font-weight: 700; color: var(--navy); }
.sidebar-sub { font-size: .72rem; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-top: .1rem; }
.sidebar-search { padding: .7rem .9rem .3rem; }
.sidebar-search input { width: 100%; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); border-radius: 20px; padding: .5rem .85rem; font-size: .82rem; font-family: inherit; }
.sidebar-search input::placeholder { color: var(--faint); }
.sidebar-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(15,108,191,.2); }
.nav-list { list-style: none; padding: .5rem .55rem 1rem; flex: 1; overflow-y: auto; }
/* Cabecera de sección tipo "⌄ General" (índice de curso de Moodle) */
.nav-section { display: flex; align-items: center; gap: .45rem; font-size: .92rem; font-weight: 600; color: var(--navy); padding: .85rem .55rem .3rem; }
.nav-section::before { content: '⌄'; color: var(--muted); font-size: .85rem; line-height: 1; }
.nav-section:first-child { padding-top: .25rem; }
/* Ítems: sin icono, indentados bajo la sección, activo en rectángulo navy */
.nav-link { display: flex; align-items: center; padding: .5rem .7rem .5rem 1.55rem; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 400; color: #3d4a5c; cursor: pointer; margin-bottom: 1px; transition: background .12s, color .12s; }
.nav-link:hover { background: var(--surface-2); color: var(--navy); text-decoration: none; }
.nav-link.active { background: var(--navy); color: #fff; font-weight: 500; }
.nav-icon { display: none; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: .66rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 .35rem; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-footer { padding: .8rem 1.1rem; border-top: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; }
.sidebar-username { font-size: .78rem; color: var(--muted); }
.btn-logout { background: none; border: 1px solid var(--line); color: var(--muted); padding: .3rem .7rem; border-radius: 4px; font-size: .78rem; cursor: pointer; font-family: inherit; transition: all .12s; }
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

/* ── Main content ─────────────────────────────────────────── */
.main-content { margin-left: 240px; flex: 1; padding: 1.6rem 1.9rem; max-width: 1160px; }

/* ── View header ──────────────────────────────────────────── */
.view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.3rem; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.view-title { font-size: 1.7rem; font-weight: 500; color: var(--navy); }
.view-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Breadcrumbs (pastillas Moodle) */
.breadcrumbs { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; font-size: .8rem; margin-bottom: .8rem; }
.breadcrumbs .crumb { background: var(--brand-soft); color: var(--navy-2); padding: .18rem .7rem; border-radius: 20px; font-weight: 500; }
.breadcrumbs .crumb.active { background: var(--navy); color: #fff; }
.breadcrumbs .sep { color: var(--faint); }

/* ── Cards ────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem; }
.card-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.stat-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); margin-bottom: 1.4rem; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.stat-value { font-size: 2.1rem; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-label { font-size: .78rem; color: var(--muted); margin-top: .35rem; }

/* ── Buttons (Bootstrap-like) ─────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem 1rem; border-radius: var(--radius-sm); font-size: .87rem; font-weight: 400; cursor: pointer; border: 1px solid transparent; font-family: inherit; transition: background .12s, border-color .12s, box-shadow .12s; line-height: 1.5; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 .2rem rgba(15,108,191,.3); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-secondary { background: var(--surface); color: var(--navy); border-color: #ced4da; }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #8f2029; }
.btn-success { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn-success:hover:not(:disabled) { background: #17632a; }
.btn-sm { padding: .28rem .65rem; font-size: .8rem; }
.btn-icon { padding: .35rem .5rem; background: none; border: none; cursor: pointer; color: var(--muted); font-size: 1rem; border-radius: 4px; transition: background .12s, color .12s; }
.btn-icon:hover { background: var(--surface-2); color: var(--navy); }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .82rem; font-weight: 500; color: var(--ink); margin-bottom: .35rem; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="datetime-local"], input[type="date"], input[type="url"], select, textarea {
  width: 100%; padding: .5rem .75rem; border: 1px solid #ced4da; border-radius: var(--radius-sm);
  font-size: .9rem; color: var(--ink); background: var(--surface); font-family: inherit; transition: border-color .12s, box-shadow .12s; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(15,108,191,.2); }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
input[type="color"] { width: 2.6rem; height: 2rem; padding: 0; border: 1px solid #ced4da; border-radius: 5px; cursor: pointer; }

/* ── Badges (pill Bootstrap) ──────────────────────────────── */
.badge { display: inline-block; padding: .22rem .6rem; border-radius: 20px; font-size: .7rem; font-weight: 700; }
.badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-in_progress { background: var(--info-bg); color: var(--info); }
.badge-done { background: var(--ok-bg); color: var(--ok); }
.badge-high { background: var(--danger-bg); color: var(--danger); }
.badge-medium { background: var(--warn-bg); color: var(--warn); }
.badge-low { background: var(--surface-2); color: var(--muted); }
.badge-moodle { background: var(--brand-soft); color: var(--brand); }
.badge-manual { background: var(--ok-bg); color: var(--ok); }

/* ── Task list ────────────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: .5rem; }
.task-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; display: flex; align-items: center; gap: .85rem; border-left: 4px solid transparent; box-shadow: var(--shadow); transition: box-shadow .12s; }
.task-item:hover { box-shadow: var(--shadow-md); }
.task-item.overdue { border-left-color: var(--danger); }
.task-item.due-today { border-left-color: #e0a800; }
.task-item.done { opacity: .6; }
.task-check { width: 1.15rem; height: 1.15rem; cursor: pointer; flex-shrink: 0; accent-color: var(--brand); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: .93rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-title.done-text { text-decoration: line-through; color: var(--faint); }
.task-meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .3rem; }
.task-date { font-size: .76rem; color: var(--muted); }
.task-date.overdue-text { color: var(--danger); font-weight: 500; }
.task-date.today-text { color: #b8860b; font-weight: 500; }
.task-actions { display: flex; gap: .3rem; }
.subject-dot { width: .55rem; height: .55rem; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ── Filter bar ───────────────────────────────────────────── */
.filter-bar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.1rem; }
.filter-bar select { width: auto; padding: .4rem .8rem; }

/* ── Teacher / subject cards ──────────────────────────────── */
.teacher-card { display: flex; flex-direction: column; gap: .5rem; }
.teacher-name { font-size: 1.1rem; font-weight: 500; color: var(--navy); }
.teacher-info { font-size: .83rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; }
.teacher-actions { display: flex; gap: .4rem; margin-top: .3rem; }
.subject-card { border-radius: var(--radius); padding: 1.2rem; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid; box-shadow: var(--shadow); }
.subject-name { font-size: 1.1rem; font-weight: 500; margin-bottom: .3rem; color: var(--navy); }
.subject-stats { font-size: .8rem; color: var(--muted); margin-bottom: .8rem; }
.subject-actions { display: flex; gap: .4rem; }

/* ── Today schedule ──────────────────────────────────────── */
.today-schedule { margin-bottom: 1.3rem; }
.schedule-row { display: flex; gap: .6rem; overflow-x: auto; padding-bottom: .35rem; margin-top: .75rem; }
.schedule-block { flex: 0 0 auto; min-width: 118px; max-width: 155px; border-radius: var(--radius-sm); padding: .6rem .7rem; background: var(--surface-2); border: 1px solid var(--line); border-top: 3px solid #ced4da; position: relative; }
.schedule-current { border-top-color: var(--brand) !important; }
.schedule-past { opacity: .5; }
.schedule-time { font-size: .72rem; color: var(--muted); margin-bottom: .2rem; }
.schedule-name { font-size: .82rem; font-weight: 500; line-height: 1.25; }
.schedule-now-pill { position: absolute; top: -.55rem; right: .4rem; background: var(--ok); color: #fff; font-size: .6rem; font-weight: 700; padding: .1rem .4rem; border-radius: 20px; text-transform: uppercase; letter-spacing: .04em; }

/* ── Moodle card ──────────────────────────────────────────── */
.moodle-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.3rem; box-shadow: var(--shadow); }
.moodle-card-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.moodle-icon { width: 2.2rem; height: 2.2rem; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1rem; flex-shrink: 0; }
.moodle-icon-ok { background: var(--ok-bg); color: var(--ok); }
.moodle-info { flex: 1; min-width: 0; }
.moodle-title { font-weight: 500; font-size: .95rem; margin-bottom: .15rem; color: var(--navy); }
.moodle-sub { font-size: .8rem; color: var(--muted); }
.moodle-note { font-size: .78rem; color: var(--faint); margin-top: .5rem; }
.moodle-connected { border-left-color: var(--ok); }

/* ── Command center (dashboard) ───────────────────────────── */
.dash-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.dash-hello { font-size: 1.7rem; font-weight: 500; color: var(--navy); line-height: 1.15; }
.dash-date { font-size: .82rem; color: var(--muted); text-transform: capitalize; margin-top: .25rem; }
.dashboard-greeting { font-size: 1.7rem; font-weight: 500; margin-bottom: 1.3rem; color: var(--navy); }
.stat-card.clickable { cursor: pointer; transition: transform .08s, border-color .12s, box-shadow .12s; }
.stat-card.clickable:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow-md); }
.stat-card.alert .stat-value { color: var(--danger); }
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.1rem; align-items: start; }
.dash-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.dash-panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .9rem; }
.dash-panel-title { font-size: 1.1rem; font-weight: 500; color: var(--navy); }
.dash-col { display: flex; flex-direction: column; gap: 1.1rem; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

/* ── Study section ────────────────────────────────────────── */
.study-layout { display: grid; grid-template-columns: 270px 1fr; gap: 1.1rem; }
.study-sidebar { display: flex; flex-direction: column; gap: 1rem; }
.study-docs-list { display: flex; flex-direction: column; gap: .4rem; }
.doc-item { display: flex; align-items: center; justify-content: space-between; background: var(--surface-2); border-radius: 6px; padding: .5rem .7rem; font-size: .83rem; }
.doc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.study-main { display: flex; flex-direction: column; gap: 1rem; }
.study-tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab-btn { padding: .5rem .95rem; border-radius: var(--radius-sm) var(--radius-sm) 0 0; font-size: .84rem; font-weight: 500; cursor: pointer; border: 1px solid transparent; border-bottom: none; background: none; color: var(--muted); font-family: inherit; margin-bottom: -1px; transition: all .12s; }
.tab-btn:hover { color: var(--brand); }
.tab-btn.active { background: var(--surface); color: var(--brand); border-color: var(--line); border-bottom-color: var(--surface); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.ai-output { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; min-height: 200px; font-size: .92rem; line-height: 1.7; overflow-y: auto; max-height: 620px; }
.ai-output.streaming { white-space: pre-wrap; font-family: var(--font-mono); font-size: .84rem; }
.ai-placeholder { color: var(--faint); font-style: italic; }
.ai-output h1, .ai-output h2, .ai-output h3 { margin: 1.1rem 0 .5rem; color: var(--navy); font-weight: 500; }
.ai-output ul, .ai-output ol { margin: .5rem 0 .5rem 1.5rem; }
.ai-output li { margin-bottom: .25rem; }
.ai-output p { margin-bottom: .75rem; }
.ai-output code { background: var(--surface-2); padding: .1rem .35rem; border-radius: 4px; font-size: .85em; font-family: var(--font-mono); color: #c7254e; }
.ai-output pre { background: #2d3436; color: #f8f9fa; padding: 1rem; border-radius: 8px; overflow-x: auto; margin: .8rem 0; }
.ai-output pre code { background: none; padding: 0; color: inherit; }
.ai-output strong { font-weight: 700; }
.ai-output blockquote { border-left: 3px solid var(--brand); padding-left: .8rem; color: var(--muted); margin: .6rem 0; }
.ai-savebar { margin-bottom: .8rem; padding-bottom: .6rem; border-bottom: 1px dashed var(--line); }
.ai-analysis-content { max-height: 60vh; overflow-y: auto; }
.ai-analysis-status { color: var(--muted); font-size: .9rem; }

/* ── Grades ───────────────────────────────────────────────── */
.grades-table { width: 100%; border-collapse: collapse; font-size: .88rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grades-table th { background: var(--surface-2); padding: .65rem .85rem; text-align: left; font-weight: 500; color: var(--navy); border-bottom: 1px solid var(--line); }
.grades-table td { padding: .65rem .85rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.grades-table tr:last-child td { border-bottom: none; }
.grades-table tr:hover td { background: var(--surface-2); }
.grade-num { font-weight: 700; font-size: 1.05rem; }
.grade-good { color: var(--ok); }
.grade-warn { color: #b8860b; }
.grade-bad { color: var(--danger); }
.avg-bar { background: var(--brand); height: 4px; border-radius: 2px; margin-top: .3rem; }

/* ── Upcoming / sync ──────────────────────────────────────── */
.upcoming-list { display: flex; flex-direction: column; gap: .5rem; }
.upcoming-item { display: flex; align-items: center; gap: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem 1rem; }
.upcoming-date { font-size: .77rem; font-weight: 700; color: var(--brand); width: 74px; flex-shrink: 0; }
.upcoming-title { flex: 1; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-status { font-size: .8rem; color: var(--muted); }

/* ── Pomodoro ─────────────────────────────────────────────── */
.pomodoro-card { text-align: center; }
.pomodoro-display { font-family: var(--font-mono); font-size: 3rem; font-weight: 700; color: var(--brand); letter-spacing: .04em; margin: .8rem 0; font-variant-numeric: tabular-nums; }
.pomodoro-label { font-size: .8rem; color: var(--muted); margin-bottom: .8rem; }
.pomodoro-actions { display: flex; gap: .5rem; justify-content: center; }
.pomodoro-sessions { font-size: .8rem; color: var(--faint); margin-top: .5rem; }

/* ── Modal ────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(20,32,58,.5); }
.modal-dialog { position: relative; background: var(--surface); border-radius: 10px; width: 90%; max-width: 540px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 16px 48px rgba(0,0,0,.3); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.3rem; border-bottom: 1px solid var(--line); }
.modal-title { font-size: 1.15rem; font-weight: 500; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--muted); line-height: 1; padding: .2rem; }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 1.2rem 1.3rem; overflow-y: auto; flex: 1; }
.modal-footer { padding: .9rem 1.3rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .5rem; }

/* ── Toast ────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; display: flex; flex-direction: column; gap: .5rem; z-index: 300; }
.toast { padding: .75rem 1.1rem; border-radius: 8px; font-size: .87rem; font-weight: 500; box-shadow: var(--shadow-md); animation: slideIn .2s ease; max-width: 330px; border: 1px solid; }
.toast-success { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.toast-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.toast-info { background: var(--info-bg); color: var(--info); border-color: #bfdcf5; }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Misc ─────────────────────────────────────────────────── */
.section-title { font-size: 1.15rem; font-weight: 500; color: var(--navy); margin-bottom: .8rem; }
.section-sep { height: 1px; background: var(--line); margin: 1rem 0; }
.empty-state { text-align: center; color: var(--muted); padding: 2rem; font-size: .9rem; }
.upload-area { border: 2px dashed #ced4da; border-radius: var(--radius); padding: 1.3rem; text-align: center; color: var(--muted); font-size: .85rem; cursor: pointer; transition: border-color .12s, color .12s; }
.upload-area:hover { border-color: var(--brand); color: var(--brand); }

/* ── Entregas Moodle ──────────────────────────────────────── */
.sub-list { display: flex; flex-direction: column; gap: .75rem; }
.sub-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: .9rem 1.1rem; box-shadow: var(--shadow); }
.sub-card:hover { box-shadow: var(--shadow-md); }
.sub-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sub-card-name { font-weight: 500; color: var(--navy); }
.sub-badge { font-size: .68rem; font-weight: 700; border-radius: 20px; padding: .18rem .6rem; white-space: nowrap; flex-shrink: 0; }
.sub-card-meta { font-size: .8rem; color: var(--muted); margin-top: .3rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.sub-card-actions { margin-top: .7rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.sub-done { font-size: .82rem; color: var(--ok); font-weight: 500; }
.sub-warning { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn); border-radius: 8px; padding: .6rem .8rem; font-size: .85rem; margin-bottom: .9rem; }
.sub-file-label { display: block; font-size: .82rem; color: var(--ink); margin-bottom: .4rem; font-weight: 500; }
.sub-file-input { width: 100%; font-size: .85rem; color: var(--muted); }
.sub-file-chosen { font-size: .82rem; color: var(--brand); margin-top: .5rem; min-height: 1em; }

/* Tabla de estado (calcada a Moodle) */
.moodle-table { width: 100%; border-collapse: collapse; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: .9rem; background: var(--surface); }
.moodle-table th { width: 34%; text-align: left; background: var(--surface-2); color: var(--ink); font-weight: 700; padding: .7rem .9rem; border: 1px solid var(--line); vertical-align: top; }
.moodle-table td { padding: .7rem .9rem; border: 1px solid var(--line); vertical-align: top; }
.moodle-table tr.ok th, .moodle-table tr.ok td { background: var(--ok-bg); color: #155724; }

/* Página de tarea */
.assign-page { max-width: 900px; }
.detail-h { color: var(--navy); font-size: 1.2rem; font-weight: 500; margin: 1.5rem 0 .6rem; }
.detail-h:first-child { margin-top: 0; }
.assign-intro { font-size: .93rem; line-height: 1.6; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; color: var(--ink); }
.assign-intro img { max-width: 100%; height: auto; }
.detail-files { display: flex; flex-direction: column; gap: .45rem; }
.detail-file-row { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .45rem .6rem; background: var(--surface); }
.detail-file-name { flex: 1; font-size: .88rem; word-break: break-word; }
.assign-upload { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--line); }
.assign-page-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: 1.2rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }

/* ── Aula virtual ─────────────────────────────────────────── */
.classroom-bar { margin-bottom: 1rem; }
.classroom-select { max-width: 340px; }
.classroom-updated { font-size: .75rem; color: var(--faint); margin-bottom: .75rem; }
.classroom-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.classroom-section-title { font-size: 1.15rem; font-weight: 500; color: var(--navy); padding-bottom: .5rem; margin-bottom: .6rem; border-bottom: 2px solid var(--line-soft); }
.classroom-summary { font-size: .85rem; color: var(--muted); margin-bottom: .8rem; line-height: 1.55; }
.classroom-summary img, .classroom-mod-desc img { max-width: 100%; height: auto; }
.classroom-mod { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem 0; border-top: 1px solid var(--line-soft); }
.classroom-mod:first-of-type { border-top: none; }
.classroom-mod-icon { font-size: 1.1rem; flex-shrink: 0; line-height: 1.4; }
.classroom-mod-main { flex: 1; min-width: 0; }
.classroom-mod-name { font-weight: 500; color: var(--ink); font-size: .92rem; }
.classroom-mod-desc { font-size: .82rem; color: var(--muted); margin-top: .2rem; line-height: 1.55; }
.classroom-file { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; margin-top: .35rem; margin-right: .8rem; }
.classroom-assign-btn { margin-top: .5rem; }
.classroom-mod-content { font-size: .84rem; color: var(--ink); margin-top: .4rem; line-height: 1.55; border-left: 2px solid var(--line); padding-left: .7rem; }
.classroom-mod-content img { max-width: 100%; height: auto; border-radius: 6px; }
.classroom-mod-content .fp { padding: .4rem 0; border-bottom: 1px solid var(--line-soft); }
.classroom-mod-content .fp-h { font-size: .8rem; color: var(--muted); margin-bottom: .2rem; }
.classroom-mod-content .fp-att { margin-top: .3rem; font-size: .8rem; }
.classroom-mod-content .quiz-note { color: var(--warn); background: var(--warn-bg); padding: .3rem .5rem; border-radius: 6px; display: inline-block; margin-top: .4rem; }

/* ── Visor PDF / OnlyOffice ───────────────────────────────── */
.pdf-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(20,32,58,.85); display: flex; flex-direction: column; padding: 2vh 2vw; }
.pdf-bar { display: flex; align-items: center; gap: .6rem; background: var(--navy); color: #fff; padding: .6rem .9rem; border-radius: 10px 10px 0 0; }
.pdf-title { font-weight: 500; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-btn { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; padding: .35rem .8rem; font-size: .82rem; cursor: pointer; text-decoration: none; white-space: nowrap; font-family: inherit; }
.pdf-btn:hover { background: rgba(255,255,255,.24); text-decoration: none; }
.pdf-frame { flex: 1; width: 100%; border: none; border-radius: 0 0 10px 10px; background: #fff; }
.office-loading { flex: 1; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1rem; text-align: center; padding: 2rem; }
.oo-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(20,32,58,.92); display: flex; flex-direction: column; }
.oo-holder { flex: 1; background: #fff; min-height: 0; }
.oo-holder > div { width: 100%; height: 100%; }

/* ── Quiz ─────────────────────────────────────────────────── */
.quiz-area { margin-top: 1rem; }
.quiz-q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); }
.quiz-prog { font-size: .78rem; color: var(--faint); margin-bottom: .6rem; }
.quiz-question { font-size: 1.1rem; font-weight: 500; color: var(--navy); margin-bottom: 1rem; line-height: 1.45; }
.quiz-opts { display: flex; flex-direction: column; gap: .5rem; }
.quiz-opt { text-align: left; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-size: .9rem; color: var(--ink); font-family: inherit; transition: background .12s, border-color .12s; }
.quiz-opt:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt-correct { background: var(--ok-bg) !important; border-color: var(--ok-line) !important; color: var(--ok); font-weight: 500; }
.quiz-opt-wrong { background: var(--danger-bg) !important; border-color: var(--danger-line) !important; color: var(--danger); }
.quiz-fb { margin-top: .8rem; padding: .7rem .9rem; border-radius: var(--radius-sm); font-size: .86rem; line-height: 1.55; }
.quiz-fb-ok { background: var(--ok-bg); color: var(--ok); }
.quiz-fb-bad { background: var(--danger-bg); color: var(--danger); }
.quiz-done { text-align: center; padding: 2rem 1rem; }
.quiz-score { font-size: 2.4rem; font-weight: 700; color: var(--brand); }
.quiz-done p { color: var(--muted); margin: .5rem 0 1rem; }

/* ── Flashcards ───────────────────────────────────────────── */
.fc-area { margin-top: 1rem; }
.fc-deck-head { display: flex; align-items: center; gap: 1.6rem; flex-wrap: wrap; }
.fc-deck-info { text-align: center; }
.fc-deck-count { font-size: 2rem; font-weight: 700; color: var(--brand); line-height: 1; }
.fc-deck-count.fc-due { color: var(--danger); }
.fc-deck-lbl { font-size: .74rem; color: var(--muted); margin-top: .2rem; }
.fc-deck-actions { margin-left: auto; }
.fc-card { min-height: 190px; display: flex; flex-direction: column; gap: .6rem; align-items: center; justify-content: center; text-align: center; padding: 1.6rem; cursor: pointer; user-select: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); transition: transform .1s; position: relative; }
.fc-card:active { transform: scale(.99); }
.fc-face { font-size: 1.2rem; font-weight: 500; color: var(--navy); line-height: 1.45; }
.fc-face.fc-back { font-size: 1.02rem; font-weight: 400; color: var(--ink); }
.fc-card .fc-hint { display: block; font-size: .72rem; color: var(--faint); }
.fc-bar { display: flex; align-items: center; gap: .6rem; margin-top: .8rem; justify-content: flex-end; }
.fc-prog { margin-right: auto; font-size: .8rem; color: var(--faint); }

/* ── Actividades ──────────────────────────────────────────── */
.act-intro { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; line-height: 1.55; max-width: 640px; }
.act-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.act-card.act-complete { opacity: .75; }
.act-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.act-subject { font-weight: 500; font-size: 1.05rem; color: var(--navy); }
.act-count { font-size: .8rem; color: var(--muted); font-weight: 500; white-space: nowrap; }
.act-bar { height: 6px; background: var(--line-soft); border-radius: 3px; margin: .5rem 0 .8rem; overflow: hidden; }
.act-bar-fill { height: 100%; background: var(--ok); width: 0; transition: width .2s; }
.act-list { display: flex; flex-direction: column; gap: .1rem; }
.act-item { display: flex; align-items: center; gap: .6rem; padding: .5rem .2rem; border-top: 1px solid var(--line-soft); }
.act-item:first-child { border-top: none; }
.act-chk { width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; accent-color: var(--ok); }
.act-name { font-size: .88rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; flex: 1; }
.act-name-link { color: var(--brand); cursor: pointer; }
.act-done .act-name { color: var(--faint); text-decoration: line-through; }
.act-meta { font-size: .75rem; color: var(--faint); white-space: nowrap; }
.removed-badge { font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--danger); background: var(--danger-bg); border: 1px solid var(--danger-line); border-radius: 4px; padding: .1rem .35rem; flex-shrink: 0; white-space: nowrap; }
.act-expand { background: none; border: none; cursor: pointer; color: var(--faint); font-size: .9rem; padding: .1rem .3rem; flex-shrink: 0; }
.act-expand:hover { color: var(--ink); }
.act-detail { margin: .2rem 0 .6rem 2.1rem; padding: .7rem .9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.act-detail-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); margin: .2rem 0 .4rem; }
.act-files { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .5rem; }
.act-file { display: flex; align-items: center; gap: .5rem; }
.act-file-name { font-size: .82rem; color: var(--brand); cursor: pointer; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-file-empty { font-size: .8rem; color: var(--faint); }
.act-upload { display: inline-block; font-size: .8rem; color: var(--brand); cursor: pointer; background: var(--brand-soft); border: 1px solid #bfdcf5; border-radius: 6px; padding: .3rem .6rem; }
.act-upload:hover { background: #d7e9fa; }
.act-notes { width: 100%; min-height: 60px; margin-top: .3rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; font-family: inherit; font-size: .84rem; resize: vertical; }

/* Citas */
.cite-link { color: var(--brand); font-size: .82em; background: var(--brand-soft); padding: .05rem .35rem; border-radius: 5px; white-space: nowrap; }

/* ══════════ Calendario ══════════ */
.gcal { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.gcal-head { display: grid; border-bottom: 1px solid var(--line); }
.gcal-dayhead { text-align: center; padding: .35rem .1rem; border-left: 1px solid var(--line-soft); }
.gcal-dayhead.gcal-today { background: var(--brand-soft); }
.gcal-dayname { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.gcal-daynum { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.gcal-today .gcal-daynum { color: #fff; background: var(--brand); border-radius: 50%; width: 1.8rem; height: 1.8rem; line-height: 1.8rem; margin: 0 auto; display: block; }
.gcal-body { display: grid; overflow-y: auto; max-height: calc(100vh - 240px); }
.gcal-gutter { position: relative; }
.gcal-hourlabel { position: absolute; right: 6px; transform: translateY(-50%); font-size: .64rem; color: var(--faint); white-space: nowrap; }
.gcal-col { position: relative; border-left: 1px solid var(--line-soft); }
.gcal-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-soft); }
.gcal-event { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: .18rem .35rem; color: #fff; overflow: hidden; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.18); transition: filter .1s; }
.gcal-event:hover { filter: brightness(1.06); }
.gcal-event-active { outline: 2px solid var(--navy); outline-offset: -2px; }
.gcal-event-name { font-size: .72rem; font-weight: 700; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; }
.gcal-event-time { font-size: .6rem; opacity: .92; }
.gcal-event-ind { font-size: .58rem; opacity: .95; margin-top: 1px; }
.gcal-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--danger); z-index: 5; }
.gcal-now::before { content: ''; position: absolute; left: -4px; top: -5px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }

.cal-wrap { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); align-items: flex-start; overflow: hidden; box-shadow: var(--shadow); }
.cal-side { flex: 1; min-width: 0; overflow-x: auto; padding: 1rem; }
.cal-session-side { width: 340px; flex-shrink: 0; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 300px; }
.cal-session-side:empty { display: none; }
.cal-nav { display: flex; gap: .5rem; margin-bottom: .75rem; align-items: center; flex-wrap: wrap; }
.cal-week-label { font-size: .9rem; color: var(--muted); margin-bottom: .75rem; font-weight: 500; }
.cal-mode-toggle { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.cal-mode-btn { background: var(--surface); border: none; cursor: pointer; padding: .35rem .8rem; font-size: .8rem; color: var(--muted); font-family: inherit; transition: background .12s, color .12s; }
.cal-mode-btn:hover { background: var(--surface-2); }
.cal-mode-btn.active { background: var(--brand); color: #fff; }
.cal-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-month-dow { text-align: center; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .3rem 0; }
.cal-month-dow.cal-month-weekend { color: var(--faint); }
.cal-month-cell { min-height: 92px; border: 1px solid var(--line-soft); border-radius: 6px; padding: .3rem; display: flex; flex-direction: column; gap: .2rem; background: var(--surface); }
.cal-month-cell.cal-month-out { background: var(--surface-2); opacity: .6; }
.cal-month-cell.cal-month-weekend { background: var(--surface-2); }
.cal-month-cell.cal-month-today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-month-num { font-size: .78rem; font-weight: 700; color: var(--muted); }
.cal-month-today .cal-month-num { color: var(--brand); }
.cal-month-chip { display: flex; align-items: center; gap: .25rem; background: var(--surface-2); border-left: 3px solid #ced4da; border-radius: 4px; padding: .15rem .3rem; cursor: pointer; transition: filter .1s; }
.cal-month-chip:hover { filter: brightness(.97); }
.cal-month-chip-active { outline: 2px solid var(--brand); outline-offset: -1px; }
.cal-month-chip-name { font-size: .68rem; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.cal-month-chip-ind { font-size: .62rem; color: var(--muted); flex-shrink: 0; }
.cal-doc-link, .doc-link, .classroom-mod-desc a, .classroom-mod-content a, .classroom-file, .act-file-name:hover, .cal-doc-link:hover, .doc-link:hover { color: var(--brand); }
.cal-doc-link:hover, .doc-link:hover, .classroom-file:hover, .act-file-name:hover { text-decoration: underline; }
.doc-icon { margin-right: .3rem; }
.doc-badge { font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #b45309; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 4px; padding: .1rem .3rem; flex-shrink: 0; }
.cal-grid { display: grid; gap: 2px; }
.cal-corner { background: transparent; }
.cal-day-header { text-align: center; padding: .4rem .2rem; border-radius: 6px; }
.cal-today-header { background: var(--brand-soft); }
.cal-day-name { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cal-day-date { font-size: 1.1rem; font-weight: 700; color: var(--ink); }
.cal-today-header .cal-day-date { color: var(--brand); }
.cal-time-label { font-size: .68rem; color: var(--faint); text-align: right; padding-right: .4rem; padding-top: .35rem; line-height: 1.2; white-space: nowrap; }
.cal-recreo-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-style: italic; }
.cal-cell { border-radius: 6px; min-height: 54px; padding: .35rem .4rem; position: relative; transition: filter .1s; }
.cal-cell-empty { background: var(--surface-2); }
.cal-recreo-cell { background: var(--surface-2); opacity: .5; min-height: 28px; }
.cal-cell-subject { background: var(--surface-2); border-top: 3px solid #ced4da; cursor: pointer; user-select: none; }
.cal-cell-subject:hover { filter: brightness(.97); }
.cal-cell-active { outline: 2px solid var(--brand); outline-offset: -2px; }
.cal-subject-name { font-size: .72rem; font-weight: 500; line-height: 1.3; color: var(--ink); }
.cal-session-ind { display: flex; gap: .25rem; margin-top: .25rem; flex-wrap: wrap; }
.cal-ind-notes, .cal-ind-docs { font-size: .65rem; color: var(--muted); }
.cal-session-loading { padding: 2rem; color: var(--muted); text-align: center; }
.cal-session-error { padding: 1rem; color: var(--danger); }
.cal-session-header { padding: 1rem 1rem .8rem; border-left: 4px solid var(--brand); border-bottom: 1px solid var(--line-soft); position: relative; }
.cal-session-close { position: absolute; top: .6rem; right: .6rem; background: none; border: none; cursor: pointer; color: var(--faint); font-size: 1rem; padding: .2rem .4rem; border-radius: 4px; }
.cal-session-close:hover { background: var(--surface-2); color: var(--ink); }
.cal-session-subject { font-weight: 500; font-size: 1.1rem; margin-bottom: .2rem; padding-right: 1.5rem; color: var(--navy); }
.cal-session-meta { font-size: .78rem; color: var(--muted); }
.cal-session-notes-section, .cal-session-docs-section { padding: .85rem 1rem; border-bottom: 1px solid var(--line-soft); }
.cal-session-section-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin-bottom: .5rem; }
.cal-session-textarea { width: 100%; min-height: 140px; resize: vertical; border: 1px solid var(--line); border-radius: 6px; padding: .6rem .7rem; font-size: .85rem; font-family: inherit; line-height: 1.5; outline: none; background: var(--surface); color: var(--ink); }
.cal-session-textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(15,108,191,.2); }
.cal-save-status { font-size: .72rem; color: var(--faint); margin-top: .3rem; height: 1em; }
.cal-doc-list { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .5rem; }
.cal-doc-empty { font-size: .82rem; color: var(--faint); padding: .3rem 0; }
.cal-doc-item { display: flex; align-items: center; gap: .4rem; background: var(--surface-2); border-radius: 6px; padding: .35rem .5rem; }
.cal-doc-icon { font-size: .85rem; flex-shrink: 0; }
.cal-doc-name { font-size: .8rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-upload-btn { display: inline-block; cursor: pointer; padding: .4rem .8rem; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: .82rem; font-weight: 500; border: 1px dashed #ced4da; transition: background .12s; }
.cal-upload-btn:hover { background: var(--line-soft); }

/* ── Búsqueda ─────────────────────────────────────────────── */
.search-info { font-size: .85rem; color: var(--muted); margin-bottom: .8rem; }
.search-list { display: flex; flex-direction: column; gap: .5rem; }
.search-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .8rem 1rem; cursor: pointer; transition: border-color .1s, box-shadow .1s; box-shadow: var(--shadow); }
.search-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }
.search-top { display: flex; align-items: center; gap: .5rem; }
.search-icon { flex-shrink: 0; }
.search-title { font-weight: 500; color: var(--navy); font-size: .9rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-badge { font-size: .62rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 700; color: var(--brand); background: var(--brand-soft); border-radius: 4px; padding: .1rem .4rem; flex-shrink: 0; }
.search-sub { font-size: .8rem; color: var(--muted); margin-top: .3rem; line-height: 1.45; }

/* ── Responsive ───────────────────────────────────────────── */
.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }
@media (max-width: 768px) {
  .mobile-topbar { display: flex; align-items: center; gap: .7rem; position: fixed; top: 0; left: 0; right: 0; height: 54px; z-index: 160; background: var(--navy); color: #fff; padding: 0 1rem; box-shadow: 0 1px 6px rgba(0,0,0,.2); }
  .menu-toggle { background: none; border: none; color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; padding: .1rem .4rem; }
  .mobile-title { font-weight: 700; font-size: 1.1rem; }
  .sidebar { width: 280px; max-width: 84vw; z-index: 200; transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 6px 0 34px rgba(0,0,0,.3); }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .main-content { margin-left: 0; padding: 1rem; padding-top: 68px; max-width: 100%; }
  .view-title, .dashboard-greeting, .dash-hello { font-size: 1.4rem; }
  .view-header { margin-bottom: 1.1rem; }
  .study-layout { grid-template-columns: 1fr; }
  .form-row, .form-grid { grid-template-columns: 1fr !important; }
  .cal-wrap { flex-direction: column; }
  .cal-session-side { width: 100%; max-height: none; border-left: none; border-top: 1px solid var(--line); }
  .cal-side { overflow-x: auto; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .card { padding: 1.1rem; }
  .stat-grid, .dash-grid { grid-template-columns: 1fr 1fr !important; }
  .modal-dialog { width: 94vw; max-width: 94vw; }
  .cal-month-cell { min-height: 64px; }
  .cal-month-chip-name { font-size: .6rem; }

  /* Objetivos de pulsación cómodos con el dedo (~44px) en móvil */
  .btn-icon { padding: .5rem .65rem; font-size: 1.15rem; }
  .btn-sm { padding: .45rem .8rem; font-size: .82rem; }
  .task-check, .act-chk { width: 22px; height: 22px; flex-shrink: 0; }
  /* Filtros a ancho completo: más fáciles de tocar y sin apretujarse */
  .filter-bar select { flex: 1 1 100%; }
  /* El menú "Nuevo documento" nunca se sale de la pantalla */
  .newdoc-menu { min-width: 0; width: 100%; }
}

/* ── Botón "Nuevo documento" (OnlyOffice) ───────────────────── */
.newdoc-wrap { position: relative; display: inline-block; margin-top: .5rem; }
.newdoc-btn { width: 100%; }
.newdoc-menu {
  display: none;
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 50;
  min-width: 210px; padding: .3rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,.16);
}
.newdoc-wrap.open .newdoc-menu { display: block; }
.newdoc-item {
  display: block; width: 100%; text-align: left;
  padding: .5rem .6rem; border: 0; border-radius: 4px;
  background: transparent; color: var(--text); font: inherit; cursor: pointer;
}
.newdoc-item:hover { background: var(--brand-soft); color: var(--brand-dark); }
.subdocs-toolbar { margin-bottom: .8rem; }

/* Enlaces de contacto en fichas de profesor */
.teacher-link { color: var(--brand); text-decoration: none; }
.teacher-link:hover { text-decoration: underline; }

/* ── Mis Documentos ─────────────────────────────────────────── */
.misdocs-toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.misdocs-lbl { font-size: .85rem; color: var(--muted); }
.misdocs-list { display: flex; flex-direction: column; gap: .4rem; }
.misdoc-item { display: flex; align-items: center; gap: .6rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .55rem .8rem; box-shadow: var(--shadow); }
.misdoc-item:hover { border-color: var(--brand); }
.misdoc-icon { flex-shrink: 0; }
.misdoc-name { flex: 1; color: var(--navy); font-weight: 500; text-decoration: none; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.misdoc-name:hover { color: var(--brand); text-decoration: underline; }
.misdoc-meta { font-size: .75rem; color: var(--muted); flex-shrink: 0; }
.misdoc-link { font-size: .72rem; background: none; border: 1px solid var(--line); border-radius: 4px; padding: .18rem .5rem; cursor: pointer; color: var(--muted); font-family: inherit; white-space: nowrap; flex-shrink: 0; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.misdoc-link:hover { border-color: var(--brand); color: var(--brand); }
.misdoc-link.on { color: var(--brand-dark); border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }

/* ── Aula virtual: promover fichero a actividad ─────────────── */
.classroom-file-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.classroom-file-row .classroom-file { flex: 1; }
.classroom-act-btn { font-size: .72rem; color: var(--brand); white-space: nowrap; }
.classroom-act-btn:disabled { color: var(--ok, #1e7e34); cursor: default; }

/* ── Actividades: marca "para examen" y quitar ──────────────── */
.act-exam { font-size: .72rem; background: none; border: 1px solid var(--line); border-radius: 4px; padding: .12rem .4rem; cursor: pointer; color: var(--muted); font-family: inherit; white-space: nowrap; }
.act-exam.on { color: #b8860b; border-color: #f0c33c; background: #fff8e1; font-weight: 600; }
.act-rm { color: var(--muted); }
.act-rm:hover { color: var(--danger, #ef4444); }
.act-doc-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: .4rem 0; }
