/* === ESPACE CLIENT — compléments au design admin Chronofleurs === */
:root { --cf-green: #52B788; --cf-green-dark: #30704F; --cf-pink: #E78B84; --cf-pink-dark: #C21D51; }

.sidebar-client { padding: 14px 20px; border-bottom: 1px solid #444; }
.sidebar-client__name { font-weight: 700; font-size: 13px; color: #FFF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-client__sub { font-size: 11px; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
body.sidebar-collapsed .sidebar-client { display: none; }

.sync-info { font-size: 12px; color: #999; align-self: center; margin-right: 6px; }
.app-footer { padding: 14px 32px; font-size: 12px; color: #999; border-top: 1px solid #E5E5E5; background: #FAFAFA; }
.app-footer a { color: #67C096; text-decoration: none; font-weight: 600; }

/* Tuiles de stats */
.stat-card { position: relative; text-align: left; }
.stat-card .stat-value { font-size: 28px; }
.stat-card .stat-delta { font-size: 12px; font-weight: 600; margin-top: 6px; }
.stat-delta.up { color: #2E7D32; } .stat-delta.down { color: #C62828; } .stat-delta.flat { color: #999; }
.stat-card.warn { border-left: 4px solid #E65100; }
.stat-card.danger { border-left: 4px solid #C62828; }
.stat-card.ok { border-left: 4px solid #4CAF50; }
.stat-card.info { border-left: 4px solid #3F7FB5; }

/* Tuiles comparatives : deux colonnes à structure identique (label / valeur / sous-texte) */
.stats-compare { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.stats-compare .stat-card { padding: 16px 18px; }
.stats-compare .stat-label { margin-bottom: 10px; }
.stat-cols { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; }
.stat-cols--single { grid-template-columns: 1fr; }
.stat-col { min-width: 0; white-space: nowrap; }
.stat-col--prev { text-align: right; }
.stat-col__label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #999; margin-bottom: 2px; }
.stats-compare .stat-value { font-size: 24px; line-height: 1.2; }
.stat-col--prev .stat-value { font-size: 18px; color: #777; line-height: 1.6; }
.stat-value small { font-size: 10px; font-weight: 600; color: #999; margin-left: 3px; vertical-align: 2px; }
.stat-of { font-size: 14px; color: #999; font-weight: 600; }
.stat-sub { font-size: 12px; color: #999; margin-top: 4px; }

/* Graphique (canvas vanilla) */
.chart-wrap { position: relative; width: 100%; height: 260px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: #666; margin-top: 8px; flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }

/* Filtres */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters .form-group { margin: 0; }
.filters .form-input { width: auto; min-width: 150px; }
.filters .btn { padding: 10px 20px; }
.filters-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 32px; align-items: end; }
.filters__col { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters__col--right { justify-content: flex-end; }
@media (max-width: 960px) { .filters-2col { grid-template-columns: 1fr; } .filters__col--right { justify-content: flex-start; } }
.seg { display: inline-flex; border: 1px solid #DDD; border-radius: 6px; overflow: hidden; }
.seg a { padding: 10px 14px; font-size: 14px; font-weight: 600; line-height: normal; color: #555; text-decoration: none; background: #FFF; }
.seg a + a { border-left: 1px solid #DDD; }
.seg a.active { background: #67C096; color: #FFF; }

/* Onglets (tableau de bord / ventes : total puis par distributeur) */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 2px solid #DDD; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #777; text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a:hover { color: #2B2B2B; }
.tabs a.active { color: #2B2B2B; border-bottom-color: #67C096; }
.tab-count { background: #67C096; color: #FFF; font-size: 11px; padding: 1px 7px; border-radius: 10px; }
.dot-off { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #E53935; }

/* Grille de casiers : façade du distributeur, 3 colonnes pleine largeur */
.lockers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.lockers-3 { grid-template-columns: repeat(3, 1fr); gap: 14px; }
.locker { border: 2px solid #E5E5E5; border-radius: 10px; padding: 14px 16px; background: #FFF; position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 150px; }
.locker__body { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.locker__product { display: flex; gap: 14px; align-items: center; min-width: 0; flex: 1 1 160px; }
.locker__side { text-align: center; flex: 0 1 auto; margin-left: auto; }
.locker__code { white-space: nowrap; }
/* Mobile : le code passe sous le produit, pleine largeur, pas de chevauchement */
@media (max-width: 560px) {
  .locker__body { flex-direction: column; align-items: stretch; }
  .locker__product { flex: none; }
  .locker__side { margin: 0; width: 100%; background: #FFF8F2; border-radius: 8px; padding: 8px; }
  .locker__code { font-size: 22px; }
  .locker__actions .btn { flex: 1 1 45%; justify-content: center; }
}
.lockers-3 .locker__img { width: 84px; height: 84px; aspect-ratio: auto; flex-shrink: 0; }
.locker__img--none { display: grid; place-items: center; color: #CCC; background: #F5F5F5; }
.locker.full { border-color: #67C096; background: #F4FBF7; }
.locker.empty { border-style: dashed; }
.locker.locked { border-color: #E65100; background: #FFF8F2; }
.locker__no { font-weight: 500; font-size: 14px; color: #1A1A1A; letter-spacing: .5px; text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; }
.locker__img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: #EEE; }
.locker__name { font-weight: 700; font-size: 14px; color: #2B2B2B; line-height: 1.2; }
.locker__price { font-size: 15px; font-weight: 700; color: var(--cf-green-dark); }
.locker__empty { color: #AAA; font-size: 13px; font-style: italic; flex: 1; display: grid; place-items: center; }
.locker__code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 18px; font-weight: 700; letter-spacing: 3px; color: #B45309; background: #FFF3E0; border-radius: 6px; padding: 4px 8px; text-align: center; }
.locker__meta { font-size: 11px; color: #999; }
.locker__actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; justify-content: center; }
.locker__actions .btn { padding: 6px 8px; font-size: 11px; }
.caisson-title { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; font-size: 14px; font-weight: 700; text-transform: uppercase; color: #555; }
.caisson-title:first-child { margin-top: 0; }

/* État du distributeur : 3 colonnes, gros badges */
.etat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 700px) { .etat-grid { grid-template-columns: repeat(2, 1fr); } }
.etat { background: #FAFAFA; border-radius: 8px; padding: 12px; text-align: center; }
.etat__label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #888; margin-bottom: 8px; }
.etat__value .badge { font-size: 16px; padding: 7px 14px; }
.etat__sub { font-size: 11px; color: #999; margin-top: 8px; }
.etat__sub .badge { font-size: 11px; }

/* Ligne d'infos sous le titre de la page machine */
.machine-infos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 24px; font-size: 13px; color: #444; margin: -8px 0 20px; }
.machine-infos__label { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #999; margin-bottom: 2px; }
@media (max-width: 700px) { .machine-infos { grid-template-columns: 1fr; } }
.stats-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) { .stats-3 { grid-template-columns: 1fr; } }

.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head h2 { margin-bottom: 0; }

.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #FAFAFA; border: 1px solid #EEE; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.bulk-bar__all { font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.bulk-bar__count { color: #999; }
.bulk-bar .grow { flex: 1; }
.locker__check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.locker__check input { width: 15px; height: 15px; accent-color: #67C096; }

.prod-img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; display: block; background: #F3F3F3; }
.prod-img--none { display: grid; place-items: center; color: #CCC; }

.quick-dates { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.text-danger { color: #C62828; font-weight: 600; }
.locker.expired { border-color: #E53935; background: #FFF5F5; }

.photo-field { display: flex; gap: 12px; align-items: center; }
.photo-field .form-input { flex: 1; }

.modal__msg { display: none; padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.modal__msg.err { background: #FDECEA; color: #B71C1C; }
.modal__msg.ok { background: #E8F5E9; color: #1B5E20; }

/* Infos machine */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: #888; font-weight: 600; font-size: 12px; text-transform: uppercase; padding-top: 2px; }
.kv dd { margin: 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 960px) { .row { grid-template-columns: 1fr; } .lockers-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .lockers-3 { grid-template-columns: 1fr; } }

.text-muted { color: #999; }
.text-right { text-align: right; }
.mt { margin-top: 16px; }
.mb0 { margin-bottom: 0; }
.empty { color: #999; font-style: italic; text-align: center; padding: 24px; }
.inline-form { display: inline; }
.help { font-size: 13px; color: #666; line-height: 1.5; }
.help p + p { margin-top: 8px; }
.big-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 36px; letter-spacing: 8px; font-weight: 700; color: #B45309; text-align: center; margin: 12px 0; }

/* Toast JS */
.toast { position: fixed; right: 20px; bottom: 20px; background: #2B2B2B; color: #FFF; padding: 12px 18px; border-radius: 8px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 500; opacity: 0; transform: translateY(10px); transition: all .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.ok { border-left: 4px solid #4CAF50; } .toast.err { border-left: 4px solid #E53935; }

/* Page de connexion */
body.auth { display: flex; align-items: center; justify-content: center; background: #1E1E1E; min-height: 100vh; padding: 20px; }
.auth-box { background: #2B2B2B; border-radius: 14px; padding: 40px 36px; width: 100%; max-width: 420px; box-shadow: 0 8px 32px rgba(0,0,0,.4); color: #E0E0E0; }
.auth-box h1 { font-size: 1.3rem; font-weight: 700; color: #FFF; letter-spacing: 1px; text-align: center; margin-bottom: 4px; }
.auth-box h1 span { color: #67C096; }
.auth-box p.sub { text-align: center; color: #999; font-size: .85rem; margin-bottom: 24px; }
.auth-box .form-label { color: #BBB; }
.auth-box .form-input { background: #1E1E1E; border-color: #444; color: #FFF; padding: 12px 14px; }
.auth-box .form-input:focus { border-color: #67C096; }
.auth-box .btn { width: 100%; justify-content: center; margin-top: 8px; background: #67C096; }
.auth-box .btn:hover { background: #56ab82; }
.auth-box .auth-error { background: #3b1f1f; color: #ffb4b4; padding: 10px 12px; border-radius: 8px; font-size: .85rem; margin-bottom: 16px; }
.auth-box .auth-ok { background: #1f3b2a; color: #b4ffd0; padding: 10px 12px; border-radius: 8px; font-size: .85rem; margin-bottom: 16px; }
.auth-box .links { text-align: center; margin-top: 18px; font-size: .8rem; }
.auth-box .links a { color: #999; }
.auth-box .h-captcha { margin: 14px 0 4px; display: flex; justify-content: center; }
.pw-strength { height: 6px; border-radius: 3px; background: #333; margin-top: 6px; overflow: hidden; }
.pw-strength > i { display: block; height: 100%; width: 0; background: #E53935; transition: width .2s, background .2s; }

/* Humidité : nuances de bleu (plus humide = plus soutenu) */
.badge-hum-0 { background: #F2F8FC; color: #7FA6C4; }
.badge-hum-1 { background: #E3F0FA; color: #3F7FB5; }
.badge-hum-2 { background: #CCE3F6; color: #2A6AA3; }
.badge-hum-3 { background: #A9D0F0; color: #174E80; }

/* === Idées & votes === */
.idees { display: flex; flex-direction: column; gap: 12px; }
.idee { display: flex; gap: 16px; align-items: flex-start; padding: 14px 16px; border: 1px solid #EEE; border-radius: 10px; background: #FFF; }
.idee__vote { flex: 0 0 72px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border: 1px solid #DDD; border-radius: 10px; background: #FAFAFA; color: #666; cursor: pointer; font: inherit; }
.idee__vote strong { font-size: 18px; line-height: 1.1; color: #333; }
.idee__vote span { font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.idee__vote:hover:not(:disabled) { border-color: #67C096; color: #2E7D32; }
.idee__vote:disabled { cursor: default; opacity: .6; }
.idee--voted .idee__vote { background: #E8F5E9; border-color: #67C096; color: #2E7D32; }
.idee--voted .idee__vote strong { color: #2E7D32; }
.idee__vote--done { cursor: default; background: #E8F5E9; border-color: #67C096; color: #2E7D32; }
.idee__body { flex: 1; min-width: 0; }
.idee__title { font-weight: 600; font-size: 15px; color: #222; }
.idee__title .badge { margin-left: 6px; vertical-align: middle; }
.idee__desc { margin: 6px 0 0; font-size: 13px; color: #555; line-height: 1.5; }
.idee__meta { margin-top: 8px; font-size: 12px; color: #999; }
@media (max-width: 640px) { .idee { gap: 10px; padding: 12px; } .idee__vote { flex-basis: 60px; } }

/* Tableau de bord : ligne distributeur */
.machines-table td { vertical-align: middle; }
.machines-table__name { white-space: nowrap; }
.machines-table__badges { width: 100%; }
.machines-table__badges .badge { white-space: nowrap; margin: 2px 4px 2px 0; }
.machines-table__badges .badge + .badge { margin-left: 0; }
.machines-table__cta { white-space: nowrap; }
@media (max-width: 640px) {
  .machines-table tr { display: grid; grid-template-columns: 1fr auto; }
  .machines-table__badges { grid-column: 1 / -1; }
  .machines-table td { border-top: 0; padding-top: 6px; padding-bottom: 6px; }
  .machines-table tr + tr td:first-child { border-top: 1px solid #EEE; }
}

/* Mes produits : grille de cartes (2 colonnes, 3 sur grand écran) */
.prod-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 1400px) { .prod-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .prod-grid { grid-template-columns: 1fr; } }
.prod { display: flex; gap: 14px; align-items: center; padding: 10px 12px; border: 1px solid #EEE; border-radius: 10px; background: #FFF; min-width: 0; }
.prod .prod-img { flex: 0 0 64px; }
.prod__body { flex: 1; min-width: 0; }
.prod__name { font-weight: 600; font-size: 14px; color: #222; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod__meta { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.prod__meta .badge + .badge { margin-left: 0; }
.prod__actions { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

/* Catalogue : une colonne par catégorie */
.prod-cols { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 16px; }
.prod-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.prod-col__title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #666; margin: 0 0 2px; padding-bottom: 6px; border-bottom: 2px solid #EEE; }
@media (max-width: 640px) { .prod-cols { grid-template-columns: 1fr; } }
