/* Kitizen: the whole field UI stylesheet. System font, high contrast, big targets. */
:root {
  --ink: #111111;
  --muted: #4a4a4a;
  --paper: #ffffff;
  --ok: #0b6e2e;      /* EN STOCK, geste réussi */
  --loan: #0b4fc4;    /* LOUÉ */
  --warn: #9a4a00;    /* À RÉPARER, rupture */
  --danger: #b3261e;  /* rebut */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}

main { max-width: 480px; margin: 0 auto; padding: 16px; }

h1 { font-size: 30px; line-height: 1.15; margin: 0 0 8px; }

.btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 64px; width: 100%; margin: 12px 0 0; padding: 0 16px;
  border: 3px solid var(--ink); background: var(--paper); color: var(--ink);
  font: inherit; font-size: 20px; font-weight: 700; text-decoration: none;
}
.btn-primary { background: var(--ink); color: var(--paper); }
/* Every button shows the hand, as a link does. */
button, .btn, .btn-mini, input[type="submit"] { cursor: pointer; }
button:disabled, .btn:disabled { cursor: default; }
.btn-danger { border-color: var(--danger); color: var(--danger); }

.band { padding: 12px 16px; color: var(--paper); font-weight: 800; letter-spacing: .04em; }
.band-stock { background: var(--ok); }
.band-loan { background: var(--loan); }
.band-reserved { background: #5b2a86; }  /* RÉSERVÉ: kept for someone, not yet given */
.band-repair { background: var(--warn); }
.band-out { background: #3a3a3a; }

input[type="text"], input[type="search"], input[inputmode="numeric"] {
  width: 100%; min-height: 60px; padding: 0 16px;
  border: 3px solid var(--ink); font: inherit; font-size: 22px;
}
label { display: block; margin: 16px 0 6px; font-weight: 700; }

/* Scanner: dark screen, everything else stays light. */
body.dark { background: #000; color: #fff; }
body.dark .btn { background: #000; color: #fff; border-color: #fff; }
body.dark .btn-primary { background: #fff; color: #000; }
body.dark a { color: #fff; }
.back { display: inline-flex; align-items: center; min-height: 48px; font-weight: 700; }
.scan-view { position: relative; margin-top: 12px; aspect-ratio: 3 / 4; background: #1f1f1f; overflow: hidden; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute; inset: 18%; border: 6px solid #fff;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35);
}
.scan-status { margin: 12px 0 0; }
.scan-result { margin-top: 12px; padding: 16px; border: 3px solid #fff; }
.scan-value { margin: 0; font-size: 20px; font-weight: 800; word-break: break-all; }
.scan-meta { margin: 6px 0 0; color: #cfcfcf; }
.scan-manual { margin-top: 8px; }

/* Field pages: who acts on top, what we look at, buttons under the thumb. */
.muted { color: var(--muted); }
.center { text-align: center; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; padding: 0 16px; border-bottom: 2px solid var(--ink);
}
.topbar-org { font-weight: 800; }
.topbar-user { font-size: 16px; font-weight: 700; text-align: right; }
.item-title { font-size: 34px; line-height: 1.1; margin: 8px 0 6px; }
.item-title + .muted { margin-top: 0; }
.card {
  display: flex; flex-direction: column; gap: 4px;
  margin: 20px 0; padding: 14px 16px; border: 3px solid var(--ink);
}
.card-label { font-size: 16px; font-weight: 700; color: var(--muted); }
.card-name { font-size: 24px; font-weight: 800; line-height: 1.2; }
.bottombar {
  max-width: 480px; margin: 0 auto; padding: 12px 16px 24px; border-top: 2px solid var(--ink);
}
.btn-scan { letter-spacing: .06em; font-weight: 800; }
.site-footer {
  max-width: 480px; margin: 32px auto 0; padding: 16px 16px 32px; border-top: 2px solid var(--ink);
  color: var(--muted); font-size: 16px;
}
.site-footer p { margin: 0 0 8px; }
.site-footer a { color: var(--ink); }

/* Field screens */
.small { font-size: 16px; }
.big { font-size: 20px; }
h2 { font-size: 20px; margin: 24px 0 8px; }
.topbar-user { display: flex; align-items: center; gap: 10px; margin: 0; }
.topbar-user { min-width: 0; }
.topbar-user span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-guest span { font-size: 14px; font-weight: 400; }
.btn-mini {
  min-height: 44px; padding: 0 12px; border: 2px solid var(--ink); background: var(--paper);
  color: var(--ink); font: inherit; font-size: 16px; font-weight: 700;
}
.flash { max-width: 480px; margin: 0 auto; padding: 12px 16px; background: #e6f2ea; font-weight: 700; }
.flash p { margin: 0; }
.actions { display: flex; flex-direction: column; margin-top: 8px; }
.actions form { margin: 0; }
.btn-big { min-height: 72px; font-size: 22px; font-weight: 800; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: var(--paper); }
.btn-link {
  display: flex; align-items: center; justify-content: center; min-height: 48px; margin-top: 8px;
  border: 0; background: none; color: var(--ink); font: inherit; font-weight: 700;
  text-decoration: underline; cursor: pointer; width: 100%;
}
a.card-name { color: var(--ink); }
.card-warn { border-color: var(--warn); }
.note { background: #f0f0f0; padding: 12px 14px; }
.error-text { color: var(--danger); font-weight: 700; }
.warning-text { color: var(--warn); font-weight: 700; }
.search { margin-bottom: 8px; }
select {
  width: 100%; min-height: 60px; padding: 0 12px; border: 3px solid var(--ink);
  background: var(--paper); font: inherit; font-size: 20px;
}
input[type="email"], input[type="password"], input[type="date"], input[type="number"] {
  width: 100%; min-height: 60px; padding: 0 16px; border: 3px solid var(--ink); font: inherit;
}
.row {
  display: flex; flex-direction: column; gap: 4px; width: 100%; min-height: 72px; margin: 0 0 10px;
  padding: 10px 16px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.row.static { min-height: 0; cursor: default; border-width: 1px; }
.row-name { font-size: 21px; font-weight: 800; }
.row-meta { font-size: 16px; color: var(--muted); }
.asked-given { display: grid; gap: 2px; margin: 0; font-size: 16px; }
.asked-given div { display: flex; gap: 10px; }
.asked-given dt { flex: 0 0 6.5em; font-weight: 800; }
.asked-given dd { margin: 0; overflow-wrap: anywhere; }
.asked-given .given dt { color: var(--loan); }
.asked-given .past { color: var(--muted); }
.tile {
  display: flex; flex-direction: column; gap: 4px; min-height: 88px; margin: 0 0 12px;
  padding: 14px 16px; border: 3px solid var(--ink); color: var(--ink); text-decoration: none;
}
.tile-title { font-size: 22px; font-weight: 800; }
.tile-meta { font-size: 16px; color: var(--muted); }
.step { display: flex; flex-direction: column; gap: 6px; margin: 16px 0; padding: 14px 16px; border: 2px solid var(--ink); }
.step-label { font-size: 15px; font-weight: 800; letter-spacing: .06em; color: var(--muted); }
.choices { margin: 8px 0 0; padding: 0; border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices legend { margin-bottom: 8px; font-weight: 800; }
.choice {
  display: flex; align-items: center; gap: 10px; min-height: 64px; margin: 0; padding: 0 14px;
  border: 3px solid var(--ink); font-size: 20px; font-weight: 700;
}
.choice input { width: 24px; height: 24px; accent-color: var(--ink); }
.choice:has(input:checked) { background: var(--ink); color: var(--paper); }
.pin-input { text-align: center; letter-spacing: .6em; font-size: 34px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.keypad button {
  min-height: 80px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  font: inherit; font-size: 32px; font-weight: 700;
}
.keypad .small { font-size: 18px; }
.keypad .ok { background: var(--ink); color: var(--paper); font-size: 24px; font-weight: 800; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Full-screen outcome: green when done, red when refused. */
body.screen-ok { background: var(--ok); color: var(--paper); }
body.screen-error { background: var(--danger); color: var(--paper); }
.screen-message { display: flex; flex-direction: column; gap: 12px; padding: 32px 0 16px; }
.screen-message h1 { font-size: 34px; }
.screen-message p { margin: 0; }
.warning { padding: 10px 12px; background: #fff3cd; color: #3d2a00; font-weight: 700; }
.btn-inverse { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn-outline-light { background: transparent; color: var(--paper); border-color: var(--paper); }
.btn-link.light { color: var(--paper); }

/* Scanner opened over a page */
.scan-overlay {
  position: fixed; inset: 0; z-index: 10; overflow: auto; padding: 16px;
  background: #000; color: #fff;
}
.scan-overlay .btn { background: #000; color: #fff; border-color: #fff; }

/* Fiche status, one colour each (the band on the fiche, a pill elsewhere): grey nothing given
   yet, amber handing out, blue equipment out (as LOUÉ), purple coming back, green all back
   (as EN STOCK), dark closed. */
:root {
  --file-requested: #5b5b5b;
  --file-distribution_in_progress: #9a4a00;
  --file-distribution_done: #0b4fc4;
  --file-return_in_progress: #5b2a86;
  --file-return_done: #0b6e2e;
  --file-closed: #2b2b2b;
}
.band-file-requested, .pill.file-requested { background: var(--file-requested); }
.band-file-distribution_in_progress, .pill.file-distribution_in_progress { background: var(--file-distribution_in_progress); }
.band-file-distribution_done, .pill.file-distribution_done { background: var(--file-distribution_done); }
.band-file-return_in_progress, .pill.file-return_in_progress { background: var(--file-return_in_progress); }
.band-file-return_done, .pill.file-return_done { background: var(--file-return_done); }
.band-file-closed, .pill.file-closed { background: var(--file-closed); }
.pill {
  display: inline-block; padding: 1px 10px; border-radius: 999px; background: var(--muted);
  color: var(--paper); font-size: 15px; font-weight: 800; line-height: 1.5; white-space: nowrap;
}
h2 .pill { vertical-align: middle; }
/* A request line's state, on the fiche. */
.pill.state-requested { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.pill.state-given { background: var(--loan); }
.pill.state-returned { background: var(--ok); }
.pill.state-lost, .pill.state-bought_out { background: var(--danger); }
.pill.state-out_of_stock { background: var(--warn); }
.pill.state-not_applicable { background: #6e6e6e; }
.topbar-org { color: var(--ink); text-decoration: none; }

/* Keyboard: a focus you can see, the row numbers once a key was pressed (keys.js). */
:focus-visible { outline: 4px solid var(--loan); outline-offset: 2px; }
body.dark :focus-visible, body.screen-ok :focus-visible, body.screen-error :focus-visible { outline-color: #fff; }
.row, .tile { position: relative; }
.kb [data-hint]::after {
  content: attr(data-hint); position: absolute; top: 8px; right: 10px;
  min-width: 26px; padding: 0 6px; border: 2px solid var(--ink); border-radius: 6px;
  background: var(--paper); color: var(--ink); font-size: 15px; font-weight: 800; text-align: center;
}
.kb .bottombar::after {
  content: "Touche ? : raccourcis clavier"; display: block; margin-top: 8px;
  color: var(--muted); font-size: 15px; text-align: center;
}
.keys-help { max-width: 420px; padding: 16px 20px; border: 3px solid var(--ink); }
.keys-help::backdrop { background: rgba(0, 0, 0, .45); }
.keys-help h2 { margin-top: 0; }
.keys-help dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 12px; }
.keys-help dt { font-weight: 800; white-space: nowrap; }
.keys-help dd { margin: 0; }
.keys-help kbd {
  display: inline-block; min-width: 24px; padding: 0 6px; border: 2px solid var(--ink);
  border-radius: 6px; font: inherit; font-size: 15px; text-align: center;
}
textarea {
  width: 100%; min-height: 96px; padding: 12px 16px; border: 3px solid var(--ink); font: inherit;
}
input[type="tel"] {
  width: 100%; min-height: 60px; padding: 0 16px; border: 3px solid var(--ink); font: inherit;
}

/* A page in sections (member page…): a title over a rule, then its content. */
.block { margin-top: 28px; }
.block > h2 { margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--ink); }
.block h3 {
  margin: 18px 0 8px; font-size: 15px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.count {
  display: inline-block; min-width: 24px; margin-left: 4px; padding: 0 7px; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-size: 14px; text-align: center;
  letter-spacing: 0;
}
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px 16px; margin: 0; }
.facts dt { font-size: 15px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.pill.reserved { background: #5b2a86; }

/* Review fixes: every target at least 44 px, choices that wrap instead of overflowing, the top
   bar and band lined up with the page's column on a tablet or a computer. */
a { color: var(--loan); }
.topbar, .band {
  padding-left: max(16px, calc((100% - 480px) / 2 + 16px));
  padding-right: max(16px, calc((100% - 480px) / 2 + 16px));
}
.topbar-org { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
a.card-name { display: inline-flex; align-items: center; min-height: 44px; }
.facts dd a, .contacts a { display: inline-flex; align-items: center; min-height: 44px; }
.choices { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.choice { gap: 8px; padding: 8px 10px; font-size: 18px; line-height: 1.2; overflow-wrap: break-word; }
.choice input { flex: none; }
.choice:has(input:focus-visible) { outline: 4px solid var(--loan); outline-offset: 2px; }
.note-label { display: block; font-size: 15px; font-weight: 700; color: var(--muted); }

/* Telling pages apart: a member's page has its band, a fiche's page is titled by its number. */
.band-member { background: var(--ink); }
.lead { margin: 0 0 4px; font-size: 21px; font-weight: 700; }
.lead a { display: inline-flex; align-items: center; min-height: 44px; }
.search .btn { margin-top: 12px; }

/* Notes: what it's about, the text, who and when. */
.note-item { padding: 10px 0; border-bottom: 1px solid #ddd; }
.note-subject {
  display: inline-block; padding: 1px 8px; border-radius: 999px; background: #e8e8e8;
  font-size: 14px; font-weight: 700;
}
.note-text { margin: 4px 0; }
.note-meta { margin: 0; font-size: 14px; color: var(--muted); }
.note-form { margin-top: 12px; }
.note-form select { width: 100%; min-height: 52px; font: inherit; border: 3px solid var(--ink); padding: 0 12px; background: var(--paper); }
