/* Remplir le viewport sans dépasser le padding du root (sinon pager coupé) */
.lb-contracts-modal,
.lb-ch-modal {
  width: min(1440px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
}

.sb-rdv-modal-root:has(.lb-contracts-modal),
.sb-rdv-modal-root:has(.lb-ch-modal) {
  padding: 12px;
}

.lb-contracts-modal .sb-rdv-modal-body,
.lb-ch-modal .sb-rdv-modal-body {
  min-height: 0;
  overflow: hidden;
}

.lb-ct-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.lb-ct-kpi {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-primary);
  text-align: left;
  cursor: default;
}

.lb-ct-kpi[data-ct-view] {
  cursor: pointer;
}

.lb-ct-kpi span {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.lb-ct-kpi strong {
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.lb-ct-kpi--generated strong { color: #3b82f6; }
.lb-ct-kpi--sent strong { color: #c9a227; }
.lb-ct-kpi--signed strong { color: #16a34a; }
.lb-ct-kpi--closed strong { color: #db2777; }
.lb-ct-kpi--alert strong { color: #be185d; }
.lb-ct-kpi--alert {
  border-color: color-mix(in srgb, #be185d 28%, var(--border));
}
.lb-ct-kpi.is-on {
  border-color: color-mix(in srgb, #be185d 45%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, #be185d 25%, transparent);
}

.lb-ct-insights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.lb-ct-insight {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 70%, var(--bg-card));
}

.lb-ct-insight h4 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
}

.lb-ct-insight ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lb-ct-insight li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-primary);
}

.lb-ct-insight em {
  font-style: normal;
  color: var(--text-muted);
}

.lb-ct-board {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lb-ct-board .sb-rg-scroll {
  overflow-x: auto !important;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.lb-ct-table {
  font-size: 12.5px;
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

.lb-ct-table thead th {
  white-space: nowrap;
  padding: 0;
  vertical-align: bottom;
}

.lb-ct-table thead th button {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.lb-ct-table thead th.is-sorted button,
.lb-ct-table thead th button:hover {
  color: var(--text-primary);
  background: transparent;
}

.lb-ct-table td {
  vertical-align: middle;
  white-space: nowrap;
  padding: 9px 12px;
}

.lb-ch-clip,
.lb-ch-notes {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-ch-notes span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-ch-etat,
.lb-ch-flag,
.lb-ct-enseigne,
.lb-ct-dur,
.lb-ct-etat {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  max-width: none;
}

.lb-ct-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
  padding: 10px 12px;
  margin: 0;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-surface) 85%, var(--bg-card));
  position: sticky;
  bottom: 0;
  z-index: 3;
}

.lb-ct-pager-meta {
  font-size: 12px;
  font-weight: 650;
  color: var(--text-muted);
}

.lb-ct-pager-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.lb-ct-page {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 5px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.lb-ct-page:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--orange) 40%, var(--border));
}

.lb-ct-page.is-on {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

.lb-ct-page:disabled {
  opacity: 0.4;
  cursor: default;
}

.lb-ct-page-gap {
  padding: 0 4px;
  color: var(--text-muted);
}

.lb-ct-id {
  font-weight: 650;
  white-space: nowrap;
}

.lb-ct-enseigne {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-primary) 8%, transparent);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.lb-ct-days {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.lb-ct-days.is-soon { color: var(--orange, #e9530d); }
.lb-ct-days.is-overdue { color: #be185d; }

.lb-ct-date,
.lb-ct-num,
.lb-ct-arr {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lb-ct-dur {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.lb-ct-dur--d12 { background: #86efac; color: #14532d; }
.lb-ct-dur--d24 { background: #4ade80; color: #14532d; }
.lb-ct-dur--d36 { background: #22c55e; }
.lb-ct-dur--d48 { background: #15803d; }

.lb-ct-etat {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.lb-ct-etat.is-signed { background: #16a34a; color: #fff; }
.lb-ct-etat.is-sent { background: #facc15; color: #422006; }
.lb-ct-etat.is-generated { background: #93c5fd; color: #1e3a8a; }
.lb-ct-etat.is-closed { background: #f9a8d4; color: #831843; }
.lb-ct-etat.is-other { background: color-mix(in srgb, var(--text-primary) 12%, transparent); }

.lb-ct-pdf {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f59e0b;
  color: #1c1917;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.lb-ct-pdf:hover {
  filter: brightness(1.05);
}

.home-day-contracts-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin: 0 0 14px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.home-day-contracts-bar.is-hot-enter {
  border-color: color-mix(in srgb, #be185d 28%, var(--border));
}

.home-day-contracts-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.home-day-contracts-copy strong {
  font-size: 14px;
  font-weight: 700;
}

.home-day-contracts-copy span {
  font-size: 12px;
  color: var(--text-muted);
}

.home-day-session-btn--contracts.is-hot {
  color: #be185d;
  font-weight: 650;
  border-color: color-mix(in srgb, #be185d 40%, var(--border));
}

#home-day-contracts-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: #be185d;
  color: #fff;
  line-height: 1;
}

#home-day-contracts-badge[hidden] {
  display: none !important;
}

.lb-ct-kpi--sent strong { color: #c9a227; }
.lb-ct-kpi--review strong { color: #2563eb; }
.lb-ct-kpi--accepted strong { color: #16a34a; }
.lb-ct-kpi--refused strong { color: #b91c1c; }
.lb-ct-kpi--ops strong { color: #7c3aed; }

.lb-ch-statut {
  min-width: 11.5rem;
}

.lb-ch-ops {
  min-width: 7.75rem;
}

.lb-ch-etat {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}
.lb-ch-etat.is-sent { background: #facc15; color: #422006; }
.lb-ch-etat.is-review { background: #93c5fd; color: #1e3a8a; }
.lb-ch-etat.is-accepted { background: #16a34a; color: #fff; }
.lb-ch-etat.is-refused { background: #ef4444; color: #fff; }
.lb-ch-etat.is-other { background: color-mix(in srgb, var(--text-primary) 12%, transparent); }

.lb-ch-flag {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
}
.lb-ch-flag.is-ok { background: color-mix(in srgb, #16a34a 18%, transparent); color: #15803d; }
.lb-ch-flag.is-ko { background: color-mix(in srgb, #f59e0b 22%, transparent); color: #92400e; }

.lb-ct-date.is-early { color: #be185d; font-weight: 650; }

.home-day-cancellations-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin: 0 0 14px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.home-day-cancellations-bar.is-hot-enter {
  border-color: color-mix(in srgb, #7c3aed 28%, var(--border));
}
.home-day-cancellations-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.home-day-cancellations-copy strong {
  font-size: 14px;
  font-weight: 700;
}
.home-day-cancellations-copy span {
  font-size: 12px;
  color: var(--text-muted);
}
.home-day-session-btn--cancellations.is-hot {
  color: #7c3aed;
  font-weight: 650;
  border-color: color-mix(in srgb, #7c3aed 40%, var(--border));
}
#home-day-cancellations-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: #7c3aed;
  color: #fff;
  line-height: 1;
}
#home-day-cancellations-badge[hidden] {
  display: none !important;
}

@media (max-width: 1100px) {
  .lb-ct-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lb-ct-insights { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .lb-ct-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Colonnes personnalisables (Contrats / Résiliations / file CS) */
.lb-tc-th {
  position: relative;
  overflow: visible !important;
}

.lb-tc-th-inner {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-tc-th-inner > button {
  display: block;
  width: 100%;
  text-align: left;
}

.lb-ct-table.sb-rg-table,
.sb-cs-detail-table.sb-rg-table {
  table-layout: fixed;
}

.lb-tc-th-label {
  display: block;
  padding: 10px 12px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lb-tc-resize {
  position: absolute;
  top: 0;
  right: -3px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
  user-select: none;
  touch-action: none;
}

.lb-tc-resize::after {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 3px;
  width: 2px;
  border-radius: 1px;
  background: transparent;
}

.lb-tc-th:hover .lb-tc-resize::after,
.lb-tc-resize:hover::after,
.lb-tc-resize.is-active::after {
  background: var(--orange);
}

body.lb-tc-resizing,
body.lb-tc-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.lb-tc-columns-ms {
  position: relative;
  flex-shrink: 0;
}

.lb-tc-columns-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.lb-tc-columns-btn:hover,
.lb-tc-columns-btn[aria-expanded="true"] {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.lb-tc-columns-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  width: min(280px, calc(100vw - 32px));
  max-height: min(420px, 70vh);
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.lb-tc-columns-panel[hidden] {
  display: none !important;
}

.lb-tc-columns-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.lb-tc-mini {
  border: 0;
  background: transparent;
  color: var(--orange);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
  padding: 2px 4px;
}

.lb-tc-columns-hint {
  margin: 0 0 8px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-muted);
}

.lb-tc-columns-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lb-tc-col-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 7px;
  user-select: none;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.lb-tc-col-item:hover {
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
}

.lb-tc-col-item.is-dragging {
  opacity: 0.45;
}

.lb-tc-col-item.is-drop {
  outline: 1px dashed var(--orange);
  background: color-mix(in srgb, var(--orange) 12%, transparent);
}

.lb-tc-col-drag {
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: -0.08em;
  cursor: grab;
  flex-shrink: 0;
}

.lb-tc-col-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-rg-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
