/* Paleta "libreta escolar": papel verde-grisáceo, tinta verde profundo, caléndula como acento.
   Etiquetas de color por rol (como en Notion) para leer la estructura de un vistazo. */
:root {
  --bg: #e9efe8;
  --surface: #ffffff;
  --surface-2: #f4f8f3;
  --ink: #16302a;
  --muted: #566b64;
  --line: #d2dcd2;
  --brand: #1d5a47;
  --brand-ink: #ffffff;
  --accent: #e8a317;
  --focus: #c98600;

  --lilac: #e6e0f6;
  --lilac-ink: #45387f;
  --sky: #d9e9f7;
  --sky-ink: #1d4b74;
  --peach: #fbe2cf;
  --peach-ink: #84451a;
  --mint: #d3eddd;
  --mint-ink: #1b5538;

  --good: #2b8a57;
  --good-soft: #d8efe2;
  --warn: #a96d0d;
  --warn-soft: #fae9c4;
  --bad: #bf432c;
  --bad-soft: #f8d9d0;

  --font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(22, 48, 42, 0.05), 0 6px 18px -10px rgba(22, 48, 42, 0.25);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1d1a;
    --surface: #162825;
    --surface-2: #1b302c;
    --ink: #e5f0ea;
    --muted: #9db3aa;
    --line: #2a423c;
    --brand: #53b58f;
    --brand-ink: #0b1a16;
    --accent: #f0b43a;
    --focus: #f0b43a;

    --lilac: #2f2a4d;
    --lilac-ink: #cfc6f5;
    --sky: #1f3447;
    --sky-ink: #b9dbf5;
    --peach: #463125;
    --peach-ink: #f6cfb0;
    --mint: #1e3b2d;
    --mint-ink: #b8e8cb;

    --good: #5cc88b;
    --good-soft: #1b3a2b;
    --warn: #eab552;
    --warn-soft: #43361a;
    --bad: #f08a72;
    --bad-soft: #472620;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 8px 20px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 48px;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.2rem); font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.nums { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 0; min-width: 0; }

/* Botones y campos */
.btn {
  appearance: none; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 10px 16px; border-radius: 12px; font-weight: 600; cursor: pointer; min-height: 44px;
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-weight: 600; font-size: 0.9rem; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 88px; resize: vertical; }

/* Superficies */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; background: var(--surface-2); }

/* Etiquetas de rol */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 650; white-space: nowrap; background: var(--mint); color: var(--mint-ink); }
.tag.lilac { background: var(--lilac); color: var(--lilac-ink); }
.tag.sky { background: var(--sky); color: var(--sky-ink); }
.tag.peach { background: var(--peach); color: var(--peach-ink); }
.tag.mint { background: var(--mint); color: var(--mint-ink); }
.tag.plain { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* Puntajes */
.pill { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.none { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* Barras */
.progress { height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.dist { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.dist > i { display: block; height: 100%; }
.dist .d1 { background: #bf432c; } .dist .d2 { background: #e08a4a; } .dist .d3 { background: #e8c24a; }
.dist .d4 { background: #7bc08f; } .dist .d5 { background: #2b8a57; }
.scorebar { height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.scorebar > span { display: block; height: 100%; border-radius: 999px; }
.scorebar.good > span { background: var(--good); } .scorebar.warn > span { background: var(--warn); } .scorebar.bad > span { background: var(--bad); }

/* ---------- Encuesta de familias ---------- */
.survey { max-width: 640px; margin: 0 auto; padding-block: 20px 40px; }
.topbar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 12px 0 10px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--brand); letter-spacing: 0.01em; }
.stepper { display: flex; gap: 6px; margin-top: 8px; }
.stepper > i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.stepper > i.done { background: var(--brand); }
.stepper > i.now { background: var(--accent); }
.hero h1 { margin-block: 18px 12px; }
.lead { font-size: 1.05rem; color: var(--muted); }
.promise { display: grid; gap: 10px; margin-block: 18px; }
.promise > div { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.promise b { font-family: var(--font-display); color: var(--brand); min-width: 1.5em; }
.teacher-head { display: flex; flex-direction: column; gap: 8px; margin-block: 14px 6px; }
.teacher-head .tag { align-self: flex-start; }
.block-title { font-family: var(--font-display); font-weight: 650; font-size: 1.05rem; margin: 22px 0 4px; }
.item { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 10px; }
.item.missing { border-color: var(--bad); background: var(--bad-soft); }
.item legend { float: left; width: 100%; font-weight: 600; padding: 0; margin: 0 0 10px; }
.item legend + * { clear: both; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.likert { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.likert input { position: absolute; opacity: 0; pointer-events: none; }
.likert-btn {
  display: grid; place-items: center; min-height: 52px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface-2); font-weight: 700; font-size: 1.15rem; cursor: pointer; user-select: none;
}
.likert-btn:hover { border-color: var(--brand); }
.likert input:checked + .likert-btn { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.likert input:focus-visible + .likert-btn { outline: 3px solid var(--focus); outline-offset: 2px; }
.ends { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 0.78rem; color: var(--muted); }
.noinfo { margin-top: 10px; background: transparent; border: 1.5px dashed var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: 0.9rem; color: var(--muted); width: 100%; min-height: 40px; }
.noinfo[aria-pressed="true"] { border-style: solid; border-color: var(--brand); background: var(--mint); color: var(--mint-ink); font-weight: 650; }
.nav { display: flex; gap: 10px; margin-top: 24px; }
.nav .btn { flex: 1; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-weight: 600; margin-top: 14px; }
.center { text-align: center; padding-block: 48px; }
.bigmark { font-family: var(--font-display); font-size: 3rem; color: var(--brand); }

/* ---------- Administración ---------- */
.shell { max-width: 1120px; margin: 0 auto; }
.adm-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-block: 18px 12px; }
.adm-head h1 { font-size: clamp(1.35rem, 3.5vw, 1.8rem); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; border-bottom: 2px solid var(--line); margin-bottom: 20px; }
.tab { appearance: none; border: 0; background: transparent; padding: 10px 14px; font-weight: 650; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.stat .v { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.group-title { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; }
.group-title h2 { font-size: 1.15rem; }
.tcard { display: flex; flex-direction: column; gap: 14px; }
.tcard.dim { background: var(--surface-2); box-shadow: none; }
.tcard .name { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.minis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.mini { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.mini .k { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.mini .v { font-weight: 700; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.irow { display: grid; grid-template-columns: minmax(0, 1fr) 54px; gap: 4px 12px; align-items: center; }
.irow .txt { font-size: 0.9rem; grid-column: 1 / -1; }
.irow .val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8rem; color: var(--muted); align-items: center; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
details summary { cursor: pointer; font-weight: 650; padding: 6px 0; }
.quotes { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.quotes blockquote { margin: 0; padding: 8px 12px; background: var(--surface-2); border-left: 4px solid var(--accent); border-radius: 0 10px 10px 0; font-size: 0.93rem; overflow-wrap: anywhere; }
.info { background: var(--sky); color: var(--sky-ink); border-radius: 12px; padding: 12px 14px; font-size: 0.92rem; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; white-space: nowrap; }
td:first-child { white-space: nowrap; }
.card.wide { grid-column: 1 / -1; }
.checklist { display: flex; flex-direction: column; gap: 6px; }
.checkrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 20; max-width: calc(100% - 32px); }
.login { max-width: 420px; margin: 12vh auto 0; }

@media (max-width: 520px) {
  .card { padding: 16px; }
  .likert-btn { min-height: 48px; }
}
@media (prefers-reduced-motion: no-preference) {
  .progress > span, .scorebar > span, .stepper > i { transition: width 0.4s ease, background 0.25s ease; }
}
