/* Coque navigation SOHO — sidebar, onglets, tableau de bord Accueil */

.soho-workspace {
  display: flex;
  min-height: calc(100vh - 84px);
  flex: 1;
  background: var(--soho-sable, #f6eee6);
}

.soho-rail {
  width: 265px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #075039 0%, #043d2c 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
  z-index: 30;
}

.soho-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  color: #c4dfd2;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  gap: 8px;
}

.soho-rail-head button {
  background: none;
  border: 0;
  color: #fff;
  padding: 6px;
  border-radius: 8px;
}

.soho-rail-head button:hover {
  background: #17674e;
}

.soho-rail-search {
  margin: 0 12px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0a5c42;
  border-radius: 9px;
  padding: 8px 10px;
  border: 1px solid #1f6f54;
}

.soho-rail-search svg {
  flex-shrink: 0;
  opacity: 0.75;
}

.soho-rail-search input {
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  outline: none;
  font-size: 13px;
}

.soho-rail-search input::placeholder {
  color: #9fc9b6;
}

.soho-rail nav {
  padding: 0 10px;
  overflow-y: auto;
  flex: 1;
}

.soho-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.soho-nav-item:hover {
  background: #17674e;
}

.soho-nav-item.selected {
  background: #63bd08;
  color: #123522;
}

.soho-nav-item .chevron {
  margin-left: auto;
  opacity: 0.85;
}

.soho-nav-item svg {
  flex-shrink: 0;
}

.soho-subnav {
  display: flex;
  flex-direction: column;
  margin: 2px 0 10px 34px;
  border-left: 1px solid #5c947f;
}

.soho-subnav a,
.soho-subnav button {
  border: 0;
  background: transparent;
  color: #e3f2ea;
  text-align: left;
  padding: 8px 12px;
  border-radius: 0 7px 7px 0;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
}

.soho-subnav a:hover,
.soho-subnav button:hover {
  background: #17674e;
}

.soho-subnav a.sub-active,
.soho-subnav button.sub-active {
  background: #23745b;
  color: #fff;
  font-weight: 700;
}

.soho-rail-footer {
  margin-top: auto;
  border-top: 1px solid #5d947e;
  padding: 16px 18px;
  font-size: 11px;
  letter-spacing: 0.3px;
  color: #c4dfd2;
  display: flex;
  align-items: center;
  gap: 10px;
}

.soho-rail-footer img {
  width: 28px;
  height: auto;
  border-radius: 4px;
}

.soho-rail.collapsed {
  width: 66px;
}

.soho-rail.collapsed .soho-nav-item {
  justify-content: center;
  padding: 12px;
}

.soho-rail.collapsed .soho-nav-item span,
.soho-rail.collapsed .soho-nav-item .chevron,
.soho-rail.collapsed .soho-rail-head span,
.soho-rail.collapsed .soho-rail-footer span,
.soho-rail.collapsed .soho-rail-search,
.soho-rail.collapsed .soho-subnav {
  display: none;
}

.soho-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.soho-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding: 10px 20px;
  background: #fff9f5;
  border-bottom: 1px solid #e6d7ce;
  min-height: 56px;
}

.soho-tab {
  display: flex;
  align-items: center;
  border: 1px solid #dfd2c9;
  border-radius: 10px;
  background: #fff;
  white-space: nowrap;
}

.soho-tab.active {
  background: #d9f3b6;
  border-color: #9ed655;
}

.soho-tab > button.soho-tab-btn {
  border: 0;
  background: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  color: #17342c;
  font-size: 13px;
  font-weight: 600;
}

.soho-tab .soho-tab-close {
  border: 0;
  background: none;
  padding: 8px 8px 8px 0;
  color: #5a6b64;
  display: grid;
  place-items: center;
}

.soho-tab .soho-tab-close:hover {
  color: #a32020;
}

#contenu {
  flex: 1;
  padding: 0;
}

.soho-workspace #contenu > .page {
  padding: 22px 24px 40px;
  max-width: 1500px;
  margin: 0 auto;
}

.soho-workspace #contenu > .page.page-accueil {
  padding: 0;
  max-width: none;
}

.soho-workspace #contenu > .page.cat-page {
  padding: 0;
  max-width: none;
}

/* —— Tableau de bord Accueil —— */
.dash-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.dash-heading h1 {
  font-size: 28px;
  margin: 0 0 4px;
  color: #102b26;
}

.dash-heading p {
  margin: 0;
  color: #53675e;
}

.dash-period {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-period select,
.dash-period button {
  padding: 9px 13px;
  border: 1px solid #d7d1c9;
  background: #fff;
  border-radius: 9px;
}

.dash-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.dash-kpi {
  min-height: 118px;
  border: 1px solid #deded7;
  border-radius: 14px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  box-shadow: 0 2px 4px #1d3d2610;
}

.dash-kpi.mint { background: #f1faec; }
.dash-kpi.blue { background: #edf5ff; }
.dash-kpi.peach { background: #fff3e8; }
.dash-kpi.lilac { background: #f5f0ff; }

.dash-kpi-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: #ffffffb3;
  color: #075c3c;
  flex-shrink: 0;
}

.dash-kpi .muted {
  color: #4d625a;
  font-size: 13px;
}

.dash-kpi strong {
  font-size: 24px;
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.dash-analytics {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 16px;
}

.dash-panel {
  background: #fffdfb;
  border: 1px solid #e1d8d0;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 2px 5px #173a2510;
  min-width: 0;
}

.dash-panel h2 {
  font-size: 17px;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #102b26;
}

.dash-bars {
  height: 200px;
  display: flex;
  align-items: end;
  gap: 10px;
  padding-top: 8px;
}

.dash-bar-item {
  height: 100%;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  gap: 8px;
}

.dash-bar {
  width: 80%;
  background: linear-gradient(#32a329, #bde8ad);
  min-height: 4px;
  border-radius: 4px 4px 0 0;
}

.dash-bar-item small {
  font-size: 11px;
  color: #53675e;
}

.dash-service-list > div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #eee7e0;
  font-size: 14px;
}

.dash-service-list strong {
  margin-left: auto;
}

.dash-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: #2aa74a;
  flex-shrink: 0;
}

.dash-dot-1 { background: #2385de; }
.dash-dot-2 { background: #f4a641; }
.dash-dot-3 { background: #9773e6; }

.dash-access p {
  margin: 0 0 10px;
  font-size: 13px;
  color: #2a4038;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-access .ok-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2aa74a;
  flex-shrink: 0;
}

.dash-empty {
  color: #6b7973;
  font-size: 14px;
  padding: 12px 0;
  margin: 0;
}

.dash-bottom {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.dash-shortcuts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.dash-shortcuts button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  min-height: 104px;
  border: 1px solid #e2e6d3;
  background: #f3f8ed;
  color: #075039;
  border-radius: 10px;
  font-weight: 600;
  font-size: 12px;
  padding: 10px;
  text-align: center;
}

.dash-shortcuts button:hover {
  background: #e2f3d2;
}

.dash-notif p {
  margin: 0 0 12px;
  font-size: 13px;
  color: #2a4038;
  padding-left: 12px;
  border-left: 3px solid #2385de;
}

.dash-notif p.warn {
  border-left-color: #f4a641;
}

.dash-notif p.ok {
  border-left-color: #2aa74a;
}

.dash-loading,
.dash-error {
  padding: 40px 20px;
  text-align: center;
  color: #53675e;
}

.dash-error {
  color: #a32020;
}

.soho-backdrop {
  display: none;
}

.soho-mobile-close {
  display: none;
}

/* Pages spéciales : pas de barre latérale / onglets (le contenu reste visible) */
body.page-connexion .soho-rail,
body.page-connexion .soho-tabs,
body.page-connexion .soho-backdrop,
body.sans-shell .soho-rail,
body.sans-shell .soho-tabs,
body.sans-shell .soho-backdrop {
  display: none !important;
}

body.page-connexion .soho-workspace,
body.sans-shell .soho-workspace {
  display: flex;
  min-height: 100vh;
}

body.page-connexion .soho-main,
body.sans-shell .soho-main {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

body.page-connexion #contenu,
body.sans-shell #contenu {
  flex: 1;
  display: flex;
  flex-direction: column;
}

body.page-connexion #contenu > .page,
body.sans-shell #contenu > .page {
  max-width: none;
  padding: 0;
  flex: 1;
}

/* Masquer ancienne nav horizontale / bottom */
.nav-bar,
.bottom-nav {
  display: none !important;
}

@media (max-width: 1200px) {
  .dash-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dash-analytics {
    grid-template-columns: 1fr 1fr;
  }
  .dash-analytics .dash-panel:last-child {
    grid-column: 1 / -1;
  }
  .dash-shortcuts {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .soho-rail {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 40;
    transform: translateX(-100%);
    width: 280px !important;
  }
  .soho-rail.mobile-open {
    transform: translateX(0);
  }
  .soho-rail.mobile-open .soho-nav-item span,
  .soho-rail.mobile-open .soho-nav-item .chevron {
    display: inline;
  }
  .soho-rail.mobile-open .soho-subnav {
    display: flex;
  }
  .soho-mobile-close {
    display: block !important;
  }
  .soho-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: #0008;
    z-index: 35;
    border: 0;
  }
  .soho-backdrop.visible {
    display: block;
  }
  .soho-workspace #contenu > .page {
    padding: 16px;
  }
  .dash-heading {
    flex-direction: column;
    align-items: flex-start;
  }
  .dash-analytics,
  .dash-bottom {
    grid-template-columns: 1fr;
  }
  .dash-analytics .dash-panel:last-child {
    grid-column: auto;
  }
  .dash-shortcuts {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .dash-kpis {
    grid-template-columns: 1fr;
  }
  .dash-period {
    width: 100%;
  }
  .dash-period select {
    flex: 1;
  }
}
