/* Qala platform styles
   Palette from the Qala logo. Montserrat for headings (matches the wordmark),
   Atkinson Hyperlegible for reading (built for legibility on small, cheap screens). */

:root {
  --navy: #04224F;
  --navy-2: #0B3366;
  --teal: #14988A;
  --teal-ink: #0E6E64;
  --green: #29D049;
  --green-press: #22B23E;
  --lime: #7CEA1D;
  --mint: #EEF6F5;
  --mint-2: #DDEEEB;
  --paper: #FFFFFF;
  --ink: #04224F;
  --ink-soft: #4A5868;
  --line: #C9D6DE;
  --line-soft: #E3EAEF;
  --danger: #B42318;
  --danger-bg: #FDECEA;
  --warn-bg: #FFF4D6;
  --ok-bg: #E3F8E6;

  --font-head: 'Montserrat', 'Segoe UI', Arial, sans-serif;
  --font-body: 'Atkinson Hyperlegible', 'Segoe UI', Arial, sans-serif;
  --font-slip: 'Courier New', Courier, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 18px;
  --wrap: 1120px;
  --step: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}
img { max-width: 100%; display: block; }
a { color: var(--teal-ink); text-underline-offset: 3px; }
a:hover { color: var(--navy); }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

h1, h2, h3, h4 { font-family: var(--font-head); color: var(--navy); line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 1.2rem + 1.2vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
h4 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 1em; max-width: 68ch; }
.lead { font-size: 1.15em; color: var(--ink-soft); }
.small { font-size: 0.875rem; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: min(var(--wrap), 100% - 2.5rem); margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.spread { display: flex; gap: 1rem; justify-content: space-between; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- header */
.site-header { border-bottom: 1px solid var(--line-soft); background: var(--paper); position: relative; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; }
.brand img { height: 40px; width: auto; }
.nav { display: flex; gap: 0.25rem; align-items: center; flex-wrap: wrap; }
.nav a { font-family: var(--font-head); font-weight: 600; font-size: 0.92rem; color: var(--navy); text-decoration: none; padding: 0.55rem 0.75rem; border-radius: var(--r-sm); }
.nav a:hover, .nav a[aria-current="page"] { background: var(--mint); }
.nav .btn { margin-left: 0.25rem; }
@media (max-width: 640px) {
  .brand img { height: 32px; }
  .nav a:not(.btn) { display: none; }
  .nav a.keep { display: inline-block; }
}

/* ---------------------------------------------------------------- buttons */
.btn {
  --bg: var(--green); --fg: var(--navy); --bd: var(--green);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--font-head); font-weight: 700; font-size: 0.98rem; line-height: 1;
  padding: 0.85rem 1.25rem; min-height: 46px;
  background: var(--bg); color: var(--fg); border: 2px solid var(--bd); border-radius: var(--r-md);
  text-decoration: none; cursor: pointer;
}
.btn:hover { --bg: var(--green-press); --bd: var(--green-press); color: var(--navy); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { --bg: transparent; --fg: var(--navy); --bd: var(--navy); }
.btn.secondary:hover { --bg: var(--mint); }
.btn.quiet { --bg: transparent; --fg: var(--teal-ink); --bd: transparent; padding-inline: 0.5rem; }
.btn.quiet:hover { --bg: var(--mint); }
.btn.danger { --bg: transparent; --fg: var(--danger); --bd: var(--danger); }
.btn.small { min-height: 36px; padding: 0.5rem 0.8rem; font-size: 0.86rem; }
.btn.block { width: 100%; }
.on-navy .btn.secondary { --fg: #fff; --bd: #fff; }
.on-navy .btn.secondary:hover { --bg: rgba(255,255,255,0.08); color: #fff; }

/* ---------------------------------------------------------------- forms */
label, .label { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.hint { display: block; font-size: 0.875rem; color: var(--ink-soft); font-weight: 400; margin-top: 0.15rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"],
input[type="date"], input[inputmode], select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: 0.7rem 0.8rem; min-height: 46px;
  border: 2px solid var(--line); border-radius: var(--r-sm); background: #fff;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px rgba(20,152,138,0.2); }
.field { margin-bottom: 1rem; }
.field-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.check { display: grid; grid-template-columns: 26px 1fr; gap: 0.6rem; align-items: start; font-weight: 400; margin-bottom: 0.7rem; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--teal); }
.req { color: var(--danger); font-weight: 700; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { font-family: var(--font-head); font-weight: 700; margin-bottom: 0.5rem; padding: 0; }

.notice { border-radius: var(--r-md); padding: 0.9rem 1rem; background: var(--mint); border-left: 5px solid var(--teal); }
.notice.warn { background: var(--warn-bg); border-left-color: #C98A00; }
.notice.error { background: var(--danger-bg); border-left-color: var(--danger); }
.notice.ok { background: var(--ok-bg); border-left-color: var(--green-press); }
.notice p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- panels and tables */
.panel { background: #fff; border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: clamp(1rem, 0.8rem + 1vw, 1.75rem); }
.panel.mint { background: var(--mint); border-color: transparent; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-md); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-family: var(--font-head); font-size: 0.82rem; font-weight: 700; color: #fff; background: var(--navy); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--mint); }

.badge { display: inline-block; font-family: var(--font-head); font-weight: 700; font-size: 0.78rem; padding: 0.22rem 0.55rem; border-radius: 999px; background: var(--mint-2); color: var(--navy); white-space: nowrap; }
.badge.distinction { background: var(--green); color: var(--navy); }
.badge.pass { background: #CFEFEA; color: var(--teal-ink); }
.badge.notyet { background: #EEF1F4; color: var(--ink-soft); }
.badge.flag, .badge.withdrawn { background: var(--danger-bg); color: var(--danger); }
.badge.review { background: var(--warn-bg); color: #7A5200; }

/* ---------------------------------------------------------------- toast */
.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 0.8rem 1.1rem; border-radius: var(--r-md); z-index: 100; max-width: calc(100% - 2rem); box-shadow: 0 8px 30px rgba(4,34,79,0.25); }
.toast.error { background: var(--danger); }

/* ---------------------------------------------------------------- home */
.hero { padding: clamp(2rem, 1rem + 5vw, 5rem) 0 clamp(2.5rem, 1rem + 4vw, 4.5rem); }
.hero .wrap { display: grid; gap: clamp(2rem, 1rem + 4vw, 4rem); grid-template-columns: 1fr; align-items: center; }
@media (min-width: 900px) { .hero .wrap { grid-template-columns: 1.15fr 0.85fr; } }
.hero h1 { max-width: 13ch; }
.hero .lead { max-width: 46ch; }
.promise { margin-top: 1.25rem; font-size: 0.95rem; color: var(--teal-ink); font-weight: 700; }

/* The till slip: the one memorable element. A real task, answerable on the page. */
.slip {
  font-family: var(--font-slip); color: #1d2733; background: #fff;
  width: min(360px, 100%); margin-inline: auto; padding: 1.4rem 1.4rem 1.1rem;
  border: 1px solid var(--line); border-top: 0; border-bottom: 0; position: relative;
  box-shadow: 0 18px 40px -18px rgba(4,34,79,0.35);
  transform: rotate(-1.2deg);
}
.slip::before, .slip::after { content: ""; position: absolute; left: -1px; right: -1px; height: 12px;
  background: radial-gradient(circle at 6px 0, transparent 6px, #fff 6.5px) repeat-x; background-size: 12px 12px; }
.slip::before { top: -12px; transform: scaleY(-1); }
.slip::after { bottom: -12px; }
.slip .shop { text-align: center; font-weight: 700; letter-spacing: 0.04em; margin-bottom: 0.2rem; }
.slip .meta { text-align: center; font-size: 0.8rem; color: #5b6675; margin-bottom: 0.9rem; }
.slip .line { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.93rem; padding: 0.12rem 0; }
.slip .rule { border-top: 1px dashed #9aa6b2; margin: 0.55rem 0; }
.slip .total { font-weight: 700; font-size: 1.02rem; }
.slip label { font-family: var(--font-body); font-size: 0.95rem; margin: 1rem 0 0.35rem; color: var(--navy); }
.slip .answer { display: flex; gap: 0.5rem; }
.slip .answer input { font-family: var(--font-slip); font-size: 1.05rem; }
.slip .answer .btn { min-height: 46px; padding-inline: 0.9rem; }
.slip .verdict { font-family: var(--font-body); font-size: 0.93rem; margin: 0.65rem 0 0; min-height: 1.5em; color: var(--navy); }
.slip .verdict.right { color: var(--teal-ink); font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
  .slip { animation: print 700ms cubic-bezier(.2,.8,.2,1) both 150ms; }
  @keyframes print { from { clip-path: inset(0 0 100% 0); transform: rotate(-1.2deg) translateY(-12px); } to { clip-path: inset(-20px -20px -20px -20px); transform: rotate(-1.2deg); } }
}

.band-section { padding: clamp(2.5rem, 1.5rem + 4vw, 4.5rem) 0; }
.band-section.mint { background: var(--mint); }
.band-section.navy { background: var(--navy); color: #fff; }
.band-section.navy h2, .band-section.navy h3 { color: #fff; }
.band-section.navy p { color: #D7E3EC; }

.steps { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); counter-reset: step; }
.steps li { counter-increment: step; padding-top: 3.2rem; position: relative; }
.steps li::before { content: counter(step); position: absolute; top: 0; left: 0; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--navy); color: #fff; font-family: var(--font-head); font-weight: 800; display: grid; place-items: center; }
.band-section.mint .steps li::before { background: var(--teal); }

.two-up { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 1.5rem; }
.service { border-top: 4px solid var(--lime); padding-top: 1rem; }
.service ul { padding-left: 1.1rem; margin: 0 0 1rem; color: #D7E3EC; }

.site-footer { border-top: 1px solid var(--line-soft); padding: 2rem 0 2.5rem; font-size: 0.92rem; color: var(--ink-soft); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; }
.site-footer a { color: var(--ink-soft); }

/* ---------------------------------------------------------------- app pages */
.page { padding: clamp(1.5rem, 1rem + 2vw, 3rem) 0 4rem; }
.page-head { margin-bottom: 1.5rem; }
.grid-dash { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 960px) { .grid-dash { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.auth-card { max-width: 560px; margin-inline: auto; }
.tabs { display: flex; gap: 0.25rem; border-bottom: 2px solid var(--line-soft); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs button { font: inherit; font-family: var(--font-head); font-weight: 700; font-size: 0.95rem; color: var(--ink-soft); background: none; border: 0; padding: 0.75rem 1rem; border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--green); }

.sim-card { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.sim-card .choices { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.meter { height: 10px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--teal); border-radius: 999px; }
.skill { display: grid; grid-template-columns: minmax(140px, 1fr) 2fr 3rem; gap: 0.75rem; align-items: center; margin-bottom: 0.6rem; font-size: 0.95rem; }
.cv-lines { padding-left: 1.1rem; }
.cv-lines li { margin-bottom: 0.4rem; }
.cert { border: 2px solid var(--navy); border-radius: var(--r-lg); padding: 1.1rem 1.2rem; position: relative; overflow: hidden; }
.cert::after { content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: var(--lime); opacity: 0.25; }
.share-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

/* ---------------------------------------------------------------- simulation */
.sim-bar { position: sticky; top: 0; z-index: 30; background: var(--navy); color: #fff; }
.sim-bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 60px; flex-wrap: wrap; padding-block: 0.4rem; }
.sim-bar .sections { display: flex; gap: 0.25rem; }
.sim-bar .sections a { color: #fff; text-decoration: none; font-family: var(--font-head); font-weight: 700; font-size: 0.9rem; padding: 0.4rem 0.7rem; border-radius: var(--r-sm); background: rgba(255,255,255,0.08); }
.sim-bar .sections a:hover { background: rgba(255,255,255,0.18); }
.timer { font-family: var(--font-head); font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--lime); }
.saved { font-size: 0.82rem; color: #BFD2E0; }
.sim-section { scroll-margin-top: 80px; margin-top: 2rem; }
.sim-section > h2 { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.sim-section > h2 .marks { font-family: var(--font-body); font-size: 0.95rem; font-weight: 400; color: var(--ink-soft); }
.task { background: #fff; border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: clamp(1rem, 0.8rem + 1vw, 1.6rem); margin-bottom: 1.1rem; }
.task h3 { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.task h3 .marks { font-family: var(--font-body); font-weight: 400; font-size: 0.9rem; color: var(--teal-ink); white-space: nowrap; }
.task table td, .task table th { vertical-align: middle; }
.money { display: flex; align-items: stretch; }
.money span { display: grid; place-items: center; padding: 0 0.6rem; background: var(--mint); border: 2px solid var(--line); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); font-weight: 700; }
.money input { border-radius: 0 var(--r-sm) var(--r-sm) 0; min-width: 0; }
.coins { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); margin-top: 0.75rem; }
.coin { border: 2px solid var(--line); border-radius: var(--r-md); padding: 0.5rem; text-align: center; }
.coin .d { font-family: var(--font-head); font-weight: 800; }
.coin .ctl { display: grid; grid-template-columns: 36px 1fr 36px; gap: 0.25rem; align-items: center; margin-top: 0.35rem; }
.coin button { font: inherit; font-weight: 800; height: 36px; border: 0; border-radius: var(--r-sm); background: var(--mint-2); color: var(--navy); cursor: pointer; }
.coin output { font-weight: 800; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
.seg label { margin: 0; font-weight: 700; font-size: 0.9rem; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 0.5rem 0.75rem; border: 2px solid var(--line); border-radius: 999px; cursor: pointer; }
.seg input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--lime); outline-offset: 2px; }
.options { display: grid; gap: 0.6rem; margin-top: 0.75rem; }
.option { display: grid; grid-template-columns: 28px 1fr; gap: 0.6rem; padding: 0.8rem 0.9rem; border: 2px solid var(--line); border-radius: var(--r-md); cursor: pointer; font-weight: 400; margin: 0; }
.option input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--navy); }
.option:has(input:checked) { border-color: var(--navy); background: var(--mint); }
.counter { font-size: 0.85rem; color: var(--ink-soft); text-align: right; margin-top: 0.25rem; }
.submit-zone { margin: 2rem 0; }
.result-mark { font-weight: 700; }
.result-mark.right { color: var(--teal-ink); }
.result-mark.wrong { color: var(--danger); }
.model { background: var(--mint); border-radius: var(--r-md); padding: 0.75rem 0.9rem; margin-top: 0.6rem; font-size: 0.95rem; }
.score-big { font-family: var(--font-head); font-weight: 800; font-size: clamp(2.6rem, 2rem + 3vw, 4rem); line-height: 1; color: var(--navy); }
dialog { border: 0; border-radius: var(--r-lg); padding: 1.5rem; max-width: 460px; width: calc(100% - 2rem); color: var(--ink); }
dialog::backdrop { background: rgba(4,34,79,0.55); }

/* ---------------------------------------------------------------- verify */
.verify-card { max-width: 640px; margin: 0 auto; border: 2px solid var(--navy); border-radius: var(--r-lg); overflow: hidden; }
.verify-card .top { background: var(--navy); color: #fff; padding: 1.25rem 1.5rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.verify-card .top img { height: 38px; width: auto; }
.verify-card .body { padding: 1.5rem; }
.verify-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.25rem; margin: 1rem 0; }
.verify-card dt { color: var(--ink-soft); }
.verify-card dd { margin: 0; font-weight: 700; }
.status-valid { color: var(--teal-ink); }
.status-bad { color: var(--danger); }

/* ---------------------------------------------------------------- staff */
.filters { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1rem; }
.drawer { position: fixed; inset: 0 0 0 auto; width: min(760px, 100%); background: #fff; z-index: 60; overflow-y: auto; box-shadow: -20px 0 50px rgba(4,34,79,0.25); padding: 1.25rem clamp(1rem, 0.5rem + 2vw, 2rem) 3rem; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(4,34,79,0.4); z-index: 55; }
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; font-size: 0.93rem; }
.answer-grid .k { color: var(--ink-soft); }
pre.written { white-space: pre-wrap; font-family: var(--font-body); background: var(--mint); padding: 0.75rem; border-radius: var(--r-sm); margin: 0.4rem 0; }
