/* Exercise-book look (ruled paper, red margin) with the colours of the Rwandan flag: blue, yellow, green */
:root {
  --paper: #fbfdff;
  --rule: #dcebf7;
  --margin: #e06666;
  --ink: #0b5ea8;
  --ink-dark: #08427a;
  --sky: #00a1de;
  --sun: #fad201;
  --leaf: #20603d;
  --leaf-light: #e3f3ea;
  --sky-light: #e2f4fc;
  --sun-light: #fff6c7;
  --text: #24272e;
  --muted: #5d6370;
  --line: #c9cfd8;
  --ok: #1d7a46;
  --warn: #9a5b00;
  --err: #b42318;
  --highlight: #fff3c4;
  --radius: 6px;
  --head: 'Bitter', Georgia, serif;
  --body: 'Atkinson Hyperlegible', Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--paper);
  /* ruled lines + red margin line, like a school exercise book */
  background-image:
    linear-gradient(90deg, transparent 47px, var(--margin) 47px, var(--margin) 49px, transparent 49px),
    repeating-linear-gradient(180deg, transparent 0 31px, var(--rule) 31px 32px);
  background-attachment: local;
}
h1, h2, h3 { font-family: var(--head); color: var(--ink); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--ink); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #f2b705; outline-offset: 2px;
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px 0 64px; }
@media (max-width: 600px) {
  body { background-image: repeating-linear-gradient(180deg, transparent 0 31px, var(--rule) 31px 32px); }
  .wrap { padding: 0 16px; }
}

/* Top bar: blue band with a blue-yellow-green stripe underneath */
.topbar { background: linear-gradient(100deg, var(--ink-dark) 0%, var(--ink) 55%, var(--sky) 100%); position: sticky; top: 0; z-index: 5;
          box-shadow: 0 2px 0 var(--sun), 0 5px 0 var(--leaf); margin-bottom: 5px; }
.topbar .wrap { display: flex; align-items: center; gap: 16px; min-height: 62px; flex-wrap: wrap; }
.topbar a, .topbar .linkbtn { color: #fff; }
.topbar .btn.secondary { color: #fff; border-color: #fff; }
.topbar .btn.secondary:hover { background: rgba(255,255,255,.15); }
.brand { font-family: var(--head); font-weight: 700; font-size: 1.5rem; color: #fff; text-decoration: none; margin-right: auto; letter-spacing: .01em; }
.brand::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--sun); margin-right: 8px; vertical-align: 2px;
                 box-shadow: 0 0 0 3px rgba(250,210,1,.35); }
.brand small { font-family: var(--body); font-weight: 400; font-size: .8rem; color: #d6ecfb; margin-left: 8px; }
.balance { font-weight: 700; color: #3a2f00; background: var(--sun); padding: 3px 12px; border-radius: 20px; white-space: nowrap; }
.help { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .92rem; color: #fff; text-decoration: none;
        background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35); padding: 4px 12px; border-radius: 20px; white-space: nowrap; }
.help:hover { background: rgba(255,255,255,.25); }
.help svg { width: 16px; height: 16px; fill: currentColor; }
@media (max-width: 520px) { .help .label { display: none; } }

/* Buttons */
.btn {
  display: inline-block; font: 700 1rem var(--body); text-decoration: none; cursor: pointer;
  padding: 11px 20px; border-radius: var(--radius); border: 2px solid var(--ink);
  background: var(--ink); color: #fff;
}
.btn:hover { background: var(--ink-dark); border-color: var(--ink-dark); }
.btn.green { background: var(--leaf); border-color: var(--leaf); }
.btn.green:hover { background: #174a2f; border-color: #174a2f; }
.btn.secondary { background: transparent; color: var(--ink); }
.btn.secondary:hover { background: #eaf0fb; }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.btn:disabled { opacity: .55; cursor: wait; }
.linkbtn { background: none; border: 0; color: var(--ink); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }

/* Forms */
form { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px 16px; }
.full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: .92rem; color: var(--text); }
label .hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
input, select, textarea {
  font: 1rem var(--body); color: var(--text); background: #fff;
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: 10px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
textarea { min-height: 70px; resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend { font-family: var(--head); font-weight: 700; color: var(--ink); font-size: 1.15rem; margin-bottom: 10px; padding: 0; }
legend::after { content: ''; display: block; width: 48px; height: 4px; border-radius: 2px; margin-top: 6px;
                background: linear-gradient(90deg, var(--sky) 0 33%, var(--sun) 33% 66%, var(--leaf) 66%); }

/* A sheet of paper sitting on the page */
.sheet { background: #fff; border: 1px solid var(--line); border-top: 5px solid var(--sky); border-radius: var(--radius); padding: 24px;
         box-shadow: 0 6px 18px rgba(11, 94, 168, .08); }
#p-exam .sheet { border-top-color: var(--leaf); }
#p-topup .sheet { border-top-color: var(--sun); }
@media (max-width: 600px) { .sheet { padding: 18px 16px; } }

.msg { padding: 10px 14px; border-radius: var(--radius); margin: 12px 0 0; font-weight: 700; }
.msg:empty { display: none; }
.msg.ok { background: #e5f4ea; color: var(--ok); }
.msg.err { background: #fdecea; color: var(--err); }
.msg.info { background: #eaf0fb; color: var(--ink-dark); }
.muted { color: var(--muted); }

/* Tabs in the teacher area */
.tabs { display: flex; gap: 6px; margin: 24px 0 0; border-bottom: 3px solid var(--ink); flex-wrap: wrap; }
.tabs button {
  font: 700 1rem var(--body); background: transparent; border: 2px solid transparent; border-bottom: 0;
  padding: 10px 16px; color: var(--muted); cursor: pointer; border-radius: var(--radius) var(--radius) 0 0; margin-bottom: -2px;
}
.tabs button:hover { background: var(--sky-light); color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); border-bottom: 2px solid var(--ink); }
.tabs #t-exam[aria-selected="true"] { background: var(--leaf); border-color: var(--leaf); }
.tabs #t-topup[aria-selected="true"] { background: var(--sun); border-color: #e0bc00; color: #3a2f00; }
.panel { padding: 24px 0 48px; }
@media (max-width: 480px) { .tabs button { padding: 9px 10px; font-size: .92rem; } }
.panel[hidden] { display: none; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.list .title { font-weight: 700; }
.badge { font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 3px; background: #eef1f5; color: var(--muted); }
.badge.successful { background: #e5f4ea; color: var(--ok); }
.badge.pending { background: #fff3d6; color: var(--warn); }
.badge.failed, .badge.rejected { background: #fdecea; color: var(--err); }

.amounts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.amounts button { font: 700 1rem var(--body); padding: 10px 14px; border: 2px solid var(--line); background: #fff; border-radius: var(--radius); cursor: pointer; }
.amounts button[aria-pressed="true"] { border-color: var(--ink); background: #eaf0fb; color: var(--ink); }

table.data { width: 100%; border-collapse: collapse; font-size: .95rem; background: #fff; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-family: var(--head); color: var(--ink); }
.scroll { overflow-x: auto; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stats div { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stats b { display: block; font-family: var(--head); font-size: 1.5rem; color: var(--ink); }
.stats div:nth-child(3n+2) { border-top: 4px solid var(--sun); } .stats div:nth-child(3n+1) { border-top: 4px solid var(--sky); } .stats div:nth-child(3n) { border-top: 4px solid var(--leaf); }

footer { padding: 28px 0 32px; color: #d6ecfb; font-size: .95rem; background: var(--ink-dark); margin-top: 40px;
         box-shadow: 0 -4px 0 var(--leaf), 0 -7px 0 var(--sun); }
footer a { color: #fff; font-weight: 700; }
footer .contact { display: flex; gap: 10px 22px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
footer .contact a { display: inline-flex; gap: 6px; align-items: center; text-decoration: none; background: rgba(255,255,255,.1); padding: 6px 12px; border-radius: 20px; }
footer .contact a.wa { background: #25d366; color: #063; }
footer svg { width: 16px; height: 16px; fill: currentColor; }

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

/* ----- "Working" animation while a document is being written ----- */
.working { display: flex; gap: 18px; align-items: center; margin: 14px 0 0; padding: 14px 16px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--sky-light), var(--sun-light)); border: 1px solid var(--rule); }
.working[hidden] { display: none; }
.wk-sheet { position: relative; flex: 0 0 64px; height: 80px; background: #fff; border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 3px 8px rgba(8, 66, 122, .15); overflow: hidden; }
.wk-sheet::before { content: ''; position: absolute; left: 9px; top: 0; bottom: 0; width: 1px; background: var(--margin); opacity: .6; }
.wk-sheet i { position: absolute; left: 14px; height: 4px; border-radius: 2px; background: var(--ink); width: 0; animation: wk-write 3.2s ease-in-out infinite; }
.wk-sheet i:nth-child(1) { top: 12px; animation-delay: 0s; }
.wk-sheet i:nth-child(2) { top: 24px; animation-delay: .5s; background: var(--leaf); }
.wk-sheet i:nth-child(3) { top: 36px; animation-delay: 1s; }
.wk-sheet i:nth-child(4) { top: 48px; animation-delay: 1.5s; background: var(--sky); }
.wk-sheet i:nth-child(5) { top: 60px; animation-delay: 2s; }
.wk-pen { position: absolute; width: 8px; height: 30px; right: 6px; top: 6px; border-radius: 2px 2px 0 0;
  background: linear-gradient(var(--sun) 0 70%, #c9a400 70% 85%, #333 85%); transform: rotate(35deg); transform-origin: bottom center;
  animation: wk-pen 1.6s ease-in-out infinite; }
@keyframes wk-write { 0% { width: 0; } 45%, 80% { width: 40px; } 100% { width: 0; } }
@keyframes wk-pen { 0%, 100% { transform: translate(0, 0) rotate(35deg); } 25% { transform: translate(-22px, 14px) rotate(30deg); }
  50% { transform: translate(-6px, 30px) rotate(38deg); } 75% { transform: translate(-26px, 42px) rotate(30deg); } }
.wk-body { flex: 1; min-width: 0; }
.wk-step { font-weight: 700; color: var(--ink-dark); min-height: 1.4em; }
.wk-step.fade { animation: wk-fade .5s ease; }
@keyframes wk-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.wk-bar { height: 10px; margin: 8px 0 6px; border-radius: 5px; background: #fff; border: 1px solid var(--line); overflow: hidden; }
.wk-bar b { display: block; height: 100%; width: 2%; border-radius: 5px; transition: width 1s linear;
  background: repeating-linear-gradient(45deg, var(--sky) 0 10px, var(--ink) 10px 20px); background-size: 28px 28px; animation: wk-stripes 1s linear infinite; }
@keyframes wk-stripes { to { background-position: 28px 0; } }
.wk-time { font-size: .9em; color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .wk-sheet i, .wk-pen, .wk-bar b, .wk-step.fade { animation: none; }
  .wk-sheet i { width: 40px; }
}

/* ----- Big, easy-to-see choices (type of assessment, level of learners) ----- */
.choose { margin: 16px 0 0; padding: 14px; border: 2px solid var(--sun); border-radius: var(--radius); background: var(--sun-light); }
.choose[hidden] { display: none; }
.choose-h { font-weight: 800; font-size: 1.08em; color: var(--ink-dark); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.choose-h .num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-size: .9em; }
.choose-h .hint { font-weight: 400; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tiles.three { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.tile { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 12px 14px 12px 40px; border: 2px solid var(--line);
  border-radius: 10px; background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.tile:hover { border-color: var(--sky); transform: translateY(-1px); }
.tile input { position: absolute; left: 13px; top: 15px; width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
.tile b { color: var(--ink-dark); }
.tile small { color: var(--muted); line-height: 1.3; }
.tile:has(input:checked) { border-color: var(--ink); background: var(--sky-light); box-shadow: 0 0 0 3px rgba(11, 94, 168, .18); }
.tile:has(input:focus-visible) { outline: 3px solid var(--sun); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
