/* Foglio rosa. Site typography and neutral colours come from site.css. */
:root {
  --pink: #b4345a; --pink-soft: #f4cfd6;
  --stop: #9a4700; --stop-soft: #fbeddf;
  --ok: #1d6847; --ok-soft: #e2f1e9;
  --ko: #a3291d; --ko-soft: #f8e3df;
}
@media (prefers-color-scheme: dark) {
  :root {
    --pink: #f4a9bb; --pink-soft: #3d1a24;
    --stop: #ffb46e; --stop-soft: #3b2715;
    --ok: #8fd8b4; --ok-soft: #163527;
    --ko: #ff9d90; --ko-soft: #3e1e1a;
  }
}
[data-app="stradipass"] { --app-rule: #8b522e; }
[data-app="nautipass"] { --app-rule: #20614f; }
body { font-size: 16px; line-height: 1.4; font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
button, summary { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

.desk { background: var(--navy); color: var(--hero-text); }
.desk-inner, .register { width: min(100% - 2.5rem, 80rem); margin-inline: auto; }
.desk-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0; }
.desk-id { min-width: 0; padding-left: 14px; border-left: 6px solid var(--foam); }
.desk h1 { margin: 0; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.03em; }
.desk-acts { display: flex; align-items: center; gap: 24px; }
.kit, .new { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; font: 700 17px var(--font-display); }
.kit { color: var(--foam); }
.new { background: var(--foam); color: var(--navy); border: 0; border-radius: var(--radius-xs); padding: 0 22px; }
.desk :focus-visible { outline-color: var(--foam); }

.register { display: grid; grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr); gap: clamp(24px, 3.5vw, 56px); padding-block: 28px; }
.overview { position: sticky; align-self: start; top: 20px; }
.overview h2, .ledger-head h2 { margin: 0; color: var(--ink); }
.overview h2 { display: flex; align-items: center; min-height: 50px; font-size: 18px; }
.signals { border-block: 1px solid var(--ink); }
.signal {
  display: grid; width: 100%; padding: 16px 18px; gap: 6px; text-align: start;
  border: 0; border-radius: 0; background: var(--surface); color: var(--ink);
  font: 650 15px/1.1 var(--font-display); font-variant-numeric: tabular-nums;
}
.signal + .signal { border-top: 1px solid var(--line); }
.signal strong { font-size: clamp(64px, 5vw, 72px); font-weight: 800; line-height: .96; letter-spacing: -.04em; }
.signal.ready { background: var(--pink-soft); }
.signal.ready strong { color: var(--pink); }
.signal.follow { color: var(--stop); background: var(--stop-soft); }
.signal[aria-pressed="true"] { outline: 2px solid currentColor; outline-offset: -3px; }
.signal[aria-pressed="true"] > span:first-child { text-decoration: underline; text-underline-offset: 3px; }
.signal:focus-visible, .signal[aria-pressed="true"]:focus-visible { position: relative; outline: 3px solid var(--ink); outline-offset: 2px; z-index: 1; }
.stock { align-items: baseline; }
.stock small { font-size: 15px; color: var(--muted); }
.track, .bar { display: block; background: var(--line); }
.track { height: 4px; margin-top: 2px; }
.track i, .fill { display: block; height: 100%; background: var(--ink); }

.ledger-head { display: flex; align-items: center; gap: 8px 16px; min-height: 50px; padding-block: 3px; border-bottom: 2px solid var(--ink); }
.ledger-head h2 { margin-right: auto; font-size: 32px; letter-spacing: -.025em; }
.ledger-head .quiet { color: var(--muted); }
.ledger-head .quiet[aria-pressed="true"] { color: var(--ink); font-weight: 750; text-decoration-thickness: 2px; }
.cols, .row summary {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(80px, 1fr) minmax(142px, .9fr) minmax(90px, .7fr);
  column-gap: clamp(10px, 1.8vw, 28px); align-items: center;
  padding: 8px 30px 8px 12px; border-left: 6px solid transparent;
}
.cols { font: 650 13px var(--font-display); color: var(--muted); border-bottom: 1px solid var(--line); }
.cols :last-child, .when { text-align: right; }
.group { margin-top: 22px; }
.group > h3 { display: flex; align-items: baseline; gap: 10px; margin: 0 0 8px; font-size: 22px; letter-spacing: -.015em; }
.n { color: var(--muted); font-size: 16px; font-weight: 650; }
.row { border-top: 1px solid var(--line); background: var(--surface); }
.row:last-child { border-bottom: 1px solid var(--line); }
.row summary { position: relative; list-style: none; min-height: 54px; border-left-color: var(--app-rule, var(--accent)); }
.row summary::after {
  content: ''; position: absolute; right: 12px; top: calc(50% - 4px); width: 6px; height: 6px;
  border: solid var(--ink); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.row[open] summary::after { transform: rotate(225deg); }
.row summary::-webkit-details-marker { display: none; }
.row summary:focus-visible { outline-offset: -3px; }
.g-ready summary { background: var(--pink-soft); }
.g-ready summary .app, .g-ready .when { color: var(--ink); }
.g-idle .when { color: var(--stop); font-weight: 750; }
.who { display: grid; min-width: 0; }
.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 19px/1.18 var(--font-display); }
.who .app, .when { color: var(--muted); font-size: 15px; }
.when { font-family: var(--font-display); }
.prep { display: flex; align-items: center; gap: 8px; min-width: 0; font: 700 16px var(--font-display); }
.bar { flex: 1; height: 4px; }
.g-ready summary .fill { background: var(--pink); }
.g-ready summary .bar { background: var(--surface); }
.pct { min-width: 3ch; text-align: end; }
.ribbon { display: inline-flex; gap: 3px; width: max-content; }
.exam-cell {
  display: grid; place-items: center; min-width: 26px; height: 26px; white-space: nowrap; text-align: center;
  font: 700 15px/1 var(--font-display); color: var(--ink); background: var(--line);
}
.pct, .exam-cell { font-variant-numeric: tabular-nums; }
.exam-cell.pass { background: var(--ok); color: var(--ok-soft); }
.exam-cell.fail { background: var(--ko-soft); border: 1px solid var(--ko); color: var(--ko); }
.exam-cell.blank { border: 1px dashed var(--muted); background: transparent; }
.empty { margin: 24px 0; }

.detail { display: grid; gap: 12px; padding: 16px 18px 8px; border-top: 1px solid var(--line); }
.progress-column, .decision-column { display: grid; align-content: start; gap: 12px; min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 960px) {
  .detail { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
}
.detail select { max-width: 100%; min-height: 44px; }
.detail h3, .detail h4 { margin: 0; color: var(--ink); font: 700 18px/1.2 var(--font-display); }
.detail h3 { font-size: 22px; }
.module-detail { max-width: 36rem; display: grid; gap: 8px; }
.detail .prep { max-width: 26rem; font-size: 26px; }
.detail .bar { height: 7px; }
.history { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-block: 4px; }
.detail .exam-cell { width: 40px; height: 40px; font-size: 22px; }
.topics { padding-left: 20px; margin: 4px 0 0; }
.meta, .measure { font-size: 15px; color: var(--muted); margin: 0; }
.meta, .measure, .shop-recent { font-family: var(--font-display); }
.meta { padding-top: 8px; border-top: 1px solid var(--line); }
.acts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-width: 32rem; }
.act {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: 44px; padding: 6px; border: 1px solid var(--ink); border-radius: var(--radius-xs);
  color: var(--ink); background: var(--surface); text-decoration: none; font: 650 16px/1.15 var(--font-display);
}
.act:hover { text-decoration: underline; }
.detail .danger { justify-self: start; color: var(--ko); font-weight: 500; }
.detail .armed { background: var(--ko-soft); font-weight: 700; }
.qr-box svg { display: block; width: 144px; height: 144px; }

/* Commissions: four figures for the quarter, then one line of explanation. */
.commissions { width: 100%; margin-top: 30px; padding: 8px 0 6px; border-top: 1px solid var(--ink); }
.commissions h2 { display: flex; align-items: baseline; gap: 10px; margin: 18px 0 10px; font-size: 17px; font-weight: 750; letter-spacing: 0; line-height: 1.2; color: var(--ink); }
.commissions h2 span { font-size: 15px; font-weight: 600; color: var(--muted); }
.commissions dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin: 0; }
.commissions dl div { border-left: 4px solid var(--line); padding-left: 12px; }
.commissions dl div[data-commission="licences"] { border-left-color: var(--foam); }
.commissions dt { font-family: var(--font-display); font-size: 15px; font-weight: 650; color: var(--muted); }
.commissions dd { margin: 4px 0 0; font-family: var(--font-display); font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; }
.commissions p { margin: 12px 0 0; font-size: 15px; color: var(--muted); max-width: 60rem; }
@media (max-width: 640px) { .commissions dl { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Purchase form and recent orders. */
.shop { width: 100%; margin-top: 30px; padding: 8px 0 18px; border-top: 1px solid var(--ink); }
.shop h2 { margin: 18px 0 4px; font-size: 17px; font-weight: 750; letter-spacing: 0; line-height: 1.2; color: var(--ink); }
.shop-unit, .shop-bill, .shop-off { margin: 0; font-size: 15px; color: var(--muted); max-width: 60rem; }
.shop-off { margin-top: 6px; color: var(--ink); }
.packs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0 12px; }
.pack {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "n l" "net net" "tot tot";
  align-items: baseline; gap: 0 10px; padding: 14px 16px 14px; text-align: left;
  border: 1px solid var(--ink); border-width: 1px 0; border-radius: 0;
  background: var(--surface); color: var(--ink);
}
.pack b { grid-area: n; font-family: var(--font-display); font-size: 44px; font-weight: 760; letter-spacing: -0.03em; line-height: .9; font-variant-numeric: tabular-nums; }
.pack .pk-l { grid-area: l; font-family: var(--font-display); font-size: 16px; font-weight: 650; }
.pack .pk-net { grid-area: net; margin-top: 12px; padding-top: 10px; border-top: 2px dashed var(--line); font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pack .pk-tot { grid-area: tot; font-family: var(--font-display); font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; }
.pack:hover, .pack:focus-visible { background: var(--navy); color: var(--hero-text); border-color: var(--navy); }
.pack:hover .pk-net, .pack:focus-visible .pk-net { color: var(--foam); border-top-color: var(--line); }
.shop-recent { list-style: none; margin: 12px 0 0; padding: 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.shop-recent li { display: grid; grid-template-columns: 7rem 8rem 7rem minmax(0, 1fr); gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.shop-recent em { font-style: normal; color: var(--muted); }
.shop-recent li[data-state="paid"] em { color: var(--ok); font-weight: 650; }
@media (max-width: 899px) { .packs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599px) {
  .packs { gap: 8px; }
  .pack { padding: 12px; }
  .pack b { font-size: 34px; }
  .pack .pk-l { font-size: 15px; }
  .pack .pk-tot { font-size: 16px; white-space: nowrap; }
  .shop-recent li { grid-template-columns: 6rem minmax(0, 1fr) auto; }
  .shop-recent em { grid-column: 1 / -1; padding-top: 0; }
}

.foot {
  width: min(100% - 2.5rem, 80rem); margin-inline: auto; padding: 14px 0 40px; border: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 15px; color: var(--muted);
}
.foot p { margin: 0; }
.quiet { min-height: 44px; min-width: 44px; border: 0; background: none; padding: 10px 0; color: var(--accent); font-family: var(--font-display); font-size: 16px; font-weight: 650; text-decoration: underline; text-underline-offset: .2em; }

/* "Nuovo allievo" sheet */
dialog.sheet {
  margin: 0 0 0 auto; padding: 0; border: 0; border-left: 1px solid var(--line); border-radius: 0;
  width: min(460px, 100%); max-width: 100%; height: 100dvh; max-height: 100dvh;
  background: var(--surface); color: var(--ink);
}
dialog.sheet::backdrop { background: rgb(13 33 55 / .55); }
.sheet-body { min-height: 100%; padding: 18px 22px 28px; display: flex; flex-direction: column; gap: 18px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { margin: 0; font-size: 24px; font-weight: 760; letter-spacing: -0.015em; color: var(--ink); }
.create { display: grid; gap: 10px; }
.field { font-family: var(--font-display); font-size: 15px; font-weight: 650; }
.create input[type="text"], .create input:not([type]) {
  width: 100%; height: 52px; padding: 0 14px; font-size: 19px; border: 1px solid var(--ink); border-radius: var(--radius-xs);
  background: var(--bg); font-family: var(--font-display); font-weight: 650;
}
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; }
.check .left { font-family: var(--font-display); color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.apps { display: grid; gap: 8px; }
.go, .go-book {
  min-height: 52px; border: 0; border-radius: var(--radius-xs); background: var(--navy); color: var(--hero-text);
  font-family: var(--font-display); font-size: 17px; font-weight: 750;
}
.error { margin: 0; color: var(--ko); font-size: 15px; }

/* The card the student scans, same shape as the printed one. */
.ticket { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.ticket .stripe { background: var(--app-rule, var(--accent)); }
.ticket .face { padding: 14px 14px 12px; min-width: 0; display: flex; flex-direction: column; }
.ticket .school { margin: 0; font-size: 15px; color: var(--muted); }
.ticket .who { margin: 6px 0 0; font-family: var(--font-display); font-size: 28px; font-weight: 760; letter-spacing: -0.02em; line-height: 1; overflow-wrap: anywhere; }
.ticket .app { margin: auto 0 0; padding-top: 10px; font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.ticket .qr-box { padding: 8px; }
.ticket .qr-box svg { width: 156px; height: 156px; }
.made .acts { margin-top: 10px; }
[hidden] { display: none !important; }
.signal.low { color: var(--stop); background: var(--stop-soft); }
#low-stock, .reason { color: var(--stop); }
#low-stock { align-self: flex-start; }
#first-exams { margin: 12px 0 0; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.group > summary small, .reason { font-size: 15px; }
.group > summary { min-height: 44px; padding-block: 8px; font: 700 21px var(--font-display); }
.group > summary .n, .group > summary small { margin-inline-start: 8px; }
.group > summary small { font-weight: 500; color: var(--muted); }
.state { font-weight: 700; color: var(--ink); }
.remind { grid-column: 1 / -1; justify-self: start; }
#search { width: 320px; height: 44px; }
#search::placeholder { color: var(--muted); opacity: 1; }
.controls { display: flex; flex-wrap: wrap; align-items: end; gap: 4px 12px; }
.row[hidden] + .replace-card { display: none; }
.controls p { width: 100%; margin: 0; }
.controls label, #create-book label:not(.check) { display: grid; gap: 4px; max-width: 100%; }
.controls input, #search, .create select { min-height: 44px; min-width: 0; max-width: 100%; border: 1px solid var(--muted); border-radius: 3px; padding: 6px 10px; color: var(--ink); background: var(--surface); font: 16px var(--font-text); }
#book > summary { min-height: 44px; padding-block: 10px; font-weight: 700; }
#book { border-top: 1px solid var(--line); }
#request-options h3, #stock-line, #request-status { margin-top: 0; }
.student-actions, .student-actions .acts, .student-actions .controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; max-width: none; }
.student-actions .quiet { border: 1px solid var(--ink); border-radius: var(--radius-xs); color: var(--ink); text-decoration: none; }
.student-actions .quiet:hover { text-decoration: underline; }
.detail .acts a:first-child { background: var(--navy); color: var(--hero-text); }
.acts > *, .detail > *, .controls > *, .official { min-width: 0; }
.readiness, .official { padding-block: 12px; border-top: 1px solid var(--line); }
.readiness { padding-top: 0; border-top: 0; }
.readiness ul { padding-inline-start: 20px; margin: 6px 0; }
.official h4 { margin-bottom: 8px; }
.official form { margin-block: 6px; }
@media (max-width: 899px) {
  .row summary .remind { grid-area: when; justify-self: end; }
}

.names { margin: 10px 0 0; font-size: 15px; color: var(--muted); }

.sheet[open] { animation: enter-sheet 180ms ease-out; }
@keyframes enter-sheet { from { transform: translateX(100%); } to { transform: translateX(0); } }
@media (max-width: 899px) {
  html { scroll-padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .desk-inner, .register, .foot { width: calc(100% - 32px); }
  .desk-inner { padding-block: 10px; gap: 12px; }
  .desk-id { padding-left: 10px; }
  .desk-inner { flex-wrap: wrap; }
  .desk-acts { flex-wrap: wrap; gap: 0 16px; }
  .desk-acts .kit { font-size: 15px; }
  .new { width: 100%; position: fixed; z-index: 3; inset: auto 0 0; border-radius: 0; min-height: calc(52px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
  .new:focus-visible { outline-color: var(--ink); outline-offset: -4px; }
  .register { display: block; padding-block: 14px; }
  .overview { position: static; }
  .overview h2 { min-height: 32px; }
  .signals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .signal { align-content: start; padding: 10px; gap: 5px; }
  .signal + .signal { border-top: 0; border-left: 1px solid var(--line); }
  .signal strong { font-size: 44px; }
  .track { margin: 0; }
  .ledger-head { margin-top: 14px; }
  .ledger-head h2 { font-size: 28px; }
  .cols { display: none; }
  .group { margin-top: 16px; }
  .group > h3 { font-size: 20px; }
  .row summary {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who who" "prep exam" "when when";
    gap: 8px 10px; padding: 10px 26px 10px 10px;
  }
  .row summary .who { grid-area: who; gap: 3px; }
  .name { white-space: normal; overflow-wrap: anywhere; }
  .row summary .when { justify-self: start; }
  .who .app { flex-shrink: 0; }
  .row summary .prep { grid-area: prep; }
  .row summary::after { top: 16px; right: 10px; }
  .row summary .ribbon { grid-area: exam; justify-self: end; }
  .when { grid-area: when; }
  .detail { padding: 12px; gap: 8px; }
  dialog.sheet { margin: auto 0 0; border: 0; border-top: 1px solid var(--line); width: 100%; height: auto; max-height: 100dvh; }
  .sheet[open] { animation-name: rise-sheet; }
  @keyframes rise-sheet { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .sheet-body { min-height: 0; gap: 12px; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
  .ticket .qr-box svg { width: 128px; height: 128px; }
  .foot { padding-block: 12px; }
}
@media (max-width: 560px) {
  .ledger-head { flex-wrap: wrap; padding-bottom: 8px; }
  #search { width: 100%; }
  .row summary { grid-template-areas: "name when" "app app" "prep exam"; row-gap: 3px; }
  .row summary .who { display: contents; }
  .row summary .name { grid-area: name; align-self: baseline; }
  .row summary .when { grid-area: when; justify-self: end; align-self: baseline; }
  .row summary .app { grid-area: app; }
  .row:not([open]) summary :is(.name, .app) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .row:not([open]) summary :is(.reason, .remind) { display: none; }
  .row[open] summary .reason, .row[open] summary .remind { grid-area: auto / 1 / auto / -1; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet[open] { animation: none; }
}

.demo-bar, .demo-message { padding: .75rem 1.25rem; background: #bce8da; color: #0d2137; }
.demo-bar a { color: inherit; font-weight: 700; }
