:root {
  --navy: #002D62;
  --navy2: #003B82;
  --red: #C8102E;
  --bg: #F5F4F0;
  --text: #0D1B2A;
  --muted: #6B7A90;
  --white: #FFFFFF;
  --dark: #06080F;
  --paper: #fffdf8;
  --line: rgba(13, 27, 42, 0.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.35;
}

a { color: var(--navy); font-weight: 700; text-decoration: none; }

.page {
  width: 210mm;
  min-height: 297mm;
  margin: 16px auto;
  padding: 18mm;
  background: var(--paper);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0, 45, 98, 0.14);
  position: relative;
  overflow: hidden;
}
.page.landscape {
  width: 297mm;
  min-height: 210mm;
  padding: 16mm;
}

.blob {
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
}
.page > *:not(.blob) { position: relative; z-index: 1; }

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 3px solid var(--red);
}
.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 8px;
}
h1 {
  font-size: 42px;
  line-height: 0.98;
  margin: 0;
  font-weight: 900;
  color: var(--navy);
  letter-spacing: -0.03em;
}
h2 {
  font-size: 24px;
  line-height: 1.05;
  margin: 0 0 10px;
  font-weight: 850;
  color: var(--navy);
}
h3 {
  font-size: 16px;
  margin: 0 0 8px;
  font-weight: 850;
  color: var(--text);
}
p { margin: 0 0 10px; }
.subtitle {
  max-width: 760px;
  font-size: 17px;
  color: var(--muted);
  font-weight: 500;
}
.brand {
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: right;
}

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 22px rgba(0, 45, 98, 0.07);
}
.card.navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.card.red { background: var(--red); color: #fff; border-color: var(--red); }
.card.navy h2, .card.navy h3, .card.red h2, .card.red h3 { color: #fff; }
.card p, .small { color: var(--muted); }
.card.navy p, .card.red p { color: rgba(255,255,255,0.78); }

.num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  margin-bottom: 10px;
}
.num.navy { background: var(--navy); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(0,45,98,0.08);
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}
.dot { width: 8px; height: 8px; border-radius: 999px; background: var(--red); }

.term {
  border-left: 6px solid var(--red);
  padding-left: 14px;
}
.term:nth-child(even) { border-left-color: var(--navy); }
.term strong { color: var(--navy); font-size: 18px; display: block; margin-bottom: 3px; }

.lines {
  min-height: 96px;
  background-image: repeating-linear-gradient(to bottom, transparent 0 27px, rgba(13,27,42,0.10) 28px);
}
.box-empty {
  min-height: 138px;
  border: 2px dashed rgba(13,27,42,0.25);
  border-radius: 14px;
  background: rgba(255,255,255,0.56);
}
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 9px;
  margin-bottom: 9px;
  font-size: 14px;
}
.check::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--red);
  border-radius: 5px;
  margin-top: 1px;
}

.postit-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.postit {
  min-height: 116px;
  padding: 14px;
  border-radius: 6px 18px 8px 18px;
  box-shadow: 0 10px 22px rgba(0,0,0,0.12);
  transform: rotate(var(--rot, -1deg));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(0,0,0,0.08);
}
.postit.yellow { background: #FFE86B; }
.postit.pink { background: #FFB3C7; }
.postit.blue { background: #9EDBFF; }
.postit.green { background: #B8F2C2; }
.postit .label { font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; opacity: .55; }
.postit .text { font-size: 18px; font-weight: 800; line-height: 1.08; }
.postit .hint { font-size: 12px; opacity: .62; font-weight: 700; }

.rubric {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}
.rubric th, .rubric td {
  padding: 12px 13px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  font-size: 13px;
}
.rubric th {
  background: var(--navy);
  color: #fff;
  font-weight: 850;
}
.rubric th:last-child, .rubric td:last-child { border-right: 0; }
.rubric tr:last-child td { border-bottom: 0; }
.rubric .criterion { font-weight: 850; color: var(--navy); font-size: 14px; }
.score-row { display: flex; gap: 8px; margin-top: 8px; }
.score {
  width: 28px; height: 28px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--muted); color: var(--muted);
  font-size: 13px; font-weight: 850;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@page { size: A4 portrait; margin: 0; }
@page landscape { size: A4 landscape; margin: 0; }
@media print {
  html, body { background: #fff; }
  .page { margin: 0; box-shadow: none; border-radius: 0; width: 210mm; min-height: 297mm; break-after: page; }
  .page.landscape { page: landscape; width: 297mm; min-height: 210mm; }
  .no-print { display: none !important; }
  a { color: inherit; }
}

/* Print/layout refinements for A4 exports */
.page.compact { padding: 14mm; }
.page.compact .header { margin-bottom: 14px; padding-bottom: 10px; }
.page.compact h1 { font-size: 34px; }
.page.compact h2 { font-size: 19px; margin-bottom: 7px; }
.page.compact h3 { font-size: 14px; margin-bottom: 5px; }
.page.compact .subtitle { font-size: 14px; }
.page.compact .card { padding: 12px; border-radius: 12px; }
.page.compact .grid { gap: 10px; }
.page.compact .num { width: 27px; height: 27px; font-size: 12px; margin-bottom: 6px; }
.page.compact p { font-size: 13px; margin-bottom: 6px; }
.page.compact .footer { margin-top: 10px; padding-top: 8px; }

.glossary-page .term strong { font-size: 15px; }
.glossary-page .term p { font-size: 12px; line-height: 1.25; }
.glossary-page .card { min-height: 72px; }

.practice-page .card.navy,
.practice-page .card.red { min-height: 118px; }
.practice-page .checklist li { font-size: 12px; margin-bottom: 6px; grid-template-columns: 18px 1fr; }
.practice-page .check::before { width: 14px; height: 14px; border-radius: 4px; }
.practice-page .prompt-card p { font-size: 12px; line-height: 1.25; }
.practice-page .mini-step p { font-size: 11.5px; line-height: 1.25; }

.postit-pairs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.postit-pair {
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.32);
  border-radius: 18px;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.postit-pair-title {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.76);
}
.postit.writeable {
  min-height: 126px;
  transform: none;
  box-shadow: 0 8px 18px rgba(0,0,0,.14);
}
.postit.writeable .label { font-size: 10px; }
.postit.writeable .text { font-size: 16px; }
.write-space {
  flex: 1;
  min-height: 55px;
  margin-top: 8px;
  background-image: repeating-linear-gradient(to bottom, transparent 0 21px, rgba(0,0,0,.12) 22px);
}

.rubric-page { padding: 10mm; }
.rubric-page .header { margin-bottom: 10px; padding-bottom: 8px; }
.rubric-page h1 { font-size: 30px; }
.rubric-page .subtitle { font-size: 12px; max-width: 720px; }
.rubric-page .brand { font-size: 10px; }
.rubric-page .rubric { border-radius: 12px; }
.rubric-page .rubric th,
.rubric-page .rubric td { padding: 7px 8px; font-size: 10.5px; line-height: 1.16; }
.rubric-page .rubric .criterion { font-size: 11px; }
.rubric-page .score-row { gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.rubric-page .score { width: 20px; height: 20px; font-size: 10px; border-width: 1.5px; }
.rubric-page .card { padding: 10px; border-radius: 12px; }
.rubric-page .grid { gap: 10px; }
.rubric-page h2 { font-size: 16px; margin-bottom: 4px; }
.rubric-page p { font-size: 11px; margin-bottom: 4px; }
.rubric-page .lines { min-height: 48px !important; background-image: repeating-linear-gradient(to bottom, transparent 0 18px, rgba(13,27,42,0.18) 19px); }
.rubric-page .footer { margin-top: 8px; padding-top: 6px; font-size: 9px; }

@media print {
  .blob { display: none !important; }
  .page {
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    width: 210mm;
    height: 297mm;
    min-height: 0;
    overflow: hidden;
    break-after: page;
  }
  .page.landscape {
    page: landscape;
    width: 297mm;
    height: 210mm;
    min-height: 0;
  }
  .page.compact { padding: 13mm; }
  .page.landscape.rubric-page { padding: 9mm; }

}
/* ── B&W print mode ─────────────────────────────────────────────────────
   Activado añadiendo clase 'bw' a <html> (lo hace bw.js cuando URL lleva ?bw).
   Sobreescribe colores para impresión económica en B&W. */

html.bw {
  --navy:  #000;
  --navy2: #000;
  --red:   #000;
  --bg:    #fff;
  --muted: #555;
  --paper: #fff;
  --line:  rgba(0,0,0,0.18);
}
html.bw body { background: #fff; }
html.bw .blob { display: none !important; }
html.bw .page { box-shadow: none; background: #fff; }

html.bw .card {
  background: #fff !important;
  border: 1.5px solid #bbb !important;
  box-shadow: none !important;
}
html.bw .card.navy,
html.bw .card.red {
  background: #fff !important;
  color: #000 !important;
  border: 2px solid #000 !important;
}
html.bw .card.navy h2, html.bw .card.navy h3,
html.bw .card.red  h2, html.bw .card.red  h3 { color: #000 !important; }
html.bw .card.navy p,  html.bw .card.red  p  { color: #555 !important; }
html.bw [style*="border-top:7px solid var(--red)"],
html.bw [style*="border-top: 7px solid var(--red)"] { border-top-color: #000 !important; }
html.bw [style*="border-top:7px solid var(--navy)"],
html.bw [style*="border-top: 7px solid var(--navy)"] { border-top-color: #555 !important; }

html.bw .num        { background: #000 !important; }
html.bw .num.navy   { background: #555 !important; }
html.bw .pill       { background: #eee !important; color: #000 !important; }
html.bw .dot        { background: #000 !important; }

html.bw h1, html.bw h2, html.bw h3 { color: #000 !important; }
html.bw .eyebrow    { color: #000 !important; }
html.bw .brand      { color: #444 !important; }
html.bw .header     { border-bottom-color: #000 !important; }
html.bw .footer     { border-top-color: #bbb !important; color: #555 !important; }

html.bw .term { border-left-color: #000 !important; }
html.bw .term:nth-child(even) { border-left-color: #555 !important; }
html.bw .term strong { color: #000 !important; }

html.bw .rubric th  { background: #000 !important; }
html.bw .rubric th, html.bw .rubric td { border-color: #bbb !important; }
html.bw .criterion  { color: #000 !important; }
html.bw .score      { border-color: #555 !important; color: #555 !important; }
html.bw .check::before { border-color: #000 !important; }

html.bw .postit       { background: #f4f4f4 !important; box-shadow: none !important; border: 1.5px solid #bbb !important; }
html.bw .postit-pair  { background: #f4f4f4 !important; border: 1px solid #bbb !important; }
html.bw .postit-pair-title { color: #333 !important; }

html.bw a { color: #000 !important; }

/* ── fin B&W ─────────────────────────────────────────────────────────── */

/* ── Campos editables ──────────────────────────────────────────────────── */
[contenteditable] {
  cursor: text;
  padding: 6px 8px;
  outline: none;
  border-radius: 6px;
  transition: box-shadow 0.15s;
}
[contenteditable]:hover {
  box-shadow: 0 0 0 1.5px rgba(0,45,98,0.18);
}
[contenteditable]:focus {
  box-shadow: 0 0 0 2.5px rgba(0,45,98,0.40);
}
[contenteditable][data-ph]:empty::before {
  content: attr(data-ph);
  color: rgba(13,27,42,0.28);
  pointer-events: none;
  display: block;
  font-style: italic;
  font-weight: 400;
  font-size: 0.88em;
}
.card.navy [contenteditable][data-ph]:empty::before {
  color: rgba(255,255,255,0.35);
}
@media print {
  [contenteditable] { box-shadow: none !important; cursor: default; padding: 4px 6px; }
  [contenteditable][data-ph]:empty::before { display: none; }
}

/* ── Scores clickables en rúbrica ──────────────────────────────────────── */
.score { cursor: pointer; user-select: none; transition: background 0.1s, color 0.1s, border-color 0.1s; }
.score:hover { border-color: var(--navy); color: var(--navy); }
.score.selected {
  background: var(--navy); color: #fff !important;
  border-color: var(--navy);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
@media print {
  .score { cursor: default; }
  .score.selected { background: var(--navy) !important; color: #fff !important; }
}

.postit.writeable { color: var(--text); justify-content: flex-start; }
.postit.writeable .label { color: rgba(13,27,42,.45); opacity: 1; }
.postit.writeable .text { color: var(--text); }
.postit.writeable .hint { color: rgba(13,27,42,.55); opacity: 1; margin-top: 8px; }
.write-space {
  border-bottom: 2px solid rgba(13,27,42,.16);
  background-image: linear-gradient(to bottom, transparent calc(100% - 1px), rgba(13,27,42,.16) 0);
  background-size: 100% 24px;
  background-position: 0 10px;
}
