:root {
  --bg: #f4f1ec;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e2ddd5;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok: #15803d;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181c;
    --card: #1d2329;
    --ink: #eef1f3;
    --muted: #9aa5b1;
    --line: #2d353d;
    --accent: #2dd4bf;
    --accent-ink: #062c28;
    --warn: #fbbf24;
    --danger: #f87171;
    --ok: #4ade80;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.4rem; margin: 8px 0 14px; }
h2 { font-size: 1.1rem; margin: 22px 0 8px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); font-size: .9rem; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--accent); color: var(--accent-ink);
}
.top a, .top .who { color: var(--accent-ink); }
.brand { font-weight: 700; letter-spacing: .2px; }
.who { font-size: .85rem; opacity: .85; }

main { max-width: 900px; margin: 0 auto; padding: 12px 16px 24px; }
.back { display: inline-block; margin-bottom: 4px; font-size: .95rem; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
}
.tabs a, .tabs .linklike {
  flex: 1; text-align: center; padding: 10px 2px; font-size: .85rem;
  color: var(--ink); border-radius: 10px;
}
.linklike { background: none; border: 0; font: inherit; cursor: pointer; color: var(--muted); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.item { display: block; color: inherit; }
.item .t { font-weight: 600; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 0 auto; }
.grow { flex: 1 1 auto !important; }

.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; }

label { display: block; margin: 10px 0; font-weight: 600; font-size: .92rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit; font-weight: 400;
}
input[type=checkbox] { display: inline-block; width: auto; margin: 0 8px 0 0; }
.card > input[type=search], #q { margin: 0 0 10px; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 700;
  border: 1px solid var(--line);
}
.badge.en_cours { color: var(--warn); }
.badge.terminee { color: var(--ok); }
.badge.attente_pieces { color: var(--danger); }
.num { font-variant-numeric: tabular-nums; font-weight: 700; }

video { width: 100%; height: 40vh; max-height: 40vh; border-radius: 12px; background: #000; object-fit: cover; }
img.ph { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; background: var(--line); cursor: pointer; }
.phw { position: relative; }
.phx { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; }
.phs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 10px; }
.phs:empty { display: none; }
.phs img.ph { width: 100%; height: auto; aspect-ratio: 1; }
.phsec { padding: 12px 0; border-top: 1px solid var(--line); }
.phsec:first-child { border-top: 0; padding-top: 0; }
.phsec:last-child { padding-bottom: 0; }
.phh { font-weight: 700; margin-bottom: 8px; }
.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dlg { width: 100%; max-width: 420px; margin: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { text-align: center; margin: 0; padding: 10px 4px; }
.stat .big { font-size: 1.6rem; font-weight: 800; }
dl { margin: 0; display: grid; grid-template-columns: 120px 1fr; gap: 4px 10px; }
dt { color: var(--muted); }
dd { margin: 0; }

#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: 92vw; padding: 12px 16px; border-radius: 12px; font-weight: 600;
  background: var(--ink); color: var(--bg); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20;
}
#toast.show { opacity: 1; }
#toast.err { background: var(--danger); color: #fff; }

.login { max-width: 420px; margin: 8vh auto; padding: 0 16px; }

/* Impression : fiche à poser sur la machine, et planche d'étiquettes */
.printonly, #printzone { display: none; }
@media print {
  body { background: #fff; color: #000; padding: 0; }
  .noprint { display: none !important; }
  main { max-width: none; padding: 0; }
  .printonly { display: block; }
  #printzone { display: grid; grid-template-columns: repeat(auto-fill, 40mm); gap: 2mm; }
  .label { width: 40mm; height: 40mm; padding: 2mm; text-align: center; border: .2mm dashed #999; page-break-inside: avoid; }
  .label svg { width: 30mm; height: 30mm; display: block; margin: 0 auto; }
  .label .n { font: 700 4.5mm/1 system-ui, sans-serif; margin-top: 1mm; }
  .fiche { font-family: system-ui, sans-serif; color: #000; }
  .fiche h1 { font-size: 20pt; margin: 0 0 4mm; }
  .fiche .head { display: flex; justify-content: space-between; gap: 8mm; border-bottom: .4mm solid #000; padding-bottom: 4mm; margin-bottom: 4mm; }
  .fiche .head svg { width: 32mm; height: 32mm; }
  .fiche .big { font-size: 26pt; font-weight: 800; }
  .fiche table { width: 100%; border-collapse: collapse; font-size: 10pt; }
  .fiche td, .fiche th { border-bottom: .2mm solid #999; padding: 2mm 1mm; text-align: left; vertical-align: top; }
}
.phcols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: start; }
.phcols .phs { grid-template-columns: 1fr; margin: 0 0 8px; }
.phcol .phh { font-size: .9rem; margin-bottom: 6px; }
.phcol .muted { margin-bottom: 8px; font-size: .85rem; }
.phcol .btn { width: 100%; min-height: 40px; padding: 8px 4px; font-size: .85rem; }
.topwrap { position: sticky; top: 0; z-index: 5; }
.top { position: static; }
.tabs { position: static; padding: 4px 4px; border-top: 0; border-bottom: 1px solid var(--line); }
.tabs a, .tabs .linklike { padding: 8px 2px; }
body { padding-bottom: 24px; }
#toast { bottom: 24px; }
@media print { .fiche .phprint { width: 40mm; height: 40mm; object-fit: cover; border-radius: 2mm; } }
/* charte Cuisine Pro Services */
:root { --bg:#f3f6f6; --card:#fff; --ink:#00304a; --muted:#5d7482; --line:#dbe5e8; --accent:#12806c; --accent-ink:#fff; --orange:#f59e0b; --navy:#00304a; }
.top { background:#fff; color:var(--navy); padding:calc(5px + env(safe-area-inset-top)) 14px 5px; border-bottom:0; }
.top .who { color:var(--navy); }
.brand img { height:34px; width:auto; display:block; }
.tabs { background:var(--navy); border-bottom:0; }
.tabs a, .tabs .linklike { color:#fff; }
.linklike { color:#b9cfd9; }
.btn.primary { background:var(--orange); border-color:var(--orange); color:var(--navy); }
.phs[hidden] { display: none; }
/* thème sombre aux couleurs Cuisine Pro Services */
:root { --bg:#0c1c26; --card:#13303f; --ink:#eaf2f5; --muted:#93aab6; --line:#244454; --accent:#30b098; --accent-ink:#00304a; --orange:#f59e0b; --navy:#00304a; --danger:#ff8a80; --ok:#5fd38d; --warn:#fbbf24; }
.top { background:var(--navy); color:#fff; border-bottom:0; }
.top .who { color:#d7e6ec; }
.brand img { background:#fff; border-radius:8px; padding:3px 8px; height:36px; }
.tabs { background:#07222f; border-bottom:1px solid var(--line); }
.tabs a, .tabs .linklike { color:#eaf2f5; }
.linklike { color:#93aab6; }
.btn { color:var(--ink); }
.btn.danger { color:var(--danger); }
.btn.primary { color:var(--navy); }

.brand { display:flex; align-items:center; gap:10px; }
.brand .bt { color:#fff; font-weight:700; font-size:1.05rem; letter-spacing:.2px; }
.tabs a, .tabs .linklike { display:flex; justify-content:center; align-items:center; padding:9px 2px; }
.tabs svg { width:26px; height:26px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.tabs a.on { color:#30b098; background:rgba(48,176,152,.16); }
.bkrow { padding: 6px 0; border-bottom: 1px solid var(--line); }
.bkrow:last-child { border-bottom: 0; }
.bkrow .btn { min-height: 36px; padding: 6px 12px; font-size: .85rem; }
