/* CRM — shell premium (sidebar + topbar) */

body.app-mode {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, #f0f4fa 0%, #e8eef6 45%, #f8fafc 100%);
  color: #0f172a;
}

.app-shell {
  background: transparent;
}

.crm-workspace {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sidebar {
  flex: 0 0 260px;
  width: 260px;
  min-width: 0;
  max-width: 260px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #082b5b 0%, #0f4c97 42%, #0a3568 100%);
  backdrop-filter: blur(12px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 4px 0 24px rgba(8, 43, 91, 0.12);
  padding: 1.1rem 0.85rem;
  animation: shell-sidebar-in 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  transition:
    width 0.3s ease,
    flex-basis 0.3s ease,
    max-width 0.3s ease,
    padding 0.3s ease;
}

@keyframes shell-sidebar-in {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  padding: 0.25rem 0.2rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.85rem;
}

.sidebar-brand-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.sidebar-brand-text strong {
  display: block;
  color: #fff;
  font-size: 0.98rem;
  font-weight: 700;
}

.sidebar-sub {
  display: block;
  font-size: 0.72rem;
  opacity: 0.82;
  color: rgba(255, 255, 255, 0.85);
}

.sidebar-collapse-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.25s ease,
    transform 0.25s ease;
}

.sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.05);
}

.sidebar-collapse-btn__icon {
  display: block;
  width: 14px;
  height: 14px;
  background: rgba(255, 255, 255, 0.9);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E") center/contain no-repeat;
  transition: transform 0.3s ease;
}

.sidebar.sidebar--collapsed .sidebar-collapse-btn__icon {
  transform: rotate(180deg);
}

.sidebar-logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  padding: 4px;
  box-shadow: 0 0 24px rgba(96, 165, 250, 0.35);
}

.sidebar-logo {
  display: none;
}

.sidebar-nav {
  gap: 0.2rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  position: relative;
  min-width: 0;
  max-width: 100%;
  transition:
    background 0.3s ease,
    color 0.3s ease,
    transform 0.25s ease;
}

.nav-item::before {
  content: "";
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.nav-item[data-nav-icon="dashboard"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='9' rx='1'/%3E%3Crect x='14' y='3' width='7' height='5' rx='1'/%3E%3Crect x='14' y='12' width='7' height='9' rx='1'/%3E%3Crect x='3' y='16' width='7' height='5' rx='1'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='9' rx='1'/%3E%3Crect x='14' y='3' width='7' height='5' rx='1'/%3E%3Crect x='14' y='12' width='7' height='9' rx='1'/%3E%3Crect x='3' y='16' width='7' height='5' rx='1'/%3E%3C/svg%3E");
}

.nav-item[data-nav-icon="users"]::before,
.nav-item[data-nav-icon="clients"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
}

.nav-item[data-nav-icon="tickets"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3C/svg%3E");
}

.nav-item[data-nav-icon="quotes"]::before,
.nav-item[data-nav-icon="purchase"]::before,
.nav-item[data-nav-icon="products"]::before,
.nav-item[data-nav-icon="suppliers"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z'/%3E%3C/svg%3E");
}

.nav-item[data-nav-icon="billing"]::before,
.nav-item[data-nav-icon="reports"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cline x1='12' y1='1' x2='12' y2='23'/%3E%3Cpath d='M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cline x1='12' y1='1' x2='12' y2='23'/%3E%3Cpath d='M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6'/%3E%3C/svg%3E");
}

.nav-item[data-nav-icon="shield"]::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3C/svg%3E");
}

.nav-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
  .sidebar .nav-item:hover:not(.nav-current) {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(3px);
  }
}

.sidebar .nav-item.nav-current {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow:
    inset 3px 0 0 #60a5fa,
    0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ——— Utilidades de truncado (CRM global) ——— */
.u-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
}

.u-truncate-group {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

/* ——— User Profile Card (sidebar) ——— */
.sidebar-footer {
  flex-shrink: 0;
  min-width: 0;
  margin-top: auto;
}

.profile-card {
  margin: 0 0 0.75rem;
  padding: 1rem 1rem 0.95rem;
  border-radius: 16px;
  min-width: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 4px 6px rgba(8, 43, 91, 0.12),
    0 12px 28px rgba(0, 0, 0, 0.2);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    background 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
  .profile-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.13);
    box-shadow:
      0 6px 10px rgba(8, 43, 91, 0.14),
      0 16px 36px rgba(0, 0, 0, 0.24);
  }
}

.profile-card__inner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  min-width: 0;
}

.profile-card__avatar-wrap {
  position: relative;
  flex-shrink: 0;
  padding: 3px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa 0%, #1a6bc4 45%, #082b5b 100%);
  box-shadow: 0 0 20px rgba(96, 165, 250, 0.35);
}

.profile-card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.12rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, #1a6bc4, #0f4c97);
  line-height: 1;
}

.profile-card__status {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #0a3568;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.75);
  z-index: 2;
}

.profile-card__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding-top: 0.1rem;
}

.profile-card__name {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  letter-spacing: -0.01em;
}

.profile-card__email {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.78);
}

.profile-card__role-badge:empty {
  display: none;
}

.profile-card__role-badge {
  display: inline-block;
  max-width: 100%;
  margin-top: 0.15rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #bfdbfe;
  background: rgba(15, 76, 151, 0.45);
  border: 1px solid rgba(96, 165, 250, 0.35);
  line-height: 1.35;
}

.btn-sidebar-out,
.btn-sidebar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 0;
  max-width: 100%;
}

.btn-sidebar-out__icon,
.btn-sidebar-link__icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  opacity: 0.9;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.btn-sidebar-out__icon {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
}

.btn-sidebar-link__icon {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3C/svg%3E");
}

.btn-sidebar-out__label,
.btn-sidebar-link__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Sidebar colapsado (escritorio) */
@media (min-width: 769px) {
  .sidebar.sidebar--collapsed {
    flex: 0 0 76px;
    width: 76px;
    max-width: 76px;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }

  .sidebar.sidebar--collapsed .sidebar-brand-text,
  .sidebar.sidebar--collapsed .nav-label,
  .sidebar.sidebar--collapsed .profile-card__body,
  .sidebar.sidebar--collapsed .btn-sidebar-out__label,
  .sidebar.sidebar--collapsed .btn-sidebar-link__label {
    display: none;
  }

  .sidebar.sidebar--collapsed .sidebar-brand {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0.85rem;
  }

  .sidebar.sidebar--collapsed .sidebar-logo-img {
    width: 40px;
    height: 40px;
  }

  .sidebar.sidebar--collapsed .sidebar-collapse-btn {
    order: 3;
    width: 100%;
  }

  .sidebar.sidebar--collapsed .nav-item {
    justify-content: center;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }

  .sidebar.sidebar--collapsed .nav-item::before {
    margin: 0;
  }

  .sidebar.sidebar--collapsed .profile-card {
    padding: 0.65rem 0.35rem;
    display: flex;
    justify-content: center;
  }

  .sidebar.sidebar--collapsed .profile-card__inner {
    justify-content: center;
  }

  .sidebar.sidebar--collapsed .profile-card__avatar-wrap {
    margin: 0 auto;
  }

  .sidebar.sidebar--collapsed .btn-sidebar-out,
  .sidebar.sidebar--collapsed .btn-sidebar-link {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .sidebar.sidebar--collapsed .nav-item:hover:not(.nav-current) {
    transform: none;
  }
}

@media (max-width: 768px) {
  .sidebar-collapse-btn {
    display: none;
  }
}

.crm-topbar {
  flex-shrink: 0;
  position: relative;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.35rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(15, 76, 151, 0.08);
  box-shadow: 0 4px 20px rgba(15, 76, 151, 0.06);
  animation: shell-topbar-in 0.4s ease 0.05s both;
}

@keyframes shell-topbar-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.crm-topbar__left {
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(100%, 420px);
}

.crm-topbar__greeting {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #082b5b;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-topbar__date {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-topbar__center {
  flex: 1;
  min-width: 0;
  max-width: 420px;
}

.crm-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-radius: 12px;
  background: #f1f5f9;
  border: 1px solid transparent;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    background 0.3s ease;
}

.crm-search:focus-within {
  background: #fff;
  border-color: rgba(15, 76, 151, 0.25);
  box-shadow: 0 0 0 3px rgba(15, 76, 151, 0.12);
}

.crm-search__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.45;
  background: #0f4c97;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") center/contain no-repeat;
}

.crm-search input {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  min-width: 0;
}

.crm-search input:focus {
  outline: none;
}

.crm-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  position: relative;
  z-index: 301;
}

.crm-notify {
  position: relative;
  z-index: 302;
}

.crm-topbar__btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.crm-topbar__btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 76, 151, 0.12);
}

.crm-topbar__bell {
  display: block;
  width: 18px;
  height: 18px;
  margin: auto;
  background: #64748b;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9'/%3E%3Cpath d='M13.73 21a2 2 0 0 1-3.46 0'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9'/%3E%3Cpath d='M13.73 21a2 2 0 0 1-3.46 0'/%3E%3C/svg%3E") center/contain no-repeat;
}

.crm-notify__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #dc2626;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}

.crm-notify__badge.hidden {
  display: none;
}

.crm-notify__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 1.5rem));
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
  z-index: 4000;
  isolation: isolate;
}

.crm-notify__panel.hidden {
  display: none;
}

.crm-notify__head {
  flex-shrink: 0;
  padding: 0.7rem 0.9rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: #0f172a;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

.crm-notify__list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.35rem 0;
  background: #fff;
}

.crm-notify__empty {
  margin: 0;
  padding: 0.9rem;
  color: #94a3b8;
  font-size: 0.85rem;
  text-align: center;
}

.crm-notify__item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: #fff;
  padding: 0.55rem 0.85rem;
  border-radius: 0;
  cursor: pointer;
  font: inherit;
}

.crm-notify__item + .crm-notify__item,
.crm-notify__section + .crm-notify__item {
  border-top: 1px solid #f1f5f9;
}

.crm-notify__item:hover {
  background: #f1f5f9;
}

.crm-notify__item-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: #0f172a;
  line-height: 1.35;
  word-break: break-word;
}

.crm-notify__item-sub {
  font-size: 0.76rem;
  margin-top: 0.2rem;
  line-height: 1.35;
  word-break: break-word;
}

.crm-notify__item-sub--warn {
  color: #b45309;
}

.crm-notify__item-sub--danger {
  color: #dc2626;
  font-weight: 600;
}

.crm-notify__item-sub--info {
  color: #1d4ed8;
}

.crm-notify__section {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.55rem 0.85rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #eef2f7;
}

.crm-notify__item--request {
  border-left: 3px solid #1d4ed8;
}

.crm-notify__item--quote-approve {
  border-left: 3px solid #0b7d45;
}

.crm-notify__item-sub--ok {
  color: #0b7d45;
  font-weight: 600;
}

.crm-notify__foot {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.crm-notify__action {
  border: 1px solid #0f4c97;
  background: #0f4c97;
  color: #fff;
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.crm-notify__action:hover:not(:disabled) {
  background: #0c3d78;
}

.crm-notify__action:disabled {
  opacity: 0.6;
  cursor: default;
}

.crm-notify__status {
  font-size: 0.76rem;
  color: #64748b;
}

.crm-topbar__avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #1a6bc4, #0f4c97);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 76, 151, 0.35);
  transition: transform 0.25s ease;
}

.crm-topbar__avatar:hover {
  transform: scale(1.05);
}

.main-content {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  position: relative;
  z-index: 1;
  padding: 1.25rem 1.5rem 2.5rem;
  background: transparent;
}

@media (max-width: 900px) {
  .crm-topbar {
    flex-wrap: wrap;
  }

  .crm-topbar__center {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }
}

@media (max-width: 768px) {
  .sidebar {
    flex: 0 0 280px;
    width: 280px;
    max-width: min(280px, 88vw);
  }

  .sidebar:not(.sidebar--open) {
    max-width: none;
  }

  .main-content {
    padding: 1rem;
  }

  .profile-card__email {
    font-size: 0.72rem;
  }
}

/* ——— Anti overflow horizontal (CRM) ——— */
body.app-mode {
  overflow-x: hidden;
}

.app-shell {
  max-width: 100%;
  overflow-x: hidden;
}

.main-content {
  max-width: 100%;
  overflow-x: hidden;
}

.main-view,
.main-card,
.dash-page,
.table-wrap {
  max-width: 100%;
  min-width: 0;
}

.main-title,
.main-lead,
.dash-page-title,
.dash-page-lead {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.users-table th,
.users-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.users-table td.num {
  max-width: 120px;
}

.dashboard-cal-event {
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-cal-event > div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
