:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e4e4e7;
  --text: #18181b;
  --text-muted: #71717a;
  --accent: #5b5bd6;
  --accent-hover: #4c4cc0;
  --accent-soft: #f1f0fe;
  --danger: #e5484d;
  --danger-soft: #fdf2f2;
  --warning: #f5a524;
  --warning-soft: #fff8e8;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

svg {
  display: block;
  width: 1em;
  height: 1em;
}

button {
  font-family: inherit;
}

/* ---- Shell ---- */
.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 6px 8px 20px;
}

.brand img {
  width: auto;
  height: var(--brand-logo-h, 72px);
  max-width: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.brand-name {
  font-weight: 650;
  font-size: 14px;
  line-height: 1.2;
}

.brand-tag {
  font-size: 11px;
  color: var(--text-muted);
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  background: none;
  border: none;
  text-align: left;
  text-decoration: none;
  width: 100%;
  cursor: pointer;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--text-muted);
}

.nav-item:hover {
  background: #f4f4f5;
}

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-item.is-active svg {
  color: var(--accent);
}

.nav-item.is-disabled {
  color: #c1c1c5;
  cursor: default;
}

.nav-item.is-disabled:hover {
  background: none;
}

.nav-item.is-disabled svg {
  color: #d4d4d8;
}

.nav-soon {
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 600;
  color: #a1a1aa;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 6px;
  white-space: nowrap;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.sidebar-foot-text {
  font-size: 10.5px;
  color: #c1c1c5;
  padding: 8px 10px 2px;
  line-height: 1.4;
}

.nav-item.is-logout {
  color: var(--danger);
}

.nav-item.is-logout svg {
  color: var(--danger);
}

.nav-item.is-logout:hover {
  background: var(--danger-soft);
}

.content {
  flex: 1;
  min-width: 0;
  /* clip (et non hidden) : ne cree pas de conteneur de defilement, position: sticky reste possible */
  overflow-x: clip;
}

.view {
  display: block;
}

[hidden] {
  display: none !important;
}

.view[hidden] {
  display: none;
}

.page {
  padding: 28px 36px 60px;
  max-width: none;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 20px;
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

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

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.btn svg {
  width: 14px;
  height: 14px;
}

/* Fiche OF : "Revenir plus tard" et "Terminer" de la meme taille */
#ofInfoActions .btn,
#ofInfoActions .of-fab-btn {
  height: 36px;
  min-width: 150px;
  padding: 0 16px;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  box-sizing: border-box;
}

.btn:hover {
  background: #f4f4f5;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.btn-sm {
  padding: 4px 9px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px;
  width: 30px;
  height: 30px;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Hub ---- */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.hub-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.hub-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.hub-card.is-disabled {
  cursor: default;
  opacity: 0.55;
}

.hub-card.is-disabled:hover {
  border-color: var(--border);
  transform: none;
}

.hub-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
}

.hub-icon svg {
  width: 18px;
  height: 18px;
}

.hub-title {
  font-size: 14px;
  font-weight: 600;
}

.hub-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.hub-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  align-self: flex-start;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card + .card {
  margin-top: 14px;
}

.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-body {
  padding: 16px;
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tab {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
}

.tab:hover {
  background: #f4f4f5;
}

.tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---- Planning ---- */
.day-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 16px;
}

.day-col {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
}

.day-col.is-operator-absent {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}

.day-absence {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -14px -16px 12px;
  padding: 7px 16px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 650;
  border-radius: var(--radius) var(--radius) 0 0;
}

.day-absence svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.day-absence span {
  font-weight: 500;
  opacity: 0.8;
}

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

.day-col-date {
  font-size: 13.5px;
  font-weight: 650;
  text-transform: capitalize;
}

.day-col-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.day-col-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.day-load {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 260px;
  min-width: 200px;
}

.day-load-bar {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: #f0f0f2;
  overflow: hidden;
  min-width: 100px;
}

.day-load-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: #2a9d5c;
  transition: width 0.15s ease;
}

.day-load-bar-fill.is-warning {
  background: var(--warning);
}

.day-load-bar-fill.is-danger {
  background: var(--danger);
}

.day-load-text {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.day-load-text.is-danger {
  color: var(--danger);
  font-weight: 650;
}

.of-table {
  overflow-x: auto;
}

.day-drop {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: fit-content;
  min-height: 60px;
  padding: 2px;
  border-radius: var(--radius);
  transition: background 0.1s ease;
}

.day-drop.is-dragover {
  background: var(--accent-soft);
  outline: none;
  outline-offset: 2px;
}

.day-drop.is-dragover .empty-state {
  display: none;
}

/* Ligne d'insertion pendant le glisser-deposer */
.drop-indicator {
  position: relative;
  height: 3px;
  margin: 2px 6px;
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
}

.drop-indicator::before,
.drop-indicator::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.drop-indicator::before { left: -6px; }
.drop-indicator::after { right: -6px; }

/* Mini-calendrier (ajout de journee) */
.mini-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.mini-cal-title {
  font-weight: 600;
  font-size: 14px;
}
.mini-cal-weekdays,
.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.mini-cal-weekdays span {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  padding-bottom: 4px;
}
.mini-day {
  font: inherit;
  font-size: 13px;
  padding: 7px 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.mini-day:hover:not(:disabled) {
  border-color: var(--accent);
}
.mini-day:disabled {
  cursor: not-allowed;
}
.mini-day.is-empty {
  visibility: hidden;
}
.mini-day.is-weekend {
  color: var(--border);
}
.mini-day.is-holiday,
.mini-cal-legend i.is-holiday {
  background: #eef0f3;
  border-color: #cfd4dc;
}
.mini-day.is-existing,
.mini-cal-legend i.is-existing {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: #8a5a00;
}
.mini-day.is-vacation,
.mini-cal-legend i.is-vacation {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 600;
}
.mini-day.is-today,
.mini-cal-legend i.is-today {
  font-weight: 700;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.mini-day.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.mini-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.mini-cal-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mini-cal-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid;
}
.mini-cal-selected {
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 500;
}

/* Une ligne par OF, colonnes alignees avec l'en-tete .of-head */
.of-grid {
  display: grid;
  /* OF, Commande, Client, Format, Qte, Temps, Expedition, Matieres, Finition, Machine, Machine suivante, Prix / bouton */
  grid-template-columns: 96px 90px minmax(130px, 1.6fr) 90px 64px 52px 84px minmax(110px, 1.2fr) minmax(90px, 1fr) 100px 112px 96px;
  align-items: center;
  column-gap: 8px;
  padding: 7px 12px 7px 10px;
  border: 1px solid transparent;
  border-left-width: 3px;
}

.of-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
}

.of-cell.is-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.of-head {
  padding-top: 2px;
  padding-bottom: 4px;
}

.of-head .of-cell {
  font-size: 10.5px;
  font-weight: 650;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.of-card {
  background: var(--surface);
  border-color: var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Portail operateur : bouton Commencer en debut de ligne, pas de colonne Prix */
#dayRow.has-of-actions .of-grid {
  grid-template-columns: 112px 96px 82px minmax(130px, 1.6fr) 82px 64px 52px 84px minmax(110px, 1.2fr) minmax(90px, 1fr) 100px 112px;
}

.of-cell-action {
  overflow: visible;
}

.of-start-btn {
  width: 100%;
  justify-content: center;
}

.of-start-btn.is-done {
  background: #e4e4e7;
  border-color: #d4d4d8;
  color: var(--text-muted);
}

/* Page Info OF (portail operateur) */
/* Fabrication, Infos produit et Conditionnement cote a cote, meme hauteur ; references / amalgame en dessous */
.info-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.info-layout > .info-wide {
  grid-column: 1 / -1;
}

@media (max-width: 1300px) {
  .info-layout { grid-template-columns: 1fr; }
}

.info-layout > .card + .card {
  margin-top: 0;
}

/* Page detail OF : bandeau de 4 grandes cases */
.of-hero {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 1300px) {
  .of-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.of-hero-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.of-hero-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.of-hero-icon svg {
  width: 26px;
  height: 26px;
}

.of-hero-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.of-hero-label {
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.of-hero-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Case Etat aux couleurs du planning */
.of-hero-tile.is-etat-reprise { background: var(--etat-reprise); border-color: var(--etat-reprise); color: #fff; }
.of-hero-tile.is-etat-urgent { background: var(--etat-urgent); border-color: var(--etat-urgent); color: #fff; }
.of-hero-tile.is-etat-bloque { background: var(--etat-bloque); border-color: var(--etat-bloque); color: #fff; }
.of-hero-tile.is-etat-fini { background: #e4e4e7; border-color: #d4d4d8; }
.of-hero-tile[class*="is-etat-"]:not(.is-etat-direct):not(.is-etat-fini) .of-hero-label { color: rgba(255, 255, 255, 0.85); }
.of-hero-tile[class*="is-etat-"]:not(.is-etat-direct) .of-hero-icon { background: rgba(255, 255, 255, 0.25); color: inherit; }

/* Fiche de fabrication : une ligne par information, icone + libelle + valeur */
.of-detail-row {
  display: grid;
  grid-template-columns: 34px 130px 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.of-detail-row:first-child { padding-top: 0; }
.of-detail-row:last-child { border-bottom: none; }

.of-detail-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #f4f4f5;
  color: var(--text-muted);
}

.of-detail-icon svg { width: 19px; height: 19px; }

.of-detail-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-muted);
}

.of-detail-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.detail-strong {
  font-size: 18px;
  font-weight: 700;
}

.detail-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f4f4f5;
  font-size: 14px;
  font-weight: 600;
}

.detail-chip svg { width: 16px; height: 16px; color: var(--text-muted); }

/* Longueur de papier necessaire : bobine plus visible */
.detail-chip.is-length {
  background: var(--accent-soft);
  color: var(--accent);
}

.detail-chip.is-length svg { width: 20px; height: 20px; color: var(--accent); }

/* Encres : pastille de couleur + nom */
.ink-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ink-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px 4px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--surface);
}

.ink-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.ink-chip.is-cut {
  padding-left: 9px;
  border-style: dashed;
}

.ink-chip.is-cut svg { width: 16px; height: 16px; }

/* Vernis (page detail OF) : pastille selon l'aspect */
.vernis-dot { border: 1px solid rgba(15, 23, 42, 0.25); }
.vernis-dot.is-brillant { background: radial-gradient(circle at 32% 30%, #ffffff 0 25%, #cfe3f7 60%, #9cbfe3 100%); }
.vernis-dot.is-mat { background: #d4d4d8; }
.vernis-dot.is-luminescent { background: radial-gradient(circle, #f7ffb0 0 35%, #b6f23c 100%); box-shadow: 0 0 5px #b6f23c; }
.vernis-dot.is-miroir { background: linear-gradient(135deg, #f4f4f5 0%, #a1a1aa 45%, #ffffff 55%, #71717a 100%); }

.detail-muted {
  color: var(--text-muted);
  font-weight: 600;
}

/* Encre dans un tableau (references de l'OF) */
.ink-chip.is-small {
  gap: 5px;
  padding: 2px 8px 2px 4px;
  font-size: 12px;
}

.ink-chip.is-small .ink-dot {
  width: 11px;
  height: 11px;
}

/* Page detail OF : references de l'OF et quantites */
.card-header-count {
  display: inline-block;
  min-width: 22px;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.card-header-count:empty {
  display: none;
}

.refs-table td {
  vertical-align: middle;
}

.refs-table .is-num {
  text-align: right;
  white-space: nowrap;
}

.refs-table .ink-list {
  gap: 4px;
}

.refs-product {
  font-weight: 650;
  white-space: nowrap;
}

.refs-qty {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.refs-table tfoot td {
  border-bottom: 0;
  font-weight: 700;
}

/* Onglets dans l'en-tete d'une carte (references / amalgame) */
.card-tabs {
  display: flex;
  justify-content: flex-start;
  gap: 4px;
  padding-top: 0;
  padding-bottom: 0;
}

.card-tab {
  padding: 12px 12px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font: inherit;
  font-weight: 650;
  color: var(--text-muted);
  cursor: pointer;
}

.card-tab:hover {
  color: var(--text);
}

.card-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Alerte sur un onglet (infos produit renseignees) : pastille orange qui pulse */
.tab-alert {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f97316;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  vertical-align: 1px;
  animation: tab-alert-pulse 1.6s ease-in-out infinite;
}

.tab-alert[hidden] {
  display: none;
}

.card-tab.has-alert:not(.is-active) {
  color: #c2410c;
}

@keyframes tab-alert-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(249, 115, 22, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .tab-alert { animation: none; }
}

/* Autoplan (onglet Amalgame), sur le modele de la fiche Autoplan de CERM */
.autoplan-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 14px;
}

.autoplan-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-muted);
}

.autoplan-total {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 650;
}

.autoplan-total strong {
  color: var(--text);
}

/* Avancement : formes cochees "Fait" / nombre de formes */
.autoplan-progress {
  margin-left: auto;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.autoplan-progress.is-complete {
  background: #f0fdf4;
  color: #15803d;
}

/* Interrupteur "Fait" d'une forme (enregistre dans le portail) */
.autoplan-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
  font-size: 13px;
  font-weight: 750;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.autoplan-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.autoplan-switch-track {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #a1a1aa;
  transition: background 0.2s ease;
}

.autoplan-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

.autoplan-switch input:checked + .autoplan-switch-track {
  background: #16a34a;
}

.autoplan-switch input:checked + .autoplan-switch-track .autoplan-switch-thumb {
  transform: translateX(20px);
}

.autoplan-switch input:focus-visible + .autoplan-switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.autoplan-switch input:disabled + .autoplan-switch-track {
  opacity: 0.5;
}

/* Forme faite : bien visible (bordure et en-tete verts, fond vert clair, badge FAIT) */
.autoplan-forme.is-done {
  border: 2px solid #16a34a;
  background: #f0fdf4;
}

.autoplan-forme.is-done .autoplan-forme-head {
  background: #16a34a;
  color: #fff;
}

.autoplan-forme.is-done .autoplan-switch {
  color: #fff;
}

.autoplan-forme.is-done .autoplan-switch input:checked + .autoplan-switch-track {
  background: #14532d;
}

.autoplan-done-badge {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 1px 10px;
  border-radius: 999px;
  background: #fff;
  color: #15803d;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.autoplan-forme.is-done .autoplan-done-badge {
  display: inline-flex;
}

.autoplan-done-badge svg {
  width: 14px;
  height: 14px;
}

.autoplan-forme.is-done .autoplan-lane-img {
  background: #dcfce7;
}

/* Formes d'impression : les unes sous les autres */
.autoplan-formes {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.autoplan-forme {
  border: 1px solid #a1a1aa;
}

.autoplan-forme-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  background: #d4d4d8;
  font-size: 13px;
  font-weight: 700;
}

.autoplan-forme-head .autoplan-metres {
  margin-left: auto;
}

.autoplan-forme-head .refs-bat-btn {
  padding: 1px 8px;
}

.autoplan-lanes {
  display: grid;
  grid-template-columns: repeat(var(--lanes, 1), minmax(0, 1fr));
  border-top: 1px solid #a1a1aa;
}

.autoplan-lane {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-left: 1px solid #a1a1aa;
}

.autoplan-lane:first-child {
  border-left: 0;
}

.autoplan-lane-name {
  align-self: stretch;
  border-bottom: 1px solid #a1a1aa;
  font-size: 12px;
  text-align: center;
}

.autoplan-lane-ref {
  font-size: 12px;
  font-weight: 600;
}

.autoplan-lane-img {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  height: 120px;
  margin-top: 2px;
  background: #f4f4f5;
}

/* Survol d'une reference : son visuel est encadre */
.autoplan-lane-img {
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.15s ease;
}

.autoplan-lane:hover .autoplan-lane-img,
.autoplan-lane:focus-within .autoplan-lane-img {
  outline-color: var(--accent);
  background: var(--accent-soft);
}

/* Survol d'une ligne de pose : le visuel de la piste de meme numero est encadre (CSS seul, :has) */
.autoplan-forme:has(.autoplan-poses tr[data-pose="0"]:hover) .autoplan-lane[data-pose="0"] .autoplan-lane-img,
.autoplan-forme:has(.autoplan-poses tr[data-pose="1"]:hover) .autoplan-lane[data-pose="1"] .autoplan-lane-img,
.autoplan-forme:has(.autoplan-poses tr[data-pose="2"]:hover) .autoplan-lane[data-pose="2"] .autoplan-lane-img,
.autoplan-forme:has(.autoplan-poses tr[data-pose="3"]:hover) .autoplan-lane[data-pose="3"] .autoplan-lane-img,
.autoplan-forme:has(.autoplan-poses tr[data-pose="4"]:hover) .autoplan-lane[data-pose="4"] .autoplan-lane-img,
.autoplan-forme:has(.autoplan-poses tr[data-pose="5"]:hover) .autoplan-lane[data-pose="5"] .autoplan-lane-img,
.autoplan-forme:has(.autoplan-poses tr[data-pose="6"]:hover) .autoplan-lane[data-pose="6"] .autoplan-lane-img,
.autoplan-forme:has(.autoplan-poses tr[data-pose="7"]:hover) .autoplan-lane[data-pose="7"] .autoplan-lane-img,
.autoplan-forme:has(.autoplan-poses tr[data-pose="8"]:hover) .autoplan-lane[data-pose="8"] .autoplan-lane-img,
.autoplan-forme:has(.autoplan-poses tr[data-pose="9"]:hover) .autoplan-lane[data-pose="9"] .autoplan-lane-img,
.autoplan-forme:has(.autoplan-poses tr[data-pose="10"]:hover) .autoplan-lane[data-pose="10"] .autoplan-lane-img,
.autoplan-forme:has(.autoplan-poses tr[data-pose="11"]:hover) .autoplan-lane[data-pose="11"] .autoplan-lane-img {
  outline-color: var(--accent);
  background: var(--accent-soft);
}

.autoplan-poses tr[data-pose] {
  cursor: default;
}

.autoplan-lane-ref {
  cursor: default;
}

.autoplan-lane-img .refs-thumb {
  width: auto;
  height: 104px;
  max-width: 90%;
  border: 0;
  border-radius: 0;
}

.autoplan-poses {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid #a1a1aa;
  font-size: 12px;
}

.autoplan-poses td {
  padding: 3px 6px;
  border-bottom: 1px solid var(--border);
}

.autoplan-poses tr:last-child td {
  border-bottom: 0;
}

.autoplan-poses .is-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.autoplan-bat {
  text-align: right;
  white-space: nowrap;
  color: var(--text-muted);
}

.autoplan-bat.is-soumis {
  color: var(--accent);
  font-weight: 650;
}

/* BAT : vignette + bouton, ouvrent le PDF dans un nouvel onglet */
.refs-bat-cell {
  width: 1%;
  white-space: nowrap;
}

.refs-bat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
}

.refs-thumb {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.refs-bat-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface);
}

.refs-bat-btn svg {
  width: 14px;
  height: 14px;
}

.refs-bat:hover .refs-bat-btn {
  color: var(--accent);
  border-color: var(--accent);
}

.refs-bat:hover .refs-thumb {
  border-color: var(--accent);
}

.refs-thumb {
  cursor: zoom-in;
}

/* Loupe au survol d'une vignette de BAT */
.bat-zoom {
  position: fixed;
  z-index: 1000;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
  pointer-events: none;
}

.bat-zoom[hidden] {
  display: none;
}

.bat-zoom img {
  display: block;
  max-width: min(380px, 60vw);
  max-height: min(380px, 70vh);
  object-fit: contain;
}

.refs-no-bat {
  color: var(--text-muted);
  font-size: 12px;
}

/* Parcours machines : etapes flechees */
.route {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.route-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 650;
  color: var(--text-muted);
  background: var(--surface);
}

.route-step.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.route-step.is-next {
  background: #fff3dc;
  border-color: #f59e0b;
  color: #8a5a00;
}

.route-tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.85;
}

.route-arrow { color: #a1a1aa; display: inline-flex; }
.route-arrow svg { width: 18px; height: 18px; }

/* Fleche + machine qui suit : inseparables au retour a la ligne */
.route-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* Carte Fabrication (colonne de droite) : machines plus compactes */
.fab-details .route-step {
  padding: 4px 9px;
  font-size: 13px;
}

.fab-details .route-arrow svg {
  width: 15px;
  height: 15px;
}

/* Commentaire bien visible */
.of-comment {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: #fff8db;
  border: 1px solid #f5d76e;
  font-size: 16px;
  font-weight: 600;
  white-space: pre-wrap;
}

.of-comment-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #a07800;
  margin-bottom: 2px;
}

.of-comment svg { width: 20px; height: 20px; flex: 0 0 auto; color: #a07800; }

.info-empty {
  color: var(--text-muted);
}

.info-product {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 8px;
  color: var(--text);
}

.info-product-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
}

.info-product-name svg { width: 18px; height: 18px; color: var(--accent); }

.info-product li { font-size: 14px; line-height: 1.6; }

.info-product ul {
  margin: 0;
  padding-left: 18px;
}

/* Infos produit : tableau comme les references de l'OF, chaque info sur sa propre ligne */
.info-product-lines { list-style: none; padding-left: 0; margin: 0; }

/* Popup "OF fini" : rappel des autres OF du meme client */
dialog.panel.done-reminder { width: min(440px, calc(100vw - 32px)); border-radius: 16px; padding: 0; border: 0; box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25); }
dialog.panel.done-reminder .panel-head { padding: 20px 24px 14px; border-bottom: 0; }
dialog.panel.done-reminder .panel-title { font-size: 18px; font-weight: 700; color: var(--text); }
dialog.panel.done-reminder .panel-body { padding: 0 24px 8px; }
.done-reminder-text { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: var(--text-muted); }
.done-reminder-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.done-reminder-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--surface-2, #f6f7fb); border: 1px solid var(--border); border-radius: 10px; }
.done-reminder-of { font-weight: 700; color: var(--text); }
.done-reminder-machine { font-size: 13px; color: var(--accent, #5b5bd6); font-weight: 600; }
dialog.panel.done-reminder .panel-foot { padding: 16px 24px 20px; border-top: 0; display: flex; justify-content: center; }
dialog.panel.done-reminder .panel-foot .btn { min-width: 220px; height: 38px; padding: 0 24px; justify-content: center; border-radius: 10px; }
.info-product-lines li { padding: 4px 0; border-bottom: 1px solid var(--border); }
.info-product-lines li:last-child { border-bottom: 0; }

.of-card:hover {
  border-color: var(--accent);
}

/* Couleur de ligne selon l'etat (memes teintes que l'ancien planning) */
.of-card.etat-reprise,
.of-card.etat-urgent,
.of-card.etat-bloque {
  color: #fff;
}

.of-card.etat-reprise {
  background: var(--etat-reprise);
  border-color: var(--etat-reprise);
}

.of-card.etat-urgent {
  background: var(--etat-urgent);
  border-color: var(--etat-urgent);
  font-weight: 600;
}

.of-card.etat-bloque {
  background: var(--etat-bloque);
  border-color: var(--etat-bloque);
}

.of-card[class]:hover {
  border-color: var(--accent);
}

/* Sur une ligne coloree, la machine suivante garde la couleur du texte */
.of-card.etat-reprise .of-next,
.of-card.etat-urgent .of-next,
.of-card.etat-bloque .of-next {
  color: inherit;
  text-decoration: underline;
}

/* Note operateurs : badge de nouveau message */
.nav-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.5;
  animation: badge-pulse 1.6s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.45); }
  50% { box-shadow: 0 0 0 4px rgba(229, 72, 77, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .nav-badge { animation: none; }
}

.new-pill {
  display: none;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
}

#noteCard.is-new {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}

#noteCard.is-new .new-pill {
  display: inline-block;
}

#noteCardBody {
  white-space: pre-wrap;
}

/* Selection multiple (admin) : Ctrl+clic / Maj+clic */
.of-card {
  user-select: none;
}

/* Selection : contour violet ; la couleur d'etat est conservee (fond violet clair seulement en direct) */
.of-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.of-card.is-selected:not(.etat-reprise):not(.etat-urgent):not(.etat-bloque) {
  background: var(--accent-soft);
}

.selection-bar {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 6px 8px 6px 14px;
}

.selection-count {
  font-size: 13px;
  font-weight: 650;
  color: var(--accent);
  margin-right: 4px;
}

/* Recherche du planning */
.search-input {
  width: 260px;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.tab-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  font-size: 11px;
  font-weight: 650;
  text-align: center;
}

.tab.is-dim {
  opacity: 0.5;
}

/* OF fini : ligne grisee et barree (le bouton reste lisible pour pouvoir annuler) */
.of-card.is-done {
  background: #f4f4f5;
  border-color: var(--border);
  font-weight: normal;
  transition: background 0.3s ease;
}

.of-card.is-done .of-cell:not(.of-cell-action) {
  color: #a1a1aa;
  text-decoration: line-through;
}

.of-card.is-dragging {
  opacity: 0.4;
}

.of-ref {
  font-weight: 650;
}

/* Pastille machine precedente : verte = terminee, rouge = pas encore, grise = verification */
.etat-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  vertical-align: -1px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.55);
}

.etat-dot.is-ok { background: #22c55e; }
.etat-dot.is-ko { background: #ef4444; }
.etat-dot.is-none { background: #ffffff; border-color: #cbd5e1; }

.of-client {
  font-weight: 500;
}

.of-next {
  color: var(--warning);
  font-weight: 600;
}

/* Depot : OF en attente de planification, en tete de machine */
.day-col.is-depot {
  /* Fond opaque : les jours qui defilent dessous ne doivent pas transparaitre */
  background: linear-gradient(var(--warning-soft), var(--warning-soft)) var(--surface, #fff);
  border-style: dashed;
  border-color: var(--warning);
  /* Reste visible en haut pendant le defilement du planning */
  position: sticky;
  top: 8px;
  z-index: 5;
  max-height: 40vh;
  overflow-y: auto;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.day-col.is-depot .day-col-date {
  color: #8a5a00;
}

/* ---- Dialogs ---- */
dialog.panel {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  width: 440px;
  max-width: 92vw;
  box-shadow: var(--shadow-md);
}

dialog.panel::backdrop {
  background: rgba(15, 15, 20, 0.4);
}

dialog.panel.is-wide {
  width: 820px;
}

/* Code matiere cliquable (carte Fabrication) -> fenetre matiere et bobines */
.matiere-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.matiere-link:hover {
  background: var(--accent);
  color: #fff;
}

/* Capacite des machines par semaine : tableau avec barre de charge par case */
.cap-table-wrap { overflow-x: auto; }
.cap-table { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 13px; }
.cap-table th { text-align: left; padding: 6px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted, #64748b); white-space: nowrap; }
.cap-table td { min-width: 150px; padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); vertical-align: middle; }
.cap-table td:first-child { border-left: 1px solid var(--border); border-radius: 10px 0 0 10px; }
.cap-table td:last-child { border-right: 1px solid var(--border); border-radius: 0 10px 10px 0; }
.cap-week { font-weight: 650; white-space: nowrap; }
.cap-week small { display: block; margin-top: 2px; font-weight: 400; color: var(--muted, #64748b); }
.cap-bar { height: 8px; margin-bottom: 6px; background: var(--surface-2, #eef0f4); border-radius: 999px; overflow: hidden; }
.cap-fill { display: block; height: 100%; border-radius: 999px; }
.cap-fill.is-ok { background: #16a34a; }
.cap-fill.is-high { background: #f59e0b; }
.cap-fill.is-over { background: #dc2626; }
.cap-text { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; white-space: nowrap; }
.cap-text strong { font-size: 14px; }
.cap-text strong.is-ok { color: #15803d; }
.cap-text strong.is-high { color: #b45309; }
.cap-text strong.is-over { color: #dc2626; }
.cap-text small { color: var(--muted, #64748b); font-size: 12px; }
.cap-empty { color: var(--muted, #94a3b8); }

.cap-table th small { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted, #64748b); }
.cap-week-head { text-align: center; background: var(--surface-2, #eef0f4); border-radius: 8px 8px 0 0; color: var(--text); }
.cap-day-head { text-align: center; }
.cap-machine { font-weight: 650; white-space: nowrap; }
.cap-machine small { display: block; font-weight: 400; color: var(--muted, #64748b); }
.cap-filters-bar { margin-bottom: 16px; padding: 12px 14px; background: var(--surface-2, #f6f7fb); border: 1px solid var(--border); border-radius: 12px; }
.cap-filters-title { margin-bottom: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted, #64748b); }
.cap-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cap-filters-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.cap-filter { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; }
.cap-filter input { margin: 0; accent-color: var(--accent); }
.cap-filter:has(input:checked) { background: var(--accent-soft, #eef0ff); border-color: var(--accent); color: var(--accent); }

.cap-machine-block { margin-bottom: 22px; }
.cap-machine-block h5 { margin: 0 0 8px; font-size: 15px; font-weight: 650; }
.cap-day { font-weight: 650; white-space: nowrap; }
.cap-date { margin-bottom: 4px; font-size: 12px; color: var(--muted, #64748b); }
.cap-table th.is-current-week, .cap-table td.is-current-week { background: var(--accent-soft, #eef0ff); }
.cap-chip { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.cap-empty-cell { text-align: center; color: var(--muted, #94a3b8); }

/* Tableau de capacite : tient dans la fenetre sans defilement horizontal */
.cap-table { table-layout: fixed; width: 100%; }
.cap-table th, .cap-table td { min-width: 0; padding: 6px 4px; }
.cap-table th { font-size: 11px; white-space: normal; }
.cap-table th small { font-size: 10px; }
.cap-table td:first-child, .cap-table th:first-child { width: 48px; }
.cap-day { font-size: 12px; }
.cap-date { font-size: 11px; }
.cap-text { flex-wrap: wrap; gap: 0; }
.cap-text strong { font-size: 12px; }
.cap-text small { font-size: 10px; }
.cap-chip { font-size: 9px; }

/* Compteur sur le bouton Archives : nombre d'OF archives trouves pendant la recherche */
.archives-count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; }

/* Squelette de chargement du planning : cartes factices qui scintillent */
.skel-day { display: flex; gap: 14px; overflow: hidden; }
.skel-card { flex: 0 0 280px; display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.skel-bar { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2, #eef0f4) 25%, #ffffff 50%, var(--surface-2, #eef0f4) 75%); background-size: 200% 100%; animation: skel-shimmer 1.2s infinite linear; }
.skel-bar.short { width: 55%; }
@keyframes skel-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel-bar { animation: none; } }
.skel-stack { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; }
/* Vignette pas encore chargee (pas de src) : meme scintillement que le reste du chargement */
img.refs-thumb:not([src]) { min-height: 48px; min-width: 48px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2, #eef0f4) 25%, #ffffff 50%, var(--surface-2, #eef0f4) 75%); background-size: 200% 100%; animation: skel-shimmer 1.2s infinite linear; }

/* Rappel "OF fini" : fenetre plus large pour lire les adresses */
dialog.done-reminder { width: min(760px, 94vw); max-width: none; }

/* Adresse de livraison dans la fenetre "Meme client" */
.same-adresse-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #dcfce7; color: #15803d; font-size: 11px; font-weight: 700; white-space: nowrap; }
.diff-adresse { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #fef3c7; color: #b45309; font-size: 11px; font-weight: 700; white-space: nowrap; }

/* Liste de cartons : imprimante et impression directe regroupees en bas a droite */
.cartons-print-group { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.cartons-print-group select { height: 34px; min-width: 170px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }

/* Impression etiquettes : bandeau superieur fixe, comme les autres pages du site */
#view-etiquettes .page-header { position: sticky; top: 0; z-index: 7; background: var(--surface); color: var(--text); border-bottom: 1px solid var(--border); margin: -28px -36px 14px; padding: 14px 36px; min-height: 0; align-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); }
#view-etiquettes .page-header .page-title { font-size: 16px; color: var(--text); }
/* Listes de l'editeur (imprimante, format, police, taille) : meme style que les champs du site */
#view-etiquettes select { height: 34px; min-width: 170px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
#view-etiquettes .page-actions { gap: 8px; align-items: center; }
/* Page Impression etiquettes : panneau de reglages a gauche, apercu a droite */
#view-etiquettes .etiq-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
#view-etiquettes .etiq-side select { width: 100%; min-width: 0; }
#view-etiquettes .etiq-side { display: flex; flex-direction: column; gap: 18px; }
#view-etiquettes .etiq-section { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
#view-etiquettes .etiq-section:last-child { border-bottom: 0; padding-bottom: 0; }
#view-etiquettes .etiq-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted, #64748b); }
#view-etiquettes .etiq-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted, #64748b); }
#view-etiquettes .etiq-field select, #view-etiquettes .etiq-btns select { height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
#view-etiquettes .etiq-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#view-etiquettes .etiq-btns .btn { min-width: 34px; }
#view-etiquettes .etiq-main { min-width: 0; }
#view-etiquettes .etiq-switch { position: relative; display: inline-flex; align-items: center; gap: 8px; width: 100%; font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; }
#view-etiquettes .etiq-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
#view-etiquettes .etiq-switch-track { position: relative; flex: 0 0 auto; width: 38px; height: 22px; border-radius: 999px; background: #cbd5e1; transition: background 0.15s; }
#view-etiquettes .etiq-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
#view-etiquettes .etiq-switch input:checked + .etiq-switch-track { background: var(--accent, #5b5bd6); }
#view-etiquettes .etiq-switch input:checked + .etiq-switch-track::after { transform: translateX(16px); }
#view-etiquettes .btn:disabled { opacity: 0.45; cursor: not-allowed; }
#view-etiquettes .btn.is-active { background: var(--accent, #5b5bd6); border-color: var(--accent, #5b5bd6); color: #fff; }
#view-etiquettes .etiq-preview-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 10px; }
#view-etiquettes .etiq-head-left { display: flex; align-items: center; gap: 6px; }
#view-etiquettes #etiqBlankSheet { display: inline-flex; align-items: center; gap: 6px; }
#view-etiquettes #etiqBlankSheet svg { width: 16px; height: 16px; }
/* Mode visualisation : blocs sans cadre */
#etiqSheet.is-view .etiq-block { border-color: transparent; background: transparent; }
#etiqSheet.is-view .etiq-block:not(.is-locked) { border: 1px solid #e2e8f0; }
#etiqSheet.is-view .etiq-block-lock { display: none; }
#view-etiquettes .etiq-preview-head .etiq-switch { width: auto; }
#view-etiquettes .etiq-preview { display: flex; justify-content: center; align-items: flex-start; padding: 16px; background: #f1f5f9; border-radius: 10px; overflow: hidden; }
@media (max-width: 900px) { #view-etiquettes .etiq-layout { grid-template-columns: 1fr; } }

/* Barre d'outils de l'editeur : groupes titres */
#view-etiquettes .etiq-group { display: flex; flex-direction: column; gap: 6px; }
#view-etiquettes .etiq-group-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted, #64748b); }
#view-etiquettes .etiq-group-buttons { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
#view-etiquettes .etiq-group-buttons select { height: 30px; min-width: 150px; }

/* Blocs de texte sur la feuille d'etiquette */
#etiqSheet .etiq-block { position: absolute; box-sizing: border-box; border: 1px dashed #64748b; background: rgba(255, 255, 255, 0.9); cursor: move; overflow: hidden; }
#etiqSheet .etiq-block-del { position: absolute; right: 0; top: 0; width: 4mm; height: 4mm; padding: 0; border: 0; background: #dc2626; color: #fff; font-size: 10px; line-height: 4mm; cursor: pointer; z-index: 2; }
#etiqSheet .etiq-block-text { position: absolute; left: 0.2mm; top: 0.2mm; right: 0.2mm; bottom: 0.2mm; padding: 0; outline: none; overflow: hidden; white-space: nowrap; line-height: 1.1; font: inherit; cursor: text; }
#etiqSheet .etiq-block.is-selected { border: 2px solid var(--accent, #5b5bd6); }
#etiqSheet .etiq-block.is-locked { cursor: default; border-style: solid; border-color: #94a3b8; }
#etiqSheet.is-view .etiq-block.is-locked { border-color: transparent; }
#etiqSheet .etiq-block-lock { position: absolute; right: 0.3mm; top: 0.3mm; width: 4mm; height: 4mm; z-index: 3; fill: none; stroke: #0f172a; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }

/* Editeur Quill dans les deux colonnes de la feuille d'etiquette */
#etiqSheet .etiq-col .ql-container { border: 0; height: 100%; font: inherit; font-size: inherit; }
#etiqSheet .etiq-col .ql-editor { padding: 0; height: 100%; overflow: hidden; font-family: inherit; font-size: inherit; line-height: 1.1; }
#etiqSheet .etiq-col .ql-editor.ql-blank::before { display: none; }
/* Carte de l'editeur : meme presentation que les cartes des autres pages */
#view-etiquettes .card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06); margin-top: 14px; }

/* Parametres > Imprimante : une ligne par imprimante (nom, adresse IP, suppression) */
.printer-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px minmax(220px, 300px) auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.printer-row input, .printer-row select { width: 100%; height: 34px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.printer-row select { text-overflow: ellipsis; }
.printer-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft, #eef0ff); }
.printer-row [data-f="ip"] { font-variant-numeric: tabular-nums; }
.printer-row [data-printer-del] { height: 34px; }

/* Repere des OF barres plus bas que la zone visible (planning admin) */
.done-below-hint { position: fixed; right: 16px; bottom: 16px; z-index: 50; padding: 8px 14px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: inherit; font-weight: 650; box-shadow: 0 6px 18px rgba(15, 23, 42, 0.25); cursor: pointer; }

/* Onglets des matieres dans la fenetre matiere (une matiere par onglet) */
.matiere-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.matiere-tab { padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; }
.matiere-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.matiere-tab { display: inline-flex; align-items: center; gap: 6px; }
.matiere-tab-icon { display: inline-flex; }
.matiere-tab-icon:empty { display: none; }
.matiere-tab-icon svg { width: 14px; height: 14px; }
.panel-title .matiere-tab-icon { margin-right: 8px; }
.panel-title .matiere-tab-icon svg, .panel-title > svg { width: 18px; height: 18px; vertical-align: -3px; margin-right: 8px; }

/* Matiere dans le tableau des journees : simple texte cliquable (rouge via .is-empty) */
.matiere-link.matiere-plain {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font-weight: 600;
  text-decoration: underline dotted;
}

/* Stock insuffisant dans le tableau : texte rouge fonce, sans fond ni cadre (lisible sur ligne coloree) */
.matiere-link.matiere-plain.is-empty {
  background: none;
  border: 0;
  color: #b91c1c;
  font-weight: 700;
}

.matiere-link svg {
  width: 15px;
  height: 15px;
}

/* Fenetre matiere : fiche, stock, bobines par emplacement */
.recherche-empl-form { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.recherche-empl-form .search-input { flex: 1; width: auto; min-width: 0; height: 36px; box-sizing: border-box; padding: 0 12px; }
.recherche-empl-form .btn { height: 36px; padding: 0 16px; }
.matiere-libelle {
  font-size: 16px;
  font-weight: 750;
  margin-bottom: 8px;
}

.matiere-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.matiere-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.matiere-summary-tile {
  flex: 1 1 160px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.matiere-summary-tile.is-warning {
  background: #fef2f2;
}

.matiere-summary-value {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
}

.matiere-summary-tile.is-warning .matiere-summary-value {
  color: #b91c1c;
}

.matiere-summary-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--text-muted);
}

.matiere-empl {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.matiere-empl-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f4f4f5;
  font-weight: 700;
}

.matiere-empl-head svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.matiere-empl-head .matiere-empl-total {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.matiere-bobines td,
.matiere-bobines th {
  padding: 6px 12px;
}

.matiere-bobines .is-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Jauge : metres restants sur metres recus */
.bobine-gauge {
  display: inline-block;
  width: 70px;
  height: 7px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 999px;
  background: #e4e4e7;
  overflow: hidden;
}

.bobine-gauge span {
  display: block;
  height: 100%;
  background: #16a34a;
}

.panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 15px;
  font-weight: 650;
  margin: 0;
}

.panel-close {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
}

.panel-body {
  padding: 16px 20px;
  max-height: 65vh;
  overflow-y: auto;
}

.panel-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* ---- Forms ---- */
.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.field-row[hidden] { display: none; }

.etat-group {
  display: flex;
  gap: 6px;
}

.etat-pill {
  flex: 1;
  padding: 6px 0;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-muted);
}

.etat-pill.is-active[data-etat="direct"] {
  background: #f4f4f5;
  color: var(--text);
  border-color: #d4d4d8;
}

.etat-pill.is-active[data-etat="reprise"] {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: var(--warning);
}

.etat-pill.is-active[data-etat="urgent"] {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}

.etat-pill.is-active[data-etat="bloque"] {
  background: var(--danger-soft);
  color: #b3261e;
  border-color: #b3261e;
}

/* ---- Table ---- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.table th {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.table input {
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px;
  width: 100%;
}

.table select {
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px;
  font-family: inherit;
  background: var(--surface);
  width: 100%;
}

.table-scroll {
  overflow-x: auto;
}

.schedule-grid {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 6px 10px;
  align-items: center;
  font-size: 13px;
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

.check-item:hover {
  background: #f4f4f5;
}

.field .check-item input {
  width: auto;
}

.check-note {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-muted);
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.form-hint code {
  background: #f4f4f5;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
}

/* ---- Horaires de travail ---- */
.hc-toolbar {
  flex-wrap: wrap;
}

.hc-toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hc-week-label {
  font-weight: 600;
  min-width: 210px;
  text-align: center;
}

.hc-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px;
  font-family: inherit;
  background: var(--surface);
}

.hc-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.hc-table th,
.hc-table td {
  border: 1px solid var(--border);
}

.hc-center {
  text-align: center !important;
  white-space: nowrap;
}

.hc-date {
  font-weight: 500;
  text-transform: none;
}

.hc-name {
  font-weight: 600;
  white-space: nowrap;
}

.hc {
  text-align: center !important;
  font-size: 12px;
  line-height: 1.5;
  min-width: 96px;
}

.hc.is-editable {
  cursor: pointer;
}

.hc.is-editable:hover {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.hc-empty { color: var(--text-muted); }
.hc-default { background: #fafafa; color: var(--text-muted); }
.hc-filled { background: transparent; }
.hc-over { background: var(--danger-soft); color: var(--danger); font-weight: 650; }
.hc-note { background: var(--warning-soft); font-style: italic; }
.hc-note-text { font-style: italic; font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.hc-vacation { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.hc-absence { background: #f4f4f5; color: var(--text-muted); font-style: italic; }

.hc-diff {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}

.hc-diff.is-over { background: var(--danger-soft); color: var(--danger); }
.hc-diff.is-under { background: #f4f4f5; color: var(--text-muted); }
.hc-diff.is-ok { background: #ecfdf3; color: #1f8a4c; }

.hc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.hc-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hc-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* ---- Misc ---- */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  z-index: 999;
  max-width: 360px;
}

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

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.15s ease;
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .page {
    padding: 20px;
  }
  button.mobile-menu-btn {
    display: inline-flex;
  }
  button.mobile-menu-btn.in-header {
    position: static;
    flex-shrink: 0;
    margin-top: 2px;
  }
  /* Planning sur mobile : le tableau des OF defile dans sa carte, la page ne deborde plus */
  .day-row,
  .day-col {
    min-width: 0;
    max-width: 100%;
  }
  .day-col {
    overflow-x: auto;
  }
}

/* Bouton menu sur mobile : ouvre la barre laterale */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 60;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}
.mobile-menu-btn[hidden] {
  display: none;
}

/* Icone commentaire a cote du n° d'OF */
.of-comment-flag {
  display: inline-flex;
  vertical-align: -2px;
  margin-left: 5px;
  color: #c08a00;
}

.of-comment-flag svg { width: 14px; height: 14px; }

.of-card.etat-reprise .of-comment-flag,
.of-card.etat-urgent .of-comment-flag,
.of-card.etat-bloque .of-comment-flag { color: inherit; }

/* Menu du clic droit sur un OF (admin) */
.context-menu {
  position: fixed;
  z-index: 1000;
  min-width: 230px;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.context-title {
  padding: 6px 10px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.context-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.context-item svg { width: 16px; height: 16px; color: var(--text-muted); flex: 0 0 auto; }
.context-item:hover { background: var(--accent-soft); }
.context-item:hover svg { color: var(--accent); }
.context-item[data-danger] { color: var(--danger); }
.context-item[data-danger] svg { color: var(--danger); }
.context-item[data-danger]:hover { background: var(--danger-soft); }

.context-sep {
  height: 1px;
  margin: 4px 0;
  background: var(--border);
}

.context-label {
  padding: 6px 10px 2px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.context-etats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px 6px 6px;
}

.context-etat {
  padding: 5px 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  background: var(--surface);
}

.context-etat.etat-reprise { background: var(--etat-reprise); border-color: var(--etat-reprise); color: #fff; }
.context-etat.etat-urgent { background: var(--etat-urgent); border-color: var(--etat-urgent); color: #fff; }
.context-etat.etat-bloque { background: var(--etat-bloque); border-color: var(--etat-bloque); color: #fff; }
.context-etat:hover { filter: brightness(0.92); }

/* Fiche OF admin : titre de groupe de champs */
.field-group-title {
  margin: 14px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* Carte Conditionnement : dessin de la bobine + chiffres */
.packaging {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.reel-drawing {
  /* largeur fixee par le dessin (echelle constante) ; reduit pour laisser la place aux chiffres */
  max-width: min(100%, 280px);
  height: auto;
  flex: 0 1 auto;
}

/* Bobine d'etiquettes en 3D : support jaune, etiquettes blanches, mandrin carton */
.reel3d-shadow { fill: rgba(0, 0, 0, 0.08); }
.reel3d-body { fill: #ecd98e; stroke: #a8904a; stroke-width: 1.5; }
.reel3d-band { fill: #ffffff; stroke: none; }
.reel3d-gap { stroke: #ecd98e; stroke-width: 2.5; }
.reel3d-strip { fill: #ecd98e; stroke: #a8904a; stroke-width: 1.5; stroke-linejoin: round; }
.reel3d-label { fill: #ffffff; stroke: #d9c477; stroke-width: 0.8; }
.reel3d-top { fill: #f6ebbd; stroke: #a8904a; stroke-width: 1.5; }
.reel3d-top.is-unknown { stroke-dasharray: 4 4; }
.reel3d-min { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-dasharray: 5 4; }
.reel3d-core { fill: #b8946a; stroke: #6b4f2a; stroke-width: 1.5; }
.reel3d-hole { fill: #5e452a; }
.reel-dim path { fill: none; stroke: var(--text-muted); stroke-width: 1.2; }
.reel-dim .reel-dim-guide { stroke-dasharray: 2 3; stroke-width: 1; }
.reel-strip-num { font-size: var(--dimfs, 13px); font-weight: 700; fill: var(--text, #1f2937); paint-order: stroke; stroke: #fff; stroke-width: 3px; }

/* Chiffres : assez larges pour que les libelles tiennent sur une ligne ; passent sous le dessin sinon */
.packaging-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 290px;
  flex: 1 1 290px;
}

.packaging-count {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.packaging-count-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--accent);
}

.packaging-count-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.reel-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Pastille | libelle (toute la place, sur une ligne) | valeur alignee a droite | boutons (largeur fixe,
   pour que toutes les valeurs s'alignent sur le meme bord, avec ou sans bouton) */
.reel-legend li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto 60px;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.3;
  color: var(--text-muted);
  font-weight: 600;
}

.reel-legend li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

/* Carte Fabrication : tableau du format a gauche, matiere / vernis / parcours a droite */
.fab-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 28px;
  align-items: start;
}

.fab-format {
  padding-right: 24px;
  border-right: 1px solid var(--border);
}

.fab-format-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text-muted);
}

.fab-format-title svg {
  width: 18px;
  height: 18px;
}

.fab-details .of-detail-row {
  grid-template-columns: 34px 96px 1fr;
}

@media (max-width: 760px) {
  .fab-grid { grid-template-columns: 1fr; }
  .fab-format { padding-right: 0; border-right: 0; }
}

/* Format condense (carte Fabrication) : dimensions, poses, espaces et entraxes en laize / avance */
.format-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.format-box-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.format-table {
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.format-table th,
.format-table td {
  padding: 3px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.format-table thead th {
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.format-table tbody th {
  padding-left: 0;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
}

.format-table tbody tr:last-child th,
.format-table tbody tr:last-child td {
  border-bottom: 0;
}

.format-table tr.is-strong td {
  font-weight: 750;
  color: var(--accent);
}

/* Icone a la place de la pastille (ex. rouleaux / carton) */
.reel-icon {
  display: inline-flex;
  color: var(--text-muted);
}

.reel-icon svg {
  width: 18px;
  height: 18px;
}

/* Saisie dans la ligne (rouleaux / carton) */
.reel-legend strong {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

/* Production du jour : bouton Imprimer en bas a droite de la fenetre */
#productionJourDialog .prod-jour-foot { display: flex; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border, #e2e8f0); }

/* Impression : seul le rapport Production du jour sort sur papier (bloc copie par planning.js) */
#prodJourPrintArea { display: none; }
@media print {
  body.is-printing-prod-jour > *:not(#prodJourPrintArea) { display: none !important; }
  body.is-printing-prod-jour #prodJourPrintArea { display: block; color: #000; background: #fff; font-size: 12px; }
  /* La regle d'impression de la Maintenance cache tout le body : le bloc doit rester visible */
  body.is-printing-prod-jour #prodJourPrintArea, body.is-printing-prod-jour #prodJourPrintArea * { visibility: visible !important; }
}
@page { size: A4 portrait; margin: 15mm; }

/* Calculette rouleaux : resultat en evidence, parametres secondaires (repliés) */
#rouleauxDialog .rl-modes { display: flex; gap: 8px; margin-bottom: 12px; }
#rouleauxDialog .rl-mode { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
#rouleauxDialog .rl-mode svg { width: 18px; height: 18px; }
#rouleauxDialog .rl-mode.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
#rouleauxDialog .rl-result { font-size: 20px; font-weight: 700; color: var(--text); margin: 14px 0; min-height: 28px; }
#rouleauxDialog .rl-params { margin-top: 12px; color: var(--text-muted); font-size: 12px; }
#rouleauxDialog .rl-params summary { cursor: pointer; padding: 4px 0; }
#rouleauxDialog .rl-params .field { margin-top: 8px; }

/* Liste des cartons CERM (ligne Carton) : largeur fixe pour ne pas ecraser le libelle */
.carton-mat-select {
  width: 220px;
  max-width: 100%;
  height: 30px;
  padding: 0 6px;
  font-size: 13px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 6px;
  background: var(--surface, #fff);
  color: var(--text);
}

.carton-input {
  width: 72px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 15px;
  text-align: right;
}

/* Colonne des boutons : crayon, ou valider + annuler pendant la saisie */
.reel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.carton-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.carton-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.carton-save {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.carton-save:hover {
  color: #fff;
  opacity: 0.9;
}

.carton-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.carton-btn svg {
  width: 15px;
  height: 15px;
}

/* Crayon "Modifier" de l'info production : meme couleur que le crayon carton */
[data-werkbon-edit] {
  color: var(--text-muted);
}

[data-werkbon-edit]:hover {
  color: var(--accent);
}

.of-comment [data-werkbon-edit] svg {
  width: 15px;
  height: 15px;
  color: inherit;
}

.reel-legend strong {
  white-space: nowrap;
  text-align: right;
  color: var(--text);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.reel-key {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.reel-key.is-max { background: #f6ebbd; border: 2px solid #a8904a; }
.reel-key.is-min { border: 2px dashed var(--accent); }
.reel-key.is-core { background: #b8946a; border: 2px solid #6b4f2a; }

.reel-dim text {
  font-family: var(--font);
  font-size: var(--dimfs, 13px);
  font-weight: 700;
  fill: var(--text);
}

/* Outil de decoupe au-dessus du tableau Format (carte Fabrication) */
.format-tool {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.format-tool svg {
  width: 15px;
  height: 15px;
}

/* Plaque de decoupe (magnetique) sous le tableau Format : numero, description, emplacement */
.tool-plate {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed #c4b5fd;
  border-radius: var(--radius-sm);
  background: #faf9ff;
}

.tool-plate-icon {
  display: inline-flex;
  color: var(--accent);
}

.tool-plate-icon svg {
  width: 20px;
  height: 20px;
}

.tool-plate-text {
  flex: 1 1 200px;
  min-width: 0;
}

.tool-plate-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-muted);
}

.tool-plate-title strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.tool-plate-desc {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-plate-loc {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tool-plate-loc svg {
  width: 13px;
  height: 13px;
}

.tool-plate-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-plate-num {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

/* Emplacement de l'outil (IC, XP, LASER) : discret, sous le numero */
.tool-plate-sub {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tool-plate-sub svg {
  width: 11px;
  height: 11px;
  vertical-align: -1px;
  margin-right: 3px;
}

/* Numero d'outil, emplacement dessous (meme ligne que l'icone) */
.tool-plate-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

/* Icone et emplacement sur la meme ligne (SVG forcé en ligne) */
.tool-plate-sub {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tool-plate-sub svg {
  display: inline-block;
  flex: 0 0 auto;
}

/* Numero d'outil puis emplacement dans une colonne a droite */
.tool-plate-stack {
  flex-direction: row;
  align-items: center;
  gap: 14px;
}

/* Outil d'une finition inline (dorure, serigraphie) : libelle puis numero */
.tool-plate-fin {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Finition inline sous la decoupe : icone propre a la finition */
.tool-plate-fin-line {
  gap: 8px;
  margin-top: 4px;
}

.tool-plate-fin-icon {
  display: inline-flex;
  color: #a16207;
}

.tool-plate-fin-icon svg {
  width: 14px;
  height: 14px;
}

/* Decoupe et finitions d'outil : meme groupe, un seul trait a la fin */
.tool-group > .of-detail-row {
  border-bottom: none;
  padding-bottom: 6px;
}

.tool-group > .of-detail-row:last-child {
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

/* Decoupe n'est plus collee au trait du dessus (premiere ligne du groupe) */
.tool-group > .of-detail-row:first-child {
  padding-top: 12px;
}

/* Etat de l'outil de decoupe (CERM) : petit badge avant le numero, libelle au survol */
.tool-plate-head { display: inline-flex; align-items: center; gap: 6px; }
.tool-state { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: #9ca3af; cursor: help; }
.tool-state.is-3 { background: #16a34a; }
.tool-state.is-1 { background: #f59e0b; }
.tool-state.is-2 { background: #2563eb; }
.tool-state.is-4, .tool-state.is-5 { background: #dc2626; }
.tool-state.is-6 { background: #7c3aed; }

/* Planning admin : bandeau fixe fin (titre, recherche, actions) ; machines et depot collent dessous */
#view-planning .page-header {
  position: sticky;
  top: 0;
  z-index: 7;
  background: var(--surface);
  min-height: 56px;
  padding: 8px 0;
  margin-bottom: 0;
}
#view-planning .page-header .page-title { font-size: 16px; }
#view-planning .page-header .page-subtitle { display: none; }
#view-planning #planningTabs {
  position: sticky;
  top: 72px;
  z-index: 6;
  background: var(--surface);
  padding: 6px 0 8px;
  margin: 0;
}
#view-planning .day-col.is-depot { top: 124px; }

/* Planning admin : bandeau et machines en gris anthracite */
#view-planning .page-header,
#view-planning #planningTabs { background: #3b3f46; }
#view-planning .page-header .page-title { color: #ffffff; }
#view-planning #planningTabs .tab { background: #4a4f58; border-color: #4a4f58; color: #e5e7eb; }
#view-planning #planningTabs .tab:hover { background: #575c66; color: #ffffff; }
#view-planning #planningTabs .tab.is-active { background: #ffffff; border-color: #ffffff; color: #3b3f46; }
#view-planning #planningTabs .tab-count { color: inherit; opacity: 0.8; }

/* Planning admin : barre de recherche sombre pleine largeur, comme l'ancien planning */
#view-planning .page-header {
  background: #0b0f14;
  color: #e2e8f0;
  margin: -28px -36px 0;
  padding: 10px 36px;
  min-height: 0;
  border-radius: 0;
  align-items: center;
}
#view-planning #planningTabs {
  top: 62px;
  margin: 0 -36px;
  padding: 6px 36px 8px;
}
#view-planning .day-col.is-depot { top: 122px; }

/* Planning admin : machines dans la barre sombre du haut (plus de bande grise) */
#view-planning #planningTabs {
  position: static;
  background: none;
  padding: 0;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}
/* Depot : colle sous le bandeau du planning (72 px) et la barre des machines (environ 64 px) */
#view-planning .day-col.is-depot { position: sticky; top: 136px; }

/* Planning admin : bandeau blanc, espaces alignes sur les journees (gap 14px, marges de la page) */
#view-planning .page-header {
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin: -28px -36px 14px;
  padding: 14px 36px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
#view-planning .page-header .page-title { color: var(--text); }
#view-planning #planningTabs .tab { background: var(--surface); border-color: var(--border); color: var(--text); }
#view-planning #planningTabs .tab:hover { background: var(--bg); color: var(--text); }
#view-planning #planningTabs .tab.is-active { background: var(--accent); border-color: var(--accent); color: #ffffff; }
#view-planning #planningTabs .tab-count { color: inherit; opacity: 0.7; }

/* Mise a jour CERM : voile flou au centre de l'ecran, bloque l'usage du planning pendant la mise a jour */
.cerm-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: wait;
}
.cerm-progress-card {
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}
.cerm-progress-text { font-size: 12px; color: var(--text); margin-bottom: 6px; }
.cerm-progress-track { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.cerm-progress-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

/* Planning admin : recherche et boutons de la barre de meme hauteur */
#view-planning .page-header .btn,
#view-planning .page-header .search-input {
  height: 32px;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1;
}
#view-planning .page-header .search-input { padding-left: 10px; padding-right: 10px; }

/* Fenetre d'ajout / modification d'OF : plus large, fond flou comme la mise a jour CERM */
#ofDialog { width: min(1040px, 92vw); }
#ofDialog::backdrop {
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Fenetre OF : le contenu defile dans la fenetre, la page derriere reste figee */
#ofDialog { max-height: 92vh; }
#ofDialog form {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  min-height: 0;
}
#ofDialog .panel-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}
body:has(#ofDialog[open]) { overflow: hidden; }

/* Fenetre OF condensee : espaces resserres pour tenir sans defiler */
#ofDialog .panel-head { padding: 10px 16px; }
#ofDialog .panel-body { padding: 10px 16px; }
#ofDialog .panel-foot { padding: 10px 16px; }
#ofDialog .field { margin-bottom: 6px; }
#ofDialog .field label { margin-bottom: 2px; }
#ofDialog .field input,
#ofDialog .field select,
#ofDialog .field textarea { padding: 5px 8px; }
#ofDialog .field-row { gap: 8px; }

/* Fenetre OF : seuls etat, avancement, reference, temps et reprise 1 restent modifiables ;
   le reste (donnees CERM) est masque */
#ofDialog .field:has(#ofCommande),
#ofDialog .field:has(#ofClient),
#ofDialog .field:has(#ofFormat),
#ofDialog .field:has(#ofQuantite),
#ofDialog .field:has(#ofDepart),
#ofDialog .field:has(#ofFinition),
#ofDialog .field:has(#ofPrix) { display: none; }
#ofDialog .panel-body > .form-hint:not(#ofRepriseHint) { display: none; }
#ofDialog .field-row { grid-template-columns: 1fr; }

/* Temps de l'OF : curseur avec la valeur affichee a droite */
.temps-slider { display: flex; align-items: center; gap: 12px; }
.temps-slider input[type="range"] { flex: 1; accent-color: var(--accent); }
.temps-slider output { min-width: 56px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }

/* Fenetre d'ajout de journee : meme fond flou que les autres fenetres */
#dayDialog::backdrop {
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Fenetre OF : bouton Enregistrer en bas a droite (Supprimer reste a gauche) */
#ofDialog .panel-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
#ofDialog #ofDialogDelete { margin-right: auto; }

/* Fiche technique de l'OF ouverte depuis le planning admin : plein ecran avec bouton retour */
.fiche-overlay {
  position: fixed;
  inset: 0;
  z-index: 1600;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.fiche-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.fiche-bar-title { font-weight: 600; color: var(--text); }
#ofFicheFrame { flex: 1; width: 100%; border: 0; }
/* Dans le planning admin, la fiche n'affiche pas le menu de gauche de l'operateur */
.is-embed .sidebar { display: none; }
/* Fiche ouverte depuis le planning admin : pas de boutons d'action de l'operateur en haut a droite */
.is-embed #ofInfoActions { display: none; }

/* Journees archivees : liste par machine, bouton Restaurer */
.archive-day { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.archive-machine { margin: 14px 0 6px; font-size: 14px; }
#archivesDialog::backdrop { background: rgba(15, 23, 42, 0.25); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.archive-results { margin-bottom: 14px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.archive-results-title { font-weight: 600; margin-bottom: 4px; }

/* Journees archivees : chaque journee se deplie pour voir ses OF */
.archive-machine-block { margin-bottom: 14px; }
.archive-group { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; background: var(--surface); }
.archive-group > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 12px; cursor: pointer; list-style: none; font-weight: 600; }
.archive-group > summary::-webkit-details-marker { display: none; }
.archive-group > summary::before { content: "▸"; margin-right: 8px; color: var(--text-muted); transition: transform 0.15s; display: inline-block; }
.archive-group[open] > summary::before { transform: rotate(90deg); }
.archive-group > summary > span:first-child { flex: 1; }
.archive-group-body { padding: 0 12px 12px; }
.archive-of-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.archive-of-table th, .archive-of-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.archive-of-table th { color: var(--text-muted); font-weight: 600; font-size: 12px; }
.archive-of-table .is-num { text-align: right; }
.archive-day-actions { margin-top: 10px; text-align: right; }

/* Parametres : meme barre du haut que le planning (blanche, collante, titre compact) */
#view-parametres .page-header {
  position: sticky;
  top: 0;
  z-index: 7;
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin: -28px -36px 14px;
  padding: 14px 36px;
  min-height: 0;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
#view-parametres .page-header .page-title { font-size: 16px; color: var(--text); }
#view-parametres .page-header .page-subtitle { display: none; }
#view-parametres .page-header .btn {
  height: 32px;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1;
}

/* Parametres : Machines / Operateurs dans la barre du haut, comme les machines du planning */
#view-parametres .page-header .tabs { flex: 1 1 auto; min-width: 0; margin: 0; }

/* Outils : catalogue avec favoris, et favoris dans la barre laterale */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tool-card { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.tool-card-icon { font-size: 22px; }
.tool-card-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tool-card-soon { font-size: 12px; color: var(--text-muted); }
.tool-fav { border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.tool-fav.is-fav { color: #f59e0b; }
.tool-fav-star { color: #f59e0b; }
.tool-card-icon svg { width: 22px; height: 22px; }

/* Barre laterale : separateur au-dessus des favoris outils */
.sidebar-divider { height: 1px; background: var(--border); margin: 10px 4px; }

/* Liste de cartons : popup, tableau, palettes et resume */
#cartonsDialog::backdrop { background: rgba(15, 23, 42, 0.25); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.cartons-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.cartons-table input, .cartons-table select { width: 100%; padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; background: var(--surface); }
.cartons-table td, .cartons-table th { vertical-align: middle; }
.cartons-summary, #cartonsSummary { margin-top: 14px; }
.cartons-pal { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 8px; background: var(--surface); }
.cartons-pal-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cartons-pal-lines { margin-top: 6px; font-size: 13px; color: var(--text-muted); }
.cartons-pal-h { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.cartons-pal-h input { width: 84px; padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; background: var(--surface); }

/* Formats de cartons : apercu 3D (Parametres et liste de cartons) */
.carton-preview { display: inline-block; vertical-align: middle; }
.carton-preview svg { width: 132px; height: 74px; }
.carton-preview-front { fill: #f6ebbd; stroke: #a8904a; stroke-width: 1; }
.carton-preview-top { fill: #fbf3d0; stroke: #a8904a; stroke-width: 1; }
.carton-preview-side { fill: #e9d89a; stroke: #a8904a; stroke-width: 1; }
.carton-preview-edge { fill: none; stroke: #7a6526; stroke-width: 0.8; }
.carton-setting { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.carton-setting > span:not(.carton-preview) { flex: 1; font-weight: 600; }
.carton-setting-add { display: flex; gap: 6px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.carton-setting-add input { width: 110px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; }
.carton-preview-cote { font-size: 7px; font-weight: 700; fill: var(--text); paint-order: stroke; stroke: #fff; stroke-width: 2px; }

/* Paramètres > Cartons : cartes de formats de carton et de palette cote a cote */
.cartons-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .cartons-grid { grid-template-columns: 1fr; } }

.cartons-grid { align-items: stretch; }
.cartons-grid > .card { margin-top: 0; height: 100%; }

/* Bandeau des cartes de Parametres : titre a gauche, bouton d'ajout a droite */
.card-header-action { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cartons-dimension { display: flex; align-items: center; gap: 8px; }
.cartons-dimension select { flex: 1; min-width: 120px; }
.cartons-table .carton-preview svg { width: 90px; height: 50px; }
.cartons-row-actions { white-space: nowrap; }
.cartons-row-actions .btn { margin-right: 4px; }
.cartons-pal select { padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; background: var(--surface); color: var(--text); min-width: 180px; }

.label-modules { margin-top: 12px; }
.label-modules-title { font-weight: 600; margin-bottom: 6px; }
.label-module { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }

.label-dims { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
.label-dims-title { font-weight: 600; margin-bottom: 6px; }
.label-preview { margin-top: 14px; }
.label-svg { display: block; }
.label-outer { fill: #fff; stroke: #0f172a; stroke-width: 1; }
.label-zone { fill: rgba(91, 91, 214, 0.15); stroke: #5b5bd6; stroke-width: 1.5; stroke-dasharray: 4 3; cursor: move; }
/* Apercu de l'etiquette : contour net, fond gris clair, zone imprimable bien visible */
#labelFormatDialog .label-preview { display: flex; justify-content: center; padding: 12px; background: #f8fafc; border: 1px dashed var(--border); border-radius: var(--radius-sm); overflow: visible; }
#labelFormatDialog .label-svg { overflow: visible; }
#labelFormatDialog .label-outer { fill: #ffffff; stroke: #0f172a; stroke-width: 1.5; }
#labelFormatDialog .label-zone { fill: rgba(91, 91, 214, 0.28); stroke: #3b3bb8; stroke-width: 2; stroke-dasharray: 5 3; cursor: move; }

/* Fiche technique de l'OF (operateur) : meme bandeau que le planning admin */
#view-ofinfo .page-header {
  position: sticky;
  top: 0;
  z-index: 7;
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin: -28px -36px 14px;
  padding: 14px 36px;
  min-height: 0;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
#view-ofinfo .page-header .page-title { font-size: 16px; color: var(--text); }
#view-ofinfo .page-header .page-subtitle { display: none; }
#view-ofinfo .page-header .btn {
  height: 32px;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1;
}

.of-carton-btn { width: auto; height: 32px; padding: 0 12px; justify-content: center; gap: 6px; }
.of-carton-btn svg { width: 16px; height: 16px; }

.matiere-link.is-empty { color: #dc2626; border-color: #dc2626; background: #fef2f2; }

.tool-card.is-ready { cursor: pointer; }
.tool-card.is-ready:hover { border-color: var(--accent); }

/* Planning operateur : nombre d'OF a droite du bandeau de la journee, journee du jour encadree */
.day-col-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.day-col.is-today { border: 2px solid var(--accent); }

.packaging-counts { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }
/* Planche : un seul fond pour les deux compteurs cote a cote */
.packaging-counts { background: var(--accent-soft, #eef0ff); border-radius: var(--radius-sm); padding: 10px 14px; }
.packaging-counts .packaging-count { background: transparent; padding: 0; border-radius: 0; }
/* Separateur vertical entre les deux compteurs de planche */
.packaging-counts .packaging-count + .packaging-count { border-left: 1px solid var(--border); padding-left: 12px; }

.of-title-client { margin-left: 12px; font-size: 14px; font-weight: 500; color: var(--text-muted); }
dialog.bat-viewer { width: min(1400px, 96vw); height: 90vh; padding: 0; }
dialog.bat-viewer[open] { display: flex; flex-direction: column; }
dialog.bat-viewer:not([open]) { display: none; }
dialog.bat-viewer::backdrop { background: rgba(15, 23, 42, 0.25); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.bat-viewer-head { display: flex; align-items: center; gap: 14px; }
#batViewerFrame { flex: 1; width: 100%; border: 0; background: #fff; }
/* BAT dans la pop-up : le document tient en entier en hauteur */
dialog.bat-viewer { max-height: 92vh; overflow: hidden; }
dialog.bat-viewer .bat-viewer-head { flex: 0 0 auto; }
#batViewerFrame { height: calc(90vh - 62px); min-height: 0; }

/* Couleur par commande : bande sur la cellule Commande, quel que soit le planning (admin ou operateur) */
.of-card[data-cmd-color] .of-cmd { box-shadow: inset 4px 0 0 var(--cmd-color); padding-left: 12px; }

/* Clic droit : Envoyer sur, la liste des machines s'affiche au survol */
.context-menu { overflow: visible; }
.context-submenu { position: relative; }
.context-submenu-list { display: none; position: absolute; top: -6px; left: 100%; min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 4px; z-index: 1;
}
.context-menu.submenu-left .context-submenu-list { left: auto; right: 100%; }
.context-submenu:hover .context-submenu-list { display: block; }
/* Sous-menu trop bas pour l'ecran : il s'ouvre vers le haut et defile si besoin */
.context-menu.submenu-up .context-submenu-list { top: auto; bottom: -6px; max-height: calc(100vh - 24px); overflow-y: auto; }
.context-submenu-title { cursor: default; }

/* Barre du planning admin : recherche + mise a jour CERM en haut, Archives + Journee en dessous */
#planningActions { flex-direction: column; align-items: flex-end; gap: 8px; }
.plan-actions-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
/* Bouton + Ajouter un OF (admin) : plus grand */
.day-col-actions .btn { height: 34px; }
.day-col-actions .btn svg { width: 16px; height: 16px; }

/* En-tete de journee compact : icones date, OF et charge ; barre de charge reduite */
.day-col-date, .day-col-count { display: flex; align-items: center; gap: 6px; }
.day-col-date svg, .day-col-count svg, .day-load > svg { width: 14px; height: 14px; color: var(--text-muted); flex: none; }
.day-load { flex: 0 1 180px; min-width: 0; gap: 6px; }
.day-load-bar { height: 6px; min-width: 50px; }
/* En-tete de journee : date, nombre d'OF et charge sur une seule ligne, separees par un trait */
.day-col-head > div:first-child { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.day-col-head > div:first-child > div + div { border-left: 1px solid var(--border); padding-left: 10px; }
.day-col-head .day-load { border-left: 1px solid var(--border); padding-left: 10px; flex: 0 1 auto; }
.day-col-head .day-load-text { white-space: nowrap; font-size: 12px; }

/* Barre de chargement fine en haut de l'ecran pendant les appels au serveur */
.busy-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 3000; overflow: hidden; background: rgba(91, 91, 214, 0.15); }
.busy-bar[hidden] { display: none; }
.busy-bar::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 30%; background: var(--accent); animation: busy-slide 1s linear infinite; }
@keyframes busy-slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

/* Horaires de travail : meme bandeau superieur que le planning */
#view-horaires .page-header {
  position: sticky;
  top: 0;
  z-index: 7;
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin: -28px -36px 14px;
  padding: 14px 36px;
  min-height: 0;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
#view-horaires .page-header .page-title { font-size: 16px; color: var(--text); }
#view-horaires .page-header .page-subtitle { display: none; }
#view-horaires .page-header .btn {
  height: 32px;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1;
}
#view-horaires .page-header .tabs { flex: 1 1 auto; min-width: 0; margin: 0; }
#view-horaires .page-header .tabs { flex: 1 1 auto; min-width: 0; margin: 0; }
/* Legende des horaires : couleurs franches et distinctes (les cases du tableau restent pales) */
.hc-legend i { width: 14px; height: 14px; }
.hc-legend i.hc-default { background: #ffffff; border-color: #a1a1aa; }
.hc-legend i.hc-over { background: #dc2626; border-color: #dc2626; }
.hc-legend i.hc-note { background: #f59e0b; border-color: #f59e0b; }
.hc-legend i.hc-vacation { background: #5b5bd6; border-color: #5b5bd6; }
.hc-legend i.hc-absence { background: #52525b; border-color: #52525b; }

/* Bandeau de journee : absence ou vacances de l'operateur attitre de la machine */
.day-col-absence { display: flex; align-items: center; gap: 6px; color: var(--danger); font-weight: 600; font-size: 12px; border-left: 1px solid var(--border); padding-left: 10px; white-space: nowrap; }
.day-col-absence svg { width: 14px; height: 14px; flex: none; }

/* Inventaire : groupes par commentaire, depliables */
.inventaire-group { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface); }
.inventaire-group > summary { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; font-weight: 600; }
.inventaire-group > .inventaire-table { margin: 0 12px 12px; width: calc(100% - 24px); }
.inventaire-table td, .inventaire-table th { font-size: 12px; }

/* Meme fond flou derriere toutes les pop-up du portail (comme la liste de cartons) */
dialog::backdrop,
dialog.panel::backdrop { background: rgba(15, 23, 42, 0.25); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
/* Horaires : champ de recherche et boutons du bandeau de la meme hauteur */
#view-horaires .page-header .search-input { height: 32px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; }

/* Page Outils : categories */
.tools-category { margin-bottom: 22px; }
.tools-category-title { font-size: 13px; font-weight: 650; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 10px; }

/* Preparation matieres : tableaux par machine */
.prep-group { margin-bottom: 14px; }
.prep-group-title { font-weight: 600; margin-bottom: 6px; }
.prep-table td, .prep-table th { font-size: 12px; }

/* Commandes consommables */
.commandes-table td, .commandes-table th { font-size: 12px; vertical-align: top; }
.commandes-items { white-space: pre-line; }
.commandes-table tr.is-processed td { color: var(--text-muted); }
.commandes-done { color: #16a34a; font-weight: 600; }
.commandes-status { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.commandes-done-date { font-size: 11px; color: var(--text-muted); }
.commandes-more { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; }
.commandes-more .btn:disabled { opacity: 0.45; cursor: default; }
.commandes-page-info { font-size: 13px; color: var(--text-muted); }
.commandes-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.commande-card { background: var(--surface, #fff); border: 1px solid var(--border, #e4e4e7); border-left: 4px solid #f59e0b; border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; min-width: 0; }
.commande-card.is-processed { border-left-color: #16a34a; background: #f9fdf9; }
.commande-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--border, #e4e4e7); }
.commande-card-date { font-size: 15px; font-weight: 700; }
.commande-card-by { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.02em; margin-top: 2px; }
.commande-card-status { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 12px; }
.commande-card-pending { color: #b45309; font-weight: 600; }
.commande-card-items { list-style: none; margin: 0; padding: 0; font-size: 13px; flex: 1; }
.commande-card-items li { padding: 5px 0 5px 12px; position: relative; overflow-wrap: anywhere; }
.commande-card-items li::before { content: ""; position: absolute; left: 0; top: 12px; width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); }
.commande-card-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border, #e4e4e7); }
@media (max-width: 600px) {
  .commandes-cards { grid-template-columns: 1fr; }
  .commande-card-head { flex-direction: column; }
}
.commandes-actions { white-space: nowrap; }
.commandes-actions .btn { margin-right: 4px; }
/* Barre laterale : libelles sur deux lignes plus serres */
.sidebar .nav-item { line-height: 1.2; }

/* Badge de nombre (barre laterale) */
.nav-item .sidebar-badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; min-width: 20px; text-align: center; }
.nav-item .sidebar-badge[hidden] { display: none; }

/* Interrupteur (glissiere) */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-slider { position: absolute; inset: 0; background: #d4d4d8; border-radius: 999px; cursor: pointer; transition: background 0.15s; }
.switch-slider::before { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.switch input:checked + .switch-slider { background: #16a34a; }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }
.switch input:focus-visible + .switch-slider { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Commandes consommables : meme bandeau superieur que le planning (admin et operateur) */
#view-commandes .page-header {
  position: sticky;
  top: 0;
  z-index: 7;
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin: -28px -36px 14px;
  padding: 14px 36px;
  min-height: 0;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
#view-commandes .page-header .page-title { font-size: 16px; color: var(--text); }
#view-commandes .page-header .page-subtitle { display: none; }
#view-commandes .page-header .btn {
  height: 32px;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1;
}
/* Commandes consommables : recherche et boutons de la meme hauteur */
#view-commandes .page-header .search-input { height: 32px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; }
/* Reglage du logo : apercu petit */
.logo-setting { display: flex; align-items: center; gap: 16px; }
.logo-setting img { max-height: 48px; max-width: 180px; width: auto; height: auto; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; background: #fff; }
.logo-setting-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Taille du logo dans la barre latérale : réglée par la glissière des paramètres */
.logo-size-setting { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; max-width: 360px; }
.logo-size-setting label { font-size: 13px; color: var(--text-muted); }
.logo-size-setting input[type=range] { width: 100%; }

/* Reglages : deux colonnes (logo et CERM), une seule sur petit ecran */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.settings-grid > .card + .card { margin-top: 0; }
.settings-grid + .card { margin-top: 16px; }
@media (max-width: 800px) { .settings-grid { grid-template-columns: 1fr; } }

/* Choix du logo : le bouton du navigateur sert d'importation */
#logoFileInput { font-size: 13px; }
#logoFileInput::file-selector-button { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--radius-sm); padding: 6px 12px; margin-right: 10px; cursor: pointer; font: inherit; }

/* Autres OF du meme client expedies le meme jour : sous la date d'expedition de la fiche OF */
.of-hero-same { display: inline-flex; align-items: center; align-self: flex-start; gap: 5px; width: auto; max-width: 100%; margin-top: 6px; padding: 1px 8px; border: 0; border-radius: 999px; background: var(--danger); color: #fff; font: inherit; font-size: 11px; font-weight: 650; line-height: 1.5; white-space: nowrap; cursor: pointer; }
.of-hero-same svg { width: 12px; height: 12px; flex-shrink: 0; }

/* Carte de journee : ombre marquee sous la carte */
.day-col {
  box-shadow: 0 1px 3px rgba(20, 20, 40, 0.08);
}

/* Couleurs des etats des OF (reglables dans Parametres > Reglages) */
:root { --etat-direct: #ffffff; --etat-reprise: #f59e0b; --etat-urgent: #d63384; --etat-bloque: #ef4444; }
.of-card.etat-direct { background: var(--etat-direct); }
.etat-colors-grid { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 12px; }
.etat-colors-grid label { display: flex; align-items: center; justify-content: flex-start; gap: 10px; font-size: 13px; }
.etat-colors-grid input[type=color] { width: 30px; height: 30px; flex: none; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: none; cursor: pointer; overflow: hidden; }
.etat-colors-grid input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.etat-colors-grid input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.etat-colors-grid input[type=color]::-moz-color-swatch { border: 0; border-radius: 50%; }

/* Cartes de journee : plus etroites et centrees */
#dayRow .day-col {
  width: 80%;
  margin-left: auto;
  margin-right: auto;
}

/* Horaires : interrupteur de validation de semaine */
.switch-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }

/* Planning : separateur de semaine entre les journees */
.week-sep { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 6px 0 -4px; }
.week-sep::before, .week-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Legende des couleurs des OF (planning operateur) */
.etat-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 12px; font-size: 13px; color: var(--text-muted); }
.etat-legend span { display: inline-flex; align-items: center; gap: 6px; }
.etat-legend-swatch { display: inline-block; width: 18px; height: 10px; border-radius: 2px; background: var(--dot); border: 1px solid #9a9aa8; }

/* Legende dans la barre superieure du planning operateur : sur sa propre ligne sous les machines */
.page-header .etat-legend { flex-basis: 100%; margin: 0; }

/* Onglets des machines + legende : la legende est sous les onglets */
.planning-tabs-wrap { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-width: 0; }
.planning-tabs-wrap .etat-legend { margin: 0; }

/* Legende sous la barre de recherche (planning operateur) */
#view-planning .page-header .etat-legend { flex-basis: 100%; justify-content: flex-end; margin: 0; }

/* Separateur vertical a droite du titre de chaque page (admin et operateur) */

/* Connexion a la base (Parametres > Reglages) */
.db-status { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.db-status .is-ok { color: #16a34a; }
.db-status .is-ko { color: var(--danger); }

/* Connexion a la base : espace avant les cartes suivantes des Reglages */
[data-tab-pane="reglages"] > .card:first-child {
  margin-bottom: 16px;
}

/* Bandeau du planning : titre et machines un peu plus bas */
#view-planning .page-header {
  padding-top: 18px;
}

/* Bandeau du planning en tableau : colonne gauche (titre + machines) centree, colonne droite en deux lignes centrees */
#view-planning .page-header { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 24px; padding-top: 14px; padding-bottom: 14px; }
#view-planning .planning-head-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; min-width: 0; }
#view-planning .planning-head-left .page-title { margin: 0; }
#view-planning .planning-tabs-wrap { flex: 1 1 auto; min-width: 0; }
#view-planning .planning-head-right { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
#view-planning .planning-head-right > .page-actions,
#view-planning .planning-head-right > .etat-legend { display: flex; justify-content: center; align-items: center; margin: 0; flex-wrap: wrap; }
#view-planning .planning-head-right > .etat-legend { gap: 14px; }

/* Barre de recherche et Archives collees a droite */
#view-planning .planning-head-right > .page-actions {
  justify-content: flex-end;
}

/* Bandeau du planning admin (sans conteneurs gauche/droite) : titre et machines a gauche, recherche et boutons empiles a droite */
#view-planning .page-header:not(:has(.planning-head-left)) { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
#view-planning .page-header:not(:has(.planning-head-left)) > .tabs { flex: 1 1 auto; min-width: 0; }
#view-planning .page-header:not(:has(.planning-head-left)) > .page-actions:not(.selection-bar) { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#view-planning .page-header:not(:has(.planning-head-left)) > .selection-bar:not([hidden]) { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
#view-planning .page-header:not(:has(.planning-head-left)) > .page-actions:not(.selection-bar) .plan-actions-row { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }

/* Info pour la production : 16 lignes CERM */
.comment-lines { display: flex; flex-direction: column; gap: 6px; }
.comment-line { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.comment-line span { flex: 0 0 28px; width: 28px; text-align: right; color: var(--muted, #888); }
#commentDialog { width: min(900px, 94vw); }
.comment-line input { flex: 1 1 auto; min-width: 0; }

/* Numero de ligne a gauche du champ (les libelles de formulaire sont en bloc par defaut) */
#commentDialog #commentLines .comment-line { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; }
#commentDialog #commentLines .comment-line > span { display: inline-block !important; flex: 0 0 28px; width: 28px; margin: 0; text-align: right; }
#commentDialog #commentLines .comment-line > input { flex: 1 1 auto; min-width: 0; width: auto; }

/* Info pour la production (operateur) : lignes avec compteur de caracteres */
#werkbonDialog .comment-line { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; }
#werkbonDialog .comment-line > span { flex: 0 0 28px; width: 28px; text-align: right; color: var(--muted, #888); }
#werkbonDialog .comment-line > input { flex: 1 1 auto; min-width: 0; }
#werkbonDialog .comment-count { flex: 0 0 52px; text-align: right; color: var(--muted, #888); font-size: 12px; }

/* Champs des 16 lignes (admin et operateur) : meme hauteur, bordure et focus */
#werkbonDialog .comment-line > input, #commentDialog #commentLines .comment-line > input { height: 34px; box-sizing: border-box; padding: 0 10px; font-size: 13px; border: 1px solid var(--border, #c9ccd6); border-radius: 6px; background: var(--surface, #fff); color: var(--text, #1f2330); }
#werkbonDialog .comment-line > input:focus, #commentDialog #commentLines .comment-line > input:focus { outline: none; border-color: var(--accent, #5b5bd6); box-shadow: 0 0 0 2px rgba(91, 91, 214, 0.15); }
#werkbonDialog .comment-line { margin-bottom: 4px; }

/* Boutons Cartons et Info pour la production centres dans le bandeau de la fiche OF */
.of-head-tools { display: flex; align-items: center; gap: 8px; margin: 0 auto; }

/* Cahier de maintenance : une carte par machine */
.maint-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.maint-card { padding: 0; overflow: hidden; }
.maint-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.maint-card-title { font-weight: 650; }
.maint-card-body { max-height: 380px; overflow-y: auto; padding: 0 14px; }
.maint-entry { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.maint-entry:last-child { border-bottom: 0; }
.maint-entry-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; color: var(--muted, #888); font-size: 12px; }
.maint-entry-actions { margin-left: auto; display: flex; gap: 4px; }
/* Cahier de maintenance : un classeur par machine, pages comme l'ancien planning */
.maint-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(480px, 1fr)); gap: 18px; align-items: start; }
.maint-book-wrap { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.maint-book-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.maint-card-title { font-weight: 650; }
.maintenance-book-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.maintenance-page-indicator { font-size: 0.9rem; font-weight: 700; color: #475569; min-width: 110px; text-align: center; }
.maintenance-book { position: relative; background: linear-gradient(135deg, #caa46b 0%, #a16207 100%); border-radius: 18px; padding: 18px 18px 18px 26px; box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14); }
.maintenance-book-spine { position: absolute; left: 10px; top: 12px; bottom: 12px; width: 12px; border-radius: 999px; background: radial-gradient(circle at center, rgba(255,255,255,0.28) 0 1px, transparent 1px 100%), linear-gradient(180deg, #7c2d12 0%, #5b210d 100%); background-size: 100% 18px, 100% 100%; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16); }
.maintenance-book-page { min-height: 380px; background: linear-gradient(90deg, rgba(220, 38, 38, 0.14) 0, rgba(220, 38, 38, 0.14) 2px, transparent 2px) 56px 0 / 100% 100% no-repeat, repeating-linear-gradient(180deg, #fffdf6 0, #fffdf6 28px, #e6f0fb 28px, #d6e6f7 30px); border-radius: 12px; border: 1px solid rgba(148, 163, 184, 0.35); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.45); padding: 26px 24px 24px 74px; }
.maintenance-page-content { display: grid; gap: 14px; }
.maintenance-note-entry { display: grid; grid-template-columns: 96px minmax(110px, 150px) minmax(120px, 180px) minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 6px 0 16px; border-bottom: 2px dashed rgba(71, 85, 105, 0.58); position: relative; }
.maintenance-note-meta { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: #64748b; margin-bottom: 4px; }
.maintenance-note-value { font-size: 0.92rem; color: #0f172a; line-height: 1.35; white-space: pre-wrap; word-break: break-word; }
.maintenance-note-value.is-title { font-weight: 700; color: #1e3a8a; }
.maintenance-note-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: flex-start; }
.maintenance-book-empty { color: #64748b; font-style: italic; padding-top: 6px; }
@media (max-width: 900px) { .maint-grid { grid-template-columns: 1fr; } .maintenance-note-entry { grid-template-columns: 1fr; } .maintenance-note-actions { justify-content: flex-start; } .maintenance-book-page { padding: 22px 18px 22px 44px; } }
/* Cahier de maintenance : cartes machines (premiere page) puis cahier ouvert, comme l'ancien planning */
.maint-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.maint-machine-card { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.maint-machine-card .maint-open { margin-top: auto; }
.maint-muted { color: var(--muted, #64748b); }
.maint-book-view { display: flex; flex-direction: column; gap: 12px; }
.maint-book-head { display: flex; align-items: center; gap: 12px; }
.maint-book-head .maint-card-title { flex: 1; font-size: 16px; }
/* Cahier de maintenance (moderne) : cartes machines et liste d'interventions */
.maint-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.maint-machine-card { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06); overflow: hidden; transition: box-shadow 0.15s, transform 0.15s; }
.maint-machine-card:hover { box-shadow: 0 8px 20px rgba(15, 23, 42, 0.10); transform: translateY(-1px); }
.maint-machine-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.maint-machine-name { font-size: 16px; font-weight: 650; color: var(--text); }
.maint-count { min-width: 28px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--accent-soft, #eef0ff); color: var(--accent, #5b5bd6); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.maint-last { background: var(--surface-2, #f6f7fb); border-radius: 10px; padding: 10px 12px; min-height: 66px; }
.maint-last-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted, #64748b); margin-bottom: 4px; }
.maint-last-title { font-size: 14px; color: var(--text); line-height: 1.35; }
.maint-last-date { font-size: 12px; color: var(--muted, #64748b); margin-top: 4px; }
.maint-open-btn { margin-top: auto; width: 100%; height: 34px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--accent, #5b5bd6); font-weight: 600; font-size: 13px; cursor: pointer; }
.maint-open-btn:hover { background: var(--accent-soft, #eef0ff); }

.maint-book-view { display: flex; flex-direction: column; gap: 14px; }
.maint-book-head { display: flex; align-items: center; gap: 12px; }
.maint-book-head .maint-card-title { flex: 1; font-size: 18px; font-weight: 650; }
.maint-timeline { display: flex; flex-direction: column; gap: 10px; }
.maint-entry-card { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; border-left: 4px solid var(--accent, #5b5bd6); }
.maint-entry-date { font-size: 13px; font-weight: 600; color: var(--muted, #64748b); }
.maint-entry-title { font-size: 15px; font-weight: 650; color: var(--text); }
.maint-entry-sub { font-size: 12px; color: var(--muted, #64748b); margin-top: 2px; }
.maint-entry-desc { font-size: 13px; color: var(--text); margin-top: 6px; white-space: pre-wrap; }
.maint-entry-actions { display: flex; gap: 4px; }
.maint-pager { display: flex; align-items: center; justify-content: center; gap: 12px; }
.maint-pager-info { font-size: 13px; font-weight: 600; color: var(--muted, #64748b); min-width: 60px; text-align: center; }
.maint-empty { padding: 24px; text-align: center; color: var(--muted, #64748b); background: var(--surface); border: 1px dashed var(--border); border-radius: 12px; }
@media (max-width: 700px) { .maint-entry-card { grid-template-columns: 1fr; } }
/* Cahier de maintenance : bandeau fixe en haut, comme la fiche OF */
#view-maintenance .page-header { position: sticky; top: 0; z-index: 7; background: var(--surface); color: var(--text); border-bottom: 1px solid var(--border); margin: -28px -36px 14px; padding: 14px 36px; min-height: 0; align-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); }
#view-maintenance .page-header .page-title { font-size: 16px; color: var(--text); }

/* Outils : meme presentation que la premiere page du cahier de maintenance (cartes machines) */
#view-outils .page-header { position: sticky; top: 0; z-index: 7; background: var(--surface); color: var(--text); border-bottom: 1px solid var(--border); margin: -28px -36px 14px; padding: 14px 36px; min-height: 0; align-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); }
#view-outils .page-header .page-title { font-size: 16px; color: var(--text); }
#view-outils .tools-category-title { font-size: 14px; font-weight: 650; color: var(--muted, #64748b); margin: 18px 0 10px; }
#view-outils .tools-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
#view-outils .tool-card { position: relative; display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 14px 44px 14px 14px; min-height: 76px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s; }
#view-outils .tool-card.is-ready:hover { border-color: var(--accent); box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08); transform: translateY(-1px); }
#view-outils .tool-card:not(.is-ready) { opacity: 0.6; }
#view-outils .tool-card-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
#view-outils .tool-card-icon svg { width: 22px; height: 22px; }
#view-outils .tool-card-body { flex: 1; min-width: 0; gap: 4px; }
#view-outils .tool-card-body strong { font-size: 15px; font-weight: 650; color: var(--text); line-height: 1.25; overflow-wrap: anywhere; }
#view-outils .tool-card-soon { align-self: flex-start; font-size: 11px; font-weight: 600; color: #b45309; background: #fef3c7; padding: 1px 8px; border-radius: 999px; }
#view-outils .tool-fav { position: absolute; top: 10px; right: 10px; }
#view-maintenance .page-header .page-subtitle { display: none; }
#view-maintenance .page-header .btn { height: 32px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; line-height: 1; }
#view-maintenance .page-header #maintenanceSearchInput { height: 32px; box-sizing: border-box; }
/* Fenetre d'intervention : liste et date a la meme hauteur */
#maintenanceDialogForm select, #maintenanceDialogForm input[type="date"], #maintenanceDialogForm input[type="text"] { height: 36px; box-sizing: border-box; }
/* Cartes machines : meme hauteur dans toute la grille */
.maint-grid { align-items: stretch; }
.maint-machine-card { height: 100%; box-sizing: border-box; }
/* Impression du cahier de maintenance : seule la zone d'impression est visible */
#maintenancePrint { display: none; }
@media print {
  body * { visibility: hidden !important; }
  #maintenancePrint, #maintenancePrint * { visibility: visible !important; }
  #maintenancePrint { display: block !important; position: absolute; left: 0; top: 0; width: 100%; padding: 12px; color: #000; }
  #maintenancePrint .print-machine { page-break-after: always; }
  #maintenancePrint h2 { font-size: 18px; margin: 0 0 8px; }
  #maintenancePrint h3 { font-size: 14px; margin: 12px 0 4px; }
  #maintenancePrint table { width: 100%; border-collapse: collapse; font-size: 11px; }
  #maintenancePrint th, #maintenancePrint td { border: 1px solid #999; padding: 4px 6px; text-align: left; vertical-align: top; }
}
/* Impression : colonnes alignees (largeurs fixes) */
@media print {
  #maintenancePrint table { table-layout: fixed; }
  #maintenancePrint th:nth-child(1), #maintenancePrint td:nth-child(1) { width: 13%; }
  #maintenancePrint th:nth-child(2), #maintenancePrint td:nth-child(2) { width: 17%; }
  #maintenancePrint th:nth-child(3), #maintenancePrint td:nth-child(3) { width: 25%; }
  #maintenancePrint th:nth-child(4), #maintenancePrint td:nth-child(4) { width: 45%; }
  #maintenancePrint td { word-wrap: break-word; }
}
/* Fenetre d'intervention : mise en page plus claire */
#maintenanceDialogForm { display: flex; flex-direction: column; gap: 16px; }
#maintenanceDialogForm .field { display: flex; flex-direction: column; gap: 6px; }
#maintenanceDialogForm .field > label { font-size: 13px; font-weight: 600; color: var(--text); }
#maintenanceDialogForm textarea { padding: 10px 12px; font-size: 14px; line-height: 1.45; border: 1px solid var(--border); border-radius: 8px; resize: vertical; min-height: 84px; box-sizing: border-box; }
#maintenanceDialogForm textarea::placeholder, #maintenanceDialogForm input::placeholder { color: #94a3b8; font-style: italic; }
#maintenanceDialogForm .field:has(#maintenanceDate), #maintenanceDialogForm .field:has(#maintenanceMachine) { flex: 1 1 0; }
#maintenanceDialogForm > .maint-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
/* Operateur : petite fleche de suggestion a droite, comme une liste */
#maintenanceOperateur { padding-right: 34px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px 14px; cursor: pointer; }
/* Operateur : masque la fleche native du navigateur (on garde la fleche ajoutee) */
#maintenanceOperateur::-webkit-calendar-picker-indicator, #maintenanceOperateur::-webkit-list-button { display: none !important; opacity: 0; }

/* Calculette amalgame */
.calc-form { display: flex; gap: 10px; margin: 14px 0; }
.calc-form .input { max-width: 220px; }
.calc-cartes { display: flex; flex-wrap: nowrap; gap: 10px; margin: -2px -4px 10px; padding: 14px 4px 4px; overflow-x: auto; scrollbar-width: thin; }
.calc-carte { position: relative; display: flex; flex-direction: column; gap: 4px; text-align: left; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 14px; flex: 0 0 200px; cursor: pointer; font: inherit; color: #0f172a; }
.calc-carte.is-active { box-shadow: 0 0 0 2px #2563eb; }
.calc-carte.is-cerm { background: #fff7e6; border-color: #f59e0b; }
.calc-carte-titre { font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calc-carte-score { font-size: 1.5rem; font-weight: 700; margin: 4px 0; }
.calc-carte-ligne { font-weight: 600; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.calc-carte .calc-ico { width: 15px; height: 15px; flex: 0 0 15px; color: #64748b; }
.calc-badge { position: absolute; top: -11px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: #16a34a; color: #fff; display: flex; align-items: center; justify-content: center; }
.calc-badge svg { width: 14px; height: 14px; }
/* Ciseaux de raccord dans l'autoplan FT OF : une couleur par groupe de raccord */
.autoplan-ciseaux { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-left: 6px; border-radius: 50%; color: #fff; vertical-align: middle; }
.autoplan-ciseaux svg { width: 11px; height: 11px; }
.autoplan-surplus { color: #ea580c; font-weight: 700; margin-left: 12px; }
.autoplan-surplus-cell { text-align: left; white-space: normal; min-width: 150px; }
.autoplan-raccord-txt { font-size: 0.8rem; font-weight: 700; color: #b91c1c; margin-left: 4px; vertical-align: middle; }
.autoplan-surplus-cell .autoplan-ciseaux { margin-left: 0; margin-right: 6px; }
.autoplan-ciseaux-0 { background: #ef4444; }
.autoplan-ciseaux-1 { background: #3b82f6; }
.autoplan-ciseaux-2 { background: #22c55e; }
.autoplan-ciseaux-3 { background: #f59e0b; }
.autoplan-ciseaux-4 { background: #a855f7; }
.autoplan-ciseaux-5 { background: #14b8a6; }
.calc-badge-eco { right: 8px; background: #2563eb; font-size: 0.8rem; font-weight: 700; line-height: 1; }
.calc-badge-decale { right: 36px; }
.calc-carte-sub { font-size: 0.85rem; color: #64748b; }
.calc-schema { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px; }
.calc-schema-titre { font-weight: 700; margin-bottom: 10px; }.calc-ligne { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.calc-ligne-titre { width: 120px; font-weight: 600; font-size: 0.9rem; }
.calc-ligne-titre span { display: block; font-weight: 400; color: #64748b; font-size: 0.8rem; }
.calc-cases { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(90px, 1fr); gap: 6px; flex: 1; }
.calc-case { height: 46px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #0f172a; font-size: 0.8rem; }
.calc-case.is-vide { background: #f1f5f9; border: 1px dashed #cbd5e1; }
/* Tableau des references (calculette amalgame) */
.calc-tableau-wrap { margin-top: 14px; overflow-x: auto; }
.calc-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; font-size: 0.9rem; }
.calc-table th, .calc-table td { padding: 8px 10px; border-bottom: 1px solid #e2e8f0; text-align: left; }
.calc-table th { background: #f8fafc; color: #64748b; font-weight: 600; }
.calc-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.calc-table .is-surplus { color: #ea580c; font-weight: 700; }
/* Calculette amalgame : bandeau identique au planning (blanc, fixe en haut) */
#view-calculette_amalgame .page-header {
  position: sticky;
  top: 0;
  z-index: 7;
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin: -28px -36px 14px;
  padding: 14px 36px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
#view-calculette_amalgame .page-header .page-title { font-size: 16px; color: var(--text); }
#view-calculette_amalgame .page-header .page-subtitle { display: none; }
#view-calculette_amalgame .calc-form { margin: 0; }
#view-calculette_amalgame .calc-form .input {
  max-width: 180px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
#view-calculette_amalgame .calc-form .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); }
#view-calculette_amalgame #calcAmalgameMessage,
#view-calculette_amalgame #calcAmalgameResultat { margin-top: 14px; }