/* ==========================================================================
   EduTrack — Parent grades portal. Brand: white · Inter · crimson #960E0B.
   Mobile-first (parents mostly on phones).
   ========================================================================== */
:root {
  --brand: #960e0b;
  --brand-hover: #7a0b08;
  --ink: #222;
  --ink-strong: #1c1917;
  --muted: #6a6a6a;
  --line: #ddd;
  --line-soft: #ebebeb;
  --bg: #fafafa;
  --card: #fff;
  --paper: #f7efe6;        /* warm accent surface (from the login) */
  --paper-line: #eadfce;   /* border on paper surfaces */
  --sans: "Inter", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  --display: "Cormorant Garamond", Georgia, "Times New Roman", serif; /* editorial headings */
  /* ---- brand-manual tokens (header + student summary handoff) ---- */
  --navy: #232D75; --navy-700: #1B2360; --navy-50: #F2F3F9;
  --sky: #6EB6E6; --sky-50: #F0F7FC;
  --red-50: #FBF3F2; --yellow-50: #FCF7E3; --green-50: #EAF4EE;
  --ok: #2E8B57; --ocre: #8A6D00;
  --charcoal: #444242; --gray-600: #6B6A6E; --gray-100: #E3E3E3; --page: #F5F5F5;
  --f-display: "Syncopate", "Arial Black", sans-serif;
  --f-subhead: "Poppins", "Helvetica Neue", sans-serif;
  --f-body: "Nunito", "Segoe UI", sans-serif;
  /* grade scale */
  --s-high: #1a7f4b; --s-high-bg: #e7f4ec;
  --s-good: #1f6f8b; --s-good-bg: #e6f1f5;
  --s-mid:  #9a6a11; --s-mid-bg:  #f7efdd;
  --s-low:  #c13515; --s-low-bg:  #fbe9e4;
  --s-none: #7a7a7a; --s-none-bg: #f0f0f0;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--sans); color: var(--ink); background: var(--page);
  font-size: 15px; letter-spacing: -0.1px; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--s-low); font-size: 13px; margin-top: 6px; }
button { font-family: inherit; cursor: pointer; }

/* ---- buttons ---- */
.btn { font-size: 15px; font-weight: 500; border: 1px solid transparent; border-radius: 8px;
  padding: 0 18px; height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .13s, border-color .13s, color .13s; }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--ink); }
.btn-outline:hover { background: #f5f5f5; }
.btn-sm { height: 38px; padding: 0 14px; font-size: 14px; }

/* ---- login ---- */
.login-view { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line);
  border-radius: 20px; padding: 40px 32px; text-align: center;
  box-shadow: rgba(0,0,0,.03) 0 1px 3px, rgba(0,0,0,.06) 0 10px 34px; }
.login-logo { width: 220px; height: auto; margin: 0 auto 22px; display: block; }
.login-card h1 { font-size: 25px; font-weight: 700; letter-spacing: -0.6px; color: var(--brand); }
.login-card > p { margin-top: 8px; }
.btn-google { width: 100%; margin-top: 26px; height: 52px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font-size: 16px; font-weight: 600; display: flex; align-items: center;
  justify-content: center; gap: 12px; transition: box-shadow .15s, border-color .15s; }
.btn-google:hover { box-shadow: rgba(0,0,0,.08) 0 3px 12px; border-color: #c9c9c9; }
.btn-google svg { width: 20px; height: 20px; }
.fineprint { font-size: 12.5px; margin-top: 20px; line-height: 1.5; }

/* ---- login: editorial split (sibling of the SIS front door) ---- */
.login-split { display: grid; grid-template-columns: 1fr 1.15fr; min-height: 100vh; }
.ls-form { display: flex; flex-direction: column; justify-content: space-between; padding: 40px 64px; background: #fff; }
.ls-lockup { display: flex; align-items: center; gap: 18px; }
.ls-logo { height: 56px; width: auto; display: block; }
.ls-divider { width: 1px; height: 32px; background: #e7e2dd; display: block; flex: none; }
.ls-kicker { font-family: var(--sans); font-size: 10px; font-weight: 600; line-height: 1.6; color: #78716c; letter-spacing: 2.2px; }
.ls-center { width: 100%; max-width: 400px; }
.ls-eyebrow { font-family: var(--display); font-style: italic; font-weight: 500; font-size: 22px; color: var(--brand); line-height: 1; }
.ls-title { font-family: var(--display); font-weight: 400; font-size: 46px; line-height: 1.04; color: var(--ink-strong); letter-spacing: 0; margin-top: 4px; }
.ls-lead { font-family: var(--sans); font-size: 15px; font-weight: 400; line-height: 1.65; color: #57534e; margin-top: 14px; }
.ls-google { width: 100%; height: 56px; margin-top: 36px; background: #fff; border: 1px solid #c7bda6; border-radius: 2px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 12px; font-family: var(--sans); font-size: 15px; font-weight: 600; color: var(--ink-strong);
  transition: background .15s ease, border-color .15s ease, transform .3s cubic-bezier(.22,.61,.36,1), box-shadow .3s cubic-bezier(.22,.61,.36,1); }
.ls-google:hover { background: var(--paper); border-color: var(--ink-strong); transform: translateY(-2px); box-shadow: 0 12px 28px -14px rgba(28,25,23,0.3); }
.ls-google svg { width: 19px; height: 19px; flex: none; }
.ls-error { font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--s-low); margin-top: 12px; }
.ls-notice { display: flex; align-items: center; gap: 10px; background: var(--paper); border-radius: 2px; padding: 14px 16px; margin-top: 22px;
  font-family: var(--sans); font-size: 13px; line-height: 1.5; color: #57534e; }
.ls-notice svg { width: 15px; height: 15px; color: var(--brand); flex: none; }
.ls-notice b { color: var(--ink-strong); font-weight: 600; }
.ls-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-family: var(--sans); font-size: 12px; color: #a9a29d; }
.ls-foot a { color: #78716c; transition: color .15s ease; }
.ls-foot a:hover { color: var(--brand); }
.ls-photo { position: relative; overflow: hidden; background: #14100f; }
.ls-photo-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.62; }
.ls-photo-shade { position: absolute; inset: 0; background: linear-gradient(200deg, rgba(20,16,15,0.1) 0%, rgba(20,16,15,0.68) 100%); }
.ls-caption { position: absolute; left: 56px; right: 56px; bottom: 56px; }
.ls-cap-eyebrow { font-family: var(--display); font-style: italic; font-weight: 500; font-size: 22px; color: rgba(255,255,255,0.85); line-height: 1; }
.ls-cap-title { font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 1.08; color: #fff; max-width: 480px; margin-top: 6px; }
.ls-cap-meta { display: flex; align-items: center; gap: 14px; margin-top: 18px; font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: 2px; color: rgba(255,255,255,0.7); }
.ls-rule { width: 34px; height: 2px; background: var(--brand); display: block; flex: none; }
@keyframes lsRise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
.ls-lockup, .ls-eyebrow, .ls-title, .ls-lead, .ls-google, .ls-notice, .ls-foot { animation: lsRise .9s cubic-bezier(.22,.61,.36,1) both; }
.ls-eyebrow, .ls-title { animation-delay: .12s; }
.ls-lead { animation-delay: .24s; }
.ls-google { animation-delay: .36s; }
.ls-notice { animation-delay: .48s; }
.ls-foot { animation-delay: .6s; }
@media (max-width: 1128px) {
  .login-split { grid-template-columns: 1fr; }
  .ls-photo { display: none; }
  .ls-form { align-items: center; padding: 40px 28px; }
  .ls-lockup, .ls-center, .ls-foot { width: 100%; max-width: 400px; }
}
@media (prefers-reduced-motion: reduce) {
  .ls-lockup, .ls-eyebrow, .ls-title, .ls-lead, .ls-google, .ls-notice, .ls-foot { animation: none; }
}

/* ---- topbar ---- */
.topbar { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 900px; margin: 0 auto; height: 64px; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo-mark { width: 38px; height: 38px; object-fit: contain; flex: none; }
.wordmark { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.logo-text { font-size: 17px; font-weight: 700; color: var(--brand); letter-spacing: -0.4px; }
.logo-sub { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .5px;
  text-transform: uppercase; margin-top: 2px; }
.user { display: flex; align-items: center; gap: 12px; flex: none; }
#user-email { font-size: 13px; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- content ---- */
.content { max-width: 900px; margin: 0 auto; padding: 22px 20px 64px; }
.loading { text-align: center; color: var(--muted); padding: 48px 20px; }

/* ==========================================================================
   Brand-manual header + student summary (design_handoff_header_movil)
   Navy sticky band with the student identity; white summary card that overlaps
   the band; light-gray page with white content cards.
   ========================================================================== */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.wrap-home { padding-top: 20px; }
.portal-main { min-height: 40vh; }

/* --- navy band (sticky header) --- */
.band { background: var(--navy); padding: 12px 0 44px; position: sticky; top: 0; z-index: 5; }
.band-top { display: flex; align-items: center; gap: 10px; }
.band-logo { width: 28px; height: 28px; flex: none; display: block; }
.band-wordmark { font: 700 11px/1 var(--f-display); letter-spacing: .12em; color: #fff; }
.band-year { font: 700 10px/1 var(--f-body); letter-spacing: .14em; color: var(--sky); }
.btn-inverse { margin-left: auto; background: transparent; border: 2px solid #fff; color: #fff; border-radius: 6px;
  padding: 7px 14px; font: 700 13px var(--f-body); cursor: pointer; transition: background .12s, color .12s; }
.btn-inverse:hover { background: #fff; color: var(--navy); }
.btn-inverse:active { transform: scale(.98); }
.btn-inverse:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.band-identity { margin-top: 18px; }
.band-idrow { display: flex; align-items: center; gap: 12px; }
.band-back { display: inline-flex; align-items: center; margin: 0 0 10px; padding: 0; background: none; border: none;
  color: rgba(255,255,255,.82); font: 700 13px var(--f-body); cursor: pointer; }
.band-back:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.band-back:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.band--home { padding-bottom: 16px; }
.band--home .band-identity { display: none; }
.band-av { width: 52px; height: 52px; flex: none; border-radius: 50%; background: var(--sky-50); border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center; font: 600 17px var(--f-subhead); color: var(--navy);
  overflow: hidden; position: relative; }
.band-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.band-id { min-width: 0; }
.band-name { display: block; font: 600 18px/1.25 var(--f-subhead); color: #fff; }
.band-meta { display: block; font: 600 13px/1.5 var(--f-body); color: var(--sky); font-variant-numeric: tabular-nums; }

/* --- summary card (overlaps the band) --- */
.summary { position: relative; z-index: 6; margin-top: -28px; background: #fff; border-radius: 16px;
  box-shadow: 0 8px 20px rgba(68,66,66,.12); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.sm-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sm-chip { border-radius: 10px; padding: 8px 12px; }
.sm-chip-nivel { background: var(--yellow-50); }
.sm-chip-asis { background: var(--green-50); }
.sm-k { display: block; font: 700 10px/1.4 var(--f-body); letter-spacing: .08em; color: var(--gray-600); }
.sm-v { display: block; font: 700 14px/1.3 var(--f-body); font-variant-numeric: tabular-nums; }
.sm-alert { background: var(--red-50); border-radius: 10px; padding: 9px 12px; font: 700 13px/1.3 var(--f-body); color: var(--brand); }
.sm-ai { background: var(--navy); border: 2px solid var(--navy); color: #fff; border-radius: 6px; width: 100%; min-height: 44px;
  font: 700 14px var(--f-body); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background .12s, border-color .12s; }
.sm-ai:hover { background: var(--navy-700); border-color: var(--navy-700); }
.sm-ai:active { transform: scale(.98); }
.sm-ai:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.sm-tabs { display: flex; gap: 22px; border-top: 1px solid var(--gray-100); padding-top: 12px; overflow-x: auto; scrollbar-width: none; }
.sm-tabs::-webkit-scrollbar { display: none; }
.sm-tab { flex: none; white-space: nowrap; background: none; border: none; cursor: pointer; font: 600 14px var(--f-body);
  color: var(--gray-600); padding: 0 0 4px; border-bottom: 2px solid transparent; transition: color .12s, border-color .12s; }
.sm-tab:hover { color: var(--charcoal); }
.sm-tab.active { font-weight: 700; color: var(--brand); border-bottom-color: var(--brand); }
.sm-tab:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; border-radius: 4px 4px 0 0; }

/* --- report region below the summary --- */
.report-back { display: inline-flex; align-items: center; margin: 14px 0 -4px; padding: 0; background: none; border: none;
  color: var(--navy); font: 700 14px var(--f-body); cursor: pointer; }
.report-back:hover { text-decoration: underline; }
.report .sc-panel { padding-top: 16px; }

/* --- footer (email moved out of the header) --- */
.portal-foot { border-top: 1px solid var(--gray-100); margin-top: 36px; padding: 16px 0; background: #fff; }
.pf-inner { display: flex; flex-wrap: wrap; gap: 4px 18px; justify-content: space-between; font: 600 12px var(--f-body); color: var(--gray-600); }
#user-email { font-variant-numeric: tabular-nums; }

@media (min-width: 768px) {
  .wrap { padding: 0 24px; }
  .band { padding: 14px 0 56px; }
  .band-wordmark { font-size: 13px; }
  .band-year { font-size: 11px; }
  .band-identity { margin-top: 22px; }
  .band-idrow { gap: 16px; }
  .band--home { padding-bottom: 22px; }
  .band-av { width: 64px; height: 64px; font-size: 20px; }
  .band-name { font-size: 24px; }
  .band-meta { font-size: 14px; }
  .summary { margin-top: -32px; padding: 20px 24px; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sm-chips { display: flex; gap: 8px; }
  .sm-alert { display: flex; align-items: center; }
  .sm-ai { width: auto; margin-left: auto; padding: 0 18px; }
  .sm-tabs { width: 100%; order: 9; }
}

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 22px; padding: 14px 16px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.legend .dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* ---- "Desempeño por materia" — grouped bars (columns by trimester, per subject) ---- */
.perf-bars { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 16px;
  margin: 6px 0 4px; background: #fff; }
.perf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.perf-title { font-size: 13px; font-weight: 700; color: var(--brand); letter-spacing: -0.2px; }
.perf-note { font-size: 11.5px; color: var(--muted); }
.perf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px 12px; }
.pb-cell { border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 8px 8px; }
.pb-sub { font-size: 12px; font-weight: 700; color: var(--ink); text-align: center; margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-cols { display: flex; align-items: flex-end; justify-content: center; gap: 8px; }
.pb-col { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; max-width: 30px; }
.pb-val { font-size: 9.5px; font-weight: 700; color: var(--ink); height: 12px; line-height: 12px;
  font-variant-numeric: tabular-nums; }
.pb-track { width: 100%; height: 54px; display: flex; align-items: flex-end; }
.pb-bar { width: 100%; border-radius: 4px 4px 0 0; min-height: 3px; }
.pb-bar.pb-empty { min-height: 3px; height: 3px; background: #ece7e0; }
.pb-k { font-size: 9.5px; font-weight: 700; color: var(--muted); }

/* ---- student card ---- */
.student-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; margin-bottom: 22px; box-shadow: rgba(0,0,0,.02) 0 1px 3px, rgba(0,0,0,.04) 0 4px 14px; }
.sc-head { display: flex; align-items: center; gap: 15px; padding-bottom: 14px; margin-bottom: 0; }
.sc-av { width: 54px; height: 54px; border-radius: 50%; flex: none; color: #fff; font-weight: 600; font-size: 18px;
  display: flex; align-items: center; justify-content: center; }
.sc-av-photo { position: relative; overflow: hidden; }
.sc-av-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sc-id { min-width: 0; }
.sc-head h2 { font-family: var(--display); font-size: 26px; font-weight: 600; letter-spacing: 0; line-height: 1.1; color: var(--ink-strong); }
.sc-sub { font-size: 13px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.sc-nograde { padding: 6px 0 14px; }
/* at-a-glance strip (folds the old summary card into the report header) */
.sc-glance { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 2px; }
/* report tabs: Notas / Asistencia / MAP / Pruebas */
.sc-tabs { display: flex; gap: 2px; margin-top: 16px; border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none; }
.sc-tabs::-webkit-scrollbar { display: none; }
.sc-tab { appearance: none; background: none; border: none; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600;
  flex: none; white-space: nowrap; color: var(--muted); padding: 10px 15px; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .13s, border-color .13s; }
.sc-tab:hover { color: var(--ink); }
.sc-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.sc-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 6px 6px 0 0; }
.sc-panel { padding-top: 18px; }

/* ---- Portal home: one summary card per student (multi-student parents) ---- */
.phome-head { margin-bottom: 18px; }
.phome-title { font-family: var(--display); font-size: 31px; font-weight: 600; letter-spacing: 0; color: var(--ink-strong); line-height: 1.08; }
.phome-sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
.pstudent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.pcard { display: flex; flex-direction: column; gap: 12px; align-items: stretch; text-align: left; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; cursor: pointer;
  font: inherit; color: inherit; box-shadow: rgba(0,0,0,.02) 0 1px 3px, rgba(0,0,0,.04) 0 4px 14px;
  transition: border-color .15s, box-shadow .15s, transform .15s; }
.pcard:not(.pcard-static):hover { border-color: var(--brand); box-shadow: rgba(150,14,11,.10) 0 6px 20px; transform: translateY(-1px); }
.pcard:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pcard-static { cursor: default; margin-bottom: 18px; }
.pc-head { display: flex; align-items: center; gap: 13px; }
.pc-av { width: 48px; height: 48px; border-radius: 50%; flex: none; color: #fff; font-weight: 600; font-size: 16px;
  display: flex; align-items: center; justify-content: center; }
.pc-av-photo { position: relative; overflow: hidden; }
.pc-av-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pc-id { min-width: 0; }
.pc-name { display: block; font-size: 16.5px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.2; }
.pc-sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.pc-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.pc-stat { display: inline-flex; flex-direction: column; gap: 1px; padding: 6px 11px; border-radius: 11px; background: var(--line-soft); }
.pc-stat-k { font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--muted); }
.pc-stat-v { font-size: 14px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.pc-stat.good { background: var(--s-high-bg); } .pc-stat.good .pc-stat-v { color: var(--s-high); }
.pc-stat.mid  { background: var(--s-mid-bg);  } .pc-stat.mid  .pc-stat-v { color: var(--s-mid); }
.pc-stat.low  { background: var(--s-low-bg);  } .pc-stat.low  .pc-stat-v { color: var(--s-low); }
.pc-flag { display: inline-flex; align-items: center; align-self: center; padding: 7px 11px; border-radius: 11px;
  font-size: 12px; font-weight: 600; background: var(--s-low-bg); color: var(--s-low); }
.pc-teaser { display: flex; gap: 7px; font-size: 12.5px; line-height: 1.45; color: #555;
  background: #faf6f6; border: 1px solid #f0e6e6; border-radius: 12px; padding: 10px 12px; margin: 0; }
.pc-teaser .ai-ic { width: 15px; height: 15px; flex: none; color: var(--brand); margin-top: 1px; }
.pc-cta { font-size: 13px; font-weight: 700; color: var(--brand); }
.pback { display: inline-flex; align-items: center; margin-bottom: 16px; padding: 0; background: none; border: none;
  color: var(--brand); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.pback:hover { text-decoration: underline; }

.subject { margin-top: 20px; }
.subject-title { font-size: 15px; font-weight: 700; color: var(--brand); margin-bottom: 8px; letter-spacing: -0.2px; }
.grade-table { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.gt-head, .gt-row { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); align-items: center; gap: 8px; }
.gt-head.gt-5, .gt-row.gt-5 { grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr)); }
.gt-head { padding: 9px 14px; background: #f7f7f7; border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .3px; text-transform: uppercase; }
.gt-head span { text-align: center; }
.gt-head .gt-domain { text-align: left; }
.gt-row { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; }
.gt-row:last-child { border-bottom: none; }
.gt-domain { font-size: 14px; color: var(--ink); min-width: 0; }
.badge { display: inline-flex; align-items: center; justify-content: center; padding: 4px 8px; border-radius: 8px;
  font-size: 12px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; margin: 0 auto; }
.badge.s-high, .dot.s-high { background: var(--s-high-bg); color: var(--s-high); }
.badge.s-good, .dot.s-good { background: var(--s-good-bg); color: var(--s-good); }
.badge.s-mid,  .dot.s-mid  { background: var(--s-mid-bg);  color: var(--s-mid); }
.badge.s-low,  .dot.s-low  { background: var(--s-low-bg);  color: var(--s-low); }
.badge.s-none, .dot.s-none, .badge.s-neutral { background: var(--s-none-bg); color: var(--s-none); }
.badge.s-pct { background: #f6ecec; color: var(--brand); font-variant-numeric: tabular-nums; }

/* ---- AI family summary — design "1c · Prioridades primero" ----
   Self-contained aesthetic imported from Claude Design: Mulish, warm cream,
   deep crimson #960e0b, level chips + trend arrows. Scoped to the block so the
   rest of the report keeps Inter. */
.ai-block { margin-top: 24px; }
.ai-card { --ai-brand: #960e0b; font-family: var(--sans); color: #3a3630;
  border: 1px solid var(--paper-line); border-radius: 16px; padding: 22px; background: var(--paper); }
.ai-card svg { display: block; }

/* placeholder / states */
.ai-cta { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.ai-cta-txt { min-width: 0; flex: 1 1 240px; }
.ai-sub { font-size: 13px; margin-top: 5px; line-height: 1.5; color: #6a645c; }
.ai-gen-btn { background: var(--ai-brand); color: #fff; flex: none; font-family: var(--sans);
  font-weight: 800; }
.ai-gen-btn:hover { background: #741616; }
.ai-ic { width: 15px; height: 15px; display: inline-block; vertical-align: -2px; margin-right: 7px; color: var(--ai-brand); }

/* header */
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.ai-title { display: inline-flex; align-items: center; gap: 11px; font-size: 15px; font-weight: 800; color: var(--ai-brand); }
.ai-title-ic { width: 34px; height: 34px; border-radius: 10px; background: #f6ecec; color: var(--ai-brand);
  display: flex; align-items: center; justify-content: center; flex: none; }
.ai-title-ic svg { width: 18px; height: 18px; }
.ai-title-tx { display: flex; flex-direction: column; line-height: 1.2; }
.ai-title-main { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: 0; color: var(--ai-brand); }
.ai-title-sub { font-size: 12px; font-weight: 500; color: #948d84; }
.ai-lang { display: inline-flex; border: 1px solid #e6e0d8; border-radius: 9px; overflow: hidden; flex: none; }
.ai-lang-btn { background: #fff; color: #9a938a; border: none; font-family: var(--sans);
  font-size: 12px; font-weight: 800; padding: 6px 14px; }
.ai-lang-btn.on { background: var(--ai-brand); color: #fff; }

/* priority cards */
.ai-prios { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.ai-prio { background: #fff; border: 1px solid #eee9e2; border-top: 3px solid var(--ai-brand);
  border-radius: 14px; padding: 15px; }
.ai-prio-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ai-prio-ic { width: 32px; height: 32px; border-radius: 9px; background: #f6ecec; color: var(--ai-brand);
  display: flex; align-items: center; justify-content: center; }
.ai-prio-ic svg { width: 18px; height: 18px; }
.ai-chip { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 5px; white-space: nowrap; }
.ai-prio-title { font-weight: 800; font-size: 13px; color: #1f1c19; margin-bottom: 8px; line-height: 1.3; }
.ai-prio-lbl { font-size: 9.5px; letter-spacing: .6px; font-weight: 800; color: #9a938a;
  text-transform: uppercase; margin-bottom: 4px; }
.ai-prio-action { font-size: 12px; line-height: 1.5; color: #4a443d; }

/* metrics strip */
.ai-strip { display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  background: #fbf6f2; border: 1px solid #f0e6dc; border-radius: 14px; padding: 15px 20px; margin-bottom: 20px; }
.ai-strip-nivel { display: flex; flex-direction: column; line-height: 1.15; }
.ai-k { font-size: 10px; letter-spacing: .7px; font-weight: 800; color: #9a938a; text-transform: uppercase; }
.ai-nivel { font-size: 18px; font-weight: 800; color: var(--ai-brand); margin-top: 3px; }
.ai-sep { width: 1px; align-self: stretch; min-height: 34px; background: #ece3d9; }
.ai-counts { display: flex; gap: 18px; }
.ai-counts > div { display: flex; flex-direction: column; line-height: 1.1; }
.ai-counts > div > span:first-child { font-size: 18px; font-weight: 800; }
.ai-counts > div > span:last-child { font-size: 11px; color: #6a645c; }
.ai-up { color: #2f7d54; } .ai-flat { color: #8a8079; } .ai-down { color: #b23227; }
.ai-bars { display: flex; align-items: flex-end; gap: 11px; }
.ai-bar { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.ai-bar-track { height: 34px; width: 16px; display: flex; align-items: flex-end; }
.ai-bar-fill { width: 100%; background: var(--ai-brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.ai-bar span { font-size: 9px; font-weight: 700; color: #948d84; }

/* full-analysis box */
.ai-analysis { border: 1px solid #eee9e2; border-radius: 14px; overflow: hidden; }
.ai-analysis-head { display: flex; align-items: center; gap: 9px; background: #f7f5f2; padding: 12px 16px;
  font-weight: 800; font-size: 13px; color: var(--ai-brand); }
.ai-analysis-body { padding: 16px; }
.ai-narrative { font-size: 13.5px; line-height: 1.65; color: #3a3630; margin: 0 0 14px; }
.ai-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.ai-col h4 { font-size: 10.5px; letter-spacing: .8px; font-weight: 800; color: #9a938a;
  text-transform: uppercase; margin-bottom: 9px; }
.ai-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-pill { font-size: 11px; background: #f4f1ec; border: 1px solid #ece7e0; border-radius: 999px;
  padding: 4px 10px; color: #4a443d; }
.ai-cols .ai-col:last-child .ai-pill { background: #fbf1ec; border-color: #f0ddd2; }
.ai-empty { font-size: 13px; color: #948d84; }

/* ---- Informe de progreso (solo lectura, dentro del modal) ---- */
.pr-report { font-family: var(--sans); color: var(--ink); }
.pr-title { font-family: var(--display); font-size: 24px; font-weight: 600; color: var(--brand); margin-bottom: 12px; line-height: 1.15; }
.pr-narrative { font-size: 14.5px; line-height: 1.65; color: #3a3630; margin: 0 0 16px; }
.pr-map { background: var(--paper); border: 1px solid var(--paper-line); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.pr-map-k { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--brand); margin-bottom: 4px; }
.pr-map p { font-size: 13.5px; line-height: 1.55; margin: 0; color: #3a3630; }
.pr-recs h4 { font-size: 12px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.pr-rec { border-left: 3px solid var(--brand); padding: 2px 0 2px 12px; margin-bottom: 12px; }
.pr-rec-mat { font-size: 14px; font-weight: 700; color: var(--ink); }
.pr-rec-acc { font-size: 13.5px; line-height: 1.5; color: #4a443d; margin-top: 2px; }
.pr-disc { font-size: 11.5px; color: #a49d94; line-height: 1.45; margin-top: 16px; }

/* footer */
.ai-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 18px; }
.ai-disc { font-size: 11px; color: #a49d94; line-height: 1.45; flex: 1 1 240px; }
.ai-regen { background: #fff; border: 1px solid #ddd7cf; border-radius: 9px; color: #4a453f;
  font-family: var(--sans); font-size: 12.5px; font-weight: 700; padding: 8px 16px; flex: none; }
.ai-regen:hover { border-color: #b7b0a6; }
.ai-spinner { width: 18px; height: 18px; border: 2px solid #eee; border-top-color: var(--ai-brand);
  border-radius: 50%; display: inline-block; animation: ai-spin .7s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .ai-prios { grid-template-columns: 1fr; }
  .ai-strip { gap: 14px 18px; }
  .ai-sep { display: none; }
}
@media (max-width: 480px) { .ai-cols { grid-template-columns: 1fr; gap: 16px; } }
@media (prefers-reduced-motion: reduce) { .ai-spinner { animation: none; } }

/* ---- AI open button (in the student card header) ---- */
.ai-open-btn { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--sans); font-size: 13px; font-weight: 800; color: #960e0b;
  background: #f6ecec; border: 1px solid #f0dede; border-radius: 999px; padding: 8px 14px;
  transition: background .13s, border-color .13s; }
.ai-open-btn:hover { background: #f0dede; border-color: #e6c9c9; }
.ai-open-btn .ai-ic { color: #960e0b; margin: 0; width: 15px; height: 15px; }
@media (max-width: 460px) { .ai-open-btn span { display: none; } .ai-open-btn { padding: 9px; } }

/* ---- AI modal (chooser -> summary) ---- */
body.ai-modal-open { overflow: hidden; }
.ai-modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.ai-modal.hidden { display: none; }
.ai-modal-backdrop { position: absolute; inset: 0; background: rgba(31, 28, 25, .5);
  opacity: 0; transition: opacity .24s ease; }
.ai-modal.open .ai-modal-backdrop { opacity: 1; }
.ai-modal-dialog { position: relative; display: flex; flex-direction: column; width: 100%; max-width: 720px;
  max-height: 90vh; background: var(--paper); border-radius: 20px; overflow: hidden; font-family: var(--sans);
  box-shadow: 0 10px 30px rgba(0,0,0,.18), 0 30px 80px rgba(60,30,20,.22);
  opacity: 0; transform: translateY(18px) scale(.985);
  transition: opacity .2s ease, transform .3s cubic-bezier(.2,.8,.2,1); }
.ai-modal.open .ai-modal-dialog { opacity: 1; transform: none; }
.ai-modal-top { display: flex; align-items: center; gap: 8px; padding: 12px 14px; flex: none; }
.ai-modal-spacer { flex: 1; }
.ai-modal-back, .ai-modal-close { width: 36px; height: 36px; border-radius: 10px; border: none; background: #f2efe9;
  color: #5a544c; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .13s; }
.ai-modal-back:hover, .ai-modal-close:hover { background: #e8e3db; }
.ai-modal-back svg, .ai-modal-close svg { width: 18px; height: 18px; }
.ai-modal-body { overflow-y: auto; padding: 4px 24px 26px; }
.ai-modal-body .ai-card { border: 0; background: transparent; padding: 0; }

.ai-modal-h { font-family: var(--display); font-size: 26px; font-weight: 600; color: var(--ink-strong); margin: 0 0 16px; }
.ai-chooser { display: flex; flex-direction: column; gap: 12px; }
.ai-choice { display: flex; align-items: center; gap: 14px; text-align: left; width: 100%;
  background: #fff; border: 1px solid #eae6e0; border-radius: 14px; padding: 16px;
  font-family: var(--sans); transition: border-color .13s, box-shadow .13s, transform .13s; }
.ai-choice:not(.soon) { cursor: pointer; }
.ai-choice:not(.soon):hover { border-color: #d9b5b5; box-shadow: 0 6px 18px rgba(60,30,20,.08); transform: translateY(-1px); }
.ai-choice-ic { width: 42px; height: 42px; border-radius: 12px; background: #f6ecec; color: #960e0b; flex: none;
  display: flex; align-items: center; justify-content: center; }
.ai-choice-ic svg { width: 20px; height: 20px; }
.ai-choice-tx { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.ai-choice-t { font-size: 15px; font-weight: 800; color: #1f1c19; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-choice-d { font-size: 12.5px; color: #6a645c; line-height: 1.45; }
.ai-choice-go { font-size: 22px; color: #b9b2a8; flex: none; }
.ai-choice.soon { opacity: .72; background: #f7f5f2; }
.ai-choice.soon .ai-choice-ic { background: #eeeae4; color: #9a938a; }
.ai-soon { font-size: 9.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  color: #9a938a; background: #eae5de; border-radius: 999px; padding: 2px 8px; }

@media (max-width: 560px) {
  .ai-modal { padding: 0; align-items: flex-end; }
  .ai-modal-dialog { max-width: none; max-height: 92vh; border-radius: 20px 20px 0 0; transform: translateY(100%); }
  .ai-modal.open .ai-modal-dialog { transform: none; }
  .ai-modal-body { padding: 4px 18px 24px; }
}
@media (prefers-reduced-motion: reduce) { .ai-modal-backdrop, .ai-modal-dialog { transition: opacity .12s; transform: none; } }

/* ---- admin banner (staff report mode) ---- */
.admin-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  background: #f6ecec; border: 1px solid #eccaca; border-left: 4px solid var(--brand);
  border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; }
.admin-banner-tag { font-size: 10.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  color: #fff; background: var(--brand); border-radius: 999px; padding: 3px 10px; flex: none; }
.admin-banner-tx { font-size: 13px; color: #5a2a28; line-height: 1.45; }

/* ---- MAP (NWEA) results (parent report) ---- */
.pmap { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.pmap-title { font-size: 15px; font-weight: 700; color: var(--brand); letter-spacing: -0.2px; }
.pmap-note { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 4px 0 14px; }
.pmap-term { margin-bottom: 14px; }
.pmap-term:last-child { margin-bottom: 0; }
.pmap-term-h { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.pmap-scroll { overflow-x: auto; }
.pmap-table { min-width: 440px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pmap-head, .pmap-row { display: grid; grid-template-columns: minmax(0, 1.6fr) .7fr .9fr .9fr 1fr;
  align-items: center; gap: 8px; }
.pmap-head { padding: 9px 14px; background: #f7f7f7; border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); }
.pmap-head span:not(:first-child), .pmap-row > span:not(.pmap-course) { text-align: center; }
.pmap-row { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; font-size: 13.5px; }
.pmap-row:last-child { border-bottom: none; }
.pmap-course { min-width: 0; }
.pmap-rit { font-variant-numeric: tabular-nums; }
.pmap-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums; }
.pmap-q { font-size: 13px; }
.pmap-growth { font-size: 12.5px; color: var(--muted); }
/* external tests (TOEFL/SAT): 4-col TOEFL grid + simple SAT rows */
.pext-head, .pext-row { grid-template-columns: minmax(0, 1.2fr) .8fr .8fr 1.5fr; }
.pext-sat { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pext-sat-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0; font-size: 13.5px; }
.pext-sat-row:last-child { border-bottom: none; }

/* ---- state cards (empty / error) ---- */
.state-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 40px 28px;
  text-align: center; max-width: 560px; margin: 40px auto; }
.state-card h2 { font-family: var(--display); font-size: 27px; font-weight: 600; letter-spacing: 0; margin-bottom: 10px; color: var(--ink-strong); }
.state-card p { line-height: 1.55; }

/* ---- toast ---- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 13px 20px; border-radius: 10px; z-index: 40; box-shadow: rgba(0,0,0,.25) 0 10px 30px; font-size: 14px; }
.toast.err { background: var(--s-low); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- wider screens ---- */
@media (min-width: 620px) {
  .content { padding-top: 28px; }
  .student-card { padding: 26px 28px; }
}

/* ---- very small phones: keep the 4-col grade grid legible ---- */
@media (max-width: 420px) {
  body { font-size: 14px; }
  .student-card { padding: 18px 15px; }
  .gt-head, .gt-row { gap: 5px; padding-left: 11px; padding-right: 11px; }
  .gt-domain { font-size: 13px; }
  .badge { font-size: 11px; padding: 4px 5px; }
  .logo-sub { display: none; }
}

/* ---- Attendance panel for parents ---- */
.patt { margin-top: 0; }
.patt-stats { margin: 10px 0 12px; }
.patt-bar-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.patt-bar-track { flex: 1; height: 8px; background: #e5e7eb; border-radius: 8px; overflow: hidden; }
.patt-bar-fill { height: 100%; border-radius: 8px; transition: width .4s; }
.patt-pct { font-size: 15px; font-weight: 700; white-space: nowrap; }
.patt-lbl { font-size: 12px; font-weight: 500; }
.patt-counts { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.patt-count { display: flex; align-items: center; gap: 4px; }
.patt-list { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.patt-list-h { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.patt-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.patt-row:last-child { border-bottom: none; }
.patt-date { color: var(--ink); }
.patt-hr { color: var(--muted); font-size: 12px; }
.patt-estado { font-weight: 600; font-size: 12px; text-align: right; }
