/* Line Media Kit - interface utilitaire.
 *
 * Gris neutres, un seul bleu d'accent, et trois couleurs d'etat qui ne
 * servent qu'a dire ou se trouve une piece. Le mode sombre est le mode
 * principal (un entrepot a 23h), le mode clair sert au bureau. Aucune police
 * distante : l'appli doit s'afficher en 4G faiblarde et fonctionner hors
 * ligne, donc la personnalite passe par la graisse et la chasse.
 */

:root {
  color-scheme: dark light;

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;

  /* sombre */
  --ground: #0e0f11;
  --panel: #17181c;
  --panel-2: #1e2025;
  --line: #2a2d33;
  --line-strong: #3d414a;
  --ink: #f1f2f4;
  --ink-2: #b4b8c0;
  --muted: #848a94;

  --accent: #5b95ff;         /* bleu : accent d'interface, code du cadenas */
  --accent-ink: #08111f;
  --ok: #43d17f;             /* dans la caisse */
  --out: #ff6f6f;            /* sortie, quelqu'un l'a */
  --away: #5b95ff;           /* rangee ailleurs */
  --alert: #ff6f6f;

  --radius: 12px;
  --radius-s: 8px;
  --tap: 60px;               /* hauteur minimale d'une ligne tapable */
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 6px 20px rgba(0, 0, 0, .4);
}

:root[data-theme="light"] {
  color-scheme: light;
  --ground: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #edeff2;
  --line: #e0e3e8;
  --line-strong: #c3c8d1;
  --ink: #14161a;
  --ink-2: #454b55;
  --muted: #6b7280;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --ok: #157f4b;
  --out: #d3392c;
  --away: #1f6feb;
  --alert: #d3392c;
  --shadow: 0 1px 2px rgba(20, 25, 35, .06), 0 6px 18px rgba(20, 25, 35, .06);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --ground: #f4f5f7;
    --panel: #ffffff;
    --panel-2: #edeff2;
    --line: #e0e3e8;
    --line-strong: #c3c8d1;
    --ink: #14161a;
    --ink-2: #454b55;
    --muted: #6b7280;
    --accent: #1f6feb;
    --accent-ink: #ffffff;
    --ok: #157f4b;
    --out: #d3392c;
    --away: #1f6feb;
    --alert: #d3392c;
    --shadow: 0 1px 2px rgba(20, 25, 35, .06), 0 6px 18px rgba(20, 25, 35, .06);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
#app { position: relative; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

/* --- etiquettes au pochoir ------------------------------------------------ */
.stencil {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.is-out { border-color: var(--out); color: var(--out); }
.chip.is-away { border-color: var(--away); color: var(--away); }
.chip.is-loose { border-color: var(--line-strong); color: var(--muted); }
.chip.is-admin { border-color: var(--accent); color: var(--accent); }

/* --- structure ------------------------------------------------------------ */
.wrap { max-width: 620px; margin: 0 auto; padding: 0 14px 120px; }
.wrap.wide { max-width: 1180px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; letter-spacing: .1em; text-transform: uppercase; font-size: 13px;
  color: var(--ink); text-decoration: none;
}
/* Le logotype est blanc sur noir : il garde son fond, qui devient une plaque
 * sur le theme clair. C'est ainsi que la marque se presente partout ailleurs. */
.topbar .brand .mark {
  height: 19px; width: auto; flex: none;
  border-radius: 3px;
  display: block;
}
/* Le fond du logotype est un noir different de celui de la barre, ce qui
 * dessinait un rectangle autour du mot. En theme sombre, le mode "screen"
 * fait disparaitre ce noir et ne laisse que le texte et le carre rouge. En
 * theme clair, la plaque noire est voulue : on n'y touche pas. */
:root[data-theme="dark"] .topbar .brand .mark { mix-blend-mode: screen; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .topbar .brand .mark { mix-blend-mode: screen; }
}
.topbar .spacer { flex: 1; }

.iconbtn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line); border-radius: var(--radius-s);
  color: var(--ink-2);
}
.iconbtn:hover { border-color: var(--line-strong); color: var(--ink); }
.iconbtn svg { width: 19px; height: 19px; }

/* --- plaque de caisse ----------------------------------------------------- */
/* Le bloc que l'on regarde en premier, une main sur le cadenas. */
.plate {
  margin: 14px 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.plate .head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px 12px;
}
.plate h1 {
  margin: 2px 0 0;
  font-size: 25px; line-height: 1.15; font-weight: 800; letter-spacing: -.01em;
}
.plate .meta { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 6px; }

.lock {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}
.lock .digits {
  font-family: var(--mono);
  font-size: clamp(34px, 12vw, 46px);
  font-weight: 700;
  letter-spacing: .12em;
  font-variant-numeric: tabular-nums slashed-zero;
  color: var(--accent);
  line-height: 1;
}
.lock .none { font-size: 15px; color: var(--muted); font-style: italic; }

/* --- compteurs ------------------------------------------------------------ */
.tally { display: flex; gap: 8px; margin-bottom: 12px; }
.tally .t {
  flex: 1; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--panel);
}
.tally .t b { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tally .t.out b { color: var(--out); }
.tally .t.away b { color: var(--away); }
.tally .t .stencil { display: block; margin-top: 2px; }

/* --- lignes de materiel --------------------------------------------------- */
.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.list .group {
  padding: 8px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
}
.list .group:first-child { border-top: 0; }

.row {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: var(--tap);
  padding: 10px 14px 10px 22px;
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  text-align: left; color: inherit;
}
.row:last-child { border-bottom: 0; }
.row:active { background: var(--panel-2); }
.row .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: var(--line-strong); }
.row.is-present .bar { background: var(--ok); }
/* Les rayures obliques disent "sorti" sans dependre de la couleur : lisible
 * aussi pour un daltonien et sous une frontale rouge. */
.row.is-out .bar {
  background: repeating-linear-gradient(135deg, var(--out) 0 5px, color-mix(in srgb, var(--out) 35%, var(--panel)) 5px 10px);
}
.row.is-away .bar { background: var(--away); }
/* Etat mixte : une partie est la, une partie non. La barre le montre en deux
 * teintes plutot que de choisir un mensonge. */
.row.is-mixed .bar {
  background: linear-gradient(180deg, var(--ok) 0 50%, var(--out) 50% 100%);
}
.row.is-loose .bar { background: var(--muted); }

.row .body { flex: 1; min-width: 0; }
.row .name { font-size: 17px; font-weight: 650; line-height: 1.25; }
.row .sub { margin-top: 3px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.row .sub .ref { font-family: var(--mono); font-size: 12px; }
.row .sub .who { color: var(--out); font-weight: 600; }

.row .act {
  flex: none; width: 74px; height: 42px;
  display: grid; place-items: center;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-s);
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-2); background: transparent;
}
.row.is-present .act, .row.is-away .act, .row.is-loose .act { border-color: var(--line-strong); }
.row.is-out .act { border-color: var(--out); color: var(--out); background: color-mix(in srgb, var(--out) 12%, transparent); }
.row.pending { opacity: .55; }

/* Retour visuel du geste : la ligne s'allume une demi-seconde. */
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } to { background: transparent; } }
.row.flash { animation: flash .5s ease-out; }

/* --- boutons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 18px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--panel); color: var(--ink);
  font-size: 15px; font-weight: 700; letter-spacing: .02em;
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--alert); border-color: color-mix(in srgb, var(--alert) 55%, var(--line)); }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }

.actions { display: flex; gap: 10px; margin: 14px 0; }
.actions .btn { flex: 1; }

/* --- champs --------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field > label { display: block; margin-bottom: 6px; }
input[type="text"], input[type="search"], input[type="number"], input[type="password"], select, textarea {
  width: 100%; min-height: 50px; padding: 10px 13px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
textarea { min-height: 84px; resize: vertical; }
::placeholder { color: var(--muted); }

/* --- pave numerique ------------------------------------------------------- */
.pin { display: flex; justify-content: center; gap: 12px; margin: 26px 0 22px; }
.pin i {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: transparent;
  transition: transform .12s ease, background .12s ease;
}
.pin i.on { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
.pin.bad { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-9px); } 50% { transform: translateX(9px); } 75% { transform: translateX(-5px); } }

.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 320px; margin: 0 auto; }
.keys button {
  height: 68px;
  font-family: var(--mono); font-size: 27px; font-weight: 600;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.keys button:active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.keys button.blank { background: transparent; border-color: transparent; pointer-events: none; }
.keys button.wide { font-size: 15px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

/* --- cartes / panneaux ---------------------------------------------------- */
.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); padding: 16px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 800; }

.caselink {
  display: flex; align-items: center; gap: 13px;
  width: 100%; min-height: var(--tap); padding: 12px 14px;
  border: 0; border-bottom: 1px solid var(--line);
  background: transparent; color: inherit; text-align: left; text-decoration: none;
}
.caselink:last-child { border-bottom: 0; }
.caselink:active { background: var(--panel-2); }
.caselink .kind {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s); color: var(--muted);
}
.caselink .kind svg { width: 20px; height: 20px; }
.caselink .n { flex: 1; min-width: 0; }
.caselink .n b { display: block; font-size: 17px; font-weight: 650; }
.caselink .n span { font-size: 13px; color: var(--muted); }
.caselink .code { font-family: var(--mono); font-size: 17px; font-weight: 700; color: var(--accent); letter-spacing: .08em; }

/* --- bandeaux ------------------------------------------------------------- */
.note {
  padding: 12px 14px; border-radius: var(--radius-s);
  border: 1px solid var(--line-strong); background: var(--panel);
  font-size: 14px; margin-bottom: 14px;
}
.note.warn { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.note.bad { border-color: color-mix(in srgb, var(--alert) 60%, var(--line)); background: color-mix(in srgb, var(--alert) 10%, var(--panel)); color: var(--ink); }

.offline {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 10px 14px; padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--accent); color: var(--accent-ink);
  font-size: 13px; font-weight: 700; letter-spacing: .04em; text-align: center;
  transform: translateY(110%); transition: transform .25s ease;
}
.offline.on { transform: none; }

.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 50;
  max-width: 90vw; padding: 12px 18px;
  background: var(--ink); color: var(--ground);
  border-radius: 999px; font-size: 14px; font-weight: 650;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  /* Masque par la visibilite, pas en le poussant sous le bord : un decalage
   * exprime en pourcentage depend de la hauteur du message, et un message
   * vide finissait par depasser en bas de l'ecran. */
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translate(-50%, 14px);
  transition: transform .22s cubic-bezier(.2, .9, .3, 1.2), opacity .18s ease, visibility .18s;
}
.toast.on { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0); }

/* --- barre d'action collee en bas ---------------------------------------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; gap: 10px;
  padding: 10px 14px; padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--ground) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.dock .btn { flex: 1; }

/* --- recherche / ajout ---------------------------------------------------- */
.sheet {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--ground);
}
.sheet .sheet-head { display: flex; gap: 10px; align-items: center; padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); }
.sheet .sheet-body { flex: 1; overflow: auto; padding: 14px; padding-bottom: 40px; }

/* --- tableaux (poste d'administration) ------------------------------------ */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 14px 0 16px; padding-bottom: 4px; }
.tabs button {
  flex: none; padding: 9px 15px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink-2);
  font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.tabs button.on { background: var(--ink); border-color: var(--ink); color: var(--ground); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 800; white-space: nowrap; }
tbody tr:hover { background: var(--panel-2); }
td .mono, .mono { font-family: var(--mono); font-size: 13px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 14px 16px; }
.kpi b { display: block; font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi.out b { color: var(--out); }
.kpi.away b { color: var(--away); }

.rowline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rowline .grow { flex: 1; min-width: 140px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* --- entree en scene ------------------------------------------------------ */
/* Un decalage court : la liste se pose, elle ne defile pas. */
@media (prefers-reduced-motion: no-preference) {
  .stagger > * { animation: rise .32s both; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  .stagger > *:nth-child(1) { animation-delay: .01s; }
  .stagger > *:nth-child(2) { animation-delay: .03s; }
  .stagger > *:nth-child(3) { animation-delay: .05s; }
  .stagger > *:nth-child(4) { animation-delay: .07s; }
  .stagger > *:nth-child(5) { animation-delay: .09s; }
  .stagger > *:nth-child(n+6) { animation-delay: .11s; }
}

@media (min-width: 760px) {
  body { font-size: 16px; }
  .wrap { padding-bottom: 60px; }
  .dock { position: static; border: 0; padding: 0; margin: 16px 0; background: none; backdrop-filter: none; }
}

/* --- choix de quantite et d'exemplaires ----------------------------------- */
/* Le compteur d'une ligne a plusieurs exemplaires : il remplace le libelle
 * d'action, parce qu'il n'y a pas de geste evident a annoncer. */
.act.count { font-family: var(--mono); font-size: 15px; letter-spacing: 0; }

.note-chip {
  display: inline-block; max-width: 100%;
  padding: 1px 7px; border-radius: 4px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink-2); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.stepper {
  display: flex; align-items: center; gap: 14px;
  margin: 8px 0 18px;
}
.stepper button {
  width: 58px; height: 58px; flex: none;
  font-size: 26px; font-weight: 700;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.stepper button:active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stepper b {
  min-width: 58px; text-align: center;
  font-family: var(--mono); font-size: 32px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pick {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap); padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.pick:last-child { border-bottom: 0; }
.pick input { width: 22px; height: 22px; min-height: 0; flex: none; accent-color: var(--accent); }
.pick .body { flex: 1; min-width: 0; }
.pick .name { font-size: 16px; font-weight: 650; }
.pick .sub { margin-top: 2px; font-size: 13px; color: var(--muted); }

/* Le bandeau qui propose d'annoter apres coup : present sans interrompre. */
.toast { display: flex; align-items: center; gap: 12px; }
.toast-act {
  flex: none; padding: 4px 11px;
  background: transparent; color: var(--ground);
  border: 1px solid var(--ground); border-radius: 999px;
  font-size: 13px; font-weight: 700;
}

/* --- releve de fin de journee -------------------------------------------- */
.sheetgroup { margin-bottom: 18px; }
.sheetgroup > h3 {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 0 0 8px; padding-bottom: 6px;
  border-bottom: 2px solid var(--line-strong);
  font-size: 16px; font-weight: 800;
}
.sheetgroup > h3 .where { font-size: 13px; font-weight: 600; color: var(--muted); }
.sheetgroup > h3 .code { font-family: var(--mono); color: var(--accent); font-weight: 700; }
.sheetgroup .n { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }

@media print {
  .topbar, .tabs, .dock, .offline, .toast, .btn { display: none !important; }
  :root { --ground: #fff; --panel: #fff; --panel-2: #fff; --ink: #000; --ink-2: #333; --muted: #555; --line: #ccc; --line-strong: #888; }
  .wrap { max-width: none; padding: 0; }
  .card { break-inside: avoid; border: 0; padding: 0; }
  .sheetgroup { break-inside: avoid; }
}

/* --- etat du materiel ----------------------------------------------------- */
:root {
  --c-check: #e0b341;
  --c-damaged: #ff8a3d;
  --c-dead: #ff5f6b;
}
:root[data-theme="light"] { --c-check: #9a6b00; --c-damaged: #b3480d; --c-dead: #c02233; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --c-check: #9a6b00; --c-damaged: #b3480d; --c-dead: #c02233; }
}

.cond {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 8px; border-radius: 4px;
  border: 1px solid currentColor;
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.cond.c-check { color: var(--c-check); }
.cond.c-damaged { color: var(--c-damaged); }
.cond.c-dead { color: var(--c-dead); text-decoration: line-through; }

/* Le choix se fait au pouce : une pile de grandes cibles, pas un menu. */
.conds { display: grid; gap: 8px; margin-top: 8px; }
.conds button {
  display: flex; align-items: center; gap: 11px;
  min-height: 54px; padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--panel); color: var(--ink);
  font-size: 15px; font-weight: 600; text-align: left;
}
.conds button i {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid currentColor;
}
.conds button.c-ok { color: var(--ok); }
.conds button.c-check { color: var(--c-check); }
.conds button.c-damaged { color: var(--c-damaged); }
.conds button.c-dead { color: var(--c-dead); }
.conds button.on { border-color: currentColor; background: color-mix(in srgb, currentColor 14%, var(--panel)); }
.conds button.on i { background: currentColor; }
.conds button[data-cond=""] { color: var(--muted); font-weight: 500; }

/* --- visage des comptes --------------------------------------------------- */
.avatar {
  flex: none; border-radius: 50%; object-fit: cover;
  background: var(--panel-2);
  vertical-align: middle;
}
.avatar.ini {
  display: inline-grid; place-items: center;
  color: #fff; font-weight: 800; letter-spacing: .02em;
}
.row .sub .avatar, .feedline .avatar { margin-right: 4px; }

/* --- fil d'historique ----------------------------------------------------- */
.feedline {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.feedline:last-child { border-bottom: 0; }
.feedline .what { flex: 1; min-width: 0; line-height: 1.45; }
.feedline .when { flex: none; font-size: 12px; padding-top: 2px; }
.feedline .cond { margin-left: 4px; }

/* --- l'administration sur un telephone ------------------------------------ */
/* Pendant un evenement, tout se controle depuis le parking : les tableaux
 * deviennent des fiches empilees, chaque cellule portant son intitule. */
@media (max-width: 760px) {
  .wrap.wide { padding-left: 12px; padding-right: 12px; }

  .tablewrap { border: 0; background: transparent; overflow: visible; }
  .tablewrap table, .tablewrap tbody, .tablewrap tr, .tablewrap td { display: block; width: 100%; }
  .tablewrap thead { display: none; }
  .tablewrap tr {
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--panel); padding: 12px 14px; margin-bottom: 10px;
  }
  .tablewrap tr:hover { background: var(--panel); }
  .tablewrap td { border: 0; padding: 3px 0; }
  .tablewrap td:empty { display: none; }
  .tablewrap td.right { text-align: left; }
  .tablewrap td[data-label]::before {
    content: attr(data-label) " ";
    display: block; margin-bottom: 2px;
    font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
    color: var(--muted);
  }
  /* La rangee d'actions passe en bas de la fiche, en cibles pleine largeur. */
  .tablewrap td.acts {
    display: flex; gap: 8px; margin-top: 10px; padding-top: 10px;
    border-top: 1px solid var(--line);
  }
  .tablewrap td.acts .btn { flex: 1; min-height: 44px; }
  .tablewrap td.pickcell { display: inline-block; width: auto; margin-right: 10px; }

  .grid2 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 11px 12px; }
  .kpi b { font-size: 24px; }

  /* Les onglets secondaires (regroupements) restent en pastilles defilantes. */
  .tabs { scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { padding: 9px 13px; font-size: 12px; }

  .rowline { gap: 8px; }
  .rowline .grow { min-width: 100%; }
  .rowline .btn.small, .rowline select { min-height: 44px; }

  .sheetgroup > h3 { font-size: 15px; }
  .sheetgroup .n { flex-basis: 100%; margin-left: 0; }
  .sheetgroup .tablewrap tr { padding: 10px 12px; }

  .card { padding: 13px; }
  .card h2 { font-size: 13px; }
}

/* Sur un grand ecran l'espace d'administration respire et tient en largeur. */
@media (min-width: 1100px) {
  .wrap.wide { max-width: 1320px; }
  .grid2 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
}

/* --- bandeau d'onglets en bas (administration au telephone) --------------- */
/* Pendant un evenement l'administration se pilote a une main, telephone en
 * bas de la paume : les destinations viennent au pouce plutot que sous le
 * pouce. Quatre principales, le reste derriere "Plus". */
.tabbar { display: none; }

@media (max-width: 760px) {
  .tabs.desk { display: none; }

  .tabbar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: color-mix(in srgb, var(--ground) 94%, transparent);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar button {
    flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 2px 7px; min-height: 58px;
    background: transparent; border: 0;
    color: var(--muted);
  }
  .tabbar button svg { width: 22px; height: 22px; }
  .tabbar button span {
    font-size: 10px; font-weight: 700; letter-spacing: .02em;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .tabbar button.on { color: var(--accent); }
  .tabbar button:active { background: var(--panel-2); }

  /* Le contenu ne doit pas finir sous le bandeau. */
  .wrap.wide { padding-bottom: 96px; }
}

@media print {
  .tabbar { display: none !important; }
}
