/* Claire & Compagnie — espace de gestion */
:root {
  --lagune: #146B2E;
  --lagune-900: #0B4A1E;
  --chantier: #F2A900;
  --ecume: #2B8F27;
  --beton: #5F6B73;
  --craie: #F4F7F8;
  --encre: #16232B;
  --ligne: #D9E0E4;
  --bs-body-font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-color: var(--encre);
  --bs-primary: var(--lagune);
  --bs-primary-rgb: 20, 107, 46;
  --bs-link-color: var(--lagune);
  --bs-link-color-rgb: 20, 107, 46;
  --bs-border-color: var(--ligne);
}
body.admin { background: var(--craie); font-size: 0.975rem; }
h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4, .h5 { font-family: "Archivo", sans-serif; font-weight: 700; letter-spacing: -0.01em; }

.btn-primary { --bs-btn-bg: var(--lagune); --bs-btn-border-color: var(--lagune); --bs-btn-hover-bg: var(--lagune-900); --bs-btn-hover-border-color: var(--lagune-900); --bs-btn-active-bg: var(--lagune-900); }
.btn-outline-primary { --bs-btn-color: var(--lagune); --bs-btn-border-color: var(--lagune); --bs-btn-hover-bg: var(--lagune); --bs-btn-hover-border-color: var(--lagune); --bs-btn-active-bg: var(--lagune); }
.btn-chantier { background: var(--chantier); color: var(--encre); font-weight: 700; border: 0; }
.btn-chantier:hover, .btn-chantier:focus { background: #d99700; color: var(--encre); }
.btn-ecume { background: var(--ecume); color: #fff; font-weight: 700; border: 0; }
.btn-ecume:hover, .btn-ecume:focus { background: #1F6F1D; color: #fff; }
:focus-visible { outline: 3px solid var(--chantier); outline-offset: 2px; }

/* Barre mobile */
.topbar { position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--lagune-900); color: #fff; padding: .6rem 1rem; }
.brand-sm { font-family: "Archivo", sans-serif; font-weight: 800; }

/* Structure */
.shell { display: flex; min-height: 100vh; }
/* Bootstrap rend .offcanvas-lg transparent (!important) sur grand écran : on force le fond vert du menu */
.sidebar, .sidebar.offcanvas-lg { background-color: var(--lagune-900) !important; color: #d3ebd6; }
@media (min-width: 992px) {
  .sidebar { width: 250px; flex: 0 0 250px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.sidebar.offcanvas-lg { --bs-offcanvas-bg: var(--lagune-900); --bs-offcanvas-color: #d3ebd6; --bs-offcanvas-width: 270px; }
.sidebar-inner { padding: 1.1rem .8rem 2rem; background: var(--lagune-900); min-height: 100%; }
.brand { display: flex; align-items: center; gap: .7rem; padding: 0 .4rem 1rem; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: .5rem; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 10px; background: var(--chantier); color: var(--encre); font-family: "Archivo", sans-serif; font-weight: 800; font-size: .85rem; }
.brand-name { font-family: "Archivo", sans-serif; font-weight: 800; color: #fff; line-height: 1.1; }
.brand-role { font-size: .8rem; color: #a3c8a8; }
.nav-group { font-size: .78rem; color: #8fb896; padding: 1rem .6rem .3rem; font-weight: 600; }
.sidebar .nav-link { display: flex; align-items: center; gap: .65rem; color: #d8ecdb; padding: .5rem .6rem; border-radius: 8px; }
.sidebar .nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar .nav-link.active { background: rgba(242,169,0,.16); color: #fff; box-shadow: inset 3px 0 0 var(--chantier); }
.sidebar .nav-link .badge { background: var(--chantier); color: var(--encre); }

.content { flex: 1; min-width: 0; padding: 1.5rem clamp(1rem, 2.5vw, 2.25rem) 3rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: clamp(1.35rem, 2.4vw, 1.75rem); margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Surfaces */
.panel { background: #fff; border: 1px solid var(--ligne); border-radius: 12px; padding: 1.1rem 1.2rem; }
.panel + .panel { margin-top: 1rem; }
.panel-title { font-family: "Archivo", sans-serif; font-weight: 700; font-size: 1.05rem; margin-bottom: .8rem; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th { font-weight: 600; color: var(--beton); font-size: .85rem; border-bottom-color: var(--ligne); white-space: nowrap; }
.table td { vertical-align: middle; }
.table-wrap { overflow-x: auto; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 700; background: #FFF6DC; }

/* Indicateurs du tableau de bord */
.kpi { background: #fff; border: 1px solid var(--ligne); border-radius: 12px; padding: 1rem 1.1rem; height: 100%; }
.kpi-label { color: var(--beton); font-size: .9rem; }
.kpi-value { font-family: "Archivo", sans-serif; font-weight: 800; font-size: 1.55rem; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .85rem; color: var(--beton); }
.kpi.quinc { border-top: 4px solid var(--chantier); }
.kpi.nett { border-top: 4px solid var(--ecume); }
.kpi.alert-kpi { border-top: 4px solid #d63939; }

/* Caisse (point de vente) */
.pos { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 1100px) { .pos { grid-template-columns: minmax(0, 1fr) 420px; align-items: start; } .pos-cart { position: sticky; top: 1rem; } }
.pos-cats { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; }
.pos-cats .btn { white-space: nowrap; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .6rem; }
.pos-item { text-align: left; background: #fff; border: 1px solid var(--ligne); border-radius: 10px; padding: .7rem .75rem; display: flex; flex-direction: column; gap: .25rem; min-height: 112px; }
.pos-item:hover:not(:disabled) { border-color: var(--lagune); }
.pos-item:disabled { opacity: .45; }
.pos-item .ref { font-size: .75rem; color: var(--beton); }
.pos-item .name { font-weight: 600; line-height: 1.2; font-size: .92rem; }
.pos-item .price { margin-top: auto; font-family: "Archivo", sans-serif; font-weight: 700; color: var(--lagune); }
.pos-item .stock { font-size: .78rem; color: var(--beton); }
.pos-item.low .stock { color: #b36b00; font-weight: 600; }
.cart-lines { max-height: 42vh; overflow-y: auto; }
.cart-line { display: grid; grid-template-columns: 1fr 92px auto; gap: .5rem; align-items: center; padding: .5rem 0; border-bottom: 1px dashed var(--ligne); }
.cart-line .t { font-weight: 600; font-size: .9rem; line-height: 1.2; }
.cart-line .s { font-size: .8rem; color: var(--beton); }
.cart-total { font-family: "Archivo", sans-serif; font-weight: 800; font-size: 1.9rem; font-variant-numeric: tabular-nums; }
.pos-cart.quinc { border-top: 5px solid var(--chantier); }
.pos-cart.nett { border-top: 5px solid var(--ecume); }

/* Connexion */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(135deg, var(--lagune-900) 0%, var(--lagune) 60%); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 2rem; }
.login-card .brand-mark { width: 52px; height: 52px; font-size: 1rem; }

.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--craie); }
.slide-thumb { width: 120px; height: 60px; object-fit: cover; border-radius: 8px; background: var(--lagune); }
.empty { text-align: center; color: var(--beton); padding: 2rem 1rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .sidebar, .topbar, .page-actions, .no-print { display: none !important; }
  .content { padding: 0; }
}

/* Aperçus de motifs du carrousel */
.pole-general { background: linear-gradient(135deg, var(--lagune-900), var(--lagune)); }
.pole-quinc { background: repeating-linear-gradient(-45deg, var(--chantier) 0 10px, var(--encre) 10px 20px); }
.pole-nett { background: radial-gradient(circle at 30% 40%, rgba(255,255,255,.5) 0 6px, transparent 7px), radial-gradient(circle at 70% 60%, rgba(255,255,255,.4) 0 9px, transparent 10px), var(--ecume); }

/* Logo téléversé */
.brand-logo { height: 42px; width: auto; max-width: 110px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }
.brand-logo.lg { height: 64px; max-width: 160px; }
.logo-preview { min-width: 72px; display: grid; place-items: center; }
