:root{
  --seg-pending:#cbd5e1;
  --seg-valid:#94d2bd;
  --seg-rejected:#f87171;
  --seg-running:#60a5fa;
  --bg-muted:#f1f3f5;
}

/* Cards avec ombre douce */
.card{ 
  box-shadow: 0 1px 3px rgba(0,0,0,.06); 
}

/* === TIMELINES CORRIGÉES === */
.timeline-bar{ 
  height:18px; 
  background:#e9ecef; 
  border-radius:4px; /* Réduit de 10px à 4px */
  position:relative; 
  overflow:hidden; 
}

.timeline-seg{ 
  position:absolute; 
  height:100%; 
  border-radius:3px; /* Réduit pour cohérence */
  transition: all 0.2s ease;
}

.timeline-seg:hover {
  filter: brightness(1.1);
  z-index: 2;
}

.timeline-seg.valid{ background: var(--seg-valid); }
.timeline-seg.pending{ background: var(--seg-pending); }
.timeline-seg.rejected{ background: var(--seg-rejected); }
.timeline-seg.running{ background: var(--seg-running); }

/* Grille responsive */
.timeline-grid{ 
  display:grid; 
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
  gap:.75rem; 
}

/* Légendes améliorées */
.legend{ 
  display:inline-block; 
  width:16px; 
  height:10px; 
  border-radius:2px; 
  vertical-align:middle; 
  margin-right:6px; 
  border: 1px solid rgba(0,0,0,0.1);
}
.legend-valid{ background: var(--seg-valid); }
.legend-pending{ background: var(--seg-pending); }
.legend-rejected{ background: var(--seg-rejected); }
.legend-running{ background: var(--seg-running); }

/* === TRAYS STATUS AMÉLIORÉ === */
.tray-card{ 
  border:1px solid #dee2e6; 
  border-radius:.5rem; 
  padding:.75rem; 
  background: white;
  transition: all 0.2s ease;
}

.tray-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.tray-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.tray-number {
  font-weight: 600;
  font-size: 1rem;
  color: #495057;
}

.tray-status {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 4px;
}

.status-free { background: #d4edda; color: #155724; }
.status-occupied { background: #f8d7da; color: #721c24; }
.status-soon { background: #fff3cd; color: #856404; }

/* === BADGES ET HELPERS === */
.badge-soft{ 
  background: #f1f3f5; 
  border:1px solid #e9ecef; 
  color: #495057;
}

/* Tables compactes */
.table-sm td, .table-sm th{ 
  padding:.4rem .5rem; 
}

/* === CALENDRIER HEBDOMADAIRE CORRIGÉ === */
.week-row{ 
  display:grid; 
  grid-template-columns: 100px 1fr; 
  align-items:center; 
  gap:1rem; 
  padding:.5rem .25rem; 
  border-bottom:1px dashed #eee; 
}

.week-row:last-child {
  border-bottom: none;
}

.week-row .day-label{ 
  font-weight:600; 
  color:#495057; 
  font-size: 0.9rem;
}

.week-row .bar{ 
  height:14px; /* Augmenté de 12px à 14px */
  background:#e9ecef; 
  border-radius:4px; /* Réduit de 8px à 4px */
  position:relative; 
  overflow:hidden; 
}

.week-row .seg{ 
  position:absolute; 
  height:100%; 
  border-radius:3px; 
  transition: all 0.2s ease;
}

.week-row .seg:hover {
  filter: brightness(1.1);
  z-index: 2;
}

.week-row .seg.valid{ background: var(--seg-valid); }
.week-row .seg.pending{ background: var(--seg-pending); }
.week-row .seg.rejected{ background: var(--seg-rejected); }
.week-row .seg.running{ background: var(--seg-running); }

/* === TOOLTIPS AMÉLIORÉS === */
.tooltip-like{ 
  pointer-events:none; 
  position:absolute; 
  transform:translate(-50%,-120%); 
  background:#212529; 
  color:#fff; 
  padding:.3rem .5rem; /* Augmenté */
  border-radius:.25rem; 
  font-size:.75rem; 
  white-space:nowrap; 
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.tooltip-like::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -4px;
  border: 4px solid transparent;
  border-top-color: #212529;
}

/* === TICKS ET GRADUATIONS === */
.timeline-ticks{ 
  position: relative; 
  height: 22px; 
  margin-top: 6px; 
}

.tick-line{ 
  position:absolute; 
  top:0; 
  bottom:8px; 
  width:1px; 
  background:#dfe3e6; 
}

.tick-label{ 
  position:absolute; 
  top:6px; 
  transform:translateX(-50%); 
  font-size:.72rem; 
  color:#6c757d; 
}

/* === MAINTENANCE ET ÉTATS === */
.maint-card h3{ 
  margin-bottom:.2rem; 
}

.maint-muted{ 
  color:#6c757d; 
}

.form-disabled{ 
  pointer-events:none; 
  opacity:.5; 
}

.maint-overlay{ 
  position:fixed; 
  inset:0; 
  background:rgba(255,255,255,.9); 
  display:flex; 
  align-items:center; 
  justify-content:center; 
  z-index:1000; 
}

.maint-card{ 
  max-width:720px; 
  padding:2rem; 
  border-radius:.75rem; 
  background:#fff; 
  border:1px solid #e9ecef; 
  box-shadow:0 10px 30px rgba(0,0,0,.08); 
}

/* === SETTINGS PANEL === */
#settings-panel .form-check-input { 
  cursor: pointer; 
}

#settings-panel .form-label { 
  margin-bottom: .35rem; 
}

#settings-panel .form-check-label{
  cursor:pointer;
  font-weight:500;
}

.settings-box{
  padding:.75rem 1rem;
  border-radius:.5rem;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.switch-col{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.switch-row{
  display:flex;
  align-items:center;
  gap:12px;
}

/* Switch custom amélioré */
.form-switch-lg{
  appearance:none;
  -webkit-appearance:none;
  position:relative;
  width:46px;
  height:26px;
  background:#dee2e6;
  border-radius:26px;
  border:1px solid #ced4da;
  outline:none;
  cursor:pointer;
  transition:background .15s ease-in-out;
}

.form-switch-lg:checked{
  background:#0d6efd33;
  border-color:#0d6efd66;
}

.form-switch-lg::before{
  content:"";
  position:absolute;
  top:2px;
  left:2px;
  width:22px;
  height:22px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 1px 2px rgba(0,0,0,.15);
  transition:left .15s ease-in-out;
}

.form-switch-lg:checked::before{
  left:22px;
}

/* === RESPONSIVE AMÉLIORÉ === */
@media (max-width: 768px) {
  .timeline-grid {
    grid-template-columns: 1fr;
  }
  
  .tray-grid {
    grid-template-columns: 1fr;
  }
  
  .week-row {
    grid-template-columns: 80px 1fr;
    gap: 0.5rem;
  }
  
  .week-row .day-label {
    font-size: 0.8rem;
  }
}

/* === ANIMATIONS DOUCES === */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.timeline-seg.running {
  animation: pulse 2s infinite;
}

/* === STATUS BADGES COHÉRENTS === */
.status-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-pending { background: var(--seg-pending); color: #374151; }
.status-approved { background: var(--seg-valid); color: #065f46; }
.status-rejected { background: var(--seg-rejected); color: #7f1d1d; }
.status-running { background: var(--seg-running); color: #1e3a8a; }

/* ================================== */
/* ===   PILULE D'ESTIMATION V3   === */
/* ================================== */

#scan-duration-text {
  transition: background-color 0.3s ease, color 0.3s ease;
  padding: 0.6em 1.2em;
  font-variant-numeric: tabular-nums;
}

.badge-estimate-initial {
  background-color: #6c757d; /* Gris (votre couleur originale) */
  color: white;
}

.badge-estimate-updated {
  background-color: #0d6efd; /* Bleu primaire Bootstrap */
  color: white;
}

.flash-update {
  animation: flash-animation 0.7s ease-out;
}

@keyframes flash-animation {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}