/* ─────────────────────────────────────────────────────────────────────────
   Cotaly — estilos
   Paleta oficial (COTALY_guia_marca.md):
     Navy        #0B2545  (texto, brand-dark)
     Teal        #1B998B  (trazo, brand)
     Teal claro  #33C9B7  (sobre fondo oscuro)
     Coral       #F25F5C  (acento / CTA / punto)
     Light       #EAF1F4  (fondo / superficies)
   Las variables --brand-* siguen siendo sobreescritas por la academia
   desde su branding (configuración → marca) si quiere personalizar.
   ───────────────────────────────────────────────────────────────────── */

:root {
  --brand: #1B998B;
  --brand-dark: #0B2545;
  --brand-light: #33C9B7;
  --accent: #F25F5C;
  --bg: #EAF1F4;
  --bg-soft: #f4f8fa;
  --panel: #ffffff;
  --line: #d5dee4;
  --line-soft: #e5ecf0;
  --text: #0B2545;
  --muted: #5e6e83;
  --danger: #c93636;
  --warn: #c67a12;
  --ok: #1B998B;
  --shadow-sm: 0 2px 6px rgba(11, 37, 69, 0.04);
  --shadow: 0 12px 32px rgba(11, 37, 69, 0.08);
  --shadow-lg: 0 24px 60px rgba(11, 37, 69, 0.12);
  --radius: 12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14.5px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: "Plus Jakarta Sans", "Inter", sans-serif;
  color: var(--brand-dark);
  margin: 0;
  letter-spacing: -0.01em;
}
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.0rem; font-weight: 700; }

.muted { color: var(--muted); }
.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  text-transform: uppercase;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

/* ── Login ─────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.login-hero {
  position: relative;
  padding: 56px;
  color: white;
  background: linear-gradient(160deg, var(--brand-dark) 0%, var(--brand) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.login-hero::after {
  content: "";
  position: absolute;
  right: -120px; top: -120px;
  width: 480px; height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.12), transparent 70%);
}
.brand-row { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  display: grid; place-items: center;
  width: 52px; height: 52px;
  border-radius: 12px;
  background: rgba(255,255,255,0.95);
  color: var(--brand-dark);
  font-weight: 900; font-size: 1.1rem;
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.login-hero h1 {
  color: white;
  font-size: clamp(2.4rem, 4.5vw, 3.6rem);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.login-hero p {
  color: rgba(255,255,255,0.85);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 520px;
}
.hero-features {
  display: grid; gap: 14px;
  position: relative;
}
.hero-feature {
  display: flex; gap: 12px; align-items: flex-start;
  color: rgba(255,255,255,0.92);
}
.hero-feature .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  margin-top: 8px; flex-shrink: 0;
}
.hero-feature strong { color: white; font-weight: 700; }

.login-panel {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 48px 56px;
  background: var(--bg);
}

.role-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 4px;
  background: var(--bg-soft);
  border-radius: 12px;
  margin-bottom: 8px;
}
.role-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.role-tabs button.active {
  background: white;
  color: var(--brand-dark);
  box-shadow: var(--shadow-sm);
}

.card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card { padding: 28px; }
.panel { padding: 20px; }
.panel.elevated { box-shadow: var(--shadow); }

.form { display: grid; gap: 14px; }
label {
  display: grid; gap: 6px;
  font-size: 0.82rem; font-weight: 700;
  color: var(--brand-dark);
}
input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(27, 153, 139, 0.12);
}
textarea { min-height: 88px; resize: vertical; }
.help { font-size: 0.78rem; color: var(--muted); font-weight: 500; }

.btn, .ghost, .icon-btn {
  min-height: 42px;
  padding: 0 18px;
  border: 1.5px solid var(--brand);
  border-radius: 10px;
  background: var(--brand);
  color: white;
  font-weight: 700;
  font-size: 0.92rem;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover { filter: brightness(1.1); }
.ghost {
  background: white;
  color: var(--brand-dark);
  border-color: var(--line);
}
.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.success { background: var(--ok); border-color: var(--ok); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 0.82rem; }
.icon-btn { padding: 0 12px; min-width: 42px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ── Shell (app autenticada) ───────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky; top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: linear-gradient(180deg, var(--brand-dark), #051a36);
  color: white;
  display: flex;
  flex-direction: column;
}
.sidebar .brand-row { margin-bottom: 8px; }
.sidebar small { color: rgba(255,255,255,0.7); display: block; margin-top: 2px; }
.sidebar .brand-mark { width: 38px; height: 38px; font-size: 0.9rem; }
.org-badge {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.07);
  border-radius: 10px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.85);
}
.org-badge strong { color: white; display: block; font-size: 0.92rem; margin-bottom: 2px; }
.nav { display: grid; gap: 4px; margin-top: 18px; flex: 1; overflow-y: auto; }
.nav button {
  padding: 10px 14px;
  text-align: left;
  border: 0;
  border-radius: 10px;
  color: rgba(255,255,255,0.72);
  background: transparent;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav button:hover { background: rgba(255,255,255,0.08); color: white; }
.nav button.active {
  background: rgba(255,255,255,0.14);
  color: white;
}
/* Encabezado de grupo dentro del nav (auditoría UX: agrupa el menú del opositor) */
.nav .nav-group {
  margin: 10px 14px 4px;
  color: rgba(255,255,255,0.42);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav .nav-group:first-child { margin-top: 6px; }
.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-footer .ghost {
  width: 100%;
  background: transparent;
  color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.2);
}

.main {
  padding: 28px 32px;
  min-width: 0;
  overflow-x: hidden;
}
.topbar, .section-head, .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.section-head { margin-bottom: 18px; }

.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.tight { gap: 10px; }

.metric {
  position: relative;
  overflow: hidden;
}
.metric .label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metric strong {
  display: block;
  font-size: 2.1rem;
  font-weight: 800;
  margin-top: 8px;
  color: var(--brand-dark);
  font-family: "Plus Jakarta Sans", sans-serif;
}
.metric .delta {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--ok);
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 0.74rem;
}
.pill.success { background: #e9fff8; color: var(--ok); }
.pill.warn { background: #fff4dd; color: var(--warn); }
.pill.danger { background: #fff0f0; color: var(--danger); }
.pill.muted { background: var(--bg-soft); color: var(--muted); }

.table {
  display: grid;
  gap: 6px;
}
.table-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.9fr 0.8fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  font-size: 0.9rem;
}
.table-row.header {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table-row .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ── Toast ──────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  right: 20px; bottom: 20px;
  max-width: 380px;
  padding: 14px 18px;
  border-radius: 12px;
  color: white;
  background: var(--brand-dark);
  box-shadow: var(--shadow-lg);
  transform: translateY(120px);
  transition: transform 0.25s ease;
  z-index: 1000;
  font-size: 0.9rem;
  font-weight: 600;
}
.toast.show { transform: translateY(0); }
.toast.success { background: var(--ok); }
.toast.error { background: var(--danger); }
.toast.warn { background: var(--warn); }

/* ── Modal ──────────────────────────────────────────────────────────── */

.modal-bg {
  position: fixed; inset: 0;
  background: rgba(8, 38, 74, 0.5);
  display: grid; place-items: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.modal-body { padding: 24px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Utilidades ─────────────────────────────────────────────────────── */

.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.78rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.color-input { padding: 0 10px; min-height: 42px; cursor: pointer; }
.color-row {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 8px;
  align-items: end;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state h3 { color: var(--muted); margin-bottom: 8px; }

.section {
  margin-bottom: 28px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1.5px solid var(--line);
  margin-bottom: 20px;
}
.tabs button {
  padding: 10px 16px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;
  transition: all 0.15s;
}
.tabs button:hover { color: var(--brand-dark); }
.tabs button.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.color-swatch {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1px solid var(--line);
  vertical-align: middle;
  margin-right: 6px;
}

.logo-preview {
  display: grid; place-items: center;
  width: 80px; height: 80px;
  border-radius: 16px;
  background: var(--bg-soft);
  border: 2px dashed var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  overflow: hidden;
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 1100px) {
  .login-page { grid-template-columns: 1fr; }
  .login-hero { padding: 32px; }
  .login-panel { padding: 32px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .table-row { grid-template-columns: 1fr; }
}

/* ── Vista semanal del opositor ─────────────────────────────────────── */

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.week-day {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 320px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.week-day.today {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
}
.week-day.rest {
  background: linear-gradient(135deg, #f8f9fc, #f1f4fa);
  opacity: 0.7;
}
.week-day.vacation {
  background: linear-gradient(135deg, #fff8e8, #fef0d4);
}
.week-day h4 {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.week-day h4 strong { color: var(--brand-dark); font-size: 0.92rem; display: block; margin-top: 2px; }
.day-empty {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 24px 4px;
  font-style: italic;
}
.task-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 0.82rem;
  background: white;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.task-card:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.task-card.estudio { border-left: 3px solid var(--brand); }
.task-card.repaso { border-left: 3px solid var(--accent); }
.task-card.simulacro { border-left: 3px solid var(--warn); }
.task-card.full { background: #f0fdf6; border-color: #c4ebd5; }
.task-card.partial { background: #fff8e8; border-color: #f0deb0; }
.task-card.none { background: #fff0f0; border-color: #f0c8c8; }
.task-card .ttype {
  font-size: 0.66rem;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
  margin-bottom: 3px;
}
.task-card .ttitle { font-weight: 600; line-height: 1.3; color: var(--brand-dark); }
.task-card .tnotes {
  margin-top: 4px;
  font-size: 0.74rem;
  color: var(--muted);
  font-style: italic;
}
.task-mark {
  position: absolute;
  top: 6px; right: 6px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg-soft);
}
.task-mark.full { background: var(--ok); }
.task-mark.partial { background: var(--warn); }
.task-mark.none { background: var(--danger); }

/* ── Avatar de usuario ─────────────────────────────────────────────── */

.avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--bg-soft);
  display: grid; place-items: center;
  font-weight: 800;
  color: var(--brand-dark);
  overflow: hidden;
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--line);
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 80px; height: 80px; font-size: 1.4rem; }
.avatar.xl { width: 110px; height: 110px; font-size: 2rem; }

/* ── Vacaciones y tags (chips) ──────────────────────────────────────── */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--brand); }
.chip.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}
.chip.rest.active {
  background: var(--muted);
  border-color: var(--muted);
}
.chip .x {
  margin-left: 4px;
  opacity: 0.6;
  font-weight: 800;
}
.chip:hover .x { opacity: 1; }

.vacation-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 10px;
  margin-bottom: 6px;
}

/* ── Plan recommendation ──────────────────────────────────────────── */

.callout {
  padding: 14px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(27, 153, 139,0.08), rgba(27, 153, 139,0.06));
  border: 1px solid rgba(27, 153, 139,0.15);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.callout .icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  display: grid; place-items: center;
  font-weight: 800;
  flex-shrink: 0;
}
.callout strong { display: block; color: var(--brand-dark); margin-bottom: 2px; }
.callout span { font-size: 0.88rem; color: var(--text); }

@media (max-width: 1100px) {
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-day { min-height: 200px; }
  .vacation-row { grid-template-columns: 1fr; }
}

/* ── Calendario mensual ─────────────────────────────────────────────── */

.calendar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.calendar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
}
.calendar-head h3 {
  font-size: 1.05rem;
  text-transform: capitalize;
  color: var(--brand-dark);
}
.calendar-nav { display: flex; gap: 6px; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-soft);
}
.calendar-dow {
  padding: 8px 6px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--bg-soft);
}
.calendar-cell {
  min-height: 96px;
  padding: 6px 8px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.78rem;
  position: relative;
}
.calendar-cell.other { background: #fafbfd; color: var(--muted); }
.calendar-cell.today { background: linear-gradient(180deg, rgba(27, 153, 139,0.05), transparent); }
.calendar-cell.today .day-num { color: var(--brand); font-weight: 900; }
.calendar-cell .day-num {
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 2px;
}
.calendar-event {
  background: var(--brand);
  color: white;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: filter 0.1s;
}
.calendar-event:hover { filter: brightness(1.1); }
.calendar-event.tutoria { background: var(--accent); }
.calendar-event.llamada { background: var(--brand); }
.calendar-event.tarea { background: var(--warn); }
.calendar-event.aviso { background: var(--muted); }
.calendar-event.override { box-shadow: inset 0 0 0 2px white, 0 0 0 1px var(--warn); }
.calendar-more {
  font-size: 0.7rem;
  color: var(--muted);
  cursor: pointer;
}

/* ── Slots de disponibilidad / reserva ──────────────────────────────── */

.slot-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.slot-card.booked {
  background: var(--bg-soft);
  border-color: var(--line);
  opacity: 0.65;
}
.slot-card .slot-when strong { font-size: 0.95rem; color: var(--brand-dark); display: block; }
.slot-card .slot-when small { color: var(--muted); }

.event-list {
  display: grid;
  gap: 10px;
}
.event-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
}
.event-row.tutoria { border-left-color: var(--accent); }
.event-row.tarea { border-left-color: var(--warn); }
.event-row.aviso { border-left-color: var(--muted); }
.event-row .when {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--brand-dark);
}
.event-row .when strong { display: block; font-size: 1.15rem; }
.event-row .actions { display: flex; gap: 6px; }

.day-of-week-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.day-of-week-row .chip {
  justify-content: center;
}

/* ── Drag & drop upload ─────────────────────────────────────────────── */

.dropzone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  background: var(--bg-soft);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--brand);
  background: rgba(27, 153, 139, 0.05);
  color: var(--brand-dark);
}
.dropzone strong { display: block; color: var(--brand-dark); margin-bottom: 4px; }
.dropzone .help { display: block; margin-top: 6px; font-size: 0.78rem; }
.dropzone-files {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.file-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.88rem;
}
.file-pill .icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg-soft);
  display: grid; place-items: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.file-pill .meta { flex: 1; min-width: 0; }
.file-pill .meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pill .meta small { color: var(--muted); }
.file-pill .actions { display: flex; gap: 6px; }

/* ── Rúbrica ─────────────────────────────────────────────────────────── */

.rubric-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 10px;
  margin-bottom: 8px;
}
.rubric-row label { margin-bottom: 0; }

.score-cell {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
}
.score-cell label { margin-bottom: 0; }
.score-cell .weight {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.score-summary {
  background: linear-gradient(135deg, rgba(27, 153, 139,0.08), rgba(27, 153, 139,0.06));
  border: 1px solid rgba(27, 153, 139,0.2);
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
}
.score-summary .num {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--ok);
  font-family: "Plus Jakarta Sans", sans-serif;
}
.score-summary .num.warn { color: var(--warn); }
.score-summary .num.danger { color: var(--danger); }

/* ── Topic / syllabus ──────────────────────────────────────────────── */

.topic-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--panel);
  margin-bottom: 8px;
}
.topic-card .top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.topic-card .top strong { display: block; color: var(--brand-dark); font-size: 0.95rem; }
.topic-card .top small { color: var(--muted); }
.topic-card .meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0;
}
.topic-attachments {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.topic-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: 8px;
  font-size: 0.84rem;
}
.topic-attachment .icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: white;
  display: grid; place-items: center;
  font-size: 0.92rem;
}
.topic-attachment .info { flex: 1; min-width: 0; }
.topic-attachment .info strong { display: block; overflow: hidden; text-overflow: ellipsis; }

.kind-pdf      { background: #fff0f0; }
.kind-audio    { background: #fff4dd; }
.kind-video    { background: #e9efff; }
.kind-imagen   { background: #e9fff8; }
.kind-documento, .kind-texto { background: var(--bg-soft); }

/* ── Filtros de categoría (chips) ───────────────────────────────────── */

.category-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.category-bar button {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: white;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
}
.category-bar button:hover { border-color: var(--brand); color: var(--brand-dark); }
.category-bar button.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

/* ── Chat ─────────────────────────────────────────────────────────────── */

.chat-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  min-height: 580px;
}
.chat-threads {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.chat-threads .thread-row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  font-size: 0.86rem;
}
.chat-threads .thread-row:hover { background: var(--bg-soft); }
.chat-threads .thread-row.active { background: rgba(27, 153, 139,0.07); border-left: 3px solid var(--brand); padding-left: 11px; }
.chat-threads .thread-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-threads .thread-row small { color: var(--muted); }

.chat-pane {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, var(--bg-soft), white);
  min-height: 380px;
  max-height: 540px;
}
.chat-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.42;
  white-space: pre-wrap;
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--brand);
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
  align-self: flex-start;
  background: white;
  border: 1px solid var(--line);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-bubble small {
  display: block;
  margin-top: 4px;
  opacity: 0.65;
  font-size: 0.7rem;
}
.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: white;
}
.chat-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.92rem;
  min-height: 44px;
  max-height: 140px;
}

/* ── Mini-gráficas SVG ──────────────────────────────────────────────── */

.minichart {
  width: 100%;
  display: block;
}
.minichart .axis { stroke: var(--line); stroke-width: 1; }
.minichart .grid { stroke: var(--line-soft); stroke-width: 1; }
.minichart .label { fill: var(--muted); font-size: 10px; }
.minichart .bar { fill: var(--brand); transition: fill 0.15s; }
.minichart .bar:hover { fill: var(--brand-dark); }
.minichart .line { fill: none; stroke: var(--brand); stroke-width: 2; }
.minichart .area { fill: var(--brand); fill-opacity: 0.12; }
.minichart .point { fill: var(--brand-dark); }
.minichart .threshold { stroke: var(--ok); stroke-dasharray: 4 4; }

.chart-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.chart-card h3 { font-size: 0.95rem; margin-bottom: 8px; }
.chart-card .legend {
  display: flex;
  gap: 14px;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
}
.chart-card .legend i {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 4px;
}

/* ── Trámites ────────────────────────────────────────────────────────── */

.procedure-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  border-left: 4px solid var(--line);
}
.procedure-row.urgente { border-left-color: var(--danger); background: rgba(196,60,60,0.04); }
.procedure-row.completado { border-left-color: var(--ok); opacity: 0.75; }
.procedure-row.en.curso, .procedure-row.en-curso { border-left-color: var(--warn); }
.procedure-row .icon-big {
  font-size: 1.3rem;
  width: 36px; height: 36px;
  background: var(--bg-soft);
  border-radius: 8px;
  display: grid; place-items: center;
}
.procedure-row .info strong { display: block; color: var(--brand-dark); }
.procedure-row .info small { color: var(--muted); }

/* ── Planes / suscripciones ─────────────────────────────────────────── */

.plan-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.plan-card.current {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(27, 153, 139,0.1);
}
.plan-card .price {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--brand-dark);
  font-family: "Plus Jakarta Sans", sans-serif;
}
.plan-card .price small { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.plan-card .features { list-style: none; padding: 0; font-size: 0.86rem; flex: 1; }
.plan-card .features li { padding: 4px 0; color: var(--muted); }
.plan-card .features li::before { content: "✓ "; color: var(--ok); font-weight: 800; }

.hidden { display: none; }

/* ─── Diferenciación visual por rol (transcripción ~20:28) ──────────────── */

/* superadmin: morado oscuro corporativo */
body.role-superadmin .sidebar {
  background: linear-gradient(180deg, #2a1245, #160827);
}
body.role-superadmin .sidebar .org-badge {
  background: rgba(170, 100, 255, 0.12);
  border-left: 3px solid #a965ff;
}

/* admin (academia): azul (color por defecto) - sin override */

/* preparador: verde profesor */
body.role-preparador .sidebar {
  background: linear-gradient(180deg, #0a3a2a, #051c14);
}
body.role-preparador .sidebar .brand-mark {
  background: #1B998B !important;
}
body.role-preparador .sidebar .org-badge {
  background: rgba(27, 153, 139, 0.18);
  border-left: 3px solid #1B998B;
}
body.role-preparador .sidebar .nav button.active {
  background: rgba(27, 153, 139, 0.22);
  color: #67e3b6;
}

/* opositor: cálido (mantiene el color de la academia, pero con header
   más claro para sentirlo más alegre y distinto del preparador) */
body.role-opositor .sidebar {
  background: linear-gradient(180deg, #1a3d6e, #0B2545);
}
body.role-opositor .sidebar .org-badge {
  background: rgba(255, 200, 70, 0.12);
  border-left: 3px solid #ffc846;
}

/* Etiqueta visible junto al avatar de cada rol (en el sidebar) */
body.role-preparador .org-badge::after {
  content: "👨‍🏫 Preparador";
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  color: #67e3b6;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
body.role-opositor .org-badge::after {
  content: "🎓 Opositor";
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  color: #ffc846;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
body.role-admin .org-badge::after {
  content: "🏛️ Administrador";
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.75);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
body.role-superadmin .org-badge::after {
  content: "🛠️ Superadmin";
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  color: #d8b6ff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Tabs (ya existían pero faltaba el estilo base si no estaba) */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button {
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tabs button.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* File pill: usado en correcciones, registry de trámites, etc. */
.file-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 8px;
  background: var(--surface, #fff);
}
.file-pill .icon { font-size: 1.4rem; }
.file-pill .meta { flex: 1; }
.file-pill .meta strong { display: block; font-size: 0.92rem; }
.file-pill .meta small { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 2px; }

/* Dropzone (transcripción adjuntos en ejercicios y trámites) */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 22px;
  margin-top: 10px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--brand);
  background: rgba(27, 153, 139, 0.04);
}
.dropzone strong { font-weight: 700; }
.dropzone span { font-size: 0.85rem; color: var(--muted); }
.dropzone-files { width: 100%; margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }


/* ─── FASE 6: Catálogo extendido ─────────────────────────────────────────── */

/* Mapa de calor del temario (catálogo §A.3) */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
  margin-top: 12px;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  padding: 8px 4px;
  text-align: center;
  font-size: 0.85rem;
  cursor: help;
  transition: transform 0.15s;
}
.heatmap-cell:hover { transform: scale(1.04); }
.heatmap-cell strong { font-size: 1.1rem; line-height: 1; }
.heatmap-cell small { font-size: 1.4rem; font-weight: 700; line-height: 1; margin: 4px 0 2px; }
.heatmap-cell em { font-style: normal; opacity: 0.8; font-size: 0.75rem; }

/* Pills con estado activo (simulacro: opciones, confianza) */
.pill.active,
button.pill.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

/* Texto justificado y sangría para .markdown del bienestar */
.markdown h4 { margin-top: 12px; margin-bottom: 6px; font-size: 0.95rem; }
.markdown ul { margin: 6px 0 6px 20px; }
.markdown li { margin: 3px 0; }
.markdown p { margin: 6px 0; }

/* Card "interna" — usada en biblioteca de bienestar dentro de un card */
.card-inner {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface, #fff);
}

/* Tabs (marketplace) */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 16px;
}
.tabs button {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* Barras de ROI en predictor */
.bar { transition: width 0.3s ease; }

/* Botón con texto a la izquierda (opciones del simulacro) */
button.text-left { text-align: left; }

/* ─── FASE 6 ampliada ───────────────────────────────────────────────────── */

/* Blockquote de testimonios de alumni */
blockquote {
  border-left: 3px solid var(--brand);
  padding: 4px 0 4px 12px;
  margin: 8px 0;
  font-style: italic;
  color: var(--muted);
  background: rgba(27, 153, 139, 0.04);
}

/* Botones disabled (sala llena) */
button[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Anchor con estilo de botón ghost (Mis certificaciones → ver SVG) */
a.ghost {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  background: var(--surface, #fff);
}
a.ghost:hover { background: rgba(27, 153, 139, 0.05); border-color: var(--brand); color: var(--brand); }
