/*
 * SphericalOne — Enterprise application theme
 * Visual-only override layer. Revert: remove this file + its <link> in base.html
 */

/* ── Design tokens ── */
:root {
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 52px;
  --topbar-height: 48px;

  /* SphericalOne official design system */
  --crm-primary: #226DB4;
  --crm-primary-hover: #185487;
  --crm-primary-soft: #EAF4FB;
  --crm-navy: #0F1C2E;
  --crm-success: #12B76A;
  --crm-success-soft: #ECFDF3;
  --crm-danger: #F04438;
  --crm-danger-soft: #FEF3F2;
  --crm-warning: #F79009;
  --crm-warning-soft: #FFFAEB;
  --crm-info: #2E90FA;
  --crm-info-soft: #EFF8FF;
  --crm-border: #E4E7EC;
  --crm-divider: #EAECF0;
  --crm-bg: #F7F9FC;
  --crm-surface: #ffffff;
  --crm-text: #172033;
  --crm-muted: #667085;
  --crm-muted-light: #98A2B3;

  /* Sidebar — light enterprise */
  --crm-sidebar-bg: #ffffff;
  --crm-sidebar-text: #172033;
  --crm-sidebar-muted: #667085;
  --crm-sidebar-hover: #F7F9FC;
  --crm-sidebar-active: #EAF4FB;
  --crm-sidebar-active-text: #226DB4;
  --crm-sidebar-border: #E4E7EC;
  --crm-sidebar-surface: #F7F9FC;

  --crm-radius-sm: 6px;
  --crm-radius-md: 10px;
  --crm-radius-lg: 12px;

  --crm-shadow-sm: 0 1px 2px rgba(23, 32, 51, 0.04);
  --crm-shadow-md: 0 2px 8px rgba(23, 32, 51, 0.06);
  --crm-surface-muted: #F7F9FC;
  --crm-row-hover: #EAF4FB;
  --crm-brand-gradient: #226DB4;

  --sphere-primary: #226DB4;
  --sphere-primary-soft: #EAF4FB;
  --sphere-border: #E4E7EC;
  --sphere-muted: #667085;
  --sphere-shadow-sm: none;
  --sphere-shadow-md: 0 2px 6px rgba(23, 32, 51, 0.06);
  --sphere-radius: 10px;

  --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --bs-body-color: var(--crm-text);
  --bs-body-bg: var(--crm-bg);
  --bs-primary: var(--crm-primary);
  --bs-primary-rgb: 34, 109, 180;
  --bs-success: var(--crm-success);
  --bs-danger: var(--crm-danger);
  --bs-warning: var(--crm-warning);
  --bs-border-color: var(--crm-border);
  --bs-border-radius: var(--crm-radius-sm);
  --bs-border-radius-sm: 6px;
  --bs-border-radius-lg: var(--crm-radius-md);
  --bs-link-color: var(--crm-primary);
  --bs-link-hover-color: var(--crm-primary-hover);
}

/* ── Base typography ── */
body {
  font-size: 0.875rem;
  line-height: 1.45;
  letter-spacing: 0.01em;
}

h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #111827;
}

.text-label,
.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  letter-spacing: 0.02em;
}

/* ── Sidebar (light enterprise — Jul 31) ── */
.sidebar {
  background: var(--crm-sidebar-bg);
  color: var(--crm-sidebar-text);
  border-right: 1px solid var(--crm-sidebar-border);
  box-shadow: none;
}

.sidebar-brand {
  flex-shrink: 0;
  min-height: var(--topbar-height);
  background: var(--crm-sidebar-bg);
  color: var(--crm-sidebar-text);
  border-bottom: 1px solid var(--crm-sidebar-border);
  padding: 0 0.85rem;
}

.sidebar-brand-link {
  width: 100%;
  min-width: 0;
}

.sidebar-brand-link:hover {
  color: var(--crm-sidebar-active-text);
}

.sidebar-brand .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--crm-primary);
  box-shadow: none;
  font-size: 0.95rem;
  color: #fff;
}

.sidebar-brand .brand-text {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--crm-sidebar-text);
}

.sidebar-brand .brand-byline {
  color: var(--crm-sidebar-muted);
  font-size: 0.6875rem;
  font-weight: 400;
  margin-top: 0.05rem;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 0.5rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

/* Nav rows — dark text on white panel (locked against compose HTML style leaks) */
.sidebar a.sidebar-link,
.sidebar a.sidebar-link:link,
.sidebar a.sidebar-link:visited,
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  border-left: none;
  padding: 0.45rem 0.6rem;
  margin-bottom: 2px;
  color: var(--crm-sidebar-text) !important;
  text-decoration: none !important;
  transition: background 0.1s ease, color 0.1s ease;
}

.sidebar-link i {
  width: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.125rem;
  color: #374151 !important;
  background: transparent;
  transition: color 0.1s ease;
}

.sidebar a.sidebar-link:hover,
.sidebar-link:hover {
  background: var(--crm-sidebar-hover);
  color: var(--crm-sidebar-text) !important;
}

.sidebar-link:hover i {
  color: #374151 !important;
  background: transparent;
}

.sidebar a.sidebar-link.active,
.sidebar-link.active {
  background: var(--crm-sidebar-active);
  color: var(--crm-sidebar-active-text) !important;
  font-weight: 600;
  box-shadow: none;
}

.sidebar-link.active i {
  color: var(--crm-sidebar-active-text) !important;
  background: transparent;
}

/* Section groups — title case headers + color tile */
.sidebar-group {
  margin-bottom: 0.35rem;
}

.sidebar-group + .sidebar-group {
  margin-top: 1rem;
  padding-top: 0;
  border-top: none;
}

.sidebar-group-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--crm-sidebar-muted);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.2rem;
  border: none;
  background: transparent;
  transition: background 0.1s ease, color 0.1s ease;
}

.sidebar-group-toggle::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

[data-sidebar-group="home"] .sidebar-group-toggle::before { background: #579bfc; }
[data-sidebar-group="crm"] .sidebar-group-toggle::before { background: var(--crm-primary); }
[data-sidebar-group="finance"] .sidebar-group-toggle::before { background: #00c875; }
[data-sidebar-group="accounting"] .sidebar-group-toggle::before { background: #bb3354; }
[data-sidebar-group="products"] .sidebar-group-toggle::before { background: #ff642e; }
[data-sidebar-group="delivery"] .sidebar-group-toggle::before { background: #cab641; }
[data-sidebar-group="hrms"] .sidebar-group-toggle::before { background: #ff158a; }
[data-sidebar-group="communication"] .sidebar-group-toggle::before { background: #ff5ac4; }
[data-sidebar-group="analytics"] .sidebar-group-toggle::before { background: #a25ddc; }
[data-sidebar-group="admin"] .sidebar-group-toggle::before { background: #676879; }
[data-sidebar-group="administration"] .sidebar-group-toggle::before { background: #fdab3d; }
[data-sidebar-group="system"] .sidebar-group-toggle::before { background: #676879; }

.sidebar-group:not(.is-collapsed) .sidebar-group-toggle {
  color: var(--crm-sidebar-muted);
  background: transparent;
  border: none;
}

.sidebar-group-toggle:hover {
  color: var(--crm-sidebar-text);
  background: var(--crm-sidebar-hover);
}

.sidebar-group-toggle i {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--crm-sidebar-muted);
  transition: transform 0.15s ease;
}

.sidebar-group-toggle:hover i {
  color: var(--crm-sidebar-muted);
}

.sidebar-group.is-collapsed .sidebar-group-toggle i {
  transform: rotate(-90deg);
}

.sidebar-group:has(.sidebar-link.active) .sidebar-group-toggle {
  color: var(--crm-sidebar-text);
  font-weight: 600;
}

[data-sidebar-group]:not(.is-collapsed) .sidebar-group-toggle {
  border-left: none;
}

.sidebar-group-items {
  padding-left: 0.15rem;
}

/* Footer — minimal “More” strip */
.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--crm-sidebar-border);
  background: var(--crm-sidebar-bg);
  padding: 0.5rem;
  gap: 0.35rem !important;
}

.btn-sidebar-collapse {
  border-radius: 8px;
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--crm-sidebar-muted);
  border: 1px solid var(--crm-sidebar-border);
  background: var(--crm-sidebar-surface);
  padding: 0.45rem 0.6rem;
}

.btn-sidebar-collapse:hover {
  color: var(--crm-sidebar-active-text);
  background: var(--crm-sidebar-active);
  border-color: #b8d9f7;
}

.btn-sidebar-collapse i {
  font-size: 0.875rem;
}

.sidebar-nav-style-picker {
  display: none;
}

/* Pipe tree — sole nav style */
.sidebar-nav-style-pipe .sidebar-tree {
  position: relative;
  margin: 0.2rem 0 0.4rem 0.75rem;
  padding: 0.15rem 0 0.15rem 0.85rem;
  border-left: 2px solid #e6e9ef;
}

.sidebar-nav-style-pipe .sidebar-tree-item {
  position: relative;
  border-left: none !important;
  padding-left: 0.65rem !important;
  border-radius: 8px;
}

.sidebar-nav-style-pipe .sidebar-tree-item::before {
  content: "" !important;
  display: block !important;
  position: absolute;
  left: -0.85rem;
  top: 50%;
  width: 0.65rem;
  height: 2px;
  background: #d1d5db;
  transform: translateY(-50%);
}

.sidebar-nav-style-pipe .sidebar-tree-item:hover::before {
  background: #9ca3af;
}

.sidebar-nav-style-pipe .sidebar-tree-item.active::before {
  background: var(--crm-sidebar-active-text);
}

.sidebar.collapsed .sidebar-nav-style-pipe .sidebar-tree,
.app-shell.sidebar-collapsed .sidebar-nav-style-pipe .sidebar-tree,
html.sidebar-collapsed-init .app-shell .sidebar-nav-style-pipe .sidebar-tree {
  border-left: none;
  margin-left: 0;
  padding-left: 0;
}

.sidebar.collapsed .sidebar-nav-style-pipe .sidebar-tree-item::before,
.app-shell.sidebar-collapsed .sidebar-nav-style-pipe .sidebar-tree-item::before,
html.sidebar-collapsed-init .app-shell .sidebar-nav-style-pipe .sidebar-tree-item::before {
  display: none !important;
}

/* Collapsed — Monday icon rail */
@media (min-width: 992px) {
  .sidebar.collapsed .sidebar-group-toggle,
  .app-shell.sidebar-collapsed .sidebar-group-toggle,
  html.sidebar-collapsed-init .app-shell .sidebar-group-toggle {
    display: none;
  }

  .sidebar.collapsed .sidebar-group.is-collapsed .sidebar-group-items,
  .app-shell.sidebar-collapsed .sidebar-group.is-collapsed .sidebar-group-items,
  html.sidebar-collapsed-init .app-shell .sidebar-group.is-collapsed .sidebar-group-items {
    display: block;
  }

  .sidebar.collapsed .sidebar-group + .sidebar-group,
  .app-shell.sidebar-collapsed .sidebar-group + .sidebar-group,
  html.sidebar-collapsed-init .app-shell .sidebar-group + .sidebar-group {
    margin-top: 0.15rem;
    padding-top: 0;
    border-top: none;
  }

  .sidebar.collapsed .sidebar-nav,
  .app-shell.sidebar-collapsed .sidebar-nav,
  html.sidebar-collapsed-init .app-shell .sidebar-nav {
    padding: 0.5rem 0.35rem;
  }

  .sidebar.collapsed .sidebar-link,
  .app-shell.sidebar-collapsed .sidebar-link,
  html.sidebar-collapsed-init .app-shell .sidebar-link {
    justify-content: center;
    padding: 0.5rem;
    border-radius: 8px;
    position: relative;
  }

  .sidebar.collapsed .sidebar-link i,
  .app-shell.sidebar-collapsed .sidebar-link i,
  html.sidebar-collapsed-init .app-shell .sidebar-link i {
    font-size: 1.25rem;
  }

  .sidebar.collapsed .sidebar-link.active,
  .app-shell.sidebar-collapsed .sidebar-link.active,
  html.sidebar-collapsed-init .app-shell .sidebar-link.active {
    background: var(--crm-sidebar-active);
  }

  .sidebar.collapsed .sidebar-link:hover::after,
  .app-shell.sidebar-collapsed .sidebar-link:hover::after,
  html.sidebar-collapsed-init .app-shell .sidebar-link:hover::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    padding: 0.4rem 0.75rem;
    background: #323338;
    color: #ffffff;
    font-size: 0.8125rem;
    font-weight: 400;
    white-space: nowrap;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    z-index: 1060;
    pointer-events: none;
  }

  .sidebar.collapsed .sidebar-brand,
  .app-shell.sidebar-collapsed .sidebar-brand,
  html.sidebar-collapsed-init .app-shell .sidebar-brand {
    justify-content: center;
    padding: 0 0.35rem;
  }

  .sidebar.collapsed .sidebar-brand-link,
  .app-shell.sidebar-collapsed .sidebar-brand-link,
  html.sidebar-collapsed-init .app-shell .sidebar-brand-link {
    justify-content: center;
  }

  .sidebar.collapsed .sidebar-brand .brand-mark,
  .app-shell.sidebar-collapsed .sidebar-brand .brand-mark,
  html.sidebar-collapsed-init .app-shell .sidebar-brand .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }

  .sidebar.collapsed .sidebar-footer,
  .app-shell.sidebar-collapsed .sidebar-footer,
  html.sidebar-collapsed-init .app-shell .sidebar-footer {
    padding: 0.35rem;
  }

  .sidebar.collapsed .btn-sidebar-collapse,
  .app-shell.sidebar-collapsed .btn-sidebar-collapse,
  html.sidebar-collapsed-init .app-shell .btn-sidebar-collapse {
    padding: 0.45rem;
    justify-content: center;
  }
}

/* ── Topbar ── */
.topbar {
  background: var(--crm-surface);
  border-bottom: 1px solid var(--crm-border);
  box-shadow: none;
  padding: 0 1.25rem;
}

.topbar-search-wrap .form-control {
  border-radius: var(--crm-radius-sm);
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
  font-size: 0.8125rem;
  min-height: 32px;
}

.topbar-search-wrap .form-control:hover {
  border-color: #9ca3af;
}

.topbar-search-wrap .form-control:focus {
  border-color: var(--crm-primary);
  box-shadow: 0 0 0 3px rgba(34, 109, 180, 0.18);
}

.topbar-company-name {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--crm-text);
}

/* ── Page layout ── */
.page-content {
  padding: 1.25rem 1.5rem;
}

.page-header {
  margin-bottom: 1.25rem;
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  margin-top: -1.25rem;
  padding: 0.85rem 1.5rem 0.75rem;
  border-bottom: 1px solid var(--crm-border);
  background: var(--crm-surface);
}

.page-title {
  font-size: 1.375rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.15rem;
}

.page-subtitle,
.dashboard-greeting {
  font-size: 0.8125rem;
  color: var(--crm-muted);
}

.breadcrumb-nav .breadcrumb {
  font-size: 0.75rem;
}

.breadcrumb-nav .breadcrumb-item a {
  color: var(--crm-muted);
  text-decoration: none;
}

.breadcrumb-nav .breadcrumb-item a:hover {
  color: var(--crm-primary);
}

.breadcrumb-nav .breadcrumb-item.active {
  color: var(--crm-text);
  font-weight: 500;
}

/* ── Cards & surfaces ── */
.table-card,
.content-card,
.stat-card {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
  border-radius: var(--crm-radius-md);
  box-shadow: none;
}

.table-card:hover {
  box-shadow: none;
}

.content-card {
  padding: 1.25rem;
}

.content-card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--crm-border);
}

.stat-card {
  padding: 1rem 1.15rem;
}

.stat-card .stat-value {
  font-size: 1.375rem;
  font-weight: 700;
  color: #111827;
}

.stat-card .stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--crm-muted);
}

/* ── Tables ── */
.table {
  --bs-table-bg: transparent;
  font-size: 0.8125rem;
}

.table-card .table thead th,
.table thead th {
  background: var(--crm-surface-muted, #F7F9FC);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--crm-muted, #667085);
  border-bottom: 1px solid var(--crm-border);
  padding: 0.65rem 0.85rem;
  white-space: nowrap;
}

.table tbody td {
  padding: 0.7rem 0.85rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--crm-divider, #EAECF0);
}

.table-card .table tbody tr:hover,
.table tbody tr:hover {
  background: var(--crm-row-hover);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(249, 250, 251, 0.6);
}

/* ── Buttons ── */
.btn {
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--crm-radius-sm);
  padding: 0.375rem 0.875rem;
  letter-spacing: 0.01em;
}

.btn-sm {
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
}

.btn-primary {
  background: var(--crm-primary);
  border: 1px solid var(--crm-primary);
  box-shadow: none;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background: var(--crm-primary-hover);
  border-color: var(--crm-primary-hover);
  box-shadow: none;
}

.btn-outline-primary {
  color: var(--crm-primary);
  border-color: var(--crm-primary);
}

.btn-outline-primary:hover {
  background: var(--crm-primary-soft);
  color: var(--crm-primary-hover);
  border-color: var(--crm-primary);
}

.btn-light {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
  color: var(--crm-text);
}

.btn-light:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.btn-quick-create {
  background: var(--crm-primary);
  border: none;
  box-shadow: none;
}

.btn-quick-create:hover {
  background: var(--crm-primary-hover);
}

/* ── Forms ── */
.form-control,
.form-select {
  font-size: 0.8125rem;
  border-radius: var(--crm-radius-sm);
  border-color: var(--crm-border);
  padding: 0.4rem 0.65rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--crm-primary);
  box-shadow: 0 0 0 3px rgba(34, 109, 180, 0.18);
}

.form-control-sm,
.form-select-sm {
  font-size: 0.75rem;
  border-radius: var(--crm-radius-sm);
}

.input-group-text {
  font-size: 0.8125rem;
  background: #f9fafb;
  border-color: var(--crm-border);
  border-radius: var(--crm-radius-sm);
}

/* ── Badges & status ── */
.badge {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--crm-radius-sm);
  padding: 0.25em 0.5em;
}

.text-bg-primary {
  background-color: var(--crm-primary) !important;
}

.priority-badge {
  border-radius: var(--crm-radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge,
.stage-badge {
  border-radius: var(--crm-radius-sm);
  font-weight: 600;
}

/* ── Alerts ── */
.alert {
  font-size: 0.8125rem;
  border-radius: var(--crm-radius-md);
  border-width: 1px;
  border-left-width: 4px;
}

.alert-success {
  background: var(--crm-success-soft);
  border-color: #c7e8c7;
  border-left-color: var(--crm-success);
  color: #0b5c2e;
}

.alert-danger {
  background: var(--crm-danger-soft);
  border-color: #f5c6cb;
  border-left-color: var(--crm-danger);
  color: #8a0916;
}

.alert-warning {
  background: var(--crm-warning-soft);
  border-color: #ffe08a;
  border-left-color: var(--crm-warning);
  color: #8a4b00;
}

.alert-info {
  background: var(--crm-primary-soft);
  border-color: #b3d7f5;
  border-left-color: var(--crm-primary);
  color: #004578;
}

.crm-alert {
  border-radius: var(--crm-radius-md);
}

/* ── KPI strip ── */
.crm-kpi-strip {
  gap: 0.65rem;
}

.crm-kpi-card {
  border-radius: var(--crm-radius-md);
  box-shadow: none;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--crm-border);
}

.crm-kpi-card.is-primary {
  border-left-color: var(--crm-primary);
}

.crm-kpi-card.is-success {
  border-left-color: var(--crm-success);
}

.crm-kpi-card.is-warning {
  border-left-color: var(--crm-warning);
}

.crm-kpi-card .crm-kpi-value {
  font-size: 1.375rem;
  font-weight: 700;
}

.crm-kpi-card .crm-kpi-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Record detail / CRM panels ── */
.crm-record-panel {
  border-radius: var(--crm-radius-md);
  box-shadow: none;
}

.crm-record-panel-header {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #374151;
  border-bottom: 1px solid var(--crm-border);
}

.crm-record-sidebar .list-group-item {
  font-size: 0.8125rem;
  border-color: #e5e7eb;
  padding: 0.5rem 0.75rem;
}

.crm-record-sidebar .list-group-item.active {
  background: var(--crm-primary-soft);
  color: var(--crm-primary);
  border-color: #b3d7f5;
  font-weight: 600;
}

/* ── Module shortcuts ── */
.module-shortcut-card {
  border-radius: var(--crm-radius-md);
  border: 1px solid var(--crm-border);
  box-shadow: none;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.module-shortcut-card:hover {
  border-color: var(--crm-primary);
  background: var(--crm-primary-soft);
  box-shadow: none;
  transform: none;
}

.module-shortcut-card .shortcut-icon {
  background: var(--crm-primary-soft);
  color: var(--crm-primary);
  border-radius: var(--crm-radius-sm);
}

/* ── Nav tabs & pills ── */
.nav-tabs {
  border-bottom: 1px solid var(--crm-border);
  gap: 0;
}

.nav-tabs .nav-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--crm-muted);
  border-radius: 0;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.55rem 1rem;
  margin-bottom: -1px;
}

.nav-tabs .nav-link:hover {
  color: var(--crm-text);
  border-bottom-color: #d1d5db;
}

.nav-tabs .nav-link.active {
  color: var(--crm-primary);
  background: transparent;
  border-bottom-color: var(--crm-primary);
}

.nav-pills .nav-link {
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--crm-radius-sm);
}

.nav-pills .nav-link.active {
  background: var(--crm-primary);
}

/* ── Modals ── */
.modal-content {
  border-radius: var(--crm-radius-md);
  border: 1px solid var(--crm-border);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
}

.modal-header {
  border-bottom: 1px solid var(--crm-border);
  padding: 0.875rem 1.25rem;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
}

.modal-footer {
  border-top: 1px solid var(--crm-border);
  padding: 0.75rem 1.25rem;
}

/* ── Dropdowns ── */
.dropdown-menu {
  font-size: 0.8125rem;
  border: 1px solid var(--crm-border);
  border-radius: var(--crm-radius-md);
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.08);
  padding: 0.35rem;
}

.dropdown-item {
  border-radius: var(--crm-radius-sm);
  padding: 0.4rem 0.65rem;
  font-weight: 500;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--crm-primary-soft);
  color: var(--crm-primary);
}

/* ── Login page ── */
.login-page {
  background: linear-gradient(160deg, #0b1929 0%, #1e3a5f 50%, #0b1929 100%);
}

.login-card {
  border-radius: var(--crm-radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2.25rem;
}

.login-card .h4 {
  font-weight: 600;
}

.login-card .brand-mark {
  border-radius: var(--crm-radius-sm) !important;
  background: var(--crm-primary) !important;
}

/* ── Install wizard ── */
.install-wizard,
.install-card {
  border-radius: var(--crm-radius-md);
}

/* ── Dashboard / My Work ── */
.dashboard-executive {
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.dashboard-kpi-primary .exec-stat-card {
  border-left: 3px solid var(--crm-primary);
  box-shadow: none;
  border-radius: var(--crm-radius-md);
}

.dashboard-kpi-primary .exec-stat-card:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--crm-border);
  border-left-color: var(--crm-primary-hover);
}

.dashboard-section .exec-stat-card {
  border-radius: var(--crm-radius-md);
}

.dashboard-section .exec-stat-card:hover {
  transform: none;
}

.dashboard-charts-grid .chart-card {
  border-radius: var(--crm-radius-md);
  box-shadow: none;
}

.dashboard-section-title {
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: #4b5563;
}

.exec-stat-icon {
  border-radius: var(--crm-radius-sm) !important;
  background: var(--crm-primary-soft) !important;
  color: var(--crm-primary) !important;
}

/* ── Email / enterprise inbox ── */
.crm-enterprise-page {
  --ent-accent: var(--crm-primary);
  --ent-accent-soft: var(--crm-primary-soft);
  --ent-border: var(--crm-border);
  --ent-muted: var(--crm-muted);
  --ent-surface: var(--crm-surface);
  --ent-canvas: var(--crm-bg);
  --ent-unread: var(--crm-primary);
  --ent-shadow: none;
  --ent-shadow-lg: 0 4px 16px rgba(23, 32, 51, 0.08);
}

.crm-entity-avatar {
  border-radius: var(--crm-radius-sm);
  background: var(--crm-primary);
  box-shadow: none;
}

.crm-entity-avatar.avatar-email {
  background: #0284c7;
}

.crm-entity-avatar.avatar-lead {
  background: #0369a1;
}

.crm-entity-avatar.avatar-queue {
  background: var(--crm-success);
}

.crm-ent-filter-pills .nav-link {
  border-radius: var(--crm-radius-sm);
  font-size: 0.75rem;
}

.crm-ent-filter-pills .nav-link.active {
  background: var(--crm-primary);
  color: #fff;
}

.crm-email-thread-item,
.crm-inbox-row {
  border-color: #e5e7eb;
}

.crm-inbox-row.is-unread {
  border-left-color: var(--crm-primary);
}

/* ── JDE browse ── */
.jde-browse-toolbar {
  border-radius: var(--crm-radius-md);
  box-shadow: none;
}

.jde-browse-table thead th {
  background: #f9fafb;
  font-size: 0.6875rem;
}

/* ── Empty states ── */
.empty-state {
  border-radius: var(--crm-radius-md);
  border: 1px dashed var(--crm-border);
  background: var(--crm-surface);
}

/* ── Pagination ── */
.pagination .page-link {
  font-size: 0.8125rem;
  border-radius: var(--crm-radius-sm);
  color: var(--crm-text);
  border-color: var(--crm-border);
}

.pagination .page-item.active .page-link {
  background: var(--crm-primary);
  border-color: var(--crm-primary);
}

/* ── Scrollbars (WebKit) ── */
.sidebar-nav::-webkit-scrollbar,
.page-content::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.page-content::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

/* Outlook-style mail list + reading pane (load last so CRM tables do not win) */
.crm-email-outlook-page .ol-mail-list-panel {
  background: #fff;
  border: 1px solid var(--crm-border, #e5e7eb);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.crm-email-outlook-page .ol-mail-list {
  display: flex;
  flex-direction: column;
}

.crm-email-outlook-page .ol-mail-row {
  display: grid;
  grid-template-columns: 10px 40px minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
  padding: 0.7rem 1rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #eef1f4;
  background: #fff;
}

.crm-email-outlook-page .ol-mail-row:hover {
  background: #f3f6f9;
}

.crm-email-outlook-page .ol-mail-row.is-unread {
  background: #f7fafc;
}

.crm-email-outlook-page .ol-mail-party,
.crm-email-outlook-page .ol-mail-subject {
  font-weight: 600;
}

.crm-email-outlook-page .ol-mail-preview {
  color: #6b7280;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ol-reading-pane {
  background: #fff;
  border: 1px solid var(--crm-border, #e5e7eb);
  border-radius: 8px;
}

.ol-command-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}
