/* T2S MULTI-SHOP v1.1 */
:root { --t2s: #0b3d62; --t2s-accent: #f0a500; --t2s-fond: #f4f6f9; }

/* ---------- Thèmes utilisateur ---------- */
[data-theme="sombre"]   { --t2s: #1f2937; --t2s-accent: #f0a500; --t2s-fond: #111827; }
[data-theme="nuit"]     { --t2s: #0f2a4a; --t2s-accent: #38bdf8; --t2s-fond: #0b1626; }
[data-theme="ocean"]    { --t2s: #0e7490; --t2s-accent: #f59e0b; --t2s-fond: #f0f9fb; }
[data-theme="emeraude"] { --t2s: #047857; --t2s-accent: #fbbf24; --t2s-fond: #f0faf5; }
[data-theme="violet"]   { --t2s: #5b21b6; --t2s-accent: #f472b6; --t2s-fond: #f7f4fd; }
[data-theme="corail"]   { --t2s: #c2410c; --t2s-accent: #0ea5e9; --t2s-fond: #fdf6f2; }
[data-theme="bordeaux"] { --t2s: #7f1d1d; --t2s-accent: #d4a017; --t2s-fond: #fbf5f5; }
[data-theme="ardoise"]  { --t2s: #334155; --t2s-accent: #22c55e; --t2s-fond: #f3f5f8; }
[data-theme="sable"]    { --t2s: #78350f; --t2s-accent: #0d9488; --t2s-fond: #fbf8f1; }
[data-theme] .btn-primary { --bs-btn-bg: var(--t2s); --bs-btn-border-color: var(--t2s); --bs-btn-hover-bg: var(--t2s); --bs-btn-hover-border-color: var(--t2s); --bs-btn-active-bg: var(--t2s); filter: saturate(1.05); }
[data-theme] .btn-primary:hover { filter: brightness(1.12); }
[data-theme] .page-item.active .page-link { background: var(--t2s); border-color: var(--t2s); }

body { background: var(--t2s-fond); font-size: .925rem; }
[data-bs-theme="dark"] .card-header { background: var(--bs-tertiary-bg); }
.bg-t2s { background: var(--t2s); }
.text-t2s { color: var(--t2s); }
.navbar-brand { letter-spacing: .02em; }
.navbar-nav .nav-link { white-space: nowrap; }
.navbar .dropdown-menu { font-size: .9rem; }
.card { border: 0; }
.card-header { background: var(--bs-body-bg); }
.table > :not(caption) > * > * { padding: .4rem .5rem; }
.w-40 { width: 40%; }
.login-bg { background: linear-gradient(135deg, #0b3d62 0%, #145c8f 60%, #f0a500 160%); }
.login-card { max-width: 400px; }
.audit-details { max-width: 420px; word-break: break-word; font-family: monospace; font-size: .75rem; }
details pre { white-space: pre-wrap; max-height: 300px; overflow: auto; background: var(--bs-tertiary-bg); padding: .5rem; }
.doc-a4 { max-width: 210mm; background: #fff; }
.montant-saisie { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Barre de liste : filtre rapide + pagination ---------- */
.liste-filtre { max-width: 320px; }
tr.filtre-cache { display: none; }

/* ---------- Notifications ---------- */
.notif-menu { width: 380px; max-width: 92vw; }
.notif-liste { max-height: 60vh; overflow-y: auto; }
.notif-item { display: flex; gap: .6rem; padding: .55rem .9rem; border-bottom: 1px solid var(--bs-border-color-translucent); color: inherit; text-decoration: none; font-size: .85rem; }
.notif-item:hover { background: var(--bs-tertiary-bg); }
.notif-item.non-lue { background: rgba(13, 110, 253, .06); font-weight: 600; }
.notif-item .bi { font-size: 1.05rem; }

/* ---------- Tableau de bord ---------- */
.kpi .fs-5 { font-variant-numeric: tabular-nums; }
.ca-graph { display: flex; align-items: stretch; gap: 4px; height: 200px; padding-top: 16px; }
.ca-barre { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.ca-barre .zone { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.ca-barre .b { display: block; width: 100%; max-width: 38px; background: var(--t2s); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.ca-barre .b .v { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); }
.ca-barre .b.vide { background: var(--bs-border-color); }
.ca-barre .b:hover { filter: brightness(1.25); }
.ca-barre .v { font-size: .62rem; color: var(--bs-secondary-color); white-space: nowrap; margin-bottom: 2px; }
.ca-barre .j { font-size: .68rem; color: var(--bs-secondary-color); margin-top: 3px; white-space: nowrap; }
.rang { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; background: var(--bs-tertiary-bg); }
.rang-1 { background: #f0a500; color: #fff; } .rang-2 { background: #9ca3af; color: #fff; } .rang-3 { background: #b45309; color: #fff; }
.barre-part { height: 4px; background: var(--bs-border-color-translucent); border-radius: 2px; overflow: hidden; }
.barre-part > span { display: block; height: 100%; background: var(--t2s-accent); }

/* ---------- Facturation rapide ---------- */
.prod-panneau .prod-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; max-height: 340px; overflow-y: auto; padding: 2px; }
.prod-tuile { position: relative; border: 1px solid var(--bs-border-color); border-radius: .5rem; padding: .5rem .55rem; background: var(--bs-body-bg); text-align: left; cursor: pointer; font-size: .8rem; line-height: 1.25; transition: transform .05s, box-shadow .1s; }
.prod-tuile:hover { border-color: var(--t2s); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.prod-tuile:active { transform: scale(.97); }
.prod-tuile .nom { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.05em; padding-right: 1.2rem; }
.prod-tuile .prix { color: var(--t2s); font-weight: 700; margin-top: .2rem; }
.prod-tuile .stk { font-size: .7rem; color: var(--bs-secondary-color); }
.prod-tuile .stk.rupture { color: var(--bs-danger); font-weight: 600; }
.prod-tuile .fav { position: absolute; top: .25rem; right: .3rem; border: 0; background: none; padding: 0 .15rem; color: #c4c4c4; font-size: 1rem; line-height: 1; }
.prod-tuile .fav.actif { color: #f0a500; }
.prod-tuile.ajoute { animation: flash-ajout .4s; }
@keyframes flash-ajout { from { background: rgba(25, 135, 84, .25); } to { background: var(--bs-body-bg); } }
.prod-tuile.cache { display: none; }
.fav-etoile { border: 0; background: none; color: #c4c4c4; padding: 0 .25rem; }
.fav-etoile.actif { color: #f0a500; }

/* ---------- Messagerie / chat ---------- */
.chat { height: calc(100vh - 190px); min-height: 460px; }
.chat-liste { overflow-y: auto; }
.chat-conv { display: flex; gap: .6rem; padding: .6rem .8rem; border-bottom: 1px solid var(--bs-border-color-translucent); color: inherit; text-decoration: none; cursor: pointer; }
.chat-conv:hover, .chat-conv.active { background: var(--bs-tertiary-bg); }
.chat-conv .avatar, .chat-msg .avatar { flex: 0 0 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--t2s); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; }
.chat-conv .apercu { font-size: .78rem; color: var(--bs-secondary-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-fil { overflow-y: auto; background: var(--bs-tertiary-bg); }
.chat-msg { display: flex; gap: .5rem; margin: .45rem .8rem; max-width: 78%; }
.chat-msg.moi { margin-left: auto; flex-direction: row-reverse; }
.chat-msg .bulle { background: var(--bs-body-bg); border-radius: .8rem; padding: .45rem .7rem; box-shadow: 0 1px 1px rgba(0,0,0,.06); word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-msg.moi .bulle { background: var(--t2s); color: #fff; }
.chat-msg.moi .bulle a { color: #fff; }
.chat-msg .meta { font-size: .68rem; opacity: .7; margin-top: .15rem; }
.chat-msg img.piece { max-width: 260px; max-height: 260px; border-radius: .5rem; display: block; margin-top: .25rem; cursor: zoom-in; }
.chat-msg .fichier { display: inline-flex; align-items: center; gap: .35rem; margin-top: .25rem; }
.chat-saisie textarea { resize: none; }
.chat-msg .js-msg-suppr { font-size: .68rem; opacity: .8; }
@media (max-width: 767.98px) {
  .chat.conv-ouverte .js-chat-col-liste { display: none !important; }
  .chat:not(.conv-ouverte) .js-chat-col-liste + div { display: none !important; }
  .chat-msg { max-width: 92%; }
}
.chat-jour { text-align: center; font-size: .72rem; color: var(--bs-secondary-color); margin: .6rem 0; }

/* ---------- Notes privées ---------- */
.note-carte { border-radius: .5rem; border: 1px solid rgba(0,0,0,.06); white-space: pre-wrap; }
.note-jaune { background: #fff8c5; } .note-bleu { background: #dbeafe; } .note-vert { background: #dcfce7; }
.note-rose { background: #fce7f3; } .note-gris { background: #f1f5f9; } .note-orange { background: #ffedd5; }
[data-bs-theme="dark"] .note-carte { color: #1f2937; }

/* ---------- Galerie des modèles ---------- */
.modele-galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.modele-carte { border: 2px solid var(--bs-border-color); border-radius: .6rem; overflow: hidden; background: var(--bs-body-bg); cursor: pointer; display: block; }
.modele-carte.choisi { border-color: var(--t2s); box-shadow: 0 0 0 3px rgba(11, 61, 98, .2); }
.modele-carte input { position: absolute; opacity: 0; }
.modele-apercu { height: 300px; overflow: hidden; background: #e5e7eb; position: relative; }
.modele-apercu .echelle { transform: scale(.285); transform-origin: top left; width: 210mm; position: absolute; top: 6px; left: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.modele-apercu.ticket .echelle { transform: scale(.6); width: 80mm; left: 50%; margin-left: -24mm; }
.modele-nom { padding: .45rem .6rem; font-size: .82rem; display: flex; justify-content: space-between; align-items: center; }

@media print {
  .no-print, nav.navbar, footer, .btn, form .form-select, .pagination, .liste-barre { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  main { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc; }
  a { color: #000; text-decoration: none; }
  .doc-a4 { padding: 0 !important; max-width: none; }
  @page { size: A4; margin: 12mm; }
  tr.filtre-cache { display: table-row; }
}
