/* SKAL Academy Formative Trackers (stand-alone).
   The tracker itself comes from AdminLens (formative-trackers.css/js) and
   follows --brand, --brand-soft and --bg set here - SKAL red and cream. */
:root {
  --brand: #c30000;
  --brand-soft: #fbe9e7;
  --bg: #f8f4ef;
  --panel: #ffffff;
  --text: #2f251f;
  --muted: #6f6258;
  --line: #ddcec0;
  --brand-button: color-mix(in srgb, var(--brand) 86%, #000);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

[hidden] { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 1.1rem;
}

.brand img { width: 44px; height: 44px; object-fit: contain; }
.brand strong { color: var(--brand); }

.topbar-actions { display: flex; gap: 6px; }

.link-btn {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.app {
  max-width: 1140px;
  margin: 0 auto;
  padding: 16px 0 40px;
  min-height: 60vh;
}

.loading, .center-note { text-align: center; color: var(--muted); padding: 40px 16px; }

.footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 20px 16px 32px; }

/* ---- Sign in / sign up ---- */
.auth {
  max-width: 440px;
  margin: 24px auto;
  padding: 0 16px;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 2px 12px rgba(47, 37, 31, 0.06);
}

.auth h1 { margin: 0 0 4px; font-size: 1.5rem; color: var(--brand); }
.auth .sub { margin: 0 0 16px; color: var(--muted); }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tabs button {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.tabs button.on { background: var(--brand-button); border-color: var(--brand-button); color: #fff; }

.field { display: block; margin-bottom: 12px; font-weight: 700; color: var(--muted); }
.field input {
  display: block;
  width: 100%;
  margin-top: 4px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: #fff;
}
.field input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.primary {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--brand-button);
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
}
.primary:disabled { opacity: 0.6; cursor: default; }

.plain-link {
  display: inline-block;
  margin-top: 12px;
  border: 0;
  background: none;
  padding: 6px 0;
  color: var(--brand-button);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.tip {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--brand-soft);
  border: 1px solid #f1c9c4;
  font-size: 0.92rem;
  line-height: 1.45;
}
.tip strong { display: block; margin-bottom: 2px; }
.tip em { display: block; margin-top: 6px; color: var(--muted); font-style: normal; }

.msg { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.msg.err { background: #fdecea; color: #a12a1e; }
.msg.ok { background: #e3f3e8; color: #2f7d4f; }

/* ---- Trial / status banner above the tracker ---- */
.banner {
  margin: 0 16px 4px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
}
.banner.warn { background: #fff4e0; border-color: #f0d3a3; }

/* ---- My account ---- */
.account { max-width: 640px; margin: 8px auto; padding: 0 16px; }
.account h1 { margin: 4px 0 2px; color: var(--brand); font-size: 1.6rem; }
.account .sub { margin: 0 0 16px; color: var(--muted); overflow-wrap: anywhere; }
.account .back { margin: 0 0 4px; }
.account .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 14px;
}
.account .card h2 { margin: 0 0 6px; font-size: 1.15rem; }
.account .card p { margin: 0 0 10px; line-height: 1.45; }
.account .card .fine { margin: 10px 0 0; color: var(--muted); font-size: 0.88rem; }
.status-ok { border-left: 6px solid #2f7d4f !important; }
.status-school { border-left: 6px solid #2f6f9f !important; }
.status-warn { border-left: 6px solid #d08a1e !important; background: #fffaf0 !important; }
.status-paused { border-left: 6px solid var(--brand) !important; }

.tile-row { display: flex; gap: 12px; margin-bottom: 14px; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 170px;
  padding: 16px 12px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: #fff;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}
.tile img { width: 54px; height: 54px; object-fit: contain; }
.tile-name { font-weight: 800; }
.tile-state { font-size: 0.85rem; font-weight: 700; color: #2f7d4f; }
.tile.off { cursor: not-allowed; opacity: 0.55; filter: grayscale(1); background: #f1ece6; }
.tile.off .tile-state { color: var(--muted); }

.account .card .plans-label { margin: 4px 0 8px; font-weight: 800; }
.plans { display: flex; gap: 10px; flex-wrap: wrap; }
.plan {
  flex: 1 1 140px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: var(--brand-button);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.plan strong { font-size: 1.3rem; }
.plan span { font-size: 0.9rem; }

.dl-row { display: flex; gap: 10px; flex-wrap: wrap; }
.secondary {
  flex: 1 1 180px;
  min-height: 48px;
  padding: 8px 14px;
  border: 1.5px solid var(--brand-button);
  border-radius: 12px;
  background: #fff;
  color: var(--brand-button);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.secondary:disabled { opacity: 0.5; cursor: default; }

/* ---- Printable copy of all sheets ---- */
#printReport { display: none; }
@media print {
  body.printing-report > *:not(#printReport) { display: none !important; }
  body.printing-report #printReport { display: block; }
  @page { size: letter; margin: 0.6in; }
  #printReport { font-family: "Avenir Next", "Segoe UI", sans-serif; color: #000; }
  .pr-cover { text-align: center; padding-top: 2in; break-after: page; }
  .pr-cover img { width: 110px; }
  .pr-cover h1 { color: #c30000; margin: 14px 0 6px; }
  .pr-sheet { break-after: page; }
  .pr-sheet:last-child { break-after: auto; }
  .pr-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
  .pr-head img { width: 40px; }
  .pr-title { margin: 0; font-weight: 800; font-size: 14pt; }
  .pr-meta { margin: 2px 0 0; font-size: 10pt; color: #444; }
  #printReport table { width: 100%; border-collapse: collapse; font-size: 10pt; }
  #printReport th, #printReport td { border: 1px solid #999; padding: 4px 6px; text-align: left; vertical-align: top; }
  #printReport th { background: #eee; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #printReport td.pr-c { text-align: center; width: 56px; }
  #printReport tr { break-inside: avoid; }
  #printReport .pr-absent td { color: #666; }
  #printReport em { font-style: normal; color: #555; }
}

/* ---- Moving data / sharing with a school ---- */
.account .card h1 { font-size: 1.4rem; margin: 0 0 10px; }
.account .card h2 + p, .account .card p + h2 { margin-top: 14px; }
.account .card .primary { width: auto; flex: 1 1 180px; padding: 8px 14px; }
.move-code {
  display: inline-block;
  margin: 0 0 10px !important;
  padding: 10px 16px;
  border: 2px dashed var(--brand);
  border-radius: 12px;
  background: var(--brand-soft);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-family: ui-monospace, Menlo, monospace;
}
.steps { margin: 0 0 6px; padding-left: 22px; line-height: 1.5; }
.steps li { margin-bottom: 6px; }
.have-code { margin-top: 14px; }
.have-code summary { cursor: pointer; font-weight: 700; color: var(--brand-button); padding: 6px 0; }
.code-form { margin-top: 8px; display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.code-form .field { flex: 1 1 200px; margin: 0; }
.code-form .field input { text-transform: uppercase; letter-spacing: 0.1em; }
.code-form .secondary { flex: 0 0 auto; }
.year-list { display: grid; gap: 8px; margin: 0 0 14px; }
.year-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}
.year-pick input { width: 22px; height: 22px; accent-color: var(--brand-button); }
.year-pick em { font-style: normal; font-weight: 600; color: var(--muted); }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: #2f251f;
  color: #fff;
  font-weight: 700;
  z-index: 1000;
}
