/* Bar : style commun aux deux portails. Jetons de couleur en variables, thème clair/sombre automatique. */
:root {
  --bg: #f7f2ea; --surface: #ffffff; --surface-2: #f0e9dd; --ink: #2a1f18; --ink-2: #6d5d50; --line: #e4d9c8;
  --accent: #b4651c; --accent-ink: #ffffff; --accent-soft: #f6e4cf;
  --ok: #2f7d4f; --ok-soft: #dff1e5; --warn: #b5760b; --warn-soft: #fbecc8; --bad: #b3372c; --bad-soft: #f8dcd8;
  --shadow: 0 1px 2px rgba(60, 35, 10, .06), 0 8px 24px rgba(60, 35, 10, .08);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15100c; --surface: #211914; --surface-2: #2b211a; --ink: #f3e9dc; --ink-2: #b2a291; --line: #3a2d23;
    --accent: #e0963f; --accent-ink: #1c1209; --accent-soft: #3a2a18;
    --ok: #6fcf97; --ok-soft: #17301f; --warn: #f0b84d; --warn-soft: #3a2c10; --bad: #ff8a7a; --bad-soft: #3b1b17;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); line-height: 1.45;
  font: 16px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
header.top {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
header.top .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.brand svg { width: 30px; height: 30px; color: var(--accent); }
.spacer { flex: 1; }
.who { color: var(--ink-2); font-size: 14px; }

/* boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600;
  transition: transform .06s, background .15s, border-color .15s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ok { background: var(--ok); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.block { width: 100%; }

/* puces et segments */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2);
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); gap: 2px; }
.seg button { border: 0; background: transparent; min-height: 34px; padding: 0 14px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.acc { background: var(--accent-soft); color: var(--accent); }

/* cartes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.coffee { padding: 16px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; text-align: left; position: relative; overflow: hidden; }
.coffee:hover { border-color: var(--accent); }
.pod { width: 54px; height: 54px; border-radius: 50%; box-shadow: inset 0 -6px 10px rgba(0,0,0,.28), inset 0 5px 8px rgba(255,255,255,.28), 0 4px 10px rgba(0,0,0,.18); background: var(--c, #7a6a58); position: relative; flex: none; }
.pod::after { content: ""; position: absolute; inset: 15px; border-radius: 50%; background: rgba(0,0,0,.22); box-shadow: inset 0 2px 3px rgba(0,0,0,.4); }
.coffee .row { display: flex; gap: 12px; align-items: center; }
.coffee h3 { font-size: 17px; }
.coffee .brand-line { color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.coffee p { margin: 0; color: var(--ink-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meter { display: flex; gap: 2px; align-items: center; }
.meter i { width: 6px; height: 14px; border-radius: 2px; background: var(--line); }
.meter i.on { background: var(--accent); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* fenêtre (feuille du bas sur téléphone) */
.scrim { position: fixed; inset: 0; background: rgba(15, 8, 3, .55); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; background: var(--surface); border-radius: 24px 24px 0 0; padding: 22px 20px 26px; display: flex; flex-direction: column; gap: 16px; animation: rise .2s; }
@media (min-width: 640px) { .scrim { align-items: center; } .sheet { border-radius: 24px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); text-align: left; width: 100%; }
.opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt .dot { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: 13px; color: var(--accent-ink); }
.opt[aria-pressed="true"] .dot { background: var(--accent); border-color: var(--accent); }
.opt.radio .dot { border-radius: 50%; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); font-weight: 700; margin-bottom: 8px; }

/* champs */
input[type=text], input[type=number], select {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); outline: none;
}
input:focus, select:focus, .btn:focus-visible, .chip:focus-visible, .opt:focus-visible, .coffee:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 6px; }

/* commandes */
.stack { display: flex; flex-direction: column; gap: 14px; }
.order { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.order .head { display: flex; gap: 12px; align-items: center; }
.order .head .pod-sm { width: 40px; height: 40px; border-radius: 50%; background: var(--c, #7a6a58); box-shadow: inset 0 -4px 7px rgba(0,0,0,.28), inset 0 3px 6px rgba(255,255,255,.28); flex: none; }
.order .cup { width: 100%; max-height: 380px; object-fit: cover; border-radius: 14px; display: block; }
.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.steps i.on { background: var(--accent); }
.steps.done i { background: var(--ok); }
.muted { color: var(--ink-2); font-size: 14px; }
.empty { text-align: center; padding: 56px 20px; color: var(--ink-2); }
.empty svg { width: 56px; height: 56px; opacity: .5; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; z-index: 60; box-shadow: var(--shadow); max-width: 90vw; font-weight: 600; animation: rise .2s; }
.banner { padding: 12px 16px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.spin { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: rot .8s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 0; }
main.wrap { padding-top: 8px; padding-bottom: 96px; }
.footer { text-align: center; color: var(--ink-2); font-size: 12px; padding: 24px 0; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* portail barman */
.switch { position: relative; width: 48px; height: 28px; border-radius: 999px; border: 0; background: var(--line); cursor: pointer; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.stepper button { width: 34px; height: 34px; border: 0; background: transparent; cursor: pointer; font-size: 18px; font-weight: 700; color: var(--ink-2); }
.stepper button:hover { background: var(--surface-2); color: var(--ink); }
.stepper output { min-width: 38px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.qrow { display: grid; grid-template-columns: minmax(180px, 1.6fr) auto auto auto auto; gap: 14px 18px; align-items: center; padding: 12px 16px; }
.qrow + .qrow { border-top: 1px solid var(--line); }
.qrow .who-cell { display: flex; gap: 12px; align-items: center; min-width: 0; }
.qrow .pod { width: 38px; height: 38px; }
.qrow .pod::after { inset: 11px; }
.qrow small { display: block; color: var(--ink-2); font-size: 12px; }
.qrow .cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.qrow .cell > span { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); font-weight: 700; }
@media (max-width: 760px) { .qrow { grid-template-columns: 1fr 1fr; } .qrow .who-cell { grid-column: 1 / -1; } }
.cols { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.col h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin: 6px 0 12px; display: flex; gap: 8px; align-items: center; }
.ord { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; border-left: 5px solid var(--accent); }
.ord.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn-soft) 40%, var(--surface)); }
.ord.go { border-left-color: var(--ok); }
.ord .who-name { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.ord .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ord .thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; }
.preview { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 14px; background: var(--surface-2); }
.box-alert { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--radius); background: var(--warn-soft); border: 1px solid var(--warn); margin-bottom: 18px; flex-wrap: wrap; }
.box-alert b { color: var(--ink); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 14px 0; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv h3 { font-size: 16px; }
.pane { padding: 6px 18px; }
.dotlive { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); display: inline-block; }
.dotlive.off { background: var(--bad); }

/* barre d'onglets du barman : en bas sur téléphone, en haut sur grand écran */
.tabbar { display: flex; gap: 8px; padding: 14px 0; overflow-x: auto; }
.fab { position: fixed; right: 16px; bottom: 24px; z-index: 31; box-shadow: var(--shadow); min-height: 52px; border-radius: 26px; padding: 0 22px; }
@media (max-width: 760px) {
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); justify-content: space-around; overflow: visible; }
  .tabbar .chip { flex: 1; border: 0; background: transparent; border-radius: 12px; min-height: 48px; padding: 0 4px; font-size: 13px; }
  .tabbar .chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
  .fab { bottom: calc(80px + env(safe-area-inset-bottom)); }
  main.wrap { padding-bottom: 170px; }
  header.top .wrap { height: 54px; }
  .brand { font-size: 18px; }
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .coffee { padding: 14px; }
  .ord .who-name { font-size: 22px; }
  .ord .actions .btn { flex: 1 1 130px; min-height: 48px; }
  .toolbar { padding: 10px 0; }
  .cols { grid-template-columns: 1fr; }
  .sheet { padding: 20px 16px calc(22px + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) { .chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none; } .chips.scroll .chip { flex: none; } }
.tabbar .chip { white-space: nowrap; }
@media (max-width: 760px) { .tabbar .chip { font-size: 12.5px; } .tabbar .chip .tag { margin-left: 4px !important; padding: 0 6px; } }

.pod.emoji, .pod-sm.emoji { display: grid; place-items: center; font-size: 26px; line-height: 1; }
.pod.emoji::after { display: none; }
.pod-sm.emoji { font-size: 20px; }
.qrow .pod.emoji { font-size: 20px; }

/* stock du barman : lignes compactes, détail au toucher */
.prow { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.prow:first-child { border-top: 0; }
.prow-head { display: flex; align-items: center; gap: 12px; cursor: pointer; min-height: 48px; }
.prow-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.prow-name b { font-size: 16px; }
.prow-name small, .prow-sum, .cell small { color: var(--ink-2); font-size: 12.5px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.prow-sum { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: 14px; color: var(--ink-2); padding-left: 52px; }
.prow-sum b { color: var(--ink); font-size: 16px; }
.prow-sum .total { margin-left: auto; font-weight: 700; color: var(--ink); }
.prow.open { background: color-mix(in srgb, var(--accent-soft) 35%, var(--surface)); }
.prow-ctl { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 6px 0 4px 52px; }
.prow-ctl .cell { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.prow-ctl .cell > span { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 700; }
.prow-btns { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.prow-btns .btn { flex: 1 1 140px; }
.stepper input { width: 56px; min-height: 36px; border: 0; border-radius: 0; text-align: center; font-weight: 700; padding: 0; background: transparent; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper button { width: 40px; height: 40px; }
.clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: transparent; color: var(--ink-2); font-size: 16px; cursor: pointer; border-radius: 50%; }
@media (max-width: 760px) { .prow-sum { padding-left: 0; } .prow-ctl { padding-left: 0; grid-template-columns: 1fr; } }

/* portail invités : barre collante, onglets de famille, liste compacte */
.grow { flex: 1; min-width: 0; }
.stickybar { position: sticky; top: 60px; z-index: 15; background: var(--bg); margin: 0 -16px 10px; padding: 8px 16px 6px; border-bottom: 1px solid transparent; }
.famtabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
.famtabs button { flex: none; min-height: 44px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 15px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.famtabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.searchrow { display: flex; gap: 8px; align-items: center; }
.searchrow input { flex: 1; min-width: 0; }
.filterbtn { flex: none; gap: 6px; }
.activechips { margin-top: 8px; }
.group-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin: 18px 2px 8px; display: flex; gap: 8px; align-items: center; }
.group-title span { font-size: 12px; background: var(--surface-2); border-radius: 999px; padding: 1px 8px; letter-spacing: 0; }
.coffee .go { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 22px; font-weight: 700; }
.meta.tight { gap: 4px 6px; margin-top: 4px; }
.live-order { display: flex; gap: 12px; align-items: center; padding: 12px 14px; margin: 12px 0 4px; width: 100%; text-align: left; cursor: pointer; border-color: var(--accent); }
.live-order .pod-sm { width: 36px; height: 36px; border-radius: 50%; background: var(--c, #7a6a58); flex: none; box-shadow: inset 0 -4px 7px rgba(0,0,0,.28), inset 0 3px 6px rgba(255,255,255,.28); }
.who { color: var(--ink-2); font-size: 14px; white-space: nowrap; }
input[type=search] { width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); outline: none; -webkit-appearance: none; appearance: none; }
@media (max-width: 760px) {
  .stickybar { top: 54px; }
  .coffee .pod { width: 46px; height: 46px; }
  .coffee .pod::after { inset: 13px; }
  .coffee .row { gap: 12px; }
  .coffee p { display: none; }
  .coffee h3 { font-size: 16px; }
  main.wrap { padding-bottom: 120px; }
}
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 2px 10px; }
.bulk .muted { flex: 1 1 100%; font-size: 13px; }
