/* Portal Estudiante v2.0 — Design Tokens + Estilos base */

:root {
  /* Base */
  --cream: #F4F0E6;
  --cream-dark: #E8E1D2;
  --teal: #6DC7D0;
  --teal-deep: #4BA8AA;
  --teal-shadow: #3A8F91;
  --teal-soft: #E8F6F7;
  --carbon: #1E2126;
  --carbon-light: #2A2E36;
  --carbon-soft: #3A3F47;
  --rail: #141619;
  --ink: #2A2A2A;
  --gray: #555555;
  --gray-light: #888888;
  --gray-soft: #B5B0A3;
  --line: #E8E1D2;
  --line-soft: #F0EBDF;

  /* Semáforo calificaciones */
  --green: #1D9E75;
  --green-soft: #E0F5EE;
  --green-deep: #157056;
  --green-bright: #2BB585;
  --yellow: #BA7517;
  --yellow-soft: #FBF1E0;
  --yellow-deep: #8E5810;
  --red: #A32D2D;
  --red-soft: #FBEAEA;
  --red-deep: #7A1F1F;

  /* Acento */
  --blue: #2C6FB8;
  --blue-soft: #E5EFFA;
  --gold: #D4A237;
  --gold-deep: #A87E1F;
  --purple: #7C5BC9;
  --purple-soft: #ECE5F8;
  --error: #A32D2D;

  /* NEM Campos Formativos */
  --campo-1: #D97D54;
  --campo-1-soft: #FCEEE7;
  --campo-2: #4BA8AA;
  --campo-2-soft: #E8F6F7;
  --campo-3: #B07FCB;
  --campo-3-soft: #ECE5F8;
  --campo-4: #4D8B5A;
  --campo-4-soft: #E5F2E8;

  /* Tipografía */
  --font-serif: 'Fraunces', serif;
  --font-sans: 'Figtree', sans-serif;
}

/* Reset para portal estudiante */
.portal-estudiante {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--cream);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.portal-estudiante * { box-sizing: border-box; }

/* Header */
.pe-header {
  background: var(--carbon);
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.pe-header .brand {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--font-serif);
}

.pe-header .brand .mi { font-weight: 600; font-size: 16px; }
.pe-header .brand .escolar { font-weight: 400; font-size: 14px; opacity: 0.7; }

.pe-header .header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pe-header .icon-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--carbon-light);
  border: 1px solid var(--carbon-soft);
  border-radius: 8px;
  padding: 6px 12px;
  color: #fff;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.pe-header .icon-btn:hover { background: var(--carbon-soft); }
.pe-header .icon-btn .material-symbols-rounded { font-size: 18px; }

.pe-header .back-btn {
  display: flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.pe-header .back-btn:hover { opacity: 1; }
.pe-header .back-btn .material-symbols-rounded { font-size: 22px; }

/* Footer */
.pe-footer {
  background: var(--carbon);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 40px 24px 32px;
  margin-top: auto;
}

.pe-footer h4 {
  font-family: var(--font-serif);
  font-size: 18px;
  color: #fff;
  margin: 0 0 8px;
}

.pe-footer p { font-size: 13px; margin: 0 0 16px; }

.pe-footer .support-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--teal);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s;
}

.pe-footer .support-cta:hover { background: var(--teal-deep); }
.pe-footer .support-cta .material-symbols-rounded { font-size: 18px; }

.pe-footer .copy {
  font-size: 11px;
  opacity: 0.5;
  margin-top: 24px;
}

/* Hero section */
.hero {
  background: var(--carbon);
  color: #fff;
  padding: 20px 24px 32px;
}

.hero-school {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--carbon-light);
  border: 1px solid var(--carbon-soft);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  margin-bottom: 16px;
}

.hero-school .material-symbols-rounded { font-size: 14px; opacity: 0.7; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  align-items: start;
}

.hero-greeting {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  margin: 0 0 6px;
  letter-spacing: -0.5px;
}

.hero-greeting .name { color: var(--teal); }

.hero-meta {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  margin: 0 0 16px;
}

.hero-meta strong { color: #fff; }

/* Period selector */
.period-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.period-bar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.55);
  display: flex;
  align-items: center;
  gap: 6px;
}

.period-bar-label .material-symbols-rounded { font-size: 14px; }

.period-selector {
  position: relative;
}

.period-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 12px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  color: white;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.period-trigger:hover { background: rgba(255,255,255,0.16); border-color: var(--teal); }
.period-trigger .material-symbols-rounded { font-size: 16px; }
.period-trigger .arrow { font-size: 18px; opacity: 0.8; transition: transform 0.2s; }
.period-selector.open .period-trigger .arrow { transform: rotate(180deg); }

.period-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
  min-width: 240px;
  padding: 6px;
  display: none;
  z-index: 30;
}

.period-selector.open .period-dropdown { display: block; }

.period-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray);
  transition: background 0.15s;
}

.period-option:hover { background: var(--cream); color: var(--ink); }
.period-option.active {
  background: var(--teal-soft);
  color: var(--teal-shadow);
  font-weight: 600;
}
.period-option .material-symbols-rounded { font-size: 14px; }

.period-option .badge-current {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  background: var(--teal);
  color: white;
  padding: 2px 6px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.period-option .check {
  margin-left: auto;
  color: var(--teal-deep);
  font-size: 16px;
  visibility: hidden;
}
.period-option.active .check { visibility: visible; }

/* Section headers */
.section-head {
  padding: 24px 24px 12px;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
}

.section-desc {
  font-size: 13px;
  color: var(--gray);
  margin: 0;
}

/* Narrative block */
.narrative {
  background: var(--carbon-light);
  border: 1px solid var(--carbon-soft);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 16px;
}

.narrative-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--teal);
  margin-bottom: 6px;
}

.narrative-text {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255,255,255,0.85);
}

.narrative-text .highlight-good { color: var(--green-bright); font-weight: 600; }
.narrative-text .highlight-bad { color: #E57373; font-weight: 600; }
.narrative-text .highlight-neutral { color: var(--teal); font-weight: 600; }

/* vs-prev chip */
.vs-prev-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
}

.vs-prev-chip.up {
  background: var(--green-soft);
  color: var(--green-deep);
  border-color: rgba(29,158,117,0.25);
}
.vs-prev-chip.down {
  background: var(--red-soft);
  color: var(--red-deep);
  border-color: rgba(163,45,45,0.20);
}
.vs-prev-chip.same {
  background: var(--line-soft);
  color: var(--gray);
  border-color: var(--line);
}
.vs-prev-chip.first {
  background: var(--purple-soft);
  color: var(--purple);
  border-color: rgba(124,91,201,0.20);
}
.vs-prev-chip .material-symbols-rounded {
  font-size: 13px;
  font-variation-settings: 'FILL' 1;
}
.vs-prev-chip .ref-grade {
  font-family: var(--font-serif);
  font-weight: 700;
  margin-left: 2px;
}

/* vs-prev block (hero comparativo) */
.vs-prev-block {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.vs-prev-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.vs-prev-icon.up { background: rgba(45,224,162,0.25); }
.vs-prev-icon.down { background: rgba(255,138,138,0.20); }
.vs-prev-icon.same { background: rgba(255,255,255,0.15); }
.vs-prev-icon .material-symbols-rounded {
  font-size: 20px;
  font-variation-settings: 'FILL' 1;
}
.vs-prev-icon.up .material-symbols-rounded { color: #5DDBA8; }
.vs-prev-icon.down .material-symbols-rounded { color: #FF8A8A; }
.vs-prev-icon.same .material-symbols-rounded { color: rgba(255,255,255,0.85); }
.vs-prev-content { flex: 1; min-width: 0; }
.vs-prev-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
  margin-bottom: 2px;
}
.vs-prev-message { font-size: 12px; line-height: 1.4; }
.vs-prev-message .diff {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  margin-right: 4px;
  letter-spacing: -0.01em;
}
.vs-prev-message .diff.up { color: #5DDBA8; }
.vs-prev-message .diff.down { color: #FF8A8A; }
.vs-prev-message .diff.same { color: rgba(255,255,255,0.95); }
.vs-prev-message .ref { opacity: 0.7; }

/* Grade circle */
.grade-circle-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.grade-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--teal-soft);
  border: 2px solid var(--teal);
}
.grade-circle.green { background: var(--green-soft); border-color: var(--green); }
.grade-circle.yellow { background: var(--yellow-soft); border-color: var(--yellow); }
.grade-circle.red { background: var(--red-soft); border-color: var(--red); }
.grade-value {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}
.grade-circle.green .grade-value { color: var(--green); }
.grade-circle.yellow .grade-value { color: var(--yellow); }
.grade-circle.red .grade-value { color: var(--red); }
.grade-label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray);
  margin-top: 1px;
}

/* Utility */
.pe-main { padding: 0 24px 40px; }

/* ===== MiClase: Report Hero ===== */
.report-hero {
  padding: 32px 28px 60px;
  position: relative; z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
}
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  margin-bottom: 18px;
}
.breadcrumb a { color: rgba(255,255,255,0.55); text-decoration: none; transition: color 0.2s; }
.breadcrumb a:hover { color: var(--teal); }
.breadcrumb .material-symbols-rounded { font-size: 14px; opacity: 0.6; }
.breadcrumb .current { color: white; font-weight: 500; }

.report-campo {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(109,199,208,0.15);
  border: 1px solid rgba(109,199,208,0.25);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--teal); text-transform: uppercase;
  margin-bottom: 18px;
}
.report-campo .material-symbols-rounded { font-size: 14px; }

.report-class-name {
  font-family: var(--font-serif);
  font-size: 44px; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.05;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap;
}
.report-class-name em { color: var(--teal); font-style: italic; }

.class-icon-large {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-deep) 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px rgba(75,168,170,0.4);
  flex-shrink: 0;
}
.class-icon-large .material-symbols-rounded {
  font-size: 30px; color: white;
  font-variation-settings: 'FILL' 1;
}

.report-meta {
  display: flex; flex-wrap: wrap;
  gap: 18px;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  margin-bottom: 20px;
}
.report-meta-item {
  display: flex; align-items: center; gap: 6px;
}
.report-meta-item .material-symbols-rounded { font-size: 16px; opacity: 0.8; }
.report-meta-item strong { color: white; font-weight: 600; }

/* Grade Panel (big, en hero de MiClase) */
.grade-panel {
  background: linear-gradient(145deg, var(--green) 0%, var(--green-deep) 100%);
  border-radius: 22px;
  padding: 24px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(29,158,117,0.4);
}
.grade-panel.yellow {
  background: linear-gradient(145deg, var(--yellow) 0%, var(--yellow-deep) 100%);
  box-shadow: 0 16px 40px rgba(186,117,23,0.4);
}
.grade-panel.red {
  background: linear-gradient(145deg, var(--red) 0%, var(--red-deep) 100%);
  box-shadow: 0 16px 40px rgba(163,45,45,0.4);
}
.grade-panel::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  pointer-events: none;
}
.grade-panel-content { position: relative; z-index: 1; }
.grade-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.grade-panel .grade-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  opacity: 0.85; margin-bottom: 4px;
  color: white;
}
.grade-big-row { display: flex; align-items: baseline; gap: 6px; }
.grade-big {
  font-family: var(--font-serif);
  font-size: 68px; font-weight: 700;
  line-height: 0.9; letter-spacing: -0.04em;
}
.grade-max { font-size: 22px; font-weight: 500; opacity: 0.65; }
.grade-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px;
  background: rgba(255,255,255,0.18);
  border-radius: 999px; margin-top: 8px;
}
.grade-status .material-symbols-rounded {
  font-size: 14px; font-variation-settings: 'FILL' 1;
}

/* Prediction */
.prediction {
  background: rgba(0,0,0,0.18);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 14px;
}
.prediction-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  opacity: 0.7; margin-bottom: 4px;
  display: flex; align-items: center; gap: 4px;
}
.prediction-label .material-symbols-rounded { font-size: 13px; }
.prediction-value-row { display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px; }
.prediction-value {
  font-family: var(--font-serif);
  font-size: 26px; font-weight: 600; line-height: 1;
}
.prediction-trend { font-size: 11px; opacity: 0.85; }
.prediction-bar {
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 999px; overflow: hidden; margin-top: 8px;
}
.prediction-fill {
  height: 100%;
  background: linear-gradient(90deg, white, rgba(255,255,255,0.6));
  border-radius: 999px;
}
.prediction-tip { font-size: 11px; opacity: 0.85; margin-top: 8px; line-height: 1.4; }

/* ===== Stats Row ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: white;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 18px 20px;
  position: relative; overflow: hidden;
}
.stat-card-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.stat-card.attendance .stat-card-icon { background: var(--green-soft); color: var(--green); }
.stat-card.pending .stat-card-icon { background: var(--yellow-soft); color: var(--yellow); }
.stat-card.delivered .stat-card-icon { background: var(--teal-soft); color: var(--teal-shadow); }
.stat-card.absences .stat-card-icon { background: var(--red-soft); color: var(--red); }
.stat-card-icon .material-symbols-rounded { font-size: 20px; font-variation-settings: 'FILL' 1; }
.stat-card-value-row { display: flex; align-items: baseline; gap: 6px; }
.stat-card-value {
  font-family: var(--font-serif);
  font-size: 30px; font-weight: 600;
  color: var(--ink); line-height: 1; letter-spacing: -0.01em;
}
.stat-card-unit { font-size: 13px; font-weight: 500; color: var(--gray-light); }
.stat-card-label { font-size: 12px; font-weight: 600; color: var(--gray); margin-top: 6px; }
.stat-card-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600;
  margin-top: 8px; padding: 2px 7px; border-radius: 999px;
}
.stat-card-trend.up { background: var(--green-soft); color: var(--green-deep); }
.stat-card-trend.down { background: var(--red-soft); color: var(--red-deep); }
.stat-card-trend.neutral { background: var(--line-soft); color: var(--gray); }
.stat-card-trend .material-symbols-rounded { font-size: 13px; }

/* ===== Heatmap Calendar ===== */
.panel {
  background: white;
  border-radius: 18px;
  border: 1px solid var(--line);
  overflow: hidden;
  margin-bottom: 24px;
}
.panel-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.panel-head h2 {
  font-family: var(--font-serif);
  font-size: 19px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
.panel-head h2 .material-symbols-rounded { font-size: 22px; color: var(--teal-deep); font-variation-settings: 'FILL' 1; }
.panel-head .head-meta { font-size: 12px; color: var(--gray-light); }
.panel-head .pill-info {
  background: var(--teal-soft); color: var(--teal-shadow);
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
}

.heatmap-body { padding: 24px; }
.heatmap-summary {
  display: flex; gap: 24px; flex-wrap: wrap;
  margin-bottom: 20px; padding-bottom: 20px;
  border-bottom: 1px dashed var(--line);
}
.heatmap-summary-value {
  font-family: var(--font-serif);
  font-size: 22px; font-weight: 600; color: var(--ink); line-height: 1;
}
.heatmap-summary-label {
  font-size: 11px; font-weight: 600; color: var(--gray);
  text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px;
}

.heatmap-grid { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.heatmap-month { flex: 1; min-width: 180px; }
.heatmap-month-label {
  font-family: var(--font-serif);
  font-size: 13px; font-weight: 600; color: var(--gray);
  margin-bottom: 8px; text-transform: capitalize;
}
.heatmap-cells { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.heatmap-cell {
  aspect-ratio: 1; border-radius: 4px;
  background: #F0EBDF; border: 1px solid #E8E1D2;
  position: relative; cursor: pointer; transition: transform 0.15s;
}
.heatmap-cell:hover { transform: scale(1.4); z-index: 3; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.heatmap-cell.no-class { background: transparent; border: 1px dashed #E0DACA; opacity: 0.4; }
.heatmap-cell.attended { background: var(--teal-soft); border-color: rgba(75,168,170,0.3); }
.heatmap-cell.delivered-1 { background: #B5E5E8; border-color: rgba(75,168,170,0.5); }
.heatmap-cell.delivered-2 { background: #6DC7D0; border-color: var(--teal-deep); }
.heatmap-cell.delivered-3 { background: var(--teal-deep); border-color: var(--teal-shadow); }
.heatmap-cell.absent { background: var(--red-soft); border-color: rgba(163,45,45,0.4); }
.heatmap-cell.late { background: var(--yellow-soft); border-color: rgba(186,117,23,0.4); }
.heatmap-cell.absent::after, .heatmap-cell.late::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); width: 5px; height: 5px; border-radius: 50%;
}
.heatmap-cell.absent::after { background: var(--red); }
.heatmap-cell.late::after { background: var(--yellow); }
.heatmap-cell.has-note::before {
  content: ''; position: absolute; top: 2px; right: 2px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--purple);
}
.heatmap-cell.today { border: 2px solid var(--carbon); box-shadow: 0 0 0 2px var(--cream); }

.heatmap-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 11px; color: var(--gray);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line); }
.legend-swatch.no-class { border-style: dashed; background: transparent; }
.legend-swatch.attended { background: var(--teal-soft); border-color: rgba(75,168,170,0.3); }
.legend-swatch.delivered { background: var(--teal-deep); }
.legend-swatch.absent { background: var(--red-soft); position: relative; }
.legend-swatch.absent::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); width: 4px; height: 4px; border-radius: 50%; background: var(--red);
}
.legend-swatch.late { background: var(--yellow-soft); position: relative; }
.legend-swatch.late::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); width: 4px; height: 4px; border-radius: 50%; background: var(--yellow);
}
.legend-swatch.has-note { position: relative; background: var(--cream); }
.legend-swatch.has-note::before {
  content: ''; position: absolute; top: 2px; right: 2px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--purple);
}

/* ===== Badges ===== */
.badges-section {
  background: linear-gradient(135deg, #FAF7EE 0%, #F5F0E0 100%);
  border-radius: 18px; border: 1px solid var(--line);
  padding: 24px; margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.badges-section::before {
  content: ''; position: absolute; top: -80px; right: -80px;
  width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(212,162,55,0.15) 0%, rgba(212,162,55,0) 70%);
  pointer-events: none;
}
.badges-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; position: relative; z-index: 1;
}
.badges-head h2 {
  font-family: var(--font-serif); font-size: 19px; font-weight: 600;
  color: var(--ink); display: flex; align-items: center; gap: 10px;
}
.badges-head h2 .material-symbols-rounded { font-size: 22px; color: var(--gold-deep); font-variation-settings: 'FILL' 1; }
.badges-progress { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--gray); font-weight: 500; }
.badges-progress strong { font-family: var(--font-serif); color: var(--gold-deep); font-weight: 700; font-size: 14px; }
.badges-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; position: relative; z-index: 1;
}
.badge-card {
  background: white; border-radius: 14px; padding: 14px 12px;
  text-align: center; border: 1px solid var(--line);
  transition: all 0.2s; position: relative;
}
.badge-card.unlocked:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.badge-card.locked { opacity: 0.5; background: rgba(255,255,255,0.5); border-style: dashed; }
.badge-icon {
  width: 48px; height: 48px; margin: 0 auto 8px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: white; box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}
.badge-card.unlocked .badge-icon.gold { background: linear-gradient(135deg, #F4C45A 0%, var(--gold-deep) 100%); }
.badge-card.unlocked .badge-icon.silver { background: linear-gradient(135deg, #D8D8D8 0%, #888 100%); }
.badge-card.unlocked .badge-icon.teal { background: linear-gradient(135deg, var(--teal) 0%, var(--teal-shadow) 100%); }
.badge-card.unlocked .badge-icon.green { background: linear-gradient(135deg, var(--green-bright) 0%, var(--green-deep) 100%); }
.badge-card.unlocked .badge-icon.purple { background: linear-gradient(135deg, #A085D6 0%, var(--purple) 100%); }
.badge-card.locked .badge-icon { background: var(--line); color: var(--gray-light); box-shadow: none; }
.badge-icon .material-symbols-rounded { font-size: 26px; font-variation-settings: 'FILL' 1; }
.badge-name { font-family: var(--font-serif); font-size: 12px; font-weight: 600; color: var(--ink); line-height: 1.2; margin-bottom: 3px; }
.badge-card.locked .badge-name { color: var(--gray-light); }
.badge-desc { font-size: 10px; color: var(--gray); line-height: 1.3; }
.badge-card.locked .badge-desc { color: var(--gray-light); }
.badge-new {
  position: absolute; top: -6px; right: -6px;
  background: var(--red); color: white;
  font-size: 9px; font-weight: 700; padding: 2px 6px;
  border-radius: 999px; letter-spacing: 0.04em;
}

/* ===== Improvement Plan + Comparison ===== */
.insights-grid {
  display: grid; grid-template-columns: 1.3fr 1fr;
  gap: 18px; margin-bottom: 24px;
}
.improvement-plan {
  background: linear-gradient(135deg, #F0FBFC 0%, #E8F6F7 100%);
  border-radius: 18px; border: 1px solid #C8E9EC; padding: 24px;
}
.improvement-plan-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.improvement-plan-head h3 { font-family: var(--font-serif); font-size: 18px; font-weight: 600; color: var(--ink); }
.improvement-plan-head .material-symbols-rounded { font-size: 22px; color: var(--teal-deep); font-variation-settings: 'FILL' 1; }
.improvement-plan-sub { font-size: 12px; color: var(--gray); margin-bottom: 18px; }
.improvement-target {
  background: white; border-radius: 12px; padding: 14px 16px;
  margin-bottom: 14px; border: 1.5px dashed var(--teal); text-align: center;
}
.improvement-target-label { font-size: 10px; font-weight: 700; color: var(--gray); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.improvement-target-value { font-family: var(--font-serif); font-size: 28px; font-weight: 700; color: var(--teal-deep); line-height: 1; }
.improvement-target-text { font-size: 11px; color: var(--gray); margin-top: 4px; }
.improvement-actions { display: flex; flex-direction: column; gap: 8px; }
.improvement-action {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; background: rgba(255,255,255,0.7);
  border-radius: 10px; border-left: 3px solid var(--teal);
}
.improvement-action-icon {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--teal); color: white;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.improvement-action-icon .material-symbols-rounded { font-size: 14px; font-weight: 700; }
.improvement-action-text { font-size: 12px; color: var(--gray); line-height: 1.5; flex: 1; }
.improvement-action-text strong { color: var(--ink); font-weight: 600; }

/* Comparison */
.comparison { background: white; border-radius: 18px; border: 1px solid var(--line); padding: 24px; }
.comparison-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.comparison-head h3 { font-family: var(--font-serif); font-size: 18px; font-weight: 600; color: var(--ink); }
.comparison-head .material-symbols-rounded { font-size: 22px; color: var(--purple); font-variation-settings: 'FILL' 1; }
.comparison-sub { font-size: 12px; color: var(--gray); margin-bottom: 18px; }
.comparison-bars { display: flex; flex-direction: column; gap: 12px; }
.comparison-row { display: flex; align-items: center; gap: 12px; }
.comparison-row-label { font-size: 12px; font-weight: 600; color: var(--gray); min-width: 60px; }
.comparison-bar { flex: 1; height: 22px; background: var(--line-soft); border-radius: 999px; position: relative; overflow: hidden; }
.comparison-fill { height: 100%; border-radius: 999px; transition: width 0.4s; position: absolute; top: 0; left: 0; }
.comparison-fill.you { background: linear-gradient(90deg, var(--teal-deep) 0%, var(--teal) 100%); }
.comparison-fill.group { background: rgba(124,91,201,0.25); }
.comparison-row-value { font-family: var(--font-serif); font-size: 13px; font-weight: 700; color: var(--ink); min-width: 36px; text-align: right; }
.comparison-position {
  margin-top: 16px; padding: 12px 14px;
  background: var(--purple-soft); border-radius: 10px;
  display: flex; align-items: center; gap: 10px;
}
.comparison-position-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--purple); color: white;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.comparison-position-icon .material-symbols-rounded { font-size: 18px; font-variation-settings: 'FILL' 1; }
.comparison-position-text { font-size: 12px; color: var(--gray); line-height: 1.4; }
.comparison-position-text strong { font-family: var(--font-serif); color: var(--purple); font-weight: 700; }

/* ===== Upcoming Dates ===== */
.upcoming {
  background: var(--carbon); color: white;
  border-radius: 18px; padding: 24px;
  margin-bottom: 24px; position: relative; overflow: hidden;
}
.upcoming::before {
  content: ''; position: absolute; top: -100px; right: -100px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(244,196,90,0.10) 0%, rgba(244,196,90,0) 70%);
  pointer-events: none;
}
.upcoming-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; position: relative; z-index: 1;
}
.upcoming-head h2 {
  font-family: var(--font-serif); font-size: 19px; font-weight: 600; color: white;
  display: flex; align-items: center; gap: 10px;
}
.upcoming-head h2 .material-symbols-rounded { font-size: 22px; color: #F4C45A; font-variation-settings: 'FILL' 1; }
.upcoming-head .pill {
  background: rgba(244,196,90,0.18); color: #F4C45A;
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
}
.upcoming-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px; position: relative; z-index: 1;
}
.upcoming-item {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px; padding: 14px;
  display: flex; align-items: flex-start; gap: 12px;
}
.upcoming-date {
  background: white; color: var(--carbon); border-radius: 10px;
  padding: 6px 8px; text-align: center; flex-shrink: 0; min-width: 50px;
}
.upcoming-date-day { font-family: var(--font-serif); font-size: 22px; font-weight: 700; line-height: 0.9; }
.upcoming-date-month { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray); margin-top: 2px; }
.upcoming-content { flex: 1; min-width: 0; }
.upcoming-type {
  display: inline-block; font-size: 9px; font-weight: 700;
  color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px;
}
.upcoming-type.exam { color: #FF8A8A; }
.upcoming-type.delivery { color: var(--teal); }
.upcoming-type.event { color: #F4C45A; }
.upcoming-title { font-size: 13px; font-weight: 600; color: white; margin-bottom: 2px; line-height: 1.3; }
.upcoming-when { font-size: 11px; color: rgba(255,255,255,0.6); }

/* ===== Criteria ===== */
.criteria-list { padding: 6px 0; }
.criterion { padding: 18px 24px; border-bottom: 1px solid var(--line-soft); transition: background 0.15s; }
.criterion:last-child { border-bottom: none; }
.criterion:hover { background: #FCFAF5; }
.criterion-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 12px; }
.criterion-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.criterion-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--teal-soft); color: var(--teal-shadow);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.criterion-icon .material-symbols-rounded { font-size: 18px; font-variation-settings: 'FILL' 1; }
.criterion-text { flex: 1; min-width: 0; }
.criterion-name { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 1px; }
.criterion-weight { font-size: 11px; color: var(--gray-light); }
.criterion-grade { font-family: var(--font-serif); font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1; flex-shrink: 0; }
.criterion-grade.green { color: var(--green); }
.criterion-grade.yellow { color: var(--yellow); }
.criterion-grade.red { color: var(--red); }
.criterion-grade-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }

.progress-bar { height: 8px; background: var(--line-soft); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.progress-fill { height: 100%; background: var(--teal); border-radius: 999px; transition: width 0.4s; }
.progress-fill.green { background: linear-gradient(90deg, var(--green) 0%, var(--green-bright) 100%); }
.progress-fill.yellow { background: linear-gradient(90deg, var(--yellow) 0%, #D49230 100%); }
.progress-fill.red { background: linear-gradient(90deg, var(--red) 0%, #C84545 100%); }
.progress-fill.empty { background: var(--gray-soft); }

.activities-detail { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-top: 8px; }
.activity-mini {
  background: #FCFAF5; border: 1px solid var(--line-soft); border-radius: 10px;
  padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.activity-mini-name { font-size: 12px; font-weight: 500; color: var(--gray); line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.activity-mini-grade { font-family: var(--font-serif); font-size: 16px; font-weight: 700; flex-shrink: 0; }
.activity-mini-grade.g { color: var(--green); }
.activity-mini-grade.y { color: var(--yellow); }
.activity-mini-grade.r { color: var(--red); }
.activity-mini.empty { background: white; border-style: dashed; }
.activity-mini.empty .activity-mini-name { color: var(--gray-light); font-style: italic; }
.activity-mini.empty .activity-mini-grade { color: var(--gray-light); }

/* ===== Side Cards (Faltas, Reportes, Observaciones) ===== */
.grid-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: start; }
.side-card { background: white; border-radius: 18px; border: 1px solid var(--line); overflow: hidden; margin-bottom: 18px; }
.side-card-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.side-card-head h3 {
  font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.side-card-head h3 .material-symbols-rounded { font-size: 18px; font-variation-settings: 'FILL' 1; }
.side-card-head h3 .material-symbols-rounded.absences { color: var(--red); }
.side-card-head h3 .material-symbols-rounded.reports { color: var(--yellow); }
.side-card-head h3 .material-symbols-rounded.notes { color: var(--purple); }
.side-card-head .count-pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.side-card-head .count-pill.danger { background: var(--red-soft); color: var(--red-deep); }
.side-card-head .count-pill.warn { background: var(--yellow-soft); color: var(--yellow-deep); }
.side-card-head .count-pill.info { background: var(--purple-soft); color: var(--purple); }
.side-list { max-height: 320px; overflow-y: auto; }
.side-item { padding: 12px 20px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: flex-start; gap: 10px; }
.side-item:last-child { border-bottom: none; }
.side-item-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.side-item-dot.red { background: var(--red); }
.side-item-dot.yellow { background: var(--yellow); }
.side-item-dot.purple { background: var(--purple); }
.side-item-content { flex: 1; min-width: 0; }
.side-item-title { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.side-item-desc { font-size: 12px; color: var(--gray); line-height: 1.4; }
.side-item-date { font-size: 11px; color: var(--gray-light); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.side-item-date .material-symbols-rounded { font-size: 12px; }
.empty-state { padding: 28px 20px; text-align: center; color: var(--gray-light); }
.empty-state .material-symbols-rounded { font-size: 32px; opacity: 0.4; margin-bottom: 6px; display: block; }
.empty-state-text { font-size: 12px; }

/* ===== Responsive ===== */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .grid-layout { grid-template-columns: 1fr; }
  .insights-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .report-class-name { font-size: 32px; }
}

@media (max-width: 768px) {
  .pe-header { padding: 10px 16px; }
  .hero { padding: 16px 16px 24px; }
  .pe-main { padding: 0 16px 32px; }
  .section-head { padding: 20px 16px 10px; }
}

@media (max-width: 600px) {
  .report-hero { padding: 22px 18px 50px; }
  .report-class-name { font-size: 26px; gap: 12px; }
  .class-icon-large { width: 46px; height: 46px; }
  .class-icon-large .material-symbols-rounded { font-size: 24px; }
  .report-meta { font-size: 12px; gap: 12px; }
  .grade-big { font-size: 56px; }
  .stat-card { padding: 14px 16px; }
  .stat-card-value { font-size: 24px; }
  .panel-head, .heatmap-body { padding: 16px 18px; }
  .badges-section { padding: 18px; }
  .improvement-plan, .comparison, .upcoming { padding: 18px; }
  .criterion { padding: 14px 18px; }
  .activities-detail { grid-template-columns: 1fr 1fr; }
  .heatmap-month { min-width: 150px; }
}

@media (max-width: 480px) {
  .hero-greeting { font-size: 22px; }
}

/* Print */
@media print {
  .pe-header .header-actions,
  .pe-footer { display: none; }
  .hero { background: #fff; color: #000; }
}
