/* Caféino — caisse : écran « Stock & achats » (pos-stock.js). Même langage que la caisse « Torréfaction » :
   surfaces moka étagées, pilules, chiffres tabulaires, mouvements calmes (≤ 220 ms). */

.inv { height: 100%; overflow-y: auto; padding: 18px 24px 32px; display: grid; gap: 14px; align-content: start; overscroll-behavior: contain; }
.inv-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.inv-seg button { gap: 8px; padding: 0 16px; }
.inv-seg button .ico { color: var(--muted); transition: color var(--dur) ease; }
.inv-seg button.active .ico { color: var(--accent); }
.inv-tn { min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--radius-pill); display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 750; background: var(--warn-soft); color: var(--warn); }
.inv-demo { margin-left: auto; background: rgba(255, 255, 255, .05); color: var(--muted); font-weight: 650; }
.inv-body { display: grid; gap: 14px; align-content: start; min-width: 0; animation: fadein .2s var(--ease-out); }
.inv-hint { margin: -2px 2px 0; max-width: 80ch; }
.inv-foot { text-align: center; padding-top: 4px; }
.inv-empty, .inv-none { display: grid; justify-items: center; gap: 10px; padding: 40px 12px; color: var(--muted); text-align: center; }
.inv-empty { height: 100%; align-content: center; }
.inv-none .ico, .inv-empty .ico { width: 56px; height: 56px; padding: 15px; box-sizing: border-box; border-radius: 50%; background: var(--moka-2); box-shadow: var(--rim); }
.inv-allok { display: flex; align-items: center; gap: 16px; padding: 22px 24px; border-radius: 24px; background: radial-gradient(120% 160% at 0% 0%, rgba(86, 183, 131, .16), rgba(86, 183, 131, 0) 60%), var(--moka); box-shadow: inset 0 0 0 1px rgba(86, 183, 131, .25); }
.inv-allok > .ico { width: 52px; height: 52px; padding: 13px; box-sizing: border-box; border-radius: 50%; background: var(--ok-soft); color: var(--ok); flex: none; }
.inv-allok div { display: grid; gap: 2px; }
.inv-allok strong { font: 700 18px/1.2 var(--font-display); letter-spacing: -.015em; }

/* Chiffres clés */
.inv-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.inv-kpi { display: grid; gap: 2px; padding: 14px 18px; border-radius: 20px; background: var(--card-grad), var(--moka); box-shadow: var(--rim); min-width: 0; }
.inv-kpi span { font-size: 12px; font-weight: 650; color: var(--muted); }
.inv-kpi strong { font: 750 26px/1.1 var(--font-display); letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-kpi small { color: var(--muted); font-size: 12px; }
.inv-kpi.warn { background: linear-gradient(150deg, rgba(231, 172, 85, .16), rgba(231, 172, 85, 0) 70%), var(--moka); box-shadow: inset 0 0 0 1px rgba(231, 172, 85, .3); }
.inv-kpi.warn strong { color: var(--warn); }
.inv-kpi.danger { background: linear-gradient(150deg, rgba(232, 102, 79, .16), rgba(232, 102, 79, 0) 70%), var(--moka); box-shadow: inset 0 0 0 1px rgba(232, 102, 79, .3); }
.inv-kpi.danger strong { color: var(--danger); }
.inv-kpi.accent { background: radial-gradient(120% 160% at 0% 0%, rgba(200, 129, 74, .28), rgba(200, 129, 74, 0) 65%), var(--moka); box-shadow: inset 0 0 0 1px rgba(200, 129, 74, .3); }
.inv-kpi.accent strong { color: var(--crema); }

/* Outils : recherche, filtre, actions */
.inv-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inv-search { flex: 1 1 240px; max-width: 420px; }
.inv-search .input { min-height: 44px; }
.inv-filter button { min-height: 38px; }
.inv-tools .btn { min-height: 44px; }

/* Ingrédients */
.inv-list { display: grid; gap: 6px; }
.irow { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(90px, 1fr) 130px 82px; gap: 16px; align-items: center; min-height: 60px; padding: 8px 16px; border-radius: 18px; background: var(--moka); box-shadow: var(--rim); transition: background-color var(--dur) ease; }
.irow.own { grid-template-columns: minmax(0, 1.4fr) minmax(80px, .9fr) 120px 78px 150px 154px; }
.irow:not(.ir-head):hover { background: var(--moka-2); }
.ir-head { min-height: 0; padding: 0 16px 2px; background: none; box-shadow: none; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.ir-name, .ir-qty, .ir-cost { display: grid; min-width: 0; line-height: 1.3; }
.ir-name b { font-weight: 650; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ir-name small, .ir-qty small, .ir-cost small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ir-qty b { font-weight: 750; font-size: 15px; letter-spacing: -.015em; white-space: nowrap; }
.ir-cost b { font-weight: 650; font-size: 14px; white-space: nowrap; }
.ir-level { position: relative; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .07); }
.ir-level i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--ok); opacity: .8; transition: width var(--dur) var(--ease-out); }
.ir-level em { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; border-radius: 2px; background: rgba(255, 255, 255, .28); }
.ir-low .ir-level i { background: var(--warn); opacity: 1; }
.ir-out .ir-level i { background: var(--danger); opacity: 1; }
.ir-low .ir-qty b { color: var(--warn); }
.ir-out .ir-qty b { color: var(--danger); }
.irow > .badge { justify-self: start; }
.ir-acts { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.ir-acts .btn { gap: 6px; }
.ir-acts .icon-btn { color: var(--ink-2); }

/* Achats */
.buy-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.inv-card { display: grid; gap: 14px; padding: 20px 22px; border-radius: 24px; background: var(--card-grad), var(--moka); box-shadow: var(--rim); min-width: 0; }
.ic-head { display: grid; gap: 3px; }
.ic-head h3 { display: flex; align-items: center; gap: 8px; font: 700 17px/1.2 var(--font-display); letter-spacing: -.015em; }
.ic-head h3 .ico { color: var(--accent); }
.inv-card .input, .stk-form .input { background: rgba(0, 0, 0, .25); border: 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); border-radius: 14px; min-height: 46px; }
.inv-card .input:focus, .stk-form .input:focus { box-shadow: var(--focus); }
.inv-card select.input:disabled { opacity: .45; }
.buy-fill { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; border-radius: 16px; text-align: left; font-weight: 650; font-size: 14px; color: var(--crema); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(200, 129, 74, .35); transition: background-color var(--dur) ease, transform var(--dur-fast) var(--ease-out); }
.buy-fill span { flex: 1; min-width: 0; }
.buy-fill:hover { background: rgba(200, 129, 74, .24); }
.buy-fill:active { transform: scale(.985); }
.bl-list { display: grid; gap: 10px; }
.bl { display: grid; grid-template-columns: minmax(0, 1.3fr) 70px minmax(112px, .9fr) 128px 44px; gap: 8px; align-items: center; animation: fadein .2s var(--ease-out); }
.bl .bl-n { text-align: right; }
.bl-t { gap: 6px; }
.bl-t .input { width: 100%; min-width: 0; text-align: right; padding: 8px 12px; }
.bl-del { color: var(--muted); }
.bl-del:disabled { opacity: .25; }
.bl-hint { grid-column: 1 / -1; margin-top: -2px; padding-left: 4px; color: var(--muted); font-size: 12px; }
.bl-add { justify-self: start; gap: 6px; }
.buy-src { width: 100%; }
.buy-src button { min-height: 42px; }
.buy-src-hint { font-size: 12.5px; }
.buy-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding-top: 14px; box-shadow: inset 0 1px 0 var(--line); }
.buy-total { display: grid; }
.buy-total span { font-size: 11.5px; font-weight: 650; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--muted); }
.buy-total strong { font: 750 30px/1.1 var(--font-display); letter-spacing: -.035em; color: var(--crema); }
.buy-foot .btn-lg { min-height: 54px; }
.buy-hist { position: sticky; top: 0; }
.bh-list { display: grid; gap: 4px; max-height: calc(100dvh - 300px); overflow-y: auto; overscroll-behavior: contain; margin: 0 -6px; padding: 0 6px; }
.bh-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; grid-template-areas: "main amt amt amt" "when src demo demo"; gap: 4px 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .03); }
.bh-main { grid-area: main; display: grid; min-width: 0; line-height: 1.3; }
.bh-main b { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bh-main small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bh-when { grid-area: when; font-size: 12px; color: var(--muted); white-space: nowrap; }
.bh-row .src { grid-area: src; justify-self: end; }
.bh-amt { grid-area: amt; justify-self: end; font-weight: 750; font-size: 14.5px; white-space: nowrap; }
.bh-row > :last-child { grid-area: demo; justify-self: end; }
.bh-demo { height: 20px; padding: 0 7px; font-size: 10.5px; background: rgba(255, 255, 255, .06); color: var(--muted); }
.src { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 700; white-space: nowrap; background: rgba(255, 255, 255, .06); color: var(--ink-2); }
.src-till { background: var(--warn-soft); color: var(--warn); }
.src-bank { background: rgba(159, 180, 214, .13); color: #b4c6e2; }
.src-pocket { background: var(--accent-soft); color: var(--crema); }
.src-credit { background: rgba(232, 102, 79, .12); color: #f0a08f; }

/* Fournisseurs */
.sup-sum { display: flex; align-items: baseline; gap: 12px; padding: 10px 18px; border-radius: var(--radius-pill); background: var(--moka); box-shadow: var(--rim); }
.sup-sum span { font-size: 13px; color: var(--muted); font-weight: 600; }
.sup-sum strong { font: 750 20px/1 var(--font-display); letter-spacing: -.025em; color: var(--crema); }
.sup-grid, .sl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.sup-card, .sl-card { display: grid; gap: 12px; padding: 18px; border-radius: 24px; background: var(--card-grad), var(--moka); box-shadow: var(--rim); min-width: 0; animation: fadein .2s var(--ease-out); }
.sup-top, .sl-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sup-av { width: 44px; height: 44px; flex: none; border-radius: 30%; display: grid; place-items: center; font: 700 18px/1 var(--font-display); color: var(--crema); background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .1), transparent 60%), var(--accent-soft); }
.sup-id, .sl-head > div { display: grid; gap: 1px; min-width: 0; flex: 1; line-height: 1.3; }
.sup-id b, .sl-head b { font-weight: 700; font-size: 15.5px; letter-spacing: -.012em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sup-ph { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); font-size: 13px; text-decoration: none; }
.sup-ph:hover { color: var(--crema); }
.sup-note { margin-top: -4px; }
.sup-ings { display: flex; flex-wrap: wrap; gap: 6px; }
.sup-ings span { height: 26px; padding: 0 10px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--ink-2); background: rgba(255, 255, 255, .05); }
.sup-ings span.low { background: var(--warn-soft); color: var(--warn); }
.sup-ings span.none { background: none; color: var(--muted); padding: 0; font-weight: 500; }
.sup-bal { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; align-items: baseline; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, .035); }
.sup-bal span { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.sup-bal strong { grid-row: span 2; font: 750 22px/1 var(--font-display); letter-spacing: -.03em; align-self: center; }
.sup-bal small { color: var(--muted); font-size: 12px; }
.sup-bal.due { background: var(--warn-soft); box-shadow: inset 0 0 0 1px rgba(231, 172, 85, .28); }
.sup-bal.due span, .sup-bal.due strong { color: var(--warn); }
.sup-bal.adv strong { color: var(--ok); }
.sup-acts, .sl-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.sup-acts .btn, .sl-acts .btn { gap: 6px; }
.sl-acts .btn { flex: 1 1 auto; justify-content: center; }

/* Liste de courses */
.sl-items { display: grid; }
.sl-it { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; box-shadow: inset 0 -1px 0 var(--line); }
.sl-it:last-child { box-shadow: none; }
.sl-it > div { display: grid; min-width: 0; line-height: 1.3; }
.sl-it b { font-weight: 650; font-size: 14.5px; }
.sl-it small { color: var(--muted); font-size: 12px; }
.sl-it small.neg { color: var(--danger); }
.sl-it strong { font-weight: 750; font-size: 14.5px; color: var(--crema); white-space: nowrap; text-align: right; }
.btn-wa { background: rgba(37, 211, 102, .14); color: #6be39a; box-shadow: inset 0 0 0 1px rgba(37, 211, 102, .3); text-decoration: none; }
.btn-wa:hover { background: rgba(37, 211, 102, .22); }

/* Règles d'options */
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.opt-card { display: grid; gap: 6px; padding: 16px; border-radius: 24px; background: var(--card-grad), var(--moka); box-shadow: var(--rim); }
.opt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 4px 6px; }
.opt-head b { font: 700 16px/1.2 var(--font-display); letter-spacing: -.015em; }
.opt-head small { font-size: 12px; }
.opt-row { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 14px; border-radius: 14px; text-align: left; background: rgba(255, 255, 255, .03); color: var(--muted); transition: background-color var(--dur) ease, transform var(--dur-fast) var(--ease-out); }
.opt-row > span { flex: 1; display: grid; min-width: 0; line-height: 1.3; }
.opt-row b { font-weight: 650; font-size: 14px; color: var(--ink); }
.opt-row small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.opt-row:hover { background: rgba(255, 255, 255, .06); }
.opt-row:active { transform: scale(.985); }
.opt-row.has { background: linear-gradient(90deg, rgba(200, 129, 74, .14), rgba(200, 129, 74, .03)); box-shadow: inset 2px 0 0 var(--accent); }
.opt-row.has small { color: var(--crema); }

/* Fenêtres */
.stk-layer .layer-panel { width: min(640px, 100%); }
.stk-form { display: grid; gap: 14px; }
.stk-form .field { align-content: start; }
.stk-form .field > span small { font-weight: 500; }
.stk-form .field > small { margin-top: -3px; }
.stk-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stk-form .price-input .input { width: 100%; flex: 1; min-width: 0; text-align: right; }
.stk-big .input { min-height: 58px; font: 750 24px/1 var(--font-display); letter-spacing: -.03em; }
.stk-form .seg { width: 100%; }
.stk-form .seg.seg-inline { width: auto; }
.stk-warn { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: var(--warn-soft); color: var(--warn); font-size: 13.5px; }
.stk-warn span { color: var(--ink); }
.stk-warn b { color: var(--warn); }
.stk-warn .ico { flex: none; margin-top: 1px; }
.cor-now { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 16px; background: rgba(255, 255, 255, .04); }
.cor-now span { font-size: 13px; font-weight: 600; color: var(--muted); }
.cor-now strong { font: 750 20px/1 var(--font-display); letter-spacing: -.025em; }
.cor-in { display: flex; gap: 10px; align-items: center; }
.cor-in .input { flex: 1; min-width: 0; text-align: right; font: 750 22px/1 var(--font-display); letter-spacing: -.02em; min-height: 54px; }
.cor-delta { display: grid; gap: 2px; padding: 14px 16px; border-radius: 18px; transition: background-color var(--dur) ease, color var(--dur) ease; }
.cor-delta span { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.cor-delta strong { font: 750 22px/1.15 var(--font-display); letter-spacing: -.025em; }
.cor-delta small { font-size: 12.5px; opacity: .85; }
.cor-delta.neg { background: var(--danger-soft); color: var(--danger); }
.cor-delta.pos { background: var(--ok-soft); color: var(--ok); }
.cor-delta.zero, .cor-delta.idle { background: rgba(255, 255, 255, .04); color: var(--muted); }
.cor-moves { display: grid; }
.cor-moves h4 { font-family: var(--font); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.cm-mv { display: grid; grid-template-columns: minmax(0, 1fr) auto 110px; gap: 10px; align-items: center; min-height: 38px; font-size: 13.5px; box-shadow: inset 0 -1px 0 var(--line); }
.cm-mv:last-child { box-shadow: none; }
.cm-mv span { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-mv small { color: var(--muted); font-size: 12px; }
.cm-mv b { text-align: right; font-weight: 700; }
.cm-mv b.neg { color: var(--ink-2); }
.cm-mv b.pos { color: var(--ok); }
.rule-rep { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; }
.rule-arrow { color: var(--accent); font-weight: 700; font-size: 18px; }
.rule-add { display: grid; grid-template-columns: minmax(0, 1fr) 150px 44px; gap: 8px; align-items: center; }
.stk-layer .pe-set .btn-sm { gap: 6px; }

@media (max-width: 1100px) {
  .irow.own { grid-template-columns: minmax(0, 1.3fr) 110px 74px 130px 96px; }
  .irow.own .ir-level, .ir-head.own > span:nth-child(2) { display: none; }
  .buy-grid { grid-template-columns: minmax(0, 1fr); }
  .buy-hist { position: static; }
  .bh-list { max-height: none; }
  .ir-acts .btn span { display: none; }
  .ir-acts .btn { width: 44px; padding: 0; justify-content: center; }
}
@media (max-width: 960px) {
  .inv { padding: 14px 14px 24px; gap: 12px; }
  .inv-seg button { padding: 0 11px; gap: 6px; }
  .inv-seg button span { font-size: 13px; }
  .irow { grid-template-columns: minmax(0, 1fr) 110px 74px; }
  .irow .ir-level, .ir-head > span:nth-child(2) { display: none; }
  .irow.own { grid-template-columns: minmax(0, 1fr) 104px 70px 96px; }
  .irow.own .ir-cost, .ir-head.own > span:nth-child(5) { display: none; }
  .bl { grid-template-columns: minmax(0, 1fr) 70px 90px; }
  .bl .bl-t { grid-column: 1 / 3; }
  .stk-two { grid-template-columns: minmax(0, 1fr); }
}
