/* side_bar.css */

/* ✅ Scoped variables (NO :root) */
.crm-sidebar{
  --sb-w: 280px;
  --sb-w-collapsed: 84px;

  --bg: #0b1220;
  --panel: rgba(255,255,255,.06);
  --panel-2: rgba(255,255,255,.10);
  --text: rgba(255,255,255,.86);
  --muted: rgba(255,255,255,.60);
  --muted2: rgba(255,255,255,.45);
  --line: rgba(255,255,255,.10);

  --accent: #60a5fa;
  --accent2: #93c5fd;
  --danger: #fb7185;

  --r: 14px;

  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sb-w);
  height: 100vh;
  background: linear-gradient(180deg, #0b1220 0%, #08101d 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 14px;
  box-sizing: border-box;
  z-index: 999;
}

.crm-sidebar.is-collapsed{
  width: var(--sb-w-collapsed);
}

.crm-sidebar__top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 8px 6px 12px;
}

.crm-brand{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width: 0;
}

.crm-brand__mark{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display:flex;
  align-items:center;
  justify-content:center;
  color:#08101d;
  font-weight: 800;
  letter-spacing: .5px;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
}

.crm-brand__text{
  min-width: 0;
}
.crm-brand__title{
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crm-brand__sub{
  color: var(--muted2);
  font-size: 12px;
  margin-top: 1px;
}

.crm-collapse{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.crm-collapse:hover{ background: var(--panel-2); }

.crm-sidebar__search{
  padding: 0 6px 12px;
}
.crm-search{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
}
.crm-search .i{ width: 18px; height: 18px; color: var(--muted); }
.crm-search input{
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  width: 100%;
  font-size: 13px;
}
.crm-search input::placeholder{ color: var(--muted2); }

.crm-nav{
  flex: 1;
  overflow: auto;
  padding: 0 6px;
}
.crm-nav::-webkit-scrollbar{ width: 8px; }
.crm-nav::-webkit-scrollbar-thumb{ background: rgba(255,255,255,.10); border-radius: 10px; }
.crm-nav::-webkit-scrollbar-track{ background: transparent; }

.crm-section{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.crm-section:first-of-type{
  border-top: 0;
  padding-top: 0;
}
.crm-section__title{
  color: var(--muted2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: 6px 8px 10px;
}

.crm-link,
.crm-group__btn{
  width: 100%;
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  box-sizing: border-box;
  font-size: 13px;
  font-weight: 600;
}

.crm-link:hover,
.crm-group__btn:hover{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.06);
}

.crm-ico{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  flex: 0 0 auto;
}
.crm-ico .i{ width: 18px; height: 18px; color: var(--text); }

.crm-label{
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crm-chev{
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--muted);
  transition: transform .2s ease;
}

.crm-group.is-open .crm-chev{
  transform: rotate(90deg);
}

.crm-link.is-active,
.crm-sublink.is-active{
  background: rgba(96,165,250,.14);
  border-color: rgba(96,165,250,.22);
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}

.crm-link.is-active .crm-ico,
.crm-sublink.is-active{
  border-color: rgba(147,197,253,.35);
}

.crm-link--danger{
  color: rgba(255,255,255,.86);
}
.crm-link--danger:hover{
  background: rgba(251,113,133,.14);
  border-color: rgba(251,113,133,.20);
}
.crm-link--danger .crm-ico{ border-color: rgba(251,113,133,.20); }
.crm-link--danger .crm-ico .i{ color: #fecdd3; }

.crm-group__panel{
  margin: 6px 0 8px 46px;
  padding-left: 10px;
  border-left: 1px dashed rgba(255,255,255,.18);

  display: grid;
  gap: 6px;

  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}

.crm-group.is-open .crm-group__panel{
  max-height: 320px;
}

.crm-sublink{
  display:block;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
}
.crm-sublink:hover{
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-color: rgba(255,255,255,.06);
}

.crm-sidebar__footer{
  padding: 10px 6px 4px;
  border-top: 1px solid var(--line);
}

.crm-foot{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
}
.crm-foot .dot{
  width: 10px; height: 10px;
  border-radius: 999px;
  background: #34d399;
  box-shadow: 0 0 0 5px rgba(52,211,153,.12);
}
.crm-foot .t1{ color: var(--text); font-weight: 700; font-size: 12px; }
.crm-foot .t2{ color: var(--muted2); font-size: 11px; margin-top: 2px; }

.crm-sidebar.is-collapsed .crm-brand__text,
.crm-sidebar.is-collapsed .crm-label,
.crm-sidebar.is-collapsed .crm-section__title,
.crm-sidebar.is-collapsed .crm-search input,
.crm-sidebar.is-collapsed .crm-chev,
.crm-sidebar.is-collapsed .crm-sidebar__footer .txt{
  display: none;
}
.crm-sidebar.is-collapsed .crm-group__panel{
  display: none !important;
}
.crm-sidebar.is-collapsed .crm-sidebar__search{
  padding-bottom: 6px;
}
.crm-sidebar.is-collapsed .crm-search{
  justify-content:center;
}
