/* ==========================================================================
   Veloffice - thème Genève Roule
   Marque : rouge #C40000, jaune #FAC700 (accents, jamais en grands aplats).
   Fonds clairs/neutres. Mode sombre via :root[data-theme="dark"].
   Police Montserrat.
   ========================================================================== */

:root {
  /* Marque (identiques en clair/sombre) */
  --brand:      #C40000;
  --brand-dark: #9e0000;
  --jaune:      #FAC700;
  --vert:       #2E9E4F;   /* sémantique : confirmer / valider */

  /* Couleurs par type de réservation (le calendrier reste inchangé) */
  --type-semaine: #2b6cb0;
  --type-journee: #B8860B;
  --type-soir:    #6f42c1;
  --type-courte:  #2E9E4F;

  /* Surfaces - thème CLAIR (défaut) */
  --bg:          #f4f5f7;
  --surface:     #ffffff;
  --surface-2:   #f8fafc;
  --sidebar-bg:  #C40000;   /* rouge corporate (essai) */
  --sidebar-txt: rgba(255,255,255,.9);
  --sidebar-muted: rgba(255,255,255,.62);
  --text:        #262a31;
  --text-soft:   #626b78;
  --border:      #e3e7ec;

  --r: 10px;
  --shadow:    0 2px 10px rgba(20,24,31,.07);
  --shadow-lg: 0 12px 40px rgba(20,24,31,.22);
  font-size: 15px;
}

:root[data-theme="dark"] {
  /* Lie de vin foncé : bordeaux profond, pour rester dans le thème */
  --bg:          #1a090d;
  --surface:     #2a1016;
  --surface-2:   #34151c;
  --sidebar-bg:  #5c0d16;
  --sidebar-txt: rgba(255,255,255,.9);
  --sidebar-muted: rgba(255,255,255,.62);
  --text:        #f3e8ea;
  --text-soft:   #c9abb0;
  --border:      #4a2028;
  --shadow:    0 2px 10px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Montserrat', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
/* Image de fond plein écran, ~10% de visibilité (texture discrète) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url("/assets/img/bg.jpg") center / cover no-repeat;
  opacity: .1;
}
button { font-family: inherit; cursor: pointer; }
.app-loading { display: grid; place-items: center; height: 100vh; color: var(--text-soft); }

/* ==========================================================================
   LOGIN
   ========================================================================== */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 50% 0%, rgba(92,13,22,.9) 0%, rgba(26,9,13,.92) 75%), url("/assets/img/bg.jpg") center / cover no-repeat;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-lg);
}
.lc-head { background: var(--brand); padding: 14px 20px; text-align: center; }
.lc-head img { max-width: 228px; height: auto; display: inline-block; vertical-align: middle; }
.lc-body { padding: 28px 32px 32px; }
.login-card h1 { margin: 0 0 4px; font-size: 1.4rem; color: var(--brand); }
.lc-title { text-align: center; margin: 0 0 14px; line-height: 1; }
.lt-velo { font-size: 2.3rem; font-weight: 800; color: var(--brand); }
.lt-ffice { font-size: 1.9rem; font-weight: 700; color: var(--jaune); }
.login-card .sub { margin: 0 0 24px; color: var(--text-soft); font-size: .9rem; }
.lc-spot {
  width: 100%; margin: 2px 0 22px; padding: 10px 40px 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; font-family: inherit; font-size: .9rem;
  color: var(--text); cursor: pointer; appearance: none; -webkit-appearance: none;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C40000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 18px;
}
.lc-spot:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.login-card label { display: block; font-weight: 600; font-size: .82rem; margin: 14px 0 6px; }
.login-card input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: var(--r); font-size: 1rem; background: var(--surface); color: var(--text);
}
.login-card input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.login-err {
  margin-top: 14px; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca;
  padding: 8px 10px; border-radius: var(--r); font-size: .85rem; display: none;
}
.login-err.show { display: block; }

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.layout { display: grid; grid-template-columns: 260px 1fr; height: 100vh; }

/* --- Sidebar neutre foncée ------------------------------------------------ */
.sidebar {
  background: var(--sidebar-bg); color: var(--sidebar-txt); display: flex; flex-direction: column;
  padding: 18px 14px; gap: 18px; overflow: hidden;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 6px 6px 2px; }
.brand-logo { width: 93px; max-width: 100%; height: auto; display: block; margin-left: 0; align-self: flex-start; }
.wordmark { font-weight: 800; font-size: 1.6rem; letter-spacing: 0; line-height: 1; }
.wm-velo { color: #fff; }
.wm-ffice { color: var(--jaune); font-size: 83%; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: 0; color: var(--sidebar-txt); padding: 11px 12px;
  border-radius: 10px; font-size: .92rem; font-weight: 600; position: relative;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}
.nav button .ico { display: inline-grid; place-items: center; width: 22px; height: 22px; color: #fff; }
.nav button .ico svg { width: 20px; height: 20px; display: block; }
/* Survol et actif : soulèvement + trait doré (option 3). */
.nav button::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: 5px; height: 2px;
  background: var(--jaune); transform: scaleX(0); transform-origin: left; transition: transform .22s ease;
}
.nav button:hover { background: rgba(255,255,255,.10); color: #fff; transform: translateY(-2px); box-shadow: 0 7px 15px rgba(0,0,0,.22); }
.nav button:hover::after { transform: scaleX(1); }
.nav button.active { background: rgba(0,0,0,.26); color: #fff; transform: translateY(-2px); box-shadow: 0 7px 16px rgba(0,0,0,.30); }
.nav button.active::after { transform: scaleX(1); }

.rail-mid { margin-top: auto; display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; }
.returns { display: flex; flex-direction: column; min-height: 0; flex-shrink: 0; }
.returns h3 {
  font-size: .72rem; text-transform: uppercase; letter-spacing: 1px;
  color: var(--jaune); margin: 0 6px 8px;
}
.returns-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 2px; }
.return-item {
  background: rgba(255,255,255,.05); border-radius: 8px; padding: 8px 10px;
  font-size: .82rem; cursor: pointer; border-left: 3px solid transparent;
}
.return-item:hover { background: rgba(255,255,255,.1); }
.return-item .who { color: #fff; font-weight: 600; }
.return-item .when { color: var(--sidebar-muted); font-size: .76rem; }
.return-item.late { border-left-color: var(--brand); }
.return-item.late .when { color: #f4a3a3; }

.me { display: flex; align-items: center; gap: 10px; padding: 10px 6px 2px; border-top: 1px solid rgba(255,255,255,.1); }
.me .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; color: var(--brand); font-weight: 700; font-size: .85rem;
  border: 2px solid var(--jaune); overflow: hidden;
}
.me .avatar img { width: 100%; height: 100%; object-fit: cover; }
.me .name { color: #fff; font-size: .85rem; font-weight: 600; line-height: 1.1; }
.me .role { color: var(--sidebar-muted); font-size: .72rem; }
.me .icon-btn { background: transparent; border: 0; color: var(--sidebar-muted); font-size: 1.1rem; padding: 4px; }
.me .icon-btn:hover { color: #fff; }
.me .logout { margin-left: auto; }

/* --- Notes / post-its d'équipe -------------------------------------------- */
.notes-box { flex-shrink: 0; }
.notes-box h3 { display: flex; align-items: center; justify-content: space-between; font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--jaune); margin: 0 6px 8px; }
.note-add-btn { background: rgba(255,255,255,.18); color: #fff; border: 0; width: 20px; height: 20px; border-radius: 6px; font-size: 1.05rem; line-height: .9; display: grid; place-items: center; }
.note-add-btn:hover { background: rgba(255,255,255,.3); }
.note-form { display: none; padding: 0 4px 8px; }
.note-form.show { display: block; }
.note-form input { width: 100%; padding: 7px 9px; border: 0; border-radius: 7px; font-size: .82rem; }
.notes-list { display: flex; flex-direction: column; gap: 7px; }
.postit { background: var(--jaune); color: #3a2e00; border-radius: 8px; font-size: .82rem; box-shadow: 0 2px 6px rgba(0,0,0,.22); overflow: hidden; }
.postit.done { opacity: .6; }
.pi-head { width: 100%; display: flex; align-items: center; gap: 8px; background: transparent; border: 0; padding: 8px 10px; font-weight: 700; font-size: .8rem; color: #3a2e00; text-align: left; cursor: pointer; }
.pi-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.postit.done .pi-title { text-decoration: line-through; }
.pi-chev { font-size: .7rem; transition: transform .15s ease; }
.postit.open .pi-chev { transform: rotate(90deg); }
.pi-body { display: none; padding: 0 10px 8px; }
.postit.open .pi-body { display: block; }
.pi-text { line-height: 1.25; word-break: break-word; white-space: pre-wrap; }
.postit.done .pi-text { text-decoration: line-through; }
.pi-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; font-size: .68rem; color: #6b5600; font-weight: 700; gap: 6px; }
.pi-actions { display: flex; gap: 3px; }
.pi-actions button { background: rgba(0,0,0,.1); border: 0; width: 19px; height: 19px; border-radius: 5px; font-size: .78rem; line-height: 1; color: #3a2e00; }
.pi-actions button:hover { background: rgba(0,0,0,.2); }
.note-empty { font-size: .76rem; color: rgba(255,255,255,.6); padding: 2px 6px; }

/* ==========================================================================
   Bouton flottant + panneau « Prochains retours » (droite)
   ========================================================================== */
.fab-returns {
  position: fixed; right: 22px; bottom: 22px; width: 48px; height: 48px; border-radius: 50%;
  background: var(--vert); color: #fff; border: 0; box-shadow: var(--shadow-lg);
  display: grid; place-items: center; z-index: 44;
}
.fab-num { font-size: 1.4rem; font-weight: 800; line-height: 1; color: #fff; }
.fab-late {
  position: absolute; top: -4px; right: -4px; min-width: 24px; height: 24px; padding: 0 5px;
  background: #e11d1d; color: #fff; border: 2px solid #fff; border-radius: 12px;
  font-size: .8rem; font-weight: 800; display: grid; place-items: center;
  animation: fablate 1.1s ease-in-out infinite;
}
@keyframes fablate {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225,29,29,.6); }
  50%      { box-shadow: 0 0 0 7px rgba(225,29,29,0); }
}

.returns-drawer-backdrop { position: fixed; inset: 0; background: rgba(15,17,21,.35); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 46; }
.returns-drawer-backdrop.show { opacity: 1; pointer-events: auto; }
.returns-drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 330px; max-width: 90vw;
  background: var(--surface); box-shadow: var(--shadow-lg); z-index: 47;
  transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column;
}
.returns-drawer.show { transform: translateX(0); }
.rd-head { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.rd-head h3 { margin: 0; color: var(--brand); font-size: .85rem; text-transform: uppercase; letter-spacing: 1px; }
.rd-head .close { margin-left: auto; background: transparent; border: 0; font-size: 2.1rem; color: var(--text-soft); line-height: 1; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; }
.rd-head .close:hover { color: var(--brand); background: var(--bg); }
.rd-list { padding: 14px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.rd-empty { color: var(--text-soft); font-size: .85rem; text-align: center; padding: 24px; }
.returns-drawer .return-item { background: var(--surface-2); border-left-width: 3px; border-left-style: solid; border-left-color: transparent; }
.returns-drawer .return-item .who { color: var(--text); display: flex; align-items: center; }
.returns-drawer .return-item .when { color: var(--text-soft); }
.returns-drawer .return-item.late { border-left-color: #e11d1d; }
.returns-drawer .return-item.late .when { color: #b91c1c; }

/* --- Zone centrale -------------------------------------------------------- */
.main { display: flex; flex-direction: column; overflow: hidden; background: transparent; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 22px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar h2 { margin: 0; font-size: 1.05rem; color: var(--text); text-transform: capitalize; white-space: nowrap; }
.tb-left { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-center { display: flex; align-items: center; gap: 12px; }
.tb-right { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.nav-dates { display: flex; align-items: center; gap: 6px; }
.nav-dates button {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--jaune) 16%, var(--surface)); font-size: 1rem; color: var(--text);
}
.nav-dates button:hover { border-color: var(--brand); color: var(--brand); }
.today-btn { width: auto !important; padding: 0 12px; font-weight: 600; font-size: .85rem !important; }

.view-switch { margin-left: auto; display: inline-flex; background: var(--bg); border-radius: 9px; padding: 3px; }
.view-switch button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 7px;
  font-size: .85rem; font-weight: 600; color: var(--text-soft);
}
.view-switch button.active { background: color-mix(in srgb, var(--jaune) 16%, var(--surface)); color: var(--brand); box-shadow: var(--shadow); }

.theme-toggle {
  width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-soft); font-size: 1.05rem; display: grid; place-items: center;
}
.theme-toggle:hover { color: var(--brand); border-color: var(--brand); }
.help-btn svg { width: 22px; height: 22px; }

.help-doc { font-size: .9rem; }
.help-doc .help-toc { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin: 0 0 18px; }
.help-doc .help-toc > b { display: block; margin-bottom: 6px; color: var(--brand); }
.help-doc .help-toc ol { margin: 0; padding-left: 20px; }
.help-doc .help-toc li { margin: 3px 0; }
.help-doc .help-toc a { color: var(--text); cursor: pointer; text-decoration: none; }
.help-doc .help-toc a:hover { color: var(--brand); text-decoration: underline; }
.help-doc .help-item { padding: 14px 0; border-top: 1px solid var(--border); }
.help-doc .help-item > b { display: block; margin-bottom: 5px; color: var(--brand); font-size: 1rem; }
.help-doc .help-item p { margin: 6px 0 0; line-height: 1.55; color: var(--text); }
.help-doc .help-item ul { margin: 7px 0 0; padding-left: 18px; }
.help-doc .help-item li { margin: 4px 0; line-height: 1.5; }

.help-install-btn, .install-guide .ig-install {
  background: var(--brand); color: #fff; border: 0; border-radius: 9px;
  padding: 11px 18px; font-family: inherit; font-weight: 700; font-size: .9rem;
}
.help-install-btn:hover, .install-guide .ig-install:hover { background: var(--brand-dark); }
.install-guide { font-size: .9rem; }
.install-guide .ig-intro { color: var(--text-soft); margin: 0 0 16px; line-height: 1.55; }
.install-guide .ig-install { display: block; width: 100%; margin: 0 0 20px; }
.install-guide .ig-label { font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .6px; color: var(--text-soft); margin: 0 0 8px; }
.install-guide .ig-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.install-guide .ig-chip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 7px 14px; font-family: inherit; font-size: .82rem; color: var(--text); }
.install-guide .ig-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.install-guide .ig-steps { margin: 0 0 16px; padding-left: 22px; }
.install-guide .ig-steps li { margin: 9px 0; line-height: 1.55; }
.install-guide .ig-check { display: flex; align-items: center; gap: 9px; font-size: .85rem; color: var(--text); padding-top: 14px; border-top: 1px solid var(--border); cursor: pointer; }
.install-guide .ig-check input { width: 16px; height: 16px; accent-color: var(--brand); }

.legend { display: flex; gap: 14px; padding: 8px 22px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-soft); }
.legend .dot { width: 11px; height: 11px; border-radius: 3px; }
.lg-avalider { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; background: var(--jaune); color: #fff; font-weight: 800; font-size: .92rem; padding: 4px 13px; border-radius: 20px; text-shadow: 0 1px 1px rgba(0,0,0,.18); }
.lg-avalider b { background: #fff; color: #4a3800; min-width: 20px; height: 20px; border-radius: 10px; display: inline-grid; place-items: center; font-size: .78rem; padding: 0 5px; text-shadow: none; }
.lg-avalider.has { animation: avpulse 1.6s ease-in-out infinite; }
@keyframes avpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(184,166,12,.5); } 50% { box-shadow: 0 0 0 6px rgba(184,166,12,0); } }

.canvas { flex: 1; overflow: auto; padding: 18px 22px; }

/* Bandeau d'alerte « à valider » : blanc, centré, clignotant */
.avalider-banner {
  display: flex; align-items: center; justify-content: center; text-align: center;
  margin-bottom: 16px; padding: 13px 16px; border-radius: 10px; cursor: pointer;
  background: var(--jaune); color: #fff; font-weight: 800;
}
.avalider-banner b { font-size: 1.15rem; margin-right: 5px; }
.avalider-banner:hover { filter: brightness(.97); }
.avalider-banner.flash { animation: abflash .5s ease-in-out 5; }
@keyframes abflash {
  0%, 100% { background: #e11d1d; box-shadow: 0 0 0 0 rgba(196,0,0,.5); transform: scale(1); }
  50%      { background: var(--jaune); box-shadow: 0 0 0 9px rgba(196,0,0,0); transform: scale(1.015); }
}

/* Indicateur vert « tout est validé » (haut à droite) */
.lg-right { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; }
/* Bouton taille d'origine, avec un peu d'air au-dessus et en dessous. */
.legend .btn-add { margin: 4px 0; }
/* .legend .lg-clear : specificite (0,2,0) pour passer DEVANT « .legend span »
   (0,1,1) qui met le texte en gris, sinon le blanc ne s'applique pas. */
.legend .lg-clear {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--vert); color: #fff; font-weight: 700; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .5px; padding: 5px 13px; border-radius: 20px;
}
.legend .lg-clear::before { content: '✓'; font-weight: 900; color: #fff; }

/* --- Infobulles d'aide ---------------------------------------------------- */
.tooltip {
  position: fixed; z-index: 9999; max-width: 240px;
  --tip-bg: #2b3038; --tip-fg: #fff; --arrow: 20px;
  background: var(--tip-bg); color: var(--tip-fg);
  font-size: .78rem; font-weight: 600; line-height: 1.35;
  padding: 7px 11px; border-radius: 9px;
  box-shadow: 0 6px 22px rgba(20, 24, 31, .22);
  pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease;
}
:root[data-theme="dark"] .tooltip { --tip-bg: #f3e8ea; --tip-fg: #241016; box-shadow: 0 6px 22px rgba(0, 0, 0, .5); }
.tooltip.measure { transition: none; }
.tooltip.show { opacity: 1; transform: translateY(0); }
.tooltip::after {
  content: ''; position: absolute; left: var(--arrow); transform: translateX(-50%);
  top: 100%; border: 6px solid transparent; border-top-color: var(--tip-bg);
}
.tooltip.below::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--tip-bg); }
:root[data-tips="off"] .tooltip { display: none; }

/* --- Interrupteur (reglages) ---------------------------------------------- */
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.pref-title { font-weight: 600; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--border); border-radius: 26px; transition: .2s; cursor: pointer; }
.slider::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ==========================================================================
   CALENDRIER - vue mois
   ========================================================================== */
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.month .dow { background: var(--surface); text-align: center; padding: 8px; font-size: .74rem; font-weight: 700; color: var(--text-soft); text-transform: uppercase; }
.day-cell { background: var(--surface); min-height: 108px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.day-cell.out { background: var(--surface-2); }
.day-cell .num { font-size: .8rem; font-weight: 600; color: var(--text-soft); }
.day-cell.today { background: color-mix(in srgb, var(--jaune) 16%, var(--surface)); }
.day-cell.today .num { color: var(--text); font-weight: 800; }
.day-cell.closed { background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 8px, var(--surface-2) 8px, var(--surface-2) 16px); }
.day-cell .closed-tag { font-size: .68rem; color: #b45309; font-weight: 600; }

.chip {
  border-radius: 6px; padding: 3px 7px; font-size: .74rem; color: #fff; font-weight: 600;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 3px solid rgba(0,0,0,.18);
}
.chip.semaine { background: var(--type-semaine); }
.chip.journee { background: var(--type-journee); }
.chip.soir    { background: var(--type-soir); }
.chip.courte  { background: var(--type-courte); }
.chip.avalider {
  background: var(--jaune); color: #4a3800; border-left-color: #b8860b;
  animation: pulse 1.4s ease-in-out infinite;
}
/* Heure de prise (vert) / heure de retour (rouge) dans les pastilles.
   Halo sombre pour rester lisible sur les fonds colorés (bleu, or, violet, vert). */
.chip .i-pick { color: #26f08a; font-weight: 700; text-shadow: 0 0 2px rgba(0,0,0,.7); }
.chip .i-ret  { color: #ff5555; font-weight: 700; text-shadow: 0 0 2px rgba(0,0,0,.7), 0 0 6px rgba(255,45,45,.6); }
/* Pastille jaune "À valider" : fond clair, on repasse en couleurs foncées sans halo. */
.chip.avalider .i-pick { color: #0a7a34; text-shadow: none; }
.chip.avalider .i-ret  { color: #c81e1e; text-shadow: none; }
/* Annulée / rejetée : grisée et barrée, mais toujours cliquable pour la retirer. */
.chip.is-cont { border-left-style: dashed; opacity: .92; }
.chip.is-cancelled { opacity: .45; text-decoration: line-through; }
.rcard.is-cancelled { opacity: .5; }
.rcard.is-cancelled .rc-who { text-decoration: line-through; }
.act-note { font-size: .85rem; color: var(--text-soft); margin: 0 0 10px; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(250,199,0,.6); }
  50%     { box-shadow: 0 0 0 5px rgba(250,199,0,0); }
}

/* --- vue agenda (jour / semaine) ----------------------------------------- */
.agenda { display: flex; flex-direction: column; gap: 20px; }
.agenda-day h4 { margin: 0 0 8px; color: var(--brand); font-size: .92rem; text-transform: capitalize; }
.agenda-row {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--border); border-left: 4px solid var(--border);
  border-radius: var(--r); padding: 10px 14px; cursor: pointer; box-shadow: var(--shadow);
}
.agenda-row:hover { border-color: var(--brand); }
.agenda-row.semaine { border-left-color: var(--type-semaine); }
.agenda-row.journee { border-left-color: var(--type-journee); }
.agenda-row.soir    { border-left-color: var(--type-soir); }
.agenda-row.courte  { border-left-color: var(--type-courte); }
.agenda-row.avalider { border-left-color: var(--jaune); background: color-mix(in srgb, var(--jaune) 8%, var(--surface)); }
.agenda-row .time { font-weight: 700; color: var(--text); min-width: 96px; font-size: .85rem; }
.agenda-row .who { font-weight: 600; }
.agenda-row .badge-type { margin-left: auto; font-size: .72rem; padding: 3px 9px; border-radius: 20px; font-weight: 700; }
.badge-type.semaine { background: color-mix(in srgb, var(--type-semaine) 15%, var(--surface)); color: var(--type-semaine); }
.badge-type.journee { background: color-mix(in srgb, var(--type-journee) 18%, var(--surface)); color: var(--type-journee); }
.badge-type.soir    { background: color-mix(in srgb, var(--type-soir) 15%, var(--surface)); color: var(--type-soir); }
.badge-type.courte  { background: color-mix(in srgb, var(--type-courte) 15%, var(--surface)); color: var(--type-courte); }
.badge-type.avalider{ background: color-mix(in srgb, var(--jaune) 25%, var(--surface)); color: #92600a; }
.empty { color: var(--text-soft); text-align: center; padding: 40px; }

/* Vues Semaine / Jour : pastilles verticales « style blog », qui s'alignent et passent à la ligne */
.rcards { display: flex; flex-wrap: wrap; gap: 12px; }
.rcard {
  width: 162px; background: var(--surface); border: 1px solid var(--border);
  border-top: 4px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 7px; align-items: flex-start;
}
.rcard:hover { border-color: var(--brand); }
.rcard.semaine { border-top-color: var(--type-semaine); }
.rcard.journee { border-top-color: var(--type-journee); }
.rcard.soir    { border-top-color: var(--type-soir); }
.rcard.courte  { border-top-color: var(--type-courte); }
.rcard.avalider { border-top-color: var(--jaune); background: color-mix(in srgb, var(--jaune) 8%, var(--surface)); }
.rc-time { font-weight: 800; font-size: .95rem; color: var(--text); }
.rc-time span { font-weight: 600; font-size: .76rem; color: var(--text-soft); }
/* Capsule Prise (vert) / Retour (rouge), sous le nom, sur les cartes agenda. */
.rc-cap {
  display: inline-flex; flex-direction: column; gap: 1px;
  background: color-mix(in srgb, var(--text) 6%, var(--surface));
  border: 1px solid var(--border); border-radius: 10px;
  padding: 4px 9px; font-size: .72rem; line-height: 1.3; font-weight: 700;
}
.rc-cap .i-pick { color: #12994a; }
.rc-cap .i-ret  { color: #e0242b; }
:root[data-theme="dark"] .rc-cap .i-pick { color: #3ee089; }
:root[data-theme="dark"] .rc-cap .i-ret  { color: #ff6b6b; }
.rc-cap .i-cont { color: var(--text-soft); }
.rc-who { font-weight: 600; font-size: .9rem; display: flex; align-items: center; }

/* ==========================================================================
   PANNEAU DÉTAIL RÉSERVATION (droite)
   ========================================================================== */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(15,17,21,.4); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.drawer-backdrop.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 92vw;
  background: var(--surface); box-shadow: var(--shadow-lg); z-index: 50;
  transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column;
}
.drawer.show { transform: translateX(0); }
.drawer-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 10px; }
.drawer-head .close { margin-left: auto; background: transparent; border: 0; font-size: 1.4rem; color: var(--text-soft); line-height: 1; }
.drawer-head h3 { margin: 0; font-size: 1.1rem; color: var(--text); }
.status-pill { display: inline-block; margin-top: 6px; font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.review-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 18px; background: color-mix(in srgb, var(--jaune) 18%, var(--surface)); border-bottom: 1px solid var(--border); }
.review-nav .rv-btn { background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 7px 12px; font-weight: 700; font-size: .82rem; white-space: nowrap; }
.review-nav .rv-btn:hover { background: var(--brand-dark); }
.review-nav .rv-pos { font-size: .76rem; font-weight: 700; color: var(--text-soft); text-align: center; }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.field { margin-bottom: 14px; }
.field .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft); font-weight: 700; }
.field .v { font-size: .95rem; margin-top: 2px; color: var(--text); }
.field a { color: var(--brand); text-decoration: none; }
.mail-sent {
  display: flex; align-items: center; gap: 9px; margin-top: 10px; padding: 9px 11px;
  background: color-mix(in srgb, var(--vert) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--vert) 28%, var(--surface));
  border-radius: 8px; font-size: .8rem; color: var(--text); line-height: 1.35;
}
.mail-sent .mini-av { margin-right: 0; flex-shrink: 0; }
/* Réponse du client (via la page publique) affichée sous l'info d'envoi. */
.client-reply {
  margin-top: 8px; padding: 9px 11px; border-radius: 8px; font-size: .8rem;
  line-height: 1.4; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
}
.client-reply.ok {
  background: color-mix(in srgb, var(--vert) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--vert) 32%, var(--surface));
}
.client-reply .cr-when { color: var(--text-soft); font-size: .75rem; }
.drawer-actions { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.btn {
  border: 0; border-radius: var(--r); padding: 11px 14px; font-size: .9rem; font-weight: 700;
  color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn-approve { background: var(--vert); }
.btn-reject  { background: var(--brand); }
.btn-cancel  { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-late    { background: var(--type-journee); }
.btn-return  { background: var(--vert); }
.btn-call    { background: var(--type-semaine); }
.btn-mail    { background: var(--brand); }
.act-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .6px; color: var(--text-soft); font-weight: 700; margin: 8px 0 1px; padding: 0 2px; }
.act-group:first-child { margin-top: 0; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* ==========================================================================
   PANNEAUX (stats, réglages, équipe)
   ========================================================================== */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); max-width: 720px; }
.panel h3 { margin: 0 0 16px; color: var(--brand); }
.stat-row { margin-bottom: 16px; }
.stat-row .top { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: 5px; }
.stat-row .top b { font-weight: 700; }
.bar { height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 6px; }
.bar.semaine > span { background: var(--type-semaine); }
.bar.journee > span { background: var(--type-journee); }
.bar.soir > span    { background: var(--type-soir); }
.bar.courte > span  { background: var(--type-courte); }

form.stack { display: flex; flex-direction: column; gap: 12px; }
form.stack label { font-weight: 600; font-size: .82rem; }
form.stack input, form.stack select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); font-size: .95rem;
  background: var(--surface); color: var(--text);
}
.cta { background: var(--brand); color: #fff; border: 0; border-radius: var(--r); padding: 12px 18px; font-weight: 700; align-self: flex-start; }
.cta:hover { background: var(--brand-dark); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #23262e; color: #fff; padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 100; font-size: .9rem; opacity: 0; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.err { background: var(--brand); }

table.team { width: 100%; border-collapse: collapse; }
table.team th, table.team td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); font-size: .88rem; }
table.team th { font-size: .72rem; text-transform: uppercase; color: var(--text-soft); }
.team-actions { display: flex; gap: 14px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.team-actions .link-btn { padding: 0; }

.seuil-types { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 2px 0 6px; background: var(--surface-2); }
.seuil-types .st-title { font-size: .82rem; font-weight: 700; margin-bottom: 10px; }
.st-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.st-row .dot { width: 13px; height: 13px; border-radius: 4px; flex: none; }
.st-row .st-name { flex: 1; font-size: .88rem; }
.st-row input { width: 90px; }
.st-row .st-unit { font-size: .8rem; color: var(--text-soft); width: 26px; }
.tag { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.tag.on { background: color-mix(in srgb, var(--vert) 16%, var(--surface)); color: #1c6b34; }
.tag.off { background: #fde8e8; color: #b91c1c; }
.tag.wait { background: color-mix(in srgb, var(--jaune) 22%, var(--surface)); color: #7a5c00; }

/* Séparateur « creusé » (effet 3D) + contact technique en bas de l'équipe */
.tech-sep { height: 0; margin: 16px 2px 12px; border-top: 1px solid rgba(0,0,0,.18); box-shadow: 0 1px 0 rgba(255,255,255,.45); }
.tech-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 15px;
  background: color-mix(in srgb, var(--jaune) 24%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--jaune) 50%, var(--surface));
  border-radius: 14px;
}
.tech-card .mini-av { width: 36px; height: 36px; margin-right: 0; flex-shrink: 0; font-size: .74rem; }
.tech-name { font-weight: 700; font-size: .9rem; color: var(--text); }
.tech-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 3px; font-size: .82rem; }
.tech-links a { color: var(--brand); text-decoration: none; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; width: 260px; height: 100vh; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.show { transform: translateX(0); }
  .topbar { position: sticky; top: 0; }
  .burger { display: inline-grid !important; }
  .day-cell { min-height: 72px; }
  .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,17,21,.45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .side-backdrop.show { opacity: 1; pointer-events: auto; }
}
.side-backdrop { display: none; }
.burger { display: none; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--brand); color: var(--jaune); place-items: center; font-size: 1.25rem; box-shadow: var(--shadow); }
.burger:hover { background: var(--brand-dark); }


/* ==========================================================================
   Bouton + Réservation, groupe droite de la topbar
   ========================================================================== */
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.view-switch { margin-left: 0; }
.btn-add { background: var(--brand); color: #fff; border: 0; border-radius: 9px; padding: 9px 16px; font-weight: 700; font-size: .88rem; white-space: nowrap; }
.btn-add:hover { background: var(--brand-dark); }

/* --- Sous-onglets (Stats) ------------------------------------------------- */
.subtabs { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 3px; margin-bottom: 16px; }
.subtabs button { border: 0; background: transparent; padding: 7px 16px; border-radius: 7px; font-weight: 600; font-size: .85rem; color: var(--text-soft); }
.subtabs button.active { background: var(--brand); color: #fff; }

/* --- Historique (teaser) -------------------------------------------------- */
.teaser { position: relative; }
.teaser-ribbon {
  background: color-mix(in srgb, var(--jaune) 22%, var(--surface)); color: #7a5c00; font-weight: 700;
  font-size: .78rem; padding: 8px 12px; border-radius: 8px; margin-bottom: 14px;
  border: 1px solid color-mix(in srgb, var(--jaune) 45%, var(--surface));
}
.muted { color: var(--text-soft); }
.hist-top { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; margin: 12px 0 20px; }
.pie { width: 170px; height: 170px; border-radius: 50%; box-shadow: var(--shadow); flex-shrink: 0; }
.pie-legend { display: flex; flex-direction: column; gap: 9px; font-size: .9rem; }
.pie-legend .dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-right: 9px; }
.hist-h { color: var(--text); margin: 6px 0 8px; }
.excel-wrap { position: relative; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.excel { width: 100%; border-collapse: collapse; font-size: .85rem; opacity: .5; }
.excel th, .excel td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.excel th { background: var(--surface-2); font-size: .72rem; text-transform: uppercase; color: var(--text-soft); }
.excel-veil {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 10px;
  font-weight: 700; color: var(--text-soft); background: color-mix(in srgb, var(--surface) 45%, transparent);
}

/* --- Champ grisé (réglage indisponible) ----------------------------------- */
.field-disabled { opacity: .8; }
.field-disabled .hint { display: block; font-size: .75rem; color: var(--text-soft); margin-top: 4px; }
.field-disabled input:disabled { background: var(--surface-2); cursor: not-allowed; }

/* --- Modal ---------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,17,21,.5); display: grid; place-items: center; z-index: 80; padding: 20px; opacity: 0; transition: opacity .15s; }
.modal-backdrop.show { opacity: 1; }
.modal-card { background: var(--surface); border-radius: 14px; width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; color: var(--text); font-size: 1.1rem; }
.modal-head .close { margin-left: auto; background: transparent; border: 0; font-size: 1.5rem; color: var(--text-soft); line-height: 1; }
.modal-body { padding: 18px 20px; }
.row2 { display: flex; gap: 12px; }
.row2 > div { flex: 1; }
.link-btn { background: transparent; border: 0; color: var(--brand); font-weight: 600; font-size: .85rem; padding: 6px 0; text-align: left; align-self: flex-start; }
.resolved { font-size: .82rem; min-height: 1em; margin-top: 4px; }

/* ==========================================================================
   Avatars (photo de profil) + marqueur de retard
   ========================================================================== */
.photo-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.avatar-lg {
  width: 66px; height: 66px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 1.4rem;
  border: 3px solid var(--jaune); overflow: hidden; flex-shrink: 0;
}
.avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
/* Avatar cliquable pour changer la photo (survol = voile « Changer »). */
.photo-pick { position: relative; cursor: pointer; }
.photo-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.5); color: #fff; font-size: .7rem; font-weight: 700;
  border-radius: 50%; opacity: 0; transition: opacity .15s;
}
.photo-pick:hover .photo-overlay { opacity: 1; }
.btn-photo {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--brand); color: var(--brand);
  font-weight: 700; font-size: .85rem; padding: 8px 14px; border-radius: 9px;
}
.btn-photo:hover { background: var(--brand); color: #fff; }
.btn-photo .bp-ico { font-size: 1rem; line-height: 1; }
.edit-resend { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

.stat-period { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.stat-period button { background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 7px 14px; font-family: inherit; font-size: .82rem; color: var(--text); }
.stat-period button:hover { border-color: var(--brand); color: var(--brand); }
.stat-period button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.stat-range { font-size: .8rem; color: var(--text-soft); margin: -4px 0 14px; }
.mini-av {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: .66rem; font-weight: 700; overflow: hidden;
  vertical-align: middle; margin-right: 9px; border: 1.5px solid var(--jaune);
}
.mini-av img { width: 100%; height: 100%; object-fit: cover; }

/* ==========================================================================
   Réglages : page à sous-menu vertical
   ========================================================================== */
.settings { display: flex; gap: 20px; align-items: flex-start; }
.settings-menu {
  display: flex; flex-direction: column; gap: 4px; width: 180px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 8px; box-shadow: var(--shadow); position: sticky; top: 18px;
}
.settings-menu button { text-align: left; background: transparent; border: 0; padding: 10px 12px; border-radius: 8px; font-weight: 600; font-size: .9rem; color: var(--text-soft); }
.settings-menu button:hover { background: var(--bg); color: var(--text); }
.settings-menu button.active { background: var(--brand); color: #fff; }
.settings-content { flex: 1; min-width: 0; }
@media (max-width: 760px) {
  .settings { flex-direction: column; }
  .settings-menu { flex-direction: row; flex-wrap: wrap; width: 100%; position: static; }
}

.late-mark {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: -4px;
  width: 18px; height: 18px; margin-right: 4px; border-radius: 50%;
  background: #e11d1d; color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.late-mark svg { width: 12px; height: 12px; }
.agenda-row .who .late-mark { width: 20px; height: 20px; }
.agenda-row .who .late-mark svg { width: 14px; height: 14px; }
.return-mark {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: -4px;
  width: 18px; height: 18px; margin-right: 4px; border-radius: 50%;
  background: var(--vert); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.return-mark svg { width: 12px; height: 12px; }
.chip.is-returned { opacity: .5; }
.rcard.is-returned { opacity: .62; }
.chip.is-late { box-shadow: inset 0 0 0 2px #b91c1c; }
.who-tag { font-weight: 600; }

/* ==========================================================================
   Barre du haut sur petit écran (placé en fin pour gagner la cascade)
   ========================================================================== */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .tb-left { order: 1; flex: 1; }
  .tb-right { order: 2; flex: 0 0 auto; }
  .tb-center { order: 3; flex: 1 0 100%; justify-content: center; margin-top: 2px; }
  .view-switch button { padding: 6px 11px; }
}
@media (max-width: 460px) {
  .btn-add { font-size: 0; padding: 9px 13px; }
  .btn-add::after { content: '+'; font-size: 1.35rem; line-height: 1; }
}
