@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/barlow-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/barlow-500.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/barlow-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/barlow-700.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/barlow-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/barlow-semi-condensed-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/barlow-semi-condensed-700.woff2") format("woff2"); }

:root {
  --bar: #151515;
  --bar-ink: #ffffff;
  --bar-ink-2: #a7a7a7;
  --bg: #ffffff;
  --panel: #ffffff;
  --shade: #f4f4f4;
  --ink: #1a1a1a;
  --ink-2: #555555;
  --ink-3: #8a8a8a;
  --line: #e2e2e2;
  --line-strong: #c8c8c8;
  --primary: #b51a00;
  --primary-hover: #8f1500;
  --primary-ink: #ffffff;
  --primary-soft: #f7e6e2;
  --focus: #b51a00;
  --ok: #2f7d1f;
  --ok-soft: #eaf4e5;
  --warn: #8a5a00;
  --warn-soft: #fbf1dc;
  --danger: #b51a00;
  --danger-soft: #f7e6e2;
  --info-soft: #eef1f4;
  --piste-green: #2f8f3a;
  --piste-blue: #1f5fbf;
  --piste-red: #c8261b;
  --piste-black: #1a1a1a;
  --gold: #c9971b;
  --radius: 2px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --panel: #202020;
    --shade: #232323;
    --ink: #ededed;
    --ink-2: #b4b4b4;
    --ink-3: #858585;
    --line: #313131;
    --line-strong: #454545;
    --primary: #d9391a;
    --primary-hover: #ef4f2e;
    --primary-soft: #3a1a13;
    --focus: #ef4f2e;
    --ok: #7cc56a;
    --ok-soft: #1f2d1b;
    --warn: #e0b04f;
    --warn-soft: #2f2616;
    --danger: #ef6a4f;
    --danger-soft: #3a1a13;
    --info-soft: #262a2e;
    --piste-black: #ededed;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding: 40px 0 72px; }
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 700; }
h1, h2 { font-family: var(--font-display); }
h1 { font-size: 2rem; letter-spacing: -.005em; }
h2 { font-size: 1.35rem; font-weight: 600; }
h3 { font-size: 1rem; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.container { width: 100%; max-width: 680px; margin: 0 auto; padding: 0 20px; }
.container-wide { width: 100%; max-width: 1360px; margin: 0 auto; padding: 0 20px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 40px; }
.row { display: flex; align-items: center; gap: 12px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spread { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); font-size: .875rem; }
.small { font-size: .875rem; }
.eyebrow { color: var(--ink-3); font-size: .875rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.prewrap { white-space: pre-line; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.topbar { background: var(--bar); color: var(--bar-ink); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--bar-ink); text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; }
.brand:hover { color: var(--bar-ink); }
.brand img { width: 44px; height: 44px; display: block; }
.nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.nav a, .nav button {
  color: var(--bar-ink-2); text-decoration: none; font: inherit; font-size: .925rem;
  padding: 6px 10px; border-radius: var(--radius); background: none; border: 0; cursor: pointer;
}
.nav a:hover, .nav button:hover { color: var(--bar-ink); }
.nav a[aria-current="page"] { color: var(--bar-ink); box-shadow: inset 0 -2px 0 var(--primary); }
.nav form { margin: 0; }

.subnav { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 32px; overflow-x: auto; }
.subnav a { padding: 0 0 10px; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--primary); }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-header p { margin-top: 6px; color: var(--ink-2); }

.footer { padding: 24px 0; color: var(--ink-3); font-size: .85rem; border-top: 1px solid var(--line); }
.footer a { color: inherit; }

.section { display: flex; flex-direction: column; gap: 12px; }
.section + .section { margin-top: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--line); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card-flush { padding: 0; overflow: hidden; }
.card-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-section + .card-section { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:hover { border-color: var(--line-strong); color: inherit; }

.hero { padding: 8px 0 0; }
.hero p { margin-top: 8px; color: var(--ink-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
  padding: 10px 18px; border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); color: var(--primary-ink); }
.btn-secondary { background: var(--panel); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--ink-2); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); padding-left: 8px; padding-right: 8px; }
.btn-ghost:hover { color: var(--ink); text-decoration: underline; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--line-strong); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn .htmx-indicator { width: 14px; height: 14px; }

label, .label { display: block; font-weight: 600; font-size: .925rem; margin-bottom: 6px; }
.field { display: flex; flex-direction: column; }
.field .hint { color: var(--ink-3); font-size: .85rem; margin-top: 6px; }
.field .error-text, .error-text { color: var(--danger); font-size: .875rem; margin-top: 6px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=datetime-local], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 9px 11px; min-height: 42px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--primary); flex: none; }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding-top: 8px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }

.choice-list { display: grid; gap: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.choice {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin: 0;
  background: var(--panel); cursor: pointer; font-weight: 400; border-top: 1px solid var(--line);
}
.choice:first-child { border-top: 0; }
.choice-list > .choice:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.choice:hover { background: var(--shade); }
.choice:has(input:checked) { background: var(--primary-soft); }
.choice input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.choice strong { display: block; font-weight: 600; }
.choice.is-disabled { opacity: .55; cursor: not-allowed; }
.choice.is-disabled:hover { background: var(--panel); }
label.choice:not(.choice-list > .choice) { border: 1px solid var(--line-strong); border-radius: var(--radius); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; padding: 1px 8px; border-radius: var(--radius); background: var(--shade); color: var(--ink-2); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--ink-2); }
.badge-accent { background: var(--primary-soft); color: var(--primary); }

.lvl { display: inline-flex; align-items: center; gap: 6px; font-size: .875rem; white-space: nowrap; color: var(--ink); }
.lvl::before { content: ""; width: 9px; height: 9px; background: var(--c, currentColor); flex: none; }
.lvl-0 { --c: var(--piste-green); }
.lvl-0::before { border-radius: 50%; }
.lvl-1 { --c: var(--piste-blue); }
.lvl-2 { --c: var(--piste-red); }
.lvl-3 { --c: var(--piste-black); }
.lvl-3::before { transform: rotate(45deg); width: 8px; height: 8px; }
.lvl-4 { --c: var(--piste-black); }
.lvl-4::before { transform: rotate(45deg); width: 8px; height: 8px; box-shadow: 0 0 0 2px var(--gold); }
.lvl-4::before { margin: 0 3px; }

.avatar { display: none; }

.alert { border-radius: var(--radius); padding: 12px 14px; border-left: 3px solid var(--line-strong); background: var(--shade); }
.alert strong { display: block; }
.alert-info { border-left-color: var(--ink-3); }
.alert-warn { background: var(--warn-soft); border-left-color: var(--warn); }
.alert-success { background: var(--ok-soft); border-left-color: var(--ok); }
.alert-danger { background: var(--danger-soft); border-left-color: var(--danger); }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { display: flex; align-items: center; gap: 10px; }
.checklist .dot { width: 20px; height: 20px; border: 1.5px solid var(--line-strong); border-radius: 50%; display: grid; place-items: center; font-size: .7rem; color: transparent; flex: none; }
.checklist li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.checklist li.done .label-text { color: var(--ink-3); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .95rem; }
.table th { position: sticky; top: 0; z-index: 2; background: var(--bg); text-align: left; font-weight: 600; font-size: .825rem; color: var(--ink-3); padding: 10px 14px 8px; white-space: nowrap; border-bottom: 1.5px solid var(--ink); vertical-align: bottom; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 2px; }
.table th:last-child, .table td:last-child { padding-right: 2px; }
.table tbody tr { position: relative; }
.table tbody tr:hover > td { background: var(--shade); }
.table a { color: var(--ink); font-weight: 600; text-decoration: none; }
.table a:hover { color: var(--primary); }
.table .row-link::after { content: ""; position: absolute; inset: 0; }
.table .row-link:focus-visible { outline: none; }
.table tr:has(.row-link:focus-visible) > td { background: var(--shade); box-shadow: inset 0 2px 0 var(--focus), inset 0 -2px 0 var(--focus); }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .zero { color: var(--ink-3); }
.table .sub { display: block; margin-top: 2px; color: var(--ink-3); font-size: .85rem; font-weight: 400; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions a:not(.btn), .table .actions button:not(.btn):not(.switch) { position: relative; z-index: 1; font: inherit; font-size: .875rem; font-weight: 500; color: var(--ink-2); background: none; border: 0; padding: 4px 0; cursor: pointer; }
.table .actions > * + * { margin-left: 16px; }
.table .actions a:not(.btn):hover, .table .actions button:not(.btn):hover { color: var(--primary); text-decoration: underline; }
.table .is-muted td { color: var(--ink-2); }
.table .is-muted a { color: var(--ink-2); font-weight: 500; }
.table-caption { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 40px 0 4px; }
.table-caption h2 { font-size: 1.15rem; }

.state { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; white-space: nowrap; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.state-ok::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.state-wait::before { background: #3a7bd5; }
.state-off { color: var(--ink-3); }
.state-off::before { background: transparent; border: 1.5px solid var(--ink-3); width: 7px; height: 7px; }
.state-warn { color: var(--warn); }
.state-warn::before { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.table th .th-sort { color: inherit; font-weight: inherit; text-decoration: none; }
.table th .th-sort:hover { color: var(--ink); }
.table th[aria-sort] { color: var(--ink); }
.table th[aria-sort] .th-sort::after { content: "\25B2"; font-size: .6rem; margin-left: 4px; vertical-align: 1px; }
.table th[aria-sort="descending"] .th-sort::after { content: "\25BC"; }
.table .child-row th { position: static; font-size: 1rem; font-weight: 600; color: var(--ink); background: none; padding: 18px 2px 6px; border-bottom: 1px solid var(--line-strong); white-space: normal; }
.table .child-row th .sub { display: inline; margin: 0 0 0 10px; }
.table tbody tr.child-row:hover > th { background: none; }

.switch { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 0; font: inherit; font-size: .9rem; color: var(--ink); cursor: pointer; }
.switch-track { width: 34px; height: 20px; border-radius: 10px; background: var(--line-strong); position: relative; flex: none; transition: background-color .15s; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.switch[aria-checked="true"] .switch-track { background: var(--ok); }
.switch[aria-checked="true"] .switch-track::after { transform: translateX(14px); }
.switch:focus-visible { outline: none; }
.switch:focus-visible .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink-3); font-size: .85rem; }

.empty { color: var(--ink-2); padding: 16px 0; }

.signature-pad { position: relative; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; aspect-ratio: 5 / 2; touch-action: none; }
.signature-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.signature-pad .baseline { position: absolute; left: 20px; right: 20px; bottom: 26%; border-top: 1px solid #d4d4d4; pointer-events: none; }
.signature-pad .clear { position: absolute; top: 6px; right: 6px; }
.signature-img { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); max-width: 300px; width: 100%; height: auto; }

#toast { position: fixed; right: 16px; bottom: 16px; z-index: 50; max-width: min(420px, calc(100vw - 32px)); }
#toast:empty { display: none; }
.toast { background: var(--bar); color: #fff; border-radius: var(--radius); padding: 12px 16px; border-left: 3px solid var(--primary); }
.toast strong { display: block; }
.flash { margin-bottom: 24px; }

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login { max-width: 420px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
.login-mark { width: 112px; height: 112px; display: block; }
.login h1 { font-size: 2.25rem; }
.login-lead { color: var(--ink-2); margin-top: 8px; }

.course-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.course-list > li { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.course-list .course-name { font-weight: 600; }
.course-list .course-meta { color: var(--ink-2); font-size: .9rem; }

@media print {
  .topbar, .footer, .no-print, #toast { display: none !important; }
  body { background: #fff; color: #000; }
  main { padding: 0; }
  .card { border-color: #999; break-inside: avoid; }
}

@media (max-width: 600px) {
  .topbar-inner { flex-wrap: wrap; gap: 0; padding-top: 10px; }
  .brand img { width: 36px; height: 36px; }
  .nav { width: 100%; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; margin: 4px -10px 0; }
  .nav a, .nav button { padding: 8px 10px 10px; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--primary); }
  .topbar-inner { position: relative; }
  .nav form { position: absolute; top: 14px; right: 10px; margin: 0; }
  main { padding-top: 28px; }
}

.row-buttons { position: relative; z-index: 1; display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.table .actions > .row-buttons + * { margin-left: 0; }
.btn svg { flex: none; }
.btn-sm { gap: 6px; }
.btn-icon { padding-left: 8px; padding-right: 8px; }
.btn-secondary:hover svg { color: var(--primary); }

.date-input { border: 0; margin: 0; padding: 0; }
.date-input legend { margin-bottom: 6px; }
.date-input-parts { display: flex; gap: 10px; align-items: flex-end; }
.date-part label { font-weight: 400; font-size: .85rem; color: var(--ink-2); margin-bottom: 4px; }
.date-part input { text-align: center; font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.date-part-day input, .date-part-month input { width: 3.6em; }
.date-part-year input { width: 5.2em; }
.date-input.has-error input { border-color: var(--danger); }
.footer-credit { color: var(--ink-3); }
.footer-credit a { color: inherit; }
