:root {
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --shadow-sm: 0 1px 2px rgba(2, 6, 23, 0.06);
  --shadow-md: 0 10px 30px rgba(2, 6, 23, 0.1);
  --shadow-lg: 0 25px 60px rgba(2, 6, 23, 0.16);
  --color-surface: rgba(255, 255, 255, 0.85);
  --color-surface-2: rgba(255, 255, 255, 0.7);
  --color-surface-dark: rgba(2, 6, 23, 0.65);
  --color-border: rgba(15, 23, 42, 0.08);
  --color-border-dark: rgba(255, 255, 255, 0.08);
  --color-text: rgb(15, 23, 42);
  --color-text-muted: rgb(100, 116, 139);
  --color-brand: #4f46e5;
  --color-accent: #ec4899;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #f43f5e;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    Segoe UI,
    Roboto,
    Helvetica Neue,
    Arial,
    sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body {
  color: var(--color-text);
  overflow-x: hidden;
}
h1,
h2,
h3 {
  letter-spacing: -0.01em;
}
main:focus {
  outline: none;
}
header #globalSearch {
  padding-left: 3rem;
}
header #globalSearch + svg {
  left: 0.9rem;
}

header .btn.btn-muted {
  margin-left: 0.25rem;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: saturate(180%) blur(10px);
}
.dark .card {
  background: var(--color-surface-dark);
  border-color: var(--color-border-dark);
}

.crm-modal {
  width: 100%;
}
.crm-modal-dialog {
  width: min(92vw, 720px);
  max-width: 92vw;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 12px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    transform 0.05s ease,
    filter 0.2s,
    background 0.2s,
    color 0.2s,
    border 0.2s;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  color: #fff;
  background: var(--color-brand);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover {
  filter: brightness(1.05);
}
.btn-muted {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}
.dark .btn-muted {
  background: rgba(30, 41, 59, 0.65);
  border-color: var(--color-border-dark);
}
.btn-secondary {
  color: var(--color-brand);
  background: transparent;
  border: 1px solid rgba(79, 70, 229, 0.35);
}
.btn-secondary:hover {
  background: rgba(79, 70, 229, 0.08);
}

.input,
.select {
  width: 100%;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--color-border);
  padding: 0.55rem 0.9rem;
  outline: 0;
  font-size: 0.95rem;
}
.input:focus,
.select:focus {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
  border-color: rgba(79, 70, 229, 0.4);
}
.dark .input,
.dark .select {
  background: rgba(30, 41, 59, 0.7);
  border-color: var(--color-border-dark);
  color: #e2e8f0;
}

.activity-editor {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.activity-editor .select,
.activity-editor .input {
  min-width: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  padding: 0.2rem 0.6rem;
  font-size: 11px;
  background: rgba(79, 70, 229, 0.12);
  color: #4338ca;
}
.dark .chip {
  background: rgba(79, 70, 229, 0.2);
  color: #c7d2fe;
}

.table-h {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}
.dark .table-h {
  color: #94a3b8;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.6rem;
  border-radius: 0.6rem;
  color: var(--color-brand);
  font-weight: 600;
  background: rgba(79, 70, 229, 0.12);
  border: 1px solid rgba(79, 70, 229, 0.2);
}
.link:hover {
  background: rgba(79, 70, 229, 0.2);
}
.dark .link {
  color: #e0e7ff;
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.35);
}
.dark .link:hover {
  background: rgba(99, 102, 241, 0.35);
}

.glass {
  background: rgba(255, 255, 255, 0.8);
}
.dark .glass {
  background: rgba(2, 6, 23, 0.6);
}

#sidebar {
  box-shadow: var(--shadow-lg);
}
#sidebar a,
#sidebar a:visited {
  color: inherit;
  text-decoration: none;
}
#sidebar nav,
#sidebar nav ul,
#sidebar nav li {
  list-style: none;
  margin: 0;
  padding: 0;
}
#sidebar ::marker {
  content: "";
}

#userMenu a,
#userMenu a:visited {
  color: inherit;
  text-decoration: none;
}
.crm-menu-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.65rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: inherit;
  transition:
    background 0.15s ease,
    color 0.15s ease;
  text-align: center;
}
.crm-menu-item:hover {
  background: rgba(255, 255, 255, 0.7);
}
.dark .crm-menu-item:hover {
  background: rgba(30, 41, 59, 0.7);
}
.crm-menu-divider {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  margin: 0.35rem 0.35rem;
}
.dark .crm-menu-divider {
  border-top-color: rgba(255, 255, 255, 0.08);
}
header {
  box-shadow: 0 6px 20px rgba(2, 6, 23, 0.08);
}
footer {
  box-shadow: 0 -8px 24px rgba(2, 6, 23, 0.06);
}

.crm-shell {
  min-width: 0;
}

.crm-main {
  min-width: 0;
}

.crm-content {
  min-width: 0;
}

.crm-table-wrap {
  overflow-x: auto;
}

.crm-card-list {
  display: none;
}

.crm-detail-mobile {
  display: none;
}

.crm-detail-desktop {
  display: block;
}

.crm-back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

.crm-action-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 1rem;
}

.crm-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.12);
  color: #4338ca;
  border: 1px solid rgba(79, 70, 229, 0.2);
  font-weight: 600;
}

.dark .crm-action-btn {
  background: rgba(99, 102, 241, 0.25);
  color: #e0e7ff;
  border-color: rgba(99, 102, 241, 0.35);
}

.crm-accordion {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.6);
}

.dark .crm-accordion {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(148, 163, 184, 0.2);
}

.crm-accordion summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  padding: 0.3rem 0;
}

.crm-accordion summary::-webkit-details-marker {
  display: none;
}

.crm-attachment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Notifications Panel */
.crm-notifications-panel {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: opacity 0.2s;
}

.crm-notifications-panel.hidden {
  display: none;
}

.crm-notifications-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  backdrop-filter: saturate(180%) blur(10px);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  width: 100%;
  border-radius: 24px 24px 0 0;
}

.dark .crm-notifications-content {
  background: var(--color-surface-dark);
  border-color: var(--color-border-dark);
}

.crm-notifications-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.dark .crm-notifications-header {
  border-color: var(--color-border-dark);
}

.crm-notifications-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.crm-notification-item {
  padding: 1rem;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s;
}

.dark .crm-notification-item {
  border-color: var(--color-border-dark);
}

.crm-notification-item:last-child {
  border-bottom: none;
}

.crm-notification-item.unread {
  background: rgba(79, 70, 229, 0.04);
}

.dark .crm-notification-item.unread {
  background: rgba(99, 102, 241, 0.1);
}

.crm-severity-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.crm-severity-info {
  background: rgba(59, 130, 246, 0.1);
  color: rgb(37, 99, 235);
}

.dark .crm-severity-info {
  background: rgba(96, 165, 250, 0.15);
  color: rgb(147, 197, 253);
}

.crm-severity-success {
  background: rgba(16, 185, 129, 0.1);
  color: rgb(5, 150, 105);
}

.dark .crm-severity-success {
  background: rgba(52, 211, 153, 0.15);
  color: rgb(110, 231, 183);
}

.crm-severity-warning {
  background: rgba(245, 158, 11, 0.1);
  color: rgb(217, 119, 6);
}

.dark .crm-severity-warning {
  background: rgba(251, 191, 36, 0.15);
  color: rgb(252, 211, 77);
}

.crm-severity-error {
  background: rgba(239, 68, 68, 0.1);
  color: rgb(220, 38, 38);
}

.dark .crm-severity-error {
  background: rgba(248, 113, 113, 0.15);
  color: rgb(252, 165, 165);
}

.crm-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
  color: inherit;
}

.crm-icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.dark .crm-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.crm-icon-btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
  color: inherit;
  flex-shrink: 0;
}

.crm-icon-btn-sm:hover {
  background: rgba(0, 0, 0, 0.05);
}

.dark .crm-icon-btn-sm:hover {
  background: rgba(255, 255, 255, 0.08);
}

.crm-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

/* Desktop view for notifications panel */
@media (min-width: 768px) {
  .crm-notifications-panel {
    align-items: center;
  }

  .crm-notifications-content {
    width: min(92vw, 480px);
    max-height: 70vh;
    border-radius: 24px;
  }
}


.crm-search-overlay {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.crm-search-overlay.hidden {
  display: none;
}

.crm-search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.crm-search-panel {
  position: relative;
  margin-top: 4rem;
  width: min(92vw, 720px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.dark .crm-search-panel {
  background: var(--color-surface-dark);
  border-color: var(--color-border-dark);
}

.crm-search-group {
  padding: 0.4rem 0.6rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}

.crm-search-row + .crm-search-group {
  margin-top: 0.4rem;
}

.crm-kanban {
  min-width: 0;
}

.crm-kanban-grid {
  width: 100%;
}

.crm-kanban-col {
  min-width: 0;
}

.crm-deal-card {
  padding: 0.75rem;
}

.crm-deal-ghost {
  opacity: 0.5;
}

.crm-deal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.crm-deal-move,
.crm-deal-more,
.crm-sheet-close {
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 12px;
  font-weight: 600;
  background: rgba(79, 70, 229, 0.12);
  color: #4338ca;
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.dark .crm-deal-move,
.dark .crm-deal-more,
.dark .crm-sheet-close {
  background: rgba(99, 102, 241, 0.25);
  color: #e0e7ff;
  border-color: rgba(99, 102, 241, 0.35);
}

.crm-deal-more-panel {
  display: none;
  margin-top: 0.5rem;
}

.crm-deal-more-panel.is-open {
  display: block;
}

@media (min-width: 769px) {
  .crm-deal-more-panel {
    display: none !important;
  }
}

.crm-mobile-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
}

.crm-mobile-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.crm-mobile-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-surface);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  padding: 1rem;
  max-height: 70vh;
  overflow: auto;
  box-shadow: 0 -16px 40px rgba(15, 23, 42, 0.25);
}

.dark .crm-mobile-sheet-panel {
  background: var(--color-surface-dark);
}

.crm-sheet-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.7);
  font-weight: 600;
}

.crm-sheet-item.is-active {
  border-color: rgba(79, 70, 229, 0.35);
  background: rgba(79, 70, 229, 0.12);
  color: #4338ca;
}

.dark .crm-sheet-item {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

.dark .crm-sheet-item.is-active {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.35);
  color: #e0e7ff;
}

.crm-tap {
  min-height: 44px;
  padding: 0.55rem 0.9rem;
}

.crm-card-actions .btn,
.crm-card-actions .link {
  min-height: 44px;
}

.crm-header-inner {
  height: 3rem;
}

.crm-mobile-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  min-height: 44px;
}

.dark .crm-mobile-search-trigger {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(148, 163, 184, 0.2);
}

.crm-fab-wrap {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 65;
  display: none;
}

.crm-fab {
  height: 54px;
  width: 54px;
  border-radius: 999px;
  background: linear-gradient(45deg, var(--color-brand), var(--color-accent));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 30px rgba(79, 70, 229, 0.35);
}

.crm-quickadd-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
}

.crm-quickadd-sheet.is-open {
  display: block;
}

.crm-quickadd-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.crm-quickadd-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-surface);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  padding: 1rem;
  max-height: 75vh;
  overflow: auto;
  box-shadow: 0 -16px 40px rgba(15, 23, 42, 0.25);
}

.dark .crm-quickadd-panel {
  background: var(--color-surface-dark);
}

.crm-page-title {
  line-height: 1.2;
}

.crm-footer {
  min-height: 2.5rem;
}

@media (max-width: 1024px) {
  #sidebar.is-collapsed {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .crm-header-inner {
    height: 2.75rem;
  }

  main h1 {
    font-size: 1.4rem;
  }

  .crm-mobile-search {
    position: sticky;
    top: 2.75rem;
    z-index: 20;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    margin-bottom: 0.75rem;
    padding-top: 0.5rem;
  }

  .dark .crm-mobile-search {
    background: rgba(2, 6, 23, 0.8);
  }

  header #globalSearch {
    width: 100%;
  }

  .crm-page-title {
    font-size: 1.4rem;
  }

  .crm-table-wrap {
    display: none;
  }

  .crm-card-list {
    display: block;
  }

  .crm-detail-mobile {
    display: block;
  }

  .crm-detail-desktop {
    display: none;
  }

  .crm-search-panel {
    width: 100%;
    margin-top: 0;
    height: 100%;
    border-radius: 0;
    padding: 1rem;
  }

  .crm-kanban {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.5rem;
  }

  .crm-kanban-grid {
    grid-auto-flow: column;
    grid-auto-columns: minmax(78vw, 1fr);
    width: max-content;
  }

  .crm-kanban-col {
    scroll-snap-align: start;
  }

  .crm-deal-card {
    padding: 0.85rem;
  }

  .crm-deal-move,
  .crm-deal-more,
  .crm-sheet-close {
    min-height: 44px;
  }

  .crm-mobile-sheet {
    display: block;
  }

  .crm-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .crm-fab-wrap {
    display: block;
  }

  .crm-footer > div {
    height: 2.5rem;
  }
}

@media (max-width: 1024px) {
  .crm-sidebar {
    width: min(85vw, 320px);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .crm-sidebar.is-open {
    transform: translateX(0);
  }
}

nav a {
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
nav a:hover {
  background: rgba(255, 255, 255, 0.75);
}
.dark nav a:hover {
  background: rgba(30, 41, 59, 0.7);
}

.crm-nav-section {
  padding: 0.35rem 0.6rem;
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: rgba(100, 116, 139, 0.8);
}
.dark .crm-nav-section {
  color: rgba(148, 163, 184, 0.7);
}

.crm-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 999px;
  padding: 0.55rem 0.7rem;
  gap: 0.5rem;
  font-weight: 600;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.2s ease;
  outline: 0;
  position: relative;
}
.crm-nav-item:focus-visible {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
}
.crm-nav-item:hover {
  background: rgba(255, 255, 255, 0.75);
}
.dark .crm-nav-item:hover {
  background: rgba(30, 41, 59, 0.75);
}
.crm-nav-item--active {
  background: rgba(79, 70, 229, 0.18);
  color: #4338ca;
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.2);
}
.dark .crm-nav-item--active {
  background: rgba(79, 70, 229, 0.3);
  color: #e0e7ff;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.35);
}

.crm-nav-left {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}
.crm-nav-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: inherit;
}
.dark .crm-nav-icon {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(148, 163, 184, 0.2);
}
.crm-nav-icon svg {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}
.crm-nav-item--active .crm-nav-icon {
  background: rgba(79, 70, 229, 0.15);
  border-color: rgba(79, 70, 229, 0.25);
}
.dark .crm-nav-item--active .crm-nav-icon {
  background: rgba(79, 70, 229, 0.25);
  border-color: rgba(79, 70, 229, 0.35);
}

.crm-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  padding: 0.6rem 0.75rem;
  gap: 0.6rem;
}
.dark .crm-profile {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(148, 163, 184, 0.15);
}
.crm-profile-main {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.crm-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  object-fit: cover;
}
.crm-profile-text {
  line-height: 1.1;
}
.crm-profile-name {
  font-size: 0.85rem;
  font-weight: 600;
}
.crm-profile-email {
  font-size: 0.7rem;
  color: rgba(100, 116, 139, 0.9);
}
.dark .crm-profile-email {
  color: rgba(148, 163, 184, 0.8);
}
.crm-profile-settings {
  height: 34px;
  width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.dark .crm-profile-settings {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(148, 163, 184, 0.2);
}
.crm-profile-settings svg {
  width: 18px;
  height: 18px;
  opacity: 0.8;
}

.crm-icon-button {
  height: 32px;
  width: 32px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.dark .crm-icon-button {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(148, 163, 184, 0.2);
}
.crm-icon-button svg {
  width: 16px;
  height: 16px;
  opacity: 0.85;
}
.crm-icon-button:focus-visible {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
}

#sidebar.is-collapsed {
  width: 92px;
}
#sidebar.is-collapsed .crm-nav-label,
#sidebar.is-collapsed .crm-nav-section,
#sidebar.is-collapsed .crm-profile-text {
  display: none;
}
#sidebar.is-collapsed .crm-profile {
  justify-content: center;
}
#sidebar.is-collapsed .crm-profile-settings {
  display: none;
}
#sidebar.is-collapsed .crm-nav-item {
  justify-content: center;
  padding: 0.6rem;
}
#sidebar.is-collapsed .crm-nav-left {
  gap: 0;
}
.nav-link:hover {
  background: rgba(255, 255, 255, 0.75);
}
.dark .nav-link:hover {
  background: rgba(30, 41, 59, 0.7);
}
.nav-link.active {
  background: rgba(79, 70, 229, 0.18);
  color: #4338ca;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.15);
}
.dark .nav-link.active {
  background: rgba(79, 70, 229, 0.28);
  color: #e0e7ff;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.35);
}

input[type="file"] {
  border-radius: 12px;
  padding: 0.45rem 0.65rem;
  border: 1px dashed rgba(148, 163, 184, 0.6);
  background: rgba(255, 255, 255, 0.75);
}
.dark input[type="file"] {
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(148, 163, 184, 0.25);
}

::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.6);
  border-radius: 999px;
}
.dark ::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
}

/* UI base components */
.ui-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: saturate(180%) blur(10px);
}
.dark .ui-card {
  background: var(--color-surface-dark);
  border-color: var(--color-border-dark);
}

.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-md);
  padding: 0.45rem 1rem;
  transition:
    transform 0.05s ease,
    filter 0.2s,
    background 0.2s,
    color 0.2s;
  outline: 0;
}
.ui-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}
.ui-btn-primary {
  color: #fff;
  background: linear-gradient(45deg, var(--color-brand), var(--color-accent));
}
.ui-btn-primary:hover {
  filter: brightness(1.08);
}
.ui-btn-muted {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.dark .ui-btn-muted {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}

.ui-input,
.ui-select {
  width: 100%;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 0.5rem 0.85rem;
  outline: 0;
}
.ui-input:focus,
.ui-select:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.dark .ui-input,
.dark .ui-select {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.ui-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  padding: 0.15rem 0.55rem;
  font-size: 11px;
  background: rgba(99, 102, 241, 0.12);
  color: #4338ca;
}
.dark .ui-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
}

.ui-table th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}
.dark .ui-table th {
  color: #94a3b8;
}
.ui-table tbody tr {
  transition: background 0.15s ease;
}
.ui-table tbody tr:hover {
  background: rgba(148, 163, 184, 0.12);
}
.dark .ui-table tbody tr:hover {
  background: rgba(148, 163, 184, 0.08);
}

.ui-empty {
  padding: 1.5rem;
  text-align: center;
  color: #64748b;
}
.dark .ui-empty {
  color: #94a3b8;
}

.ui-skeleton {
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.2),
    rgba(148, 163, 184, 0.35),
    rgba(148, 163, 184, 0.2)
  );
  background-size: 200% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
  border-radius: var(--radius-md);
}
@keyframes skeleton {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
