/* Modern Nova-like sidebar layout (non destructive) */
body.has-modern-sidebar {
  --app-sidebar-w: 248px;
  --app-topbar-h: 72px;
  --app-content-gap: 20px;
}

body.has-modern-sidebar header:not(.nova-header) {
  position: sticky;
  top: 0;
  z-index: 1100;
  height: var(--app-topbar-h);
  margin-left: var(--app-sidebar-w);
  width: calc(100% - var(--app-sidebar-w));
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.06);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}

body.has-modern-sidebar #simulation-indicator,
body.has-modern-sidebar #header-date-time-block {
  display: none !important;
}

body.has-modern-sidebar .header-actions {
  justify-self: end;
}

body.has-modern-sidebar .app-header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 12px;
  max-width: 420px;
}

body.has-modern-sidebar .app-header-search input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 0.92rem;
}

body.has-modern-sidebar .app-profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #dbe3ee;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.86rem;
  color: #334155;
  white-space: nowrap;
}

body.has-modern-sidebar nav {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: var(--app-sidebar-w) !important;
  min-width: var(--app-sidebar-w) !important;
  height: 100vh !important;
  background: linear-gradient(180deg, #f8fbff 0%, #f1f5f9 100%) !important;
  border-right: 1px solid #dbe3ee;
  box-shadow: 8px 0 30px rgba(15, 23, 42, 0.08);
  overflow-y: auto !important;
  overflow-x: hidden !important;
  white-space: normal !important;
  z-index: 1200;
  padding: 12px 10px 16px;
}

body.has-modern-sidebar nav .app-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}

body.has-modern-sidebar nav .app-sidebar-brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

body.has-modern-sidebar nav .app-sidebar-brand strong {
  font-size: 0.88rem;
  color: #0f172a;
  letter-spacing: -0.005em;
}

body.has-modern-sidebar nav ul {
  display: flex !important;
  flex-direction: column;
  height: auto;
  gap: 3px;
}

body.has-modern-sidebar nav.app-nav-has-pages ul {
  min-height: calc(100vh - 84px);
}

body.has-modern-sidebar nav .app-nav-pages-spacer {
  margin-top: auto;
  height: 8px;
  pointer-events: none;
}

body.has-modern-sidebar nav .app-nav-section-label {
  padding: 10px 10px 4px;
  color: #64748b;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.has-modern-sidebar nav .app-nav-page-link > a {
  background: rgba(148, 163, 184, 0.08);
}

body.has-modern-sidebar nav .app-nav-page-link > a:hover {
  background: rgba(37, 99, 235, 0.14);
}

body.has-modern-sidebar nav > ul > li {
  height: auto;
  display: block;
}

body.has-modern-sidebar nav > ul > li > a {
  height: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-right: none;
  border-radius: 10px;
  padding: 8px 12px;
  color: #334155;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: -0.005em;
  line-height: 1.3;
  background: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.has-modern-sidebar nav > ul > li > a .icon {
  margin-right: 9px;
  font-size: 0.92rem;
  width: 16px;
  display: inline-flex;
  justify-content: center;
  flex-shrink: 0;
}

/* Badge "à traiter" (#badge-attente) — compact, aligné à droite, dans la sidebar */
body.has-modern-sidebar nav > ul > li > a #badge-attente {
  margin-left: auto !important;
  min-width: 18px !important;
  padding: 1px 5px !important;
  font-size: 0.66rem !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  border-radius: 10px !important;
  flex-shrink: 0 !important;
  box-shadow: none !important;
  letter-spacing: 0 !important;
}

body.has-modern-sidebar nav > ul > li > a:hover {
  background: #e9f2ff;
  color: #1d4ed8;
}

body.has-modern-sidebar nav > ul > li > a.active {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
  border-bottom: none;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

body.has-modern-sidebar nav li > ul {
  margin: 4px 0 8px 22px;
  padding-left: 8px;
  border-left: 1px dashed #cbd5e1;
  display: grid;
  gap: 2px;
}

body.has-modern-sidebar nav li > ul a {
  padding: 5px 8px;
  border-radius: 8px;
  color: #475569;
  font-size: 0.74rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.has-modern-sidebar nav li > ul a:hover {
  background: #eef2ff;
  color: #1d4ed8;
}

body.has-modern-sidebar nav .bo-side-widgets {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

body.has-modern-sidebar nav .bo-side-card {
  border: 1px solid #d9e3ef;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 9px;
  display: grid;
  gap: 7px;
}

body.has-modern-sidebar nav .bo-side-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #1e3a8a;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

body.has-modern-sidebar nav .bo-side-title .icon {
  margin-right: 0;
  width: 14px;
}

body.has-modern-sidebar nav .bo-side-meta {
  display: grid;
  gap: 4px;
  color: #334155;
  font-size: 0.68rem;
}

body.has-modern-sidebar nav .bo-side-meta span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

body.has-modern-sidebar nav .bo-side-meta strong {
  color: #64748b;
  font-weight: 700;
}

body.has-modern-sidebar nav .bo-side-cutoff-time {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f766e;
  line-height: 1;
}

body.has-modern-sidebar nav .bo-side-cutoff-status,
body.has-modern-sidebar nav .bo-side-cutoff-refresh {
  color: #475569;
  font-size: 0.68rem;
  line-height: 1.35;
}

body.has-modern-sidebar nav .bo-side-cutoff-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

body.has-modern-sidebar nav .bo-side-cutoff-edit input {
  border: 1px solid #d2ddeb;
  border-radius: 9px;
  padding: 6px 8px;
  font-size: 0.72rem;
  color: #0f172a;
  background: #ffffff;
  min-width: 0;
}

body.has-modern-sidebar nav .bo-side-cutoff-edit button {
  border: 1px solid #15803d;
  border-radius: 9px;
  background: linear-gradient(135deg, #16a34a 0%, #10b981 100%);
  color: #ffffff;
  padding: 6px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

body.has-modern-sidebar nav .bo-side-cutoff-edit button:hover {
  filter: brightness(1.03);
}

body.has-modern-sidebar nav .bo-side-cutoff-msg {
  color: #475569;
  font-size: 0.66rem;
  line-height: 1.3;
  min-height: 1.1em;
}

body.has-modern-sidebar nav .bo-side-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

body.has-modern-sidebar nav .bo-side-kpis > div {
  border: 1px solid #dbe5f1;
  border-radius: 10px;
  background: #ffffff;
  padding: 6px;
  display: grid;
  gap: 3px;
}

body.has-modern-sidebar nav .bo-side-kpis span {
  color: #64748b;
  font-size: 0.62rem;
  font-weight: 700;
}

body.has-modern-sidebar nav .bo-side-kpis strong {
  color: #0f172a;
  font-size: 0.86rem;
  font-weight: 800;
}

body.has-modern-sidebar nav .bo-side-actions,
body.has-modern-sidebar nav .bo-side-filters {
  display: grid;
  gap: 6px;
}

body.has-modern-sidebar nav .bo-side-actions button,
body.has-modern-sidebar nav .bo-side-filters button {
  width: 100%;
  border: 1px solid #d2ddeb;
  border-radius: 9px;
  background: #ffffff;
  color: #334155;
  padding: 6px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

body.has-modern-sidebar nav .bo-side-actions button:hover,
body.has-modern-sidebar nav .bo-side-filters button:hover {
  background: #e9f2ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

body.has-modern-sidebar nav .bo-side-filters button.active {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

body.has-modern-sidebar nav .consult-side-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

body.has-modern-sidebar nav .consult-side-chips .cp-chip {
  width: 100%;
  justify-content: flex-start;
  white-space: normal;
  border-radius: 10px;
  padding: 7px 9px;
  font-size: 0.68rem;
}

body.has-modern-sidebar nav .consult-side-page-links {
  display: grid;
  gap: 6px;
}

body.has-modern-sidebar nav .consult-side-page-links a {
  width: 100%;
  border: 1px solid #d2ddeb;
  border-radius: 9px;
  background: #ffffff;
  color: #334155;
  padding: 7px 9px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

body.has-modern-sidebar nav .consult-side-page-links a:hover {
  background: #e9f2ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

body.has-modern-sidebar nav .consult-side-page-links a.active {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

body.has-modern-sidebar nav .opc-side-widgets {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

body.has-modern-sidebar nav .opc-side-card {
  gap: 8px;
}

body.has-modern-sidebar nav .opc-side-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

body.has-modern-sidebar nav .opc-side-kpis > div {
  border: 1px solid #dbe5f1;
  border-radius: 10px;
  background: #ffffff;
  padding: 6px;
  display: grid;
  gap: 3px;
}

body.has-modern-sidebar nav .opc-side-kpis span {
  color: #64748b;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

body.has-modern-sidebar nav .opc-side-kpis strong {
  color: #0f172a;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.25;
}

body.has-modern-sidebar nav .opc-side-actions {
  display: grid;
  gap: 6px;
}

body.has-modern-sidebar nav .opc-side-actions button {
  justify-content: flex-start;
}

body.has-modern-sidebar nav .opc-side-meta {
  display: grid;
  gap: 4px;
  color: #334155;
  font-size: 0.68rem;
}

body.has-modern-sidebar nav .opc-side-meta span {
  display: block;
}

body.has-modern-sidebar #content-area,
body.has-modern-sidebar main,
body.has-modern-sidebar .cp-main,
body.has-modern-sidebar .bo-page,
body.has-modern-sidebar .page,
body.has-modern-sidebar #reservation-layout,
body.has-modern-sidebar #reservations-section,
body.has-modern-sidebar #kpi-commercials-section {
  margin-left: calc(var(--app-sidebar-w) + var(--app-content-gap)) !important;
  width: calc(100% - var(--app-sidebar-w) - var(--app-content-gap));
}

body.has-modern-sidebar.page-gestion-contreparties > .container {
  margin-left: calc(var(--app-sidebar-w) + var(--app-content-gap)) !important;
  width: calc(100% - var(--app-sidebar-w) - var(--app-content-gap));
  max-width: none;
}

body.has-modern-sidebar #content-area,
body.has-modern-sidebar main {
}

.app-burger {
  display: none;
  border: 1px solid #dbe3ee;
  background: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.app-sidebar-overlay {
  display: none;
}

@media (max-width: 1024px) {
  body.has-modern-sidebar header:not(.nova-header) {
    margin-left: 0;
    width: 100%;
    grid-template-columns: auto 1fr auto;
    padding-left: 12px;
    padding-right: 12px;
  }

  body.has-modern-sidebar nav {
    transform: translateX(-102%);
    transition: transform 0.24s ease;
  }

  body.has-modern-sidebar.sidebar-open nav {
    transform: translateX(0);
  }

  body.has-modern-sidebar #content-area,
  body.has-modern-sidebar main,
  body.has-modern-sidebar .cp-main,
  body.has-modern-sidebar .bo-page,
  body.has-modern-sidebar .page,
  body.has-modern-sidebar #reservation-layout,
  body.has-modern-sidebar #reservations-section,
  body.has-modern-sidebar #kpi-commercials-section {
    margin-left: 0 !important;
    width: 100%;
  }

  body.has-modern-sidebar.page-gestion-contreparties > .container {
    margin-left: 0 !important;
    width: 100%;
    max-width: 100%;
  }

  body.has-modern-sidebar .app-burger {
    display: inline-flex;
  }

  body.has-modern-sidebar .app-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1150;
  }

  body.has-modern-sidebar.sidebar-open .app-sidebar-overlay {
    display: block;
  }
}
