:root {
  --bg: #f5f6f8; --panel: #ffffff; --ink: #1d2433; --muted: #6b7385; --line: #e3e6ec; --accent: #2f4fd8; --accent-ink: #fff;
  --ok: #1f8a4c; --warn: #b56a00; --bad: #c62828; --radius: 10px; --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 4px 16px rgba(20, 30, 60, .05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; word-break: break-all; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; background: #eef0f5; padding: 1px 5px; border-radius: 4px; }
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: #141b2d; color: #c9cfdc; padding: 18px 12px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { color: #c9cfdc; padding: 8px 10px; border-radius: 8px; }
.side nav a:hover { background: #1f2840; text-decoration: none; }
.side nav a.on { background: #2a3556; color: #fff; }
.side .nav-pos { background: var(--accent); color: #fff !important; font-weight: 600; text-align: center; margin-bottom: 8px; }
.nav-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #7d879e; margin: 12px 10px 4px; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 1.05rem; }
.brand.big { color: var(--ink); font-size: 1.3rem; margin-bottom: 14px; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; font-size: .8rem; font-weight: 800; }
.me { margin-top: auto; border-top: 1px solid #2a3348; padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.me a { color: #fff; } .me small { color: #7d879e; }
.main { padding: 24px 32px 60px; max-width: 1400px; }
.top { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; }
.top > :not(h1) { display: flex; gap: 8px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
table.panel { padding: 0; width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfc; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
tr.cancelled td { color: var(--muted); text-decoration: line-through; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; align-items: start; }
.row2, .row3 { display: grid; gap: 12px; } .row2 { grid-template-columns: 1fr 1fr; } .row3 { grid-template-columns: 1fr 1fr 1fr; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: #39404f; }
label.check, label.chip { flex-direction: row; align-items: center; gap: 8px; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid #cfd4de; border-radius: 8px; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b8c5ff; border-color: var(--accent); }
input[type="color"] { padding: 2px; width: 44px; height: 38px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 9px 14px; border-radius: 8px; border: 1px solid #cfd4de; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none !important; }
.btn:hover { background: #f1f3f7; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #2441c0; }
.btn.danger { color: var(--bad); border-color: #f0c4c4; }
.btn.small { padding: 5px 9px; font-size: .82rem; }
.btn.ghost { border-style: dashed; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
button.link { background: none; border: 0; color: #9aa3b8; padding: 0; cursor: pointer; font: inherit; text-align: left; }
.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.flash.ok { background: #e7f6ed; color: #145c33; border: 1px solid #bfe5cd; }
.flash.error { background: #fdecec; color: #8e1c1c; border: 1px solid #f5c2c2; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; background: #eef0f5; color: #3b4254; font-weight: 600; }
.tag.ok { background: #e3f4ea; color: var(--ok); } .tag.warn { background: #fff2dc; color: var(--warn); } .tag.bad { background: #fde7e7; color: var(--bad); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: #ccc; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.kpi span { color: var(--muted); font-size: .85rem; } .kpi strong { font-size: 1.5rem; } .kpi small { color: var(--muted); }
.kpi-line { display: flex; gap: 22px; flex-wrap: wrap; } .kpi-line strong { font-size: 1.15rem; margin-left: 4px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input:not([type="checkbox"]) { min-width: 220px; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; background: #f1f3f9; border: 1px dashed #b9c1d6; padding: 12px; border-radius: 8px; font-size: 1.05rem; word-break: break-all; }
.codes { columns: 2; font-size: 1.05rem; }
.activities { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.choice { border: 1px solid var(--line); border-radius: 8px; padding: 10px; flex-direction: row; align-items: flex-start; gap: 8px; }
.choice small { display: block; color: var(--muted); }
.mapping { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 12px; }
.denoms { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.approval { border: 1px dashed #d0d5e0; border-radius: 8px; padding: 8px 12px; }
.approval summary { cursor: pointer; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; border-bottom: 1px solid var(--line); }
.bar { flex: 1; background: #c7d1fb; border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bar span { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: .7rem; color: var(--muted); }
.actions { display: flex; gap: 10px; }
.wide { max-width: 1100px; } .narrow-panel { max-width: 560px; }
.card-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.card { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 28px; width: 100%; }
.card.narrow { max-width: 440px; } .card h1 { margin-bottom: 14px; }
.who { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; cursor: pointer; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { font-size: 1.3rem; padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: #fafbfc; cursor: pointer; }
.pin { font-size: 1.5rem; letter-spacing: .4em; text-align: center; }

/* ---- Écran de caisse ---- */
body.pos { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
body.pos.training { background: repeating-linear-gradient(45deg, #fff8e6, #fff8e6 20px, #fff2cc 20px, #fff2cc 40px); }
.pos-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #141b2d; color: #fff; }
.pos-top .brand { color: #fff; }
.banner { background: #ffb300; color: #3a2600; font-weight: 800; padding: 4px 10px; border-radius: 6px; }
.pos-user { margin-left: auto; color: #c9cfdc; }
.pos-nav { display: flex; gap: 6px; }
.pos-nav .btn { padding: 7px 11px; }
.pos-main { flex: 1; display: grid; grid-template-columns: 1fr 420px; min-height: 0; }
.pos-left { padding: 14px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.pos-search { position: relative; }
.pos-search input { width: 100%; font-size: 1.1rem; padding: 13px 15px; }
.results { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 5; max-height: 360px; overflow-y: auto; }
.results button { display: flex; justify-content: space-between; width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; text-align: left; }
.results button:hover, .results button.sel { background: #eef2ff; }
.cats { display: flex; gap: 8px; flex-wrap: wrap; }
.cats button { border: 0; border-radius: 8px; padding: 10px 14px; color: #fff; font: inherit; font-weight: 700; cursor: pointer; background: #5b6479; }
.cats button.on { outline: 3px solid #141b2d; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; overflow-y: auto; align-content: start; padding-bottom: 20px; }
.tile { background: #fff; border: 1px solid var(--line); border-left: 6px solid #5b6479; border-radius: 10px; padding: 12px; min-height: 92px; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; font: inherit; text-align: left; box-shadow: var(--shadow); }
.tile:hover { border-color: var(--accent); }
.tile strong { font-size: .95rem; } .tile .price { font-weight: 700; } .tile small { color: var(--muted); }
.tile.out { opacity: .55; }
.pos-right { background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px; gap: 10px; min-height: 0; }
.ticket-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lines { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; border-top: 1px solid var(--line); }
.lines li { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.lines .qty { display: flex; gap: 4px; align-items: center; }
.lines .qty button { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line); background: #fafbfc; font-size: 1.1rem; cursor: pointer; }
.lines .amount { text-align: right; font-weight: 700; }
.lines .empty { color: var(--muted); text-align: center; padding: 40px 0; display: block; }
.ticket-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ticket-tools .btn { padding: 9px 4px; font-size: .85rem; }
.totals > div { display: flex; justify-content: space-between; color: var(--muted); }
.totals .big { font-size: 1.6rem; color: var(--ink); font-weight: 800; }
.btn.pay { font-size: 1.3rem; padding: 18px; background: var(--ok); color: #fff; border: 0; }
.btn.pay:hover { background: #18703d; }
dialog { border: 0; border-radius: 14px; padding: 22px; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(15, 20, 35, .45); }
#dlg-body { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 16px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }
.methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.methods button { padding: 14px; font: inherit; font-weight: 700; border-radius: 10px; border: 1px solid var(--line); background: #fafbfc; cursor: pointer; }
.methods button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.paylist { list-style: none; padding: 0; margin: 0; }
.paylist li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.due { font-size: 1.4rem; font-weight: 800; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #141b2d; color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 20; max-width: 90vw; }
.toast.error { background: var(--bad); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; }
  .main { padding: 16px; } .grid2 { grid-template-columns: 1fr; } .row2, .row3 { grid-template-columns: 1fr; }
  body.pos { overflow: auto; height: auto; } .pos-main { grid-template-columns: 1fr; } .pos-right { border-left: 0; }
  .denoms { grid-template-columns: repeat(3, 1fr); } .pos-nav { flex-wrap: wrap; }
}
@media print { .side, .top .btn, .filters { display: none; } .shell { display: block; } }
