/* Self-hosted (SIL OFL, licences in /static/fonts): no requests leave the server. Latin subset. */
@font-face { font-family:"Bricolage Grotesque"; font-style:normal; font-weight:700; font-display:swap; src:url(/static/fonts/bricolage-grotesque-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family:"Bricolage Grotesque"; font-style:normal; font-weight:800; font-display:swap; src:url(/static/fonts/bricolage-grotesque-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family:"Atkinson Hyperlegible"; font-style:normal; font-weight:400; font-display:swap; src:url(/static/fonts/atkinson-hyperlegible-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family:"Atkinson Hyperlegible"; font-style:normal; font-weight:700; font-display:swap; src:url(/static/fonts/atkinson-hyperlegible-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family:"IBM Plex Mono"; font-style:normal; font-weight:400; font-display:swap; src:url(/static/fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family:"IBM Plex Mono"; font-style:normal; font-weight:600; font-display:swap; src:url(/static/fonts/ibm-plex-mono-latin-600-normal.woff2) format("woff2"); }
/* Palette from Typing with Xolotl (twx tools/gen_test_pack.py): the xolo's dark coat as ink,
 * lake water for actions, jade for progress, cinnabar for what needs help, ochre for medals. */
:root { color-scheme: light dark;
  --bg:#e9efec; --card:#fbfcfa; --ink:#2a1b16; --mut:#66574f; --line:#d0d8d2; --acc:#b83428; --acc2:#286a8c; --ok:#2f7556;
  --edge:#00000026; --brand:#2a1b16; --brand-ink:#f3e6cf; --ochre:#c88830; --axo:#fad4c8;
  --f-display:"Bricolage Grotesque", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --f-body:"Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --f-mono:"IBM Plex Mono", ui-monospace, Consolas, monospace; }
@media (prefers-color-scheme: dark) { :root { --bg:#231b1d; --card:#30262a; --ink:#f1e7dc; --mut:#b3a59b; --line:#463a3d; --acc:#f0705f; --acc2:#6fb4d6; --ok:#5fc596;
  --edge:#00000066; --brand:#17100f; --brand-ink:#f3e6cf; --ochre:#e3a94e; --axo:#e2948a; } }
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--ink); font:16px/1.55 var(--f-body); }
a { color:var(--acc2); }
:focus-visible { outline:3px solid var(--ochre); outline-offset:2px; }
header.top { background:var(--brand); color:var(--brand-ink); padding:.55rem 1rem; display:flex; gap:1.1rem; align-items:center; flex-wrap:wrap; border-bottom:3px solid var(--ochre); }
header.top a { color:var(--brand-ink); text-decoration:none; font-weight:600; }
header.top a:hover { text-decoration:underline; text-underline-offset:.25em; }
header.top a.brand { font-family:var(--f-display); font-size:1.15rem; font-weight:800; letter-spacing:.01em; }
/* Machitia's mark (the server's icon and the word) and the school's (crest and name). */
.mark { display:inline-flex; align-items:center; gap:.5rem; }
.mark img { width:1.9rem; height:1.9rem; display:block; flex:none; }
.mark.small { gap:.35rem; font-family:var(--f-display); font-weight:800; font-size:.95rem; }
.mark.small img { width:1.4rem; height:1.4rem; }
.school { display:inline-flex; align-items:center; gap:.5rem; font-weight:700; }
.school img { height:1.9rem; width:auto; max-width:3.4rem; object-fit:contain; display:block; flex:none; }
/* The school gets a quiet band of its own under the bar, so the bar keeps to Machitia, the menu and the person. */
.school-strip { background:var(--card); border-bottom:1px solid var(--line); padding:.35rem max(1rem, calc((100% - 1100px) / 2 + 1rem)); }
header.top { padding-inline:max(1rem, calc((100% - 1100px) / 2 + 1rem)); }   /* the bar and the band start where the page's content does */
.school.strip { font-size:.95rem; color:var(--ink); }
.school.strip img { height:1.7rem; }
header.top nav.links { display:flex; gap:1.3rem; align-items:center; }
header.top .who { display:inline-flex; align-items:center; gap:.8rem; }
header.top .brand { margin-right:.4rem; }
@media (max-width: 640px) {
  header.top { gap:.3rem .8rem; padding:.45rem .8rem; }
  .school-strip { padding-inline:.8rem; }
  header.top .brand { order:1; margin-right:0; }
  header.top .sp { order:2; }
  header.top .who { order:3; font-size:.9rem; }
  header.top nav.links { order:4; flex:0 0 100%; gap:1.1rem; overflow-x:auto; white-space:nowrap; padding:.15rem 0 .25rem; scrollbar-width:none; }
  header.top nav.links::-webkit-scrollbar { display:none; }
  .school.strip { font-size:.9rem; }
}
.school.big { display:flex; justify-content:center; font-size:1.35rem; margin:.8rem auto 0; text-align:center; }
.school.big img { height:3.4rem; max-width:6.5rem; }
.login-wrap { text-align:center; }
.login-art { display:block; width:min(13rem, 55vw); height:auto; margin:5vh auto 0; }
.login-wrap .narrow { margin-top:1rem; text-align:left; }
.pub-sign { max-width:1040px; margin:1.5rem auto 2rem; padding:1rem 1rem 0; border-top:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; gap:1rem; flex-wrap:wrap; color:var(--ink); }
.pub-sign .school img { height:2.6rem; max-width:5rem; }
.pub-sign .with { margin-left:auto; color:var(--mut); }
.school-preview { max-height:6rem; max-width:12rem; }
.brand-preview { display:flex; align-items:center; gap:1.1rem; flex-wrap:wrap; background:var(--brand); color:var(--brand-ink); padding:.7rem 1rem; border-radius:8px; border-bottom:3px solid var(--ochre); }
.brand-preview + .school-strip { border:1px solid var(--line); border-top:0; border-radius:0 0 8px 8px; }
header.top a.login { border:1px solid #f3e6cf66; border-radius:6px; padding:.2rem .7rem; font-weight:600; }
header.top a.login:hover { background:#f3e6cf22; text-decoration:none; }
header.top .sp { flex:1; }
header.top form { display:inline; margin:0; }
main { max-width:1100px; margin:1.5rem auto; padding:0 1rem; }
h1, h2 { font-family:var(--f-display); letter-spacing:-.005em; }
h1 { font-size:1.6rem; margin:.2rem 0 1rem; line-height:1.15; } h2 { font-size:1.15rem; margin:0 0 .6rem; }
.card { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:1rem 1.2rem; margin-bottom:1.2rem; overflow-x:auto; }
table { border-collapse:collapse; width:100%; }
th, td { text-align:left; padding:.4rem .6rem; border-bottom:1px solid var(--line); vertical-align:middle; }
th { color:var(--mut); font-weight:600; font-size:.85rem; white-space:nowrap; }
td.num, th.num { text-align:right; font-variant-numeric:tabular-nums; }
code, .code { font-family:var(--f-mono); letter-spacing:.06em; }
.code { background:var(--bg); padding:.1rem .4rem; border-radius:4px; user-select:all; }
input, select, textarea, button { font:inherit; color:inherit; }
input[type=text], input[type=password], input[type=number], select, textarea { background:var(--bg); border:1px solid var(--line); border-radius:6px; padding:.4rem .55rem; }
textarea { width:100%; min-height:6rem; }
/* Buttons are keycaps: a solid face and a darker lower edge that is pressed in on :active. */
button, .btn { background:var(--acc2); color:#fff; border:0; border-radius:7px; padding:.45rem .9rem; cursor:pointer; text-decoration:none; display:inline-block; font-weight:600;
  box-shadow:0 3px 0 var(--edge); transform:translateY(0); transition:transform .06s, box-shadow .06s; }
button:active, .btn:active { transform:translateY(2px); box-shadow:0 1px 0 var(--edge); }
button.danger { background:var(--acc); } button.ghost, .btn.ghost { background:transparent; color:var(--acc2); border:1px solid var(--line); box-shadow:0 2px 0 var(--line); }
button.sm, .btn.sm { padding:.15rem .5rem; font-size:.85rem; }
@media (prefers-reduced-motion: reduce) { button, .btn { transition:none; } }
form.inline { display:inline-flex; gap:.4rem; align-items:center; flex-wrap:wrap; margin:0; }
.row { display:flex; gap:.6rem; flex-wrap:wrap; align-items:center; margin:.5rem 0; }
.muted { color:var(--mut); } .ok { color:var(--ok); } .err { color:var(--acc); }
.flash { padding:.6rem 1rem; border-radius:8px; margin-bottom:1rem; background:var(--card); border:1px solid var(--line); }
.flash.err { border-color:var(--acc); }
.narrow { max-width:380px; margin:12vh auto 0; }
.narrow label { display:block; margin:.6rem 0 .2rem; }
.narrow input { width:100%; }
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:.8rem; margin-bottom:1.2rem; }
.stat { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:.7rem 1rem; }
.stat b { display:block; font-size:1.6rem; } .stat span { color:var(--mut); font-size:.85rem; }
pre { background:var(--bg); padding:.8rem; border-radius:8px; overflow:auto; max-height:24rem; }

.code.blocked { text-decoration: line-through; opacity: .6; }

/* ---- charts (charts.js): colours are classes, never style attributes ---- */
:root { --yellow:#c88830; --orange:#d0691f; --gold:#c88830; --silver:#9a9a9e; --bronze:#a8623a; --pale:#e2e9e5; --grey:#9a9590; --white:#fff; }
@media (prefers-color-scheme: dark) { :root { --yellow:#e3a94e; --orange:#f08a4a; --gold:#e3a94e; --silver:#b9b6b8; --bronze:#d08a5c; --pale:#3a2f33; --grey:#7c7074; } }
.sv { max-width: 100%; height: auto; display: block; }
.center .sv { margin: 0 auto; }
.sv text { font-family: var(--f-body); } .sv .b { font-weight: 700; }
.f-ink { fill: var(--ink); } .f-dim { fill: var(--mut); } .f-rule { fill: var(--line); } .f-pale { fill: var(--pale); }
.f-green { fill: var(--ok); } .f-yellow { fill: var(--yellow); } .f-orange { fill: var(--orange); } .f-red { fill: var(--acc); }
.f-blue { fill: var(--acc2); } .f-grey { fill: var(--grey); } .f-gold { fill: var(--gold); } .f-silver { fill: var(--silver); }
.f-bronze { fill: var(--bronze); } .f-white { fill: var(--white); }
.s-ink { stroke: var(--ink); } .s-rule { stroke: var(--line); } .s-red { stroke: var(--acc); } .s-blue { stroke: var(--acc2); }
.s-green { stroke: var(--ok); } .s-yellow { stroke: var(--yellow); } .s-orange { stroke: var(--orange); } .s-white { stroke: var(--white); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; align-items: start; }
.grid .card { margin: 0; } .grid .wide { grid-column: 1 / -1; }
.center { text-align: center; } .big { font-size: 1.8rem; font-weight: 700; margin: .2rem 0; } .big small { font-size: .85rem; font-weight: 400; color: var(--mut); }
.warn { color: var(--orange); }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin: 0 0 1rem; } .tabs a { padding: .5rem 1rem; border-bottom: 3px solid transparent; border-radius: 4px 4px 0 0; text-decoration: none; color: var(--mut); font-weight: 600; font-size: .85rem; }
.tabs a:hover { color: var(--ink); background: var(--pale); }
.tabs a.on, .tabs a[aria-current="page"] { color: var(--acc2); border-bottom-color: var(--acc2); background: var(--pale); }
.keycap { display: inline-block; min-width: 1.7em; text-align: center; padding: .05rem .35rem; margin: 0 .15rem .2rem 0; border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 5px; background: var(--bg); font-family: var(--f-mono); box-shadow: 0 1px 0 var(--edge); }
.mixrow { display: flex; align-items: center; gap: .5rem; margin: .25rem 0; }
.setrow { display: grid; grid-template-columns: 9.5rem 1fr; align-items: center; gap: .5rem; margin: .3rem 0; }
.stage { margin: .4rem 0; } .dotc { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; margin-right: .5rem; }
.dotc.f-green { background: var(--ok); } .dotc.f-blue { background: var(--acc2); } .dotc.f-grey { background: var(--grey); } .dotc.f-gold { background: var(--gold); }
.kb { max-width: 640px; } td svg.spark { display: inline-block; vertical-align: middle; }
header.top .light { color: #fff; border-color: #fff8; }

/* ---- public boards: leagues, no places ---- */
body.pub main { max-width: 980px; }
.leagues { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .8rem; }
.league { border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; background: var(--bg); }
.league.gold { border-color: var(--gold); } .league.silver { border-color: var(--silver); } .league.bronze { border-color: var(--bronze); } .league.sprout { border-color: var(--ok); }
.lhead { display: flex; align-items: center; gap: .6rem; } .lhead b { display: block; font-size: 1.1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .6rem 0 0; } .chip { padding: .1rem .6rem; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.card.mine { border: 2px solid var(--acc2); } .mrow { display: flex; gap: 1rem; align-items: center; margin: .6rem 0; } .mrow p { margin: .1rem 0; }
.record { font-weight: 700; color: var(--ok); }

input.narrow-in { width: 11rem; }
.board > summary { cursor: pointer; list-style: none; } .board > summary h2 { display: inline; }
.board > summary::before { content: "▸ "; } .board[open] > summary::before { content: "▾ "; }
.gtitle { margin: 1.4rem 0 .6rem; font-size: 1.25rem; }
.badges { margin: .8rem 0 .2rem; } .chip.badge { border-color: var(--gold); }
.more summary { cursor: pointer; color: var(--mut); } .challenge .big { margin-bottom: .4rem; }

/* ---- Compact Public Group Dashboard & Individual Dashboard ---- */
body.pub main { max-width: 1040px; }
body.pub .gtitle {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.board-box > summary::before {
  content: "" !important;
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dash-container {
  width: 100%;
}

.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}
.dash-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.dash-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
}
.dash-back-btn:hover {
  color: var(--acc2);
}
.dash-class-name {
  color: var(--ink);
  font-weight: 700;
}
.dash-tabs {
  display: inline-flex;
  gap: 0.3rem;
  background: var(--bg);
  padding: 0.18rem;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.dash-tab-btn {
  background: transparent;
  color: var(--mut);
  border: 0;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.dash-tab-btn.active {
  background: var(--card);
  color: var(--acc2);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.dash-tab-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.dash-reto {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
}
.reto-label {
  font-weight: 600;
  color: var(--mut);
}
.dash-reto-bar {
  width: 95px;
  height: 10px;
  background: var(--pale);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.dash-reto-fill {
  height: 100%;
  background: var(--acc2);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.dash-reto-fill.done {
  background: var(--ok);
}
.reto-count-short {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink);
}
.dash-search-form {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}
.dash-search-form input {
  padding: 0.28rem 0.55rem;
  font-size: 0.84rem;
  width: 7.5rem;
}
.dash-search-form button {
  padding: 0.28rem 0.65rem;
  font-size: 0.84rem;
}

/* ---- Carousel for Group Dashboard: One board at a time ---- */
.dash-carousel {
  width: 100%;
  margin-top: 0.5rem;
}

.carousel-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.4rem 0.6rem;
}
.carousel-dots-scroll {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.15rem 0;
  flex: 1;
  justify-content: center;
}
.carousel-dots-scroll::-webkit-scrollbar {
  display: none;
}
.carousel-dot {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--mut);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.carousel-dot:hover {
  color: var(--ink);
  border-color: var(--mut);
}
.carousel-dot.active {
  background: var(--acc2);
  color: #fff;
  border-color: var(--acc2);
}
.carousel-btn, .carousel-play-toggle {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 6px;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.carousel-btn:hover, .carousel-play-toggle:hover {
  background: var(--card);
  border-color: var(--acc2);
  color: var(--acc2);
}

.carousel-slides {
  position: relative;
  width: 100%;
}
.carousel-slide {
  display: none;
}
.carousel-slide.active {
  display: block;
  animation: dashFadeIn 0.25s ease-out;
}
@keyframes dashFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.board-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.1rem 1.4rem;
  margin-bottom: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}
.board-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.6rem;
  margin-bottom: 0.4rem;
  cursor: default;
}
.board-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.board-box-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}
.board-tag-group {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  background: var(--bg);
  color: var(--mut);
  border: 1px solid var(--line);
}
.board-info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  color: var(--mut);
  font-size: 0.85rem;
  cursor: help;
  background: var(--bg);
  border: 1px solid var(--line);
}
.board-blurb-text {
  font-size: 0.88rem;
  color: var(--mut);
  margin: 0.2rem 0 0.9rem;
  line-height: 1.4;
}

/* Motivating decorated table */
.decorated-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.4rem;
}
.decorated-table th {
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  color: var(--mut);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
}
.tier-row {
  background: var(--bg);
  border-radius: 8px;
  transition: all 0.15s ease;
}
.tier-row:hover {
  background: rgba(0, 0, 0, 0.02);
}
@media (prefers-color-scheme: dark) {
  .tier-row:hover {
    background: rgba(255, 255, 255, 0.03);
  }
}
.tier-row td {
  padding: 0.65rem 0.8rem;
  border: 0;
  vertical-align: middle;
}
.tier-row td:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}
.tier-row td:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.tier-row.tier-gold td.nivel-col {
  border-left: 4px solid var(--gold);
}
.tier-row.tier-silver td.nivel-col {
  border-left: 4px solid var(--silver);
}
.tier-row.tier-bronze td.nivel-col {
  border-left: 4px solid var(--bronze);
}
.tier-row.tier-sprout td.nivel-col {
  border-left: 4px solid var(--ok);
}

.tier-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.tier-cell svg.medal {
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.12));
}
.tier-info {
  display: flex;
  flex-direction: column;
}
.tier-name {
  font-size: 0.96rem;
  color: var(--ink);
  font-weight: 700;
}
.tier-count {
  font-size: 0.78rem;
  line-height: 1.2;
}
.board-table .nivel-col {
  width: 28%;
  white-space: nowrap;
}
.board-table .alumnos-col {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.chip {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 0.84rem;
  color: var(--ink);
  text-decoration: none;
}
.chip.chip-me {
  background: #eef4ff;
  border-color: var(--acc2);
  color: var(--acc2);
  font-weight: 700;
  box-shadow: 0 0 0 1px var(--acc2);
}
@media (prefers-color-scheme: dark) {
  .chip.chip-me {
    background: #1e294b;
    border-color: #6393ff;
    color: #9cbaff;
    box-shadow: 0 0 0 1px #6393ff;
  }
}

/* ---- Individual Dashboard ---- */
.ind-topbar {
  justify-content: space-between;
}
.ind-user-wrap {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.ind-user-pill {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink);
}
.dash-logout-link {
  color: var(--mut);
  font-size: 0.85rem;
  text-decoration: none;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}
.dash-logout-link:hover {
  color: var(--acc);
  border-color: var(--acc);
}
.ind-banner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.2rem;
  padding: 1rem 1.3rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  margin-bottom: 1.2rem;
  background: var(--card);
}
@media (max-width: 768px) {
  .ind-banner {
    grid-template-columns: 1fr;
  }
}
.ind-banner-left h1 {
  margin: 0 0 0.4rem;
  font-size: 1.4rem;
}
.ind-banner-line {
  margin: 0.25rem 0;
  font-size: 0.85rem;
}
.tag-level {
  font-weight: 700;
  color: var(--acc2);
}
.ind-banner-right h3 {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  color: var(--mut);
}
.ind-badges-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.chip.badge {
  border-color: var(--gold);
  color: var(--ink);
  background: var(--bg);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.12rem 0.5rem;
}
.ind-columns-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1.2rem;
}
@media (max-width: 768px) {
  .ind-columns-wrap {
    grid-template-columns: 1fr;
  }
}
.ind-col-header {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--mut);
  text-transform: uppercase;
  margin: 0.3rem 0 0.6rem;
}
.ind-metric-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.75rem;
}
.ind-metric-title {
  font-size: 0.92rem;
  margin: 0 0 0.35rem;
  font-weight: 700;
}
.ind-metric-line {
  margin: 0.22rem 0;
  font-size: 0.86rem;
}
.tag-group {
  font-weight: 600;
  color: var(--acc2);
}
.ind-metric-bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.83rem;
}
.bar-tag {
  color: var(--mut);
  font-size: 0.82rem;
}
.metric-bar-track {
  flex: 1;
  height: 9px;
  background: var(--pale);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  max-width: 140px;
}
.metric-bar-fill {
  height: 100%;
  background: var(--acc2);
  border-radius: 999px;
}
.next-tag {
  color: var(--mut);
  font-size: 0.82rem;
}
.muted-card {
  opacity: 0.8;
}

/* ---- Classroom view header and gear button ---- */
.classroom-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.2rem 0 0.4rem;
}
.classroom-gear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mut);
  text-decoration: none;
  padding: 0.25rem;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease, transform 0.25s ease;
  vertical-align: middle;
}
.classroom-gear-btn:hover {
  color: var(--ink);
  background: var(--line);
  transform: rotate(45deg);
}
.classroom-gear-btn .gear-icon {
  display: block;
}
.card-config-highlight {
  outline: 2px solid var(--acc2) !important;
  box-shadow: 0 0 16px rgba(42, 91, 215, 0.35) !important;
  transition: outline 0.3s ease, box-shadow 0.3s ease;
}


/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
  flex-wrap: wrap;
}
.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--mut);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
  border-radius: 4px 4px 0 0;
  box-shadow: none;
}
.tab-btn:hover {
  color: var(--ink);
  background: var(--pale);
}
.tab-btn:active, .sub-tab-btn:active { transform: none; box-shadow: none; }
.tab-btn.active {
  color: var(--acc2);
  border-bottom-color: var(--acc2);
  background: var(--pale);
}
.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}
.tab-pane.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sub tabs */
.sub-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.sub-tab-btn {
  background: var(--pale);
  border: 1px solid var(--line);
  color: var(--mut);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  box-shadow: none;
}
.sub-tab-btn:hover {
  background: var(--line);
  color: var(--ink);
}
.sub-tab-btn.active {
  background: var(--acc2);
  border-color: var(--acc2);
  color: #fff;
}
.sub-pane {
  display: none;
}
.sub-pane.active {
  display: block;
}

svg { max-width: 100%; height: auto; }


/* ---- landing: code entry first, then one tile per playable module ---- */
.landing { max-width: 760px; margin: 5vh auto 0; }
.landing h1 { font-size: clamp(1.9rem, 5vw, 2.7rem); margin: 0 0 .4rem; }
.landing .lead { color: var(--mut); margin: 0 0 1.4rem; max-width: 34rem; }
.codeform { display: flex; flex-direction: column; gap: .6rem; }
.codeform label { font-weight: 700; }
.codeform .entry { display: flex; gap: .7rem; flex-wrap: wrap; align-items: stretch; }
.codeform input.code-in { flex: 1 1 16rem; min-width: 0; font: 600 1.5rem/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; text-align: center;
  padding: .85rem .6rem; background: var(--card); border: 2px solid var(--ink); border-bottom-width: 5px; border-radius: 10px; }
.codeform input.code-in::placeholder { color: var(--mut); opacity: .55; letter-spacing: .12em; }
.codeform input.code-in:focus-visible { outline-offset: 3px; }
.codeform .go { font-size: 1.15rem; padding: .7rem 1.4rem; }
.codeform .hint { margin: 0; color: var(--mut); min-height: 1.5em; font-size: .95rem; }
.codeform .hint.bad { color: var(--acc); }
.modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-top: 2rem; }
.module { background: var(--card); border: 1px solid var(--line); border-bottom: 4px solid var(--ochre); border-radius: 12px; padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: .5rem; margin: 0; }
.module h2 { margin: 0; font-size: 1.25rem; }
.module .module-image { align-self: center; width: min(9rem, 60%); height: auto; }
.module p { margin: 0; color: var(--mut); flex: 1; }
.module .actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .4rem; }
.module .needs { font-size: .9rem; color: var(--mut); }
.landing .empty { color: var(--mut); }

/* ---- classroom: "Atención hoy" and the students table on narrow screens ---- */
.attn { border-left: 5px solid var(--ochre); }
.attn h2 { margin-bottom: .4rem; }
.attn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.attn-list li { padding-left: 1.5rem; position: relative; }
.attn-list li::before { content: ""; position: absolute; left: .15rem; top: .55em; width: .7rem; height: .7rem; border-radius: 3px; background: var(--grey); box-shadow: 0 2px 0 var(--edge); }
.attn-list li.err::before { background: var(--acc); }
.attn-list li.warn::before { background: var(--ochre); }
.attn-list li.ok::before { background: var(--ok); }
.attn-list li.ok, .attn-list li.err, .attn-list li.warn { color: var(--ink); }
.attn-list .more-li { color: var(--mut); }
@media (max-width: 640px) {
  .opt { display: none; }
  th { white-space: normal; }
  td form.inline { flex-direction: column; align-items: stretch; gap: .3rem; }
  td .chip { padding: .05rem .4rem; font-size: .8rem; }
  td form.inline button.sm { padding: .15rem .4rem; }
  td form.inline input[type=password] { width: 100%; min-width: 0; }
  .card { padding: .8rem .9rem; }
  th, td { padding: .4rem .25rem; }
}
@media (prefers-reduced-motion: reduce) { .tab-pane { animation: none; } }

/* ---- forms: a visible label above every field; help text under it ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .9rem 1.1rem; align-items: start; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > label, label[for], .lbl { font-weight: 700; font-size: .92rem; }
.field input:not([type=checkbox]), .field select { width: 100%; }
.field > button { align-self: start; margin-top: 1.55rem; }
.help { color: var(--mut); font-size: .86rem; margin: 0; }
label.check { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; margin-top: 1.55rem; }
.sub-h { font-size: 1rem; margin: 1.2rem 0 .6rem; font-family: var(--f-display); }
form.inline > label { font-weight: 700; font-size: .92rem; }

/* ---- student page ---- */
.crumbs { margin: 0 0 .3rem; }
.student-head .row { gap: .8rem; }
.student-head .sp { flex: 1; }
.student-head .code { font-size: 1.15rem; padding: .2rem .6rem; font-weight: 600; }

/* ---- legend of the coloured keyboard ---- */
.legend { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .88rem; color: var(--mut); }
.legend li { display: inline-flex; align-items: center; gap: .4rem; }
.sw { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; border: 1px solid var(--ink); }
.sw-green { background: var(--ok); } .sw-yellow { background: var(--yellow); } .sw-orange { background: var(--orange); } .sw-red { background: var(--acc); } .sw-pale { background: var(--pale); border-color: var(--line); }

/* ---- admin and aulas ---- */
.chip.admin { border-color: var(--acc); color: var(--acc); font-weight: 600; }
.chip.teacher { font-weight: 600; }

/* ---- Familias tab: one card per panel ---- */
.fam-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .4rem; }
.fam-head h2 { margin: 0; }
.chip.vis-private { color: var(--mut); }
.chip.vis-public { border-color: var(--ok); color: var(--ok); font-weight: 600; }
.chip.vis-password { border-color: var(--ochre); font-weight: 600; }
.fam-link .code { font-size: .95rem; word-break: break-all; }
.fam-form fieldset { border: 0; padding: 0; margin: 1rem 0 0; min-width: 0; }
.fam-form legend { font-weight: 700; padding: 0; margin-bottom: .4rem; }
.opt-card { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .9rem; margin: 0 0 .5rem; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--card); }
.opt-card.on, .opt-card:has(input:checked) { border-color: var(--acc2); background: var(--pale); }
.opt-card input[type=radio] { margin-top: .3rem; flex: none; }
.opt-card > span { display: flex; flex-direction: column; gap: .15rem; flex: 1; min-width: 0; }
.opt-card .field { margin-top: .5rem; max-width: 22rem; }
.fam-danger { margin-top: 1rem; }
.fam-danger summary { cursor: pointer; color: var(--mut); }
.fam-more { margin: 0 0 1.2rem; }

/* ---- printable sheet for families ---- */
.sheet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
@media (max-width: 640px) { .sheet { grid-template-columns: minmax(0, 1fr); } }
.slip { border: 2px dashed var(--ink); border-radius: 10px; padding: .8rem 1rem; background: var(--card); break-inside: avoid; }
.slip h2 { margin: 0 0 .3rem; }
.slip-brand { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin: 0 0 .5rem; color: var(--mut); }
.slip-brand .school { color: var(--ink); }
.slip-brand .school img { height: 1.8rem; }
.slip-brand .mark { margin-left: auto; }
.slip-label { margin: 0; color: var(--mut); font-size: .85rem; }
.slip-code { font-size: 1.5rem; font-weight: 600; margin: .1rem 0 .5rem; user-select: all; display: inline-block; }
.slip ol { margin: 0 0 .5rem; padding-left: 1.2rem; }
.slip-panel { margin: 0; font-size: .92rem; word-break: break-all; }
@media print {
  header.top, .school-strip, .no-print, .flash { display: none !important; }
  body { background: #fff; color: #000; }
  main { margin: 0; max-width: none; }
  .slip { background: #fff; border-color: #000; }
}

/* ================= public pages (children and families): dawn over the lake of Xochimilco =================
 * Motifs are drawn in public/motifs: the single-colour ones (sol, maguey, ola, greca) are masks so they
 * take the theme's colours; the ajolote and the xolo come with Typing with Xolotl, as small illustrations. */
body.pub { --bg:#eee4cd; --card:#fffaf0; --ink:#2a1b16; --mut:#6b5848; --line:#d8c8a6; --pale:#f4ead3; --acc2:#1f6f6a; --ok:#2f7556; --acc:#b83428; --ochre:#c88830; }
@media (prefers-color-scheme: dark) { body.pub { --bg:#231b1d; --card:#30262a; --ink:#f1e7dc; --mut:#b3a59b; --line:#463a3d; --pale:#3a2f33; --acc2:#6fc2bb; --ok:#5fc596; --acc:#f0705f; --ochre:#e3a94e; } }
body.pub main { max-width: 1040px; margin-top: 1rem; }
.pub-page { display: block; }

.pub-hero { position: relative; border-radius: 16px; overflow: hidden; margin: 0 0 1.2rem; background: #2a1b16; }
.pub-sky { position: relative; min-height: 250px; margin-bottom: 14px; padding: 2rem 1.6rem 5.5rem; color: #fff; overflow: hidden;
  background: linear-gradient(180deg, #141848 0%, #3a3a78 40%, #b8607c 74%, #f89848 100%); }
.pub-hero.small .pub-sky { min-height: 170px; padding-bottom: 4.6rem; }
.pub-hero-text { position: relative; z-index: 4; max-width: 34rem; }
.pub-eyebrow { margin: 0 0 .3rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .85rem; color: #ffd9a0; }
.pub-hero h1 { margin: 0; font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 800; line-height: 1.05; color: #fff; text-shadow: 0 2px 0 #14184866; }
.pub-lead { margin: .7rem 0 0; font-size: 1.05rem; color: #fff; max-width: 30rem; }
.pub-machitia { display: block; width: 100%; height: auto; margin: -.3rem 0 1.2rem; }
.pub-xolo { position: absolute; right: 4%; bottom: 40px; width: 118px; height: auto; z-index: 2; }
.pub-sun { position: absolute; right: 24%; bottom: 36px; width: 130px; height: 130px; background: #ffd27a; z-index: 1;
  -webkit-mask: url(/static/motifs/sol.svg) center / contain no-repeat; mask: url(/static/motifs/sol.svg) center / contain no-repeat; }
.pub-maguey { position: absolute; left: -8px; bottom: 26px; width: 92px; height: 92px; background: #2c6a4a; z-index: 2;
  -webkit-mask: url(/static/motifs/maguey.svg) center / contain no-repeat; mask: url(/static/motifs/maguey.svg) center / contain no-repeat; }
.pub-water { position: absolute; left: 0; right: 0; bottom: 14px; height: 54px; z-index: 3; background: linear-gradient(180deg, #489890 0%, #103848 100%); }
.pub-wave { position: absolute; left: 0; right: 0; top: -6px; height: 12px; background: #ffffff66;
  -webkit-mask: url(/static/motifs/ola.svg) 0 50% / 48px 12px repeat-x; mask: url(/static/motifs/ola.svg) 0 50% / 48px 12px repeat-x; }
.pub-ajolote { position: absolute; left: 9%; bottom: 8px; width: 118px; height: auto; }
.pub-greca { height: 12px; background: var(--ochre);
  -webkit-mask: url(/static/motifs/greca.svg) 0 100% / 24px 12px repeat-x; mask: url(/static/motifs/greca.svg) 0 100% / 24px 12px repeat-x; }
.pub-hero > .pub-greca { position: absolute; left: 0; right: 0; bottom: 0; height: 14px; background: #b83428;
  -webkit-mask-size: 28px 14px; mask-size: 28px 14px; }
@media (prefers-reduced-motion: no-preference) {
  .pub-ajolote { animation: pub-bob 5s ease-in-out infinite; }
  @keyframes pub-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
}

.pub-intro { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1rem; margin: 0 0 1.6rem; }
.pub-intro:has(.pub-me:only-child) { grid-template-columns: 1fr; }
.pub-me, .pub-reto { background: var(--card); border: 1px solid var(--line); border-bottom: 4px solid var(--ochre); border-radius: 12px; padding: 1rem 1.2rem; }
.pub-me label, .pub-reto label { display: block; font-weight: 700; margin-bottom: .4rem; }
.pub-me-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.pub-me-row input { flex: 1 1 12rem; min-width: 0; padding: .6rem .7rem; font-size: 1rem; }
.pub-reto p { margin: .5rem 0 0; }
progress.reto-bar, progress.metric-bar { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 16px; border: 0; border-radius: 999px; overflow: hidden; background: var(--pale); color: var(--ok); }
progress::-webkit-progress-bar { background: var(--pale); }
progress::-webkit-progress-value { background: var(--ok); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--ok); border-radius: 999px; }
progress.reto-bar.done::-webkit-progress-value { background: var(--ochre); }
progress.reto-bar.done::-moz-progress-bar { background: var(--ochre); }

.pub-group { margin: 0 0 1.8rem; }
.pub-group-title { display: flex; align-items: center; gap: .6rem; margin: 0 0 .8rem; font-size: 1.6rem; }
.pub-group-mark { width: 30px; height: 30px; background: var(--ok); flex: none;
  -webkit-mask: url(/static/motifs/maguey.svg) center / contain no-repeat; mask: url(/static/motifs/maguey.svg) center / contain no-repeat; }
.pub-boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.board-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem; }
.board-card h3 { margin: 0; font-family: var(--f-display); font-size: 1.25rem; }
.board-blurb { margin: .2rem 0 .8rem; color: var(--mut); font-size: .93rem; }
.tiers { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.tier { display: flex; gap: .7rem; align-items: flex-start; padding: .55rem .7rem; border-radius: 10px; background: var(--pale); border-left: 5px solid var(--line); }
.tier-gold { border-left-color: var(--gold); } .tier-silver { border-left-color: var(--silver); } .tier-bronze { border-left-color: var(--bronze); } .tier-sprout { border-left-color: var(--ok); }
.tier-medal { flex: none; line-height: 0; }
.tier-body { display: flex; flex-wrap: wrap; gap: .1rem .6rem; align-items: baseline; }
.tier-count { color: var(--mut); font-size: .88rem; }
.tier-names { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .3rem; }
.pub-foot { margin-top: 2rem; text-align: center; color: var(--mut); }
.pub-nav { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 0 0 1rem; font-weight: 600; }
.pub-unlock { margin: 1.5rem auto; }

@media (max-width: 720px) {
  .pub-intro { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .pub-sky { padding: 1.4rem 1.1rem 6.6rem; min-height: 230px; }
  .pub-hero.small .pub-sky { padding-bottom: 5.6rem; }
  .pub-sun { right: 5%; bottom: 24px; width: 84px; height: 84px; }
  .pub-xolo { display: none; }
  .pub-ajolote { width: 92px; left: 4%; }
  .pub-maguey { width: 70px; height: 70px; }
}

/* ---- /instalar: acceso directo a pantalla completa ---- */
.landing .install-link { margin: 2rem 0 0; font-size: .9rem; color: var(--mut); }
.install { max-width: 640px; margin: 5vh auto 0; }
.install .steps { padding-left: 1.3rem; line-height: 1.6; }
.install .steps li { margin: .5rem 0; }
.install code { overflow-wrap: anywhere; }

/* ---- landing: "Seguir como ..." ---- */
.resume { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--acc2); border-radius: 12px; padding: .9rem 1.2rem; margin: 0 0 1.2rem; }
.resume p { margin: 0 0 .6rem; font-size: 1.15rem; }
.resume .actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.codeform .remember { font-weight: 400; display: block; color: var(--mut); }
.codeform .remember .help { display: block; font-size: .85rem; margin-left: 1.6rem; }

.badge { background: var(--ochre); color: #2a1b16; border-radius: 999px; padding: 0 .45rem; font-size: .8rem; font-weight: 800; }
ul.plain { list-style: none; padding: 0; margin: .4rem 0 0; display: grid; gap: .6rem; }
ul.plain form.inline { margin-left: .5rem; }

/* /instalar: the platform tabs sit under the intro, and a tab's content under them. */
.install .tabs { margin-top: 1.2rem; }
.install [data-panel][hidden] { display: none; }
.install [data-panel] h2 { margin-top: .4rem; }
