/* SmartPOS Manager - orange fonce / gris anthracite / noir / blanc. Doux et professionnel. */
:root {
  --bg: #F5F4F2; --surface: #FFFFFF; --surface-2: #EFEDEA;
  --ink: #1B1C1F; --ink-2: #44474E; --muted: #6B6F76; --border: #E4E1DC;
  --black: #0E0E10; --charcoal: #26282C; --charcoal-2: #34373C;
  --orange: #C2410C; --orange-d: #9A3412; --orange-l: #FFEDE0; --orange-m: #F3C4A4;
  --ok: #1F7A5A; --ok-l: #E3F4EC; --warn: #B45309; --warn-l: #FEF0D9; --err: #B42318; --err-l: #FDE7E4;
  --r: 14px; --r-sm: 10px;
  --shadow: 0 1px 2px rgba(20,20,20,.04), 0 6px 20px rgba(20,20,20,.05);
  --f-head: 'Lexend', system-ui, sans-serif; --f-body: 'Source Sans 3', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 16px; } html, body { max-width: 100%; overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--f-head); margin: 0; letter-spacing: -.01em; color: var(--black); }
h1 { font-size: 1.6rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
a { color: var(--orange-d); text-decoration: none; }
a:hover { text-decoration: underline; }
.num, td.r, th.r { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .r { text-align: right; } .nowrap { white-space: nowrap; }
:focus-visible { outline: 3px solid var(--orange-m); outline-offset: 2px; border-radius: 6px; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 252px; background: var(--charcoal); color: #D8D9DC; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 18px; }
.brand strong { display: block; font-family: var(--f-head); color: #fff; font-size: 1.05rem; line-height: 1.1; }
.brand small { color: #9A9DA3; font-size: .78rem; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--orange); color: #fff; display: grid; place-items: center; font: 700 1.2rem var(--f-head); }
.nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: #85888F; padding: 16px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: #D8D9DC; font-weight: 500; min-height: 44px; transition: background .18s, color .18s; }
.nav-item:hover { background: var(--charcoal-2); text-decoration: none; color: #fff; }
.nav-item.active { background: var(--orange); color: #fff; }
.nav-item.logout { margin-top: auto; color: #B8BABF; }
.main { flex: 1; min-width: 0; max-width: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 0 16px; color: var(--muted); }
.search input { border: 0; background: transparent; padding: 11px 0; flex: 1; font: inherit; color: var(--ink); outline: none; min-width: 0; }
.search:focus-within { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-l); }
.profile { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.profile strong { display: block; font-size: .92rem; line-height: 1.2; } .profile small { color: var(--muted); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--black); color: #fff; display: grid; place-items: center; font: 600 .85rem var(--f-head); }
.content { padding: 28px; max-width: 1500px; width: 100%; margin: 0 auto; }
.menu-btn { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- Composants ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.g-main { grid-template-columns: 2fr 1fr; }
.stat { padding: 18px 20px; } .stat .label { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: 8px; }
.stat .value { font: 600 1.55rem var(--f-head); margin-top: 6px; color: var(--black); font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.stat.dark { background: var(--charcoal); border-color: var(--charcoal); } .stat.dark .label, .stat.dark .sub { color: #B9BBC0; } .stat.dark .value { color: #fff; }
.stat.accent { background: var(--orange); border-color: var(--orange); } .stat.accent .label, .stat.accent .sub { color: #FFE3D1; } .stat.accent .value { color: #fff; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 11px; border: 1px solid transparent; font: 600 .95rem var(--f-body); cursor: pointer; background: var(--orange); color: #fff; transition: background .18s, transform .1s, box-shadow .18s; }
.btn:hover { background: var(--orange-d); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-dark { background: var(--black); } .btn-dark:hover { background: var(--charcoal); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border); } .btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--orange-l); color: var(--orange-d); } .btn-soft:hover { background: var(--orange-m); }
.btn-danger { background: var(--surface); color: var(--err); border-color: #F1C4BF; } .btn-danger:hover { background: var(--err-l); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .85rem; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--border); background: var(--surface); border-radius: 11px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600; }
.chip-ok { background: var(--ok-l); color: var(--ok); } .chip-warn { background: var(--warn-l); color: var(--warn); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-l); color: var(--ok); } .badge.warn { background: var(--warn-l); color: var(--warn); } .badge.err { background: var(--err-l); color: var(--err); } .badge.orange { background: var(--orange-l); color: var(--orange-d); } .badge.dark { background: var(--black); color: #fff; }
.alert { padding: 12px 16px; border-radius: var(--r-sm); margin-bottom: 16px; font-weight: 500; border: 1px solid; }
.alert-ok { background: var(--ok-l); color: var(--ok); border-color: #BFE3D2; } .alert-err { background: var(--err-l); color: var(--err); border-color: #F1C4BF; } .alert-warn { background: var(--warn-l); color: var(--warn); border-color: #F5D9A8; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th { text-align: left; font: 600 .76rem var(--f-head); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid #F0EEEA; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FBFAF8; }
.neg { color: var(--err); } .pos-c { color: var(--ok); }

/* ---------- Formulaires ---------- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--ink-2); }
input[type=text], input[type=number], input[type=password], input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 11px; background: #fff; font: inherit; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-l); }
.field { margin-bottom: 14px; } .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; } .form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 18px; } .filters .field { margin: 0; min-width: 150px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; } .check input { width: 20px; height: 20px; accent-color: var(--orange); }
.tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: 12px; width: fit-content; margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 8px 16px; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: .9rem; } .tabs a.on { background: var(--surface); color: var(--orange-d); box-shadow: var(--shadow); } .tabs a:hover { text-decoration: none; }

/* ---------- POS ---------- */
.pos > * { min-width: 0; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 20px; align-items: start; }
.pos-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-height: 128px; transition: border-color .15s, box-shadow .15s, transform .1s; font: inherit; color: inherit; }
.pcard:hover { border-color: var(--orange); box-shadow: 0 6px 18px rgba(194,65,12,.12); } .pcard:active { transform: scale(.98); }
.pcard .pn { font-weight: 600; line-height: 1.25; } .pcard .pp { font: 600 1.05rem var(--f-head); color: var(--orange-d); margin-top: auto; } .pcard .ps { font-size: .78rem; color: var(--muted); }
.pcard.out { opacity: .5; pointer-events: none; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; }
.cat { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: .88rem; cursor: pointer; white-space: nowrap; color: var(--ink-2); min-height: 40px; }
.cat.on { background: var(--black); color: #fff; border-color: var(--black); }
.cart { position: sticky; top: 84px; display: flex; flex-direction: column; max-height: calc(100vh - 104px); }
.cart-lines { overflow-y: auto; flex: 1; min-height: 80px; margin: 0 -4px; padding: 0 4px; }
.cl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.cl .qty { display: flex; align-items: center; gap: 6px; }
.qty button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700; }
.qty span { min-width: 26px; text-align: center; font-weight: 600; }
.totals { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; }
.totals .row { display: flex; justify-content: space-between; padding: 3px 0; color: var(--ink-2); }
.totals .row.big { font: 700 1.35rem var(--f-head); color: var(--black); padding-top: 8px; }
.pay-line { display: grid; grid-template-columns: 1.1fr 1fr auto; gap: 8px; margin-bottom: 10px; } .pay-line .pay-note { grid-column: 1 / -1; min-height: 38px; font-size: .9rem; }

/* ---------- Recu ---------- */
.receipt { max-width: 420px; margin: 0 auto; background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.receipt .rh { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--border); padding-bottom: 14px; margin-bottom: 14px; }
.receipt .brand-o { color: var(--orange); font: 700 1.2rem var(--f-head); }
.receipt .row { display: flex; justify-content: space-between; padding: 4px 0; gap: 10px; }
.receipt .total { background: var(--orange-l); border-radius: 12px; padding: 12px 14px; margin-top: 12px; font: 700 1.2rem var(--f-head); color: var(--orange-d); display: flex; justify-content: space-between; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--black); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; background-image: radial-gradient(circle at 85% 15%, rgba(194,65,12,.55), transparent 45%), radial-gradient(circle at 10% 95%, rgba(194,65,12,.25), transparent 40%); }
.login-art h1 { color: #fff; font-size: 2.3rem; max-width: 14ch; line-height: 1.15; } .login-art p { color: #C9CBD0; max-width: 42ch; }
.login-art ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; color: #E6E7EA; } .login-art li::before { content: ''; display: inline-block; width: 8px; height: 8px; background: var(--orange); border-radius: 50%; margin-right: 12px; }
.login-form { display: grid; place-items: center; padding: 32px; background: var(--bg); }
.login-form .card { width: 100%; max-width: 400px; padding: 32px; }

.legend-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.legend-bar span { display: block; height: 100%; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; font-size: .72rem; color: var(--muted); }
.bars .b i { display: block; width: 100%; max-width: 44px; background: var(--orange); border-radius: 8px 8px 3px 3px; min-height: 3px; }
.bars .b.zero i { background: var(--surface-2); }

dialog { border: 0; border-radius: var(--r); padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: min(520px, 92vw); } dialog::backdrop { background: rgba(14,14,16,.55); }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g-main, .pos { grid-template-columns: 1fr; } .cart { position: static; max-height: none; } }
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 40; left: 0; transform: translateX(-102%); transition: transform .25s; box-shadow: 0 0 40px rgba(0,0,0,.35); } .sidebar.open { transform: none; }
  .menu-btn { display: grid; } .topbar { padding: 10px 16px; gap: 10px; } .profile div { display: none; } .content { padding: 18px 16px; }
  .g2, .g3, .form-grid { grid-template-columns: 1fr; } .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; }
  .topbar .search { display: none; }
  .cart-foot { position: sticky; bottom: 0; }
}
@media (max-width: 520px) { .g4 { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .sidebar, .topbar, .no-print, .alert { display: none !important; } body { background: #fff; } .content { padding: 0; }
  .receipt { border: 0; box-shadow: none; max-width: 100%; }
}

/* ---------- Caisse : pied de panier stable ---------- */
.cart, .cart * { max-width: 100%; }
.cart input, .cart select { min-width: 0; }
.cart-foot { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); margin: 14px -20px -20px; padding: 12px 20px; border-radius: 0 0 var(--r) var(--r); z-index: 5; }
.cart-foot-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.cart-foot-total { font: 700 1.3rem var(--f-head); color: var(--black); }
.cart-foot .btn { flex: 1; max-width: 220px; min-height: 48px; }
@media (max-width: 1100px) { .cart { overflow: visible; } .cart-foot { position: sticky; bottom: 0; box-shadow: 0 -8px 20px rgba(20,20,20,.06); } }

/* ---------- Hors ligne ---------- */
.qrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #F0EEEA; flex-wrap: wrap; } .qrow:last-child { border-bottom: 0; }
.chip-err { background: var(--err-l); color: var(--err); }
#syncchip { white-space: nowrap; }

.approve { margin-top: 12px; padding: 12px; border: 1px dashed var(--orange-m); border-radius: 12px; background: var(--orange-l); }
.approve p { margin: 0 0 8px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #F0EEEA; } .kv:last-child { border-bottom: 0; }

/* ---------- Promotions & tickets thermiques ---------- */
.promo-old { color: var(--muted); font-weight: 400; font-size: .85em; } .promo-lbl { color: var(--orange-d); font-weight: 600; } .promo-hint { font-size: .75rem; color: var(--orange-d); font-weight: 600; }
.receipt.fmt-80 { max-width: 80mm; padding: 10px 12px; border-radius: 6px; font-size: .86rem; }
.receipt.fmt-58 { max-width: 58mm; padding: 8px 8px; border-radius: 6px; font-size: .78rem; } .receipt.fmt-58 .total { font-size: 1rem; }
.receipt.fmt-a4 { max-width: 720px; }
@media print { .receipt.fmt-80, .receipt.fmt-58 { max-width: 100%; padding: 0; border-radius: 0; } body { margin: 0; } }
