/* ============================================================
   PISCINE OUEST — Dashboard Admin
   Feuille de styles complète et unifiée
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --sidebar-bg:       #1A2B4C;
  --sidebar-hover:    #243759;
  --sidebar-active:   #2563EB;
  --accent:           #2563EB;
  --accent-hover:     #1d4ed8;
  --accent-light:     #dbeafe;
  --danger:           #ef4444;
  --danger-light:     #fee2e2;
  --warning:          #f59e0b;
  --success:          #10b981;
  --success-light:    #d1fae5;
  --text-primary:     #0f172a;
  --text-secondary:   #475569;
  --text-muted:       #94a3b8;
  --border:           #e2e8f0;
  --bg-main:          #f8fafc;
  --bg-card:          #ffffff;
  --radius:           8px;
  --radius-lg:        12px;
  --shadow-sm:        0 1px 3px rgba(0,0,0,.08);
  --shadow-md:        0 4px 16px rgba(0,0,0,.12);
  --shadow-lg:        0 12px 32px rgba(0,0,0,.18);
  --font:             'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }

.hidden { display: none !important; }

/* ============================================================
   CONNEXION (PIN ADMIN)
   ============================================================ */
.login {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #243759 0%, #1A2B4C 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.login-card {
  background: var(--bg-card);
  padding: 40px 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-card h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-sub {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 24px;
}

.login-pin {
  width: 100%;
  font-size: 2rem;
  letter-spacing: 12px;
  text-align: center;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  outline: none;
  transition: border-color .2s;
  background: #f8fafc;
}

.login-pin:focus {
  border-color: var(--accent);
  background: #ffffff;
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 20px;
  margin-bottom: 12px;
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
#app, .app {
  display: flex !important;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px 16px;
  z-index: 100;
}

.brand {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-name {
  display: block;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.brand-who {
  display: block;
  font-size: 0.8rem;
  color: #93c5fd;
  margin-top: 4px;
  font-weight: 500;
}

.nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all .2s;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37,99,235,.4);
}

.nav-group {
  display: flex;
  flex-direction: column;
}

.nav-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
  background: transparent;
  border: none;
}

.nav-parent:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-parent.active-parent {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-parent-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-parent-arrow {
  font-size: 0.85rem;
  transition: transform 0.2s ease;
  color: rgba(255, 255, 255, 0.6);
}

.nav-group.open .nav-parent-arrow {
  transform: rotate(180deg);
}

.nav-sub-list {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding-left: 8px;
  margin-top: 4px;
  margin-left: 14px;
  border-left: 2px solid rgba(255, 255, 255, 0.15);
}

.nav-group.open .nav-sub-list {
  display: flex;
}

.nav-sub-item {
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
  border: none;
  cursor: pointer;
}

.nav-sub-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-sub-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.nav-logout {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 14px;
  color: #fca5a5;
}

.nav-logout:hover {
  background: rgba(239,68,68,0.2);
  color: #fff;
}

.main, .main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100vh;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
}

/* ============================================================
   VUES
   ============================================================ */
.view {
  flex: 1;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.view-head h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
  width: 100%;
}

/* ============================================================
   BOUTONS & FORMULAIRES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all .2s;
  white-space: nowrap;
}

.btn-primary, .btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover, .btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(37,99,235,.35);
}

.btn-soft, .btn--secondary {
  background: #e2e8f0;
  color: var(--text-primary);
}
.btn-soft:hover, .btn--secondary:hover {
  background: #cbd5e1;
}

.btn-ghost, .btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover, .btn--ghost:hover {
  background: var(--bg-main);
  color: var(--text-primary);
}

.btn-danger, .btn--danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover, .btn--danger:hover {
  background: #dc2626;
}

.btn-sm, .btn--sm {
  padding: 5px 10px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-block {
  width: 100%;
}

.input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  transition: all .2s;
  width: 100%;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

textarea.input {
  resize: vertical;
}

.grow { flex: 1; }

/* ============================================================
   TABLEAUX (CLIENTS & STOCKS)
   ============================================================ */
.table-wrap, .table-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.table, .data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th, .data-table th {
  padding: 12px 18px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td, .data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-primary);
  vertical-align: middle;
}

.table tbody tr:hover td {
  background: #f8fafc;
}

.table tr.inactive td {
  opacity: 0.6;
}

.table td.strong {
  font-weight: 600;
}

.table td.actions {
  white-space: nowrap;
  display: flex;
  gap: 8px;
}

/* ============================================================
   TAGS / BADGES
   ============================================================ */
.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-sel {
  background: #dbeafe;
  color: #1e40af;
}

.tag-chlore {
  background: #fef3c7;
  color: #92400e;
}

.tag-off {
  background: #fee2e2;
  color: #991b1b;
  margin-left: 6px;
}

.tag-target {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  margin-left: 6px;
}

.tag-all {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  margin-left: 6px;
}

/* ============================================================
   PLANNING (CALENDRIER MENSUEL + GLISSER-DÉPOSER)
   ============================================================ */
.month-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.month-nav h2 {
  font-size: 1.3rem;
  font-weight: 700;
  min-width: 200px;
  text-align: center;
}

.planning {
  display: flex;
  gap: 20px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.client-panel {
  width: 250px;
  min-width: 250px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.client-list {
  flex: 1;
  overflow-y: auto;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-item {
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all .2s;
  font-size: 0.85rem;
  font-weight: 500;
}

.client-item:hover {
  border-color: var(--accent);
  background: #eff6ff;
  box-shadow: var(--shadow-sm);
}

.client-item:active {
  cursor: grabbing;
}

.calendar {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-right: 4px;
}

.week {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.week-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 12px;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.day {
  background: #f8fafc;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 10px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
}

.day.today {
  border-color: var(--accent);
  background: #f0f7ff;
}

.day.outside {
  opacity: 0.45;
}

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.day-head-date {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.day-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-copy-tag {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.3;
}
.btn-copy-tag:hover {
  background: #e2e8f0;
  color: #1e293b;
  border-color: #94a3b8;
}
.btn-copy-tag.active {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1d4ed8;
}
.btn-copy-tag.paste {
  background: #dcfce7;
  border-color: #22c55e;
  color: #15803d;
  font-weight: 700;
}
.btn-copy-tag.paste:hover {
  background: #bbf7d0;
  transform: scale(1.05);
}

.day-name {
  color: var(--text-secondary);
}

.day-num {
  font-size: 1rem;
  color: var(--text-primary);
}

.day-month {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.lanes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.lane {
  min-height: 80px;
  background: #1e3a8a;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  padding: 8px 8px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all .2s;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.lane.over, .lane.dragover {
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--accent);
  filter: brightness(1.08);
}

.lane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  gap: 4px;
}

.lane-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-lane-tour {
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #ffffff;
  font-size: 0.70rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.btn-lane-tour:hover {
  background: rgba(255, 255, 255, 0.38);
  border-color: #ffffff;
  transform: translateY(-1px);
}

.btn-lane-tour.copied {
  background: #fef08a;
  border-color: #facc15;
  color: #854d0e;
  text-shadow: none;
  font-weight: 800;
}

.btn-lane-tour.paste {
  background: #22c55e;
  border-color: #16a34a;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 2px 5px rgba(0,0,0,0.25);
}

.btn-lane-tour.paste:hover {
  background: #16a34a;
  border-color: #15803d;
  transform: scale(1.04);
}

.lane .card {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: grab;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: all .2s;
}

.lane .card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Trait de couleur pour le sel retiré selon la demande de l'utilisateur */
.lane .card.sel {
  border-left: 1px solid #e2e8f0;
}

.lane .card.validated {
  background: #ffffff !important;
  border-color: #86efac;
  cursor: default;
}

.lane .card .card-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 12px; /* bien espacé du bouton */
}

.lane .card .card-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lane .card .card-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: #f1f5f9;
  color: #64748b;
  font-size: 18px; /* PLUS GROSSE CROIX */
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 10px; /* PLUS ESPACÉE DU NOM */
  padding: 0;
}

.lane .card .card-del:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
  transform: scale(1.15);
}

.lane-drop-zone {
  min-height: 32px;
  background: #ffffff !important;
  border: 1px dashed #cbd5e1 !important;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569 !important;
  transition: all 0.2s;
  cursor: pointer;
  margin-top: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.lane.over .lane-drop-zone {
  border-color: var(--accent) !important;
  background: #f8fafc !important;
  color: var(--accent) !important;
}

.drop-indicator {
  height: 4px;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(255,255,255,0.9);
  margin: 2px 0;
}

.visit-card, .visit-instance-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: grab;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: all .2s;
}

.visit-card:hover, .visit-instance-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* ============================================================
   NOTES ADMIN
   ============================================================ */
.note-form {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px 24px;
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.note, .note-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.note.inactive {
  background: #f8fafc;
  border-color: #e2e8f0;
  opacity: 0.85;
}

.note-top, .note-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.note-top-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.note-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.note-date {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--sidebar-bg);
}

.note-msg, .note-text {
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.5;
  margin: 0 0 14px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.acks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ack {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ack.ok {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.ack.wait {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

/* ============================================================
   MODALES & DIALOGUES
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn .2s;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp .2s ease;
}

.modal h3 {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(85vh - 130px);
}

.modal-actions {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ============================================================
   TOASTS & FEEDBACK
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  background: #0f172a;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all .3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 3000;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  background: var(--danger);
}

.empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 24px;
  text-align: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
/* ============================================================
   STOCKS & CONSOMMATION DES PRODUITS
   ============================================================ */

.sub-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.sub-tab {
  padding: 10px 20px;
  border-radius: var(--radius);
  background: #f1f5f9;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sub-tab:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.sub-tab.active {
  background: var(--sidebar-bg);
  border-color: var(--sidebar-bg);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.stocks-toolbar,
.stocks-client-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.stocks-client-toolbar {
  justify-content: flex-start;
  gap: 24px;
}

.client-selector-box,
.month-selector-box,
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.client-selector-box {
  flex: 1;
  min-width: 280px;
}

.select-client {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
  border-color: #cbd5e1;
}

.toolbar-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.select-month {
  min-width: 220px;
  font-weight: 500;
}

/* Grille de cartes métriques */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-ph    { border-top: 4px solid #ec4899; }
.metric-galets{ border-top: 4px solid #3b82f6; }
.metric-hypo  { border-top: 4px solid #8b5cf6; }
.metric-sel   { border-top: 4px solid #10b981; }
.metric-stab  { border-top: 4px solid #f59e0b; }

.metric-icon {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.metric-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.metric-val {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--sidebar-bg);
  line-height: 1.2;
}

.metric-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 500;
}

/* Fiche Héros Client */
.client-hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 5px solid var(--sidebar-bg);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.client-hero-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.client-avatar {
  width: 52px;
  height: 52px;
  background: #f1f5f9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  border: 1px solid var(--border);
}

.client-hero-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--sidebar-bg);
  margin-bottom: 6px;
}

.client-hero-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.client-hero-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding-left: 20px;
  border-left: 1px solid var(--border);
}

.hero-stat-val {
  font-size: 2rem;
  font-weight: 800;
  color: var(--sidebar-bg);
  line-height: 1;
}

.hero-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 4px;
}

.client-address {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin-left: 4px;
}

/* Sections & Tableaux de Stocks */
.stocks-section {
  margin-bottom: 32px;
}

.section-head {
  margin-bottom: 14px;
}

.section-head h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--sidebar-bg);
}

.text-highlight {
  font-weight: 700;
  color: var(--sidebar-bg);
}

.prod-inline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prod-inline-list li {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
}

.visit-note {
  font-style: italic;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.badge-volume {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-weight: 600;
}

.badge-sel {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #10b981;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.2;
  white-space: nowrap;
}

.badge-cellule {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #f97316;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.2;
  white-space: nowrap;
}

.badge-chlore {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
  font-weight: 600;
}

.badge-primary {
  background: var(--sidebar-bg);
  color: #fff;
  font-weight: 600;
}/* ============================================================
   MODALE DE SAISIE DE PASSAGE & FORMULAIRES LARGES
   ============================================================ */

.modal-form-wide {
  max-width: 680px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--sidebar-bg);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 10px;
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}/* ============================================================
   CAPSULES ACTIONS & REMARQUES (IDENTIQUE FLUTTER MOBILE)
   ============================================================ */

.remarks-rows-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.remark-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.remark-capsule {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--sidebar-bg);
  transition: all 0.15s ease;
  user-select: none;
  line-height: 1.2;
}

.remark-capsule:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.remark-capsule.active {
  font-weight: 600;
  background: rgba(37, 99, 235, 0.12);
  border: 1.5px solid #2563EB;
  color: #2563EB;
}

.remark-capsule.active.capsule-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
  color: #ef4444;
}

.remark-capsule.active.capsule-orange {
  background: rgba(245, 158, 11, 0.12);
  border-color: #f59e0b;
  color: #d97706;
}

.badge-remark {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin: 2px 4px 2px 0;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-remark.badge-remark-danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.badge-remark.badge-remark-orange {
  background: #fffbeb;
  color: #d97706;
  border-color: #fde68a;
}

/* ============================================================
   VUE MENSUELLE GLOBALE (PLEIN ÉCRAN, 4 COLONNES, COULEURS TOURNEE)
   ============================================================ */
.app.monthly-fullscreen .sidebar {
  display: none !important;
}

.app.monthly-fullscreen .main {
  width: 100vw !important;
  max-width: 100vw !important;
  padding: 0 !important;
}

.app.monthly-fullscreen #view-monthly {
  padding: 16px 28px !important;
  min-height: 100vh !important;
}

.monthly-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.monthly-head-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.monthly-head-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.monthly-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.80rem;
  font-weight: 600;
  color: #334155;
  background: #ffffff;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.legend-box {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  margin-right: 4px;
  margin-left: 6px;
}
.legend-box.box-tour {
  background: #e0f2fe;
  border: 1.5px solid #7dd3fc;
  margin-left: 0;
}
.legend-box.box-no-tour {
  background: #ffedd5;
  border: 1.5px solid #fdba74;
}

.monthly-select {
  width: auto;
  min-width: 190px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius);
  background: #ffffff;
}

.monthly-stats-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
}

.monthly-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: visible;
  margin-bottom: 24px;
}

/* 4 Colonnes : Mardi, Mercredi, Jeudi, Vendredi */
.monthly-grid-head {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #1e293b;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.monthly-grid-head-day {
  padding: 12px 10px;
  text-align: center;
  font-size: 0.90rem;
  font-weight: 800;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.monthly-grid-head-day:last-child {
  border-right: none;
}

/* Couleurs distinctes pour chaque colonne de la vue mensuelle */
.col-head-0 {
  background: linear-gradient(135deg, #0369a1, #0284c7) !important;
  border-top-left-radius: var(--radius-lg);
}
.col-head-1 {
  background: linear-gradient(135deg, #047857, #059669) !important;
}
.col-head-2 {
  background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
}
.col-head-3 {
  background: linear-gradient(135deg, #b45309, #d97706) !important;
  border-top-right-radius: var(--radius-lg);
}

/* Grille 4 colonnes sans scrollbar interne */
.monthly-grid-body {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(130px, auto);
  overflow: visible;
}

.monthly-day-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px 10px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 130px;
  height: auto;
  transition: all 0.15s ease;
}

.monthly-day-cell:nth-child(4n) {
  border-right: none;
}

/* ── Fonds avec nuance harmonieuse dédiée par colonne si tournée ── */
.monthly-day-cell.cell-tour {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.monthly-day-cell.col-0.cell-tour {
  background: #f0f9ff;
  border-color: #bae6fd;
}
.monthly-day-cell.col-0.cell-tour:hover {
  background: #e0f2fe;
}
.monthly-day-cell.col-0.cell-tour .monthly-day-num {
  color: #0369a1;
}

.monthly-day-cell.col-1.cell-tour {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.monthly-day-cell.col-1.cell-tour:hover {
  background: #d1fae5;
}
.monthly-day-cell.col-1.cell-tour .monthly-day-num {
  color: #047857;
}

.monthly-day-cell.col-2.cell-tour {
  background: #f5f3ff;
  border-color: #ddd6fe;
}
.monthly-day-cell.col-2.cell-tour:hover {
  background: #ede9fe;
}
.monthly-day-cell.col-2.cell-tour .monthly-day-num {
  color: #4f46e5;
}

.monthly-day-cell.col-3.cell-tour {
  background: #fffbeb;
  border-color: #fde68a;
}
.monthly-day-cell.col-3.cell-tour:hover {
  background: #fef3c7;
}
.monthly-day-cell.col-3.cell-tour .monthly-day-num {
  color: #b45309;
}

/* ── Fond orange clair pour les jours SANS tournée ── */
.monthly-day-cell.cell-no-tour {
  background: #fff7ed;
  border-color: #fed7aa;
}
.monthly-day-cell.cell-no-tour:hover {
  background: #ffedd5;
}
.monthly-day-cell.cell-no-tour .monthly-day-num {
  color: #c2410c;
}

/* Hors mois courant */
.monthly-day-cell.is-outside {
  opacity: 0.65;
  filter: grayscale(15%);
}

/* Aujourd'hui */
.monthly-day-cell.is-today {
  box-shadow: inset 0 3px 0 var(--accent);
}
.monthly-day-cell.is-today .monthly-day-num {
  background: var(--accent);
  color: #ffffff !important;
  border-radius: 6px;
  padding: 2px 6px;
}

.monthly-day-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.monthly-day-num-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.monthly-day-num {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
}

.today-tag {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--accent);
  color: #ffffff;
  padding: 1px 5px;
  border-radius: 4px;
}

.monthly-day-count-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  line-height: 1.2;
}
.col-badge-0 {
  background: #0284c7;
  color: #ffffff;
}
.col-badge-1 {
  background: #059669;
  color: #ffffff;
}
.col-badge-2 {
  background: #6366f1;
  color: #ffffff;
}
.col-badge-3 {
  background: #d97706;
  color: #ffffff;
}
.badge-orange {
  background: #f97316;
  color: #ffffff;
}

/* ── Liste des visites du jour : AUCUN DÉROULEMENT (pleinement déployée) ── */
.monthly-visits-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: visible !important;
  max-height: none !important;
}

/* ── Sous-sections distinctes par technicien (séparation absolue) ── */
.monthly-tech-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  padding: 5px 6px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-left-width: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.monthly-tech-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 3px;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

.monthly-tech-pill {
  font-size: 0.70rem;
  font-weight: 700;
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 4px;
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
  line-height: 1.3;
}

.monthly-tech-count {
  font-size: 0.68rem;
  font-weight: 600;
  color: #64748b;
}

.monthly-tech-cards {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.monthly-empty-day {
  font-size: 0.75rem;
  color: #9a3412;
  font-style: italic;
  padding: 8px 4px;
  text-align: center;
}

.monthly-visit-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-left-width: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.3;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.monthly-visit-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0,0,0,0.12);
  filter: brightness(0.98);
}

.monthly-visit-card.validated {
  background: #f0fdf4;
  border-color: #86efac;
}

.monthly-card-left {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  flex: 1;
}

.monthly-card-name {
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.monthly-card-tech {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  color: #ffffff;
  font-weight: 700;
  flex-shrink: 0;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}

.monthly-card-badge {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  flex-shrink: 0;
}

.monthly-card-icons {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  font-size: 0.75rem;
}

/* Bouton déclencheur Vue Mensuelle dans le planning */
.btn-monthly-trigger {
  background: linear-gradient(135deg, #1e3a8a, #0284c7) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 700 !important;
  padding: 6px 14px !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35) !important;
  transition: all 0.2s ease !important;
  cursor: pointer;
}

.btn-monthly-trigger:hover {
  background: linear-gradient(135deg, #172554, #0369a1) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.45) !important;
}

/* ============================================================
   STOCK ENTREPÔT
   ============================================================ */
.warehouse-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.warehouse-form {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px 24px;
  display: flex;
  gap: 16px;
  align-items: flex-end;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.warehouse-fields {
  display: flex;
  gap: 16px;
  flex: 1;
  flex-wrap: wrap;
}

.warehouse-fields .field {
  flex: 1;
  min-width: 200px;
}

.warehouse-table-full {
  width: 100%;
}

.col-photo {
  width: 70px;
  text-align: center;
}

.warehouse-thumb-wrap {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.warehouse-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.warehouse-thumb-placeholder {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
  font-size: 1.5rem;
}

.warehouse-qty-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-step {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
  line-height: 1;
}

.btn-step-minus:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #dc2626;
  transform: scale(1.05);
}

.btn-step-plus:hover {
  background: #dcfce7;
  border-color: #22c55e;
  color: #16a34a;
  transform: scale(1.05);
}

.warehouse-qty-input {
  width: 80px !important;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
}

.warehouse-qty-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Print layout pour le planning mensuel */
@media print {
  .sidebar, .view-head-actions, .hint, #m-prev, #m-next, #m-today, #btn-to-monthly,
  .monthly-head-left .btn, #monthly-filter-tech, #monthly-print, #logout {
    display: none !important;
  }
  .app {
    display: block !important;
  }
  .main {
    height: auto !important;
    overflow: visible !important;
    background: #fff !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .view {
    padding: 0 !important;
  }
  .monthly-container {
    border: none !important;
    box-shadow: none !important;
    min-height: auto !important;
  }
  .monthly-grid-body {
    overflow: visible !important;
  }
  .monthly-visits-list {
    overflow: visible !important;
    max-height: none !important;
  }
}