@font-face { font-family: "Atkinson"; src: url(/fonts/atkinson-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url(/fonts/atkinson-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url(/fonts/atkinson-400i.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --paper: #F4F5F7;
  --surface: #FFFFFF;
  --ink: #1C2530;
  --muted: #56616F;
  --line: #D3D9E1;
  --ultramarine: #2B4BA8;
  --ultramarine-soft: #E3E9F7;
  --viridian: #24735F;
  --viridian-soft: #DDEFE9;
  --alizarin: #A8233A;
  --alizarin-soft: #F7E1E5;
  --ochre: #8A6508;
  --ochre-soft: #FBF0D2;
  /* weekday pigments */
  --d1: #5E4495; --d2: #2B4BA8; --d3: #24735F; --d4: #B5651D; --d5: #A8233A; --d6: #5C4033; --d0: #56616F;
  --radius-s: 6px;
  --radius-m: 10px;
  --step--1: 0.9rem;
  --step-0: 1.125rem;   /* 18px body */
  --step-1: 1.35rem;
  --step-2: 1.75rem;
  --step-3: 2.3rem;
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper); color: var(--ink);
  font-family: "Atkinson", "Verdana", "Segoe UI", sans-serif;
  font-size: var(--step-0); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: var(--step-3); letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 .8em; max-width: 70ch; }
a { color: var(--ultramarine); }
:focus-visible { outline: 3px solid var(--ultramarine); outline-offset: 2px; }
.boot { padding: 3rem; color: var(--muted); }

/* ---------- layout */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side {
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 1.25rem 0.75rem; display: flex; flex-direction: column; gap: 1rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { padding: 0 .75rem; }
.brand b { display: block; font-size: var(--step-1); line-height: 1.15; }
.brand span { color: var(--muted); font-size: var(--step--1); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: .6rem; min-height: 48px; padding: .5rem .75rem;
  border-radius: var(--radius-s); text-decoration: none; color: var(--ink); font-weight: 700;
}
.nav a:hover { background: var(--paper); }
.nav a[aria-current="page"] { background: var(--ultramarine); color: #fff; }
.side-foot { margin-top: auto; padding: 0 .75rem; font-size: var(--step--1); color: var(--muted); }
.season-pick label { font-size: var(--step--1); color: var(--muted); display: block; padding: 0 .75rem; }
.season-pick select { margin: .25rem .75rem 0; width: calc(100% - 1.5rem); font-size: var(--step--1); min-height: 40px; }

main { padding: 2rem clamp(1rem, 3vw, 3rem) 4rem; max-width: 1180px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.head h1 { margin: 0; }
.head .sub { color: var(--muted); margin: .25rem 0 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.panel > h2, .panel > h3 { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; align-items: start; }
.grid2 > .panel { margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--step--1); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: .75rem; }

/* ---------- figures on dashboard */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.figure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem 1.25rem; text-decoration: none; color: inherit; display: block; }
.figure:hover { border-color: var(--ultramarine); }
.figure strong { display: block; font-size: var(--step-2); }
.figure span { color: var(--muted); }

/* ---------- buttons & forms */
button, .btn {
  font: inherit; font-weight: 700; font-size: var(--step-0);
  min-height: 46px; padding: .5rem 1.1rem; border-radius: var(--radius-s);
  border: 2px solid var(--ultramarine); background: var(--surface); color: var(--ultramarine);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem;
}
button:hover, .btn:hover { background: var(--ultramarine-soft); }
button.primary, .btn.primary { background: var(--ultramarine); color: #fff; }
button.primary:hover { background: #22408F; }
button.danger { border-color: var(--alizarin); color: var(--alizarin); }
button.danger:hover { background: var(--alizarin-soft); }
button.quiet { border-color: transparent; background: transparent; }
button.quiet:hover { background: var(--paper); }
button.small, .btn.small { min-height: 36px; padding: .2rem .7rem; font-size: var(--step--1); }
button:disabled { opacity: .5; cursor: not-allowed; }

label { font-weight: 700; display: block; margin-bottom: .25rem; }
.field { margin-bottom: .9rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: var(--step--1); }
input, select, textarea {
  font: inherit; font-size: var(--step-0); width: 100%; min-height: 46px;
  padding: .45rem .7rem; border: 2px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--ultramarine); outline: none; }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--ultramarine); vertical-align: middle; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; margin: .3rem 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1rem; }
.search { max-width: 420px; }
.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters .field { margin: 0; }
.filters select { width: auto; }

/* ---------- tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
table { border-collapse: collapse; width: 100%; }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: var(--step--1); color: var(--muted); font-weight: 700; background: var(--surface); position: sticky; top: 0; }
tbody tr:hover { background: #F8F9FB; }
tr.link { cursor: pointer; }
tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.unsure td:first-child { box-shadow: inset 4px 0 0 var(--ochre); }
tr.archived { color: var(--muted); }

/* ---------- class chips: the pigment identity */
.chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .1rem .55rem .1rem .35rem;
  border-radius: 999px; font-weight: 700; font-size: var(--step--1); white-space: nowrap;
  background: color-mix(in srgb, var(--c, var(--d0)) 14%, white); color: var(--c, var(--d0));
  text-decoration: none; border: 0;
}
.chip::before { content: ""; width: .85em; height: .85em; border-radius: 50%; background: var(--c, var(--d0)); }
.chip.ap::before { background: linear-gradient(90deg, var(--c) 50%, transparent 50%); border: 2px solid var(--c); width: .75em; height: .75em; }
.chip.so::before { background: transparent; border: 2px solid var(--c); width: .75em; height: .75em; }
.chips { display: flex; gap: .3rem; flex-wrap: wrap; }

.tag { display: inline-block; padding: .05rem .5rem; border-radius: var(--radius-s); font-size: var(--step--1); font-weight: 700; white-space: nowrap; }
.tag.ok { background: var(--viridian-soft); color: var(--viridian); }
.tag.due { background: var(--alizarin-soft); color: var(--alizarin); }
.tag.late { background: var(--alizarin); color: #fff; }
.tag.unsure { background: var(--ochre-soft); color: var(--ochre); }
.tag.info { background: var(--ultramarine-soft); color: var(--ultramarine); }
.tag.grey { background: var(--paper); color: var(--muted); }

/* class cards on the Cours page */
.classgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.classcard { background: var(--surface); border: 1px solid var(--line); border-top: 8px solid var(--c); border-radius: var(--radius-m); padding: 1rem 1.2rem; text-decoration: none; color: inherit; display: block; }
.classcard:hover { box-shadow: 0 0 0 2px var(--c); }
.classcard h3 { margin: 0 0 .25rem; }
.classcard .count { font-size: var(--step-2); font-weight: 700; color: var(--c); }

/* sessions calendar */
.sessions { display: flex; flex-wrap: wrap; gap: .4rem; }
.sess { min-height: 42px; border-radius: var(--radius-s); font-size: var(--step--1); padding: .2rem .7rem; }
.sess.done { background: var(--viridian-soft); border-color: var(--viridian); color: var(--viridian); }
.sess.planned { background: var(--surface); border-color: var(--line); color: var(--ink); }
.sess.cancelled { background: var(--paper); border-color: var(--line); color: var(--muted); text-decoration: line-through; }
.sess.extra { background: var(--ultramarine-soft); }

/* sync indicator */
.sync { display: flex; align-items: center; gap: .5rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--viridian); flex: none; }
.dot.off { background: var(--ochre); }
.dot.err { background: var(--alizarin); }

/* dialog */
dialog { border: 0; border-radius: var(--radius-m); padding: 0; width: min(640px, 94vw); max-height: 90vh; color: var(--ink); box-shadow: 0 20px 60px rgba(20, 30, 50, .3); }
dialog::backdrop { background: rgba(28, 37, 48, .45); }
dialog form { display: flex; flex-direction: column; max-height: 90vh; }
dialog .dlg-head { padding: 1.1rem 1.5rem .5rem; }
dialog .dlg-head h2 { margin: 0; font-size: var(--step-2); }
dialog .dlg-body { padding: .5rem 1.5rem; overflow-y: auto; }
dialog .dlg-foot { padding: 1rem 1.5rem; display: flex; justify-content: flex-end; gap: .5rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.picklist { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-s); }
.picklist label { font-weight: 400; display: flex; gap: .6rem; align-items: center; padding: .5rem .75rem; border-bottom: 1px solid var(--line); margin: 0; cursor: pointer; }
.picklist label:hover { background: var(--paper); }

/* toasts */
#toasts { position: fixed; bottom: 1rem; right: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 50; }
.toast { background: var(--ink); color: #fff; padding: .8rem 1.1rem; border-radius: var(--radius-s); max-width: 420px; }
.toast.err { background: var(--alizarin); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login .panel { width: min(440px, 100%); padding: 2rem; }
.login h1 { font-size: var(--step-2); }
.stripe { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-bottom: 1.5rem; }
.stripe i { flex: 1; }

.tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1.25rem; border-bottom: 2px solid var(--line); }
.tabs a { padding: .6rem 1rem; text-decoration: none; color: var(--muted); font-weight: 700; border-bottom: 4px solid transparent; margin-bottom: -2px; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--ultramarine); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1.2rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.money-total { font-size: var(--step-1); font-weight: 700; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: column; padding: .75rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav a { white-space: nowrap; }
  .side-foot { margin-top: 0; }
  main { padding: 1.25rem 1rem 4rem; }
  h1 { font-size: var(--step-2); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- print */
#print { display: none; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; font-size: 11pt; }
  body > *:not(#print) { display: none !important; }
  #print { display: block; }
  .sheet { page-break-after: always; break-after: page; }
  .sheet:last-child { page-break-after: auto; break-after: auto; }
}
.sheet { font-family: "Atkinson", Arial, sans-serif; color: #000; }
.sheet .sheet-head { display: grid; grid-template-columns: 1fr 1.6fr; gap: 1rem; margin-bottom: 8mm; align-items: start; }
.sheet .assoc { font-weight: 700; font-size: 13pt; }
.sheet .title { font-size: 11pt; }
.sheet .title b { font-size: 18pt; }
.sheet .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 2mm 8mm; margin-top: 3mm; font-size: 10.5pt; }
.sheet table.att { width: 100%; border-collapse: collapse; table-layout: fixed; }
.sheet table.att th, .sheet table.att td { border: 1px solid #000; padding: 0 2mm; height: 11mm; font-size: 11pt; color: #000; background: #fff; position: static; }
.sheet table.att th { font-weight: 400; font-size: 10pt; text-align: center; height: 9mm; }
.sheet table.att th:first-child { font-size: 13pt; font-weight: 700; width: 30%; }
.sheet table.att td.gone { background: repeating-linear-gradient(135deg, #fff 0 3mm, #ccc 3mm 3.4mm); }
.sheet .obs { margin-top: 5mm; font-size: 10pt; }
.sheet.invoice { font-size: 11pt; max-width: 180mm; }
@media print { .sheet.invoice { page: portrait; } @page portrait { size: A4 portrait; margin: 16mm; } }
.invoice .inv-top { display: flex; justify-content: space-between; gap: 10mm; margin-bottom: 10mm; }
.invoice h1 { font-size: 20pt; margin: 0 0 2mm; }
.invoice table { border-collapse: collapse; width: 100%; margin: 6mm 0; }
.invoice th, .invoice td { border-bottom: 1px solid #999; padding: 2mm; font-size: 10.5pt; color: #000; background: #fff; position: static; }
.invoice th { text-align: left; }
.invoice .tot td { border-top: 2px solid #000; font-weight: 700; font-size: 12pt; }
.invoice .legal { font-size: 9pt; color: #333; margin-top: 10mm; }
.preview { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.5rem; overflow-x: auto; }
