/* Stock Latino — même direction artistique que la caisse (« Noche » : prune sombre, accent rose → mangue) */

@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #110a0f;
  --bg-glow: #2a0f1f;
  --panel: #1d1219;
  --panel-2: #2a1b24;
  --panel-3: #38242f;
  --line: #3b2733;
  --text: #fcf4ef;
  --muted: #bfa9b4;
  --accent: #ff3d77;
  --accent-2: #ff8a3d;
  --grad: linear-gradient(120deg, #ff3d77 0%, #ff6a52 55%, #ff9a3d 100%);
  --on-accent: #1a0610;
  --ok: #2ed47a;
  --warn: #ffb547;
  --danger: #ff4d5e;
  --info: #3d7bff;
  --radius: 16px;
  --radius-sm: 12px;
  --tap: 48px;
  --font: "Bricolage", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 85% -10%, var(--bg-glow), transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 500 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-weight: 800; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

button {
  font: inherit;
  font-weight: 700;
  color: inherit;
  border: 0;
  cursor: pointer;
  min-height: var(--tap);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  padding: 0 16px;
  transition: transform .07s ease, filter .12s ease;
  touch-action: manipulation;
  white-space: nowrap;
}
button:active:not(:disabled) { transform: scale(.97); filter: brightness(1.15); }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
button.primary { background: var(--grad); color: var(--on-accent); font-weight: 800; }
button.danger { background: var(--danger); color: #fff; }
button.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
button.compact { min-height: 40px; padding: 0 12px; font-size: 14px; }
button.plus { color: var(--ok); }
button.minus { color: var(--danger); }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: var(--tap);
  padding: 0 14px;
  width: 100%;
}
input:focus, select:focus { border-color: var(--accent-2); outline: none; }
label { display: grid; gap: 6px; font-weight: 700; font-size: 14px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- connexion ---------- */
.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 24px;
  display: grid;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 40px; height: 40px; }
.brand b { font-size: 22px; font-weight: 800; }
.brand span { color: var(--muted); font-weight: 600; }
.error { color: var(--danger); font-weight: 700; min-height: 1.4em; }

/* ---------- structure ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(17, 10, 15, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: transparent; color: var(--muted); min-height: 42px; }
.tabs button.active { background: var(--panel-3); color: var(--text); }
.who { color: var(--muted); font-size: 14px; text-align: right; line-height: 1.2; }
.who b { color: var(--text); display: block; }
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; }
  .topbar .tabs { order: 3; flex-basis: 100%; }
  .who { margin-left: auto; }
}
main { padding: 20px 16px 60px; max-width: 1100px; margin: 0 auto; display: grid; gap: 18px; }
.head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }

.notice {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--muted);
}
.notice b { color: var(--text); }

/* ---------- listes ---------- */
.list { display: grid; gap: 8px; }
.item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.item.alert { border-color: rgba(255, 77, 94, .6); }
.item.off { opacity: .55; }
.item .name { font-weight: 800; font-size: 17px; }
.item .sub { color: var(--muted); font-size: 14px; }
.qty { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; text-align: right; min-width: 110px; }
.qty.neg { color: var(--danger); }
.qty.pos { color: var(--ok); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--muted);
  vertical-align: middle;
}
.badge.danger { background: rgba(255, 77, 94, .18); color: #ff8a95; }
.badge.warn { background: rgba(255, 181, 71, .16); color: var(--warn); }
.badge.ok { background: rgba(46, 212, 122, .14); color: var(--ok); }
.badge.info { background: rgba(61, 123, 255, .18); color: #8fb0ff; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.cat { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.cat i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* ---------- fenêtres ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 2, 4, .7);
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
}
.modal {
  width: min(560px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px 20px;
  display: grid;
  gap: 14px;
}
.modal.wide { width: min(760px, 100%); }
.modal .foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.recipe-row { display: grid; grid-template-columns: 1fr 120px auto; gap: 8px; align-items: center; }
.inv-row { display: grid; grid-template-columns: 1fr minmax(220px, 280px); gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.inv-row input { text-align: right; }

/* ---------- messages ---------- */
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(480px, calc(100% - 32px)); }
.toast { background: var(--panel-3); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; font-weight: 700; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.err { border-color: var(--danger); color: #ffb3ba; }
.toast.ok { border-color: var(--ok); }

pre.details { white-space: pre-wrap; word-break: break-word; margin: 4px 0 0; font: 13px/1.4 ui-monospace, monospace; color: var(--muted); }

@media (max-width: 560px) { .inv-row { grid-template-columns: 1fr; } }
.row > select { max-width: 55%; }
