/* HOSANNA SHOP — interface sobre : couleurs plates, peu d'effets */
:root {
  --navy: #13213F; --navy-2: #1E3158; --gold: #B8913A;
  --ink: #1C2333; --muted: #6A7287; --line: #E4E7ED; --bg: #F5F6F8; --soft: #F0F2F5;
  --ok: #1B7F47; --warn: #B7700B; --bad: #B83227;
  --radius: 8px;
  --bs-primary: #13213F; --bs-primary-rgb: 19, 33, 63;
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
body { background: var(--bg); color: var(--ink); font-size: .92rem; -webkit-tap-highlight-color: transparent; }
a { color: var(--navy-2); }
.app { display: flex; min-height: 100vh; }

/* Barre latérale */
.sidebar { width: 236px; flex: 0 0 236px; background: #fff; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 1040; }
.sidebar .brand { display: block; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.sidebar .brand img { width: 100%; max-height: 52px; object-fit: contain; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 10px 4px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; padding: 8px 10px; border-radius: 6px; font-size: .9rem; }
.nav-item i { font-size: 1rem; width: 18px; text-align: center; color: var(--muted); }
.nav-item:hover { background: var(--soft); color: var(--ink); }
.nav-item.active { background: var(--soft); color: var(--navy); font-weight: 600; box-shadow: inset 3px 0 0 var(--navy); }
.nav-item.active i { color: var(--navy); }
.nav-item .pill { margin-left: auto; background: var(--bad); color: #fff; font-size: .7rem; border-radius: 10px; padding: 0 6px; line-height: 1.5; }
.sidebar-foot { font-size: .72rem; color: var(--muted); padding: 10px 18px; border-top: 1px solid var(--line); }

/* Zone principale */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1030; min-height: 58px; }
.page-title { font-size: 1.1rem; font-weight: 600; margin: 0; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { padding: 20px 24px 40px; }
.btn-icon { width: 36px; height: 36px; border-radius: 6px; border: 1px solid var(--line); background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; color: var(--ink); }
.badge-dot { position: absolute; top: -5px; right: -6px; background: var(--bad); color: #fff; font-size: .65rem; border-radius: 9px; padding: 0 5px; font-weight: 600; }
.user-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 10px 3px 3px; font-size: .88rem; }
.avatar { width: 28px; height: 28px; border-radius: 4px; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 6px; font-size: .8rem; font-weight: 500; text-decoration: none; border: 1px solid; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.chip-ok { color: var(--ok); border-color: #CBE6D6; background: #F3FAF6; } .chip-ok .dot { background: var(--ok); }
.chip-off { color: var(--bad); border-color: #F0CDC9; background: #FDF5F4; } .chip-off .dot { background: var(--bad); }

/* Cartes */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.card-header { background: #fff; border-bottom: 1px solid var(--line); font-weight: 600; color: var(--ink); padding: 12px 16px; display: flex; align-items: center; gap: 8px; }
.card-header .bi { color: var(--muted); }
.card-footer { border-top: 1px solid var(--line); }
.kpi { --kc: #2563EB; --kbg: #EFF4FF; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--kc); border-radius: var(--radius); padding: 14px 16px; height: 100%; position: relative; }
.kpi .label { font-size: .78rem; color: var(--muted); font-weight: 500; padding-right: 46px; }
.kpi .value { font-size: 1.35rem; font-weight: 700; color: var(--ink); margin-top: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.kpi .ico { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; background: var(--kbg); color: var(--kc); }
/* Couleurs automatiques par position dans la rangée */
.row > :nth-child(6n+1) > .kpi, .row > :nth-child(6n+1) > a > .kpi { --kc: #2563EB; --kbg: #EFF4FF; }
.row > :nth-child(6n+2) > .kpi, .row > :nth-child(6n+2) > a > .kpi { --kc: #10B981; --kbg: #ECFDF5; }
.row > :nth-child(6n+3) > .kpi, .row > :nth-child(6n+3) > a > .kpi { --kc: #F59E0B; --kbg: #FFFBEB; }
.row > :nth-child(6n+4) > .kpi, .row > :nth-child(6n+4) > a > .kpi { --kc: #8B5CF6; --kbg: #F5F3FF; }
.row > :nth-child(6n+5) > .kpi, .row > :nth-child(6n+5) > a > .kpi { --kc: #06B6D4; --kbg: #ECFEFF; }
.row > :nth-child(6n+6) > .kpi, .row > :nth-child(6n+6) > a > .kpi { --kc: #EC4899; --kbg: #FDF2F8; }
/* Indicateur principal : carte pleine en couleur */
.kpi.dark { background: linear-gradient(135deg, #1D4ED8 0%, #2563EB 55%, #3B82F6 100%); border: 0; color: #fff; }
.kpi.dark .label, .kpi.dark .sub { color: rgba(255,255,255,.82); }
.kpi.dark .value { color: #fff; }
.kpi.dark .ico { background: rgba(255,255,255,.18); color: #fff; }
.kpi.dark .trend-up { color: #BBF7D0; } .kpi.dark .trend-down { color: #FECACA; }
.col-xl-2 .kpi .ico, .col-4 .kpi .ico { display: none; }
.col-xl-2 .kpi .label, .col-4 .kpi .label { padding-right: 0; }
.trend-up { color: var(--ok); font-weight: 600; } .trend-down { color: var(--bad); font-weight: 600; }

/* Tableaux */
.table { --bs-table-bg: transparent; margin: 0; }
.table thead th { font-size: .75rem; color: var(--muted); background: #FAFBFC; border-bottom: 1px solid var(--line); font-weight: 600; white-space: nowrap; }
.table td { vertical-align: middle; border-color: var(--line); }
.table-hover tbody tr:hover { background: #FAFBFC; }
.bc-inline svg { height: 46px; width: auto; display: block; }
.thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; background: var(--soft); padding: 1px 6px; border-radius: 4px; color: var(--ink); }
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Boutons & formulaires */
.btn { border-radius: 6px; font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--navy); --bs-btn-border-color: var(--navy); --bs-btn-hover-bg: var(--navy-2); --bs-btn-hover-border-color: var(--navy-2); --bs-btn-active-bg: var(--navy); --bs-btn-disabled-bg: var(--navy); }
.btn-outline-primary { --bs-btn-color: var(--navy); --bs-btn-border-color: #C5CBD6; --bs-btn-hover-bg: var(--navy); --bs-btn-hover-border-color: var(--navy); --bs-btn-active-bg: var(--navy); }
.btn-gold { background: var(--navy); color: #fff; border: 0; }
.btn-gold:hover { background: var(--navy-2); color: #fff; }
.form-control, .form-select { border-radius: 6px; border-color: #D3D8E0; }
.form-control:focus, .form-select:focus { border-color: var(--navy-2); box-shadow: 0 0 0 .15rem rgba(19,33,63,.12); }
.form-label { font-weight: 500; font-size: .83rem; color: #3B4357; margin-bottom: .3rem; }
.status { font-size: .74rem; font-weight: 500; padding: 2px 8px; border-radius: 4px; display: inline-block; white-space: nowrap; }
.st-ok { background: #E9F5EE; color: var(--ok); } .st-warn { background: #FBF2E3; color: var(--warn); } .st-bad { background: #FBECEA; color: var(--bad); } .st-info { background: #EAF0F8; color: #2B5A9A; } .st-mute { background: var(--soft); color: var(--muted); }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); } .empty i { font-size: 2rem; display: block; margin-bottom: 6px; opacity: .6; }
.insight { border-left: 3px solid var(--gold); background: #fff; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0 6px 6px 0; padding: 9px 12px; font-size: .87rem; margin-bottom: 8px; }
.insight.bad { border-left-color: var(--bad); } .insight.ok { border-left-color: var(--ok); }
.nav-pills .nav-link { color: var(--ink); } .nav-pills .nav-link.active { background: var(--navy); color: #fff; }
.nav-tabs .nav-link { color: var(--muted); } .nav-tabs .nav-link.active { color: var(--navy); font-weight: 600; }
.list-group-item.active { background: var(--navy); border-color: var(--navy); }

/* Point de vente */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; height: calc(100vh - 100px); }
.pos-left { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.pos-search { position: relative; }
.pos-search input { height: 48px; font-size: 1rem; padding-left: 42px; padding-right: 100px; }
.pos-search .bi-search { position: absolute; left: 15px; top: 13px; font-size: 1.05rem; color: var(--muted); }
.pos-search .actions { position: absolute; right: 6px; top: 6px; }
.cats { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 12px; font-size: .83rem; white-space: nowrap; color: var(--ink); }
.cats button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.grid-products { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-auto-rows: max-content; gap: 10px; align-content: start; padding-bottom: 10px; }
.pcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; position: relative; text-align: left; padding: 0; }
.pcard:hover { border-color: #AEB6C4; }
.pcard:active { transform: scale(.98); }
.pcard img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; background: var(--soft); }
.pcard .b { padding: 8px 10px 10px; }
.pcard .n { font-size: .82rem; line-height: 1.25; height: 2.5em; overflow: hidden; color: var(--ink); }
.pcard .p { font-weight: 700; color: var(--ink); margin-top: 4px; font-size: .9rem; }
.pcard .c { position: absolute; top: 6px; left: 6px; background: rgba(255,255,255,.92); color: var(--ink); font-size: .68rem; padding: 1px 6px; border-radius: 4px; font-family: ui-monospace, monospace; }
.pcard.off { opacity: .5; pointer-events: none; }
.pcard.off .p::after { content: ' · Indisponible'; color: var(--bad); font-weight: 500; font-size: .75rem; }
.cart { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; }
.cart-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.cart-lines { flex: 1; overflow-y: auto; padding: 0 12px; }
.cline { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cline .n { font-weight: 500; font-size: .86rem; } .cline .u { font-size: .76rem; color: var(--muted); }
.cline .t { font-weight: 600; text-align: right; }
.qtyb { justify-self: start; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.qtyb button { border: 0; background: var(--soft); width: 32px; height: 32px; font-weight: 600; }
.qtyb input { width: 48px; border: 0; text-align: center; font-weight: 600; height: 32px; }
.cart-foot { border-top: 1px solid var(--line); padding: 12px 14px; }
.tot-line { display: flex; justify-content: space-between; font-size: .87rem; margin: 3px 0; color: var(--muted); }
.tot-grand { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding: 10px 0 8px; margin-top: 6px; }
.tot-grand .v { font-size: 1.5rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.pay-btn { height: 52px; font-size: 1.05rem; }
.kbd { font-size: .68rem; border: 1px solid rgba(255,255,255,.4); border-radius: 3px; padding: 0 4px; margin-left: 6px; opacity: .8; }
.quick-cash button { flex: 1; }
.modes .btn-check:checked + .btn { background: var(--navy); color: #fff; border-color: var(--navy); }
#reader { border-radius: 8px; overflow: hidden; }

/* Connexion */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 32px 28px; }

/* Navigation mobile (bas d'écran) */
.bottom-nav { display: none; }
.fab-cart { display: none; }
.install-btn { display: none; }

@media (max-width: 1199px) { .pos { grid-template-columns: minmax(0, 1fr) 350px; } }
@media (max-width: 991px) {
  .sidebar { position: fixed; left: -250px; transition: left .2s; } body.nav-open .sidebar { left: 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.3); }
  .content { padding: 14px 12px 90px; } .topbar { padding: 8px 12px; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1035; background: #fff; border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .bottom-nav a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-size: .68rem; padding: 5px 0; border-radius: 6px; }
  .bottom-nav a i { display: block; font-size: 1.25rem; line-height: 1.2; }
  .bottom-nav a.active { color: var(--navy); font-weight: 600; }
  .bottom-nav a.main-act i { background: var(--navy); color: #fff; width: 44px; height: 32px; line-height: 32px; border-radius: 8px; margin: 0 auto 1px; }
  /* POS mobile : catalogue plein écran + panier en tiroir */
  .pos { display: block; height: auto; }
  .grid-products { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); overflow: visible; }
  .pos .cart { position: fixed; left: 0; right: 0; bottom: 0; top: 12vh; z-index: 1050; border-radius: 12px 12px 0 0; transform: translateY(105%); transition: transform .22s ease; }
  body.cart-open .pos .cart { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .fab-cart { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 1036; background: var(--navy); color: #fff; border: 0; border-radius: 8px; padding: 12px 16px; align-items: center; font-weight: 600; }
  .fab-cart .v { margin-left: auto; font-variant-numeric: tabular-nums; }
  .fab-cart .n { background: #fff; color: var(--navy); border-radius: 4px; padding: 0 7px; margin-right: 10px; font-size: .85rem; }
  .table-responsive { -webkit-overflow-scrolling: touch; }
  .kpi .value { font-size: 1.12rem; }
  .kbd { display: none; }
  #toasts { top: 64px; bottom: auto !important; left: 0; right: 0; padding: 8px !important; }
  #toasts .toast { width: 100%; }
}
@media (display-mode: standalone) { .topbar { padding-top: max(8px, env(safe-area-inset-top)); } }
@media print { .sidebar, .topbar, .no-print, .bottom-nav, .fab-cart { display: none !important; } .content { padding: 0; } body { background: #fff; } }
