:root {
  /* ═══════════════════════════════════════════════════════════
     SAFITRACK DESIGN SYSTEM v2 — Attio-grade cohesion
     Every token below is implementation-ready.
     ═══════════════════════════════════════════════════════════ */

  /* ── Colors ── */
  --color-primary: #2f5fd0;
  --color-primary-rgb: 47, 95, 208;
  --color-primary-dark: #2550b5;
  --color-primary-light: #6b93e8;
  --color-primary-bg: rgba(47, 95, 208, 0.08);
  --color-primary-bg-hover: rgba(47, 95, 208, 0.12);

  --color-success: #16a34a;
  --color-success-rgb: 22, 163, 74;
  --color-success-bg: rgba(22, 163, 74, 0.08);
  --color-warning: #ca8a04;
  --color-warning-rgb: 202, 138, 4;
  --color-warning-bg: rgba(202, 138, 4, 0.08);
  --color-danger: #dc2626;
  --color-danger-rgb: 220, 38, 38;
  --color-danger-bg: rgba(220, 38, 38, 0.08);

  /* ── Backgrounds — very subtle layering like Attio ── */
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f3f5;
  --bg-elevated: #ffffff;
  --bg-gray: #e9ecef;
  --bg-hover: rgba(0, 0, 0, 0.03);
  --bg-active: rgba(0, 0, 0, 0.05);

  /* ── Text — clear 3-level hierarchy ── */
  --text-primary: #0d0f11;
  --text-secondary: #3d4249;
  --text-muted: #6e7681;
  --text-inverse: #ffffff;

  /* ── Borders — subtle, low-contrast ── */
  --border-color: #dee2e6;
  --border-color-light: #f1f3f5;

  /* ── Shadows — extremely subtle, Attio-style ── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.10);

  /* ── Layout ── */
  --header-height: 52px;
  --sidebar-width: 220px;
  --bottom-nav-height: 64px;
  --content-max-width: 1200px;

  /* ── Border Radius — tight, consistent like Attio ── */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* ── Spacing — strict 4px grid ── */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;

  /* ── Control heights — THE unifying constant ── */
  --control-height-xs: 24px;
  --control-height-sm: 28px;
  --control-height-md: 30px;
  --control-height-lg: 36px;
  --icon-xs: 12px;
  --icon-sm: 14px;
  --icon-md: 16px;
  --icon-lg: 18px;

  /* ── Button tokens ── */
  --btn-radius: 8px;
  --btn-font-size: 0.875rem;
  --btn-font-weight: 550;

  /* ── Transitions — fast, professional ── */
  --transition-fast: 100ms ease;
  --transition-base: 150ms ease;
  --transition-slow: 250ms ease;
  --motion-ease-standard: cubic-bezier(0.25, 0.1, 0.25, 1);
  --motion-ease-emphasized: cubic-bezier(0.16, 1, 0.3, 1);
  --motion-distance-press: 1px;
  --motion-distance-hover: 0px;

  /* ── Z-index layers ── */
  --z-dropdown: 1000;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 1000;
  --z-modal: 1100;
  --z-toast: 100000;
  --z-loading: 1300;
  --z-header: 800;
}

/* AI Generate Button - visual equivalent of Tailwind utilities provided */
.ai-generate-btn {
  position: absolute;
  right: 8px;
  top: -6px;
  /* slightly lower so it's closer to the input */
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 36px;
  min-width: 160px;
  max-width: 220px;
  padding: 8px 14px;
  background: linear-gradient(90deg, var(--color-primary) 0%, #7c3aed 55%, #fb7185 100%);
  color: var(--text-inverse);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--btn-radius);
  font-weight: var(--btn-font-weight);
  font-size: var(--btn-font-size);
  font-family: inherit;
  text-align: left;
  padding-left: 14px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(47, 95, 208, 0.10);
  transition: transform 200ms var(--motion-ease-standard), box-shadow 260ms var(--motion-ease-emphasized), filter 200ms ease;
  z-index: 8;
}

/* =========================
   Settings module — Redesigned (Senior v2)
   Purpose: stronger hierarchy, clearer affordances, 8px spacing system
   ========================= */

/* Spacing and type tokens (unified with design system) */
:root {
  --s-1: 8px;
  --s-2: 16px;
  --s-3: 24px;
  --s-4: 32px;
  --s-5: 40px;
  --s-6: 56px;

  /* ── Typography scale — compact, professional ── */
  --type-xxs: 0.6875rem;   /* 11px */
  --type-xs: 0.75rem;      /* 12px */
  --type-sm: 0.8125rem;    /* 13px */
  --type-md: 0.875rem;     /* 14px */
  --type-lg: 1rem;         /* 16px */
  --type-xl: 1.125rem;     /* 18px */
  --type-xxl: 1.25rem;     /* 20px */

  --card-radius: var(--radius-md);
  --card-border: 1px solid var(--border-color);
  --card-elevation: var(--shadow-xs);
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-3);
  padding-bottom: var(--s-1);
  border-bottom: 1px solid var(--border-color-light);
}

.settings-header>div:first-child {
  max-width: 68%;
}

.settings-title {
  font-size: var(--type-xxl);
  margin: 0;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.settings-sub {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
  font-size: var(--type-sm);
  line-height: 1.4;
}

.settings-header-actions {
  display: flex;
  gap: var(--s-2);
  align-items: center
}

/* Actions — make primary prominent, cancel subtle */
.settings-header-actions .btn {
  border-radius: var(--btn-radius);
  padding: 0 var(--space-3);
  font-weight: 550;
}

.settings-header-actions .btn.btn-primary {
  transform: translateY(0);
  transition: background var(--transition-fast);
}

.settings-header-actions .btn.btn-primary:active {
  transform: translateY(1px);
}

.settings-header-actions .btn.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.settings-layout {
  display: flex;
  gap: var(--s-4);
  align-items: flex-start;
  max-width: var(--content-max-width);
  margin: 0 auto
}

/* Navigation — compact vertical rail with clear active affordance */
.settings-nav {
  width: 220px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}



.settings-nav .nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 6px;
  background: transparent;
  transition: background 180ms ease
}

.settings-nav .nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: none;
}

.settings-nav .nav-item.active {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

.settings-nav .nav-item.active::before {
  background: var(--color-primary);
}

.settings-nav .nav-item.danger {
  color: var(--color-danger);
  font-weight: 600;
}

.settings-content {
  flex: 1;
  min-width: 380px
}

/* Card — more breathing room, clearer header */
.section-card {
  background: var(--bg-secondary);
  border-radius: var(--card-radius);
  border: var(--card-border);
  overflow: hidden;
}

.section-card+.section-card {
  margin-top: var(--s-3)
}

.section-card-header {
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--border-color-light);
  display: flex;
  align-items: center;
  justify-content: space-between
}

.section-title {
  margin: 0;
  font-size: var(--type-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.section-sub {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: var(--type-sm)
}

.section-card-body {
  padding: var(--s-3)
}

/* Form grid tuned to 8px system */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-2)
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px
}

.form-field label {
  font-weight: 700;
  color: var(--text-secondary);
  font-size: var(--type-sm)
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field select {
  height: calc(var(--control-height-lg) + 2px);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: none;
  font-size: var(--type-md)
}

/* Small input variant */
.input-small,
select.input-small {
  box-sizing: border-box;
  height: var(--control-height-md);
  padding: 0 var(--space-3);
  line-height: 1.2;
  font-size: var(--type-md);
  border-radius: var(--btn-radius);
}

/* Override for select inputs that need explicit height */
select.input-small,
#safifind-filter {
  height: var(--control-height-md) !important;
  min-height: var(--control-height-md);
  line-height: var(--control-height-md) !important;
  padding: 0 var(--space-3) !important;
  font-size: var(--type-md) !important;
  box-sizing: border-box !important;
  vertical-align: middle;
}

/* Auth visual left-side brand — use transparentMain but render it white */
.auth-visual-side .visual-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-visual-side .visual-logo {
  width: 200px;
  height: auto;
  filter: brightness(0) invert(1);
  -webkit-filter: brightness(0) invert(1);
}

.auth-visual-side .visual-logo-white {
  /* ensure the image blends well on darker backgrounds */
  mix-blend-mode: screen;
}

/* Main app header brand logo - theme-aware colors */
.header-brand img,
.app-header .header-brand img {
  width: 130px;
  height: auto;
  transition: filter 180ms var(--motion-ease-standard), -webkit-filter 180ms var(--motion-ease-standard);
}

/* Dark mode: render logo white */
html[data-theme="dark"] .header-brand img {
  /* Use grayscale + brightness so the logo becomes neutral (avoid color inversion artifacts)
     Adjust brightness to sit closer to the text tone */
  filter: grayscale(1) brightness(2) contrast(0.95);
  -webkit-filter: grayscale(1) brightness(2) contrast(0.95);
  opacity: 0.95;
}

/* Light mode: render logo darker but not fully saturated black */
html[data-theme="light"] .header-brand img {
  /* Slightly reduce brightness to soften the logo in light mode */
  filter: grayscale(1) brightness(0.75) contrast(0.95);
  -webkit-filter: grayscale(1) brightness(0.75) contrast(0.95);
  opacity: 0.95;
}

.form-field input[disabled] {
  opacity: 0.8
}

.radio-row {
  display: flex;
  gap: 12px;
  align-items: center
}

.radio-row label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: var(--type-sm)
}

/* Segmented control — pill track with inner knob feel, keyboard accessible */
.segmented-control {
  display: inline-flex;
  background: transparent;
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  background: linear-gradient(180deg, var(--bg-secondary), transparent);
  border: 1px solid var(--border-color-light)
}

.segmented-control .seg-btn {
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: none;
  font-weight: 550;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--type-sm);
}

.segmented-control .seg-btn.seg-active {
  background: var(--color-primary);
  color: var(--text-inverse);
}

.seg-hint {
  display: block;
  font-size: var(--type-xxs);
  opacity: 0.9
}

/* Control row — descriptions get more room and better contrast */
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2)
}

.control-desc {
  color: var(--text-muted);
  max-width: 62%;
  font-size: var(--type-sm)
}

/* Toggle — larger, tactile */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none
}

.toggle-switch .switch {
  width: 40px;
  height: 24px;
  background: var(--bg-gray);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  position: relative;
  transition: all var(--transition-fast);
}

.toggle-switch .switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.toggle-switch input:checked+.switch {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.toggle-switch input:checked+.switch::after {
  transform: translateX(16px);
}

.toggle-switch .switch:focus {
  outline: 3px solid rgba(var(--color-primary-rgb), 0.10);
  outline-offset: 2px
}

.form-actions {
  display: flex;
  gap: var(--s-1);
  justify-content: flex-end;
  padding-top: var(--s-1)
}

.empty-state {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2);
  color: var(--text-muted)
}

.empty-illustration {
  font-size: 26px
}

.danger-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding: 12px 0
}

.btn-danger {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid var(--color-danger-bg);
  padding: 0 var(--space-3);
  border-radius: var(--btn-radius);
  font-weight: 600;
}

@media (max-width: 920px) {
  .settings-layout {
    flex-direction: column
  }

  .settings-nav {
    width: 100%;
    display: flex;
    gap: 8px;
    overflow: auto;
    padding: 8px
  }

  .form-grid {
    grid-template-columns: 1fr
  }

  .settings-header {
    align-items: flex-start
  }

  .settings-header>div:first-child {
    max-width: 100%
  }
}


.ai-generate-btn::before,
.ai-generate-btn::after {
  content: '';
  position: absolute;
  z-index: 5;
  pointer-events: none;
}

.ai-generate-btn::before {
  width: 48px;
  height: 48px;
  right: 6px;
  top: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  filter: blur(6px);
  opacity: 0.95;
  transition: right 220ms ease, bottom 220ms ease, filter 220ms ease, box-shadow 220ms ease;
}

.ai-generate-btn::after {
  width: 80px;
  height: 80px;
  right: 8px;
  top: 12px;
  background: rgba(251, 113, 133, 0.14);
  border-radius: 9999px;
  filter: blur(10px);
  opacity: 0.85;
  transition: right 220ms ease, transform 220ms ease;
}

.ai-generate-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(162, 26, 175, 0.12);
  border-color: rgba(251, 113, 133, 0.45);
  color: #fb7185;
}

.ai-generate-btn:hover::before {
  right: 48px;
  bottom: -12px;
  box-shadow: 20px 20px 20px 30px rgba(162, 26, 175, 0.18);
}

.ai-generate-btn:hover::after {
  right: -8px;
  transform: translateX(10px);
}

/* Compact gradient button inspired by user's design but scaled down */
.gradient-button {
  position: absolute;
  right: 8px;
  top: -10px;
  /* nudged up slightly */
  padding: 6px 14px;
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-primary);
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--btn-radius);
  overflow: hidden;
  transition: transform 0.18s ease;
  z-index: 8;
}

.gradient-button.small-gradient {
  padding: 6px 10px;
  font-size: 0.82rem;
  /* slightly smaller than default */
  border-radius: var(--btn-radius);
}

.gradient-button:hover {
  transform: scale(1.03);
}

.gradient-button::before {
  content: "";
  position: absolute;
  top: -40%;
  left: -40%;
  width: 180%;
  height: 180%;
  background: conic-gradient(from 0deg,
      var(--color-primary-dark),
      #4ecdc4,
      var(--color-primary),
      #45b7d1,
      #96ceb4,
      var(--color-primary-light),
      var(--color-primary-dark));
  z-index: -2;
  filter: blur(10px);
  transform: rotate(0deg);
  transition: transform 1.2s ease-in-out;
  border-radius: var(--btn-radius);
}

.gradient-button:hover::before {
  transform: rotate(180deg);
}

.gradient-button::after {
  content: "";
  position: absolute;
  inset: 3px;
  /* creates visible border area from ::before */
  background: var(--bg-tertiary);
  /* use site gray tone for interior */
  border-radius: calc(var(--btn-radius) - 3px);
  z-index: -1;
  filter: none;
}

/* ensure inside text is white and not gradient clipped */
.gradient-button {
  color: var(--text-primary);
}

.gradient-text {
  /* kept for backward compatibility but force white */
  color: #fff !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
}

.gradient-button:active {
  transform: scale(0.99);
}

@keyframes hue-rotating {
  to {
    filter: hue-rotate(360deg);
  }
}

/* Add breathing room after company type select so button can sit comfortably */
select#company-type {
  margin-bottom: 20px;
}

.ai-generate-btn:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}


[data-theme="dark"] {
  /* Backgrounds — refined dark surface hierarchy */
  --bg-primary: #111318;
  --bg-secondary: #16181d;
  --bg-tertiary: #1c1f26;
  --bg-elevated: #1c1f26;
  --bg-gray: #23262e;
  --bg-hover: rgba(255, 255, 255, 0.04);
  --bg-active: rgba(255, 255, 255, 0.06);

  /* Text — clear hierarchy, bright on dark */
  --text-primary: #f0f2f4;
  --text-secondary: #b8c0cc;
  --text-muted: #737d8c;

  /* Borders — subtle */
  --border-color: #2a2e36;
  --border-color-light: #1f2229;

  /* Shadows — darker ambient */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.16);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.32);
  --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.40);

  /* Semantic color backgrounds stay the same */
  --color-primary-bg: rgba(47, 95, 208, 0.12);
  --color-primary-bg-hover: rgba(47, 95, 208, 0.18);
  --color-success-bg: rgba(22, 163, 74, 0.12);
  --color-warning-bg: rgba(202, 138, 4, 0.12);
  --color-danger-bg: rgba(220, 38, 38, 0.12);
}


/* ===== MENTION SYSTEM ===== */
.mention-container {
  position: relative;
}

.mention-input {
  width: 100%;
  min-height: 100px;
  padding: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: var(--transition-fast);
  resize: vertical;
}

.mention-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.mention-suggestions {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
}

.mention-suggestion {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.mention-suggestion:hover {
  background: var(--bg-tertiary);
}

.mention-suggestion.active {
  background: var(--color-primary-bg);
}

.mention-avatar {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: white;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

/* Company view summary styles */
.company-summary {
  padding: 8px 0;
}

.company-summary-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.company-summary-avatar img.company-summary-logo {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
}

.company-summary-initials {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
}

.company-summary-main {
  min-width: 0;
}

.company-summary-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-summary-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.company-summary-domain {
  font-size: 0.9rem;
}

.company-summary-domain-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 9999px;
  background: var(--bg-tertiary);
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  font-size: 0.85rem;
}

.company-summary-domain-link svg {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  stroke: currentColor;
}

.company-summary-domain-link:hover {
  background: var(--bg-primary);
  transform: translateY(-1px);
  transition: var(--transition-fast);
}

/* Dark theme tweak */
[data-theme="dark"] .company-summary-domain-link {
  background: rgba(255, 255, 255, 0.03);
  color: var(--color-primary-light);
}

/* Style company link inside person/company summary meta to look like plain muted metadata */
.company-summary-meta .person-view-company-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  background: transparent;
  color: var(--color-primary);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  transition: background 160ms ease, transform 160ms ease;
}

.company-summary-meta .person-view-company-link svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  stroke: currentColor;
  opacity: 0.95;
}

.company-summary-meta .person-view-company-link .person-company-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  display: inline-block;
  vertical-align: middle;
}

.company-summary-meta .person-view-company-link:hover {
  background: var(--bg-tertiary);
  transform: translateY(-1px);
}

[data-theme="dark"] .company-summary-meta .person-view-company-link {
  color: var(--color-primary-light);
}

/* Opportunity card company avatar */
.opp-company-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.opp-company-avatar {
  width: 22px;
  height: 22px;
  position: relative;
  flex-shrink: 0;
}

.opp-company-avatar img {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: block;
}

.opp-company-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.opportunity-company {
  margin-bottom: 6px;
}

.mention-info {
  flex: 1;
}

.mention-name {
  font-weight: 550;
  color: var(--text-primary);
}

.mention-details {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.mentioned-person {
  display: inline-block;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  font-weight: 550;
  margin: 0 0.125rem;
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scrollbar-gutter: stable;
}

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.875rem;
  font-weight: 550;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

/* ===== LOADING SCREEN ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-loading);
  transition: opacity 180ms ease, visibility 180ms ease;
  overflow: hidden;
}

/* dark theme no longer needs a separate color; the variable --bg-primary
   is already dark when theme is set to dark, so the base rule handles both modes. */
/*[data-theme="dark"] .loading-overlay {
  background: #0f1117;
}*/

@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@keyframes gradient-shift-dark {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

/* Animated background blobs */
.loading-overlay::before {
  content: none;
}

.loading-overlay::after {
  content: none;
}

@keyframes blob-animation {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(30px, -30px) scale(1.1);
  }

  66% {
    transform: translate(-20px, 20px) scale(0.95);
  }
}

.loading-content {
  /* default card-style layout for older versions; kept for backwards compatibility */
  text-align: center;
  padding: 2rem 1.75rem;
  position: relative;
  z-index: 10;
  width: min(420px, calc(100% - 2rem));
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .loading-content {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  box-shadow: var(--shadow-lg);
}

/* --- simple inline loading layout used by crm loading screen --- */
.loading-content.simple {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  box-shadow: none;
  width: auto;
  padding: 0.5rem 1rem;
}

@keyframes content-appear {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.loading-logo {
  margin-bottom: 1rem;
  position: relative;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-logo img {
  height: 46px;
  width: auto;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  margin: 0.5rem auto 1rem;
  position: relative;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  border-top-color: var(--color-primary);
  animation: loading-spin 0.9s linear infinite;
}

/* inline adjustments when inside simple container */
.loading-content.simple .loading-spinner {
  margin: 0;
  /* no automatic centering */
  width: 24px;
  height: 24px;
  border-width: 2px;
  /* reapply animation in case cascade dropped it */
  animation: loading-spin 0.9s linear infinite;
  animation-play-state: running;
}

/* hide legacy extras when using simple layout */
.loading-content.simple .loading-logo,
.loading-content.simple .loading-progress {
  display: none;
}

.loading-spinner::before,
.loading-spinner::after {
  content: none;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-spinner::before {
  content: none;
}

.loading-spinner::after {
  content: none;
}

.loading-text {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 550;
  margin-bottom: 1rem;
  letter-spacing: 0.2px;
  position: relative;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* smaller font when inside simple layout */
.loading-content.simple .loading-text {
  font-size: 0.8rem;
  margin-bottom: 0;
}


.loading-progress {
  width: 100%;
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  margin: 0 auto;
}

[data-theme="dark"] .loading-progress {
  background: var(--bg-tertiary);
}

.loading-progress-bar {
  height: 100%;
  width: 38%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
  border-radius: var(--radius-full);
  animation: loading-bar 1.1s ease-in-out infinite;
}

.loading-progress-bar::after {
  content: none;
}

@keyframes loading-bar {
  0% {
    transform: translateX(-65%);
  }

  100% {
    transform: translateX(225%);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

@keyframes loading-progress {
  0% {
    width: 0;
  }

  50% {
    width: 70%;
  }

  100% {
    width: 100%;
  }
}

/* ===== AUTH SCREEN ===== */
.auth-screen {
  min-height: 100vh;
  width: 100%;
  display: flex;
  background: var(--bg-primary);
  overflow: hidden;
}

.auth-split-layout {
  display: flex;
  width: 100%;
  height: 100vh;
  flex-direction: row;
}

/* --- Left Side: Interactive Cartoon Characters --- */
.auth-visual-side {
  width: 50%;
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.auth-cartoon-side {
  background: #e8e8e8;
  padding: 0;
  cursor: default;
}

/* ---- Dark / Light mode for cartoon stage ---- */
[data-theme="dark"] .auth-cartoon-side {
  background: #1a1e21;
}

[data-theme="light"] .auth-cartoon-side {
  background: #e8e8e8;
}

/* Stage brand logo color per theme */
[data-theme="dark"] .stage-brand-logo {
  filter: brightness(0) invert(1);
}

[data-theme="light"] .stage-brand-logo {
  filter: brightness(0);
}

/* ---- Top-left brand logo on cartoon stage ---- */
.cartoon-stage-logo {
  position: absolute;
  top: 28px;
  left: 32px;
  z-index: 10;
}

.stage-brand-logo {
  width: 220px;
  height: auto;
  opacity: 0.85;
}

.cartoon-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 0;
}

/* ---- Character base styles ---- */
.toon {
  position: absolute;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  opacity: 0;
  transform: translateY(110%);
}

/* ---- Entrance animations ---- */

/* Orange: rises first from below — slow, heavy, grounded */
.toon-orange.entered {
  animation: enterRise 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.05s forwards;
}

/* Purple: grows upward from the ground like it's being built */
.toon-purple.entered {
  animation: enterGrow 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.25s forwards;
}

/* Dark: slides in from below with a confident lean */
.toon-dark.entered {
  animation: enterLean 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.45s forwards;
}

/* Yellow: the little one — drops in last with a soft landing */
.toon-yellow.entered {
  animation: enterDrop 0.7s cubic-bezier(0.34, 1.3, 0.64, 1) 0.6s forwards;
}

/* Orange: smooth vertical rise, slight scale correction at the end */
@keyframes enterRise {
  0% {
    opacity: 0;
    transform: translateY(110%);
  }

  15% {
    opacity: 1;
  }

  70% {
    transform: translateY(-2%);
  }

  85% {
    transform: translateY(0.5%);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Purple: grows up from base — starts compressed, stretches to full height */
@keyframes enterGrow {
  0% {
    opacity: 0;
    transform: translateY(80%) scaleY(0.4);
    transform-origin: center bottom;
  }

  20% {
    opacity: 1;
  }

  60% {
    transform: translateY(-1.5%) scaleY(1.03);
    transform-origin: center bottom;
  }

  80% {
    transform: translateY(0.5%) scaleY(0.99);
    transform-origin: center bottom;
  }

  100% {
    opacity: 1;
    transform: translateY(0) scaleY(1);
    transform-origin: center bottom;
  }
}

/* Dark: slides up with a subtle tilt — like stepping into frame */
@keyframes enterLean {
  0% {
    opacity: 0;
    transform: translateY(100%) rotate(2deg);
  }

  20% {
    opacity: 1;
  }

  65% {
    transform: translateY(-1.5%) rotate(-0.5deg);
  }

  85% {
    transform: translateY(0.5%) rotate(0deg);
  }

  100% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
}

/* Yellow: drops in with a gentle spring settle */
@keyframes enterDrop {
  0% {
    opacity: 0;
    transform: translateY(90%) scale(0.85);
  }

  20% {
    opacity: 1;
  }

  55% {
    transform: translateY(-3%) scale(1.02);
  }

  72% {
    transform: translateY(1%) scale(0.99);
  }

  88% {
    transform: translateY(-0.4%) scale(1.005);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toon-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  /* Body shape stays fixed — skew applied via JS on email state */
  transform-origin: center bottom;
  will-change: transform;
  transition: transform 0.35s ease;
}

/* Movable head region — slides horizontally for neck movement */
.toon-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  will-change: transform;
  transition: transform 0.05s linear;
}

.toon-eyes {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.toon-eye {
  position: relative;
  overflow: hidden;
  border-radius: 50%;
}

.toon-eye-white {
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.toon-pupil {
  background: #1a1a2e;
  border-radius: 50%;
  position: absolute;
  transition: transform 0.05s linear;
  will-change: transform;
}

.toon-eyelid {
  position: absolute;
  top: 0;
  left: -2px;
  right: -2px;
  height: 0%;
  border-radius: 0 0 50% 50%;
  transition: height 0.15s ease-in-out;
  z-index: 2;
}

.toon-eyelid.blink,
.toon-eyelid.closed {
  height: 105%;
}

.toon-mouth {
  background: #1a1a2e;
  transition: all 0.3s ease;
}

/* ---- Character 1: Tall Purple ---- */
.toon-purple {
  width: 180px;
  height: 340px;
  bottom: 12%;
  left: 50%;
  margin-left: -115px;
  z-index: 2;
}

.toon-purple .toon-face {
  background: #6c5ce7;
  width: 100%;
  height: 100%;
  border-radius: 24px;
  padding-top: 50px;
}

.toon-purple .toon-eye-white {
  width: 22px;
  height: 22px;
}

.toon-purple .toon-pupil {
  width: 10px;
  height: 10px;
}

.toon-purple .toon-eyes {
  gap: 24px;
}

.toon-purple .toon-eyelid {
  background: #6c5ce7;
}

.toon-purple .toon-mouth {
  width: 4px;
  height: 28px;
  border-radius: 2px;
  margin-top: 14px;
}

.toon-purple .toon-mouth.smile {
  width: 20px;
  height: 10px;
  border-radius: 0 0 20px 20px;
  background: #1a1a2e;
}

/* ---- Character 2: Dark Rectangle ---- */
.toon-dark {
  width: 140px;
  height: 320px;
  bottom: 0;
  left: 50%;
  margin-left: 5px;
  z-index: 3;
}

.toon-dark .toon-face {
  background: #2d3436;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  padding-top: 40px;
}

.toon-dark .toon-eye-white {
  width: 20px;
  height: 20px;
}

.toon-dark .toon-pupil {
  width: 10px;
  height: 10px;
}

.toon-dark .toon-eyes {
  gap: 16px;
}

.toon-dark .toon-eyelid {
  background: #2d3436;
}

.toon-dark .toon-mouth {
  width: 3px;
  height: 20px;
  border-radius: 2px;
  margin-top: 12px;
}

.toon-dark .toon-mouth.smile {
  width: 16px;
  height: 8px;
  border-radius: 0 0 16px 16px;
  background: #1a1a2e;
}

/* ---- Character 3: Big Orange Dome ---- */
.toon-orange {
  width: 310px;
  height: 190px;
  bottom: 0;
  left: 50%;
  margin-left: -230px;
  z-index: 4;
}

.toon-orange .toon-face {
  background: #e17055;
  width: 100%;
  height: 100%;
  border-radius: 180px 180px 0 0;
  padding-top: 50px;
}

.toon-orange .toon-eye-white {
  width: 18px;
  height: 18px;
}

.toon-orange .toon-pupil {
  width: 8px;
  height: 8px;
}

.toon-orange .toon-eyes {
  gap: 36px;
}

.toon-orange .toon-eyelid {
  background: #e17055;
}

.toon-orange .toon-mouth {
  width: 24px;
  height: 12px;
  border-radius: 0 0 24px 24px;
  margin-top: 14px;
  background: #1a1a2e;
}

.toon-orange .toon-mouth.neutral {
  width: 4px;
  height: 20px;
  border-radius: 2px;
}

/* Look-away states during password */
.toon-orange.look-away .toon-head {
  transform: translateX(-20px) !important;
}

.toon-dark.look-away .toon-head {
  transform: translateX(-16px) !important;
}

/* ---- Character 4: Yellow Dome ---- */
.toon-yellow {
  width: 180px;
  height: 130px;
  bottom: 0;
  left: 50%;
  margin-left: 15px;
  z-index: 5;
}

.toon-yellow .toon-face {
  background: #fdcb6e;
  width: 100%;
  height: 100%;
  border-radius: 120px 120px 0 0;
  padding-top: 30px;
}

.toon-yellow .toon-eye-white {
  width: 10px;
  height: 10px;
}

.toon-yellow .toon-pupil {
  width: 5px;
  height: 5px;
}

.toon-yellow .toon-eyes {
  gap: 22px;
}

.toon-yellow .toon-eyelid {
  background: #fdcb6e;
}

.toon-yellow .toon-mouth {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  margin-top: 8px;
}

.toon-yellow .toon-mouth.smile {
  width: 18px;
  height: 9px;
  border-radius: 0 0 18px 18px;
  background: #1a1a2e;
}

/* Keep old classes from breaking */
.auth-visual-overlay,
.auth-visual-content,
.visual-brand,
.visual-brand h1,
.visual-quote,
.visual-quote p {
  display: none;
}



.glass-user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.glass-avatar {
  width: 40px;
  height: 40px;
  background: #fcd34d;
  color: #78350f;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
}

.glass-text {
  display: flex;
  flex-direction: column;
}

.glass-text .name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0f1419;
}

.glass-text .role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.glass-badge {
  background: #1f9d6e;
  color: #ffffff;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* --- Right Side: Form --- */
.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 2rem;
  position: relative;
  overflow-y: auto;
}


/* Wrapper to enforce max-width and centering */
.auth-form-wrapper {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-left: 0;
}

.auth-logo-mobile {
  display: none;
  margin-bottom: 2rem;
}

.mobile-logo-main {
  width: 220px;
  max-width: 100%;
  height: auto;
}

.auth-header h2 {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* Back to Home button — matches sign-in shape */
.btn-back-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-md, 10px);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

/* Light mode: dark/black button */
[data-theme="light"] .btn-back-home {
  background: #1a1a2e;
  color: #ffffff;
  border: 1px solid transparent;
}

[data-theme="light"] .btn-back-home:hover {
  background: #2d2d44;
}

/* Dark mode: white/gray button */
[data-theme="dark"] .btn-back-home {
  background: rgba(255, 255, 255, 0.12);
  color: #e1e4e8;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .btn-back-home:hover {
  background: rgba(255, 255, 255, 0.18);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-field label {
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--text-primary);
  padding-left: 2px;
}

/* Modern Input Styling - Clean & Crisp */
.input-wrapper.modern-input {
  position: relative;
}

/* Left Icon (Envelope/Lock) - Handles both <i> and <svg> */
.input-wrapper.modern-input i:first-child,
.input-wrapper.modern-input svg.left-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  /* For i tags */
  width: 18px;
  /* For SVGs */
  height: 18px;
  /* For SVGs */
  pointer-events: none;
  z-index: 10;
}

.input-wrapper.modern-input input {
  width: 100%;
  height: 48px;
  /* Increased slightly for better breathability */
  padding: 0 45px 0 42px !important;
  /* Extra padding on right to avoid eye icon overlap */
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: all 0.2s ease-in-out;
}

/* Auth form inputs: remove left padding reserved for icons so text is left-aligned */
.auth-form .input-wrapper.modern-input input {
  padding: 0 45px 0 14px !important;
}

/* Increase label and input text size on auth page for better readability */
.auth-form .form-field label {
  font-size: 1rem;
  /* slightly larger than default 0.875rem */
  font-weight: 700;
  color: var(--text-primary);
}

.auth-form .input-wrapper.modern-input input {
  font-size: 1rem;
  /* make typed text and placeholder a bit larger */
  height: 45px;
}

/* Dark mode specific clarity adjustment */
[data-theme="dark"] .input-wrapper.modern-input input {
  background: rgba(255, 255, 255, 0.03);
  /* Slight contrast against bg */
  border-color: rgba(255, 255, 255, 0.1);
}

.input-wrapper.modern-input input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-bg);
  background: var(--bg-primary);
  outline: none;
}

/* Eye Icon Button */
.toggle-password {
  position: absolute;
  right: 22px;
  top: 0;
  bottom: 0;
  margin: auto;
  height: 32px;
  border: none;
  background: transparent;
  padding: 6px;
  color: var(--text-muted);
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-password:hover {
  color: var(--text-primary);
  background: transparent;
}

/* Branding Group Styles */
.visual-brand-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
}

.visual-sub-brand {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-left: 0.25rem;
  opacity: 0.9;
}

/* Removed powered-by styles since element is gone */

/* Form Extra */
.form-extra {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  width: 100%;
  /* Ensure full width */
}

.remember-me {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-weight: 550;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  /* Prevent wrapping */
}

.remember-me input {
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
  min-width: 16px;
  /* Prevent squishing */
  border-radius: 4px;
  margin: 0;
  display: inline-block;
  cursor: pointer;
}

.forgot-password {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

.forgot-password:hover {
  text-decoration: underline;
}

/* Login screen primary button */
.auth-form .btn-primary.btn-lg {
  height: 40px;
  font-size: 0.88rem;
  font-weight: 550;
  border-radius: 10px;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  background: var(--color-primary);
  color: #ffffff;
  border: 1px solid transparent;
  letter-spacing: 0.3px;
}

.auth-form .btn-primary.btn-lg:hover {
  background: var(--color-primary-dark);
}

.auth-form .btn-primary.btn-lg:active {
  box-shadow: 0 1px 3px rgba(47, 95, 208, 0.2);
  transform: scale(0.99);
}

/* Social Login */
.auth-divider {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  margin: 1.5rem 0;
  text-transform: uppercase;
}

.auth-divider span {
  padding: 0 1rem;
}

.social-login {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 34px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-weight: 550;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: none;
  letter-spacing: 0.3px;
}

.btn-social:hover {
  background: var(--bg-secondary);
  border-color: var(--color-primary);
  box-shadow: 0 2px 4px rgba(47, 95, 208, 0.1);
}

.btn-social:active {
  transform: scale(0.98);
}

.auth-footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 900px) {
  .auth-split-layout {
    flex-direction: column;
  }

  .auth-visual-side {
    display: none;
  }

  .auth-form-side {
    width: 100%;
    align-items: flex-start;
    /* Align top on mobile */
    padding-top: 4rem;
  }

  .auth-form-wrapper {
    max-width: 100%;
    padding: 0 1rem;
  }

  .auth-logo-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center them relative to each other */
    gap: 1rem;
    margin-bottom: 2.5rem;
    width: 100%;
  }

  /* Invert Sangyug logo for mobile (assuming light/dark mode needs) 
     Adjust filter based on background. If mobile background is white (light mode default), 
     we need a dark logo. The logo is likely white by default if reused from dark sidebar? 
     Let's check the generated image of the visual side. 
     The visual side uses `filter: brightness(0) invert(1)` which makes it WHITE.
     If the mobile background is light, we need it BLACK (default). 
     If mobile background is dark, we need it WHITE.
  */

  /* Default (Light Mode) - Make it dark/original if it's a white logo */
  .mobile-logo-sub {
    opacity: 0.8;
    /* If the image is inherently white, we need to invert it to black for light mode */
    filter: brightness(0);
  }

  /* Dark Mode Mobile Support */
  [data-theme="dark"] .mobile-logo-sub {
    filter: brightness(0) invert(1);
  }

  .auth-header {
    text-align: center;
    padding-left: 0;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   SIGNUP MULTI-STEP WIZARD
   ───────────────────────────────────────────────────────────────────────────── */

/* Tighten the header when inside the signup wizard */
.signup-header {
  margin-bottom: 1.5rem;
}

/* ── Stepper ── */
.signup-stepper {
  margin-bottom: 1.5rem;
}

.signup-stepper-track {
  display: flex;
  align-items: center;
}

.ss-step {
  display: flex;
  align-items: center;
  flex: 1;
}

.ss-step:last-child {
  flex: 0;
}

.ss-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
  position: relative;
}

.ss-num {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: opacity 0.15s ease;
  line-height: 1;
}

.ss-check {
  position: absolute;
  inset: 0;
  margin: auto;
  opacity: 0;
  color: #fff;
  transition: opacity 0.15s ease;
}

/* Active step */
.ss-step.active .ss-dot {
  background: var(--color-primary);
  border-color: var(--color-primary);
  transform: scale(1.08);
  box-shadow: 0 0 0 4px rgba(47, 95, 208, 0.15);
}

.ss-step.active .ss-num {
  color: #fff;
}

/* Completed step */
.ss-step.completed .ss-dot {
  background: var(--color-success);
  border-color: var(--color-success);
  transform: scale(1);
  box-shadow: none;
}

.ss-step.completed .ss-num {
  opacity: 0;
}

.ss-step.completed .ss-check {
  opacity: 1;
}

.ss-line {
  flex: 1;
  height: 2px;
  background: var(--border-color);
  margin: 0 6px;
  border-radius: 2px;
  transition: background 0.35s ease;
}

.ss-step.completed .ss-line {
  background: var(--color-success);
}

.signup-stepper-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

.signup-stepper-labels span {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 1;
  text-align: center;
}

.signup-stepper-labels span:first-child {
  text-align: left;
}

.signup-stepper-labels span:last-child {
  text-align: right;
}

/* ── Step Panels ── */
.signup-step-panel {
  display: none;
  flex-direction: column;
}

.signup-step-panel.active {
  display: flex;
  animation: signupStepIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.signup-step-panel.active.step-reverse {
  animation: signupStepInReverse 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes signupStepIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes signupStepInReverse {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Step action row (Back + Continue) ── */
.signup-step-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 16px;
  align-items: stretch;
}

.signup-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
  flex-shrink: 0;
}

.signup-back-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}

.signup-next-btn {
  height: 44px !important;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 10px !important;
  margin-top: 16px;
  letter-spacing: 0.2px;
  gap: 8px;
}

/* When next-btn is inside the actions grid, remove its top margin */
.signup-step-actions .signup-next-btn {
  margin-top: 0;
}

/* ── Plan Card ── */
.signup-plan-card {
  border: 1.5px solid var(--color-primary);
  border-radius: 16px;
  padding: 22px 22px 20px;
  background: rgba(47, 95, 208, 0.04);
  position: relative;
  overflow: hidden;
}

.signup-plan-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 95, 208, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.signup-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--color-success);
  color: #fff;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.signup-plan-name {
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 5px;
}

.signup-plan-tagline {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 18px;
  line-height: 1.5;
}

.signup-plan-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.signup-plan-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--text-primary);
}

.signup-plan-features li svg {
  flex-shrink: 0;
  color: var(--color-success);
}

.signup-plan-upgrade-note {
  margin-top: 18px;
  font-size: 0.775rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color-light);
  padding-top: 14px;
}

/* Match auth-form input styles for the signup wizard inputs */
#signup-form .form-field label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

#signup-form .input-wrapper.modern-input input {
  padding: 0 45px 0 14px !important;
  font-size: 0.9375rem;
  height: 44px;
}

/* Dark mode adjustments */
[data-theme="dark"] .signup-plan-card {
  background: rgba(47, 95, 208, 0.07);
  border-color: rgba(47, 95, 208, 0.35);
}

[data-theme="dark"] .signup-plan-card::before {
  background: radial-gradient(circle, rgba(47, 95, 208, 0.18) 0%, transparent 70%);
}

[data-theme="dark"] .ss-dot {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .signup-back-btn {
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
}

[data-theme="dark"] .signup-back-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS — Unified system. Every button shares the same
   DNA: height, radius, font, spacing. Variants only change
   color/fill. This is the #1 cohesion lever.
   ═══════════════════════════════════════════════════════════ */

/* Base Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-height-md);
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--btn-radius);
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.btn i,
.btn svg {
  width: var(--icon-sm);
  height: var(--icon-sm);
  flex-shrink: 0;
}

.btn::before {
  display: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Shared interaction for all interactive controls */
:where(.btn, .toolbar-btn, .toolbar-btn-primary, .task-filter, .reminder-filter, .toggle-btn, .filter-select, .action-btn) {
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

/* Shared font styling for all button-like controls */
.toolbar-btn,
.toolbar-btn-primary,
.task-filter,
.reminder-filter,
.toggle-btn,
.action-btn {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--type-md);
  font-weight: 550;
}

:where(.btn, .toolbar-btn, .toolbar-btn-primary, .task-filter, .reminder-filter, .toggle-btn, .filter-select, .action-btn):active:not(:disabled) {
  transform: translateY(var(--motion-distance-press));
}

/* Primary — solid fill, the main CTA */
.btn-primary {
  background: var(--color-primary);
  color: var(--text-inverse);
  border-color: transparent;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

.btn-primary:active:not(:disabled) {
  background: var(--color-primary-dark);
}

/* Secondary — bordered, used alongside primary */
.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:active:not(:disabled) {
  background: var(--bg-active);
}

[data-theme="dark"] .btn-secondary {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

[data-theme="dark"] .btn-secondary:hover:not(:disabled) {
  background: var(--bg-tertiary);
}

/* Danger — destructive actions */
.btn-danger {
  background: var(--color-danger);
  color: var(--text-inverse);
  border-color: transparent;
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-danger:active:not(:disabled) {
  background: #991b1b;
}

/* Ghost — minimal, blends with content */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-ghost:active:not(:disabled) {
  background: var(--bg-active);
}

[data-theme="dark"] .btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Focus ring — accessible but subtle */
.btn:focus-visible,
.toolbar-btn:focus-visible,
.toolbar-btn-primary:focus-visible,
.action-btn:focus-visible,
.toggle-btn:focus-visible,
.filter-select:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

/* Size Variants */
.btn-lg {
  height: var(--control-height-lg);
  padding: 0 var(--space-4);
  font-size: var(--btn-font-size);
}

.btn-sm {
  height: var(--control-height-sm);
  padding: 0 var(--space-2);
  font-size: var(--type-xs);
}

.btn-xs {
  height: var(--control-height-xs);
  padding: 0 var(--space-2);
  font-size: var(--type-xxs);
}

.btn-block {
  width: 100%;
}

/* Success */
.btn-success {
  background: var(--color-success);
  color: var(--text-inverse);
  border-color: transparent;
}

.btn-success:hover:not(:disabled) {
  background: #15803d;
}

/* Warning */
.btn-warning {
  background: var(--color-warning);
  color: var(--text-inverse);
  border-color: transparent;
}

.btn-warning:hover:not(:disabled) {
  background: #a16207;
}

/* Icon-only button */
.btn-icon {
  width: var(--control-height-md);
  height: var(--control-height-md);
  padding: 0;
  border-radius: var(--btn-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon.btn-primary {
  background: var(--color-primary);
  color: var(--text-inverse);
}

.btn-icon.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-icon.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-icon:hover:not(:disabled) {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .btn-icon:hover:not(:disabled) {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Outline Button - Professional Alternative */
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  box-shadow: none;
}

.btn-outline:hover:not(:disabled) {
  background: var(--color-primary-bg);
  box-shadow: 0 2px 4px rgba(47, 95, 208, 0.1);
}

.btn-outline:active:not(:disabled) {
  transform: scale(0.98);
}

[data-theme="dark"] .btn-outline {
  color: var(--color-primary-light);
  border-color: var(--color-primary-light);
}

[data-theme="dark"] .btn-outline:hover:not(:disabled) {
  background: rgba(125, 162, 248, 0.15);
}

/* ===== DARK MODE BUTTON ENHANCEMENTS ===== */

/* Dark mode secondary buttons */
[data-theme="dark"] .btn-secondary {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
  box-shadow: none;
}

[data-theme="dark"] .btn-secondary:hover:not(:disabled) {
  background: var(--bg-tertiary);
  border-color: var(--color-primary-light);
  box-shadow: 0 2px 6px rgba(125, 162, 248, 0.1);
}

/* Dark mode success button */
[data-theme="dark"] .btn-success {
  box-shadow: 0 2px 8px rgba(31, 157, 110, 0.2);
}

[data-theme="dark"] .btn-success:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(31, 157, 110, 0.3);
}

/* Dark mode warning button */
[data-theme="dark"] .btn-warning {
  box-shadow: 0 2px 8px rgba(198, 132, 26, 0.2);
}

[data-theme="dark"] .btn-warning:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(198, 132, 26, 0.3);
}

/* Dark mode danger button */
[data-theme="dark"] .btn-danger {
  box-shadow: 0 2px 8px rgba(200, 58, 58, 0.2);
}

[data-theme="dark"] .btn-danger:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(200, 58, 58, 0.3);
}

/* Dark mode ghost button */
[data-theme="dark"] .btn-ghost {
  color: var(--text-secondary);
}

[data-theme="dark"] .btn-ghost:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Dark mode icon buttons */
[data-theme="dark"] .btn-icon.btn-secondary {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

[data-theme="dark"] .btn-icon.btn-secondary:hover:not(:disabled) {
  background: var(--bg-tertiary);
  border-color: var(--color-primary-light);
}

[data-theme="dark"] .btn-icon.btn-ghost {
  color: var(--text-secondary);
}

[data-theme="dark"] .btn-icon.btn-ghost:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--color-primary-light);
}

/* ===== APP LAYOUT ===== */
.main-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-secondary);
}

/* ===== APP HEADER ===== */
.app-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-3) 0 var(--space-2);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
}

body.modal-active {
  overflow: hidden !important;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0;
  padding-left: 0;
  min-width: 0;
  overflow: hidden;
}

.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--control-height-md);
  height: var(--control-height-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--btn-radius);
  cursor: pointer;
  font-size: 1rem;
  transition: background var(--transition-fast);
}

.mobile-menu-btn:hover {
  background: var(--bg-hover);
}

.mobile-menu-btn:active {
  background: var(--bg-active);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.header-org-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-1);
  min-width: 0;
  flex-wrap: nowrap;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--btn-radius);
  transition: background var(--transition-fast);
  user-select: none;
  -webkit-user-select: none;
  flex-shrink: 1;
}

.header-org-btn:hover {
  background: var(--bg-hover);
}

.header-org-name {
  font-size: var(--type-lg);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.header-org-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.header-org-btn.open .header-org-chevron {
  transform: rotate(180deg);
}

.brand-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--control-height-md);
  height: var(--control-height-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--btn-radius);
  cursor: pointer;
  font-size: var(--type-lg);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.header-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.header-icon-btn:active {
  background: var(--bg-active);
}

/* ──────────────────────────────────────────────────────────────────────
   NOTIFICATIONS — redesigned
────────────────────────────────────────────────────────────────────── */

.notifications-menu {
  position: relative;
}

.notification-bell-btn {
  position: relative;
}

/* Bell ring animation when there are unread notifications */
@keyframes notif-bell-ring {
  0%, 60%, 100% { transform: rotate(0); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-12deg); }
  30% { transform: rotate(10deg); }
  40% { transform: rotate(-7deg); }
  50% { transform: rotate(4deg); }
}

.notification-bell-btn.has-unread svg {
  animation: notif-bell-ring 1.4s ease 0.2s both;
  transform-origin: top center;
}

.safi-nudge-launcher {
  position: relative;
  border-color: transparent;
  background: transparent;
  overflow: hidden;
}

.nudge-bot-gif {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 4px;
  display: block;
  pointer-events: none;
}

.safi-nudge-launcher:hover {
  background: var(--bg-tertiary);
  border-color: transparent;
}

/* Badge */
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: var(--color-danger);
  box-shadow: 0 0 0 2px var(--bg-primary);
}

/* Popover panel */
.notifications-popover {
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  width: min(96vw, 400px);
  max-height: min(74vh, 520px);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 150ms var(--motion-ease-emphasized), visibility 150ms, transform 150ms var(--motion-ease-emphasized);
  z-index: var(--z-dropdown);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.notifications-menu.active .notifications-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.notifications-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-4) var(--space-2);
  flex-shrink: 0;
}

.notifications-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.notifications-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.notifications-unread-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-primary-bg);
}

.notifications-mark-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 var(--space-2);
  height: 28px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
}

.notifications-mark-all-btn:hover {
  background: var(--bg-tertiary);
  color: var(--color-primary);
  border-color: var(--border-color);
}

/* Filter tabs */
.notifications-filter-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 var(--space-3) var(--space-2);
  flex-shrink: 0;
}

.notif-tab {
  padding: 0 var(--space-3);
  height: 28px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.notif-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.notif-tab.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
}

/* Divider */
.notifications-divider {
  height: 1px;
  background: var(--border-color);
  flex-shrink: 0;
}

/* Scrollable list */
.notifications-list {
  overflow-y: auto;
  padding: var(--space-2) var(--space-3) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

/* Empty state */
.notifications-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-8) var(--space-4) var(--space-7);
  text-align: center;
}

.notifications-empty-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.notifications-empty-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.notifications-empty-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: -4px;
}

/* Notification item — Apple card style */
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-3);
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
}

.notification-item:hover {
  background: var(--bg-tertiary);
  box-shadow: var(--shadow-md);
}

/* Unread — subtle tint only, no color borders */
.notification-item.unread {
  background: var(--color-primary-bg);
  border-color: rgba(var(--color-primary-rgb), 0.15);
}
.notification-item.unread:hover {
  background: var(--color-primary-bg-hover);
}

/* Item body */
.notification-item-body {
  flex: 1;
  min-width: 0;
}

.notification-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 2px;
}

.notification-item-type {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.notification-item-time {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.notification-item-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-item-message {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Unread indicator dot */
.notif-unread-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  margin-top: 4px;
  box-shadow: 0 0 0 2px var(--color-primary-bg);
}

/* Footer — device alerts CTA */
.notifications-popover-footer {
  border-top: 1px solid var(--border-color);
  padding: var(--space-2) var(--space-3);
  flex-shrink: 0;
}

.notifications-enable-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 0 var(--space-3);
  height: 34px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.notifications-enable-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-bg);
}

/* ----- Disable hover transform for key CRM action buttons -----
   The user requested removing the subtle hover 'move/scale' effect
   for new-company / new-person style buttons in CRM. This override
   clears transform on hover for common action button selectors.
*/
.settings-header-actions .btn,
.ai-generate-btn,
.gradient-button,
.btn-primary,
.btn-secondary,
.btn-ghost,
.company-summary-domain-link,
.company-summary-meta .person-view-company-link,
.toolbar-btn-primary,
#add-company-btn,
#add-person-btn {
  transition-property: background, color, box-shadow !important;

  /* keep color/box-shadow trasitions but drop transform */
}


.settings-header-actions .btn:hover,
.ai-generate-btn:hover,
.gradient-button:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-ghost:hover,
.company-summary-domain-link:hover,
.company-summary-meta .person-view-company-link:hover,
.toolbar-btn-primary:hover,
#add-company-btn:hover,
#add-person-btn:hover {
  transform: none !important;
  /* remove any hover translation/scale */
}


.due-popup-container {
  position: fixed;
  top: calc(var(--header-height) + 12px);
  right: 12px;
  width: min(92vw, 360px);
  z-index: calc(var(--z-toast) + 5);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.due-popup-container.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.due-popup-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.due-popup-card:hover {
  border-color: var(--color-primary);
}

.due-popup-card.overdue {
  border-color: rgba(239, 68, 68, 0.55);
}

.due-popup-card.due-today {
  border-color: rgba(47, 95, 208, 0.55);
}

.due-popup-card.due-soon {
  border-color: rgba(245, 158, 11, 0.45);
}

.due-popup-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.due-popup-type {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.due-popup-time {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.due-popup-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.125rem;
}

.due-popup-message {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* SafiNudge */
.safi-nudge-container {
  position: fixed;
  right: 0;
  bottom: calc(var(--bottom-nav-height) + 1.2rem);
  width: min(96vw, 500px);
  z-index: calc(var(--z-toast) + 8);
  pointer-events: none;
  display: flex;
  justify-content: flex-end;
}

.safi-nudge-container.active {
  pointer-events: auto;
}

.safi-nudge-stage {
  position: relative;
  margin-right: 0.55rem;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  transform: translateX(122%);
  opacity: 0;
  transition: transform 0.42s var(--motion-ease-emphasized), opacity 0.24s ease;
}

.safi-nudge-container.active .safi-nudge-stage {
  transform: translateX(0);
  opacity: 1;
}

.safi-nudge-bot {
  position: relative;
  width: 106px;
  height: 106px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.18));
  animation: safi-nudge-bob 1.9s ease-in-out infinite;
}

.safi-nudge-bot-gif {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.safi-nudge-bot-sparkle {
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 1rem;
  animation: safi-nudge-sparkle 1.35s ease-in-out infinite;
}

.safi-nudge-bubble {
  max-width: min(72vw, 320px);
  margin-bottom: 18px;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-lg);
  min-width: 0;
  position: relative;
  opacity: 0;
  transform: translateX(16px) translateY(8px) scale(0.96);
  transition: opacity 0.26s ease, transform 0.3s var(--motion-ease-emphasized);
}

.safi-nudge-bubble::after {
  content: '';
  position: absolute;
  right: -8px;
  bottom: 18px;
  width: 14px;
  height: 14px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  transform: rotate(-45deg);
}

.safi-nudge-container.show-message .safi-nudge-bubble {
  opacity: 1;
  transform: translateX(0) translateY(0) scale(1);
}

.safi-nudge-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.safi-nudge-message {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.35;
  word-break: break-word;
}

.safi-nudge-modal-container {
  width: min(92vw, 520px);
  border-radius: 20px;
  overflow: hidden;
}

/* ==========================
   TECHNICIAN FORMS - PREMIUM
   Focused styles to modernize and unify
   Survey / Installation / Maintenance forms
   Non-functional visual improvements only
   ========================== */
.card.max-w-md {
  max-width: 520px;
}

.card.max-w-3xl {
  max-width: 980px;
}

.card .card-body {
  padding: 28px;
}

.section-container {
  background: transparent;
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px solid var(--border-color);
}

.section-container h3.card-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px 0;
  font-size: 1.02rem;
}

.section-container h3.card-title i {
  width: 20px;
  height: 20px;
  opacity: 0.9
}

.form-field {
  display: block;
  margin-bottom: 12px;
}

.form-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="tel"],
.form-field input[type="number"],
.form-field input[type="date"],
.form-field input[type="datetime-local"],
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, border-color .12s;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: rgba(47, 95, 208, 0.9);
  box-shadow: 0 8px 24px rgba(47, 95, 208, 0.06);
}

.field-helper {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.grid>.form-field.md\:col-span-2 {
  grid-column: span 2;
}

/* radio group for better settings layout */
.form-radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: var(--space-3);
}

.tile-option {
  width: 100%;
}

/* tile-based options */
.tile-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.tile-option .indicator {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border-color);
  border-radius: 9999px;
  position: relative;
}

.tile-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tile-option input[type="radio"]:checked+.indicator {
  border-color: var(--color-primary);
}

/* highlight entire tile when its radio is checked (modern :has support) */
.tile-option:has(input[type="radio"]:checked) {
  background: var(--bg-secondary);
  border-color: var(--color-primary);
}

.tile-option:has(input[type="radio"]:checked) .tile-title {
  color: var(--color-primary);
}

[data-theme="dark"] .tile-option:has(input[type="radio"]:checked) {
  background: var(--bg-tertiary);
}


.tile-option input[type="radio"]:checked+.indicator::before {
  content: '';
  position: absolute;
  inset: 0.3rem;
  background: var(--color-primary);
  border-radius: 50%;
}

.tile-body {
  display: flex;
  flex-direction: column;
}

.tile-title {
  font-weight: 550;
  color: var(--text-primary);
}

.tile-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
}

[data-theme="dark"] .tile-option {
  border-color: var(--border-color-light);
  background: var(--bg-secondary);
}

[data-theme="dark"] .tile-option .indicator {
  border-color: var(--border-color-light);
}

[data-theme="dark"] .tile-title {
  color: var(--text-primary);
}

[data-theme="dark"] .tile-sub {
  color: var(--text-secondary);
}

/* alignment helper for action buttons in forms */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: var(--space-6);
}


.photo-upload-multiple {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent);
  cursor: pointer;
  color: var(--text-secondary);
}

.photo-upload-multiple:hover {
  border-color: rgba(47, 95, 208, 0.35);
  box-shadow: 0 8px 24px rgba(47, 95, 208, 0.05);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.photo-grid .relative,
.photo-grid img,
.photo-grid .photo-item {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 8px;
  overflow: hidden;
}

.signature-container {
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.5);
}

.signature-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.signature-placeholder {
  color: var(--text-secondary);
  font-weight: 600;
}

.card .form-field .btn {
  border-radius: 10px;
}

/* Better spacing for submit area */
.card .form-field.mt-8 {
  margin-top: 20px;
}

.btn-primary.w-full {
  width: 100%;
}

/* Responsive tweaks */
@media (max-width: 900px) {
  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .card.max-w-3xl {
    padding-left: 12px;
    padding-right: 12px;
  }

  .signature-container {
    height: 220px !important;
  }
}

.safi-nudge-modal-container .modal-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.safi-nudge-modal-container .modal-body {
  background: var(--bg-secondary);
}

/* ==========================
   SafiNudge Composer — snc-*
   ========================== */
@keyframes snc-bob {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

.safi-nudge-modal-container,
.snc-container {
  width: min(92vw, 440px);
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
}

/* ── Hero strip ── */
.snc-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem 1.375rem;
  background: linear-gradient(160deg, #f0f4ff 0%, #eef2ff 100%);
  border-bottom: 1px solid rgba(var(--color-primary-rgb), 0.12);
  text-align: center;
}

.snc-close {
  position: absolute;
  top: 0.875rem;
  right: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.snc-close:hover {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

.snc-bot {
  width: 68px;
  height: 68px;
  object-fit: contain;
  flex-shrink: 0;
  margin-bottom: 0.625rem;
  animation: snc-bob 2.4s ease-in-out infinite;
  filter: drop-shadow(0 4px 10px rgba(var(--color-primary-rgb), 0.28));
}

.snc-hero-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 0.25rem;
}

.snc-hero-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ── Body ── */
.snc-body {
  padding: 1.25rem 1.375rem;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

/* To row */
.snc-to-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.snc-to-badge {
  flex-shrink: 0;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border: 1px solid rgba(var(--color-primary-rgb), 0.2);
}

.snc-select {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.875rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.snc-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

/* Message */
.snc-message-wrap {
  position: relative;
}

.snc-textarea {
  width: 100%;
  padding: 0.7rem 0.875rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  resize: none;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  line-height: 1.55;
  font-family: inherit;
}

.snc-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.snc-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.snc-counter {
  margin-top: 0.3rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
}

/* Quick chips */
.snc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.snc-chip {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 550;
  border: 1px solid rgba(var(--color-primary-rgb), 0.22);
  background: rgba(var(--color-primary-rgb), 0.05);
  color: var(--color-primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.snc-chip:hover {
  background: var(--color-primary-bg);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ── Footer ── */
.snc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1.375rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.snc-cancel-btn {
  background: none;
  border: none;
  padding: 0.5rem 0.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
  font-family: inherit;
}

.snc-cancel-btn:hover {
  color: var(--text-primary);
}

.snc-send-btn {
  padding: 0.55rem 1.375rem;
  border-radius: 999px;
  border: none;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(var(--color-primary-rgb), 0.35);
  transition: opacity 0.15s, box-shadow 0.15s;
  font-family: inherit;
  letter-spacing: 0.1px;
}

.snc-send-btn:hover {
  opacity: 0.9;
  box-shadow: 0 6px 20px rgba(var(--color-primary-rgb), 0.45);
}

/* ── Dark mode overrides ── */
[data-theme="dark"] .snc-hero {
  background: linear-gradient(160deg, #111827 0%, #0f172a 100%);
  border-bottom-color: rgba(var(--color-primary-rgb), 0.15);
}

[data-theme="dark"] .snc-close {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .snc-close:hover {
  background: var(--color-primary-bg);
  color: var(--color-primary-light);
}

[data-theme="dark"] .snc-body {
  background: #0d1117;
}

[data-theme="dark"] .snc-select,
[data-theme="dark"] .snc-textarea {
  background: #1a1e24;
  border-color: #2d343e;
  color: #c9d1d9;
}

[data-theme="dark"] .snc-select:focus,
[data-theme="dark"] .snc-textarea:focus {
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.15);
}

[data-theme="dark"] .snc-chip {
  background: rgba(var(--color-primary-rgb), 0.08);
  border-color: rgba(var(--color-primary-rgb), 0.2);
  color: var(--color-primary-light);
}

[data-theme="dark"] .snc-chip:hover {
  background: rgba(var(--color-primary-rgb), 0.16);
  border-color: var(--color-primary-light);
  color: var(--color-primary-light);
}

[data-theme="dark"] .snc-footer {
  background: #161b22;
  border-top-color: #2d343e;
}

/* Additional polish for technician forms */
/* Form grid: make two-column layout for wider screens inside technician cards */
.card.max-w-3xl .section-container .grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.card.max-w-3xl .section-container .grid .form-field {
  margin-bottom: 0;
}

/* Accent header stripe and subtle icon background */
.section-container h3.card-title {
  position: relative;
  padding-left: 8px;
}

.section-container h3.card-title::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(47, 95, 208, 0.9), rgba(139, 92, 246, 0.75));
  opacity: 0.14;
}

/* Checklist cards - pill hover and active state */
.section-container label.group {
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.section-container label.group:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.12);
}

.section-container label.group input[type="checkbox"]:checked+span,
.section-container label.group input[type="checkbox"]:checked~span {
  color: var(--color-primary);
  font-weight: 700;
}

/* Submit button prominence inside forms */
.card.max-w-3xl .btn-primary {
  padding: 14px 18px;
  font-size: 1.03rem;
  border-radius: 12px;
  letter-spacing: 0.2px;
}

/* Signature improvements */
.signature-placeholder {
  font-size: 0.98rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.signature-container {
  min-height: 160px;
}

/* Photo grid hover / focus */
.photo-grid .photo-item img {
  transition: transform .18s ease, box-shadow .18s ease;
}

.photo-grid .photo-item img:hover {
  transform: scale(1.03);
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.18);
}

/* Compact mobile layout for technician forms */
/* Accessibility: ensure contrast for helpers on small screens */
/* End of technician form polish */

/* ==========================
   Back button (pill) design
   Used for "Change Location" and "Back to Dashboard"
   ========================== */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.06);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.btn-back:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(2, 6, 23, 0.09);
}

.btn-back:active {
  transform: translateY(0);
}

.btn-back-icon i {
  width: 16px;
  height: 16px;
  display: inline-block;
}

.btn-back-text {
  font-size: 0.95rem;
}

.safi-nudge-field select:focus,
.safi-nudge-field textarea:focus {
  border-color: rgba(47, 95, 208, 0.58);
  box-shadow: 0 0 0 3px rgba(47, 95, 208, 0.16);
}

.safi-nudge-counter {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: right;
}

.safi-nudge-sticker-row {
  margin: 0.15rem 0 0.2rem;
  display: flex;
  gap: 0.35rem;
  justify-content: center;
}

.safi-nudge-sticker-row span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(47, 95, 208, 0.1);
  font-size: 0.95rem;
  animation: safi-nudge-sticker-float 2.4s ease-in-out infinite;
}

.safi-nudge-sticker-row span:nth-child(2) {
  animation-delay: 0.18s;
}

.safi-nudge-sticker-row span:nth-child(3) {
  animation-delay: 0.36s;
}

.safi-nudge-sticker-row span:nth-child(4) {
  animation-delay: 0.54s;
}

.safi-nudge-sticker-row span:nth-child(5) {
  animation-delay: 0.72s;
}

.safi-nudge-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.2rem;
}

.safi-nudge-quick-row .btn {
  border-radius: 999px;
  border-color: rgba(47, 95, 208, 0.22);
  background: rgba(47, 95, 208, 0.08);
  font-weight: 600;
}

.safi-nudge-quick-row .btn:hover {
  background: rgba(47, 95, 208, 0.16);
  border-color: rgba(47, 95, 208, 0.45);
}

@keyframes safi-nudge-bob {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

@keyframes safi-nudge-sparkle {

  0%,
  100% {
    transform: scale(0.95);
    opacity: 0.6;
  }

  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes safi-nudge-launcher-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.46);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

@keyframes safi-nudge-sticker-float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

/* User Menu */
.user-menu {
  position: relative;
}

.user-avatar-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--color-primary);
  color: white;
  font-size: 0.775rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  overflow: hidden;
}

/* Photo inside the header avatar circle */
.user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-full);
  display: block;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  width: 220px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--transition-fast), visibility var(--transition-fast), transform var(--transition-fast);
  z-index: var(--z-dropdown);
  padding: var(--space-1) 0;
}

.user-menu.active .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-header {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-1);
}

.user-name {
  display: block;
  font-weight: 600;
  font-size: var(--type-sm);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.user-email {
  display: block;
  font-size: var(--type-xs);
  color: var(--text-muted);
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-1) 0;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 9px var(--space-3);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--type-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  border-radius: 0;
}

.user-dropdown-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.user-dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.user-dropdown-item-danger {
  color: var(--color-danger);
}

.user-dropdown-item-danger:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

/* ===== SIDEBAR ===== */
/* sidebar sits beneath modals which share --z-modal, avoid overlap */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  z-index: var(--z-sticky);
  pointer-events: none;
}

.sidebar.active {
  pointer-events: auto;
}

.sidebar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.sidebar.active .sidebar-overlay {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-nav {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--transition-base);
  overflow: hidden;
}

.sidebar.active .sidebar-nav {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.5rem;
  border-bottom: none;
  font-weight: 550;
  font-size: 1rem;
  flex-shrink: 0;
  min-width: 0;
}

.sidebar-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.sidebar-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-toggle-btn svg {
  width: 16px;
  height: auto;
}

.sidebar-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

/* Small floating page label (icon + text) placed just to the right of the sidebar */
.page-label {
  position: fixed;
  top: 16px;
  left: calc(var(--sidebar-width) + 12px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  background: transparent;
  pointer-events: none;
  z-index: calc(var(--z-modal) - 1);
}

.page-label .page-label-icon svg,
.page-label .page-label-icon img,
.page-label .page-label-icon i {
  width: 18px;
  height: 18px;
  display: block;
  opacity: 0.95;
}

.page-label .page-label-text {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-primary);
  line-height: 1;
}

.sidebar-close:hover {
  background: var(--bg-tertiary);
}

/* Scrollable nav sections container */
.sidebar-nav-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 0.5rem;
}

.sidebar-nav-content::-webkit-scrollbar {
  width: 5px;
}

.sidebar-nav-content::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.sidebar-nav-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.nav-section {
  padding: 0 var(--space-1) !important;
}

.nav-section-title {
  display: block;
  font-size: var(--type-xxs);
  font-weight: 550;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-1);
  margin-top: var(--space-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  height: 30px;
  padding: 0 var(--space-2) 0 var(--space-2);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--type-md);
  font-weight: 550;
  border-radius: var(--btn-radius);
  cursor: pointer;
  transition: background var(--transition-fast);
  margin-bottom: 1px;
}

.nav-item:hover {
  background: var(--bg-hover);
}

.nav-item.active {
  background: var(--bg-tertiary);
}


/* ===== SIDEBAR ICONS ===== */

.nav-item svg {
  width: var(--icon-md);
  height: var(--icon-md);
  color: var(--text-muted);
  opacity: 1;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item .nav-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0 5px;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #fff;
  margin-left: auto;
  flex-shrink: 0;
}


.sidebar-footer {
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
}

.sidebar-footer-logo {
  height: 24px;
  width: auto;
  opacity: 0.8;
  display: block;
  /* Light mode: grayish black */
  filter: grayscale(100%) brightness(20%) contrast(120%);
  transition: all var(--transition-base);
}

[data-theme="dark"] .sidebar-footer-logo {
  /* Dark mode: grayish white */
  filter: grayscale(100%) brightness(200%) contrast(80%);
  opacity: 0.9;
}

/* ── Workspace button (sidebar header) ── */
.ws-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--btn-radius);
  color: var(--text-primary);
  text-align: left;
  transition: background var(--transition-fast);
  user-select: none;
  -webkit-user-select: none;
}

.ws-btn:hover {
  background: var(--bg-hover);
}

.ws-btn-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: var(--btn-radius);
  background: var(--accent, #6366f1);
  color: #fff;
  font-size: var(--type-xs);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  overflow: hidden;
}

/* Org logo image inside the sidebar workspace button */
.ws-btn-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--btn-radius);
  display: block;
}

.ws-btn-name {
  flex: 1;
  min-width: 0;
  font-size: var(--type-lg);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.ws-btn-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.ws-btn.open .ws-btn-chevron {
  transform: rotate(180deg);
}

/* ── Workspace dropdown menu ── */
.ws-menu {
  position: fixed;
  z-index: 10050;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1);
  min-width: 220px;
}

.ws-menu-org-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
}

.ws-menu-org-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: var(--btn-radius);
  background: var(--accent, #6366f1);
  color: #fff;
  font-size: var(--type-sm);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  overflow: hidden;
}

.ws-menu-org-name {
  font-size: var(--type-md);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-1) 0;
}

.ws-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  height: var(--control-height-sm);
  padding: 0 var(--space-3);
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: var(--type-md);
  font-weight: 550;
  border-radius: var(--btn-radius);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.ws-menu-item:hover {
  background: var(--bg-hover);
}

.ws-menu-item svg {
  flex-shrink: 0;
  color: var(--text-secondary);
}

.ws-menu-item--danger {
  color: var(--color-danger);
}

.ws-menu-item--danger svg {
  color: var(--color-danger);
}

.ws-menu-item--danger:hover {
  background: var(--color-danger-bg);
}


/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-top: var(--header-height);
  margin-bottom: var(--bottom-nav-height);
  padding: 1.25rem 0.875rem;
  overflow-x: hidden;
  transition: margin-left 0.3s ease, max-width 0.3s ease;
  background: var(--bg-secondary);
}

/* ===== BOTTOM NAVIGATION (Mobile) ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0.5rem 1rem;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  z-index: var(--z-fixed);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 550;
  cursor: pointer;
  transition: all var(--transition-base);
  border-radius: 8px;
}

.bottom-nav-item i {
  font-size: 1.25rem;
}

.bottom-nav-item.active {
  color: var(--color-primary);
  background: var(--color-primary-bg);
}

.bottom-nav-item:hover {
  color: var(--text-primary);
  border-color: var(--border-color-light);
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

/* dark theme override for cards */
[data-theme="dark"] .card {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

/* muted copy inside cards uses secondary text in dark mode for legibility */
[data-theme="dark"] .card .text-muted {
  color: var(--text-secondary);
}

/* ensure page headers have a softer divider in dark mode */
[data-theme="dark"] .page-header {
  border-bottom-color: var(--border-color-light);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: var(--type-md);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-subtitle {
  font-size: var(--type-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-color);
}

.page-header.flex {
  align-items: flex-start;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.page-title {
  font-size: var(--type-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0;
  letter-spacing: -0.02em;
}

.page-subtitle {
  display: none;
}

.view-header-minimal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-color);
}

.view-breadcrumb {
  display: flex;
  align-items: center;
}

.view-breadcrumb span {
  font-size: var(--type-xl);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Shared page shell helpers for consistent module structure */
.crm-page-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.crm-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.crm-page-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.crm-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}



/* ===== FORM ELEMENTS ===== */
button {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
}

input,
select,
textarea {
  width: 100%;
  height: var(--control-height-md);
  padding: 0 var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius);
  font-size: var(--type-md);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-secondary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

textarea {
  height: auto;
  min-height: 80px;
  padding: var(--space-3);
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-bg);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: var(--icon-md);
  padding-right: var(--space-8);
}

/* ===== VISIT CARD ===== */
.visit-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  transition: border-color var(--transition-fast);
}

.visit-card:hover {
  border-color: var(--color-primary);
}

.visit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.visit-company {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.visit-date {
  font-size: 0.9rem;
  color: white
}

.visit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.visit-meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 1rem;
  color: var(--text-secondary);
}

.visit-meta-item i {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.visit-notes {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
  background: var(--bg-tertiary);
  padding: 0.875rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
}

.visit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ===== TAGS ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: var(--control-height-xs);
  padding: 0 var(--space-2);
  background: var(--color-primary-bg);
  color: var(--color-primary);
  font-size: var(--type-xs);
  font-weight: 550;
  border-radius: var(--radius-xs);
  line-height: 1;
}

.tag-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.7;
}

.tag-remove:hover {
  opacity: 1;
}

/* ===== AI INSIGHT ===== */
.ai-insight {
  background: linear-gradient(135deg, rgba(26, 55, 186, 0.15) 0%, rgba(73, 11, 181, 0.1) 100%);
  border: 1px solid rgba(120, 120, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 0.75rem;
}

[data-theme="dark"] .ai-insight {
  background: linear-gradient(135deg, rgba(26, 55, 186, 0.15) 0%, rgba(73, 11, 181, 0.1) 100%);
  border-color: rgba(120, 120, 255, 0.3);
}

.ai-insight-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: #00035f;
}

[data-theme="dark"] .ai-insight-header {
  color: rgb(226, 239, 255);
}

.ai-insight-content {
  font-size: 1rem;
  color: #00035f;
  line-height: 1.5;
}

[data-theme="dark"] .ai-insight-content {
  color: rgb(226, 239, 255);
}

/* ===== LEAD SCORE BADGE ===== */
.lead-score-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: var(--control-height-xs);
  padding: 0 var(--space-2);
  border-radius: var(--radius-xs);
  font-size: var(--type-sm);
  font-weight: 600;
  line-height: 1;
}

.lead-score-badge.high {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.lead-score-badge.medium {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.lead-score-badge.low {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

/* ===== FUNNEL ===== */
.funnel-hub {
  min-height: calc(100vh - 120px);
}

/* ===== FUNNEL HERO STATS ===== */
.funnel-hero {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.funnel-hero-stat {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  position: relative;
  transition: border-color var(--transition-fast);
}

.funnel-hero-stat:hover {
  border-color: var(--color-primary);
}

.funnel-stat-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.funnel-stat-content {
  flex: 1;
  min-width: 0;
}

.funnel-stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.funnel-stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.funnel-stat-trend {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--type-sm);
  font-weight: 600;
  padding: 0 var(--space-2);
  height: var(--control-height-xs);
  border-radius: var(--radius-xs);
}

.funnel-stat-trend.positive {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.funnel-stat-trend.negative {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

/* ===== FUNNEL MAIN GRID ===== */
.funnel-main-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
}

.funnel-main-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ===== SECTION TITLES ===== */
.funnel-section-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.funnel-section-title svg {
  color: var(--text-muted);
}

/* ===== VISUAL FUNNEL ===== */
.funnel-visual-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

.funnel-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.funnel-level {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.funnel-level-bar {
  width: var(--funnel-width);
  height: 56px;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-medium);
}

.funnel-level:hover .funnel-level-bar {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.funnel-level-fill {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
}

.funnel-level-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  color: white;
  z-index: 1;
}

.funnel-level-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}

.funnel-level-title {
  font-size: 0.9375rem;
  font-weight: 600;
  flex: 1;
  margin-left: 0.75rem;
}

.funnel-level-count {
  font-size: 1.25rem;
  font-weight: 700;
  margin-right: 0.5rem;
}

.funnel-level-percent {
  font-size: 0.8125rem;
  font-weight: 550;
  opacity: 0.85;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
}

.funnel-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  color: var(--text-muted);
  opacity: 0.5;
}

/* ===== CONVERSION FLOW ===== */
.funnel-conversion-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

.conversion-flow {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.conversion-step {
  display: grid;
  grid-template-columns: 140px 1fr 60px;
  align-items: center;
  gap: 1rem;
}

.conversion-step-label {
  font-size: 0.9375rem;
  font-weight: 550;
  color: var(--text-secondary);
}

.conversion-step-bar {
  height: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.conversion-step-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

.conversion-step-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
}

/* ===== FUNNEL STAGE CARDS ===== */
.funnel-stages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.funnel-stage-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  transition: border-color var(--transition-fast);
}

.funnel-stage-card:hover {
  border-color: var(--stage-color);
}

.funnel-stage-card-header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1rem;
}

.funnel-stage-card-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  color: white;
  flex-shrink: 0;
}

.funnel-stage-card-info {
  flex: 1;
  min-width: 0;
}

.funnel-stage-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.funnel-stage-card-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.funnel-stage-card-badge {
  font-size: var(--type-md);
  font-weight: 700;
  color: var(--stage-color);
  background: color-mix(in srgb, var(--stage-color) 12%, transparent);
  padding: 0 var(--space-2);
  height: var(--control-height-xs);
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-xs);
}

.funnel-stage-card-progress {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 1rem;
}

.funnel-stage-card-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.funnel-stage-card-items {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.funnel-stage-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.funnel-stage-item-company {
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.funnel-stage-item-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.funnel-stage-card-empty {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

/* ===== FUNNEL SIDEBAR ===== */
.funnel-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.funnel-sidebar-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.funnel-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.funnel-sidebar-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.funnel-sidebar-title svg {
  color: var(--text-muted);
}

.funnel-sidebar-badge {
  font-size: var(--type-sm);
  font-weight: 600;
  color: white;
  background: var(--color-primary);
  padding: 0 var(--space-2);
  height: 22px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-xs);
}

.funnel-sidebar-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  max-height: 320px;
  overflow-y: auto;
}

.funnel-sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

.funnel-sidebar-empty svg {
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.funnel-sidebar-empty p {
  font-weight: 550;
  margin-bottom: 0.25rem;
}

.funnel-sidebar-empty span {
  font-size: 0.8125rem;
}

/* ===== HOT LEAD ITEMS ===== */
.hot-lead-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-primary);
  border-radius: var(--btn-radius);
  transition: background var(--transition-fast);
}

.hot-lead-item:hover {
  background: var(--bg-hover);
}

.hot-lead-avatar {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: white;
  font-size: var(--type-xs);
  font-weight: 600;
  border-radius: var(--btn-radius);
  flex-shrink: 0;
}

.hot-lead-info {
  flex: 1;
  min-width: 0;
}

.hot-lead-company {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hot-lead-contact {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.hot-lead-score {
  font-size: var(--type-md);
  font-weight: 700;
  padding: 0 var(--space-2);
  height: var(--control-height-xs);
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-xs);
}

.hot-lead-score.score-hot {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(249, 115, 22, 0.15));
  color: #ef4444;
}

.hot-lead-score.score-warm {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

/* ===== FUNNEL ACTIVITY TIMELINE ===== */
.funnel-activity-timeline {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.funnel-activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--btn-radius);
  transition: background var(--transition-fast);
}

.funnel-activity-item:hover {
  background: var(--bg-hover);
}

.funnel-activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 0.375rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 15%, transparent);
}

.funnel-activity-content {
  flex: 1;
  min-width: 0;
}

.funnel-activity-company {
  display: block;
  font-size: 0.9375rem;
  font-weight: 550;
  color: var(--text-primary);
}

.funnel-activity-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.funnel-activity-stage {
  font-size: 0.8125rem;
  font-weight: 550;
}

.funnel-activity-time {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.funnel-activity-time::before {
  content: '•';
  margin-right: 0.5rem;
  color: var(--border-color);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1280px) {
  .funnel-main-grid {
    grid-template-columns: 1fr 340px;
  }
}

@media (max-width: 1024px) {
  .funnel-main-grid {
    grid-template-columns: 1fr;
  }

  .funnel-sidebar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* ===== SIDEBAR QUICK ACTIONS BUTTONS ===== */
.sidebar-quick-actions {
  padding: var(--space-1) var(--space-2) var(--space-1);
  display: flex;
  flex-direction: row;
  gap: var(--space-1);
  flex-shrink: 0;
  border-bottom: none;
}

.sidebar-action-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-2);
  height: var(--control-height-xs);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius);
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--type-xs);
  font-family: inherit;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  line-height: 1;
  white-space: nowrap;
}

/* Quick Actions takes more space, Search is compact */
.sidebar-action-btn:first-child {
  flex: 1;
  min-width: 0;
}

.sidebar-action-btn:last-child {
  flex: 0 0 auto;
}

.sidebar-action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.sidebar-action-btn svg {
  flex-shrink: 0;
  opacity: 0.55;
}

.sidebar-action-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-kbd {
  font-family: inherit;
  font-size: 10px;
  font-weight: 550;
  padding: 1px 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-muted);
  line-height: 1.4;
  flex-shrink: 0;
}


/* ===== QUICK ACTIONS MODAL (⌘K) ===== */
.qa-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
}

.qa-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
}

.qa-container {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: qa-in 0.15s var(--motion-ease-emphasized);
}

@keyframes qa-in {
  from { opacity: 0; transform: scale(0.97) translateY(-6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.qa-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-color);
}

.qa-header input {
  flex: 1;
  border: none !important;
  background: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none !important;
  box-shadow: none !important;
  height: 28px;
  line-height: 28px;
  padding: 0;
  margin: 0;
  border-radius: 0;
}

.qa-header input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.qa-header-kbd {
  font-family: inherit;
  font-size: 11px;
  font-weight: 550;
  padding: 3px 7px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1;
}

.qa-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 16px 4px;
  opacity: 0.7;
}

.qa-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 4px 6px 6px;
}

.qa-results::-webkit-scrollbar { width: 4px; }
.qa-results::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.qa-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--btn-radius);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.qa-item:hover,
.qa-item.active {
  background: var(--bg-hover);
}

.qa-item-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.qa-item.active .qa-item-icon {
  background: var(--color-primary-bg);
  border-color: rgba(var(--color-primary-rgb), 0.2);
  color: var(--color-primary);
}

.qa-item-title {
  flex: 1;
  font-size: 14px;
  font-weight: 550;
  color: var(--text-primary);
}

.qa-item-shortcut {
  font-family: inherit;
  font-size: 11px;
  font-weight: 550;
  padding: 1px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-muted);
}

.qa-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.qa-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.qa-footer-hint {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}

.qa-footer-hint kbd, .qa-footer-action kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 0 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-muted);
  line-height: 1.5;
}

.qa-footer-action {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-secondary);
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
}

.qa-footer-action kbd {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
}


/* ===== SEARCH RECORDS MODAL (/) ===== */
.sr-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

.sr-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
}

.sr-container {
  position: relative;
  width: 100%;
  max-width: 740px;
  margin: 0 var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 520px;
  animation: qa-in 0.15s var(--motion-ease-emphasized);
}

.sr-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sr-header input {
  flex: 1;
  border: none !important;
  background: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none !important;
  box-shadow: none !important;
  height: 28px;
  line-height: 28px;
  padding: 0;
  margin: 0;
  border-radius: 0;
}

.sr-header input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.sr-header-kbd {
  font-family: inherit;
  font-size: 11px;
  font-weight: 550;
  padding: 3px 7px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1;
}

.sr-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sr-results-pane {
  width: 50%;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sr-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 14px 4px;
  opacity: 0.7;
  flex-shrink: 0;
}

.sr-results {
  flex: 1;
  overflow-y: auto;
  padding: 4px 6px 6px;
}

.sr-results::-webkit-scrollbar { width: 4px; }
.sr-results::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.sr-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--btn-radius);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sr-item:hover,
.sr-item.active {
  background: var(--bg-hover);
}

.sr-item-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
}

.sr-item-info {
  flex: 1;
  min-width: 0;
}

.sr-item-name {
  display: block;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-item-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
  flex-shrink: 0;
  white-space: nowrap;
}

.sr-badge-company {
  background: #e8edff;
  color: #3b5bdb;
}

[data-theme="dark"] .sr-badge-company {
  background: rgba(59, 91, 219, 0.18);
  color: #7b9cff;
}

.sr-badge-person {
  background: #e9f5ee;
  color: #1a7f45;
}

[data-theme="dark"] .sr-badge-person {
  background: rgba(26, 127, 69, 0.18);
  color: #5bd187;
}

.sr-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Preview Pane */
.sr-preview-pane {
  width: 50%;
  padding: 16px;
  overflow-y: auto;
}

.sr-preview-pane::-webkit-scrollbar { width: 4px; }
.sr-preview-pane::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.sr-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 13px;
}

.sr-preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.sr-preview-favicon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  object-fit: contain;
  background: #fff;
}

.sr-preview-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sr-preview-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.sr-preview-meta-badge {
  font-size: 11px;
  font-weight: 550;
  color: var(--text-muted);
  margin-top: 1px;
}

.sr-preview-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
  opacity: 0.7;
}

.sr-preview-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.sr-preview-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  opacity: 0.6;
  margin-top: 1px;
}

.sr-preview-val {
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-word;
}

.sr-preview-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.sr-preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sr-tag {
  font-size: 11px;
  font-weight: 550;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-secondary);
}

.sr-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
  flex-shrink: 0;
}

.sr-footer-hint {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}

.sr-footer-hint kbd, .sr-footer-action kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 0 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-muted);
  line-height: 1.5;
}

.sr-footer-action {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 550;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
}

.sr-footer-action kbd {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
}

/* Search Records - responsive: hide preview pane on small screens */
/* ===== MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  animation: backdrop-fade-in var(--transition-slow) ease;
}

@keyframes backdrop-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-container {
  position: relative;
  width: 100%;
  margin-bottom: 0;
  max-height: 90vh;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow: hidden;
  animation: modal-slide-up 0.3s var(--motion-ease-emphasized);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
}

@keyframes modal-slide-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.modal-header h3 {
  font-size: var(--type-md);
  font-weight: 550;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-primary);
}

.modal-header h3 svg,
.modal-header h3 i {
  color: var(--color-primary);
  font-size: var(--type-md);
}

.modal-close {
  width: var(--control-height-sm);
  height: var(--control-height-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--btn-radius);
  cursor: pointer;
}

/* Company view summary enhancements */
.company-summary {
  padding: 12px 0;
}

.company-summary-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.company-summary-avatar {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.company-summary-avatar img.company-summary-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.company-summary-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-inverse);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
}

.company-summary-main {
  flex: 1 1 auto;
  min-width: 0;
}

.company-summary-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-summary-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.company-summary-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.company-summary-stats {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.company-summary-stats .stat {
  background: var(--bg-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  text-align: center;
  min-width: 84px;
}

.stat-value {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.company-summary-desc {
  margin-top: 12px;
  color: var(--text-primary);
  font-size: 0.95rem;
  max-height: 72px;
  overflow: hidden;
}

.company-summary-tags {
  margin-top: 8px;
}

.company-summary-tags .tag {
  display: inline-block;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  padding: 0 var(--space-2);
  height: var(--control-height-xs);
  line-height: var(--control-height-xs);
  border-radius: var(--radius-xs);
  font-size: var(--type-xs);
  margin-right: var(--space-1);
}

@media (max-width: 880px) {
  .modal-container.modal-size-xl {
    width: 100%;
    border-radius: 12px;
  }

  .company-view-sidebar {
    display: none;
  }
}

/* Company tabs: lists and items */
.company-opps-list,
.company-call-list,
.company-visits-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0.25rem 1rem 1rem 1rem;
}

.company-opp,
.call-item,
.visit-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.company-opp-main,
.call-item-left,
.visit-main {
  flex: 1 1 auto;
  min-width: 0;
}

.call-item {
  align-items: center;
}

.call-item-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.call-item-date {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.call-item-contact {
  font-size: 0.95rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-item-mid {
  flex: 0 0 140px;
  text-align: right;
  font-weight: 550;
  color: var(--text-primary);
}

.call-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.visit-title {
  font-weight: 600;
}

.company-opp-title,
.visit-title {
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-opp-meta,
.call-item-mid,
.visit-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.company-opp-actions,
.call-item-right,
.visit-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.outcome-badge-small {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Smaller screens: compact spacing */
.modal-close:hover {
  background: var(--bg-tertiary);
}

.modal-close:active {
  background: var(--bg-tertiary);
}

.modal-body {
  padding: var(--space-5);
  overflow-y: auto;
  max-height: calc(87vh - 140px);
  background: var(--bg-secondary);
}

/* Form Sections */
.form-section {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}

.form-section:last-child {
  margin-bottom: 0;
}

.form-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-color-light);
}

.form-section-icon {
  width: var(--icon-md);
  height: var(--icon-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border-radius: var(--radius-xs);
  font-size: var(--type-md);
}

.form-section-title {
  font-size: var(--type-md);
  font-weight: 550;
  color: var(--text-primary);
}

.form-section-description {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Enhanced Form Fields */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.form-field:last-child {
  margin-bottom: 0;
}

.form-field label {
  font-size: var(--type-md);
  font-weight: 550;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.form-field label .required-indicator {
  color: var(--color-danger);
  font-weight: 700;
}

.form-field label .field-hint {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
}

.form-field label .optional-badge {
  font-size: 0.65rem;
  font-weight: 550;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
}

.field-helper {
  font-size: 0.9125rem;
  color: var(--text-muted);
  margin-top: -0.25rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.field-helper i {
  font-size: 0.85rem;
}

/* Enhanced Input Styling */
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  height: var(--control-height-md);
  padding: 0 var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius);
  font-size: var(--type-md);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-secondary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-field textarea {
  height: auto;
  min-height: 80px;
  padding: var(--space-3);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-bg);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--text-muted);
}

.form-field input:disabled,
.form-field select:disabled,
.form-field textarea:disabled {
  background: var(--bg-tertiary);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Improve contrast for input borders in light mode (non-dark theme) */
:where(html, body):not([data-theme="dark"]) .form-field input,
:where(html, body):not([data-theme="dark"]) .form-field select,
:where(html, body):not([data-theme="dark"]) .form-field textarea,
:where(html, body):not([data-theme="dark"]) .categories-input,
:where(html, body):not([data-theme="dark"]) .competitors-input,
:where(html, body):not([data-theme="dark"]) .phone-number {
  border-color: rgba(15, 20, 25, 0.12);
}

/* Dark-mode: increase input border visibility */
[data-theme="dark"] .form-field input,
[data-theme="dark"] .form-field select,
[data-theme="dark"] .form-field textarea,
[data-theme="dark"] .categories-input,
[data-theme="dark"] .competitors-input,
[data-theme="dark"] .phone-number {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Input with Icon */
.input-with-icon {
  position: relative;
}

.input-with-icon i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.input-with-icon input {
  padding-left: 2.75rem;
}

/* Field Groups */
.field-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field-group-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

/* Progressive Disclosure */
.advanced-options {
  margin-top: 1rem;
}

.advanced-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--text-secondary);
  width: 100%;
  justify-content: center;
}

.advanced-toggle:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.advanced-toggle i {
  transition: transform var(--transition-fast);
}

.advanced-toggle.active i {
  transform: rotate(180deg);
}

.advanced-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.advanced-content.show {
  max-height: 1000px;
  margin-top: 1rem;
}

.modal-footer {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  justify-content: flex-end;
}

.modal-footer .btn {
  flex: 0 0 auto;
  min-width: 80px;
}

.modal-footer .btn-primary {
  background: var(--color-primary);
  color: var(--text-inverse);
  border-color: transparent;
}

.modal-footer .btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

.modal-footer .btn-primary:active:not(:disabled) {
  background: var(--color-primary-dark);
}

.modal-footer .btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.modal-footer .btn-secondary:hover:not(:disabled) {
  background: var(--bg-tertiary);
}

.modal-footer .btn-danger {
  background: var(--color-danger);
  color: var(--text-inverse);
  border-color: transparent;
}

.modal-footer .btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.modal-footer-with-option {
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.modal-footer-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.modal-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.add-more-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.add-more-label {
  line-height: 1;
}

.ios-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.ios-toggle input[type="checkbox"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.ios-toggle-slider {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--border-color);
  transition: background-color 0.2s ease;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-muted) 30%, transparent);
}

.ios-toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 20, 25, 0.22);
  transition: transform 0.2s ease;
}

.ios-toggle input[type="checkbox"]:checked+.ios-toggle-slider {
  background: var(--color-primary);
}

.ios-toggle input[type="checkbox"]:checked+.ios-toggle-slider::after {
  transform: translateX(18px);
}

.ios-toggle input[type="checkbox"]:focus-visible+.ios-toggle-slider {
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.duplicate-warning {
  font-size: 0.78rem;
  line-height: 1.2;
  color: var(--color-danger);
  font-weight: 600;
}

/* ==========================================================
   CRM Add-Entity Modals — Attio-inspired minimal design
   (Company, Person, Opportunity, Task, Reminder, Call-Log)
   ========================================================== */
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .modal-container {
  max-width: min(560px, 94vw) !important;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .modal-header {
  padding: 0.875rem 1.25rem;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .modal-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  gap: 0;
}

/* Hide icons inside modal header titles */
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .modal-header h3 svg,
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .modal-header h3 i {
  display: none;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .modal-body {
  padding: 1rem 1.25rem 1.25rem;
  background: var(--bg-primary);
  max-height: calc(85vh - 130px);
}

/* Flatten form sections */
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-section {
  border-radius: 0;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  background: transparent;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-section + .form-section {
  margin-top: 0.25rem;
  padding-top: 0;
  border-top: none;
}

/* Hide section headers entirely (icons + titles) */
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-section-header {
  display: none;
}

/* Compact field spacing */
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-field {
  margin-bottom: 0.75rem;
  gap: 0.3rem;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-field:last-child {
  margin-bottom: 0;
}

/* Labels: small, normal case, muted color */
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-field {
  gap: 0.1rem;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-field label {
  font-size: var(--type-md);
  font-weight: 550;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-secondary);
}

/* Required indicator: "(required)" text style */
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-field label .required-indicator {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.75rem;
}

/* Optional badge: minimal */
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-field label .optional-badge {
  display: none;
}

/* Compact inputs */
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-field input,
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-field select,
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-field textarea,
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .categories-input,
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .competitors-input,
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .phone-number {
  border-radius: var(--btn-radius);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  font-size: var(--type-md);
  font-weight: 550;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-field input:focus,
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-field select:focus,
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-field textarea:focus,
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .categories-input:focus,
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .competitors-input:focus,
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .phone-number:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-bg);
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-field input::placeholder,
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .form-field textarea::placeholder {
  font-style: normal;
  color: var(--text-muted);
}

/* Hide field helpers for cleaner look */
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .field-helper {
  display: none;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .field-group {
  gap: 0.75rem;
}

/* Compact footer */
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 0.75rem 1.25rem;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .modal-footer .btn {
  padding: 0.4rem 0.875rem;
  font-size: var(--type-md);
  border-radius: var(--btn-radius);
}

/* Category suggestions: compact */
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal) .category-suggestions {
  margin-top: 0.375rem;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal) .tag-suggestion {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
}

/* Search dropdowns inside modals: compact, unified */
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .search-container {
  margin-bottom: 0;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .search-container i,
:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .search-container svg {
  display: none;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .search-container input {
  padding-left: 0.75rem !important;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .search-results {
  top: calc(100% + 0.25rem);
  border-radius: 8px;
  max-height: 200px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .search-results .search-result-item {
  padding: 0.5rem 0.75rem;
  gap: 0.5rem;
  font-size: 0.8125rem;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .search-results .search-result-avatar {
  width: 26px;
  height: 26px;
  font-size: 0.6875rem;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .search-results .opp-suggest-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .search-results .search-result-name {
  font-size: 0.8125rem;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .live-search-results {
  top: calc(100% + 0.25rem);
  border-radius: 8px;
  max-height: 200px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .live-search-results .search-result-item {
  padding: 0.5rem 0.75rem;
  gap: 0.5rem;
  font-size: 0.8125rem;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .live-search-results .search-result-item .title {
  font-size: 0.8125rem;
  font-weight: 550;
}

:is(#company-modal, #person-modal, #opportunity-modal, #task-modal, #reminder-modal, #call-log-modal) .live-search-results .search-result-item .subtitle {
  font-size: 0.6875rem;
}

/* =========================================================
   Note / Companies Transfer modals (unchanged layout)
   ========================================================= */
:is(#note-modal, #companies-transfer-modal) .modal-container {
  border-radius: 24px;
  border: 1px solid var(--border-color);
  box-shadow: 0 18px 48px rgba(10, 22, 45, 0.2);
}

#note-modal .modal-container {
  max-width: min(760px, 94vw) !important;
}

#companies-transfer-modal .modal-container {
  max-width: min(820px, 95vw) !important;
}

:is(#note-modal, #companies-transfer-modal) .modal-header {
  padding: 0.8rem 1.2rem;
  background: linear-gradient(145deg, var(--bg-primary), var(--bg-secondary));
}

:is(#note-modal, #companies-transfer-modal) .modal-header h3 {
  font-size: 1.1rem;
  font-weight: 550;
}

:is(#note-modal, #companies-transfer-modal) .modal-body {
  padding: 1.5rem 1.5rem 1.4rem;
  background: linear-gradient(to bottom, var(--bg-secondary), var(--bg-primary));
  max-height: calc(88vh - 148px);
}

:is(#note-modal, #companies-transfer-modal) .form-section {
  border-radius: 16px;
  border: 1px solid var(--border-color-light);
  box-shadow: 0 1px 2px rgba(10, 22, 45, 0.04), 0 8px 22px rgba(10, 22, 45, 0.06);
  padding: 1.1rem;
  margin-bottom: 0.9rem;
}

:is(#note-modal, #companies-transfer-modal) .form-section-header {
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
}

:is(#note-modal, #companies-transfer-modal) .form-section-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

:is(#note-modal, #companies-transfer-modal) .form-field {
  margin-bottom: 0.95rem;
}

:is(#note-modal, #companies-transfer-modal) .form-field label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
  color: var(--text-secondary);
}

:is(#note-modal, #companies-transfer-modal) .form-field input,
:is(#note-modal, #companies-transfer-modal) .form-field select,
:is(#note-modal, #companies-transfer-modal) .form-field textarea,
#note-modal .note-content-editable {
  border-radius: 12px;
  border-width: 1px;
  padding: 0.75rem 0.9rem;
  background: var(--bg-primary);
}

:is(#note-modal, #companies-transfer-modal) .form-field input:focus,
:is(#note-modal, #companies-transfer-modal) .form-field select:focus,
:is(#note-modal, #companies-transfer-modal) .form-field textarea:focus,
#note-modal .note-content-editable:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

:is(#note-modal, #companies-transfer-modal) .field-helper {
  font-size: 0.76rem;
}

:is(#note-modal, #companies-transfer-modal) .modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 0.9rem 1.5rem;
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
}

/* =========================================================
   Call Log Modal — redesigned
   ========================================================= */
#call-log-modal .modal-container {
  max-width: min(760px, 95vw);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

/* Header */
#call-log-modal .clm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.clm-header-inner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.clm-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  flex-shrink: 0;
}

#call-log-modal .clm-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* Body */
#call-log-modal .clm-body {
  padding: 1.25rem 1.5rem;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(88vh - 130px);
  overflow-y: auto;
}

/* Two-column row */
.clm-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
}

/* Three-column meta row */
.clm-meta-row {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 0.875rem;
  align-items: end;
}

/* Field */
.clm-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

/* Label */
.clm-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.clm-label svg {
  opacity: 0.7;
  flex-shrink: 0;
}

/* Base input */
.clm-input {
  width: 100%;
  padding: 0.6rem 0.875rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  box-sizing: border-box;
}

.clm-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.clm-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.clm-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Direction toggle */
.clm-direction-group {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  padding: 3px;
  gap: 3px;
}

.clm-dir-option {
  flex: 1;
}

.clm-dir-option input {
  display: none;
}

.clm-dir-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  user-select: none;
  border-radius: 7px;
}

.clm-dir-chip:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.clm-dir-chip svg {
  opacity: 0.6;
  transition: opacity 0.15s;
}

.clm-dir-option input:checked+.clm-dir-chip {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.clm-dir-option input:checked+.clm-dir-chip svg {
  opacity: 1;
}

.clm-dir-option:not(:last-child) .clm-dir-chip {
  border-right: none;
}

/* Outcome grid */
.clm-outcome-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.clm-outcome-option {
  display: block;
}

.clm-outcome-option input {
  display: none;
}

.clm-outcome-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 8px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s, box-shadow 0.12s;
  user-select: none;
  line-height: 1;
}

.clm-outcome-chip:hover {
  border-color: var(--color-primary);
  color: var(--text-primary);
}

/* Connected */
.clm-outcome-option input:checked+.clm-outcome--connected {
  background: #e8f9d0;
  color: #2f6700;
  border-color: #7bc63a;
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(100, 192, 50, 0.18);
}

/* Voicemail */
.clm-outcome-option input:checked+.clm-outcome--voicemail {
  background: #eeeaff;
  color: #412ead;
  border-color: #9080e0;
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(130, 100, 230, 0.18);
}

/* No Answer */
.clm-outcome-option input:checked+.clm-outcome--noanswer {
  background: #e6e8ec;
  color: #2e323c;
  border-color: #788090;
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(110, 120, 140, 0.18);
}

/* Busy */
.clm-outcome-option input:checked+.clm-outcome--busy {
  background: #fff3d0;
  color: #7a4a00;
  border-color: #d4960a;
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(215, 155, 10, 0.18);
}

/* Wrong Number */
.clm-outcome-option input:checked+.clm-outcome--wrong {
  background: #fde8e8;
  color: #7a1010;
  border-color: #d04040;
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(210, 60, 60, 0.18);
}

/* Call Failed */
.clm-outcome-option input:checked+.clm-outcome--failed {
  background: #fff0ec;
  color: #95320a;
  border-color: #d05c20;
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(210, 90, 30, 0.18);
}

/* Footer */
#call-log-modal .clm-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.9rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.clm-save-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Dark mode adjustments */
[data-theme="dark"] .clm-input {
  background: #1a1e24;
  border-color: #2d343e;
  color: #c9d1d9;
}

[data-theme="dark"] .clm-input:focus {
  border-color: var(--color-primary);
}

[data-theme="dark"] .clm-direction-group {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}

[data-theme="dark"] #call-log-modal .clm-header {
  background: #161b22;
  border-bottom-color: #2d343e;
}

[data-theme="dark"] #call-log-modal .clm-body {
  background: #0d1117;
}

[data-theme="dark"] #call-log-modal .clm-footer {
  background: #161b22;
  border-top-color: #2d343e;
}

[data-theme="dark"] .clm-outcome-chip {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-muted);
}

[data-theme="dark"] .clm-outcome-option input:checked+.clm-outcome--connected {
  background: rgba(100, 200, 50, 0.12);
  color: #88d040;
  border-color: #5fa020;
}

[data-theme="dark"] .clm-outcome-option input:checked+.clm-outcome--voicemail {
  background: rgba(120, 100, 230, 0.12);
  color: #a090e8;
  border-color: #7060c8;
}

[data-theme="dark"] .clm-outcome-option input:checked+.clm-outcome--noanswer {
  background: rgba(100, 110, 130, 0.14);
  color: #acb4c0;
  border-color: #6a7080;
}

[data-theme="dark"] .clm-outcome-option input:checked+.clm-outcome--busy {
  background: rgba(210, 150, 10, 0.12);
  color: #d4a030;
  border-color: #a07010;
}

[data-theme="dark"] .clm-outcome-option input:checked+.clm-outcome--wrong {
  background: rgba(210, 60, 60, 0.12);
  color: #e06060;
  border-color: #a02828;
}

[data-theme="dark"] .clm-outcome-option input:checked+.clm-outcome--failed {
  background: rgba(210, 90, 30, 0.12);
  color: #e08050;
  border-color: #a04010;
}

/* Responsive */
/* Remaining CRM Modals (Unified) */
:is(#change-password-modal, #route-details-modal, #location-modal, #visit-details-modal, #photo-modal) .modal-container {
  border-radius: 24px;
  border: 1px solid var(--border-color);
  box-shadow: 0 18px 48px rgba(10, 22, 45, 0.2);
}

:is(#change-password-modal, #route-details-modal, #location-modal, #visit-details-modal, #photo-modal) .modal-header {
  padding: 0.8rem 1.2rem;
  background: linear-gradient(145deg, var(--bg-primary), var(--bg-secondary));
}

:is(#change-password-modal, #route-details-modal, #location-modal, #visit-details-modal, #photo-modal) .modal-header h3 {
  font-size: 1.1rem;
  font-weight: 550;
}

:is(#change-password-modal, #route-details-modal, #location-modal, #visit-details-modal, #photo-modal) .modal-body {
  padding: 1.25rem 1.5rem 1.4rem;
  background: linear-gradient(to bottom, var(--bg-secondary), var(--bg-primary));
  max-height: calc(88vh - 148px);
}

:is(#change-password-modal, #route-details-modal, #location-modal, #visit-details-modal, #photo-modal) .modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 0.9rem 1.5rem;
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
}

:is(#change-password-modal, #route-details-modal, #visit-details-modal) .modal-body h4 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

:is(#route-details-modal, #visit-details-modal) .modal-body p {
  color: var(--text-secondary);
}

/* =========================================================
   Call Log View Modal
   ========================================================= */
/* ===== CALL LOG VIEW MODAL v2 ===== */
#call-log-view-modal .clv2-container {
  max-width: min(500px, 95vw);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.clv2-hero {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

.clv2-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.clv2-hero-info {
  flex: 1;
  min-width: 0;
  padding-top: 0.1rem;
}

.clv2-name {
  font-size: 1rem;
  font-weight: 650;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clv2-company {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clv2-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.375rem;
  flex-shrink: 0;
  padding-top: 0.1rem;
}

.clv2-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
}

.clv2-cell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.875rem 0;
  border-right: 1px solid var(--border-color-light);
  padding-right: 1rem;
  padding-left: 0;
}

.clv2-cell:first-child {
  padding-left: 0;
}

.clv2-cell:last-child {
  border-right: none;
  padding-right: 0;
  padding-left: 1rem;
}

.clv2-cell:not(:first-child):not(:last-child) {
  padding-left: 1rem;
}

.clv2-cell-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.clv2-cell-value {
  font-size: 0.8375rem;
  font-weight: 550;
  color: var(--text-primary);
  line-height: 1.4;
}

.clv2-notes {
  padding: 1rem 1.5rem;
  background: var(--bg-primary);
}

.clv2-notes-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.clv2-notes-body {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  min-height: 56px;
}

.clv2-footer {
  gap: 0.5rem;
}

[data-theme="dark"] #call-log-view-modal .clv2-container {
  border-color: #2d343e;
}

[data-theme="dark"] .clv2-hero,
[data-theme="dark"] .clv2-grid,
[data-theme="dark"] .clv2-notes {
  background: var(--bg-primary);
}

[data-theme="dark"] .clv2-notes-body {
  background: var(--bg-secondary);
}

[data-theme="dark"] .clv-header {
  background: #161b22;
  border-bottom-color: #2d343e;
}

[data-theme="dark"] .clv-hero {
  background: #0d1117;
  border-bottom-color: #2d343e;
}

[data-theme="dark"] .clv-body {
  background: #0d1117;
}

[data-theme="dark"] .clv-notes {
  background: #1a1e24;
  border-color: #2d343e;
}

[data-theme="dark"] .clv-footer {
  background: #161b22;
  border-top-color: #2d343e;
}

/* Confirm Dialog Specific Styles */
.confirm-dialog-container {
  max-width: min(480px, 92vw);
  margin: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modal-fade-in 0.15s ease;
}

.confirm-dialog-container::before {
  display: none;
}

.confirm-dialog-content {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-5);
}

.confirm-dialog-icon {
  width: var(--control-height-md);
  height: var(--control-height-md);
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-bg);
  border: 1px solid var(--border-color);
  color: var(--color-primary);
  font-weight: 700;
  font-size: var(--type-md);
  flex-shrink: 0;
}

.confirm-dialog-icon::before {
  content: '?';
}

.confirm-dialog-copy {
  min-width: 0;
}

.confirm-dialog-copy h3 {
  margin: 0;
  font-size: var(--type-lg);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.confirm-dialog-copy #confirm-message {
  margin: var(--space-2) 0 0;
  font-size: var(--type-md);
  line-height: 1.5;
  color: var(--text-secondary);
}

.confirm-helper-text {
  margin: var(--space-2) 0 0;
  font-size: var(--type-sm);
  line-height: 1.4;
  font-weight: 550;
  color: var(--text-secondary);
  display: none;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-color);
}

.confirm-dialog-actions .btn {
  min-width: 100px;
  height: var(--control-height-md);
  border-radius: var(--btn-radius);
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  padding: 0 var(--space-4);
  line-height: normal;
}

.confirm-dialog-actions .btn-secondary {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.confirm-dialog-actions .btn-secondary:hover:not(:disabled) {
  background: var(--bg-tertiary);
}

.confirm-dialog-actions .btn-primary {
  /* no special shadow */
}

.confirm-dialog-container.confirm-dialog-danger::before {
  display: none;
}

.confirm-dialog-container.confirm-dialog-danger .confirm-dialog-icon {
  background: var(--color-danger-bg);
  border-color: var(--border-color);
  color: var(--color-danger);
}

.confirm-dialog-container.confirm-dialog-danger .confirm-dialog-icon::before {
  content: '!';
}

.confirm-dialog-container.confirm-dialog-danger .confirm-helper-text {
  display: block;
  color: var(--text-secondary);
}

.confirm-dialog-container.confirm-dialog-danger .confirm-dialog-copy #confirm-message {
  color: var(--text-secondary);
}

.confirm-dialog-container.confirm-dialog-danger .confirm-dialog-actions .btn-danger {
  /* clean, no dramatic shadow */
}

/* Export format UI removed (export modal deleted) */

.export-format-option input:checked+.export-format-card i {
  color: var(--color-primary);
}

.export-format-card span {
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--text-secondary);
}

.date-range-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.date-range-btn {
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 550;
  cursor: pointer;
  transition: all var(--transition-base);
  letter-spacing: 0.2px;
}

.date-range-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  box-shadow: 0 2px 4px rgba(47, 95, 208, 0.1);
}

.date-range-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  box-shadow: 0 2px 6px rgba(47, 95, 208, 0.15);
}

.date-range-btn.active:hover {
  box-shadow: 0 4px 12px rgba(47, 95, 208, 0.25);
}

.date-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ===== REMINDERS REDESIGN ===== */
.reminder-workspace {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.reminder-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.reminder-stats-redesign {
  margin-bottom: 0;
}

.reminder-stat-card {
  position: relative;
}

.reminder-stat-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.reminder-stat-card-overdue {
  border-color: var(--color-danger);
  background: linear-gradient(0deg, var(--color-danger-bg), transparent 50%);
}

.reminder-panel {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.reminder-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.reminder-panel-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.reminder-filters {
  margin-bottom: 1rem;
}

.reminders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.reminder-card {
  margin-bottom: 0;
  border-radius: 14px;
  padding: 1rem;
}

.reminder-card.is-completed {
  border-color: var(--color-success);
  background: linear-gradient(0deg, var(--color-success-bg), transparent 60%);
}

.reminder-card.is-overdue {
  border-color: var(--color-danger);
}

.reminder-header {
  margin-bottom: 0.4rem;
}

.reminder-title {
  font-size: 1.02rem;
}

.reminder-status.pending {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.reminder-card.is-overdue .reminder-status.pending {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.reminder-description {
  margin-bottom: 0.55rem;
}

.reminder-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.reminder-meta-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.55rem;
  font-size: 0.79rem;
}

.reminder-meta-item svg,
.reminder-meta-item i {
  width: 14px;
  height: 14px;
}

.reminder-actions {
  border-top: 1px dashed var(--border-color);
  padding-top: 0.65rem;
}

.reminder-date {
  font-size: 0.75rem;
}

.reminder-action-buttons {
  gap: 0.35rem;
}

.reminder-action-btn {
  width: 34px;
  height: 34px;
}

.reminder-assigned-to {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color-light);
}

.reminder-empty-state {
  margin-top: 0.5rem;
}

.reminder-notification {
  border-radius: var(--radius-lg);
  margin-bottom: 0.85rem;
}

@media (max-width: 900px) {
  .reminder-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .reminder-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Companies import/export transfer modal */
.companies-transfer-switch {
  display: flex;
  gap: 0.5rem;
}

.companies-transfer-switch .date-range-btn {
  flex: 1;
  justify-content: center;
}

#companies-import-feedback code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}

.companies-import-errors-card {
  margin-top: 0.85rem;
  border: 1px solid var(--color-warning);
  background: var(--color-warning-bg);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
}

.companies-import-errors-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.companies-import-errors-list {
  margin: 0;
  padding-left: 1rem;
  max-height: 170px;
  overflow-y: auto;
}

.companies-import-errors-list li {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

/* ===== TOAST NOTIFICATIONS ===== */
#toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--space-4));
  left: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius);
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease, toast-out 0.2s ease var(--toast-timeout, 2700ms) forwards;
  pointer-events: auto;
}

.toast.subtle {
  border-color: var(--border-color-light);
  box-shadow: var(--shadow-xs);
}

.toast-icon {
  font-size: 1.125rem;
}

.toast.success .toast-icon {
  color: var(--color-success);
}

.toast.error .toast-icon {
  color: var(--color-danger);
}

.toast.info .toast-icon {
  color: var(--color-primary);
}

.toast-message {
  flex: 1;
  font-size: var(--type-md);
  color: var(--text-primary);
}

.ui-success-flash {
  animation: ui-success-flash 850ms ease;
}

@keyframes ui-success-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(31, 157, 110, 0);
  }

  20% {
    box-shadow: 0 0 0 3px rgba(31, 157, 110, 0.2);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(31, 157, 110, 0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(1rem);
  }
}

/* ===== LOCATION MAP ===== */
.location-map {
  height: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin-top: 0.75rem;
}

.location-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
}

.location-status.success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.location-status.error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

/* ===== PHOTO UPLOAD ===== */
.photo-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.photo-upload-area:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
}

.photo-upload-area i {
  font-size: 2rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.photo-upload-area span {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.photo-preview {
  margin-top: 1rem;
}

.photo-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-md);
}

/* ===== SALES REP LOG VISIT REDESIGN ===== */
.log-visit-shell {
  width: 100%;
}

.log-visit-flow {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.log-visit-step {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1rem 1.05rem;
  box-shadow: var(--shadow-sm);
}

.log-visit-step-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.log-visit-step-num {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-primary-bg);
  border: 1px solid color-mix(in srgb, var(--color-primary) 40%, var(--border-color));
}

.log-visit-step.is-complete .log-visit-step-num {
  color: transparent;
  background: var(--color-success);
  border-color: color-mix(in srgb, var(--color-success) 65%, var(--border-color));
  position: relative;
}

.log-visit-step.is-complete .log-visit-step-num::before {
  content: '✓';
  position: absolute;
  inset: 0;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
}

.log-visit-section-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 650;
  color: var(--text-primary);
}

.log-visit-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.log-visit-row-span {
  grid-column: 1 / -1;
}

.log-visit-selected-company {
  border: 1px solid color-mix(in srgb, var(--color-primary) 28%, var(--border-color));
  background: linear-gradient(to bottom, color-mix(in srgb, var(--color-primary-bg) 45%, transparent), var(--bg-primary));
}

.log-visit-selected-company #selected-company-name {
  font-weight: 600;
  color: var(--text-primary);
}

.log-visit-submit {
  width: min(100%, 320px);
  min-width: 0;
}

.log-visit-actionbar {
  display: flex;
  justify-content: center;
  margin-top: 0.95rem;
}

.log-visit-submit-hint {
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

.log-visit-step[data-step="1"] .location-status.success {
  border: 1px solid color-mix(in srgb, var(--color-success) 35%, transparent);
}

.log-visit-flow .location-map {
  min-height: 220px;
}

@media (max-width: 1024px) {
  .log-visit-submit {
    width: 100%;
    height: var(--control-height-lg);
  }
}

/* ===== CHART CONTAINER ===== */
.chart-container {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin: 1.5rem 0;
  height: 300px;
}

/* ===== SEARCH ===== */
.search-container {
  position: relative;
  margin-bottom: var(--space-3);
}

.search-container i,
.search-container svg {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: var(--icon-md);
  height: var(--icon-md);
  pointer-events: none;
  z-index: 1;
}

.search-container input {
  width: 100%;
  height: var(--control-height-md);
  padding: 0 var(--space-3) 0 var(--space-8) !important;
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: var(--type-md);
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-container input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-bg);
}

.search-container input::placeholder {
  color: var(--text-muted);
}

.search-results {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.search-result-item:hover {
  background: var(--bg-tertiary);
}

.search-result-avatar {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary), #7c3aed);
  color: white;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.search-result-name {
  font-weight: 550;
  color: var(--text-primary);
}

/* Company suggestion avatar in opportunity modal */
.opp-suggest-avatar {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

[data-theme="dark"] .opp-suggest-avatar {
  background: #2d343e;
  border-color: #3d4754;
}

.opp-suggest-initials {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  letter-spacing: 0.02em;
}

.opp-suggest-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
}

.opp-suggest-avatar--custom {
  background: var(--color-primary-bg);
  border-color: var(--color-primary);
}

.opp-suggest-avatar--custom span {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-primary);
  line-height: 1;
}

.opp-suggest-avatar span {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 1;
}

.opp-suggest-avatar--person {
  background: rgba(100, 120, 220, 0.1);
  border-color: rgba(100, 120, 220, 0.22);
  border-radius: 50%;
}

.opp-suggest-avatar--person span {
  color: #6478dc;
}

[data-theme="dark"] .opp-suggest-avatar--person {
  background: rgba(100, 120, 220, 0.15);
  border-color: rgba(100, 120, 220, 0.3);
}

[data-theme="dark"] .opp-suggest-avatar--person span {
  color: #8090e8;
}

.search-result-role {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-7) var(--space-5);
  text-align: center;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--type-xl);
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-2);
}

.empty-state-title {
  font-size: var(--type-md);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.empty-state-description {
  font-size: var(--type-sm);
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  max-width: 44ch;
}

.empty-state.empty-state-alert {
  border-color: color-mix(in srgb, var(--color-danger) 35%, var(--border-color));
  background: linear-gradient(to bottom, color-mix(in srgb, var(--color-danger-bg) 35%, transparent), var(--bg-primary));
}

.empty-state.empty-state-alert .empty-state-icon {
  color: var(--color-danger);
  border-color: color-mix(in srgb, var(--color-danger) 40%, var(--border-color));
  background: color-mix(in srgb, var(--color-danger-bg) 60%, var(--bg-tertiary));
}

/* ===== SKELETON LOADING ===== */
.skeleton {
  background: linear-gradient(90deg,
      var(--bg-tertiary) 18%,
      color-mix(in srgb, var(--bg-tertiary) 55%, var(--bg-primary)) 50%,
      var(--bg-tertiary) 82%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s infinite;
  border-radius: var(--radius-md);
}

.skeleton-card {
  height: 110px;
  margin-bottom: 0.9rem;
}

.skeleton-title {
  height: 20px;
  width: 58%;
  margin-bottom: 0.6rem;
}

.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: 0.45rem;
}

.skeleton-text.short {
  width: 40%;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* ===== TAGS INPUT ===== */
.tags-input-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  min-height: 48px;
  align-items: center;
}

.tags-input {
  flex: 1;
  min-width: 120px;
  border: none;
  background: none;
  padding: 0.25rem;
  font-size: 0.9375rem;
}

.tags-input:focus {
  outline: none;
  box-shadow: none;
}

.tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.tag-suggestion {
  padding: 0 var(--space-3);
  height: var(--control-height-xs);
  display: inline-flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  font-size: var(--type-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.tag-suggestion:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--text-inverse);
}

/* ===== RESPONSIVE - Tablet and Up ===== */
@media (min-width: 768px) {
  .auth-hero {
    display: flex;
  }

  .auth-form-container {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .mobile-menu-btn {
    display: none;
  }

  .sidebar {
    pointer-events: none;
  }

  .sidebar-overlay {
    display: none;
  }

  .sidebar-nav {
    transform: translateX(0);
    position: fixed;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    pointer-events: auto;
    border-right: 1px solid var(--border-color);
    z-index: calc(var(--z-header) + 1);
  }

  .sidebar-header {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
    padding: 0 0.75rem;
    align-items: center;
  }

  .sidebar-close {
    display: none;
  }

  .sidebar-toggle-btn {
    display: flex;
    margin-left: auto;
  }

  .header-org-btn {
    display: none;
  }

  .app-header {
    left: var(--sidebar-width);
  }

  .header-left {
    display: flex;
    flex-shrink: 0;
  }

  .main-content {
    margin-left: var(--sidebar-width);
    margin-bottom: 0;
    padding: var(--space-5);
    max-width: calc(100vw - var(--sidebar-width));
  }

  .bottom-nav {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .modal {
    align-items: center;
    padding: var(--space-4);
  }

  .modal-container {
    max-width: 520px;
    border-radius: var(--radius-xl);
    animation: modal-fade-in 0.15s ease;
  }

  @keyframes modal-fade-in {
    from {
      opacity: 0;
      transform: scale(0.95);
    }

    to {
      opacity: 1;
      transform: scale(1);
    }
  }

  #toast-container {
    bottom: 2rem;
    left: auto;
    right: 2rem;
    width: 360px;
  }

  .chart-container {
    height: 350px;
  }

  /* ========================================= */
  /* FIX: Handle COLLAPSED state on Tablets */
  /* ========================================= */

  .main-content {
    transition: margin-left var(--transition-base), max-width var(--transition-base);
  }

  .sidebar.collapsed~.main-content,
  .sidebar.collapsed~.notes-view-root {
    margin-left: 60px;
    /* OVERRIDE: Update max-width to match collapsed sidebar (60px) */
    max-width: calc(100vw - 60px);
  }
}


/* ===== RESPONSIVE - Desktop ===== */
@media (min-width: 1024px) {
  .main-content {
    padding: 1rem 2rem;
  }

  .page-title {
    font-size: 1.3rem;
  }

  .card {
    padding: 1rem;
  }
}

/* ===== RESPONSIVE - Large Desktop ===== */
/* ===== RESPONSIVE - Large Desktop ===== */
@media (min-width: 1280px) {

  /* UPDATE: Full width logic */
  .main-content {
    /* 1. Calculate exact remaining width after sidebar */
    width: calc(100vw - var(--sidebar-width));

    /* 2. Keep the margin for sidebar, but REMOVE 'auto' (which was centering it) */
    margin-left: var(--sidebar-width);
    margin-right: 0;

    /* 3. Sleek padding (reduced from 3rem to 2rem) */
    padding: 1rem;

    /* 4. Remove max-width constraint to allow full stretch */
    max-width: none;
  }

  .page-title {
    font-size: 1.3rem;
  }

  .card {
    padding: 1rem;
  }
}


/* ===== UTILITY CLASSES ===== */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--text-muted);
}

.text-prim {
  color: var(--color-primary-light);
}

.text-success {
  color: var(--color-success);
}

.text-warning {
  color: var(--color-warning);
}

.text-danger {
  color: var(--color-danger);
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.mt-4 {
  margin-top: 2rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

.mb-4 {
  margin-bottom: 2rem;
}

.gap-1 {
  gap: 0.5rem;
}

.gap-2 {
  gap: 1rem;
}

.gap-3 {
  gap: 1.5rem;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.flex-wrap {
  flex-wrap: wrap;
}

.hidden {
  display: none !important;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

/* Base Utilities */
.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gap-x-2 {
  column-gap: 0.5rem;
}

.gap-x-6 {
  column-gap: 1.5rem;
}

.gap-y-2 {
  row-gap: 0.5rem;
}

.gap-y-3 {
  row-gap: 0.75rem;
}

@media (min-width: 640px) {
  .sm\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.tag-sm {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.col-span-2 {
  grid-column: span 2 / span 2;
}


/* ===== ROUTE PLANNING ===== */
.locations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.location-card {
  display: flex;
  align-items: flex-start;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.location-card:hover {
  border-color: var(--color-primary);
}

.location-card.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
}

.location-card.recommended {
  border-color: var(--color-success);
  background: var(--color-success-bg);
}

.location-checkbox {
  margin-right: 0.75rem;
  margin-top: 0.25rem;
}

.location-checkbox input[type="checkbox"] {
  display: none;
}

.location-checkbox label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.location-checkbox input[type="checkbox"]:checked+label {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.location-checkbox input[type="checkbox"]:checked+label::after {
  content: '✓';
  color: white;
  font-size: 0.75rem;
}

.location-info h4 {
  margin: 0 0 0.25rem 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.location-info p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.location-recommendation {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--color-success-bg);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--color-success);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.route-map {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin: 1rem 0;
  height: 300px;
}

.route-order {
  margin: 1rem 0;
}

.route-order h4 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
}

.sortable-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sortable-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.sortable-handle {
  margin-right: 0.75rem;
  color: var(--text-muted);
  cursor: grab;
}

.sortable-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.75rem;
}

.sortable-content h4 {
  margin: 0 0 0.25rem 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.sortable-content p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.routes-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.route-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.route-info h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
}

.route-info p {
  margin: 0.25rem 0;
  font-size: 0.8125rem;
}

.route-assignees {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.5rem 0;
  flex-wrap: wrap;
}

.route-assignees-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.route-assignees-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.route-assignee-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: var(--color-primary-bg);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text-primary);
}

.route-assignee-tag .assignee-avatar {
  width: 18px;
  height: 18px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.5625rem;
}

.route-meta-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

.route-meta-info span {
  white-space: nowrap;
}

.route-actions {
  display: flex;
  gap: 0.5rem;
}

.route-details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.route-details p {
  margin: 0;
  font-size: 0.875rem;
}

.route-stops {
  padding-left: 1.5rem;
}

.route-stops li {
  margin-bottom: 0.75rem;
}

.route-stops li:last-child {
  margin-bottom: 0;
}

.route-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0;
}

.route-summary p {
  margin: 0;
  font-size: 0.875rem;
}

/* ===== ROUTE NAVIGATION ===== */
.route-navigation {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
}

.route-navigation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

.route-navigation-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.route-navigation-map {
  flex: 1;
  min-height: 300px;
}

.route-navigation-info {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 1.5rem;
}

.current-stop {
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.current-stop h3 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.stop-info h4 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.stop-info p {
  margin: 0 0 1.5rem 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.stop-actions {
  display: flex;
  gap: 0.75rem;
}

.next-stops h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
}

.stops-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stop-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.stop-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  margin-right: 0.75rem;
}

.stop-details h4 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.stop-details p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.route-marker-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  border: 3px solid white;
  box-shadow: var(--shadow-md);
}

.route-marker-icon.current {
  background: var(--color-success);
  animation: pulse 2s infinite;
}

.route-marker-icon.completed {
  background: var(--color-success);
}

.user-marker-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--color-danger);
  color: white;
  border-radius: var(--radius-full);
  border: 3px solid white;
  box-shadow: var(--shadow-md);
}

/* ===== MULTI-SELECT FOR REPS ===== */
.multi-select-container {
  position: relative;
}

.multi-select-display {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  cursor: pointer;
  min-height: 48px;
}

.multi-select-display.empty {
  color: var(--text-muted);
  align-items: center;
}

.multi-select-tag {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 550;
  border-radius: var(--radius-full);
}

.multi-select-tag .remove {
  cursor: pointer;
  font-size: 0.875rem;
}

.multi-select-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
  display: none;
}

.multi-select-dropdown.show {
  display: block;
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.multi-select-option:hover {
  background: var(--bg-tertiary);
}

.multi-select-option.selected {
  background: var(--color-primary-bg);
}

.multi-select-option input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* ===== LOCATION SEARCH ===== */
.location-search-container {
  margin-bottom: 1rem;
}

.location-search-container input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: var(--transition-fast);
}

.location-search-container input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.location-search-container input::placeholder {
  color: var(--text-muted);
}

/* ===== AI RECOMMENDATION ===== */
.ai-recommendation {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  margin-top: 1rem;
  padding: 1.2rem;
  margin-bottom: 20px;
}

.ai-recommendation-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-success);
}

.ai-recommendation button {
  margin-top: 12px;
  background-color: var(--color-success);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(31, 157, 110, 0.15);
  border: 1px solid transparent;
}

.ai-recommendation button:hover:not(:disabled) {
  background-color: #178659;
  box-shadow: 0 4px 12px rgba(31, 157, 110, 0.25);
}

.ai-recommendation-content {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== OPPORTUNITY PIPELINE ===== */
.opportunity-pipeline-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1rem;
}

.deals-page-header {
  margin-bottom: 0.35rem;
}

.pipeline-view-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.pipeline-view-left,
.pipeline-view-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pipeline-view-btn {
  height: 34px;
  padding: 0 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 550;
}

.pipeline-view-btn.is-active {
  border-color: var(--color-primary);
  color: var(--text-primary);
}

.pipeline-header,
.pipeline-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.pipeline-filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pipeline-filter {
  height: 34px;
  padding: 0 0.72rem;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 550;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fast);
}

.pipeline-filter:hover {
  border-color: var(--border-color-light);
  color: var(--text-primary);
}

.pipeline-filter.active {
  background: var(--bg-primary);
  border-color: var(--border-color-light);
  color: var(--text-primary);
}

.pipeline-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: nowrap;
  margin-left: auto;
}

.pipeline-controls-primary {
  width: 100%;
  margin-left: 0;
}

.pipeline-controls-primary .pipeline-search {
  flex: 1 1 260px;
  width: auto;
}

.pipeline-quick-filter {
  min-width: 170px;
  width: 170px;
  flex: 0 0 170px;
}

.pipeline-add-btn {
  margin-left: auto;
}

#pipeline-advanced-toggle {
  min-width: 138px;
}

#pipeline-advanced-toggle.is-open {
  border-color: var(--color-primary);
  color: var(--text-primary);
}

.pipeline-controls-advanced {
  width: 100%;
  justify-content: flex-end;
  margin-left: 0;
  padding-top: 0.15rem;
}

.pipeline-controls-advanced[hidden] {
  display: none;
}

.pipeline-search {
  position: relative;
  width: 220px;
  max-width: 100%;
}

.pipeline-search i,
.pipeline-search svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.pipeline-search input,
.pipeline-select {
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.pipeline-search input {
  width: 100%;
  padding: 0 0.75rem 0 2.5rem;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.pipeline-select {
  padding: 0 0.65rem;
  min-width: 150px;
  width: 150px;
  flex: 0 0 150px;
}

.pipeline-controls .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.pipeline-search input:focus,
.pipeline-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.pipeline-search input::placeholder {
  color: var(--text-muted);
}

.pipeline-stages {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.875rem;
  padding-bottom: 1rem;
  align-items: start;
}

.pipeline-stage {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: auto;
  box-shadow: none;
  transition: border-color 150ms ease;
}

[data-theme="dark"] .pipeline-stage {
  background: #161b22;
  border-color: #2d343e;
}

.pipeline-stage:hover {
  border-color: var(--border-color-light);
}

[data-theme="dark"] .pipeline-stage:hover {
  border-color: #3d4754;
}

.pipeline-stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .pipeline-stage-header {
  border-bottom-color: #2d343e;
}

.pipeline-stage-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.pipeline-stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.pipeline-stage-count {
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  min-width: 22px;
  text-align: center;
}

[data-theme="dark"] .pipeline-stage-count {
  background: #1e2329;
  border-color: #2d343e;
  color: #8b949e;
}

.pipeline-stage-value {
  font-size: 0.72rem;
  font-weight: 550;
  color: var(--text-muted);
  padding-bottom: 0.2rem;
}

.opportunity-list {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pipeline-inline-add {
  width: 100%;
  border: 1px dashed var(--border-color);
  background: transparent;
  color: var(--text-muted);
  height: 32px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 550;
  cursor: pointer;
  margin-top: 0.1rem;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.pipeline-inline-add:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-bg);
}

/* ===== OPPORTUNITY CARDS ===== */

.opportunity-card {
  background: #ffffff;
  border: 1px solid #c8d0da;
  border-radius: 10px;
  padding: 0.875rem;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
  will-change: transform;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  user-select: none;
  -webkit-user-select: none;
}

[data-theme="dark"] .opportunity-card {
  background: #1e2329;
  border-color: #2d343e;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.opportunity-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

[data-theme="dark"] .opportunity-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.opportunity-card.dragging {
  opacity: 0.35;
  transform: rotate(1deg) scale(0.98);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.opportunity-card.readonly {
  opacity: 0.8;
  cursor: default;
}

.opportunity-card.readonly:hover {
  transform: none;
}

/* Card header: company row + drag handle */
.opp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.opp-company-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

.opp-company-avatar {
  width: 22px;
  height: 22px;
  position: relative;
  flex-shrink: 0;
}

.opp-logo-img {
  position: absolute;
  inset: 0;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  object-fit: contain;
  display: none;
}

.opp-company-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

[data-theme="dark"] .opp-company-label {
  color: #8b949e;
}

.opp-drag-handle {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 5px;
  cursor: grab;
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}

.opp-drag-handle:active {
  cursor: grabbing;
}

.opportunity-card:hover .opp-drag-handle {
  opacity: 0.5;
}

.opp-drag-handle:hover {
  opacity: 1 !important;
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .opp-drag-handle:hover {
  background: #2d343e;
}

/* Deal / opportunity name */
.opp-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 0.55rem;
}

[data-theme="dark"] .opp-name {
  color: #c9d1d9;
}

/* Value row */
.opp-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.opp-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

[data-theme="dark"] .opp-value {
  color: #e6edf3;
}

.opp-owner-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 550;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  padding: 0.2rem 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

[data-theme="dark"] .opp-owner-chip {
  background: #2d343e;
  color: #8b949e;
}

/* Probability bar */
.opp-probability-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.opp-prob-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

[data-theme="dark"] .opp-prob-bar {
  background: #2d343e;
}

.opp-prob-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 300ms ease;
}

.opp-prob-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 30px;
  text-align: right;
}

/* Next step */
.opp-next-step {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.opp-step-icon {
  flex-shrink: 0;
  position: relative;
  top: 1px;
  color: var(--color-warning);
}

.opp-next-step.overdue {
  color: var(--color-danger);
}

.opp-next-step.overdue .opp-step-icon {
  color: var(--color-danger);
}

.opp-step-date {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Competitors */
.opp-competitors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

/* Notes preview */
.opp-notes {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.55rem;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

[data-theme="dark"] .opp-notes {
  color: #6e7681;
}

/* Card footer */
.opp-card-footer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-color);
}

[data-theme="dark"] .opp-card-footer {
  border-top-color: #2d343e;
}

.opp-stage-age {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 550;
  color: var(--text-muted);
}

[data-theme="dark"] .opp-stage-age {
  color: #6e7681;
}

.opp-created-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-right: auto;
}

[data-theme="dark"] .opp-created-date {
  color: #6e7681;
}

.opp-actions-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Action buttons */
.opportunity-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 6px;
  transition: background 120ms ease, color 120ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

.opportunity-card:hover .opportunity-action-btn {
  opacity: 1;
}

.opportunity-action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .opportunity-action-btn:hover {
  background: #2d343e;
  color: #c9d1d9;
}

.delete-opportunity:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

/* ===== SORTABLE DRAG STATES ===== */

/* Probability Slider */
.probability-slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.probability-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  outline: none;
}

.probability-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  cursor: pointer;
}

.probability-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  cursor: pointer;
  border: none;
}

.probability-value {
  min-width: 40px;
  text-align: center;
  font-weight: 600;
  color: var(--color-primary);
}

/* Competitors Input */
.competitors-input-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  min-height: 48px;
  align-items: center;
}

.competitors-input {
  flex: 1;
  min-width: 120px;
  border: none;
  background: none;
  padding: 0.25rem;
  font-size: 0.9375rem;
}

.competitors-input:focus {
  outline: none;
  box-shadow: none;
}

.competitor-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: var(--color-danger-bg);
  color: var(--color-danger);
  font-size: 0.75rem;
  font-weight: 550;
  border-radius: var(--radius-full);
}

.competitor-tag .remove {
  cursor: pointer;
  font-size: 0.875rem;
}

/* Pipeline Summary */
/* Responsive adjustments for pipeline */
@media (max-width: 1400px) {
  .pipeline-stages {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .pipeline-view-row {
    flex-direction: column;
    align-items: stretch;
  }

  .pipeline-view-right {
    justify-content: flex-start;
  }

  .pipeline-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pipeline-stages {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
  }

  .pipeline-stage {
    min-height: auto;
  }
}

.pipeline-stage.drag-over {
  background: var(--color-primary-bg);
  border: 2px dashed var(--color-primary);
}

[data-theme="dark"] .pipeline-stage.drag-over {
  background: rgba(47, 95, 208, 0.08);
}

.pipeline-stage.is-drop-origin {
  border-color: var(--border-color-light);
  opacity: 0.7;
}

.pipeline-stage.is-drop-target {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
}

[data-theme="dark"] .pipeline-stage.is-drop-target {
  background: rgba(47, 95, 208, 0.08);
}

.opportunity-list.valid-drop {
  min-height: 100px;
  background: transparent;
  border-radius: var(--radius-md);
}

/* already defined above in card redesign block - keep this one canonical */
.opportunity-card.dragging {
  opacity: 0.35;
  transform: rotate(1deg) scale(0.98) !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2) !important;
  z-index: 1000;
}

.opportunity-card.dragging-active {
  opacity: 0.75;
}

.sortable-ghost {
  opacity: 0 !important;
  background: transparent !important;
  border: 2px dashed var(--color-primary) !important;
  box-shadow: none !important;
}

[data-theme="dark"] .sortable-ghost {
  border-color: var(--color-primary) !important;
  background: rgba(var(--color-primary-rgb, 47, 95, 208), 0.06) !important;
}

.sortable-chosen {
  cursor: grabbing !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18) !important;
  transform: scale(1.02) !important;
  border-color: var(--color-primary) !important;
  transition: none !important;
}

[data-theme="dark"] .sortable-chosen {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45) !important;
}

.sortable-drag {
  opacity: 1 !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body.is-dragging,
body.is-dragging * {
  cursor: grabbing !important;
  user-select: none;
}

@media (min-width: 768px) {
  .opportunity-list {
    min-height: 100px;
    transition: none;
  }

  .opportunity-list:hover {
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-md);
  }
}

/* ===== OPPORTUNITY OWNER STYLES ===== */
.opportunity-owner {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.opportunity-card.readonly {
  opacity: 0.8;
  border-color: var(--border-color-light);
  cursor: not-allowed !important;
}

.opportunity-card.readonly:hover {
  border-color: var(--border-color-light) !important;
  box-shadow: none !important;
  transform: none !important;
}

.opportunity-card.readonly .opportunity-action-btn {
  opacity: 0.5;
  cursor: not-allowed;
}

.opportunity-card.readonly .opportunity-action-btn:hover {
  background: transparent;
  color: var(--text-muted);
}

.sidebar-attribution {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  padding-bottom: 20px;
}

.sidebar-attribution p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  /* Better than random red */
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px;
}

/* ===== AUTH LOGOS ===== */
.auth-logos {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-logo img {
  max-width: 150px;
  height: auto;
  transition: transform 0.3s ease;
}

.auth-logo img:hover {
  transform: scale(1.05);
}

.auth-subtitle {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-subtitle p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  font-weight: 550;
}

/* Mobile styles */
/* ===== TASKS AND REMINDERS ===== */
.task-card,
.reminder-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: var(--transition-fast);
  position: relative;
}

.task-card:hover,
.reminder-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.task-header,
.reminder-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.task-title,
.reminder-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.task-status,
.reminder-status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 550;
}

.task-status.pending {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.task-status.in_progress {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.task-status.completed {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.reminder-status.pending {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.reminder-status.completed {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.task-meta,
.reminder-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.task-meta-item,
.reminder-meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.task-meta-item i,
.reminder-meta-item i {
  color: var(--text-muted);
  font-size: 0.875rem;
  width: 20px;
  text-align: center;
}

.task-description,
.reminder-description {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.task-actions,
.reminder-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ==========================
   SafiFind modal — Polished redesign (scoped)
   - Centered dialog on desktop, compact bottom-sheet on mobile
   - 8px spacing scale, stronger header, de-emphasized metadata
   - Scoped to #safifind-modal only to avoid global modal changes
   ========================== */

/* Backdrop: soften so dialog reads as primary focus */
#safifind-modal .modal-backdrop {
  background: rgba(15, 20, 30, 0.35);
}

/* Container: centered on wide screens, keeps bottom-sheet feel on small */
#safifind-modal.modal {
  align-items: flex-end;
  /* default mobile bottom sheet */
}

@media (min-width: 720px) {
  #safifind-modal.modal {
    align-items: center;
  }

  #safifind-modal .modal-container {
    width: 92vw;
    max-width: 720px;
    margin: 0;
    /* center vertically */
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(15, 20, 30, 0.16);
    animation: none;
    /* keep it subtle when centering */
  }
}

/* Header: stronger, tighter */
#safifind-modal .modal-header {
  padding: 20px 24px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color-light);
}

#safifind-modal .modal-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-primary);
}

#safifind-modal .modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
}

#safifind-modal .modal-container {
  width: 95% !important;
  max-width: 1200px !important;
  height: 85vh;
  display: flex;
  flex-direction: column;
}

#safifind-modal .modal-body {
  padding: 0;
  flex: 1;
  overflow: hidden;
}

.safifind-layout {
  display: flex;
  height: 100%;
}

.safifind-sidebar {
  width: 350px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color-light);
  display: flex;
  flex-direction: column;
}

.safifind-search-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color-light);
}

.safifind-search-grid {
  display: grid;
  grid-template-columns: 1fr 100px;
  gap: 12px;
  margin-bottom: 8px;
  /* Reduced from 12px */
}

.safifind-search-section .form-field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}

.safifind-search-section .form-field select,
.safifind-search-section .form-field input {
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.safifind-results-section {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.safifind-results-section .section-header {
  padding: 8px 20px;
  /* Reduced from 12px 20px */
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color-light);
}

.safifind-results-section .section-header h4 {
  font-size: 0.8125rem;
  margin: 0;
  color: var(--text-muted);
}

.safifind-results-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}

.safifind-main {
  flex: 1;
  position: relative;
  background: #111;
}

#safifind-map {
  width: 100%;
  height: 100%;
  filter: grayscale(0.2) contrast(1.1);
}

#safifind-modal .modal-footer {
  padding: 12px 24px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#safifind-coords-status {
  font-size: 12px;
  color: var(--text-muted);
}

.empty-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-style: italic;
}

/* Compact Result Cards */
#safifind-result-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}

#safifind-result-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--color-primary);
}

.safifind-result-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
  /* 14px */
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.safifind-result-meta {
  font-size: 0.75rem;
  /* 12px */
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.safifind-result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.safifind-result-actions .btn-sm {
  padding: 4px 8px;
  font-size: 0.75rem;
  height: 28px;
}

.safifind-category-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(99, 102, 241, 0.2);
  /* Semi-transparent indigo */
  color: #818cf8;
  /* Lighter indigo */
  border: 1px solid rgba(99, 102, 241, 0.3);
}

@media (max-width: 900px) {
  .safifind-layout {
    flex-direction: column;
    overflow-y: auto;
  }

  .safifind-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color-light);
  }

  .safifind-main {
    height: 400px;
    flex: none;
  }

  #safifind-modal .modal-container {
    height: 95vh;
  }
}

.task-priority,
.reminder-date {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 550;
}

.task-priority.low {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.task-priority.medium {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.task-priority.high {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.reminder-date {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

.task-action-buttons,
.reminder-action-buttons {
  display: flex;
  gap: 0.5rem;
}

.task-action-btn,
.reminder-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all var(--transition-base);
}

.task-action-btn:hover,
.reminder-action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--color-primary);
  border-color: var(--border-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.task-action-btn:active,
.reminder-action-btn:active {
  transform: scale(0.95);
}

.task-assigned-to,
.reminder-assigned-to {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.task-assigned-to i,
.reminder-assigned-to i {
  color: var(--text-muted);
}

.task-filters,
.reminder-filters {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  align-items: center;
}

.task-filter,
.reminder-filter {
  height: var(--control-height-md);
  padding: 0 var(--space-4);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  border-radius: var(--btn-radius);
  font-size: 0.8125rem;
  font-weight: 550;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.task-filter:hover,
.reminder-filter:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.task-filter.active,
.reminder-filter.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.task-stats,
.reminder-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.task-stat-card,
.reminder-stat-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-stat-title,
.reminder-stat-title {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 550;
}

.task-stat-value,
.reminder-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.task-overdue,
.reminder-overdue {
  color: var(--color-danger);
  font-weight: 550;
}

.task-creator,
.reminder-creator {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.task-creator i,
.reminder-creator i {
  color: var(--text-muted);
}

/* Task and reminder modals */
.task-form-field,
.reminder-form-field {
  margin-bottom: 1rem;
}

.task-form-label,
.reminder-form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.task-form-input,
.reminder-form-input,
.task-form-select,
.reminder-form-select,
.task-form-textarea,
.reminder-form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: var(--transition-fast);
}

.task-form-input:focus,
.reminder-form-input:focus,
.task-form-select:focus,
.reminder-form-select:focus,
.task-form-textarea:focus,
.reminder-form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.task-form-textarea,
.reminder-form-textarea {
  resize: vertical;
  min-height: 100px;
}

.task-form-buttons,
.reminder-form-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Responsive adjustments for tasks and reminders */
/* ===== AI CHAT ASSISTANT - SAFI AI ===== */

/* header AI button with generative-style animated gradient border */
.header-ai-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: var(--control-height-sm);
  padding: 0 var(--space-3) 0 var(--space-2);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius);
  font-size: var(--type-sm);
  cursor: pointer;
  letter-spacing: 0;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  outline: none;
}

/* Remove gradient border pseudo-elements */
.header-ai-btn::before {
  display: none;
}

.header-ai-btn::after {
  display: none;
}

.header-ai-btn svg {
  width: var(--icon-sm);
  height: var(--icon-sm);
  color: var(--color-primary);
  flex-shrink: 0;
}

.header-ai-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--color-primary);
  color: var(--text-primary);
}

.header-ai-btn:hover svg {
  color: var(--color-primary);
}

.header-ai-btn:active {
  background: var(--bg-active);
}

/* ---- Chat panel ---- */
/* ===== AI CHAT PANEL — Attio-inspired clean design ===== */
.ai-chat-window {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  border-left: 1px solid var(--border-color-light);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.06);
  z-index: 1010;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-chat-window.active {
  transform: translateX(0);
}

/* ---- Header ---- */
.ai-chat-header {
  padding: 0 12px 0 16px;
  height: 52px;
  border-bottom: 1px solid var(--border-color-light);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  flex-shrink: 0;
}

.ai-chat-header-identity {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.ai-chat-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1;
}

.ai-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.ai-chat-header-btn {
  background: transparent;
  border: none;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
  padding: 0;
  flex-shrink: 0;
}

.ai-chat-header-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ---- Messages ---- */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scroll-behavior: smooth;
}

.ai-chat-messages::-webkit-scrollbar {
  width: 3px;
}

.ai-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.ai-chat-message {
  display: flex;
  flex-direction: column;
  max-width: 92%;
}

.ai-chat-message.user {
  align-self: flex-end;
  align-items: flex-end;
}

.ai-chat-message.ai {
  align-self: flex-start;
  align-items: flex-start;
}

.ai-chat-message + .ai-chat-message {
  margin-top: 6px;
}

.ai-chat-message.user + .ai-chat-message.ai,
.ai-chat-message.ai + .ai-chat-message.user {
  margin-top: 16px;
}

/* ---- Bubbles ---- */
.ai-chat-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  word-break: break-word;
  font-size: 13.5px;
  line-height: 1.6;
}

.ai-chat-message.user .ai-chat-bubble {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color-light);
}

.ai-chat-message.ai .ai-chat-bubble {
  background: transparent;
  color: var(--text-primary);
  padding: 4px 0;
}

/* ---- Rich text inside AI bubbles ---- */
.ai-chat-bubble p {
  margin: 0 0 6px 0;
  line-height: 1.6;
}

.ai-chat-bubble p:last-child {
  margin-bottom: 0;
}

.ai-chat-bubble h1,
.ai-chat-bubble h2,
.ai-chat-bubble h3,
.ai-chat-bubble h4 {
  color: var(--text-primary);
  line-height: 1.3;
  font-weight: 600;
  margin: 10px 0 4px 0;
}

.ai-chat-bubble h1:first-child,
.ai-chat-bubble h2:first-child,
.ai-chat-bubble h3:first-child,
.ai-chat-bubble h4:first-child {
  margin-top: 0;
}

.ai-chat-bubble h1 { font-size: 15px; }
.ai-chat-bubble h2 { font-size: 14px; }
.ai-chat-bubble h3 { font-size: 13.5px; }
.ai-chat-bubble h4 { font-size: 13px; }

.ai-chat-bubble ul,
.ai-chat-bubble ol {
  margin: 4px 0 6px 0;
  padding-left: 18px;
}

.ai-chat-bubble li {
  margin-bottom: 3px;
  line-height: 1.55;
}

.ai-chat-bubble li:last-child {
  margin-bottom: 0;
}

.ai-chat-bubble strong {
  font-weight: 600;
  color: var(--text-primary);
}

.ai-chat-bubble em {
  font-style: italic;
}

.ai-chat-bubble code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  background: var(--bg-tertiary);
  padding: 1.5px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-color-light);
}

.ai-chat-bubble blockquote {
  border-left: 2px solid var(--border-color);
  margin: 6px 0;
  padding: 4px 10px;
  color: var(--text-secondary);
  font-style: italic;
}

.ai-chat-bubble hr {
  border: none;
  border-top: 1px solid var(--border-color-light);
  margin: 8px 0;
}

/* ---- Message action buttons (copy / helpful / not-helpful / retry) ---- */
.ai-chat-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  margin-top: 2px;
}

.ai-chat-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}

.ai-chat-action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.ai-chat-action-btn:active {
  transform: scale(0.92);
}

.ai-chat-action-btn.ai-action-active {
  color: var(--color-primary);
}

.ai-chat-action-btn.ai-action-copied {
  color: var(--color-success, #16a34a);
}

.ai-chat-action-btn svg {
  pointer-events: none;
  display: block;
}

/* ---- Footer ---- */
.ai-chat-footer {
  border-top: 1px solid var(--border-color-light);
  padding: 10px 12px 12px;
  background: var(--bg-primary);
  flex-shrink: 0;
  position: relative;
}

/* ---- Prompts dropdown ---- */
.ai-prompts-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 12px;
  right: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color-light);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  z-index: 20;
}

[data-theme="dark"] .ai-prompts-menu {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.ai-prompts-list {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ai-prompt-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 13.5px;
  color: var(--text-primary);
  font-family: inherit;
  font-weight: 550;
  transition: background 0.1s;
  width: 100%;
}

.ai-prompt-item:hover {
  background: var(--bg-secondary);
}

.ai-prompt-icon {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1;
}

.ai-prompts-empty {
  margin: 6px 4px 4px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 0;
}

/* ---- Prompts toggle button ---- */
.ai-chat-prompts-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1.5px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  margin-right: 4px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  font-family: inherit;
  line-height: 1;
}

.ai-chat-prompts-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.ai-chat-prompts-btn.active {
  background: var(--color-primary-bg);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ---- Input composer ---- */
.ai-chat-input-wrap {
  display: flex;
  align-items: flex-end;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 6px 6px 6px 14px;
  transition: border-color 0.15s;
}

.ai-chat-input-wrap:focus-within {
  border-color: var(--color-primary);
}

.ai-chat-textarea {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.45;
  padding: 5px 8px 5px 0;
  min-width: 0;
  resize: none;
  font-family: inherit;
  max-height: 120px;
  overflow-y: auto;
}

.ai-chat-textarea:focus,
.ai-chat-textarea:focus-visible {
  outline: none;
  box-shadow: none;
}

.ai-chat-textarea::placeholder {
  color: var(--text-muted);
  font-size: 13px;
}

.ai-chat-input-actions {
  display: flex;
  align-items: flex-end;
  flex-shrink: 0;
}

/* ---- Send button ---- */
.ai-chat-send-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.ai-chat-send-btn:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

.ai-chat-send-btn:active:not(:disabled) {
  transform: scale(0.92);
}

.ai-chat-send-btn:disabled {
  background: var(--border-color);
  cursor: default;
  opacity: 0.5;
}

/* ---- Typing / loading indicator ---- */
.ai-chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
}

.ai-chat-typing-dots span {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: chatDotBounce 1.3s infinite ease-in-out;
}

.ai-chat-typing-dots span:nth-child(1) { animation-delay: 0s; }
.ai-chat-typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.ai-chat-typing-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes chatDotBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* ---- Dark mode overrides ---- */
[data-theme="dark"] .ai-chat-bubble code {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .ai-chat-input-wrap {
  background: var(--bg-tertiary);
}

/* ---- Mobile ---- */
/* ===== TASKS AND REMINDERS NOTIFICATION ===== */
.reminder-notification {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(79, 70, 229, 0.05) 100%);
  border: 1px solid rgba(79, 70, 229, 0.3);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  overflow: hidden;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reminder-notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(79, 70, 229, 0.1);
  border-bottom: 1px solid rgba(79, 70, 229, 0.2);
}

.reminder-notification-header span {
  font-weight: 600;
  color: var(--color-primary);
}

.reminder-notification-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.reminder-notification-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.reminder-notification-content {
  padding: 0 1.5rem 1rem;
}

.reminder-notification-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(79, 70, 229, 0.1);
}

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

.reminder-notification-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.reminder-notification-time {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.reminder-notification-actions {
  display: flex;
  gap: 0.5rem;
}

.reminder-notification-more {
  text-align: center;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== FORCE CONFIRM DIALOG TO TOP ===== */
#confirm-dialog {
  z-index: 99999 !important;
}

#confirm-dialog .modal-container {
  z-index: 99999 !important;
}

#confirm-dialog .modal-backdrop {
  z-index: 99998 !important;
}

/* Ensure toast is visible above everything */
#toast-container {
  z-index: var(--z-toast) !important;
}


.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color-light);
  background: var(--bg-primary);
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all var(--transition-base);
}

.action-btn:hover {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.action-btn:active {
  transform: scale(0.95);
}

.action-btn svg {
  stroke-width: 1.5;
}

.company-description,
.person-details {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.company-location,
.person-company {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.company-location i,
.person-company i {
  color: var(--text-muted);
}

.company-categories,
.person-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.company-category {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 550;
  border-radius: var(--radius-full);
}

.person-contact-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.person-contact-item i {
  color: var(--text-muted);
}

.person-opportunity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-success);
}

.person-opportunity i {
  color: var(--color-success);
}

.categories-input-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  min-height: 48px;
  align-items: center;
}

.categories-input {
  flex: 1;
  min-width: 120px;
  border: none;
  background: none;
  padding: 0.25rem;
  font-size: 0.9375rem;
}

.categories-input:focus {
  outline: none;
  box-shadow: none;
}

.category-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 550;
  border-radius: var(--radius-full);
}

.category-tag .remove {
  cursor: pointer;
  font-size: 0.875rem;
}

.category-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.phone-numbers-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.phone-number-input {
  display: flex;
  gap: 0.5rem;
}

.phone-number {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: var(--transition-fast);
}

.phone-number:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

/* Manual coordinates section */
.manual-coords-section {
  display: none;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.manual-coords-section.hidden {
  display: block;
}

.coord-inputs {
  display: flex;
  gap: 1rem;
}

.coord-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.coord-inputs input[type="number"] {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

.coord-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.coord-buttons button {
  flex: 1;
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 550;
  cursor: pointer;
  transition: all var(--transition-base);
  letter-spacing: 0.2px;
}

.coord-buttons button:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  box-shadow: 0 2px 6px rgba(47, 95, 208, 0.15);
}

.coord-buttons button:active {
  transform: scale(0.98);
}

.coord-buttons button i {
  margin-right: 0.25rem;
}

/* Geocoding button loading state */
.geocode-btn.loading {
  pointer-events: none;
  opacity: 0.6;
}

.geocode-btn.loading i {
  animation: spin 1s linear infinite;
}

/* Force hide the native scrollbar so we can use our custom one */
html,
body {
  scrollbar-width: none !important;
}

/* ----- CUSTOM SCROLLBAR STYLES ----- */

/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 10px;
  /* Thin track looks more modern */
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  /* Matches your app's background perfectly */
  border-radius: 100px;
  /* Fully rounded track ends */
  border: none;
  /* Clean look */
}

::-webkit-scrollbar-thumb {
  background-color: #4e6374;
  /* Dark grey thumb - nice contrast */
  border-radius: 4px;
  /* Sleek rounded corners */
  border: 2px solid var(--bg-primary);
  /* Optional border for extra definition */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  /* Subtle lift effect */
  transition: background-color 0.2s, box-shadow 0.2s;
  /* Smooth transition on hover */
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-primary);
  /* Your brand color on hover */
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.2);
  /* Stronger lift on hover */
}

/* Fallback for Firefox */
* {
  scrollbar-width: 10px;
  scrollbar-color: #333333;
}

/* ===== TECHNICIAN SPECIFIC STYLES ===== */

/* Step-based form */
.form-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
  position: relative;
}

.form-steps::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-color);
  z-index: 1;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  transition: var(--transition-fast);
}

.step.active .step-number {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.step.completed .step-number {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

.step-title {
  font-size: 0.75rem;
  font-weight: 550;
  color: var(--text-secondary);
  text-align: center;
}

.step.active .step-title {
  color: var(--color-primary);
  font-weight: 600;
}

.step.completed .step-title {
  color: var(--color-success);
}

/* Step container */
.step-container {
  display: none;
}

.step-container.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Signature Canvas */
.signature-container {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  position: relative;
  margin-bottom: 1rem;
}

.signature-canvas {
  width: 100%;
  height: 200px;
  cursor: crosshair;
  background: white;
  border-radius: var(--radius-md);
}

.signature-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.signature-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.signature-preview {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  display: none;
}

.signature-preview.show {
  display: block;
}

.signature-preview img {
  max-width: 100%;
  max-height: 100px;
}

/* Photo Grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.photo-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 1;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 24px;
  height: 24px;
  background: var(--color-danger);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-upload-multiple {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
  background: var(--bg-tertiary);
}

.photo-upload-multiple:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
}

.photo-upload-multiple i {
  font-size: 2rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Technician Visit Card */
.technician-visit-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: var(--transition-fast);
}

.technician-visit-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.technician-visit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.technician-visit-company {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.technician-visit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.technician-visit-meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.technician-visit-meta-item i {
  color: var(--text-muted);
}

.work-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.work-status-badge.completed {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.work-status-badge.partially-completed {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.work-status-badge.pending {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.work-status-badge.follow-up {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

/* Technician Dashboard Map */
.technician-map-container {
  height: 400px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

/* PDF Button */
.pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  background: var(--color-danger);
  color: white;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 550;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 2px 6px rgba(200, 58, 58, 0.15);
  letter-spacing: 0.3px;
}

.pdf-btn:hover {
  background: #b02d2d;
  box-shadow: 0 4px 12px rgba(200, 58, 58, 0.25);
}

.pdf-btn:active {
  box-shadow: 0 1px 3px rgba(200, 58, 58, 0.2);
  transform: scale(0.98);
}

/* Responsive adjustments */
/* Signature Canvas Styles */
.signature-canvas {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  touch-action: none;
}

[data-theme="dark"] .signature-canvas {
  background: #2a2a2a;
  border-color: #444;
}

.signature-placeholder {
  color: var(--text-muted);
  font-size: 0.875rem;
  pointer-events: none;
}

.signature-preview {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  display: none;
}

.signature-preview.show {
  display: block;
}

.signature-preview img {
  max-height: 100px;
  border-radius: var(--radius-sm);
}

/* Photo Item Styles */
.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition-fast);
}

.photo-item:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 24px;
  height: 24px;
  background: var(--color-danger);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: var(--transition-fast);
}

.photo-remove:hover {
  opacity: 1;
}

button svg {
  width: 18px;
}

/* Icon background */
.icon-bg {
  width: 21px;
  height: 21px;
  border-radius: 6px;
  /* key detail */
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* Icon itself */
.icon-bg svg {
  width: 15px;
  height: 15px;
  fill: white;
}

/* Colors (from screenshot) */
.icon-bg.companies {
  background: #2563eb;
}

.icon-bg.people {
  background: #c95809;
}

.icon-bg.deals {
  background: #ea580c;
}

.icon-bg.users {
  background: #0c99bd;
}

.icon-bg.workspaces {
  background: #7c3aed;
}


/* Collapsed sidebar state */
.sidebar.collapsed .sidebar-nav {
  width: 60px;
}

.sidebar.collapsed .sidebar-header {
  padding: 0 0.5rem;
  height: var(--header-height);
  justify-content: center;
}

.sidebar.collapsed .sidebar-footer {
  padding: 1rem 0.75rem;
}

/* Collapsed sidebar - Quick Actions buttons */
.sidebar.collapsed .sidebar-quick-actions {
  padding: 6px 6px 4px;
  flex-direction: column;
  gap: 4px;
}

.sidebar.collapsed .sidebar-action-btn span,
.sidebar.collapsed .sidebar-action-btn .sidebar-kbd {
  display: none;
}

.sidebar.collapsed .sidebar-action-btn {
  justify-content: center;
  padding: 7px;
  flex: 0 0 auto;
}

/* Collapsed sidebar state - Fix for Icons */
.sidebar.collapsed .nav-item>span:not(.icon-bg),
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .ws-btn {
  display: none;
}

.sidebar.collapsed .sidebar-toggle-btn {
  margin-left: auto;
  margin-right: auto;
}

.sidebar.collapsed .sidebar-footer {
  justify-content: center;
}

.sidebar.collapsed .sidebar-footer-logo {
  display: none;
}

/* Ensure icon containers stay visible */
.sidebar.collapsed .icon-bg {
  display: grid;
  /* Keep grid layout for centering */
}

/* Adjust nav items when collapsed */
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0.65rem;
}

.sidebar.collapsed .nav-item i {
  margin: 0;
  font-size: 1.25rem;
}

/* Adjust main content when sidebar is collapsed */
@media (min-width: 768px) {
  .main-content {
    transition: margin-left var(--transition-base);
  }
}

/* Update icon when sidebar is collapsed — handled by JS */

/* Show tooltips for collapsed sidebar */
.sidebar.collapsed .nav-item {
  position: relative;
}


.sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
  visibility: visible;
}


/* ===== TABLE VIEW STYLES ===== */
.view-options {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.table-container {
  overflow-x: auto;
  margin-top: 1rem;
  min-height: 200px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-table th {
  position: sticky;
  top: 0;
  background: linear-gradient(to bottom, var(--bg-secondary), var(--bg-tertiary));
  color: var(--text-primary);
  font-weight: 700;
  text-align: left;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  letter-spacing: 0.3px;
  z-index: 2;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color-light);
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--bg-secondary) 72%, transparent);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover {
  background: color-mix(in srgb, var(--color-primary-bg) 35%, var(--bg-tertiary));
}

.data-table th:last-child,
.data-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--bg-primary);
  box-shadow: -8px 0 12px -10px rgba(15, 23, 42, 0.25);
}

.data-table th:last-child {
  z-index: 3;
  background: linear-gradient(to bottom, var(--bg-secondary), var(--bg-tertiary));
}

.company-name-cell {
  font-weight: 550;
  color: var(--text-primary);
}

.company-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.person-name-cell {
  font-weight: 550;
  color: var(--text-primary);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 550;
}

.status-active {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.status-inactive {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.table-actions .action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  transition: var(--transition-fast);
}

.table-actions .action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Responsive adjustments for table */
/* Add these styles to your CSS file */

/* Pagination Styles */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 550;
  cursor: pointer;
  transition: var(--transition-fast);
}

.pagination-btn:hover:not(.disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--color-primary);
}

.pagination-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.pagination-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-btn svg {
  width: 16px;
  height: 16px;
}

.pagination-ellipsis {
  padding: 0 0.5rem;
  color: var(--text-muted);
}

/* Responsive adjustments */
.photo-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: white;
  padding: 8px 4px 4px;
  font-size: 10px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.3s ease;
  text-align: center;
}

.photo-item:hover .photo-info {
  opacity: 1;
}

.photo-info small:first-child {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-info small:last-child {
  color: #4ade80;
  font-weight: 550;
}

/* Compression progress toast styling */
#compression-progress-toast {
  background: var(--color-primary-bg);
  border-left: 4px solid var(--color-primary);
  min-width: 250px;
}

#compression-progress-toast .toast-icon {
  color: var(--color-primary);
}

/* ======================
// NOTES VIEW STYLES
// ====================== */

/* ======================
// REDESIGNED NOTES VIEW (v2)
// ====================== */

.notes-view-root {
  display: flex;
  margin-top: var(--header-height);
  margin-bottom: var(--bottom-nav-height);
  height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
  background: var(--bg-primary);
  overflow: hidden;
  position: relative;
  transition: margin-left var(--transition-base), max-width var(--transition-base);
}

@media (min-width: 768px) {
  .notes-view-root {
    margin-left: var(--sidebar-width);
    max-width: calc(100vw - var(--sidebar-width));
    margin-bottom: 0;
    height: calc(100vh - var(--header-height));
  }
}

/* Sub-sidebar for Categories/Tags */
.notes-sub-sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  z-index: 10;
}

.nss-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.nss-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nss-add-btn {
  width: 120px;
  height: 32px;
  font-size: 14px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 4px 12px var(--color-primary-bg);
}


.nss-add-btn span {
  padding-left: 5px;
}

.nss-add-btn:hover {
  background: var(--color-primary-dark);
}

.nss-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nss-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.nss-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nss-item.active {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  font-weight: 600;
}

.nss-item i {
  width: 18px;
  height: 18px;
}

.nss-count {
  margin-left: auto;
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
}

.nss-divider {
  height: 1px;
  background: var(--border-color);
  margin: 1.5rem 0.5rem;
}

.nss-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding: 0 1rem;
}

.nss-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 0.5rem;
}

.nss-tag-item {
  font-size: 0.8125rem;
  padding: 0.25rem 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid var(--border-color);
}

.nss-tag-item:hover {
  background: var(--bg-primary);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* Notes Board (Main grid area) */
.notes-board {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  padding: 1.5rem 2rem;
  overflow-y: auto;
}

.nb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.nb-search-wrap {
  position: relative;
  width: 100%;
  max-width: 400px;
  display: flex;
  align-items: center;
}

.nb-search-wrap i,
.nb-search-wrap svg {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
  z-index: 2;
}

.nb-search-input {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem 0 2.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.nb-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.nb-search-input::placeholder {
  color: var(--text-muted);
}

.nb-actions {
  display: flex;
  gap: 1rem;
}

.nb-view-toggle {
  display: flex;
  background: var(--bg-secondary);
  padding: 0.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.nb-toggle-btn {
  width: 36px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nb-toggle-btn.active {
  background: var(--bg-primary);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

/* Note Grid & Cards */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.note-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.note-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: transparent;
  transition: background 0.3s;
}

.note-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg);
  background: var(--bg-primary);
}

.note-card:hover::before {
  background: var(--color-primary);
}

.note-card.pinned {
  background: color-mix(in srgb, var(--color-warning-bg) 20%, var(--bg-secondary));
  border-color: var(--color-warning);
}

.nc-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.nc-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nc-pin-icon {
  color: var(--color-warning);
  font-size: 0.75rem;
}

.nc-content {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 4.8em;
}

.nc-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color-light);
}

.nc-mentions {
  display: flex;
  gap: -8px;
}

.nc-mention-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-right: -8px;
}

.nc-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Slide-over Editor */
.note-slide-over {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  z-index: 1050;
  visibility: hidden;
  transition: visibility 0s 0.3s;
}

.note-slide-over.active {
  visibility: visible;
  transition: visibility 0s;
}

.nso-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.note-slide-over.active .nso-backdrop {
  opacity: 1;
}

.nso-content {
  position: absolute;
  top: 0;
  right: -600px;
  width: 100%;
  max-width: 600px;
  height: 100%;
  background: var(--bg-primary);
  box-shadow: var(--shadow-2xl);
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 1px solid var(--border-color);
}

.nso-tool-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.nso-tool-btn:hover {
  background: var(--bg-tertiary);
  color: var(--color-primary);
}

.nso-tool-btn i {
  width: 16px;
  height: 16px;
}

.nso-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color-light);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.nso-toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nso-toolbar-divider {
  width: 1px;
  height: 18px;
  background: var(--border-color);
  margin: 0 8px;
}

/* Tagging Suggestions */
.tagging-suggestions {
  position: absolute;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 3000;
  min-width: 220px;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  animation: slide-up 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-primary);
}

.suggestion-item:hover {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

.suggestion-item i {
  color: var(--color-primary);
  flex-shrink: 0;
}

.suggestion-item div {
  display: flex;
  flex-direction: column;
}

.suggestion-item span {
  font-weight: 600;
  font-size: 0.9rem;
}

.suggestion-item small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Identified Tags in Editor */
.person-tag,
.company-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 550;
  font-size: 0.9em;
  margin: 0 2px;
  cursor: pointer;
  vertical-align: middle;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.person-tag {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border: 1px solid var(--color-primary-light);
}

.company-tag {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  /* slightly darker indigo */
  border: 1px solid rgba(99, 102, 241, 0.3);
}

[data-theme="light"] .company-tag {
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.person-tag:hover,
.company-tag:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Editor Placeholder */
[contenteditable]:empty:before {
  content: attr(placeholder);
  color: var(--text-muted);
  opacity: 0.6;
  pointer-events: none;
  display: block;
}

.note-slide-over.active .nso-content {
  right: 0;
}

.nso-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.nso-header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nso-close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.nso-close-btn:hover {
  background: var(--bg-tertiary);
}

.nso-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
}

.nso-header-right {
  display: flex;
  gap: 0.5rem;
}

.nso-action-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nso-action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nso-action-btn.danger:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.nso-body {
  flex: 1;
  padding: 2rem 3rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.nso-title-input {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  border: none;
  background: transparent;
  width: 100%;
  margin-bottom: 1rem;
}

.nso-title-input:focus {
  outline: none;
}

.nso-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color-light);
}

.nso-meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.nso-meta-item i {
  width: 14px;
  height: 14px;
}

.nso-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  padding: 0.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
  position: sticky;
  top: -2rem;
  z-index: 10;
}

.nso-toolbar-group {
  display: flex;
  gap: 0.125rem;
}

.nso-toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 0.25rem;
}

.nso-tool-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nso-tool-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nso-editor-content {
  flex: 1;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text-primary);
  outline: none;
}

.nso-editor-content p {
  margin-bottom: 1rem;
}

/* Mentions & Hashtags in Editor */
.mention-span {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  padding: 0 0.375rem;
  border-radius: 4px;
  font-weight: 600;
}

.hashtag-span {
  color: var(--color-secondary);
  font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .notes-sub-sidebar {
    width: 200px;
  }
}

/* ===== ROUTE PLANNING ===== */

/* Page header */
.rp-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.rp-page-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.rp-page-title svg {
  opacity: 0.6;
  color: var(--color-primary);
  flex-shrink: 0;
}

/* 3-panel grid */
.route-planning-container {
  display: grid;
  grid-template-columns: 420px 1fr 380px;
  gap: 1rem;
  height: calc(100vh - var(--header-height) - 5.5rem);
}

/* Panel shell */
.rp-panel {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.rp-panel-head {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.rp-panel-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.rp-panel-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border-radius: 999px;
}

/* Company picker */
.rp-panel--picker {
  grid-row: 1;
}

.rp-panel-search {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  flex-shrink: 0;
}

.rp-panel-search svg {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.rp-panel-search input {
  width: 100%;
  height: 34px;
  padding: 0 0.75rem 0 2.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-family: inherit;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.rp-panel-search input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.rp-panel-search input::placeholder { color: var(--text-muted); }

.rp-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.625rem;
}

/* Company quick card */
.cqc {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  position: relative;
}

.cqc:hover {
  border-color: var(--color-primary);
  background: var(--bg-secondary);
}

.cqc--added {
  border-left: 3px solid var(--color-success);
  background: var(--color-success-bg);
}

.cqc--added:hover {
  border-color: var(--color-success);
  background: var(--color-success-bg);
  cursor: default;
}

.cqc--noaddr {
  opacity: 0.5;
  cursor: default;
}

.cqc--noaddr:hover {
  border-color: var(--border-color);
  background: var(--bg-primary);
}

.cqc--suggested {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
}

.cqc-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.cqc-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  color: white;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.cqc-avatar--noaddr {
  background: var(--bg-tertiary) !important;
  color: var(--text-muted);
}

.cqc-body {
  flex: 1;
  min-width: 0;
}

.cqc-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cqc-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.125rem;
}

.cqc-address {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.cqc-dist {
  font-size: 0.6875rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.cqc-noaddr-label {
  font-size: 0.6875rem;
  color: var(--color-warning, #f59e0b);
  font-style: italic;
}

.cqc-add {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.cqc:hover .cqc-add {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

.cqc-badge {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--color-success);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cqc-lock {
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0.6;
}

/* Empty state */
.rp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  text-align: center;
}

.rp-empty svg { opacity: 0.3; }
.rp-empty p { font-size: 0.875rem; margin: 0; }
.rp-empty--full { padding: 3rem 1.5rem; }

/* ── Route Builder panel ── */
.rp-panel--builder {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Stats strip */
.rp-stats {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  gap: 0;
  flex-shrink: 0;
}

.rp-stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.rp-stat svg {
  color: var(--color-primary);
  opacity: 0.7;
  flex-shrink: 0;
}

.rp-stat > div {
  display: flex;
  flex-direction: column;
}

.rp-stat-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.rp-stat-key {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.rp-stat-sep {
  width: 1px;
  height: 28px;
  background: var(--border-color);
  flex-shrink: 0;
  margin: 0 0.75rem;
}

/* Assignment row */
.rp-assign {
  display: flex;
  gap: 0.625rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.rp-assign input,
.rp-assign select {
  flex: 1;
  height: 34px;
  padding: 0 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-family: inherit;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.rp-assign input:focus,
.rp-assign select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Stops list */
.rp-stops {
  flex: 1;
  overflow-y: auto;
  padding: 0.625rem;
  min-height: 0;
}

.rp-stops-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  text-align: center;
}

.rp-stops-empty svg { opacity: 0.25; margin-bottom: 0.5rem; }
.rp-stops-empty p { font-size: 0.875rem; margin: 0; font-weight: 500; }
.rp-stops-empty span { font-size: 0.8125rem; opacity: 0.7; }

/* Route stop item */
.rsi {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--bg-primary);
  cursor: default;
  transition: border-color var(--transition-fast);
}

.rsi:hover {
  border-color: var(--color-primary);
  background: var(--bg-secondary);
}

.rsi.sortable-chosen { opacity: 0.65; cursor: grabbing; }
.rsi.sortable-ghost  { opacity: 0.35; }

.rsi-grip {
  color: var(--text-muted);
  cursor: grab;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  opacity: 0.5;
  transition: opacity var(--transition-fast);
}

.rsi:hover .rsi-grip { opacity: 1; }

.rsi-num {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rsi-body {
  flex: 1;
  min-width: 0;
}

.rsi-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rsi-sub {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.125rem;
}

.rsi-tag {
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.05rem 0.375rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.rsi-tag--start {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.rsi-leg {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.rsi-remove {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.rsi-remove:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

/* Footer */
.rp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.rp-footer-right {
  display: flex;
  gap: 0.5rem;
}

.rp-btn-clear {
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.rp-btn-clear:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.rp-btn-optimize {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

/* Map panel */
.rp-panel--map {
  display: flex;
  flex-direction: column;
}

.rp-map-wrap {
  flex: 1;
  position: relative;
  min-height: 0;
}

#route-planning-map {
  position: absolute;
  inset: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.rp-map-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: var(--bg-secondary);
  color: var(--text-muted);
  text-align: center;
}

.rp-map-empty svg { opacity: 0.25; }
.rp-map-empty p { font-size: 0.875rem; margin: 0; }

/* Saved routes */
.rp-saved-section {
  margin-top: 1.25rem;
}

.rp-saved-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.rp-saved-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.rp-saved-count {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border-radius: 999px;
}

.ri-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 0.75rem;
}

.ri {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-primary);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.ri:hover {
  border-color: var(--color-primary);
  background: var(--bg-secondary);
}

.ri-icon-col { flex-shrink: 0; }

.ri-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--color-primary-bg);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ri-body { flex: 1; min-width: 0; }

.ri-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ri-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}

.ri-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.ri-chip--stops { background: var(--color-primary-bg); color: var(--color-primary); }
.ri-chip--dist  { background: var(--color-success-bg); color: var(--color-success); }
.ri-chip--time  { background: var(--bg-tertiary); color: var(--text-secondary); }

.ri-assignees {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.ri-assignee {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.ri-assignee-av {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ri-unassigned {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.ri-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-shrink: 0;
}

.ri-delete-btn:hover {
  background: var(--color-danger-bg) !important;
  color: var(--color-danger) !important;
}

/* Responsive */
@media (max-width: 1200px) {
  .route-planning-container {
    grid-template-columns: 360px 1fr 340px;
  }
}

@media (max-width: 992px) {
  .route-planning-container {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 260px 1fr;
    height: auto;
  }
  .rp-panel--picker {
    grid-column: 1 / -1;
  }
  .rp-panel--map {
    min-height: 300px;
  }
  .ri-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .route-planning-container {
    grid-template-columns: 1fr;
    grid-template-rows: 220px auto auto;
  }
}

/* ===== Auto Plan Routes ===== */
.auto-plan-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.auto-plan-btn svg {
  opacity: 0.7;
}

/* Modal */
.auto-plan-modal {
  max-width: 100% !important;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}

.auto-plan-modal .modal-header {
  border-radius: 0;
}

.auto-plan-header {
  padding: 0.875rem 1.5rem;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

.auto-plan-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--text-primary);
}

.auto-plan-title h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.auto-plan-title svg {
  color: var(--text-muted);
}

/* Tabs */
.auto-plan-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  padding: 0 1.5rem;
}

.auto-plan-tab {
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.auto-plan-tab:hover {
  color: var(--text-secondary);
}

.auto-plan-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--color-primary);
}

.auto-plan-tab.completed {
  color: var(--color-success);
}

/* Body */
.auto-plan-body {
  padding: 0;
  flex: 1;
  overflow-y: auto;
  max-height: none;
}

.auto-plan-step-content {
  display: none;
  padding: 1.25rem;
}

.auto-plan-step-content.active {
  display: block;
}

/* Configure layout – reps on left, companies on right */
.auto-plan-configure {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
  height: calc(100vh - 180px);
}

@media (max-width: 768px) {
  .auto-plan-configure {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.auto-plan-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-primary);
  min-height: 0;
}

.auto-plan-panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.auto-plan-panel-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.auto-plan-panel-count {
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--color-primary);
  color: white;
  padding: 0.0625rem 0.4375rem;
  border-radius: var(--radius-full);
  min-width: 1.25rem;
  text-align: center;
  line-height: 1.4;
}

.auto-plan-panel-actions {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.auto-plan-panel-header > .btn {
  margin-left: auto;
}

.auto-plan-panel-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.auto-plan-panel-search svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.auto-plan-panel-search input {
  flex: 1;
  border: none;
  background: none;
  font-size: 0.8125rem;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
}

.auto-plan-panel-search input::placeholder {
  color: var(--text-muted);
}

.auto-plan-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem;
}

/* Selection rows */
.auto-plan-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.1s ease;
  border: 1px solid transparent;
  margin-bottom: 1px;
}

.auto-plan-row:hover {
  background: var(--bg-secondary);
}

.auto-plan-row.selected {
  background: var(--color-primary-bg);
  border-color: color-mix(in srgb, var(--color-primary) 15%, transparent);
}

.auto-plan-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
  cursor: pointer;
}

.auto-plan-row-avatar {
  width: 30px;
  height: 30px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.auto-plan-row.selected .auto-plan-row-avatar {
  background: var(--color-primary);
  color: white;
}

.auto-plan-row-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.0625rem;
}

.auto-plan-row-name {
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auto-plan-row-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Footer */
.auto-plan-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.auto-plan-footer .footer-spacer {
  flex: 1;
}

/* ===== Route Review (Auto Plan review tab) ===== */

/* Summary strip */
.rv-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}
.rv-summary-item strong { color: var(--color-primary); font-weight: 700; }
.rv-summary-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--border-color); }

/* Routes grid */
.rv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1rem;
}

/* Card */
.rv-card {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}
.rv-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.rv-card-color { width: 4px; flex-shrink: 0; }
.rv-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Card top row */
.rv-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color-light);
}
.rv-route-name {
  background: transparent;
  border: 1px solid transparent;
  padding: 0.25rem 0.375rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  min-width: 0;
  flex: 1;
}
.rv-route-name:hover { background: var(--bg-secondary); border-color: var(--border-color); }
.rv-route-name:focus { outline: none; background: var(--bg-primary); border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary-bg); }
.rv-card-stats {
  display: flex;
  gap: 0.625rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}
.rv-card-stats span {
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
}

/* Rep section */
.rv-card-rep-section { padding: 0.5rem 1rem; position: relative; }
.rv-rep-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}
.rv-rep-display:hover, .rv-rep-display.open { background: var(--bg-secondary); }
.rv-rep-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.625rem;
  flex-shrink: 0;
}
.rv-rep-name { font-size: 0.8125rem; font-weight: 550; color: var(--text-primary); }
.rv-rep-extra {
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 0 0.375rem;
  border-radius: var(--radius-full);
}
.rv-rep-chevron {
  margin-left: auto;
  opacity: 0.4;
  transition: transform 0.2s, opacity 0.2s;
  flex-shrink: 0;
}
.rv-rep-display.open .rv-rep-chevron { transform: rotate(180deg); opacity: 0.7; }

/* Rep dropdown */
.rv-rep-dropdown {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  margin-top: 0.25rem;
  overflow: hidden;
}
.rv-rep-dropdown-section { padding: 0.25rem 0; }
.rv-rep-dropdown-label {
  display: block;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 0.375rem 0.75rem 0.25rem;
}
.rv-rep-dropdown-divider { height: 1px; background: var(--border-color-light); }
.rv-rep-dropdown-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-primary);
  transition: background 0.1s;
}
.rv-rep-dropdown-row:hover { background: var(--bg-secondary); }
.rv-rep-dropdown-row .rv-rep-actions { margin-left: auto; display: flex; gap: 0.25rem; }
.rv-rep-avatar-sm {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.5625rem;
  flex-shrink: 0;
  background: var(--color-primary);
}
.rv-rep-action-btn {
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  font-size: 0.6875rem;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-secondary);
}
.rv-rep-action-btn:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-bg); }
.rv-switch-btn { color: var(--text-muted); }
.rv-rep-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  padding: 0;
  margin-left: auto;
  transition: color 0.15s;
}
.rv-rep-remove:hover { color: var(--color-danger); }
.rv-rep-dropdown-empty {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Map */
.rv-card-map {
  height: 200px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color-light);
  border-bottom: 1px solid var(--border-color-light);
}
.rv-card-map .leaflet-container { height: 100%; }

/* Stops list */
.rv-card-stops {
  padding: 0.5rem 0;
  max-height: 180px;
  overflow-y: auto;
}
.rv-stop {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.3rem 1rem;
  transition: background 0.1s;
}
.rv-stop:hover { background: var(--bg-secondary); }
.rv-stop-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  flex-shrink: 0;
}
.rv-stop-name {
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}
.rv-stop-addr {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40%;
  flex-shrink: 0;
}

/* Outlier notice */
.rv-outlier-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  background: rgba(245,158,11,0.06);
  border: 1px solid rgba(245,158,11,0.18);
  border-radius: var(--radius-md);
  padding: 0.625rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.rv-outlier-notice svg { color: #f59e0b; flex-shrink: 0; }
.rv-outlier-toggle { margin-left: auto; }
.rv-outlier-expandable {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding-top: 0.5rem;
}
.rv-outlier-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.15);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-primary);
}
.rv-outlier-chip em { font-style: normal; font-weight: 600; color: #d97706; }

/* Footer accents */
.auto-plan-footer .btn-primary:last-child { background: var(--color-primary); }
.auto-plan-footer .spinner { width: 16px; height: 16px; animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ===== TASKS KANBAN BOARD ===== */
.tasks-kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.tasks-search-bar {
  flex: 1;
  min-width: 250px;
  max-width: 400px;
  position: relative;
}

.tasks-search-bar input {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem 0 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.tasks-search-bar input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.tasks-search-bar input::placeholder {
  color: var(--text-muted);
}

.tasks-search-bar i,
.tasks-search-bar svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.tasks-header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.tasks-kanban-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
}

/* Kanban Column */
.kanban-column {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1rem;
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-color);
}

.kanban-column-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.kanban-column-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

.kanban-column-icon.todo {
  background: #FFF4E6;
  color: #F59E0B;
}

.kanban-column-icon.in-progress {
  background: #DBEAFE;
  color: #3B82F6;
}

.kanban-column-icon.done {
  background: #D1FAE5;
  color: #10B981;
}

.kanban-column-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.kanban-add-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.kanban-add-btn:hover {
  background: var(--bg-primary);
  color: var(--color-primary);
}

.kanban-cards-container {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem;
  margin: -0.25rem;
}

/* Task Card */
.kanban-task-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.kanban-task-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(47, 95, 208, 0.15);
  transform: translateY(-1px);
}

.kanban-task-card.sortable-chosen {
  opacity: 0.68;
  cursor: grabbing;
}

.kanban-task-card.sortable-ghost {
  opacity: 0.3;
  background: var(--color-primary-bg);
}

.task-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.task-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
  margin-right: 0.5rem;
}

.task-card-menu {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition-fast);
}

.kanban-task-card:hover .task-card-menu {
  opacity: 1;
}

.task-card-menu:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.task-card-description {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-card-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.task-tag {
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.task-tag.priority-high {
  background: #FEE2E2;
  color: #DC2626;
}

.task-tag.priority-medium {
  background: #FEF3C7;
  color: #D97706;
}

.task-tag.priority-low {
  background: #DBEAFE;
  color: #2563EB;
}

.task-tag.category {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.task-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color-light);
}

.task-card-due-date {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.85rem;
  /* Increased from 0.75rem */
  font-weight: 550;
  color: var(--text-muted);
}

.task-card-due-date i {
  font-size: 0.85rem;
}

.task-card-due-date.overdue {
  color: var(--color-danger);
}

.task-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.task-card-assignee-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.task-card-assignee {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.task-card-assignee-name {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.task-card-progress {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.task-card-comments {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Task Detail View Modal */
.task-detail-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10050;
  padding: 1rem;
}

.task-detail-modal.active {
  display: flex;
}

.task-detail-container {
  background: var(--bg-primary);
  border-radius: 20px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.14);
}

/* ── Header ────────────────────────────────────── */
.tdv-header {
  padding: 1.25rem 1.5rem 1.1rem;
  border-bottom: 1px solid var(--border-color-light);
  border-left: 4px solid transparent;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(145deg, var(--bg-primary), var(--bg-secondary));
}

.tdv-priority-high    { border-left-color: #DC2626; }
.tdv-priority-medium  { border-left-color: #D97706; }
.tdv-priority-low     { border-left-color: #2563EB; }

.tdv-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.tdv-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.75rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.tdv-status-pending {
  background: #FEF3C7;
  color: #D97706;
}

.tdv-status-in_progress {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

.tdv-status-completed {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.tdv-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 0 0 0.875rem;
}

.tdv-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tdv-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
}

.tdv-pill-priority-high {
  background: #FEE2E2;
  color: #DC2626;
  border-color: #FECACA;
}

.tdv-pill-priority-medium {
  background: #FEF3C7;
  color: #D97706;
  border-color: #FDE68A;
}

.tdv-pill-priority-low {
  background: #DBEAFE;
  color: #2563EB;
  border-color: #BFDBFE;
}

.tdv-pill-due {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.tdv-pill-overdue {
  background: #FEE2E2;
  color: #DC2626;
  border-color: #FECACA;
}

.tdv-pill-nodate {
  background: var(--bg-secondary);
  color: var(--text-muted);
  border-color: var(--border-color-light);
}

/* ── Body ──────────────────────────────────────── */
.tdv-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.tdv-section {
  margin-bottom: 1.25rem;
}

.tdv-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 0.6rem;
}

.tdv-desc {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.65;
  white-space: pre-wrap;
}

/* ── People ────────────────────────────────────── */
.tdv-people {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.tdv-person {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.875rem;
  flex: 1;
  min-width: 150px;
}

.tdv-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.tdv-avatar-blue {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

.tdv-avatar-purple {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
}

.tdv-person-info {
  min-width: 0;
}

.tdv-person-label {
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tdv-person-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Actions ───────────────────────────────────── */
/* ── Footer ───────────────────────────────────── */
.tdv-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border-top: 1px solid var(--border-color-light);
  background: var(--bg-secondary);
  border-radius: 0 0 20px 20px;
}

.tdv-edit-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 36px;
  padding: 0 1rem;
  font-size: 0.8375rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  letter-spacing: 0.1px;
}

.tdv-edit-btn:hover {
  background: var(--bg-tertiary, #f3f4f6);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.tdv-delete-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.tdv-delete-btn:hover {
  background: var(--color-danger-bg);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.tdv-lock-notice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.875rem;
  font-size: 0.825rem;
  color: var(--text-muted);
  width: 100%;
}

/* Responsive */
@media (max-width: 1200px) {
  .tasks-kanban-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .kanban-column:last-child {
    grid-column: 1 / -1;
  }
}

/* Empty state */
.kanban-empty-state {
  text-align: center;
  padding: 1.25rem 0.9rem;
  color: var(--text-muted);
  border: 1px dashed var(--border-color-light);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-secondary) 60%, transparent);
}

.kanban-empty-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  opacity: 1;
  margin-bottom: 0.45rem;
}

.kanban-empty-text {
  font-size: 0.82rem;
}

/* ═══════════════════════════════════════════════════
   MANAGER DASHBOARD — db-* namespace
   ═══════════════════════════════════════════════════ */

.db {
  padding: 0 0.25rem 2rem;
  max-width: 1600px;
  margin: 0 auto;
}

/* ── Header ── */
.db-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color-light);
}
.db-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}
.db-sub {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.db-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.db-refresh:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.04);
}

/* ── KPI Cards ── */
.db-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.db-kpi {
  background: var(--bg-primary);
  border: 1px solid var(--border-color-light);
  border-radius: 12px;
  padding: 1.125rem 1.25rem;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.db-kpi:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
  border-color: var(--border-color);
}
.db-kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.db-kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.db-kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.db-kpi-val {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.db-kpi-of {
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--text-muted);
}
.db-kpi-foot {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.db-kpi-loading {
  min-height: 110px;
}

/* ── Shared card ── */
.db-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color-light);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.db-card-wide { min-width: 0; }
.db-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.db-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.db-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.db-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ── Pipeline stage bar ── */
.db-stage-bar {
  display: flex;
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1rem;
  background: var(--border-color-light);
}
.db-stage-seg {
  height: 100%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.db-stage-legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.625rem;
}
.db-stage-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}
.db-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.db-stage-name {
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-stage-val {
  font-weight: 600;
  color: var(--text-primary);
}
.db-stage-ct {
  color: var(--text-muted);
  font-size: 0.75rem;
  min-width: 20px;
  text-align: right;
}

/* ── Chart area (bar charts) ── */
.db-chart-area {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 180px;
  padding-top: 8px;
}
.db-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
}
.db-bar-pair {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  flex: 1;
  width: 100%;
}
.db-bar {
  width: 14px;
  border-radius: 4px 4px 0 0;
  transition: height 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
  position: relative;
}
.db-bar:hover { opacity: 0.8; }
.db-bar:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 0.65rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}
.db-bar-c { background: linear-gradient(180deg, #3b82f6, #60a5fa); }
.db-bar-w { background: linear-gradient(180deg, #10b981, #34d399); }
.db-bar-v { background: linear-gradient(180deg, #f97316, #fdba74); width: 20px; }
.db-bar-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.db-legend-row { display: flex; gap: 1rem; }
.db-legend { display: flex; align-items: center; gap: 5px; font-size: 0.75rem; color: var(--text-secondary); }

/* ── Grid layouts ── */
.db-row-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  margin-bottom: 0;
}
.db-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0;
}
.db-row-bottom {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
}

@media (max-width: 1100px) {
  .db-row-2, .db-row-bottom { grid-template-columns: 1fr; }
  .db-row-3 { grid-template-columns: 1fr 1fr; }
}
/* ── Leaderboard ── */
.db-lb-list { display: flex; flex-direction: column; gap: 6px; }
.db-lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: 6px;
  transition: background 0.15s;
}
.db-lb-row:hover { background: var(--bg-secondary); }
.db-lb-rank {
  width: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
}
.db-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
}
.db-lb-name {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-lb-val {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 24px;
  text-align: right;
}
.db-lb-bar-track {
  width: 60px;
  height: 4px;
  background: var(--border-color-light);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.db-lb-bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Tasks ── */
.db-badge-warn {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}
.db-task-list { display: flex; flex-direction: column; gap: 2px; }
.db-task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}
.db-task-row:hover { background: var(--bg-secondary); }
.db-task-overdue { background: rgba(239, 68, 68, 0.04); }
.db-task-pri {
  width: 4px;
  height: 28px;
  border-radius: 3px;
  flex-shrink: 0;
}
.db-pri-high, .db-pri-urgent { background: #ef4444; }
.db-pri-medium { background: #f59e0b; }
.db-pri-low { background: #10b981; }
.db-task-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.db-task-name {
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-task-assignee {
  font-size: 0.6875rem;
  color: var(--text-muted);
}
.db-task-due {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.db-due-overdue {
  color: #dc2626;
}

/* ── Closing Soon ── */
.db-close-list { display: flex; flex-direction: column; gap: 2px; }
.db-close-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}
.db-close-row:hover { background: var(--bg-secondary); }
.db-close-info { flex: 1; min-width: 0; }
.db-close-name {
  display: block;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-close-stage {
  font-size: 0.6875rem;
  font-weight: 600;
}
.db-close-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
}
.db-close-val {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
}
.db-close-days {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* ── Table ── */
.db-table {
  width: 100%;
  border-collapse: collapse;
}
.db-table th {
  text-align: left;
  padding: 0.625rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border-color-light);
}
.db-table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border-color-light);
  font-size: 0.8125rem;
  color: var(--text-primary);
}
.db-table tbody tr:hover { background: var(--bg-secondary); }
.db-table tbody tr:last-child td { border-bottom: none; }

.db-user {
  display: flex;
  align-items: center;
  gap: 8px;
}
.db-avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}
.db-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
}
.db-score-hi { background: rgba(16,185,129,0.12); color: #059669; }
.db-score-md { background: rgba(245,158,11,0.12); color: #b45309; }
.db-score-lo { background: rgba(239,68,68,0.12); color: #dc2626; }
.db-muted { color: var(--text-muted); font-size: 0.8125rem; }

/* ── Reminders ── */
.db-rem-list { display: flex; flex-direction: column; gap: 2px; }
.db-rem-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}
.db-rem-row:hover { background: var(--bg-secondary); }
.db-rem-overdue { background: rgba(239,68,68,0.04); }
.db-rem-icon {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.db-rem-title {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-rem-due {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ── Skeleton loading ── */
.db-skel {
  background: var(--border-color-light);
  border-radius: 6px;
  animation: db-pulse 1.5s infinite;
}
.db-skel-title { width: 220px; height: 24px; margin-bottom: 8px; }
.db-skel-sub { width: 340px; height: 14px; }
.db-skel-block { width: 100%; height: 80px; }
.db-skel-chart { width: 100%; height: 200px; }

@keyframes db-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.25; }
}

/* External Toggle Button for Password */
.toggle-password-external {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 48px;
  /* Match input height */
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
  flex-shrink: 0;
}

.toggle-password-external:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--bg-tertiary);
}

/* Clean start for Onboarding Premium Styles */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

.onboarding-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.onboarding-svg {
  width: 100%;
  height: 100%;
}

.onboarding-bubble {
  position: fixed;
  z-index: 10001;
  width: 340px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.onboarding-bubble.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

[data-theme="dark"] .onboarding-bubble {
  background: rgba(18, 18, 18, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

/* Staggered Content */
.onboarding-bubble.active .ob-title-group {
  animation: obSlideUp 0.5s ease forwards 0.1s;
}

.onboarding-bubble.active #ob-text {
  animation: obSlideUp 0.5s ease forwards 0.2s;
}

.onboarding-bubble.active .onboarding-progress-container {
  animation: obSlideUp 0.5s ease forwards 0.3s;
}

.onboarding-bubble.active .onboarding-bubble-footer {
  animation: obSlideUp 0.5s ease forwards 0.4s;
}

@keyframes obSlideUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ob-title-group,
#ob-text,
.onboarding-progress-container,
.onboarding-bubble-footer {
  opacity: 0;
}

/* Header Alignment Fix */
.ob-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.ob-icon {
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  /* Align with title height */
}

#ob-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

#ob-text {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

/* Progress Bar */
.onboarding-progress-container {
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 2px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

[data-theme="dark"] .onboarding-progress-container {
  background: rgba(255, 255, 255, 0.1);
}

.onboarding-progress-bar {
  height: 100%;
  background: var(--color-primary);
  width: 0%;
  transition: width 0.4s ease;
}

/* Footer & Buttons */
.onboarding-bubble-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 1.25rem;
  margin-top: auto;
}

[data-theme="dark"] .onboarding-bubble-footer {
  border-top-color: rgba(255, 255, 255, 0.05);
}

.onboarding-actions-right {
  display: flex;
  gap: 0.625rem;
}

.ob-btn {
  padding: 0.625rem 1.25rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ob-btn-skip {
  background: transparent;
  color: var(--text-muted);
  padding-left: 0;
  padding-right: 0;
}

.ob-btn-skip:hover {
  color: var(--text-primary);
}

.ob-btn-back {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.ob-btn-back:hover {
  background: var(--bg-secondary);
}

.ob-btn-next {
  background: var(--color-primary);
  color: white;
  min-width: 80px;
  box-shadow: 0 4px 12px rgba(var(--color-primary-rgb), 0.3);
}

.ob-btn-next:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.onboarding-arrow {
  position: absolute;
  width: 16px;
  height: 16px;
  background: inherit;
  border: inherit;
  border-right: 0;
  border-bottom: 0;
  z-index: -1;
}

.arrow-bottom {
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.arrow-top {
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(225deg);
}

.arrow-right {
  left: -8px;
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
}

.arrow-left {
  right: -8px;
  top: 50%;
  transform: translateY(-50%) rotate(135deg);
}

.onboarding-overlay.active #onboarding-hole {
  animation: obHolePulse 2s ease-in-out infinite;
}

@keyframes obHolePulse {
  0% {
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 0;
  }

  50% {
    stroke: rgba(255, 255, 255, 0.5);
    stroke-width: 4px;
  }

  100% {
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 0;
  }
}

.onboarding-celebrate {
  text-align: center;
  padding: 1rem 0;
}

.onboarding-celebrate i {
  font-size: 3.5rem;
  color: var(--color-success);
  margin-bottom: 1.25rem;
  display: block;
}

.onboarding-celebrate h3 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

/* ===== PWA INSTALL BANNER ===== */
.install-banner {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 400px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-fixed);
  padding: 12px;
  animation: slideUp 0.4s ease-out;
}

@media (min-width: 901px) {
  .install-banner {
    bottom: 24px;
  }
}

.install-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.install-banner-text {
  flex: 1;
}

.install-banner-text strong {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
}

.install-banner-text p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.install-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 100%);
    opacity: 0;
  }

  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* ===== CALL LOGS VIEW ===== */

/* ── Header bar ── */
.call-logs-filters {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: nowrap;
}

.cl-search {
  flex-shrink: 0;
  width: 230px;
}

.cl-search input {
  height: 32px;
  width: 100%;
  font-size: 0.8125rem;
}

/* Compact controls in call-logs header */
.page-header-row .call-logs-filters .filter-select {
  height: 32px;
  padding: 0 0.65rem;
  font-size: 0.8125rem;
  width: auto;
  flex-shrink: 0;
}

.page-header-row .call-logs-filters .btn {
  height: 32px;
  padding: 0 0.75rem;
  font-size: 0.8125rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.page-header-row .call-logs-filters .view-toggle {
  padding: 0.15rem;
  flex-shrink: 0;
}

.page-header-row .call-logs-filters .toggle-btn {
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
}

.page-header-row {
  align-items: center;
  flex-wrap: nowrap;
}

/* View Toggle for Managers */
.view-toggle {
  display: flex;
  background: var(--bg-secondary);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 0.25rem;
}

.toggle-btn {
  padding: 0.4rem 0.875rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.toggle-btn:hover {
  color: var(--text-primary);
}

.toggle-btn.active {
  background: var(--bg-secondary);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.filter-select {
  height: var(--control-height-md);
  padding: 0 var(--space-4);
  border-radius: var(--btn-radius);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
}

.outcome-badge {
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.outcome-badge.connected {
  background: #D7F44A;
  color: #1F2A00;
}

/* Strong indigo – already good */
.outcome-badge.voicemail {
  background: #2F2E8B;
  color: #E6E9FF;
}

/* Neutral but solid (cool slate) */
.outcome-badge.no-answer {
  background: #3A3F4B;
  color: #E5E7EB;
}

/* Warm amber, not washed out */
.outcome-badge.busy {
  background: #8A5A00;
  color: #FFF3D6;
}

/* Muted red, clearly invalid */
.outcome-badge.wrong-number {
  background: #6B1F1F;
  color: #FFE4E4;
}

/* Strong failure red */
.outcome-badge.call-failed {
  background: #7A1E24;
  color: #FFE6E8;
}

/* ── Clear filters button ── */
.cl-clear-filters-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  height: 32px;
  padding: 0 0.625rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-color: transparent;
}

.cl-clear-filters-btn:hover {
  color: var(--color-danger, #e53e3e);
  background: var(--color-error-bg, rgba(229, 62, 62, 0.08));
}

/* ── Activity Feed ── */
.cl-feed {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.cl-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color-light);
  transition: background var(--transition-fast);
  position: relative;
}

.cl-row:last-child {
  border-bottom: none;
}

.cl-row:hover {
  background: var(--bg-secondary);
}

/* Direction bubble */
.cl-row-dir {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cl-row-dir--outbound {
  background: rgba(var(--color-primary-rgb, 99, 102, 241), 0.1);
  color: var(--color-primary);
}

.cl-row-dir--inbound {
  background: rgba(255, 210, 0, 0.12);
  color: #a07400;
}

/* Main body: contact + note */
.cl-row-body {
  flex: 1;
  min-width: 0;
}

.cl-row-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.cl-row-sub {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 0.18rem;
  font-size: 0.775rem;
  color: var(--text-muted);
  min-width: 0;
}

.cl-row-company {
  flex-shrink: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cl-row-note {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.75;
  min-width: 0;
}

.cl-row-company + .cl-row-note::before {
  content: ' · ';
  margin: 0 0.1rem;
  opacity: 0.5;
}

/* Rep name (manager team view) */
.cl-row-rep {
  flex-shrink: 0;
  font-size: 0.775rem;
  color: var(--text-muted);
  min-width: 80px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Time + duration */
.cl-row-meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  min-width: 96px;
  text-align: right;
}

.cl-row-time {
  font-size: 0.775rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.cl-row-dur {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.65;
}

/* Action buttons: fade in on row hover */
.cl-row-actions {
  flex-shrink: 0;
  display: flex;
  gap: 0.15rem;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.cl-row:hover .cl-row-actions {
  opacity: 1;
}

/* Outcome badge inside a row: keep fixed width so align stays consistent */
.cl-row > .outcome-badge {
  flex-shrink: 0;
  min-width: 88px;
  justify-content: center;
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
}

/* ── Empty state ── */
.cl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  gap: 0.75rem;
  text-align: center;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.cl-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.cl-empty-title {
  font-size: 1rem;
  font-weight: 650;
  color: var(--text-primary);
}

.cl-empty-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.55;
  margin-bottom: 0.5rem;
}

/* Dark mode adjustments */
[data-theme="dark"] .cl-feed {
  border-color: #2d343e;
}

[data-theme="dark"] .cl-row {
  border-bottom-color: rgba(255,255,255,0.04);
}

[data-theme="dark"] .cl-row:hover {
  background: rgba(255,255,255,0.03);
}

[data-theme="dark"] .cl-row-dir--inbound {
  background: rgba(255, 200, 0, 0.08);
  color: #c8a400;
}

[data-theme="dark"] .cl-empty {
  border-color: #2d343e;
  background: #0d1117;
}

[data-theme="dark"] .cl-empty-icon {
  background: #161b22;
  border-color: #2d343e;
}


.outcome-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.outcome-option {
  display: block;
  width: 100%;
}

.outcome-option input {
  display: none;
}

.outcome-card {
  padding: 1rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: var(--transition-fast);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50%;
  width: 100%;
  min-height: 20px;
  aspect-ratio: 1.2 / 1;
  background: var(--bg-secondary);
}

.outcome-card:hover {
  border-color: var(--text-muted);
  background: var(--bg-tertiary);
}

.outcome-option input:checked+.outcome-card {
  font-weight: 700;
  box-shadow: 0 0 0 2px currentColor;
}

/* Specific Outcome Colors */
.outcome-option input[value="Connected"]:checked+.outcome-card {
  background: #D7F44A;
  color: #1F2A00;
  border-color: #D7F44A;
}

.outcome-option input[value="Voicemail"]:checked+.outcome-card {
  background: #2F2E8B;
  color: #E6E9FF;
  border-color: #2F2E8B;
}

.outcome-option input[value="No Answer"]:checked+.outcome-card,
.outcome-option input[value="Busy"]:checked+.outcome-card {
  background: #3A3F4B;
  color: #E5E7EB;
  border-color: #3A3F4B;
}

.outcome-option input[value="Wrong Number"]:checked+.outcome-card,
.outcome-option input[value="Call Failed"]:checked+.outcome-card {
  background: #7A1E24;
  color: #FFE6E8;
  border-color: #7A1E24;
}


/* Live Search Results */
.search-input-group {
  position: relative;
}

.live-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-height: 250px;
  overflow-y: auto;
  display: none;
}

.live-search-results.active {
  display: block;
}

.live-search-results .search-result-item {
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.625rem;
}

.live-search-results .search-result-item .search-result-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
  min-width: 0;
}

.live-search-results .search-result-item:hover {
  background: var(--bg-tertiary);
}

.live-search-results .search-result-item .title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.live-search-results .search-result-item .subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.live-search-results .search-result-item.add-new {
  border-top: 1px solid var(--border-color);
  color: var(--color-primary);
  font-weight: 600;
  background: var(--color-primary-bg);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* View Details Grid */
.view-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-field.full-row {
  grid-column: 1 / -1;
}

.detail-field label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.detail-value {
  font-size: 1rem;
  color: var(--text-primary);
  word-break: break-word;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  min-height: 2.5rem;
  display: flex;
  align-items: center;
}

/* Compact spacing for Company modal details */
#company-view-modal .view-details-grid {
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

#company-view-modal .detail-field {
  gap: 0.25rem;
}

#company-view-modal .detail-value {
  padding: 0.5rem;
  min-height: 2rem;
  font-size: 0.95rem;
  align-items: flex-start;
}

/* Make links inside modal detail values wrap nicely and look compact */
#company-view-modal .detail-value a,
#person-view-modal .detail-value a,
#opportunity-view-modal .detail-value a {
  display: inline-block;
  padding: 0.28rem 0.6rem;
  margin: 0;
  background: transparent;
  color: var(--color-primary);
  text-decoration: none;
  border-radius: 8px;
  white-space: normal;
  word-break: break-word;
}

/* If the domain/email uses the pill class, neutralize heavy pill styling in the sidebar */
#company-view-modal .detail-value .company-summary-domain-link,
#person-view-modal .detail-value .company-summary-domain-link {
  padding: 0.28rem 0.6rem;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
  font-weight: 600;
}

/* Direction Badge Styling */
.direction-badge {
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}


.direction-badge.inbound {
  background: #ffef4d;
  color: #353935;
}

.direction-badge.outbound {
  background: #353935;
  color: #ffef4d;
}

/* Employees list in Company View */
.company-employees-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px;
}

.company-employee {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 8px;
  border-radius: 8px;
  transition: background 120ms ease, transform 120ms ease;
  cursor: default;
}

.company-employee:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.03));
  transform: translateY(-1px);
}

.company-employee .employee-left {
  flex: 0 0 auto;
}

.company-employee .mention-avatar {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-on-accent, #ffffff);
  background: linear-gradient(135deg, rgba(43, 111, 245, 1) 0%, rgba(67, 156, 255, 1) 100%);
}

.company-employee .employee-main {
  flex: 1 1 auto;
  min-width: 0;
}

.company-employee .employee-name {
  font-size: 1.02rem;
  color: var(--text-primary);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-employee .employee-role {
  margin-top: 6px;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.company-employee .employee-actions {
  margin-left: 8px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.company-employee .employee-actions .btn,
.company-employee .employee-actions .view-employee {
  padding: 6px 8px;
  font-size: 0.9rem;
  background: transparent;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
}

/* Subtle divider between employees */
.company-employee+.company-employee {
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

@media (max-width: 800px) {
  .company-employee {
    padding: 8px 6px;
    gap: 10px;
  }

  .company-employee .mention-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }

  .company-employee .employee-name {
    font-size: 0.95rem;
  }
}

/* Search Input Wrapper */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-input-wrapper input {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem 0 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input-wrapper input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.search-input-wrapper input::placeholder {
  color: var(--text-muted);
}

/* Call Log Modal specific adjustments */
#call-log-modal .form-grid {
  grid-template-columns: repeat(3, 1fr);
}

#call-log-modal .form-field:nth-child(n+7) {
  grid-column: 1 / -1;
}

/* ===== REMINDERS V2 WORKSPACE ===== */
/* ================================================================
   REMINDERS v2 — Redesigned from scratch
   Clean timeline layout, status-driven visual language.
   Uses existing design tokens throughout.
   ================================================================ */

/* ── Page shell ── */
.rem-page {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-bottom: 2rem;
}

/* ── Page header ── */
.rem-page-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.rem-page-head .rem-search-wrap {
  flex-shrink: 0;
}

.rem-page-head .rem-filters {
  flex: 1;
}

.rem-page-head .btn {
  margin-left: auto;
  flex-shrink: 0;
}

.rem-page-head-text {
  min-width: 0;
}

.rem-page-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0;
}

.rem-page-sub {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── KPI strip ── */
.rem-kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.625rem;
}

.rem-kpi {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  transition: border-color var(--transition-base);
}

.rem-kpi:hover {
  border-color: rgba(var(--color-primary-rgb), 0.35);
}

.rem-kpi.is-danger {
  border-color: rgba(200, 58, 58, 0.5);
  background: linear-gradient(135deg, var(--color-danger-bg) 0%, transparent 70%);
}

.rem-kpi.is-danger .rem-kpi-icon {
  color: var(--color-danger);
  background: var(--color-danger-bg);
}

.rem-kpi.is-danger .rem-kpi-val {
  color: var(--color-danger);
}

.rem-kpi-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.rem-kpi-icon svg,
.rem-kpi-icon i {
  width: 16px;
  height: 16px;
}

.rem-kpi-body {
  min-width: 0;
}

.rem-kpi-val {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.rem-kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 550;
}

/* ── Body two-column layout ── */
.rem-body {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

/* ── Sidebar ── */
.rem-sidebar {
  position: sticky;
  top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rem-sidebar-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.rem-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color-light);
  background: var(--bg-primary);
}

.rem-sidebar-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rem-sidebar-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.4rem;
}

.rem-sidebar-empty {
  padding: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.rem-sidebar-list {
  display: flex;
  flex-direction: column;
}

.rem-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-color-light);
  transition: background var(--transition-fast);
}

.rem-sidebar-item:last-child {
  border-bottom: none;
}

.rem-sidebar-item:hover {
  background: var(--bg-tertiary);
}

.rem-sidebar-item-body {
  flex: 1;
  min-width: 0;
}

.rem-sidebar-item-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rem-sidebar-item-time {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: var(--color-danger);
  margin-top: 0.2rem;
  font-weight: 550;
}

/* ── Main content ── */
.rem-main {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Toolbar ── */
.rem-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Filter pills */
.rem-filters {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

/* Override base .reminder-filter styles inside the new layout */
.rem-filters .reminder-filter {
  height: 30px;
  padding: 0 0.8rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.79rem;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.rem-filters .reminder-filter:hover {
  border-color: rgba(var(--color-primary-rgb), 0.45);
  color: var(--color-primary);
}

.rem-filters .reminder-filter.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* Search */
.rem-search-wrap {
  position: relative;
  width: 264px;
  flex-shrink: 0;
}

.rem-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.rem-search-input {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem 0 2.5rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.rem-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.rem-search-input::placeholder {
  color: var(--text-muted);
}

/* ── Empty filter hint ── */
.rem-empty-msg {
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: 0.875rem 1rem;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
}

/* ── Card list ── */
.rem-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ── Individual reminder card ── */
.rem-card {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

/* Reset base .reminder-card padding/margin that would double up */
.rem-card.reminder-card {
  padding: 0;
  margin-bottom: 0;
}

.rem-card:hover {
  border-color: rgba(var(--color-primary-rgb), 0.4);
  box-shadow: 0 2px 12px rgba(16, 24, 40, 0.07);
}

/* Colored left status stripe */
.rem-card-stripe {
  width: 3px;
  flex-shrink: 0;
  background: var(--border-color);
  transition: background var(--transition-base);
}

.rem-card.is-overdue .rem-card-stripe {
  background: var(--color-danger);
}

.rem-card.is-today .rem-card-stripe {
  background: var(--color-warning);
}

.rem-card.is-done .rem-card-stripe {
  background: var(--color-success);
}

/* Subtle background tints per status */
.rem-card.is-overdue {
  border-color: rgba(200, 58, 58, 0.3);
  background: linear-gradient(100deg, rgba(200, 58, 58, 0.04) 0%, transparent 55%);
}

.rem-card.is-today {
  border-color: rgba(198, 132, 26, 0.3);
  background: linear-gradient(100deg, rgba(198, 132, 26, 0.04) 0%, transparent 55%);
}

.rem-card.is-done {
  border-color: rgba(31, 157, 110, 0.22);
  background: linear-gradient(100deg, rgba(31, 157, 110, 0.04) 0%, transparent 55%);
  opacity: 0.72;
}

/* Card inner layout */
.rem-card-inner {
  flex: 1;
  min-width: 0;
  padding: 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Top row: status badge + action buttons */
.rem-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}

/* Status badge */
.rem-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.rem-badge.pending {
  background: rgba(var(--color-primary-rgb), 0.1);
  color: var(--color-primary);
}

.rem-badge.overdue {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.rem-badge.today {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.rem-badge.done {
  background: var(--color-success-bg);
  color: var(--color-success);
}

/* Action buttons — revealed on card hover */
.rem-card-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.rem-card:hover .rem-card-actions {
  opacity: 1;
}

.rem-action-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  flex-shrink: 0;
  padding: 0;
  font-size: 0;
  line-height: 0;
}

.rem-action-btn svg,
.rem-action-btn i {
  width: 12px;
  height: 12px;
}

.rem-action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.rem-action-btn.complete-reminder:hover {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: var(--color-success);
}

.rem-action-btn.delete-reminder:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.rem-action-btn.is-small {
  width: 22px;
  height: 22px;
}

.rem-action-btn.is-small svg,
.rem-action-btn.is-small i {
  width: 11px;
  height: 11px;
}

.rem-action-btn.is-lg {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  margin-left: auto;
}

.rem-action-btn.is-lg svg,
.rem-action-btn.is-lg i {
  width: 15px;
  height: 15px;
}

/* Card title */
.rem-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 0;
}

.rem-card.is-done .rem-card-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Description */
.rem-card-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Footer meta row */
.rem-card-foot {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.rem-card-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.rem-meta-icon {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  opacity: 0.65;
}

/* Stray rule preserved from previous block */
.view-toolbar+.spreadsheet-container .spreadsheet-cell {
  font-weight: 550;
}

/* ── Responsive ── */
@media (max-width: 1080px) {
  .rem-body {
    grid-template-columns: 1fr;
  }

  .rem-sidebar {
    position: static;
    order: 2;
  }

  .rem-main {
    order: 1;
  }

  .rem-kpis {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== GLOBAL MOBILE HARDENING ===== */
/* ===== TECHNICIAN DASHBOARD FILTER CONTROLS ===== */
/* ===== FORM CONSISTENCY LAYER ===== */
:root {
  --form-control-height: 40px;
  --form-control-radius: var(--radius-md);
  --form-control-font-size: 0.9375rem;
}

:is(.form-field input,
  .form-field select,
  .task-form-input,
  .reminder-form-input,
  .task-form-select,
  .reminder-form-select,
  .categories-input,
  .competitors-input,
  .phone-number,
  .technician-filter-control) {
  min-height: var(--form-control-height);
  border-radius: var(--form-control-radius);
  font-size: var(--form-control-font-size);
  line-height: 1.35;
}

:is(.form-field textarea,
  .task-form-textarea,
  .reminder-form-textarea) {
  border-radius: var(--form-control-radius);
  font-size: var(--form-control-font-size);
  line-height: 1.45;
  min-height: 96px;
}

:is(.form-field input,
  .form-field select,
  .form-field textarea,
  .task-form-input,
  .reminder-form-input,
  .task-form-select,
  .reminder-form-select,
  .task-form-textarea,
  .reminder-form-textarea,
  .categories-input,
  .competitors-input,
  .phone-number,
  .technician-filter-control) {
  border: 1.25px solid var(--border-color);
  background: var(--bg-primary);
}

:is(.form-field input,
  .form-field select,
  .form-field textarea,
  .task-form-input,
  .reminder-form-input,
  .task-form-select,
  .reminder-form-select,
  .task-form-textarea,
  .reminder-form-textarea,
  .categories-input,
  .competitors-input,
  .phone-number,
  .technician-filter-control):focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

:is(.form-field input,
  .form-field select,
  .form-field textarea,
  .task-form-input,
  .reminder-form-input,
  .task-form-select,
  .reminder-form-select,
  .task-form-textarea,
  .reminder-form-textarea,
  .categories-input,
  .competitors-input,
  .phone-number,
  .technician-filter-control)[aria-invalid="true"],
:is(.form-field input,
  .form-field select,
  .form-field textarea,
  .task-form-input,
  .reminder-form-input,
  .task-form-select,
  .reminder-form-select,
  .task-form-textarea,
  .reminder-form-textarea,
  .categories-input,
  .competitors-input,
  .phone-number,
  .technician-filter-control).is-invalid {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-danger-bg) 70%, transparent);
}

.form-field label,
.task-form-label,
.reminder-form-label {
  font-weight: 600;
  letter-spacing: 0.1px;
}

.field-helper {
  font-size: 0.78rem;
  margin-top: -0.15rem;
  line-height: 1.35;
}

.field-error,
.form-error {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--color-danger);
}

.required-indicator {
  color: var(--color-danger);
  font-weight: 700;
}

.optional-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid var(--border-color-light);
}

.technician-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* ===== TOKENIZED UI UTILITIES ===== */
.modal-size-sm {
  max-width: min(460px, 92vw) !important;
}

.modal-size-md {
  max-width: min(760px, 94vw) !important;
}

.modal-size-lg {
  max-width: min(980px, 96vw) !important;
}

.modal-size-xl {
  max-width: min(1120px, 97vw) !important;
}

.modal-size-transfer {
  max-width: min(820px, 95vw) !important;
}

.modal-size-photo {
  max-width: min(92vw, 1200px) !important;
  max-height: 90vh;
}

.u-inline-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.u-flex-1 {
  flex: 1;
}

.u-maxw-320 {
  max-width: 320px;
}

.u-icon-16 {
  width: 16px;
  height: 16px;
}

.u-search-icon-muted {
  color: var(--text-muted);
}

.u-p-md {
  padding: var(--space-4);
}

.u-p-xl {
  padding: var(--space-7);
}

.u-grid-col-full {
  grid-column: 1 / -1;
}

.u-spacer-md {
  margin-bottom: 1.5rem;
}

.u-map-sm {
  height: 200px;
}

.u-map-md {
  height: 300px;
}

.u-map-lg {
  height: 400px;
}

.u-my-md {
  margin: 1rem 0;
}

.u-mt-md {
  margin-top: 1rem;
}

.u-flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.u-photo-contain {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.technician-filter-control {
  width: auto;
  min-width: 170px;
  height: var(--control-height-md);
  padding: 0 2rem 0 var(--space-3);
  border-radius: var(--btn-radius);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 550;
  box-shadow: none;
}

.technician-filter-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

#filter-date.technician-filter-control {
  min-width: 160px;
  padding-right: var(--space-3);
}

/* ==============================================
   VISITS HUB - PREMIUM MANAGER VIEW
   State-of-the-art design for enterprise CRM
   ============================================== */

/* ===== MAIN CONTAINER ===== */
.visits-hub {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  animation: fadeInUp 0.4s var(--motion-ease-emphasized);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== HERO STATS SECTION ===== */


.visits-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.visits-stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 550;
}

.visits-stat-sparkline {
  height: 32px;
  margin-top: 0.75rem;
  opacity: 0.8;
}

/* ===== COMMAND BAR ===== */
.visits-command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}

.visits-search-box {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.visits-search-box input {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem 0 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.visits-search-box input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.visits-search-box input::placeholder {
  color: var(--text-muted);
}

.visits-search-box svg,
.visits-search-box i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.visits-view-toggle {
  display: flex;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.visits-view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.visits-view-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.visits-view-btn.active {
  background: var(--bg-primary);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.visits-filters-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 550;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.visits-filters-toggle:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.visits-filters-toggle.has-filters {
  background: var(--color-primary-bg);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.visits-filters-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.visits-actions-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ===== FILTERS PANEL ===== */
.visits-filters-panel {
  display: none;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  animation: slideDown 0.25s var(--motion-ease-emphasized);
}

.visits-filters-panel.open {
  display: block;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.visits-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.visits-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.visits-filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.visits-filter-select {
  height: 40px;
  padding: 0 2.25rem 0 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
}

.visits-filter-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.visits-date-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.visits-date-range input {
  flex: 1;
  height: 40px;
  padding: 0 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  font-size: 0.875rem;
  color: var(--text-primary);
}

.visits-date-range span {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.visits-filters-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color-light);
}

/* ===== MAIN CONTENT AREA ===== */
.visits-main-content {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  min-height: 600px;
}

.visits-list-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.visits-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.visits-list-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.visits-list-count {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.visits-list-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.visits-sort-select {
  padding: 0.375rem 1.75rem 0.375rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
}

/* List Container with scroll */
.visits-list-container {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.visits-list-container::-webkit-scrollbar {
  width: 6px;
}

.visits-list-container::-webkit-scrollbar-track {
  background: transparent;
}

.visits-list-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.visits-list-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== VISIT CARD - PREMIUM ===== */
.visit-card-premium {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
}

.visit-card-premium:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.visit-card-premium.selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.visit-card-premium::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1rem;
  bottom: 1rem;
  width: 3px;
  background: var(--visit-type-color, var(--color-primary));
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.visit-card-premium:hover::before,
.visit-card-premium.selected::before {
  opacity: 1;
}

.visit-card-premium[data-type="new_lead"] {
  --visit-type-color: #3b82f6;
}

.visit-card-premium[data-type="follow_up"] {
  --visit-type-color: #8b5cf6;
}

.visit-card-premium[data-type="demo"] {
  --visit-type-color: #f59e0b;
}

.visit-card-premium[data-type="closing"] {
  --visit-type-color: #10b981;
}

.visit-card-premium[data-type="support"] {
  --visit-type-color: #6b7280;
}

.visit-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.875rem;
}

.visit-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9375rem;
  flex-shrink: 0;
}

.visit-card-main {
  flex: 1;
  min-width: 0;
}

.visit-card-company {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.visit-card-rep {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.visit-card-rep svg {
  color: var(--text-muted);
}

.visit-card-time {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.visit-card-time-relative {
  font-weight: 550;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.visit-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.visit-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.visit-card-badge.type-new_lead {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.visit-card-badge.type-follow_up {
  background: rgba(139, 92, 246, 0.12);
  color: #8b5cf6;
}

.visit-card-badge.type-demo {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.visit-card-badge.type-closing {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.visit-card-badge.type-support {
  background: rgba(107, 114, 128, 0.12);
  color: #6b7280;
}

.visit-card-badge.score-high {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.visit-card-badge.score-medium {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.visit-card-badge.score-low {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.visit-card-badge.verified {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.visit-card-notes {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.visit-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color-light);
}

.visit-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.visit-card-tag {
  padding: 0.25rem 0.5rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 550;
  border-radius: var(--radius-sm);
}

.visit-card-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.visit-card-premium:hover .visit-card-actions {
  opacity: 1;
}

.visit-card-action {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.visit-card-action:hover {
  background: var(--bg-tertiary);
  color: var(--color-primary);
}

/* ===== ACTIVITY SIDEBAR ===== */
.visits-activity-sidebar {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.activity-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color-light);
}

.activity-sidebar-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.activity-live-dot {
  width: 8px;
  height: 8px;
  background: var(--color-success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.activity-sidebar-tabs {
  display: flex;
  gap: 0;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border-color-light);
}

.activity-tab {
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast);
}

.activity-tab:hover {
  color: var(--text-primary);
}

.activity-tab.active {
  color: var(--color-primary);
}

.activity-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px 2px 0 0;
}

/* Align icons and text in activity tabs */
.activity-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.activity-tab svg,
.activity-tab i {
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}

.activity-tab .lucide {
  transform: translateY(0);
  /* reset any icon offsets */
}

.activity-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

/* Activity Timeline */
.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-timeline-item {
  display: flex;
  gap: 0.875rem;
  padding: 0.75rem 0;
  position: relative;
}

.activity-timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 44px;
  bottom: -8px;
  width: 2px;
  background: var(--border-color-light);
}

.activity-timeline-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

.activity-timeline-icon.success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.activity-timeline-icon.warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.activity-timeline-content {
  flex: 1;
  min-width: 0;
}

.activity-timeline-title {
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.activity-timeline-title strong {
  font-weight: 600;
}

.activity-timeline-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Team Leaderboard */
.team-leaderboard {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.leaderboard-item:hover {
  background: var(--bg-tertiary);
}

.leaderboard-rank {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
  background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
  color: #7c5800;
}

.leaderboard-item:nth-child(2) .leaderboard-rank {
  background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
  color: #5a5a5a;
}

.leaderboard-item:nth-child(3) .leaderboard-rank {
  background: linear-gradient(135deg, #cd7f32 0%, #daa06d 100%);
  color: #5c3d1e;
}

.leaderboard-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8125rem;
}

.leaderboard-info {
  flex: 1;
  min-width: 0;
}

.leaderboard-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-stats {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.leaderboard-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
}

/* ===== TIMELINE VIEW ===== */
.visits-timeline-view {
  display: none;
}

.visits-timeline-view.active {
  display: block;
}

.timeline-group {
  margin-bottom: 2rem;
}

.timeline-visit-card {
  margin-left: 1rem;
}

.timeline-group-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  padding: 0.5rem 0;
  z-index: 1;
}

.timeline-group-date {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-group-line {
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.timeline-group-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.25rem 0.625rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}

/* ===== MAP VIEW ===== */
.visits-map-view {
  display: none;
}

.visits-map-view.active {
  display: block;
  height: 100%;
}

.visits-map-container {
  height: 500px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.visits-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.map-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

/* ===== VISIT DETAIL PANEL ===== */
.visit-detail-panel {
  position: fixed;
  top: 0;
  right: -480px;
  width: 480px;
  height: 100vh;
  background: var(--bg-primary);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  transition: right 0.3s var(--motion-ease-emphasized);
  display: flex;
  flex-direction: column;
}

.visit-detail-panel.open {
  right: 0;
}

.visit-detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: calc(var(--z-modal) - 1);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.visit-detail-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.visit-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.visit-detail-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.visit-detail-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.visit-detail-actions {
  display: flex;
  gap: 0.5rem;
}

.visit-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.visit-detail-section {
  margin-bottom: 1.5rem;
}

.visit-detail-section:last-child {
  margin-bottom: 0;
}

.visit-detail-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.visit-detail-company {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.visit-detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.visit-detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.visit-detail-meta-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.visit-detail-meta-value {
  font-size: 0.9375rem;
  font-weight: 550;
  color: var(--text-primary);
}

.visit-detail-notes {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.visit-detail-photo {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.visit-detail-photo img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

.visit-detail-photo img:hover {
  transform: scale(1.02);
}

/* AI Insight Block in Detail Panel */
.visit-detail-section .ai-insight {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.visit-detail-section .ai-insight::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #7c3aed, #6366f1);
}

.visit-detail-section .ai-insight-content {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.visit-detail-section .ai-insight-content p {
  margin-bottom: 0.75rem;
}

.visit-detail-section .ai-insight-content p:last-child {
  margin-bottom: 0;
}

.visit-detail-section .ai-insight-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.visit-detail-section .ai-insight-content ul,
.visit-detail-section .ai-insight-content ol {
  margin: 0.75rem 0;
  padding-left: 1.25rem;
}

.visit-detail-section .ai-insight-content li {
  margin-bottom: 0.375rem;
}

/* ===== EMPTY STATE ===== */
.visits-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.visits-empty-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-xl);
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.visits-empty-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.visits-empty-description {
  font-size: 0.9375rem;
  color: var(--text-muted);
  max-width: 320px;
}

/* ===== LOADING SKELETON ===== */
.visits-skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.visits-skeleton-card {
  height: 140px;
  margin-bottom: 0.875rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .visits-main-content {
    grid-template-columns: 1fr;
  }

  .visits-activity-sidebar {
    display: none;
  }
}

/* ===== PHOTO MODAL ===== */
.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.photo-modal.open {
  opacity: 1;
  visibility: visible;
}

.photo-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
}

.photo-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.photo-modal.open .photo-modal-content {
  transform: scale(1);
}

.photo-modal-image {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.photo-modal-close {
  position: absolute;
  top: -48px;
  right: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: var(--radius-full);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.photo-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* ============================================================
   COMPREHENSIVE MOBILE OPTIMIZATIONS
   All mobile-specific styles consolidated for easy maintenance
   ============================================================ */

/* Page Header Row for Call Logs and similar views */
.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  gap: 1rem;
}

/* Filters Section */
.filters-section {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.search-input-wrapper {
  position: relative;
}

.search-input-padded {
  padding-left: 2.5rem !important;
  width: 100%;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
}

.filter-actions .btn {
  flex: 1;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* ===== UTILITY CLASSES ===== */
.mt-sm {
  margin-top: 0.5rem;
}

.mt-md {
  margin-top: 1rem;
}

.mt-lg {
  margin-top: 1.5rem;
}

.mb-sm {
  margin-bottom: 0.5rem;
}

.mb-md {
  margin-bottom: 1rem;
}

.mb-lg {
  margin-bottom: 1.5rem;
}

/* Text truncation utilities */
.text-clamp-1 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.text-clamp-2 {
  overflow: hidden;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.text-clamp-3 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* Photo Grid Layouts */
.photo-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.photo-grid .photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-item-more {
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-group-inline {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-group-end {
  display: flex;
  justify-content: flex-end;
}

/* ===== USER MANAGEMENT CARD ===== */
.user-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

.user-card-info {
  flex: 1;
  min-width: 0;
}

.user-card-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card-email {
  color: var(--text-muted);
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ===== VISITS FILTER SPAN ===== */
.visits-filter-group.span-2 {
  grid-column: span 2;
}

/* ===== EXTRA SMALL DEVICES (≤480px) ===== */
/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {

  /* Larger touch targets */
  .btn {
    min-height: 44px;
  }

  .nav-item {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
  }

  .bottom-nav-item {
    min-height: 48px;
  }

  /* Remove hover effects that cause sticky states on touch */
  .visit-card:hover,
  .reminder-card:hover,
  .kanban-task-card:hover,
  .opportunity-card:hover,
  .card:hover,
  .stat-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }

  /* Better tap feedback */
  .btn:active,
  .nav-item:active,
  .bottom-nav-item:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
  }

  .kanban-task-card:active {
    transform: scale(0.98);
    border-color: var(--color-primary);
  }

  /* Disable resize handles on mobile */
  .resize-handle {
    display: none;
  }

  /* Scroll snap for horizontal scrolling elements */
  .pipeline-filters {
    scroll-snap-type: x mandatory;
  }

  .pipeline-filter {
    scroll-snap-align: start;
  }
}

/* ===== LANDSCAPE MOBILE ===== */
/* ===== SAFE AREA INSETS (Notch/Home Indicator) ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
}

/* ============================================
   VISITS, TECHNICIANS & ROUTE PLANNING
   Enhanced Mobile Design (≤768px)
   ============================================ */

/* ===== SMALLER MOBILE BREAKPOINT (≤480px) ===== */
/* ==========================================================================
   RECORD VIEW MODALS — Company & Person (Redesigned)
   ========================================================================== */

/* Modal overlay setup — centered dialog */
.record-view-modal {
  align-items: center;
  justify-content: center;
}

/* The panel itself */
.record-modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(920px, 96vw);
  height: min(660px, 94vh);
  max-height: 94vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: recordModalPop 0.25s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  z-index: 1;
}

@keyframes recordModalPop {
  from {
    transform: scale(0.96) translateY(8px);
    opacity: 0;
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* ── Hero ── */
.record-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  flex-shrink: 0;
}

.record-hero-avatar {
  width: 68px;
  height: 68px;
  border-radius: 14px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.record-hero-avatar img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  border-radius: 14px;
  position: absolute;
  inset: 0;
  display: none;
}

.record-hero-avatar--person {
  border-radius: 50%;
  background: var(--color-primary);
}

.record-hero-info {
  flex: 1;
  min-width: 0;
}

.record-hero-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.record-hero-name {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.record-hero-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  color: var(--color-primary);
  border: 1px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
  white-space: nowrap;
}

.record-hero-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.record-hero-domain a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.825rem;
  color: var(--color-primary);
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-primary) 20%, transparent);
  transition: background 0.15s, transform 0.1s;
}

.record-hero-domain a:hover {
  background: color-mix(in srgb, var(--color-primary) 15%, transparent);
  transform: translateY(-1px);
}

.record-hero-domain a svg {
  flex-shrink: 0;
}

.record-hero-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.record-hero-cat-chip {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--bg-tertiary, var(--bg-secondary));
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.record-hero-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 550;
}

.record-hero-subtitle a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.record-hero-subtitle a:hover {
  text-decoration: underline;
}

.record-hero-contact-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.record-hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 3px 10px 3px 8px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  transition: border-color 0.15s, color 0.15s;
}

.record-hero-chip svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.record-hero-chip:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* Hero Actions */
.record-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.record-hero-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-family: inherit;
}

#company-view-edit-btn,
#person-view-edit-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.record-hero-actions .modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
}

.record-hero-edit-btn:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

#company-view-edit-btn:hover,
#person-view-edit-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.record-hero-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.record-hero-close-btn:hover {
  background: var(--bg-tertiary);
}

/* ── Body Layout ── */
.record-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.record-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border-color);
}

/* ── Tabs ── */
.record-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 12px 20px 0;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  flex-shrink: 0;
}

.record-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 10px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  font-family: inherit;
  position: relative;
  bottom: -1px;
  white-space: nowrap;
}

.record-tab svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke: currentColor;
}

.record-tab:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.record-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: transparent;
}

/* ── Tab Panels ── */
.record-tab-panels {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

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

.record-tab-panel[style*="display:none"] {
  display: none !important;
}

/* ── Sidebar ── */
.record-sidebar {
  width: 280px;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.record-sidebar-section {
  margin-bottom: 8px;
}

.record-sidebar-title {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 0 8px;
  margin-bottom: 2px;
}

/* Field Card */
.record-field-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 8px;
  transition: background 0.12s;
  margin-bottom: 2px;
}

.record-field-card:hover {
  background: var(--bg-secondary);
}

.rfc-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.rfc-icon svg {
  width: 13px;
  height: 13px;
  stroke: var(--color-primary);
  fill: none;
}

.rfc-body {
  flex: 1;
  min-width: 0;
}

.rfc-label {
  font-size: 0.695rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.rfc-value {
  font-size: 0.875rem;
  color: var(--text-primary);
  font-weight: 550;
  word-break: break-word;
  line-height: 1.4;
}

.rfc-value a {
  color: var(--color-primary);
  text-decoration: none;
}

.rfc-value a:hover {
  text-decoration: underline;
}

.rfc-mono {
  font-family: var(--font-mono, 'SF Mono', 'Fira Code', monospace);
  font-size: 0.8rem;
}

.rfc-desc {
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* ── Tab Panel Content items ── */

/* Opportunity cards in view modals */
.record-opp-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  margin-bottom: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: default;
}

.record-opp-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 12px rgba(var(--color-primary-rgb, 47, 95, 208), 0.12);
}

.record-opp-card-stage {
  width: 6px;
  border-radius: 3px;
  align-self: stretch;
  flex-shrink: 0;
  background: var(--color-primary);
}

.record-opp-card-body {
  flex: 1;
  min-width: 0;
}

.record-opp-card-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-opp-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.record-opp-card-meta .stage-pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  color: var(--color-primary);
  border: 1px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
  text-transform: capitalize;
}

.record-opp-card-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.record-opp-card-action {
  margin-left: auto;
}

/* Employee row inside company modal */
.record-employee-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  transition: background 0.12s;
  cursor: pointer;
  margin-bottom: 2px;
}

.record-employee-row:hover {
  background: var(--bg-secondary);
}

.record-employee-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.record-employee-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.record-employee-role {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.record-employee-action {
  margin-left: auto;
}

/* Call row */
.record-call-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  margin-bottom: 8px;
  transition: border-color 0.15s;
}

.record-call-row:hover {
  border-color: var(--color-primary);
}

.record-call-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: color-mix(in srgb, #22c55e 12%, transparent);
  border: 1.5px solid color-mix(in srgb, #22c55e 30%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.record-call-icon svg {
  width: 15px;
  height: 15px;
  stroke: #22c55e;
}

.record-call-icon--inbound {
  background: color-mix(in srgb, #3b82f6 12%, transparent);
  border-color: color-mix(in srgb, #3b82f6 30%, transparent);
}

.record-call-icon--inbound svg {
  stroke: #3b82f6;
}

.record-call-body {
  flex: 1;
  min-width: 0;
}

.record-call-contact {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.record-call-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.record-call-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.record-call-outcome-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  background: color-mix(in srgb, #22c55e 12%, transparent);
  color: #16a34a;
  border: 1px solid color-mix(in srgb, #22c55e 25%, transparent);
}

/* Visit row */
.record-visit-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  margin-bottom: 8px;
  transition: border-color 0.15s;
}

.record-visit-row:hover {
  border-color: var(--color-primary);
}

.record-visit-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.record-visit-dot svg {
  width: 15px;
  height: 15px;
  stroke: var(--color-primary);
}

.record-visit-body {
  flex: 1;
  min-width: 0;
}

.record-visit-type {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.record-visit-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.record-visit-notes {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 5px;
  line-height: 1.4;
}

.record-visit-action {
  flex-shrink: 0;
  margin-top: 2px;
}

/* Empty state for tabs */
.record-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
}

.record-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.record-empty-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--text-muted);
}

.record-empty-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.record-empty-desc {
  font-size: 0.83rem;
  color: var(--text-muted);
  max-width: 260px;
  line-height: 1.5;
}

/* ==========================================================================
   RECORD VIEW MODAL — REVAMP ENHANCEMENTS
   ========================================================================== */



/* ── Stats Bar ── */
.record-stats-bar {
  display: flex;
  align-items: stretch;
  gap: 1px;
  padding: 0;
  background: var(--border-color);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.record-stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  background: var(--bg-primary);
  gap: 2px;
  min-width: 0;
  transition: background 0.15s;
}

.record-stat-item:first-child {
  border-radius: 0;
}

.record-stat-item:hover {
  background: var(--bg-secondary);
}

.record-stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.record-stat-value--primary {
  color: var(--color-primary);
}

.record-stat-value--success {
  color: #22c55e;
}

.record-stat-value--warning {
  color: #f59e0b;
}

.record-stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ── Tab count badges ── */
.record-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  margin-left: 4px;
  line-height: 1;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.record-tab.active .record-tab-count {
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  color: var(--color-primary);
  border-color: color-mix(in srgb, var(--color-primary) 25%, transparent);
}

/* ── Quick Actions in sidebar ── */
.record-quick-actions {
  display: flex;
  gap: 6px;
  padding: 0 0 12px;
  flex-wrap: wrap;
}

.record-quick-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

.record-quick-action svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.record-quick-action:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 6%, transparent);
  transform: translateY(-1px);
}

.record-quick-action--email:hover {
  border-color: #3b82f6;
  color: #3b82f6;
  background: color-mix(in srgb, #3b82f6 6%, transparent);
}

.record-quick-action--call:hover {
  border-color: #22c55e;
  color: #22c55e;
  background: color-mix(in srgb, #22c55e 6%, transparent);
}

.record-quick-action--directions:hover {
  border-color: #f59e0b;
  color: #f59e0b;
  background: color-mix(in srgb, #f59e0b 6%, transparent);
}

/* ── Last Activity indicator in hero ── */
.record-hero-last-activity {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

.record-hero-last-activity-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

.record-hero-last-activity-dot--stale {
  background: #f59e0b;
}

.record-hero-last-activity-dot--cold {
  background: #ef4444;
}

/* ── Enhanced tab panel transitions ── */
.record-tab-panel {
  animation: recordTabFadeIn 0.2s ease;
}

@keyframes recordTabFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Improved sidebar section dividers ── */
.record-sidebar-section + .record-sidebar-section {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}



/* ── Better edit button states ── */
#company-view-edit-btn:hover,
#person-view-edit-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ── Dark mode tweaks ── */
[data-theme="dark"] .record-modal-panel {
  background: var(--bg-secondary);
  border-left-color: var(--border-color);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .record-hero {
  background: var(--bg-primary);
}

[data-theme="dark"] .record-sidebar {
  background: var(--bg-primary);
}

[data-theme="dark"] .record-tabs {
  background: var(--bg-primary);
}

[data-theme="dark"] .record-hero-edit-btn {
  background: var(--bg-secondary);
}



[data-theme="dark"] .record-stat-item {
  background: var(--bg-primary);
}

[data-theme="dark"] .record-stat-item:hover {
  background: var(--bg-secondary);
}

[data-theme="dark"] .record-quick-action {
  background: var(--bg-primary);
}

/* ── Mobile responsive ── */
/* ==========================================================================
   OPPORTUNITY VIEW MODAL (Compact Dashboard Redesign)
   ========================================================================== */

#opportunity-view-modal .record-modal-panel {
  width: min(840px, 94vw);
  height: auto;
  min-height: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

#opportunity-view-modal .record-hero {
  padding: 14px 24px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

#opportunity-view-modal .record-hero-avatar {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  font-size: 1.1rem;
}

#opportunity-view-modal .record-body {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg-secondary);
}

/* Highlights Row */
.ov-highlights {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border-color);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.ov-highlight-card {
  background: var(--bg-secondary);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ov-highlight-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.ov-highlight-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Two-Column Content Grid */
.ov-content-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  flex: 1;
  min-height: 0;
}

.ov-main-col {
  padding: 20px 24px;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ov-side-col {
  padding: 20px 24px;
  background: rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

[data-theme="dark"] .ov-side-col {
  background: rgba(255, 255, 255, 0.02);
}

.ov-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ov-section-title i,
.ov-section-title svg {
  color: var(--color-primary);
  opacity: 0.8;
}

.ov-next-step-box {
  background: color-mix(in srgb, var(--color-primary) 5%, var(--bg-primary));
  border: 1px solid color-mix(in srgb, var(--color-primary) 15%, var(--border-color));
  border-radius: 10px;
  padding: 14px;
}

.ov-next-step-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ov-next-step-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: 0.03em;
}

.ov-next-step-date {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  padding: 2px 8px;
  border-radius: 6px;
}

.ov-next-step-content {
  font-size: 0.9rem;
  font-weight: 550;
  color: var(--text-primary);
  line-height: 1.5;
}

.ov-notes-container {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  padding: 12px;
  background: var(--bg-primary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.ov-competitors-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ov-comp-tag {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.ov-meta-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  padding: 6px 0;
  border-bottom: 1px dotted var(--border-color);
}

.ov-meta-item:last-child {
  border-bottom: none;
}

.ov-meta-label {
  color: var(--text-muted);
  font-weight: 550;
}

.ov-meta-value {
  color: var(--text-primary);
  font-weight: 600;
}

/* ===== BOTTOM ACTION BAR ===== */
.bottom-action-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: var(--z-fixed);
  transition: transform 0.4s var(--motion-ease-emphasized), opacity 0.3s ease;
  pointer-events: none;
  opacity: 0;
}

.bottom-action-bar.active {
  transform: translateX(-50%) translateY(0);
  pointer-events: all;
  opacity: 1;
}

.bab-content {
  background: color-mix(in srgb, var(--bg-secondary) 80%, transparent);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.bab-selection-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-weight: 550;
  font-size: 0.95rem;
}

.bab-count {
  background: var(--color-primary);
  color: white;
  min-width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.8rem;
  padding: 0 4px;
}

.bab-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
}

.bab-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 550;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.bab-btn i,
.bab-btn svg {
  width: 16px;
  height: 16px;
}

.bab-btn-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.bab-btn-danger:hover {
  background: var(--color-danger);
  color: white;
}

.bab-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.bab-btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Selection header th — matches td cell sizing exactly */
.spreadsheet-table th.th-selection {
  padding: 0 !important;
  text-align: center;
  vertical-align: middle;
  cursor: default !important;
}

/* Checkbox Styling in Table */
.selection-checkbox {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 24px !important;
  height: 24px !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  position: relative !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  background: var(--bg-secondary) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  vertical-align: middle !important;
  outline: none !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}

.spreadsheet-table th.th-selection {
  line-height: 0;
}

.spreadsheet-table th.th-selection .selection-checkbox,
.spreadsheet-table td .selection-checkbox {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  max-width: 24px !important;
  max-height: 24px !important;
}

.selection-checkbox:hover {
  border-color: var(--color-primary);
  background: var(--bg-tertiary);
}

.selection-checkbox:checked {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.selection-checkbox::after {
  content: '';
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  width: 14px !important;
  height: 14px !important;
  transform: translate(-50%, -50%) !important;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.selection-checkbox:checked::after {
  opacity: 1 !important;
}

/* Row checkboxes - Check icon */
.row-select:checked::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E") !important;
}

/* Header checkboxes - Minus icon */
#companies-select-all:checked::after,
#people-select-all:checked::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'%3E%3C/line%3E%3C/svg%3E") !important;
}

/* Dark mode adjustments */
[data-theme="dark"] .selection-checkbox {
  background: #1e2227 !important;
  border: 1.5px solid rgba(255, 255, 255, 0.3) !important;
}

[data-theme="dark"] .selection-checkbox:checked {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
}

.spreadsheet-table tr:has(.row-select:checked) td {
  background: rgba(var(--color-primary-rgb), 0.05) !important;
}

[data-theme="dark"] .spreadsheet-table tr:has(.row-select:checked) td {
  background: rgba(var(--color-primary-rgb), 0.12) !important;
}

.spreadsheet-cell-wrapper:has(.selection-checkbox) {
  text-align: center;
  padding: 0 !important;
}

.spreadsheet-cell:has(.selection-checkbox) {
  justify-content: center;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   WORKFLOWS — Visual automation builder
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Page ──────────────────────────────────────────────────────────────────── */
.wf-page {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
}
.wf-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-3);
}
.wf-page-title {
  font-size: var(--type-xxl);
  font-weight: 650;
  color: var(--text-primary);
  margin: 0;
}
.wf-page-subtitle {
  font-size: var(--type-sm);
  color: var(--text-muted);
  margin: var(--space-1) 0 0;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.wf-empty {
  text-align: center;
  padding: var(--space-9) var(--space-5);
}
.wf-empty-icon {
  margin-bottom: var(--space-4);
}
.wf-empty-title {
  font-size: var(--type-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
}
.wf-empty-text {
  color: var(--text-muted);
  font-size: var(--type-md);
  max-width: 400px;
  margin: 0 auto var(--space-5);
  line-height: 1.5;
}

/* ── Workflow list cards ──────────────────────────────────────────────────── */
.wf-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.wf-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.wf-card:hover {
  border-color: var(--color-primary-light);
}
.wf-card-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.wf-card-info {
  min-width: 0;
}
.wf-card-name {
  font-size: var(--type-md);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wf-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: 2px;
}
.wf-card-trigger-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--type-xs);
  font-weight: 550;
  color: var(--badge-color, var(--text-secondary));
}
.wf-card-action-count {
  font-size: var(--type-xs);
  color: var(--text-muted);
}
.wf-card-right {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}
.wf-card-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.wf-card-btn-danger:hover {
  color: var(--color-danger);
  background: var(--color-danger-bg);
}

/* ── Toggle switch ────────────────────────────────────────────────────────── */
.wf-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.wf-toggle-track {
  display: block;
  width: 34px;
  height: 20px;
  background: var(--bg-gray);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition-fast);
}
.wf-toggle.active .wf-toggle-track {
  background: var(--color-success);
}
.wf-toggle-thumb {
  display: block;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform var(--transition-fast);
}
.wf-toggle.active .wf-toggle-thumb {
  transform: translateX(14px);
}
.wf-toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--type-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   WORKFLOW BUILDER
   ═══════════════════════════════════════════════════════════════════════════════ */

.wf-builder {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

/* ── Builder header ───────────────────────────────────────────────────────── */
.wf-builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  flex-shrink: 0;
  gap: var(--space-3);
}
.wf-builder-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
}
.wf-builder-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}
.wf-builder-name-input {
  border: none;
  background: transparent;
  font-size: var(--type-lg);
  font-weight: 600;
  color: var(--text-primary);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  width: 100%;
  max-width: 400px;
  transition: background var(--transition-fast);
}
.wf-builder-name-input:hover {
  background: var(--bg-hover);
}
.wf-builder-name-input:focus {
  outline: none;
  background: var(--bg-tertiary);
}
.wf-builder-name-input.wf-input-error {
  outline: 2px solid var(--color-danger);
}
.wf-builder-active-toggle {
  display: flex;
  align-items: center;
}

/* ── Canvas ───────────────────────────────────────────────────────────────── */
.wf-canvas {
  flex: 1;
  overflow: auto;
  padding: var(--space-7) var(--space-5);
  background: var(--bg-primary);
  /* Dot-grid background */
  background-image: radial-gradient(circle, var(--border-color) 1px, transparent 1px);
  background-size: 24px 24px;
}
.wf-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Blocks (trigger & action) ────────────────────────────────────────────── */
.wf-block {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  gap: var(--space-3);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  overflow: hidden;
}
.wf-block:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-sm);
}
.wf-block-color-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.wf-block-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--block-color, var(--text-muted)) 10%, transparent);
  color: var(--block-color, var(--text-muted));
  flex-shrink: 0;
}
.wf-block-body {
  flex: 1;
  min-width: 0;
}
.wf-block-label {
  font-size: var(--type-xxs);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.wf-block-title {
  font-size: var(--type-md);
  font-weight: 600;
  color: var(--text-primary);
}
.wf-block-object {
  font-weight: 500;
  color: var(--text-secondary);
}
.wf-block-description {
  font-size: var(--type-xs);
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.wf-block-actions {
  display: flex;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}
.wf-block:hover .wf-block-actions {
  opacity: 1;
}
.wf-block-edit-btn,
.wf-block-delete-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.wf-block-edit-btn:hover {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}
.wf-block-delete-btn:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

/* Empty trigger block */
.wf-block-empty {
  border-style: dashed;
  cursor: pointer;
}
.wf-block-empty:hover {
  background: var(--bg-hover);
}
.wf-block-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Connector ────────────────────────────────────────────────────────────── */
.wf-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 40px;
  position: relative;
}
.wf-connector.disabled {
  opacity: 0.3;
}
.wf-connector-line {
  width: 2px;
  flex: 1;
  background: var(--border-color);
}
.wf-connector-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  flex-shrink: 0;
}

/* ── Add action button ────────────────────────────────────────────────────── */
.wf-add-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3);
  background: transparent;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--type-sm);
  font-weight: 550;
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}
.wf-add-action-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-bg);
}

/* ── Field badges ─────────────────────────────────────────────────────────── */
.wf-field-count {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border-radius: var(--radius-xs);
  font-size: var(--type-xxs);
  font-weight: 600;
}
.wf-target-label {
  color: var(--text-secondary);
  font-weight: 550;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SIDE PANEL (picker / editor)
   ═══════════════════════════════════════════════════════════════════════════════ */

.wf-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  transition: opacity var(--transition-slow);
}
.wf-panel-overlay.active {
  opacity: 1;
}
.wf-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100vw;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
}
.wf-panel.active {
  transform: translateX(0);
}
.wf-panel-wide {
  width: 480px;
}
.wf-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-color-light);
  flex-shrink: 0;
}
.wf-panel-header h3 {
  margin: 0;
  font-size: var(--type-lg);
  font-weight: 650;
  color: var(--text-primary);
}
.wf-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
}
.wf-panel-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-color-light);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-shrink: 0;
}
.wf-panel-hint {
  font-size: var(--type-sm);
  color: var(--text-muted);
  margin: 0 0 var(--space-4);
  line-height: 1.5;
}
.wf-panel-label {
  font-size: var(--type-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin: var(--space-5) 0 var(--space-2);
  display: block;
}
.wf-panel-label:first-child {
  margin-top: 0;
}

/* ── Option list (trigger/action type selector) ───────────────────────────── */
.wf-option-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.wf-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.wf-option:hover {
  border-color: var(--color-primary-light);
  background: var(--bg-hover);
}
.wf-option.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
}
.wf-option-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--opt-color, var(--text-muted)) 10%, transparent);
  color: var(--opt-color, var(--text-muted));
  flex-shrink: 0;
}
.wf-option-info {
  flex: 1;
  min-width: 0;
}
.wf-option-label {
  font-size: var(--type-md);
  font-weight: 550;
  color: var(--text-primary);
}
.wf-option-desc {
  font-size: var(--type-xs);
  color: var(--text-muted);
  margin-top: 1px;
}
.wf-option-check {
  color: var(--color-primary);
  flex-shrink: 0;
}

/* Object selector (smaller) */
.wf-object-options {
  flex-direction: row;
  gap: var(--space-2);
}
.wf-option-sm {
  flex: 1;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-3) var(--space-2);
  gap: var(--space-2);
}
.wf-option-sm .wf-option-icon {
  width: 32px;
  height: 32px;
}
.wf-option-sm .wf-option-label {
  font-size: var(--type-sm);
}

/* ── Live search ──────────────────────────────────────────────────────────── */
.wf-editor-section {
  margin-bottom: var(--space-5);
}
.wf-search-input-wrapper {
  position: relative;
}
.wf-search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.wf-search-input {
  width: 100%;
  height: var(--control-height-lg);
  padding: 0 var(--space-3) 0 34px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--type-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.wf-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-bg);
}
.wf-search-results {
  margin-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 240px;
  overflow-y: auto;
}
.wf-search-result {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-size: var(--type-sm);
  color: var(--text-primary);
  width: 100%;
  transition: background var(--transition-fast);
}
.wf-search-result:hover {
  background: var(--bg-hover);
}
.wf-search-loading {
  padding: var(--space-3);
  text-align: center;
  font-size: var(--type-sm);
  color: var(--text-muted);
}
.wf-search-selected {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-success-bg);
  border-radius: var(--radius-sm);
  font-size: var(--type-sm);
  color: var(--text-primary);
  font-weight: 550;
}

/* ── Fields editor grid ───────────────────────────────────────────────────── */
.wf-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.wf-field-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.wf-field-row-wide {
  grid-column: 1 / -1;
}
.wf-field-label {
  font-size: var(--type-xs);
  font-weight: 600;
  color: var(--text-secondary);
}
.wf-field-input {
  height: var(--control-height-md);
  padding: 0 var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--type-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color var(--transition-fast);
}
.wf-field-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-bg);
}
textarea.wf-field-input {
  height: auto;
  padding: var(--space-2) var(--space-3);
  resize: vertical;
  min-height: 56px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   WORKFLOW — MOBILE
   ═══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .wf-page {
    padding: var(--space-4) var(--space-3);
  }
  .wf-page-header {
    flex-direction: column;
    gap: var(--space-3);
  }
  .wf-page-header .btn {
    align-self: stretch;
    justify-content: center;
  }
  .wf-builder-header {
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3);
  }
  .wf-builder-header-left {
    width: 100%;
  }
  .wf-builder-header-right {
    width: 100%;
    justify-content: space-between;
  }
  .wf-builder-name-input {
    max-width: none;
    font-size: var(--type-md);
  }
  .wf-canvas {
    padding: var(--space-5) var(--space-3);
  }
  .wf-panel {
    width: 100%;
    border-radius: 0;
  }
  .wf-panel-wide {
    width: 100%;
  }
  .wf-fields-grid {
    grid-template-columns: 1fr;
  }
  .wf-object-options {
    flex-direction: column;
  }
  .wf-option-sm {
    flex-direction: row;
  }
}
