:root{
  --tb-bg: #f5f7f8;
  --tb-card: #ffffff;
  --tb-text: #0f172a;
  --tb-muted: #64748b;

  --tb-petrol: #2f6b6b;
  --tb-petrol-2: #255b5b;

  --tb-sidebar: #355f63;
  --tb-sidebar-2: #2f5458;

  --tb-radius: 18px;
  --tb-shadow: 0 16px 40px rgba(15, 23, 42, .10);

  --tb-sb-collapsed: 88px;
  --tb-sb-expanded: 280px;

  --tb-gap: 18px;
  --tb-container: 96%;
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--tb-bg);
  color: var(--tb-text);
}

/* ===== Main / container ===== */
.tb-main{
  margin-left: var(--tb-sb-collapsed);
  min-height: 100vh;
  padding: 18px 18px 30px;
  position: relative;
  transition: margin-left .25s ease;
}
.tb-container{
  width: var(--tb-container);
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

/* ===== Fond graphique (blobs + noise) ===== */
.tb-bg{
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.tb-blob{
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 999px;
  filter: blur(40px);
  opacity: .35;
  transform: translate3d(0,0,0);
}
.tb-blob--1{
  top: -140px;
  left: 18%;
  background: radial-gradient(circle at 30% 30%, rgba(47,107,107,.9), rgba(47,107,107,0));
}
.tb-blob--2{
  top: 120px;
  right: -160px;
  background: radial-gradient(circle at 40% 40%, rgba(37,91,91,.75), rgba(37,91,91,0));
}
.tb-blob--3{
  bottom: -200px;
  left: -180px;
  background: radial-gradient(circle at 50% 50%, rgba(100,116,139,.55), rgba(100,116,139,0));
}
.tb-noise{
  position:absolute;
  inset:0;
  background-image:
    linear-gradient(to bottom, rgba(255,255,255,.78), rgba(255,255,255,.78)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.25'/%3E%3C/svg%3E");
  background-size: cover, 220px 220px;
  mix-blend-mode: soft-light;
  opacity: .18;
}

/* ===== Topbar ===== */
.tb-topbar{
  width: var(--tb-container);
  margin: 0 auto 18px;
  display: grid;
  grid-template-columns: 240px 1fr 240px;
  align-items: center;
  gap: var(--tb-gap);
  position: relative;
  z-index: 2;
}
.tb-h1{ font-size: 20px; font-weight: 800; }
.tb-h2{ font-size: 13px; color: var(--tb-muted); margin-top: 2px; }

.tb-search{
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(15,23,42,.06);
  box-shadow: 0 10px 30px rgba(15,23,42,.06);
  border-radius: 999px;
  padding: 10px 14px;
  display:flex;
  align-items:center;
  gap: 10px;
}
.tb-search input{
  border: none;
  outline: none;
  width: 100%;
  font-size: 14px;
  background: transparent;
}
.tb-search-ico{ opacity: .7; }

.tb-topbar-right{
  display:flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== Buttons ===== */
.tb-btn{
  border: 1px solid rgba(15,23,42,.08);
  background: rgba(255,255,255,.8);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 650;
  box-shadow: 0 10px 25px rgba(15,23,42,.06);
  transition: transform .12s ease, background .12s ease;
}
.tb-btn:active{ transform: translateY(1px); }
.tb-btn-primary{
  background: linear-gradient(180deg, rgba(47,107,107,.95), rgba(37,91,91,.95));
  color: #fff;
  border-color: rgba(255,255,255,.15);
}
.tb-btn-ghost{
  width: 44px;
  padding: 10px 0;
}

/* ===== Cards & skeleton ===== */
.tb-card{
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(15,23,42,.06);
  border-radius: var(--tb-radius);
  box-shadow: var(--tb-shadow);
  padding: 16px 16px 14px;
  backdrop-filter: blur(10px);
}
.tb-card-title{ font-weight: 800; font-size: 14px; }
.tb-card-sub{ font-size: 12px; color: var(--tb-muted); margin-top: 4px; }

.tb-skel{
  height: 10px;
  border-radius: 999px;
  margin-top: 12px;
  background: linear-gradient(90deg, rgba(15,23,42,.06), rgba(15,23,42,.03), rgba(15,23,42,.06));
  background-size: 200% 100%;
  animation: tbShimmer 1.4s infinite linear;
}
.tb-skel--short{ width: 70%; }
@keyframes tbShimmer{
  0%{ background-position: 0% 0; }
  100%{ background-position: 200% 0; }
}

/* ===== Grids ===== */
.tb-grid-3{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--tb-gap);
  margin-bottom: var(--tb-gap);
}
.tb-grid-main{
  display:grid;
  grid-template-columns: 1fr 340px;
  gap: var(--tb-gap);
}
.tb-card--large{ min-height: 220px; }
.tb-card--side{ min-height: 220px; }

/* ===== Sidebar ===== */
.tb-sidebar{
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: var(--tb-sb-collapsed);
  background: linear-gradient(180deg, var(--tb-sidebar), var(--tb-sidebar-2));
  color: #e8f0f1;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: width .25s ease;
  overflow: hidden;
  z-index: 5;
}
@media (min-width: 981px){
  .tb-sidebar:hover{ width: var(--tb-sb-expanded); }
  .tb-sidebar:hover ~ .tb-main{ margin-left: var(--tb-sb-expanded); }
}

/* Brand */
.tb-brand{ display:flex; align-items:center; gap: 12px; padding: 8px 10px; }
.tb-logo{
  width: 42px; height: 42px;
  border-radius: 14px;
  display:grid; place-items:center;
  background: rgba(255,255,255,.16);
  font-weight: 800;
}
.tb-brand-text{
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .18s ease, transform .18s ease;
}
@media (min-width: 981px){
  .tb-sidebar:hover .tb-brand-text{ opacity: 1; transform: translateX(0); }
}
.tb-brand-title{ font-weight: 800; line-height: 1.1; }
.tb-brand-subtitle{ font-size: 12px; color: rgba(232,240,241,.75); }

/* Nav items */
.tb-nav{ display:flex; flex-direction: column; gap: 8px; padding: 0 4px; }

.tb-item{
  display:flex;
  align-items:center;
  gap: 12px;
  color: #e8f0f1;
  text-decoration:none;
  padding: 12px 12px;
  border-radius: 14px;
  transition: background .15s ease, transform .15s ease;
  position: relative;
}
.tb-item:hover{ background: rgba(255,255,255,.14); }
.tb-item:active{ transform: translateY(1px); }
.tb-item.is-active{ background: rgba(255,255,255,.16); }

.tb-ico{
  width: 28px;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex: 0 0 28px;
}

.tb-label{
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .18s ease, transform .18s ease;
}

.tb-chevron{
  margin-left: auto;
  opacity: 0;
  transform: rotate(0deg);
  transition: opacity .18s ease, transform .2s ease;
  font-size: 22px;
  line-height: 1;
}
@media (min-width: 981px){
  .tb-sidebar:hover .tb-label{ opacity: 1; transform: translateX(0); }
  .tb-sidebar:hover .tb-chevron{ opacity: .9; }
}

/* Sous-menu */
.tb-item-group{ border-radius: 14px; }
.tb-sub{
  max-height: 0;
  overflow: hidden;
  margin-left: 44px;
  margin-top: 0;
  padding-left: 10px;
  border-left: 2px solid rgba(255,255,255,.18);
  transition: max-height .25s ease, margin-top .25s ease;
}
.tb-subitem{
  display:block;
  color: rgba(232,240,241,.9);
  text-decoration:none;
  padding: 9px 10px;
  border-radius: 12px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .18s ease, transform .18s ease, background .15s ease;
}
.tb-subitem:hover{ background: rgba(255,255,255,.12); }

/* Règle clé */
@media (min-width: 981px){
  .tb-sidebar:hover .tb-item-group:hover .tb-sub{
    max-height: 220px;
    margin-top: 6px;
  }
  .tb-sidebar:hover .tb-item-group:hover .tb-subitem{
    opacity: 1;
    transform: translateX(0);
  }
  .tb-sidebar:hover .tb-item-group:hover .tb-chevron{
    transform: rotate(90deg);
  }
}

.tb-sidebar-footer{
  margin-top: auto;
  padding: 10px 10px;
  color: rgba(232,240,241,.75);
  font-size: 12px;
}

/* ===== Mobile overlay ===== */
.tb-burger{
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 9999;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: var(--tb-shadow);
  cursor: pointer;
  display: none;
}

@media (max-width: 980px){
  .tb-burger{ display: inline-grid; place-items:center; }

  .tb-sidebar{
    width: var(--tb-sb-expanded);
    transform: translateX(-105%);
    transition: transform .25s ease;
  }
  body.tb-sb-open .tb-sidebar{ transform: translateX(0); }

  .tb-main{
    margin-left: 0;
    padding-top: 70px;
  }

  .tb-topbar{
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .tb-grid-3{ grid-template-columns: 1fr; }
  .tb-grid-main{ grid-template-columns: 1fr; }

  /* mobile: on affiche tout */
  .tb-brand-text, .tb-label, .tb-chevron{
    opacity: 1 !important;
    transform: none !important;
  }
  .tb-subitem{
    opacity: 1 !important;
    transform: none !important;
  }
  .tb-item-group:hover .tb-sub{
    max-height: 220px;
    margin-top: 6px;
  }
}