:root {
  --brand: #0b66c3;
  --brand-dark: #084d96;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1a2230;
  --muted: #6b7280;
  --border: #e3e7ee;
  --danger: #d33;
  --success: #1c8a4d;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(16, 38, 71, 0.08);
  --surface-2: #f7f9fc;
  --hover: #f0f3f8;
  --zebra: #f3f7fc;
}

/* ---------- Thème sombre (global) ---------- */
[data-theme="dark"] {
  --brand: #3b8ae6;
  --brand-dark: #2f76c9;
  --bg: #0f1722;
  --surface: #16212e;
  --surface-2: #1d2a39;
  --text: #e6edf5;
  --muted: #9aa7b6;
  --border: #2a3a4d;
  --hover: #22303f;
  --zebra: #1a2633;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .inline-form { background: var(--surface-2); }
[data-theme="dark"] .cred-box,
[data-theme="dark"] .submenu,
[data-theme="dark"] .data-table th { background: var(--surface-2); }
[data-theme="dark"] .badge { background: #243446; }
[data-theme="dark"] .alert.error { background: #3a1f1f; border-color: #5a2a2a; color: #ff9b9b; }
[data-theme="dark"] .alert.success { background: #16331f; border-color: #234d31; color: #7fe0a3; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Boutons ---------- */
.btn-primary {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.btn-ghost:hover { background: var(--hover); text-decoration: none; }
.btn-ghost.danger { color: var(--danger); border-color: #f0caca; }
.btn-ghost.danger:hover { background: #fdecec; }
.btn-mini {
  padding: 5px 10px; font-size: 13px; border-radius: 7px;
  border: 1px solid var(--border); background: #fff; cursor: pointer;
}
.btn-mini:hover { background: var(--hover); }
.btn-mini.danger { color: var(--danger); border-color: #f0caca; }

/* ---------- Alertes ---------- */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin: 10px 0; }
.alert.error { background: #fdecec; color: var(--danger); border: 1px solid #f3c9c9; }
.alert.success { background: #e7f6ee; color: var(--success); border: 1px solid #bfe6cf; }

/* ---------- Formulaires ---------- */
.form label { display: block; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.form input[type="text"],
.form input[type="email"],
.form input[type="password"],
.form input[type="number"],
.form input[type="date"],
.form input[type="datetime-local"],
.form input[type="search"],
.form input[type="tel"] {
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 15px;
  font-weight: 400;
  background: var(--surface);
  color: var(--text);
}
.form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,102,195,.15); }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.checkbox input { width: auto; margin: 0; }

/* ---------- Page d'authentification ---------- */
.auth-page { display: flex; min-height: 100vh; }
.auth-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-card {
  background: var(--surface);
  width: 100%; max-width: 400px;
  padding: 32px 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-card .form { text-align: left; margin-top: 18px; }
.auth-card .btn-primary { width: 100%; margin-top: 4px; }
.auth-logo { width: 64px; height: 64px; object-fit: contain; }
.auth-card h1 { font-size: 22px; margin: 12px 0 4px; }

/* ---------- Barre de navigation ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 16px; min-height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 34px; height: 34px; object-fit: contain; }
.brand-text { font-size: 16px; letter-spacing: .5px; }

.nav-toggle {
  margin-left: auto; display: flex; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 9px;
  border-radius: 9px; transition: background .15s;
}
.nav-toggle:hover { background: var(--hover); }
.nav-toggle span {
  width: 24px; height: 2px; background: var(--text); border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease;
}
/* Hamburger -> croix quand le menu est ouvert */
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Menu mobile : panneau déroulant sous la barre, plutôt que tassé sur la ligne */
.mainnav {
  display: none; flex-direction: column;
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-height: calc(100vh - 60px); overflow-y: auto;
  padding: 8px 16px 14px;
}
.mainnav.open { display: flex; }

.menu { list-style: none; margin: 0; padding: 4px 0; }
.menu > li { border-radius: 9px; }
.menu > li + li { margin-top: 2px; }
.menu > li > a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 12px; color: var(--text); font-weight: 700; font-size: 15px;
  border-radius: 9px;
}
.menu > li > a:hover { background: var(--hover); text-decoration: none; }
.menu li.active > a { color: var(--brand); }
.menu li.active { background: var(--surface-2); }
.caret { font-size: 11px; transition: transform .2s ease; }
.has-sub.open > .sub-trigger .caret { transform: rotate(180deg); }

/* Sous-menus repliés par défaut sur mobile (accordéon) */
.submenu { list-style: none; margin: 0 0 4px; padding: 2px 0 6px 10px; display: none; }
.has-sub.open .submenu { display: block; }
.submenu a {
  display: block; padding: 10px 12px; color: var(--muted); font-weight: 500;
  border-radius: 8px; border-left: 2px solid var(--border);
}
.submenu a:hover { color: var(--brand); background: var(--hover); text-decoration: none; }
.submenu a.active { color: var(--brand); font-weight: 700; border-left-color: var(--brand); }

.nav-account {
  display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding: 12px 4px 4px;
  border-top: 1px solid var(--border);
}
.nav-account .who {
  font-weight: 700; padding: 4px 0;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.logout-form { margin: 0; }
.nav-account .btn-ghost, .nav-account .logout-form button { width: 100%; text-align: center; }

/* ---------- Layout applicatif ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.hero h1 { font-size: 26px; margin: 0 0 6px; }
.placeholder {
  margin-top: 24px; padding: 40px; text-align: center; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}

.cards { display: grid; gap: 16px; margin-top: 24px; grid-template-columns: 1fr; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; color: var(--text); box-shadow: var(--shadow); display: block;
}
a.card:hover { text-decoration: none; transform: translateY(-2px); transition: transform .15s; }
.card-icon { font-size: 30px; }
.card h2 { margin: 8px 0 4px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.card-links { list-style: none; padding: 0; margin: 14px 0 0; }
.card-links li { margin: 6px 0; }

/* ---------- Modale comptes ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(16,30,55,.45);
  display: flex; align-items: flex-start; justify-content: center; padding: 20px;
  z-index: 100; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 720px;
  box-shadow: var(--shadow); margin: 24px 0;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
/* Boîtes de dialogue applicatives (UI.confirm / UI.alert) — voir public/js/ui-dialog.js */
.ui-dialog-overlay { position: fixed; inset: 0; background: rgba(16,30,55,.55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 300; }
.ui-dialog { background: var(--surface); color: var(--text); border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 440px; padding: 22px 24px; animation: ui-dialog-pop .12s ease-out; }
@keyframes ui-dialog-pop { from { transform: translateY(6px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.ui-dialog-title { margin: 0 0 8px; font-size: 18px; }
.ui-dialog-msg { margin: 0 0 22px; white-space: pre-line; line-height: 1.5; color: var(--text); }
.ui-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
/* Texte (consigne) en cellule de 3 lignes avec barre de défilement */
.text-scroll {
  width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 9px; font-family: inherit; font-size: 15px; line-height: 1.5;
  background: var(--surface); color: var(--text);
  height: calc(1.5em * 3 + 22px); resize: vertical; overflow-y: auto;
}

/* Différenciation texte / question dans les modales */
.bc-meta { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.bc-text {
  background: var(--surface-2); border-left: 3px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 14px; color: var(--text); white-space: pre-wrap;
  max-height: 150px; overflow-y: auto; margin: 4px 0 12px;
}
.bc-question { font-weight: 800; font-size: 17px; color: var(--brand); margin: 14px 0 10px; }
.bc-options { display: flex; flex-direction: column; gap: 8px; }
.bc-opt { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; cursor: pointer; }
.bc-opt:hover { background: var(--hover); }
.bc-opt input { width: auto; margin: 0; }
.bc-msg { margin-right: auto; color: var(--danger); font-size: 13px; }
.bc-rep { display: flex; flex-direction: column; gap: 8px; }
.bc-rep-row { display: flex; align-items: center; gap: 8px; }
.bc-rep-label { flex: 1; }
.bc-rep-input { width: 80px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.bc-rep-total { margin-top: 10px; font-size: 15px; }

/* --- Formulaire diffusions (admin) --- */
.diff-form .field-label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; margin-bottom: 6px; }
.seg-btn { border: none; background: transparent; color: var(--muted); cursor: pointer; padding: 9px 14px; border-radius: 7px; font-size: 13px; font-weight: 600; font-family: inherit; }
.seg-btn.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.opt-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.opt-row { display: flex; gap: 8px; align-items: center; }
.opt-input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font-size: 14px; }
.target-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 9px; padding: 8px; display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.tgt-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.tgt-item:hover { background: var(--hover); }
.tgt-item input { width: auto; margin: 0; }

/* --- Barres de résultats --- */
.res-row { display: grid; grid-template-columns: 150px 1fr 110px; align-items: center; gap: 12px; margin: 10px 0; font-size: 14px; }
.res-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.res-bar { background: var(--surface-2); border-radius: 99px; height: 18px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.res-fill { background: linear-gradient(90deg, var(--brand), var(--brand-dark)); height: 100%; border-radius: 99px; transition: width .3s; min-width: 2px; }
.res-val { text-align: right; font-weight: 700; }
.res-val .muted { font-weight: 400; }
.modal-body h3 { font-size: 15px; margin: 22px 0 10px; }
.modal-body h3:first-child { margin-top: 0; }
.inline-form { background: #f7f9fc; padding: 16px; border-radius: 10px; border: 1px solid var(--border); }
.grid-3 { display: grid; gap: 12px; grid-template-columns: 1fr; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #eef2f7; color: var(--muted); }
.badge.warn { background: #fff3df; color: #a86600; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cred-box {
  margin-top: 10px; font-family: monospace; font-size: 14px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px;
}

/* Panneau d'accès par utilisateur */
.perm-row > td { background: var(--surface-2); padding: 14px !important; }
.perms-panel { display: flex; flex-direction: column; gap: 12px; }
.perms-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.perm-group { border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; margin: 0; }
.perm-group legend { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 0 4px; }
.perm-item { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 4px 0; cursor: pointer; }
.perm-item input { width: auto; margin: 0; }
.perms-actions { display: flex; align-items: center; gap: 12px; }
.perm-help { font-size: 12px; margin: 0 0 4px; }
.badge.online { background: #e7f6ee; color: #1c8a4d; }
[data-theme="dark"] .badge.online { background: #14331f; color: #7fe0a3; }
.role-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.role-pick select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-family: inherit; }
/* Grille de permissions en MATRICE alignée : Élément | Voir | Modifier | Supprimer */
.perm-head, .perm-leaf { display: grid; grid-template-columns: minmax(0, 1fr) 58px 76px 84px; align-items: center; gap: 6px; }
.perm-head { padding: 2px 0 7px; margin-bottom: 2px; border-bottom: 2px solid var(--border); }
.perm-head span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); text-align: center; }
.perm-head span:first-child { text-align: left; }
.perm-leaf { padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
.perm-leaf:last-child { border-bottom: none; }
.perm-leaf-label { font-weight: 600; line-height: 1.25; }
.perm-toggle { display: flex; align-items: center; justify-content: center; cursor: pointer; min-height: 22px; }
.perm-toggle input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.perm-toggle input:disabled { opacity: .35; cursor: not-allowed; }
.perm-toggle-txt { display: none; }
.perm-na { text-align: center; color: var(--border); user-select: none; }
/* Chaque groupe seul sur sa ligne (une colonne), largeur lisible. */
.perms-grid { grid-template-columns: 1fr; }
.perm-group { max-width: 760px; }
/* Sous-tableau imbriqué (étapes du Processus Complet) sous la ligne « Voir ». */
.perm-substeps { margin: 4px 0 8px; padding: 8px 10px 6px; border-left: 3px solid var(--brand); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.perm-substeps.is-hidden { display: none; }
.perm-substeps .perm-leaf:last-child { border-bottom: none; }
.perm-sub-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--brand); margin-bottom: 4px; }
/* Mobile : on empile chaque ligne, cases avec libellé, pas d'en-tête de colonnes */
@media (max-width: 560px) {
  .perm-head { display: none; }
  .perm-leaf { grid-template-columns: 1fr; gap: 3px; padding: 10px 0; }
  .perm-leaf-label { margin-bottom: 2px; }
  .perm-toggle { justify-content: flex-start; gap: 7px; color: var(--muted); font-size: 13px; }
  .perm-toggle-txt { display: inline; }
}

/* ---------- Tablette / Desktop ---------- */
@media (min-width: 860px) {
  .nav-toggle { display: none; }
  /* Grille 3 colonnes : marque (gauche) · menus (centre) · compte (droite) */
  .topbar-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
  .brand { grid-column: 1; justify-self: start; }
  /* mainnav s'efface pour que ses enfants rejoignent la grille du parent */
  .mainnav, .mainnav.open { display: contents; }
  .menu { grid-column: 2; justify-self: center; display: flex; padding: 0; gap: 4px; }
  .menu > li { position: relative; }
  .menu > li + li { margin-top: 0; }
  .menu li.active { background: none; }
  .menu > li > a { display: block; padding: 10px 14px; border-radius: 8px; }
  .menu > li > a:hover { background: var(--hover); text-decoration: none; }
  .submenu {
    position: absolute; top: 100%; left: 0; min-width: 200px; padding: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: var(--shadow); display: none;
  }
  .has-sub:hover .submenu, .has-sub.open .submenu { display: block; }
  .submenu a { padding: 8px; border-left: none; border-radius: 7px; }
  .submenu a:hover { background: var(--hover); text-decoration: none; }
  .submenu a.active { border-left: none; }
  .nav-account {
    grid-column: 3; justify-self: end;
    flex-direction: row; align-items: center; border-top: none; margin-top: 0; padding: 0;
    gap: 10px; flex-wrap: nowrap;
  }
  .nav-account .who { padding: 0; }
  .nav-account .btn-ghost, .nav-account .logout-form button { width: auto; }
  .cards { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* ====================== LOGISTIQUE — livraisons ====================== */
.container-wide { max-width: 1320px; }
.theme-toggle { padding: 8px 10px; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.page-head h1 { font-size: 24px; margin: 0; }
.sync-info { display: flex; align-items: center; gap: 12px; font-size: 13px; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin: 18px 0; padding: 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.search {
  flex: 1 1 240px; min-width: 200px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 9px; font-size: 14px;
  background: var(--surface); color: var(--text);
}
.search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,102,195,.15); }

.view-switch { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; }
.view-btn {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  padding: 8px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; font-family: inherit;
}
.view-btn.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  padding: 7px 12px; border-radius: 99px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text); font-size: 13px; font-family: inherit;
}

.table-scroll { overflow: auto; max-height: calc(100dvh - 280px); border: 1px solid var(--border); border-radius: var(--radius); }
table.deliveries { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
table.deliveries thead th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted);
  text-transform: uppercase; font-size: 11px; letter-spacing: .6px; text-align: left;
  padding: 12px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.deliveries th.sortable { cursor: pointer; user-select: none; }
.sort-caret { font-size: 9px; color: var(--brand); }
table.deliveries td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.deliveries tbody tr { cursor: pointer; }
table.deliveries tbody tr:nth-child(even) { background: var(--zebra); }
table.deliveries tbody tr:hover { background: var(--hover); }
table.deliveries tbody tr.row-done,
table.deliveries tbody tr.row-done:nth-child(even) { background: #e7f6ee; }
table.deliveries tbody tr.row-done:hover { background: #d9f0e3; }
[data-theme="dark"] table.deliveries tbody tr.row-done,
[data-theme="dark"] table.deliveries tbody tr.row-done:nth-child(even) { background: #14331f; }
[data-theme="dark"] table.deliveries tbody tr.row-done:hover { background: #1a4128; }
.cell-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-action { text-align: right; white-space: nowrap; }
.btn-mini.validate { color: var(--success); border-color: #bfe6cf; font-weight: 600; }
.btn-mini.validate:hover { background: #e7f6ee; }
/* Colonnes Document / Téléchargement */
.cell-doc { white-space: nowrap; }
a.btn-mini { display: inline-block; text-decoration: none; color: var(--text); }
a.btn-mini:hover { text-decoration: none; }
.doc-none { color: var(--muted); }

/* Pastilles d'urgence */
.pill { display: inline-block; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; color: #fff; }
.pill-green { background: #1c8a4d; }
.pill-red { background: #e23b3b; }
.pill-orange { background: #e8870c; }
.pill-blue { background: #2f7fd1; }
.pill-bluelight { background: #74b3ec; }
.pill-grey { background: #9aa7b6; }

/* Panneau de détails (slide-over) */
.slideover-overlay { position: fixed; inset: 0; background: rgba(16,30,55,.45); z-index: 120; }
.slideover {
  position: absolute; top: 0; right: 0; height: 100%; width: 100%; max-width: 440px;
  background: var(--surface); box-shadow: -8px 0 30px rgba(0,0,0,.2);
  display: flex; flex-direction: column; animation: slidein .18s ease;
}
@keyframes slidein { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.slideover-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.slideover-head h2 { margin: 0; font-size: 17px; }
.slideover-body { padding: 12px 20px; overflow-y: auto; flex: 1; }
.slideover-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.detail-table td { padding: 9px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.detail-table .dk { color: var(--muted); width: 42%; }
.detail-table .dv { font-weight: 600; }

@media (max-width: 859px) {
  .table-scroll { max-height: none; }
  .cell-name { max-width: 140px; }
}

/* ---------- Vue graphique (timeline SVG) ---------- */
.graph-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.graph-legend span { display: inline-flex; align-items: center; gap: 6px; }
.graph-legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.graph-scroll {
  overflow-x: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.graph-svg { display: block; }
.graph-svg .g-month { fill: var(--muted); font-size: 12px; font-weight: 700; text-transform: capitalize; }
.graph-svg .g-label { fill: var(--text); font-size: 12px; }
.graph-svg .g-date { fill: var(--muted); font-size: 12px; font-weight: 600; }
.graph-svg .g-sep { stroke: var(--border); stroke-width: 1; }
.graph-svg .g-today { stroke: #e23b3b; stroke-width: 1.5; stroke-dasharray: 4 3; }
.graph-svg .g-today-label { fill: #e23b3b; font-size: 11px; font-weight: 700; }
.graph-svg .g-point { cursor: pointer; }
.graph-svg .g-point:hover circle { stroke: var(--brand); stroke-width: 2.5; }

/* ---------- Prévision de stock ---------- */
.toolbar-params { gap: 18px; align-items: center; flex-wrap: wrap; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); align-self: center; }
.param { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.param.check { font-weight: 500; gap: 6px; cursor: pointer; }
.param-input { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 500; }
.param-input input { width: 64px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 14px; }
.param-help { font-size: 12px; }

.forecast-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 4px 0 16px; }
.fc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.fc-card .fc-val { font-size: 26px; font-weight: 800; line-height: 1.1; }
.fc-card .fc-lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.fc-card.warn .fc-val { color: #e23b3b; }
.fc-card.ok .fc-val { color: var(--success); }
@media (max-width: 720px) { .forecast-cards { grid-template-columns: repeat(2, 1fr); } }

.forecast-chart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 18px; box-shadow: var(--shadow); }
.chart-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.chart-head h3 { margin: 0; font-size: 16px; }
.forecast-svg .g-grid { stroke: var(--border); stroke-width: 1; }
.forecast-svg .g-axis { fill: var(--muted); font-size: 11px; }
.forecast-svg .g-barval { fill: var(--text); font-size: 11px; font-weight: 700; }
.forecast-svg .bar-win { fill: var(--brand); }
.forecast-svg .bar-off { fill: var(--brand); opacity: .32; }
.forecast-svg .fc-bar:hover rect { opacity: .85; }
.graph-legend .sw-win, .graph-legend .sw-off { display: inline-block; width: 12px; height: 12px; border-radius: 3px;
  margin-right: 5px; vertical-align: -1px; background: var(--brand); }
.graph-legend .sw-off { opacity: .32; }

table.forecast th.num, table.forecast td.num { text-align: right; white-space: nowrap; }
table.forecast tbody tr { cursor: default; }
table.forecast tbody tr.row-warn,
table.forecast tbody tr.row-warn:nth-child(even) { background: #fdecec; }
table.forecast tbody tr.row-warn:hover { background: #fbdede; }
[data-theme="dark"] table.forecast tbody tr.row-warn,
[data-theme="dark"] table.forecast tbody tr.row-warn:nth-child(even) { background: #3a1d1d; }
[data-theme="dark"] table.forecast tbody tr.row-warn:hover { background: #4a2424; }
.small { font-size: 12px; }

/* ---------- Vue calendrier ---------- */
.cal-head { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 12px; }
.cal-title { margin: 0; font-size: 18px; text-transform: capitalize; min-width: 200px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-weekdays { margin-bottom: 6px; }
.cal-wd { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.cal-cell {
  min-height: 92px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; padding: 6px; display: flex; flex-direction: column; gap: 4px;
}
.cal-cell.empty { background: transparent; border: none; }
.cal-cell.today { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(11,102,195,.2); }
.cal-day { font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-cell.today .cal-day { color: var(--brand); }
.cal-chips { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-chip {
  border: none; color: #fff; font-size: 11px; padding: 3px 6px; border-radius: 5px;
  text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: inherit;
}
.cal-chip:hover { filter: brightness(1.08); }
@media (max-width: 859px) {
  .cal-cell { min-height: 64px; }
  .cal-chip { font-size: 10px; }
  .cal-day { font-size: 11px; }
}

/* ====================== INFORMATIQUE — applications ====================== */
.apps-grid { display: grid; gap: 16px; grid-template-columns: 1fr; margin-top: 8px; }
@media (min-width: 620px) { .apps-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }

.app-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); cursor: pointer; transition: transform .12s;
  display: flex; flex-direction: column; gap: 8px;
}
.app-card:hover { transform: translateY(-2px); }
.app-card--auto { background: #fff7ed; border-color: #fed7aa; }
[data-theme="dark"] .app-card--auto { background: #2a2113; border-color: #5a4420; }
.app-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.app-logo { width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: var(--surface-2); flex: none; }
.logo-initials {
  display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--brand);
  background: var(--surface-2); border-radius: 10px;
}
.app-logo.logo-initials { width: 44px; height: 44px; font-size: 16px; }
.app-badges { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.app-name { margin: 0; font-size: 16px; }
.app-desc { margin: 0; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.app-card-foot { font-size: 12px; margin-top: auto; }

.badge.kind { background: #e7eefb; color: var(--brand); }
.badge.status-active { background: #e7f6ee; color: #1c8a4d; }
.badge.status-in_progress { background: #e7eefb; color: #2f6fd1; }
.badge.status-paused { background: #fff3df; color: #a86600; }
.badge.status-abandoned { background: #f0f0f0; color: #888; }
[data-theme="dark"] .badge.kind { background: #1d3050; }
[data-theme="dark"] .badge.status-active { background: #14331f; }
[data-theme="dark"] .badge.status-in_progress { background: #1d3050; }
[data-theme="dark"] .badge.status-paused { background: #33280f; }
[data-theme="dark"] .badge.status-abandoned { background: #2a2a2a; }

/* Fiche détaillée */
.slideover-wide { max-width: 540px; }
.detail-top { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.app-logo-lg { width: 64px; height: 64px; border-radius: 12px; object-fit: contain; background: var(--surface-2); flex: none; }
.app-logo-lg.logo-initials { font-size: 24px; }
.detail-badges { display: flex; gap: 6px; margin-bottom: 4px; }
.detail-desc { color: var(--text); background: var(--surface-2); padding: 10px 12px; border-radius: 9px; font-size: 14px; }
.deploy-section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 18px 0 6px; }
.host-node-view { margin-top: 10px; }
.host-node-view h4 { margin: 6px 0; font-size: 14px; }
.secret-value { font-family: monospace; }

/* Formulaire */
.modal-lg { max-width: 640px; }
.kind-switch { display: flex; gap: 8px; margin-bottom: 16px; }
.kind-btn { flex: 1; padding: 12px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; font-weight: 700; cursor: pointer; font-family: inherit; color: var(--text); }
.kind-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.logo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.logo-preview { width: 64px; height: 64px; flex: none; }
.logo-preview img, .logo-preview .logo-initials { width: 64px; height: 64px; border-radius: 12px; object-fit: contain; font-size: 22px; }
.logo-actions { display: flex; flex-direction: column; gap: 6px; }
.req { color: var(--danger); }
.sep { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.deploy-title { font-size: 15px; margin: 0 0 12px; }
.field-row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }
.host-node { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.host-node legend { font-size: 13px; font-weight: 700; color: var(--brand); padding: 0 6px; }
.secret-input { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.secret-input input { flex: 1; }
.secret-eye { background: none; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; padding: 6px 10px; font-size: 14px; }
.secret-eye:hover { background: var(--hover); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ====================== Tickets / support ====================== */
.nav-tickets { position: relative; }
.nav-badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
@media (max-width: 859px) { .nav-badge { position: static; margin-left: 6px; } }

.tickets-layout { display: grid; gap: 16px; grid-template-columns: 1fr; margin-top: 10px; }
@media (min-width: 800px) { .tickets-layout { grid-template-columns: 320px 1fr; align-items: start; } }
.tickets-list { display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; }
.tk-item { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; font-family: inherit; color: var(--text); }
.tk-item:hover { background: var(--hover); }
.tk-item.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(11,102,195,.2); }
.tk-item-top { display: flex; align-items: center; gap: 6px; }
.tk-item-sub { font-size: 12px; color: var(--muted); margin: 4px 0; }
.tk-item-prev { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); flex: none; }

.tickets-chat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 420px; }
.tk-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.tk-chat-head h2 { margin: 0; font-size: 17px; }
.tk-chat-actions { display: flex; align-items: center; gap: 8px; }
.tk-messages { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; max-height: 56vh; }
.tk-msg { max-width: 78%; align-self: flex-start; }
.tk-msg.mine { align-self: flex-end; }
.tk-msg-meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.tk-msg.mine .tk-msg-meta { text-align: right; }
.tk-bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 13px; font-size: 14px; white-space: pre-wrap; }
.tk-msg.mine .tk-bubble { background: var(--brand); color: #fff; border-color: var(--brand); }
.tk-form { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.tk-form textarea { flex: 1; resize: vertical; min-height: 40px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; font-family: inherit; font-size: 14px; background: var(--surface); color: var(--text); }
.tk-closed { padding: 14px 18px; border-top: 1px solid var(--border); text-align: center; }

/* ====================== Fabrication ====================== */
.fab-tab { margin-top: 16px; }
.fab-cards { display: grid; gap: 16px; grid-template-columns: 1fr; margin-top: 8px; }
@media (min-width: 720px) { .fab-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
.fab-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.fab-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fab-card-head h3 { margin: 0; font-size: 16px; }
.fab-desc { color: var(--muted); font-size: 13px; }
.fab-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.mono, .dv.mono { font-family: monospace; }

/* Sélection des opérateurs (nouvelle session) */
.fab-operators-pick { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 4px 0 2px; }
.fab-op-check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.fab-op-check input { width: auto; margin: 0; }
/* Réattribution des opérateurs (carte En cours) */
.fab-reassign-wrap { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; align-items: flex-start; }
.fab-reassign { min-width: 180px; padding: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-family: inherit; }
/* Boutons import/export configuration */
.fab-config-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* Bouton « Terminer la session » */
.fab-finish { margin-left: auto; }
.fab-finish.ready { animation: fab-finish-pulse 1.4s ease-in-out infinite; }
@keyframes fab-finish-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(28,138,77,.5); } 50% { box-shadow: 0 0 0 6px rgba(28,138,77,0); } }
.fab-finish.ready { background: #1c8a4d; border-color: #1c8a4d; }

/* Assemblage */
.fab-banner { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.fab-progress { display: flex; align-items: center; gap: 12px; margin: 10px 0; font-size: 14px; }
.fab-progress-bar { flex: 1; height: 14px; background: var(--surface-2); border-radius: 99px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.fab-progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-dark)); border-radius: 99px; transition: width .3s; }
.fab-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.fab-pill { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 700; cursor: pointer; }
.fab-pill.current { background: var(--brand); color: #fff; border-color: var(--brand); }
.fab-pill.done { background: #1c8a4d; color: #fff; border-color: #1c8a4d; }
.fab-step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.fab-step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.fab-step-head h3 { margin: 0; font-size: 19px; flex: 1; }
.fab-step-img { max-width: 100%; max-height: 360px; border-radius: 10px; cursor: zoom-in; display: block; margin: 8px 0; }
.fab-block { background: var(--surface-2); border-radius: 9px; padding: 12px; margin: 10px 0; }
.fab-instr { margin: 10px 0; padding-left: 24px; }
.fab-instr li { padding: 6px 0; }
.fab-instr-text { vertical-align: top; }
/* Images affichées sous une sous-instruction (vue opérateur) */
.fab-instr-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.fab-instr-img { max-width: 200px; max-height: 200px; border-radius: 9px; border: 1px solid var(--border); cursor: zoom-in; object-fit: cover; }
/* Éditeur de sous-instructions (configuration) */
.fab-instr-edit { display: flex; flex-direction: column; gap: 12px; margin: 8px 0; }
.fab-instr-row { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--surface-2); }
.fab-instr-row.file-over { border-color: var(--brand); outline: 2px dashed var(--brand); outline-offset: 2px; background: color-mix(in srgb, var(--brand) 8%, var(--surface-2)); }
.fab-instr-line { display: flex; align-items: flex-start; gap: 8px; }
.fab-instr-line .badge { margin-top: 7px; }
/* Le texte d'instruction s'agrandit pour tout afficher (retour à la ligne). */
.fab-instr-line .instr-input { flex: 1; resize: none; overflow: hidden; min-height: 38px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.fab-instr-drop-hint { margin: 8px 0 0; padding-left: 34px; opacity: .65; }
.fab-drag-ghost { position: fixed; width: 84px; height: 84px; object-fit: cover; border-radius: 8px; pointer-events: none; z-index: 250; opacity: .9; transform: translate(-50%, -50%); box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.fab-instr-thumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding-left: 34px; }
.fab-thumb { position: relative; display: inline-block; cursor: grab; }
.fab-thumb:active { cursor: grabbing; }
.fab-thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; cursor: zoom-in; }
.fab-thumb.dragging { opacity: .4; }
.fab-thumb.drop-target img { outline: 2px dashed var(--brand); outline-offset: 2px; }
.fab-thumb-del { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; line-height: 18px; border-radius: 50%; border: none; background: var(--danger, #dc3545); color: #fff; cursor: pointer; font-size: 12px; padding: 0; }
.fab-instr-addimg { white-space: nowrap; }
/* Aperçu agrandi au survol (suit le curseur) */
.img-hover-preview { position: fixed; z-index: 150; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; }
.img-hover-preview img { display: block; max-width: 320px; max-height: 320px; border-radius: 7px; }
/* Outils requis : éditeur (liste) + affichage (vue opérateur) */
.fab-tools-edit { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.fab-tool-row { display: flex; align-items: center; gap: 8px; }
.fab-tool-row .tool-input { flex: 1; }
.fab-tools-ul { margin: 6px 0 0; padding-left: 22px; }
.fab-tools-ul li { padding: 2px 0; }
.fab-tools { background: var(--surface-2); border-radius: 9px; padding: 10px 12px; margin: 8px 0; font-size: 14px; }
.fab-prec { background: #fff3df; color: #8a5a00; border-radius: 9px; padding: 10px 12px; margin: 8px 0; font-size: 14px; }
[data-theme="dark"] .fab-prec { background: #33280f; color: #e0b25e; }
.fab-validate { margin: 16px 0; display: flex; flex-direction: column; gap: 10px; }
.fab-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }

/* Config étapes */
.fab-steps-panel { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.fab-steps-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.fab-step-edit-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fab-step-edit-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); transition: border-color .12s, box-shadow .12s; }
.fab-step-edit-item:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.fab-step-num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.fab-step-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fab-step-name { font-weight: 600; }
.fab-step-meta { color: var(--muted); font-size: 12px; }
.fab-step-ctrl { display: flex; gap: 4px; flex: none; align-items: center; }
.fab-step-list { list-style: none; margin: 8px 0; padding: 0; }
.fab-step-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }

/* Zoom image plein écran */
.img-zoom { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 200; cursor: zoom-out; padding: 20px; }
.img-zoom img { max-width: 96%; max-height: 96%; border-radius: 8px; }

/* ====================== Paramètres ====================== */
.icon-btn { font-size: 17px; line-height: 1; padding: 8px 11px; }
.icon-btn.active { border-color: var(--brand); color: var(--brand); }
.page-title { margin: 0 0 18px; font-size: 24px; }
.settings-layout { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 6px; }
.settings-tab {
  text-align: left; padding: 11px 14px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--text); font-family: inherit;
}
.settings-tab:hover { background: var(--hover); }
.settings-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.settings-content {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.settings-section h2 { margin-top: 0; }
.settings-section h3 { font-size: 15px; margin: 22px 0 10px; }
.perso-row {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); margin-top: 8px;
}
.perso-label { font-weight: 700; min-width: 80px; }
/* ---------- Ordres de fabrication ---------- */
.of-pref { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); margin-bottom: 14px; }
.of-pref label { font-weight: 600; font-size: 14px; }
.of-row { cursor: pointer; }
.of-row:hover { background: var(--hover); }
.of-adv { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.of-adv-bar { width: 90px; height: 8px; flex: 0 0 auto; }
.of-head h2 { margin: 6px 0 2px; }
/* Stepper (2ᵉ navbar interne) */
.of-stepper { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0; margin: 8px 0 16px; border-bottom: 1px solid var(--border); }
.of-step { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 104px; padding: 8px 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; font-family: inherit; color: var(--text); }
.of-step:hover:not(:disabled) { background: var(--hover); }
.of-step:disabled { opacity: .45; cursor: not-allowed; }
.of-step-n { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); }
.of-step-l { font-size: 11px; line-height: 1.2; text-align: center; color: var(--muted); }
.of-step.done .of-step-n { background: #1c8a4d; color: #fff; border-color: #1c8a4d; }
.of-step.current { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.of-step.current .of-step-n { background: var(--brand); color: #fff; border-color: var(--brand); }
.of-step.active { background: var(--surface-2); }
.of-step.active .of-step-l { color: var(--text); font-weight: 600; }
.of-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.of-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.of-panel-head h3 { margin: 0; }
.of-done { color: var(--success); font-weight: 600; }
.of-fields { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin: 12px 0; }
.of-fields label { display: block; font-weight: 600; font-size: 14px; }
.of-fields input, .of-fields textarea, .of-fields select { width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-family: inherit; font-size: 14px; }
.of-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.of-lines { margin: 10px 0; }
.of-prod-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 9px; margin: 8px 0; }
.of-prod-pick { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 8px 10px; border: none; border-bottom: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-family: inherit; }
.of-prod-pick:last-child { border-bottom: none; }
.of-prod-pick:hover { background: var(--hover); }
.of-prod-pick.is-chosen { background: var(--surface-2); }
.of-pp-name { font-weight: 600; }
.of-pp-add { margin-left: auto; font-size: 12px; color: var(--brand); white-space: nowrap; }
.of-qty { width: 80px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); }
.of-sel td { vertical-align: middle; }
.of-lines-save { margin-top: 12px; background: var(--success); border-color: var(--success); color: #fff; }
.of-lines-save:hover { filter: brightness(1.08); background: var(--success); }
/* Étape 4 — stock produits finis + composants (groupés par produit fini) */
.of-mat-head { margin: 10px 0 6px; }
#ofMaterials { margin-top: 4px; }
.of-mat { width: 100%; border-collapse: collapse; font-size: 14px; }
.of-mat th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 2px solid var(--border); }
.of-mat th:not(:first-child), .of-mat td:not(:first-child) { text-align: center; width: 90px; }
.of-mat td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.of-mat-fin td { font-weight: 700; border-top: 2px solid var(--border); }
.of-mat-fin.is-ok td:first-child { box-shadow: inset 4px 0 0 var(--success); }
.of-mat-fin.is-short td:first-child { box-shadow: inset 4px 0 0 var(--danger, #dc3545); }
.of-mat-comp td:first-child { padding-left: 22px; color: var(--text); }
.of-mat-comp.is-short { background: rgba(220, 53, 69, 0.07); }
.of-mat-comp.is-ok { background: rgba(40, 167, 69, 0.05); }
.of-mat-arrow { color: var(--muted); margin-right: 4px; }
.of-mat-warn { color: var(--danger, #dc3545); font-weight: 600; }
.of-mat-ok { color: var(--success); font-weight: 600; }
/* Planning machines */
.of-planning-title { margin: 24px 0 10px; font-size: 18px; }
.of-machines { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .of-machines { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }
.of-machine { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); }
.of-machine-name { font-weight: 700; margin-bottom: 8px; }
.of-machine-items { display: flex; flex-direction: column; gap: 6px; }
.of-machine-chip { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 7px; background: var(--surface-2); cursor: pointer; font-family: inherit; text-align: left; }
.of-machine-chip:hover { background: var(--hover); }
.of-mc-date { font-weight: 600; font-size: 13px; min-width: 92px; }
.of-mc-num { font-family: monospace; font-size: 12px; color: var(--muted); }
/* Prévision de stock : réglage intervalle + modale méthode de calcul */
.prev-interval { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.prev-interval .select { padding: 5px 8px; font-size: 13px; }
.prev-info h4 { margin: 16px 0 6px; }
.prev-info h4:first-child { margin-top: 0; }
.prev-info ul { margin: 0 0 8px; padding-left: 20px; }
.prev-info li { margin-bottom: 5px; line-height: 1.45; }
.prev-info code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
/* Recherche produit : autocomplétion + sélection multiple */
.prev-search-wrap { position: relative; flex: 1 1 260px; min-width: 200px; }
.prev-search-wrap .search { width: 100%; }
.prev-suggest { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow); max-height: 300px; overflow-y: auto; }
.prev-suggest-item { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 8px 12px; border: none; border-bottom: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-family: inherit; }
.prev-suggest-item:last-child { border-bottom: none; }
.prev-suggest-item:hover { background: var(--hover); }
.prev-suggest-item .ps-name { font-weight: 600; }
.prev-prod-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.prev-prod-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; font-size: 13px; font-weight: 500; }
.prev-prod-chip button { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; padding: 0; }
.prev-prod-chip button:hover { color: var(--danger); }
@media (max-width: 560px) { .of-fields { grid-template-columns: 1fr; } }

/* Titre de projet auto-généré (lecture seule) */
.proj-title-auto { font-family: monospace; font-weight: 600; background: var(--surface-2); letter-spacing: .3px; }
/* Formulaire MFL : note d'aide + résumé dans l'historique */
.mfl-note { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin: 0 0 14px; font-weight: 400; line-height: 1.5; }
.mfl-field[hidden] { display: none; }
/* Champs Oui/Non : choix direct cliquable (segmented control) */
.ouinon { display: flex; width: max-content; margin: 6px 18% 0 auto; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.ouinon-btn { border: none; border-left: 1px solid var(--border); background: var(--surface); color: var(--text); font-family: inherit; font-size: 14px; padding: 8px 18px; cursor: pointer; }
.ouinon-btn:first-child { border-left: none; color: var(--muted); }
.ouinon-btn:hover { background: var(--hover); }
.ouinon-btn.is-active[data-val=""] { background: #fff; color: var(--text); }
.ouinon-btn.is-active[data-val="Oui"] { background: #1f9d57; color: #fff; }
.ouinon-btn.is-active[data-val="Non"] { background: #d83a3a; color: #fff; }
.mfl-summary { white-space: pre-wrap; font-family: inherit; font-size: 13px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 6px 0 0; }
/* Filtres intégrés sous les titres de colonnes (historique commercial) */
.filter-row th { padding: 4px 8px 8px; vertical-align: top; font-weight: 400; }
.col-filter { width: 100%; font-size: 12px; padding: 5px 6px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); font-family: inherit; }
.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.th-sort:hover { color: var(--brand); }
.th-sort .sort-caret { font-size: 11px; }
.th-date-filter { display: flex; gap: 4px; flex-wrap: wrap; }
.th-date-filter .chip { font-size: 12px; padding: 4px 8px; }

.export-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.export-list { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .export-list { grid-template-columns: 1fr 1fr; } }
.small { font-size: 12px; }
@media (min-width: 860px) {
  .settings-layout { grid-template-columns: 230px 1fr; }
}

/* ====================== Commercial — création de client ====================== */
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* Détail d'une action (sections lisibles) */
.detail-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.detail-section { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 18px 0 6px; border-top: 1px solid var(--border); padding-top: 12px; }
.detail-section:first-of-type { border-top: none; padding-top: 0; }
.detail-list { margin: 6px 0 0; padding-left: 20px; font-size: 14px; }
.detail-list li { padding: 2px 0; }

/* Historique : zébrage (blanc / bleu) + lignes cliquables */
#projectsTable tbody tr { cursor: pointer; }
#projectsTable tbody tr:nth-child(even) { background: var(--zebra); }
#projectsTable tbody tr:hover { background: var(--hover); }
/* Étiquettes « type d'ajout » de l'historique */
.badge-projet { background: #e7eefb; color: #2f6fd1; }
.badge-client { background: #fff3df; color: #a8660a; }
[data-theme="dark"] .badge-projet { background: #1d3050; color: #8bb6f0; }
[data-theme="dark"] .badge-client { background: #33280f; color: #e0b25e; }
.client-form { max-width: 780px; margin: 0 auto; }
/* Blocs Entreprise / Contacts en « carte » (fond surface au lieu du bleu très clair) */
.client-form .host-node { background: var(--surface); box-shadow: var(--shadow); }
.client-form textarea { width: 100%; margin-top: 6px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 9px; font-family: inherit; font-size: 15px; background: var(--surface); color: var(--text); }
/* Selects alignés sur les inputs (pleine largeur + même hauteur) */
.client-form select, .contact-block select {
  width: 100%; margin-top: 6px; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: 9px; font-size: 15px; font-family: inherit; background: var(--surface); color: var(--text);
}
.contacts-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 10px; }
.contacts-head h3 { margin: 0; font-size: 16px; }
.contact-block legend { display: flex; align-items: center; gap: 10px; }
.client-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.test-output { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 14px; overflow: auto; font-size: 13px; white-space: pre-wrap; margin-top: 12px; }

/* ====================== Ajout de projet ====================== */
/* Champ mesuré : valeur + unité à droite */
.measure { display: flex; gap: 6px; margin-top: 6px; }
.measure input { flex: 1; margin-top: 0 !important; }
.measure select { width: auto; min-width: 70px; margin-top: 0 !important; }
.dim-modes { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; }
.radio { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; cursor: pointer; }
.radio input { width: auto; margin: 0; }

.client-search-row { display: flex; gap: 10px; align-items: center; }
.client-search-row input { flex: 1; }
.nowrap { white-space: nowrap; }
.client-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.client-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 4px 10px; font-size: 13px; }
.client-chip button { border: none; background: none; cursor: pointer; color: var(--danger); font-size: 13px; }
.client-results { max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: 9px; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.client-result { text-align: left; border: none; background: none; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-family: inherit; font-size: 14px; color: var(--text); }
.client-result:hover { background: var(--hover); }
.client-result.is-selected { background: #e7eefb; color: var(--brand); font-weight: 600; }
[data-theme="dark"] .client-result.is-selected { background: #1d3050; }
.client-result.is-selected::before { content: '✓ '; }

/* ============================ BLOC-NOTES ============================ */
:root {
  --prio-0: #3b8ae6;  /* aucune  : bleu   */
  --prio-1: #e6b800;  /* faible  : jaune  */
  --prio-2: #e8821e;  /* normal  : orange */
  --prio-3: #e23b3b;  /* important : rouge */
}
body.notebook-open { overflow: hidden; }
/* Bouton flottant */
.notebook-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 24px; line-height: 1;
  box-shadow: 0 6px 20px rgba(11,102,195,.4); transition: transform .15s, box-shadow .15s;
}
.notebook-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(11,102,195,.5); }
.notebook-fab-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--danger); color: #fff; border-radius: 99px; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--surface);
}
/* Overlay centré */
.notebook-overlay { align-items: center; }
.notebook {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  width: 100%; max-width: 980px; height: 80vh; max-height: 820px; margin: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.notebook-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.notebook-head h2 { margin: 0; font-size: 18px; }
.notebook-body { flex: 1; min-height: 0; display: flex; }
/* Gauche : liste */
.note-list-pane { width: 280px; border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.note-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.note-list-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.note-list { overflow-y: auto; padding: 8px; flex: 1; }
.note-empty { padding: 16px; }
.note-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--prio-0);
  border-radius: 9px; padding: 10px 12px; margin-bottom: 6px; font-family: inherit; font-size: 14px; color: var(--text);
}
.note-item:hover { background: var(--hover); }
.note-item.active { background: var(--hover); box-shadow: inset 0 0 0 1px var(--brand); }
.note-item-title { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-dot { color: var(--danger); font-size: 12px; }
.note-rem-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
/* Couleurs de priorité (bordure gauche + pastille) */
.prio-0 { border-left-color: var(--prio-0); }
.prio-1 { border-left-color: var(--prio-1); }
.prio-2 { border-left-color: var(--prio-2); }
.prio-3 { border-left-color: var(--prio-3); }
/* Droite : éditeur / rappels */
.note-right { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; }
.note-editor { display: flex; flex-direction: column; min-height: 100%; border-left: 4px solid var(--prio-0); padding-left: 12px; }
.note-editor-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.note-title-input { flex: 1; min-width: 140px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-family: inherit; font-size: 15px; font-weight: 600; }
.note-prio { padding: 8px 10px; }
.note-body-input { flex: 1; min-height: 220px; resize: vertical; margin: 0 0 10px; }
.note-editor-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.note-saved-info { color: var(--muted); font-size: 13px; }
.note-unsaved { color: var(--danger); font-weight: 600; }
.note-foot-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.note-reminders { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.note-rem-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; font-size: 14px; }
.note-back { display: none; }
/* Panneau « prochains rappels » */
.note-default-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.note-default-head h3 { margin: 0; font-size: 17px; }
.rem-line {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; margin-bottom: 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--prio-0); border-radius: 9px;
  width: 100%; text-align: left; cursor: pointer; font-family: inherit; color: var(--text);
  transition: filter .15s, box-shadow .15s;
}
.rem-line:hover { filter: brightness(0.97); box-shadow: inset 0 0 0 1px var(--brand); }
[data-theme="dark"] .rem-line:hover { filter: brightness(1.15); }
.rem-line-title { font-weight: 600; }
.rem-line-meta { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.rem-line-prio { margin-left: auto; }
/* Modale « Ajouter un rappel » (restylée) */
.rem-form { display: flex; flex-direction: column; gap: 18px; }
.rem-group { display: flex; flex-direction: column; gap: 10px; }
.rem-group-title { font-weight: 700; font-size: 14px; }
.rem-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rem-opt {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  transition: border-color .15s, background .15s;
}
.rem-opt:hover { background: var(--hover); }
.rem-opt input { margin-top: 2px; width: auto; }
.rem-opt:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--surface-2); }
.rem-opt-txt { display: flex; flex-direction: column; gap: 1px; font-size: 14px; }
.rem-opt-sub { color: var(--muted); font-size: 12px; }
/* Segmented control « Quand » */
.rem-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface-2); width: fit-content; }
.rem-seg-btn { border: none; background: none; padding: 8px 16px; cursor: pointer; font-family: inherit; font-size: 14px; color: var(--muted); }
.rem-seg-btn.active { background: var(--brand); color: #fff; font-weight: 600; }
.rem-relative { display: flex; gap: 8px; align-items: center; }
.rem-amount { width: 90px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-family: inherit; }
.rem-absolute input { padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-family: inherit; }
@media (max-width: 560px) { .rem-options { grid-template-columns: 1fr; } }
/* Popup rappels échus */
.due-rem { border-left: 4px solid var(--prio-0); padding: 10px 14px; margin-bottom: 12px; background: var(--surface-2); border-radius: 9px; }
.due-rem h3 { margin: 0 0 4px; font-size: 16px; }
.due-rem-body { white-space: pre-wrap; margin-top: 8px; }

/* Couleur de priorité : règles à 2 classes → gagnent quel que soit l'ordre des
   déclarations (corrige la bordure des lignes de rappels qui restait bleue). */
.note-item.prio-0, .rem-line.prio-0, .due-rem.prio-0 { border-left-color: var(--prio-0); }
.note-item.prio-1, .rem-line.prio-1, .due-rem.prio-1 { border-left-color: var(--prio-1); }
.note-item.prio-2, .rem-line.prio-2, .due-rem.prio-2 { border-left-color: var(--prio-2); }
.note-item.prio-3, .rem-line.prio-3, .due-rem.prio-3 { border-left-color: var(--prio-3); }
/* Teinte de fond de la ligne « prochains rappels » selon l'importance + libellé coloré */
.rem-line.prio-0 { background: rgba(59,138,230,.10); }
.rem-line.prio-1 { background: rgba(230,184,0,.14); }
.rem-line.prio-2 { background: rgba(232,130,30,.14); }
.rem-line.prio-3 { background: rgba(226,59,59,.13); }
.rem-line .rem-line-prio { font-weight: 700; }
.rem-line.prio-0 .rem-line-prio { color: var(--prio-0); }
.rem-line.prio-1 .rem-line-prio { color: var(--prio-1); }
.rem-line.prio-2 .rem-line-prio { color: var(--prio-2); }
.rem-line.prio-3 .rem-line-prio { color: var(--prio-3); }

/* Téléphone : plein écran, panneaux bascule liste/détail */
@media (max-width: 760px) {
  .notebook-overlay { padding: 0; align-items: stretch; }
  .notebook { height: 100%; max-height: none; max-width: none; border-radius: 0; }
  .note-list-pane { width: 100%; border-right: none; }
  .note-right { display: none; }
  .notebook-body.show-detail .note-list-pane { display: none; }
  .notebook-body.show-detail .note-right { display: block; }
  .note-back { display: inline-block; }
  .notebook-fab { right: 14px; bottom: 14px; }
}
