:root {
  --crm-bg-light: #ffffff;
  --crm-bg-dark: #0f172a;
  --crm-accent: #f0b445;
  --crm-accent-2: #f0b445;
  --crm-accent-hover: #d99b2e;
  --crm-accent-contrast: #0f172a;
  --crm-border: #3b82f6;
  --crm-border-strong: #3b82f6;
  --crm-border-soft: #3b82f6;
  --crm-focus-ring: rgba(59, 130, 246, 0.18);
  --crm-surface-soft: #ffffff;
  --crm-nav-bg: #ffffff;
  --crm-text: #111827;
  --crm-muted: #5b6577;
  --crm-radius: 0;
  --crm-header-height: 88px;
}

[data-bs-theme="dark"] {
  --crm-bg-dark: #0f172a;
  --crm-accent: #f0b445;
  --crm-accent-2: #f0b445;
  --crm-accent-hover: #d99b2e;
  --crm-accent-contrast: #0f172a;
  --crm-border: #2a3442;
  --crm-border-strong: #475569;
  --crm-border-soft: #334155;
  --crm-focus-ring: rgba(240, 180, 69, 0.2);
  --crm-surface-soft: #0f172a;
  --crm-nav-bg: #0f172a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0 !important;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(240, 180, 69, 0.12), transparent 60%),
    linear-gradient(180deg, #f7f9fc 0%, #eff3f8 100%);
  color: var(--crm-text);
  overflow: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html {
  width: 100%;
  overflow-x: hidden;
}

img,
svg,
canvas {
  max-width: 100%;
}

button,
input,
select,
textarea {
  max-width: 100%;
}
body::-webkit-scrollbar { display: none; }
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  display: none;
}

header.sticky-top.bg-body {
  position: sticky;
  top: 0;
  z-index: 1040;
  min-height: var(--crm-header-height);
  background-color: rgba(255, 255, 255, 0.75) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--crm-border);
}

header.sticky-top.bg-body .container-fluid {
  min-height: inherit;
  padding-block: 1.15rem !important;
}

[data-bs-theme="light"] .crm-auth-card,
[data-bs-theme="light"] .crm-sidebar,
[data-bs-theme="light"] .crm-card,
[data-bs-theme="light"] .kpi-card,
[data-bs-theme="light"] .chart-card,
[data-bs-theme="light"] .table-responsive,
[data-bs-theme="light"] .modal-content,
[data-bs-theme="light"] #entryForm.entry-form-grid,
[data-bs-theme="light"] .followups-panel,
[data-bs-theme="light"] .followups-table-wrap {
  border-color: var(--crm-border) !important;
}

[data-bs-theme="light"] .crm-auth-card,
[data-bs-theme="light"] .crm-card,
[data-bs-theme="light"] .kpi-card,
[data-bs-theme="light"] .chart-card,
[data-bs-theme="light"] .modal-content {
  box-shadow: none !important;
}

[data-bs-theme="light"] .nav-pills .nav-link,
[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select,
[data-bs-theme="light"] .modal .form-control,
[data-bs-theme="light"] .modal .form-select,
[data-bs-theme="light"] .btn-outline-primary,
[data-bs-theme="light"] .btn-outline-secondary {
  border-color: var(--crm-border-strong) !important;
}

[data-bs-theme="light"] .nav-pills .nav-link:hover,
[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus,
[data-bs-theme="light"] .modal .form-control:focus,
[data-bs-theme="light"] .modal .form-select:focus,
[data-bs-theme="light"] #entryForm.entry-form-grid .form-control:focus,
[data-bs-theme="light"] #entryForm.entry-form-grid .form-select:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 0.2rem var(--crm-focus-ring) !important;
}

[data-bs-theme="light"] .table,
[data-bs-theme="light"] .table th,
[data-bs-theme="light"] .table td {
  border-color: var(--crm-border-soft) !important;
}

[data-bs-theme="light"] .table thead th,
[data-bs-theme="light"] .report-table thead th {
  background: #eff6ff !important;
  border-bottom-color: var(--crm-border-strong) !important;
}

[data-bs-theme="dark"] body {
  background: var(--crm-bg-dark);
  color: #f8fafc;
}

[data-bs-theme="light"] .text-secondary {
  color: #000000 !important;
}

[data-bs-theme="dark"] .text-secondary {
  color: #d1d5db !important;
}

[data-bs-theme="dark"] #profileNameTop,
[data-bs-theme="dark"] #profileNameMobile {
  color: #f8fafc !important;
}

[data-bs-theme="dark"] #profileEmailTop,
[data-bs-theme="dark"] #profileEmailMobile {
  color: #e5e7eb !important;
}

.crm-auth-page {
  min-height: 100vh;
  position: relative;
  padding: 2rem 1rem 2rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(900px 400px at 50% 0%, rgba(245, 181, 68, 0.08), transparent 58%),
    linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
}

.crm-auth-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background: transparent;
  pointer-events: none;
}

[data-bs-theme="dark"] .crm-auth-page::before {
  background: transparent;
}

.crm-auth-shell {
  position: relative;
  width: min(100%, 560px);
}

.crm-auth-card {
  width: 100%;
  overflow: hidden;
  padding: 3.5rem 1.75rem !important;
  border: 1px solid rgba(83, 103, 132, 0.42);
  background: rgba(10, 18, 34, 0.92);
  box-shadow: none;
  position: relative;
  z-index: 1;
}

[data-bs-theme="light"] .crm-auth-page {
  background:
    radial-gradient(900px 400px at 50% 0%, rgba(245, 181, 68, 0.10), transparent 58%),
    linear-gradient(180deg, #f8fafc 0%, #eef3f9 100%);
}

[data-bs-theme="light"] .crm-auth-card {
  border-color: #d8e0ea;
  background: rgba(255, 255, 255, 0.95);
}

.crm-auth-logo-corner {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 2;
}

.crm-auth-logo-badge {
  width: 100%;
  max-width: 126px;
  background: transparent;
  border: 0;
  padding: 0;
  display: flex;
  justify-content: center;
}

.crm-auth-logo {
  max-width: 126px;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: none;
}

@media (max-width: 768px) {
  .crm-auth-page {
    min-height: 100dvh;
    padding: 0.8rem 0.9rem 1.25rem;
    display: grid;
    place-items: center;
    overflow-y: auto;
  }

  .crm-auth-logo-corner {
    position: fixed;
    left: 0.75rem;
    top: 0.75rem;
    width: fit-content;
    margin-bottom: 0;
  }

  .crm-auth-logo-badge {
    max-width: 112px;
  }

  .crm-auth-logo {
    max-width: 112px;
  }

  .crm-auth-shell {
    width: min(100% - 1.75rem, 420px);
    margin-top: 0;
    margin-inline: auto;
  }

  .crm-auth-logo-corner + .crm-auth-shell {
    margin-top: 0;
  }

  .crm-auth-card {
    padding: 3rem 1.5rem !important;
  }

  .crm-auth-copy {
    margin-bottom: 1.5rem !important;
  }

  .crm-auth-card h1 {
    font-size: 1.85rem;
  }

  .crm-auth-card p {
    font-size: 0.95rem;
  }

  .crm-auth-card form {
    gap: 0.9rem;
  }

  .crm-auth-card .form-label {
    font-size: 0.92rem;
  }

  .crm-auth-card .form-control {
    min-height: 50px;
    padding-inline: 1rem;
    font-size: 1rem;
  }
}

.crm-auth-card .alert {
  margin-bottom: 1rem;
}

.crm-auth-copy,
.crm-auth-card form,
.crm-auth-card .form-label,
.crm-auth-card .form-control {
  text-align: left;
}

.crm-auth-copy {
  width: 100%;
  max-width: 430px;
  margin-inline: auto;
}

.crm-auth-card h1 {
  margin: 0;
  color: #f8fafc;
  font-size: 1.85rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
  font-family: inherit;
}

.crm-auth-card p {
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.5;
}

[data-bs-theme="light"] .crm-auth-card h1 {
  color: #0f172a;
}

[data-bs-theme="light"] .crm-auth-card p {
  color: #475569;
}

.crm-auth-card form {
  width: 100%;
  max-width: min(100%, 430px);
  margin-inline: auto;
  display: grid;
  gap: 0.9rem;
}

.crm-auth-card form > div {
  display: grid;
  gap: 0.35rem;
}

.crm-auth-card .form-label {
  color: #d7deea;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.crm-auth-card .form-control {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: 50px;
  background: rgba(7, 13, 26, 0.96);
  border: 1px solid rgba(83, 103, 132, 0.42);
  color: #f8fafc;
  padding-inline: 1rem;
  box-shadow: none;
}

.crm-auth-card .form-control::placeholder {
  color: #8d99ab;
}

[data-bs-theme="dark"] .crm-auth-card .form-control {
  background: rgba(7, 13, 26, 0.96);
  border-color: rgba(83, 103, 132, 0.42);
  color: #f8fafc;
}

[data-bs-theme="light"] .crm-auth-card .form-label {
  color: #334155;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

[data-bs-theme="light"] .crm-auth-card .form-control {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

[data-bs-theme="light"] .crm-auth-card .form-control::placeholder {
  color: #94a3b8;
}

.crm-auth-card .btn {
  min-height: 46px;
  border: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.crm-auth-card .btn.btn-primary {
  background: var(--crm-accent);
  color: #0f172a;
  box-shadow: none;
  width: fit-content;
  min-width: 180px;
  padding-inline: 1.5rem;
  justify-self: start;
}

.crm-auth-card .btn.btn-primary:hover {
  background: #f2bf5e;
}

[data-bs-theme="dark"] .crm-auth-card .btn.btn-primary {
  color: #0f172a;
}

.crm-auth-card .btn.btn-primary {
  box-shadow: none !important;
}

.crm-btn-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  width: 1.45rem;
  height: 1rem;
  margin-right: 0.45rem;
  vertical-align: middle;
}

.crm-btn-loader span {
  width: 0.24rem;
  height: 0.24rem;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.45;
  animation: crm-btn-dot-pulse 0.9s infinite ease-in-out;
}

.crm-btn-loader span:nth-child(2) {
  animation-delay: 0.12s;
}

.crm-btn-loader span:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes crm-btn-dot-pulse {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-2px);
    opacity: 1;
  }
}

.toastify.crm-toast {
  border-radius: 0 !important;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22) !important;
  filter: none !important;
  padding: 0.55rem 0.75rem !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
  line-height: 1.25 !important;
  color: #ffffff !important;
  border: 1px solid #3b82f6 !important;
  backdrop-filter: blur(8px);
  background-image: none !important;
  min-height: 38px;
  min-width: 240px;
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  opacity: 1 !important;
  z-index: 20000 !important;
}

[data-bs-theme="light"] .toastify.crm-toast {
  background: #eff6ff !important;
  color: #0f172a !important;
  border-color: #3b82f6 !important;
  box-shadow: none !important;
}

[data-bs-theme="light"] .toastify.crm-toast .toastify-content,
[data-bs-theme="light"] .toastify.crm-toast .crm-toast-close {
  color: #0f172a !important;
}

.toastify.crm-toast--success {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
}

.toastify.crm-toast--error {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
}

.toastify.crm-toast .crm-toast-close {
  color: #ffffff !important;
  opacity: 1 !important;
  text-shadow: none !important;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  line-height: 1;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.toastify.crm-toast .crm-toast-close:hover {
  opacity: 0.85 !important;
}

.toastify.crm-toast .toastify-content {
  color: inherit !important;
}

.crm-auth-theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1030;
}

.crm-auth-page .form-control,
.crm-auth-page .input-group .btn {
  min-height: 44px;
}

@media (max-width: 768px) {
  .crm-auth-card .btn.btn-primary {
    width: fit-content;
    min-width: 180px;
  }
}

.password-requests-card {
  border: 1px solid rgba(128, 128, 128, 0.18);
}

.chart-row {
  align-items: stretch;
}

.chart-card {
  height: 100%;
  min-height: 420px;
  position: relative;
  overflow: hidden;
  background: #fffdf8;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.06);
}

[data-bs-theme="dark"] .chart-card {
  background: #141d19;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

.chart-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
}

.chart-card--donut {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chart-card--trend {
  display: flex;
  flex-direction: column;
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
}

.chart-canvas-wrap--donut {
  flex: 1;
  min-height: 320px;
  display: grid;
  place-items: center;
  padding: 0.25rem 0.25rem 0.5rem;
}

.chart-canvas-wrap--donut canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 300px;
}

.chart-canvas-wrap--trend {
  height: 330px;
}

.chart-canvas-wrap--trend canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
  position: relative;
  z-index: 1;
}

.chart-field--action {
  align-self: end;
}

.chart-range-wrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (max-width: 991.98px) {
  .chart-controls {
    grid-template-columns: 1fr 1fr;
  }

  .chart-range-wrap {
    grid-template-columns: 1fr;
  }

  .chart-canvas-wrap--trend {
    height: 280px;
  }
}

.chart-card > * {
  position: relative;
  z-index: 1;
}

.crm-shell {
  height: calc(100vh - var(--crm-header-height));
  overflow: hidden;
  gap: 0;
}

.crm-sidebar {
  width: 280px;
  height: 100%;
  overflow: hidden;
  flex: 0 0 280px;
  border-right: 1px solid #cbd5e1 !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
  transition: width 0.2s ease, padding 0.2s ease;
}

[data-bs-theme="dark"] .crm-sidebar {
  border-right: 1px solid var(--crm-border) !important;
  background: var(--crm-nav-bg) !important;
}

.crm-content {
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.4rem !important;
}

.crm-card {
  min-width: 0;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: var(--crm-radius) !important;
  box-shadow: 0 12px 30px rgba(2, 10, 28, 0.06);
}

[data-bs-theme="dark"] .crm-card {
  border: 1px solid #334155 !important;
  background: #111827 !important;
  color: #f8fafc !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none !important;
}

.nav-pills .nav-link {
  color: #1f2937;
  border: 1px solid #dbe4ee;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 10px !important;
  padding: 0.75rem 0.9rem;
  transition: all 0.18s ease;
}

.nav-pills .nav-link:hover {
  background: #f3f6fb;
  border-color: rgba(148, 163, 184, 0.24);
}

.nav-pills .nav-link.active {
  background: var(--crm-accent);
  color: var(--crm-accent-contrast);
  box-shadow: 0 6px 14px rgba(240, 180, 69, 0.35);
}

[data-bs-theme="dark"] .nav-pills .nav-link {
  color: #e5e7eb;
  border: 1px solid #334155;
  background: #0f172a;
}

[data-bs-theme="dark"] .nav-pills .nav-link.active {
  background: var(--crm-accent);
  color: var(--crm-accent-contrast);
  border-color: #f0b445;
}

.sidebar-logo-wrap {
  border-top: 1px solid rgba(30, 58, 52, 0.18);
  padding-top: 0.9rem;
  margin-top: 0.9rem;
  display: flex;
  justify-content: center;
}

[data-bs-theme="dark"] .sidebar-logo-wrap {
  border-top-color: rgba(214, 239, 228, 0.2);
}

.sidebar-logo-badge {
  width: 100%;
  max-width: 174px;
  background: transparent;
  /* border: 1px solid var(--crm-border); */
  border-radius: 12px;
  padding: 0.45rem 0.65rem;
  /* display: flex; */
  justify-content: center;
}

[data-bs-theme="light"] .sidebar-logo-badge {
  background: transparent;
}

[data-bs-theme="dark"] .sidebar-logo-badge {
  background: transparent;
  border-color: transparent;
}

.sidebar-logo-img {
  max-width: 160px;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(12, 28, 24, 0.18));
}

[data-bs-theme="light"] .sidebar-logo-img {
  mix-blend-mode: normal;
}

[data-bs-theme="dark"] .sidebar-logo-img {
  mix-blend-mode: normal;
}

.kpi-card {
  border: 1px solid #cbd5e1;
  border-radius: 12px !important;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

[data-bs-theme="dark"] .kpi-card {
  border: 1px solid #334155 !important;
  background: #0f172a !important;
}

.kpi-card p {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475467;
}

[data-bs-theme="dark"] .kpi-card p {
  color: #cbd5e1 !important;
}

.kpi-card h3 {
  margin: 0.4rem 0 0;
  font-weight: 800;
  letter-spacing: 0.01em;
}

[data-bs-theme="dark"] .kpi-card h3 {
  color: #f8fafc !important;
}

[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6 {
  color: #f8fafc !important;
}

.table,
.table th,
.table td {
  border-color: var(--crm-border) !important;
}

tbody, td, tfoot, th, thead, tr {
  border-color: inherit;
  border-style: solid;
  border-width: 1px;
}

.table > :not(caption) > * > * {
  background-color: transparent !important;
  box-shadow: none !important;
}

[data-bs-theme="dark"] .table,
[data-bs-theme="dark"] .table th,
[data-bs-theme="dark"] .table td {
  border-color: var(--crm-border) !important;
  background-color: transparent !important;
}

[data-bs-theme="dark"] .table > :not(caption) > * > * {
  background-color: transparent !important;
  box-shadow: none !important;
}

.table thead th {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: #0f172a;
  font-weight: 700;
}

[data-bs-theme="dark"] .table thead th {
  color: #f1f5f9 !important;
  background: #16213a !important;
  border-color: #334155 !important;
}

.table-responsive {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  border: 1px solid #cbd5e1;
}

.table-responsive::-webkit-scrollbar {
  display: block;
  height: 8px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.55);
}

.report-table {
  min-width: 1720px;
  table-layout: fixed;
  margin-bottom: 0;
}

.report-table.report-table--super {
  min-width: 1880px;
}

.report-table.report-table--no-action {
  min-width: 1600px;
}

.report-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff !important;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  text-align: center;
  vertical-align: middle;
  font-size: 0.72rem;
  line-height: 1.2;
  letter-spacing: 0.03em;
  padding: 0.58rem 0.45rem;
  font-weight: 700;
  border-bottom-width: 2px !important;
  min-height: 58px;
}

[data-bs-theme="dark"] .report-table thead th {
  background: #0f172a !important;
  color: #f8fafc !important;
}

[data-bs-theme="dark"] .table-responsive {
  border-color: #334155 !important;
}

.report-table td {
  vertical-align: top;
  padding: 0.28rem 0.4rem;
  font-size: 0.86rem;
  line-height: 1.15;
  word-break: normal;
  overflow-wrap: normal;
}

.report-table tbody tr:nth-child(odd) td {
  background: rgba(0, 0, 0, 0.02) !important;
}

[data-bs-theme="dark"] .report-table tbody tr:nth-child(odd) td {
  background: rgba(255, 255, 255, 0.03) !important;
}

.report-table tbody tr.overdue-row td {
  background: #ffe5e5 !important;
  color: #b00020 !important;
}

[data-bs-theme="dark"] .report-table tbody tr.overdue-row td {
  background: rgba(176, 0, 32, 0.25) !important;
  color: #ffd1d1 !important;
}

/* Column widths by position to keep layout stable even with dynamic HTML */
.report-table th:nth-child(1),
.report-table td:nth-child(1) { width: 40px; text-align: center; white-space: nowrap; }
.report-table th:nth-child(2),
.report-table td:nth-child(2) { width: 104px; white-space: nowrap; }
.report-table th:nth-child(3),
.report-table td:nth-child(3) { width: 140px; white-space: nowrap; }
.report-table th:nth-child(4),
.report-table td:nth-child(4) { width: 132px; white-space: nowrap; }
.report-table th:nth-child(5),
.report-table td:nth-child(5) { width: 122px; white-space: nowrap; }
.report-table th:nth-child(6),
.report-table td:nth-child(6) { width: 116px; white-space: nowrap; }
.report-table th:nth-child(7),
.report-table td:nth-child(7) { width: 170px; white-space: nowrap; }
.report-table th:nth-child(8),
.report-table td:nth-child(8) { width: 150px; white-space: nowrap; }
.report-table th:nth-child(9),
.report-table td:nth-child(9) { width: 150px; white-space: nowrap; }
.report-table th:nth-child(10),
.report-table td:nth-child(10) { width: 126px; white-space: nowrap; }
.report-table th:nth-child(11),
.report-table td:nth-child(11) { width: 108px; white-space: nowrap; }
.report-table th:nth-child(12),
.report-table td:nth-child(12) { width: 108px; white-space: nowrap; }
.report-table th:nth-child(13),
.report-table td:nth-child(13) {
  width: 190px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}
.report-table th:nth-child(14),
.report-table td:nth-child(14) {
  width: 150px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.report-table th:nth-child(15),
.report-table td:nth-child(15) { width: 104px; white-space: nowrap; }
.report-table th:nth-child(16),
.report-table td:nth-child(16) { width: 88px; white-space: nowrap; }
.report-table th:nth-child(17),
.report-table td:nth-child(17) { width: 100px; white-space: nowrap; }
.report-table th:nth-child(18),
.report-table td:nth-child(18) { width: 120px; white-space: nowrap; text-align: center; }

.report-table.report-table--super th:nth-child(1),
.report-table.report-table--super td:nth-child(1) { width: 36px; text-align: center; white-space: nowrap; }
.report-table.report-table--super th:nth-child(2),
.report-table.report-table--super td:nth-child(2) { width: 40px; text-align: center; white-space: nowrap; }
.report-table.report-table--super th:nth-child(3),
.report-table.report-table--super td:nth-child(3) { width: 120px; white-space: nowrap; }
.report-table.report-table--super th:nth-child(4),
.report-table.report-table--super td:nth-child(4) { width: 140px; white-space: nowrap; }
.report-table.report-table--super th:nth-child(5),
.report-table.report-table--super td:nth-child(5) { width: 122px; white-space: nowrap; }
.report-table.report-table--super th:nth-child(6),
.report-table.report-table--super td:nth-child(6) { width: 116px; white-space: nowrap; }
.report-table.report-table--super th:nth-child(7),
.report-table.report-table--super td:nth-child(7) { width: 170px; white-space: nowrap; }
.report-table.report-table--super th:nth-child(8),
.report-table.report-table--super td:nth-child(8) { width: 150px; white-space: nowrap; }
.report-table.report-table--super th:nth-child(9),
.report-table.report-table--super td:nth-child(9) { width: 150px; white-space: nowrap; }
.report-table.report-table--super th:nth-child(10),
.report-table.report-table--super td:nth-child(10) { width: 126px; white-space: nowrap; }
.report-table.report-table--super th:nth-child(11),
.report-table.report-table--super td:nth-child(11) { width: 108px; white-space: nowrap; }
.report-table.report-table--super th:nth-child(12),
.report-table.report-table--super td:nth-child(12) { width: 108px; white-space: nowrap; }
.report-table.report-table--super th:nth-child(13),
.report-table.report-table--super td:nth-child(13) {
  width: 190px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}
.report-table.report-table--super th:nth-child(14),
.report-table.report-table--super td:nth-child(14) { width: 150px; white-space: normal; overflow-wrap: anywhere; }
.report-table.report-table--super th:nth-child(15),
.report-table.report-table--super td:nth-child(15) { width: 104px; white-space: nowrap; }
.report-table.report-table--super th:nth-child(16),
.report-table.report-table--super td:nth-child(16) { width: 92px; white-space: nowrap; }
.report-table.report-table--super th:nth-child(17),
.report-table.report-table--super td:nth-child(17) { width: 100px; white-space: nowrap; }
.report-table.report-table--super th:nth-child(18),
.report-table.report-table--super td:nth-child(18) { width: 108px; white-space: nowrap; }
.report-table.report-table--super th:nth-child(19),
.report-table.report-table--super td:nth-child(19) { width: 120px; white-space: nowrap; text-align: center; }

.report-table .btn {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  line-height: 1;
  border-radius: 999px;
  min-height: 28px;
  min-width: 74px;
  box-shadow: none;
}

.report-table td:last-child {
  white-space: nowrap;
  min-width: 120px;
  text-align: center;
}

.report-table.report-table--no-action td:last-child,
.report-table.report-table--no-action th:last-child {
  min-width: 92px;
  width: 92px;
  text-align: center;
}

.report-table td:last-child .btn {
  margin-right: 0.4rem;
  margin-bottom: 0;
}

.report-table td:last-child .btn:last-child {
  margin-right: 0;
}

.report-table td:last-child .entry-edit-btn {
  margin-bottom: 0.2rem;
}

.report-pdf-link,
.report-no-pdf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  line-height: 1.1;
  white-space: nowrap;
}

.report-pdf-link {
  background: rgba(13, 110, 253, 0.12);
  color: #0d6efd;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid rgba(13, 110, 253, 0.18);
}

.report-pdf-link:hover {
  background: rgba(13, 110, 253, 0.18);
  color: #084298;
}

[data-bs-theme="dark"] .report-pdf-link {
  background: rgba(96, 165, 250, 0.14);
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, 0.22);
}

[data-bs-theme="dark"] .report-pdf-link:hover {
  background: rgba(96, 165, 250, 0.22);
  color: #eff6ff;
}

.report-no-pdf {
  background: rgba(100, 116, 139, 0.14);
  color: #64748b;
  border: 1px solid rgba(100, 116, 139, 0.18);
}

[data-bs-theme="dark"] .report-no-pdf {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.18);
}

/* Keep report columns readable across different report categories */
.report-table td,
.report-table.report-table--super td {
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}

.report-table th,
.report-table.report-table--super th {
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: normal;
  vertical-align: middle;
}

.tab-panel {
  display: none;
  min-width: 0;
}

.tab-panel.active {
  display: block;
}

.form-control,
.form-select {
  border: 1px solid #94a3b8;
  box-shadow: none !important;
  background: #fff;
  color: #111827;
  border-radius: 10px !important;
}

.form-control::placeholder {
  color: #667085;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  border: 1px solid #475569 !important;
  background: #0b1220 !important;
  color: #f8fafc !important;
}

[data-bs-theme="dark"] .form-control::placeholder {
  color: #cbd5e1;
}

.modal-content {
  border: 1px solid #d6d9df;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 44px rgba(18, 28, 45, 0.18);
  overflow: hidden;
}

[data-bs-theme="dark"] .modal-content {
  border: 1px solid #424b57;
  background: #12161d;
  color: #f5f5f5;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.42);
}

.modal-square .modal-content {
  min-height: auto;
}

.modal-form-stack .col-12 {
  display: block;
}

.modal-header,
.modal-footer {
  border-color: #dfe4ed;
  padding: 0.9rem 1.2rem;
  background: rgba(248, 250, 255, 0.85);
}

.modal-body {
  padding: 1.1rem 1.2rem 1.2rem;
  background: #fff;
}

[data-bs-theme="dark"] .modal-body {
  background: #12161d;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.modal .btn-close {
  transform: scale(0.9);
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
  border-color: #424b57;
  background: rgba(33, 38, 46, 0.8);
}

[data-bs-theme="dark"] .modal .btn-close {
  filter: invert(1) grayscale(1) brightness(1.2);
}

.modal .form-control,
.modal .form-select {
  border-radius: 10px;
  min-height: 46px;
  border-color: #ccd4df;
  background: #fff;
}

.modal .form-control:focus,
.modal .form-select:focus {
  border-color: #1f2a3d;
  box-shadow: 0 0 0 0.2rem rgba(31, 42, 61, 0.16) !important;
}

[data-bs-theme="dark"] .modal .form-control,
[data-bs-theme="dark"] .modal .form-select {
  border-color: #4b5563;
  background: #12161d;
}

[data-bs-theme="dark"] .modal .form-control:focus,
[data-bs-theme="dark"] .modal .form-select:focus {
  border-color: #d6dde8;
  box-shadow: 0 0 0 0.2rem rgba(214, 221, 232, 0.2) !important;
}

.modal-backdrop.show {
  opacity: 0.5;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

body.modal-open .crm-shell,
body.modal-open header.sticky-top {
  filter: blur(4px);
  transition: filter 0.18s ease;
}

.modal .modal-form-stack {
  margin-top: 0.25rem !important;
  row-gap: 0.65rem !important;
}

.modal .modal-form-stack .btn-primary,
.modal .modal-form-stack .btn-outline-secondary {
  min-height: 46px;
  border-radius: 0 !important;
  box-shadow: none !important;
  font-weight: 600;
}

[data-bs-theme="light"] .modal .modal-form-stack .btn-primary,
[data-bs-theme="light"] .modal .modal-form-stack .btn-outline-secondary {
  border-color: #3b82f6 !important;
}

[data-bs-theme="light"] .modal .modal-form-stack .btn-outline-secondary {
  color: #1d4ed8;
  background: #ffffff;
}

[data-bs-theme="light"] .modal .modal-form-stack .btn-outline-secondary:hover,
[data-bs-theme="light"] .modal .modal-form-stack .btn-outline-secondary:focus {
  color: #ffffff;
  background: #3b82f6;
  border-color: #3b82f6 !important;
}

#userModal .modal-dialog,
#dealershipModal .modal-dialog {
  max-width: 580px;
}

@media (max-width: 576px) {
  .modal-dialog {
    margin: 0.7rem;
  }

  .modal-square .modal-content {
    min-height: auto;
  }

  .modal-header,
  .modal-footer,
  .modal-body {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .modal .modal-form-stack .col-12.d-flex {
    flex-direction: column;
  }

  .modal .modal-form-stack .col-12.d-flex .btn {
    width: 100%;
  }
}

.btn {
  border-radius: 0 !important;
  box-shadow: none !important;
}

.btn-primary {
  background: var(--crm-accent);
  border-color: var(--crm-accent);
  color: var(--crm-accent-contrast);
}

.btn-primary:hover {
  background: var(--crm-accent-hover);
  border-color: var(--crm-accent-hover);
  color: var(--crm-accent-contrast);
}

[data-bs-theme="dark"] .btn-primary {
  background: var(--crm-accent);
  border-color: var(--crm-accent);
  color: var(--crm-accent-contrast);
}

.btn-outline-primary {
  color: var(--crm-accent-contrast);
  border-color: var(--crm-border);
  background: var(--crm-surface-soft);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  color: var(--crm-accent-contrast);
  background: var(--crm-accent);
  border-color: var(--crm-accent);
}

.btn-outline-secondary {
  color: #1f2937;
  border-color: #94a3b8;
  background: #fff;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  color: #fff;
  background: #374151;
  border-color: #374151;
}

.btn-outline-danger {
  color: #9f1d1d;
  border-color: #9f1d1d;
  background: #fff;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
  color: #fff;
  background: #9f1d1d;
  border-color: #9f1d1d;
}

#entryForm.entry-form-grid {
  padding: 0.9rem;
  border: 1px solid #d8e0ea;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 75%);
}

#entryForm.entry-form-grid .form-label {
  color: #334155;
  font-weight: 600;
}

#entryForm.entry-form-grid .form-control,
#entryForm.entry-form-grid .form-select {
  min-height: 44px;
  border-radius: 10px;
  border-color: #cbd5e1;
}

#entryForm.entry-form-grid .form-control:focus,
#entryForm.entry-form-grid .form-select:focus {
  border-color: #1f2a3d;
  box-shadow: 0 0 0 0.2rem rgba(31, 42, 61, 0.12) !important;
}

[data-bs-theme="dark"] #entryForm.entry-form-grid {
  border-color: #3f4b5a;
  background: linear-gradient(180deg, #17202c 0%, #111827 75%);
}

[data-bs-theme="dark"] #entryForm.entry-form-grid .form-label {
  color: #cbd5e1;
}

#entryForm.entry-form-grid .entry-form-actions .btn {
  min-width: 170px;
}

@media (max-width: 767.98px) {
  #entryForm.entry-form-grid .entry-form-actions .btn {
    width: 100%;
    min-width: 0;
  }
}

[data-bs-theme="dark"] .btn-outline-primary {
  color: #ffe0b4;
  border-color: var(--crm-border);
  background: transparent;
}

[data-bs-theme="dark"] .btn-outline-primary:hover,
[data-bs-theme="dark"] .btn-outline-primary:focus {
  color: var(--crm-accent-contrast);
  background: var(--crm-accent);
  border-color: var(--crm-accent);
}

[data-bs-theme="dark"] .btn-outline-secondary {
  color: #e5e7eb;
  border-color: #64748b;
  background: #111827;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover,
[data-bs-theme="dark"] .btn-outline-secondary:focus {
  color: #111827;
  background: #e5e7eb;
  border-color: #e5e7eb;
}

[data-bs-theme="dark"] .btn-outline-danger {
  color: #ff8d8d;
  border-color: #ff8d8d;
  background: transparent;
}

[data-bs-theme="dark"] .btn-outline-danger:hover,
[data-bs-theme="dark"] .btn-outline-danger:focus {
  color: #141d19;
  background: #ff8d8d;
  border-color: #ff8d8d;
}

#themeToggleTop.theme-toggle-flat {
  --theme-toggle-bg: var(--crm-surface-soft);
  --theme-toggle-fg: var(--crm-accent-contrast);
  border: 1px solid var(--crm-border);
  background: var(--theme-toggle-bg);
  color: var(--theme-toggle-fg);
  min-width: 126px;
  height: 38px;
  font-weight: 600;
  letter-spacing: 0;
  padding: 0 0.95rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 999px !important;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}

#themeToggleTop.theme-toggle-flat:hover {
  transform: translateY(-1px);
}

[data-bs-theme="dark"] #themeToggleTop.theme-toggle-flat {
  --theme-toggle-bg: #f0b445;
  --theme-toggle-fg: #0f172a;
  border: 1px solid #f0b445;
  background: var(--theme-toggle-bg);
  color: var(--theme-toggle-fg);
}

[data-bs-theme="dark"] #themeToggleTop.theme-toggle-flat:hover {
  transform: translateY(-1px);
}

.theme-icon {
  line-height: 1;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
}

.theme-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.icon-only-btn {
  min-width: 42px !important;
  width: 42px;
  height: 42px;
  padding: 0 !important;
  border-radius: 12px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

#sidebarCollapseBtn.icon-only-btn {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--crm-border);
  color: var(--crm-text);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
}

#sidebarCollapseBtn.icon-only-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.14);
}

#sidebarCollapseBtn.icon-only-btn:active {
  transform: translateY(0);
}

[data-bs-theme="dark"] #sidebarCollapseBtn.icon-only-btn {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.8));
  color: #f8fafc;
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

[data-bs-theme="dark"] #sidebarCollapseBtn.icon-only-btn:hover {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #b42318;
  color: #fff;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  border: 1px solid #fff;
}

[data-bs-theme="dark"] .notification-badge {
  border-color: #141d19;
}

.notification-menu {
  width: min(92vw, 360px);
  border: 1px solid #141d19;
}

[data-bs-theme="dark"] .notification-menu {
  border-color: #e5e5e5;
  background: #141d19;
  color: #f5f5f5;
}

.notification-list {
  max-height: 340px;
  overflow-y: auto;
}

.notification-item {
  border-bottom: 1px solid #e5e5e5;
  padding: 0.6rem 0.8rem;
}

[data-bs-theme="dark"] .notification-item {
  border-bottom-color: #2e2e2e;
}

.sidebar-icon {
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex: 0 0 20px;
}

.sidebar-label {
  white-space: nowrap;
}

.crm-shell.sidebar-collapsed .crm-sidebar {
  width: 88px;
  flex-basis: 88px;
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
}

.crm-shell.sidebar-collapsed .crm-sidebar .sidebar-label {
  display: none;
}

.crm-shell.sidebar-collapsed .crm-sidebar .nav-link {
  position: relative;
}

.crm-shell.sidebar-collapsed .crm-sidebar .nav-pills .nav-link {
  justify-content: center;
  gap: 0;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  min-height: 40px;
}

.crm-shell.sidebar-collapsed .crm-sidebar .sidebar-logo-wrap {
  padding-top: 0.7rem;
  margin-top: 0.7rem;
}

.crm-shell.sidebar-collapsed .crm-sidebar .sidebar-logo-badge {
  max-width: 56px;
  width: 56px;
  padding: 0.25rem;
  border-radius: 8px !important;
}

.crm-shell.sidebar-collapsed .crm-sidebar .sidebar-logo-img {
  max-width: 48px;
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.profile-badge {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 1px solid #d4a231;
  border-radius: 9px !important;
  background: #f0b445;
  color: #1d4ed8;
  box-shadow: none !important;
}

.crm-shell.sidebar-collapsed .crm-content {
  width: calc(100% - 88px);
}

[data-bs-theme="dark"] .profile-badge {
  border-color: #d4a231;
  background: #f0b445;
  color: #1d4ed8;
}

[data-bs-theme="dark"] header.sticky-top.bg-body {
  background-color: #0b1220 !important;
  border-bottom: 1px solid #334155 !important;
}

[data-bs-theme="dark"] .crm-sidebar {
  border-right: 1px solid #334155 !important;
  background: #0b1220 !important;
}

/* Flat UI mode: no box shadows */
header.sticky-top.bg-body,
.chart-card,
[data-bs-theme="dark"] .chart-card,
.crm-card,
[data-bs-theme="dark"] .crm-card,
.nav-pills .nav-link.active,
.modal-content,
[data-bs-theme="dark"] .modal-content,
#themeToggleTop.theme-toggle-flat,
.profile-badge,
.theme-toggle-flat,
.btn {
  box-shadow: none !important;
}

.sidebar-logo-img {
  filter: none !important;
}

@media (max-width: 991.98px) {
  body {
    overflow: auto;
  }

  header.sticky-top.bg-body {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1040;
  }

  :root {
    --crm-header-height: 112px;
  }

  header.sticky-top.bg-body .container-fluid {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  header.sticky-top.bg-body .container-fluid > .d-flex:last-child {
    width: 100%;
    justify-content: flex-end;
  }

  #themeToggleTop.theme-toggle-flat {
    min-width: 108px;
    height: 36px;
    padding: 0 0.75rem;
  }

  .crm-content {
    padding: 1rem !important;
  }

  .crm-shell {
    display: block !important;
    height: auto;
    overflow: visible;
    margin-top: var(--crm-header-height);
  }

  .crm-content {
    padding-top: 1rem !important;
    height: auto;
    overflow: visible;
  }

  .kpi-card p {
    font-size: 0.72rem;
  }

  .kpi-card h3 {
    font-size: 1.35rem;
  }

  .chart-controls {
    grid-template-columns: 1fr 1fr;
  }

  .chart-range-wrap {
    grid-template-columns: 1fr;
  }
}
.expiry-green { background-color: rgba(25, 135, 84, 0.18) !important; }
.expiry-orange { background-color: rgba(255, 153, 0, 0.2) !important; }
.expiry-red { background-color: rgba(220, 53, 69, 0.2) !important; }

.report-builder-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.02), rgba(15, 23, 42, 0.01));
}

.report-builder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.report-count-pill {
  border: 1px solid var(--crm-border);
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  white-space: nowrap;
  background: var(--crm-surface-soft);
  color: #0f172a;
}

[data-bs-theme="dark"] .report-count-pill {
  border-color: var(--crm-border);
  background: #0f172a;
  color: #f8fafc;
}

.report-builder-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.report-field {
  min-width: 0;
}

.report-range-wrap {
  grid-column: span 1;
}

.report-range-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.report-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.report-actions .btn {
  min-width: 132px;
  padding-inline: 1.1rem;
}

#refreshEntriesBtn {
  margin-top: 0.35rem;
}

#deleteSelectedEntriesBtn {
  margin-top: 0.35rem;
}

.workflow-step {
  border: 1px solid #141d19;
  background: #fff;
}

[data-bs-theme="dark"] .workflow-step {
  border-color: #e5e5e5;
  background: #141d19;
}

.workflow-kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475467;
  font-weight: 700;
}

[data-bs-theme="dark"] .workflow-kicker {
  color: #cbd5e1;
}

.users-table-scroll {
  max-height: 360px;
  overflow-y: auto;
}

.bulk-col {
  width: 34px;
  text-align: center;
}

.users-table-scroll table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff !important;
}

[data-bs-theme="dark"] .users-table-scroll table thead th {
  background: #16213a !important;
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .users-table-scroll table thead th input[type="checkbox"] {
  accent-color: #7dd3fc;
  filter: brightness(1.2);
}

[data-bs-theme="dark"] .table thead th input[type="checkbox"] {
  accent-color: #7dd3fc;
  filter: brightness(1.2);
}

@media (max-width: 991.98px) {
  .report-builder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-range-wrap {
    grid-column: span 2;
  }
}

@media (max-width: 575.98px) {
  .crm-content {
    padding: 0.85rem !important;
  }

  .crm-card {
    border-radius: 10px !important;
  }

  header.sticky-top.bg-body .container-fluid > .d-flex:first-of-type {
    width: 100%;
    justify-content: flex-start;
  }

  header.sticky-top.bg-body .container-fluid > .d-flex:last-child {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .profile-badge {
    width: 28px;
    height: 28px;
  }

  #themeToggleTop.theme-toggle-flat,
  .icon-only-btn {
    width: 100%;
    min-width: 0 !important;
  }

  .report-builder-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .report-builder-grid {
    grid-template-columns: 1fr;
  }

  .report-range-wrap {
    grid-column: span 1;
  }

  .report-range-grid {
    grid-template-columns: 1fr;
  }

  .report-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .table-responsive {
    border-radius: 10px;
  }

  .report-table {
    min-width: 1400px;
  }

  .report-table.report-table--super {
    min-width: 1540px;
  }

  .report-table .btn {
    min-height: 32px;
    min-width: 64px;
    font-size: 0.74rem;
    padding: 0.34rem 0.65rem;
  }

  .chart-controls {
    grid-template-columns: 1fr;
  }

  .chart-field--action {
    margin-top: 0.25rem;
  }

  .kpi-card {
    padding: 0.85rem !important;
  }

  .kpi-card h3 {
    font-size: 1.2rem;
  }

  .kpi-card p {
    font-size: 0.68rem;
  }
}

@media (max-width: 767.98px) {
  body {
    overflow-x: hidden;
  }

  header.sticky-top.bg-body {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1040;
  }

  :root {
    --crm-header-height: 116px;
  }

  header.sticky-top.bg-body .container-fluid {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center !important;
    gap: 0.65rem;
    padding: 0.75rem !important;
  }

  header.sticky-top.bg-body .container-fluid > .btn[data-bs-target="#mobileSidebar"] {
    width: auto;
    min-height: 38px;
    grid-column: 1;
    grid-row: 1;
  }

  header.sticky-top.bg-body .container-fluid > .d-flex:first-of-type {
    width: auto;
    min-width: 0;
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-start;
  }

  #profileNameTop,
  #profileEmailTop {
    max-width: 58vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  header.sticky-top.bg-body .container-fluid > .d-flex:last-child {
    width: 100%;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: space-between;
  }

  .crm-shell {
    width: 100%;
    min-height: calc(100dvh - var(--crm-header-height));
    margin-top: var(--crm-header-height);
    display: flex !important;
    justify-content: center;
  }

  .crm-content {
    width: min(100%, 760px);
    max-width: 100vw;
    margin-inline: auto;
    padding: 0.9rem !important;
  }

  .crm-content > .tab-panel.crm-card,
  .tab-panel > .crm-card,
  .followups-panel,
  .report-builder-card {
    width: 100%;
    margin-inline: auto;
    padding: 1rem !important;
  }

  .tab-panel.active {
    width: 100%;
  }

  .tab-panel > .crm-card:first-child {
    text-align: center;
  }

  .tab-panel > .crm-card:first-child .d-flex {
    justify-content: center !important;
  }

  #kpiCards {
    justify-content: center;
  }

  #kpiCards > [class*="col-"],
  .role-superadmin-only .row > [class*="col-"] {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .tab-panel .d-flex.justify-content-between.align-items-center {
    align-items: flex-start !important;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .tab-panel .d-flex.gap-2 {
    flex-wrap: wrap;
  }

  .tab-panel .d-flex.gap-2 > .btn,
  .tab-panel .d-flex.justify-content-between.align-items-center > .btn,
  .tab-panel .d-flex.justify-content-between.align-items-center > .d-flex {
    width: 100%;
  }

  .tab-panel .d-flex.justify-content-between.align-items-center > .d-flex .btn {
    flex: 1 1 140px;
  }

  #entryForm.entry-form-grid {
    margin-inline: 0;
    padding: 0.75rem;
  }

  .chart-card {
    min-height: auto;
    padding: 1rem !important;
  }

  .chart-canvas-wrap--donut {
    min-height: 230px;
  }

  .chart-canvas-wrap--trend {
    height: 240px;
  }

  .offcanvas {
    max-width: min(86vw, 320px);
  }

  .modal-dialog {
    max-width: calc(100vw - 1.25rem);
  }
}

@media (max-width: 575.98px) {
  .crm-auth-page {
    min-height: 100dvh;
    padding: 0.7rem 0.75rem 1rem;
    overflow-y: auto;
  }

  .crm-auth-shell {
    width: min(100% - 1.5rem, 390px);
    margin-inline: auto;
  }

  .crm-auth-card {
    padding: 2.5rem 1.25rem !important;
  }

  .crm-auth-card h1 {
    font-size: 1.75rem;
  }

  .crm-auth-logo-badge,
  .crm-auth-logo {
    max-width: 104px;
  }

  .crm-auth-logo-corner {
    margin-bottom: 0;
  }

  .crm-auth-theme-toggle {
    right: 0.75rem;
    top: 0.75rem;
  }

  #themeToggleTop.theme-toggle-flat,
  .icon-only-btn {
    flex: 1 1 0;
    width: auto;
  }

  .crm-content > .tab-panel.crm-card,
  .tab-panel > .crm-card,
  .followups-panel,
  .report-builder-card {
    width: 100%;
    margin-inline: auto;
    padding: 0.85rem !important;
  }

  .crm-shell {
    align-items: flex-start;
  }

  .crm-content {
    width: 100%;
    padding: 0.7rem !important;
  }

  #kpiCards > [class*="col-"],
  .role-superadmin-only .row > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .report-count-pill {
    width: 100%;
    text-align: center;
  }

  .followups-panel #followupForm .btn,
  #backupNowBtn {
    width: 100%;
  }
}

/* Follow-up notes module */
.followups-panel {
  background: #fff;
}

[data-bs-theme="dark"] .followups-panel {
  background: #141d19;
}

.followups-panel #followupForm {
  padding: 0.75rem;
  border: 1px solid #141d19;
  background: rgba(0, 0, 0, 0.02);
}

[data-bs-theme="dark"] .followups-panel #followupForm {
  border-color: #d6d6d6;
  background: rgba(255, 255, 255, 0.04);
}

.followups-table-wrap {
  border: 1px solid #141d19;
}

[data-bs-theme="dark"] .followups-table-wrap {
  border-color: #d6d6d6;
}

.followups-table {
  min-width: 1080px;
  margin-bottom: 0;
}

.followups-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff !important;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: #0f172a;
  font-weight: 700;
}

[data-bs-theme="dark"] .followups-table thead th {
  background: #0f172a !important;
  color: #f8fafc !important;
}

.followups-table td {
  vertical-align: middle;
}

.followups-table td:nth-child(3) input {
  min-width: 280px;
}

.followups-table td:last-child .btn {
  min-width: 70px;
}

/* Square corners throughout the static site */
button,
.btn,
.card,
.crm-card,
.crm-auth-page .crm-auth-card,
.crm-auth-page .crm-card,
.form-control,
.form-select,
.alert,
.modal-content,
.modal-header,
.modal-footer,
.nav-pills .nav-link,
.badge,
.profile-badge,
.theme-toggle-flat,
.crm-auth-logo-badge,
.sidebar-logo-badge,
.kpi-card,
.chart-card,
.dropdown-menu,
.input-group .btn,
.list-group-item,
.pagination,
.page-link,
.accordion-item,
.accordion-button,
.offcanvas,
.popover,
.toast,
.toastify,
.table,
.table-responsive,
.input-group-text,
.crm-sidebar {
  border-radius: 0 !important;
}

#themeToggleTop.crm-auth-theme-toggle {
  border-radius: 0 !important;
}

#themeToggleTop.theme-toggle-flat {
  border-radius: 0 !important;
}
