:root {
  --radius-md: 16px;
  --radius-sm: 12px;
  --transition-base: 180ms ease;
}

.theme-dark {
  /* 60% - Main Background (Darkest) */
  --color-bg: #161616;
  --color-bg-primary: #161616;

  /* 30% - Surface Background (Medium Dark) */
  --color-surface: #1c1c1c;
  --color-surface-alt: #1c1c1c;
  --color-surface-elevated: #1c1c1c;
  --color-surface-hover: #212121;
  --color-surface-active: #262626;

  /* Text Hierarchy */
  --color-text: hsl(0, 0%, 95%);
  --color-text-primary: hsl(0, 0%, 95%);
  --color-text-secondary: #a1a1a1;
  --color-text-tertiary: #6b6b6b;
  --color-text-muted: hsl(0, 0%, 50%);
  --color-text-disabled: #4a4a4a;
  --color-text-on-accent: #ffffff;
  --color-muted: hsl(0, 0%, 50%);
  --color-placeholder: rgba(161, 161, 161, 0.5);

  /* 10% - Accent (Indigo) */
  --color-primary: #6366f1;
  --color-primary-hover: #7c3aed;
  --color-primary-active: #5b21b6;
  --color-primary-soft: rgba(99, 102, 241, 0.1);
  --color-primary-border: rgba(99, 102, 241, 0.3);
  --color-primary-subtle: rgba(99, 102, 241, 0.2);
  --color-primary-text: #8b8df1;

  /* Legacy accent (maps to primary) */
  --color-accent: var(--color-primary);
  --color-accent-soft: var(--color-primary-soft);

  /* Borders & Dividers */
  --color-border-subtle: #2a2a2a;
  --color-border: #333333;
  --color-border-default: #333333;
  --color-border-strong: #404040;

  /* Chart Grid Lines */
  --color-chart-grid: hsl(0, 0%, 15%);

  /* Interactive States */
  --color-hover: rgba(255, 255, 255, 0.05);
  --color-active: rgba(255, 255, 255, 0.08);
  --color-focus: var(--color-primary);
  --color-focus-ring: rgba(99, 102, 241, 0.4);

  /* Semantic Colors - REDESIGNED */
  --color-success: #22c55e;
  --color-success-hover: #16a34a;
  --color-success-soft: rgba(34, 197, 94, 0.1);
  --color-success-border: rgba(34, 197, 94, 0.3);

  --color-warning: #f59e0b;
  --color-warning-hover: #d97706;
  --color-warning-soft: rgba(245, 158, 11, 0.1);
  --color-warning-border: rgba(245, 158, 11, 0.3);

  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-danger-soft: rgba(220, 38, 38, 0.1);
  --color-danger-border: rgba(220, 38, 38, 0.3);

  /* Chart-specific colors (softer for visual balance) */
  --color-danger-chart-bg: rgba(239, 68, 68, 0.35);
  --color-danger-chart-border: rgba(239, 68, 68, 0.7);
  --color-success-chart-bg: rgba(74, 222, 128, 0.35);
  --color-success-chart-border: rgba(74, 222, 128, 0.7);

  --color-info: #3b82f6;
  --color-info-hover: #2563eb;
  --color-info-soft: rgba(59, 130, 246, 0.1);
  --color-info-border: rgba(59, 130, 246, 0.3);

  /* Input Colors */
  --color-input-bg: var(--color-surface);
  --color-input-border: var(--color-border-default);
  --color-input-border-focus: var(--color-primary);
  --color-input-disabled-bg: #1f1f1f;
  --color-input-disabled-text: #4a4a4a;

  /* Button tokens */
  --btn-primary-soft-bg: var(--color-primary-soft);
  --btn-primary-soft-border: var(--color-primary-border);
  --btn-primary-soft-text: var(--color-primary);
  --btn-primary-soft-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
  --btn-primary-soft-shadow-hover: 0 4px 12px rgba(99, 102, 241, 0.35);

  /* Shadows - Keep as none for dark theme */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-glow: none;
  --shadow-soft: none;
  --shadow-elevated: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-elevated-hover: 0 8px 16px rgba(0, 0, 0, 0.15);
  --shadow-elevated-medium: 0 12px 30px rgba(0, 0, 0, 0.15);
  --shadow-modal: 0 22px 60px rgba(0, 0, 0, 0.35);
}

.theme-light {
  /* Background Colors - Off-white, modern and minimal */
  --color-bg: hsl(0,0%,97%);
  --color-surface: hsl(0,0%,100%);
  --color-surface-alt: #f5f3ff;
  --color-surface-elevated: hsl(0,0%,100%);

  /* Text Colors - Softer blacks for reduced eye strain */
  --color-text: hsl(0, 0%, 5%);
  --color-text-secondary: #525252;
  --color-text-muted: hsl(0, 0%, 40%);
  --color-text-disabled: #a3a3a3;
  --color-muted: hsl(0, 0%, 40%);
  --color-placeholder: #a3a3a3;

  /* Primary Purple - Vibrant but not harsh */
  --color-primary: #6366f1;
  --color-primary-hover: #7c3aed;
  --color-primary-active: #5b21b6;
  --color-primary-soft: rgba(99, 102, 241, 0.1);
  --color-primary-border: rgba(99, 102, 241, 0.3);
  --color-primary-border-subtle: rgba(99, 102, 241, 0.6);

  /* Legacy accent (maps to primary for backwards compatibility) */
  --color-accent: var(--color-primary);
  --color-accent-soft: var(--color-primary-soft);

  /* Semantic Colors - Success (Green) */
  --color-success: #10b981;
  --color-success-hover: #059669;
  --color-success-soft: #d1fae5;
  --color-success-border: #a7f3d0;

  /* Warning (Amber) */
  --color-warning: #f59e0b;
  --color-warning-hover: #d97706;
  --color-warning-soft: #fef3c7;
  --color-warning-border: #fde68a;

  /* Error/Danger (Red) */
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-danger-soft: #fee2e2;
  --color-danger-border: #fecaca;

  /* Info (Blue) */
  --color-info: #3b82f6;
  --color-info-hover: #2563eb;
  --color-info-soft: #dbeafe;
  --color-info-border: #bfdbfe;

  /* Borders & Dividers - Subtle and clean */
  --color-border: #e5e5e5;
  --color-border-strong: #d4d4d4;
  --color-border-subtle: hsl(0, 0%, 85%);

  /* Chart Grid Lines */
  --color-chart-grid: hsl(0, 0%, 95%);

  /* Interactive States */
  --color-hover: rgba(0, 0, 0, 0.04);
  --color-active: rgba(0, 0, 0, 0.08);
  --color-surface-hover: rgba(0, 0, 0, 0.04);
  --color-focus: var(--color-primary);
  --color-focus-ring: rgba(139, 92, 246, 0.3);

  /* Input & Form Colors */
  --color-input-bg: hsl(0,0%,100%);
  --color-input-border: #d4d4d4;
  --color-input-border-focus: var(--color-primary);
  --color-input-disabled-bg: #f5f5f5;
  --color-input-disabled-text: #a3a3a3;

  /* Shadows - Softer for modern look */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.025);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-glow: 0 0 0 3px rgba(139, 92, 246, 0.05);
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.03);
  --shadow-elevated: 0 4px 12px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.15);
  --shadow-elevated-hover: 0 8px 16px rgba(0, 0, 0, 0.075);
  --shadow-elevated-medium: 0 12px 30px rgba(0, 0, 0, 0.075);
  --shadow-modal: 0 22px 60px rgba(0, 0, 0, 0.175);

  /* Button tokens */
  --btn-primary-soft-bg: var(--color-primary-soft);
  --btn-primary-soft-border: var(--color-primary-border);
  --btn-primary-soft-text: var(--color-primary);
  --btn-primary-soft-shadow: none;
  --btn-primary-soft-shadow-hover: none;
}

html,
body {
  height: 100%;
}

body.app-body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 500;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.btn-close {
  --bs-btn-close-color: #fff;
  --bs-btn-close-opacity: 0.6;
  --bs-btn-close-hover-opacity: 0.9;
  --bs-btn-close-focus-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: none;
}

.app-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 24px 16px;
  text-align: center;
  color: var(--color-text);
}

.app-footer a {
  color: var(--color-text);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.app-footer a:hover,
.app-footer a:focus {
  color: var(--color-accent);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  letter-spacing: -0.01em;
}

/*
  Layout shell: uses flexbox + min-height: 100vh so every page stretches to fill the
  viewport. Lead Details needs to opt out further down.
*/
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--color-bg);
}

/* Sidebar Navigation */
.app-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 208px;
  height: 100vh;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-border-subtle);
  z-index: 100;
}

.app-sidebar-brand {
  height: 60px;
  padding: 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-border-subtle);
}

.app-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.app-sidebar-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-sidebar-nav-item {
  /* Container for nav links */
}

.app-sidebar-link {
  display: block;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition-base);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.app-sidebar-link:hover {
  background: var(--color-hover);
  color: var(--color-text-primary);
}

.app-sidebar-link.is-active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.app-sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--color-border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-sidebar-footer form {
  margin: 0;
}

.app-sidebar-footer .app-sidebar-link {
  font-size: 14px;
}

/* Dropdown in sidebar */
.app-sidebar .dropdown-toggle::after {
  margin-left: auto;
}

.app-sidebar .dropdown-menu {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border-default);
  border-radius: 8px;
  padding: 4px;
  margin-top: 4px;
}

.app-sidebar .dropdown-item {
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--color-text-secondary);
  font-size: 14px;
}

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

.app-sidebar .dropdown-item.active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.app-brand-link {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.app-brand-link:hover {
  color: var(--color-text-primary);
  text-decoration: none;
}

.app-tenant-switcher {
  display: flex;
  align-items: center;
  width: 100%;
}

.app-tenant-button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--color-text-primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  transition: background var(--transition-base), color var(--transition-base);
}

.app-tenant-button:hover,
.app-tenant-button:focus {
  background: var(--color-hover);
  color: var(--color-text-primary);
}

.app-tenant-button:focus {
  outline: 2px solid rgba(111, 125, 255, 0.35);
  outline-offset: 2px;
}

.app-tenant-button::after {
  display: none;
}

.app-tenant-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-tenant-arrows {
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: var(--color-text-muted);
  line-height: 1;
}

.app-tenant-arrow {
  display: block;
  width: 12px;
  height: 12px;
  line-height: 1;
}

.app-tenant-switcher--single {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.arrival-time-picker {
  position: relative;
  width: 100%;
}

.arrival-time-picker__display {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-weight: 600;
  padding: 0.75rem 1rem;
  line-height: 1.2;
  transition: border-color var(--transition-base), box-shadow var(--transition-base),
    background var(--transition-base);
}

.arrival-time-picker__display:focus-visible,
.arrival-time-picker__display:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 0.2rem var(--color-focus-ring);
}

.arrival-time-picker.arrival-time-picker--disabled .arrival-time-picker__display {
  cursor: not-allowed;
  opacity: 0.6;
}

.arrival-time-picker__display-text {
  flex: 1;
  text-align: left;
  white-space: nowrap;
}

.arrival-time-picker:not(.arrival-time-picker--has-value) .arrival-time-picker__display-text {
  color: var(--color-muted);
  font-weight: 500;
}

.arrival-time-picker__chevron {
  width: 10px;
  height: 10px;
  border: 2px solid var(--color-muted);
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg);
  transition: transform var(--transition-base), border-color var(--transition-base);
  flex-shrink: 0;
}

.arrival-time-picker.arrival-time-picker--open .arrival-time-picker__chevron {
  transform: rotate(-135deg);
  border-color: var(--color-primary);
}

.arrival-time-popover {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  min-width: 280px;
  z-index: 30;
}

.arrival-time-popover__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.arrival-time-popover__column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.arrival-time-popover__label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.arrival-time-popover__options {
  display: grid;
  gap: 8px;
}

[data-arrival-hours].arrival-time-popover__options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

[data-arrival-minutes].arrival-time-popover__options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.arrival-time-popover__option {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  color: var(--color-text);
  border-radius: 12px;
  padding: 0.55rem 0.4rem;
  font-weight: 600;
  transition: background var(--transition-base), color var(--transition-base),
    border-color var(--transition-base), box-shadow var(--transition-base);
}

.arrival-time-popover__option:hover,
.arrival-time-popover__option:focus-visible {
  outline: none;
  background: var(--color-surface-hover);
  border-color: rgba(255, 255, 255, 0.08);
}

.arrival-time-popover__option.is-active {
  background: var(--color-primary-soft);
  border-color: var(--color-primary-border);
  color: var(--color-text);
  box-shadow: 0 0 0 1px var(--color-primary-border);
}

.arrival-time-popover__meridiem {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.arrival-time-popover__meridiem .arrival-time-popover__option {
  flex: 1;
  padding: 0.55rem 0.6rem;
}

.arrival-time-popover__footer {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.arrival-time-popover__clear {
  border: none;
  background: transparent;
  color: var(--color-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.7rem;
  padding: 0;
  transition: color var(--transition-base);
}

.arrival-time-popover__clear:hover,
.arrival-time-popover__clear:focus-visible {
  outline: none;
  color: var(--color-text);
}

.app-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
  color: #ffffff;
  background: var(--color-primary);
}

.app-button:hover,
.app-button:focus {
  transform: translateY(-1px);
}

.app-button--secondary {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border: 1px solid var(--color-primary-border);
}

.app-button--secondary:hover,
.app-button--secondary:focus {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

.app-button--danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
  box-shadow: none;
}

.app-button--danger:hover,
.app-button--danger:focus {
  background: var(--color-danger-soft);
  filter: brightness(0.95);
}

/*
  app-main picks up the remaining viewport height (flex: 1) so that the content area
  behaves like a tall column. Without page-specific overrides, children inside
  .app-main-inner will inherit that stretched height and leave empty space at the bottom.
*/
.app-main {
  flex: 1;
  margin-left: 208px;
  background: var(--color-bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.lead-form-page .app-main {
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 100vh;
  height: auto;
}

/*
  Column wrapper with gap spacing; its children stretch because flex containers default
  to align-items: stretch. On shorter forms this means .app-content grows taller than the
  actual form and produces the visible gap.
*/
.app-main-inner {
  width: 100%;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.lead-form-page .app-main-inner {
  align-self: auto;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

/* Toast Container - Bottom Right */
.toast-container-new {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 420px;
}

/* Individual Toast */
.toast-new {
  position: relative;
  background: var(--color-surface);
  color: var(--color-text);
  border: 2px solid var(--color-border-subtle);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
  padding: 16px 20px;
  padding-right: 48px;
  min-width: 320px;
  max-width: 420px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1),
              transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-new.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-new.hiding {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}

/* Icon, Message, Close Button */
.toast-new__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.toast-new__icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  display: block;
}

.toast-new__message {
  flex: 1;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.toast-new__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 20px;
  height: 20px;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: color var(--transition-base);
}

.toast-new__close:hover {
  color: var(--color-text);
}

/* Variants */
.toast-new--success .toast-new__icon {
  color: var(--color-success);
}

.toast-new--danger .toast-new__icon {
  color: var(--color-danger);
}

.toast-new--info .toast-new__icon {
  color: var(--color-info);
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .toast-container-new {
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
  }
  .toast-new {
    min-width: auto;
    width: 100%;
  }
}

.app-banner {
  border-radius: var(--radius-sm);
}

.app-messages .alert {
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--color-text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/*
  Every page card starts with a hard min-height. That default is what pushes the Lead
  Details form away from its buttons when nothing overrides it.
*/
.app-content {
  width: 100%;
}
/*
  Lead Details (lead-form-page): do not stretch the form/tabs to full viewport height;
  let content shrink-wrap and keep buttons directly under fields.
*/
.lead-form-page .app-content {
  flex: 1 1 auto;
  align-items: stretch;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
}

.lead-form-page #lead-form.lead-form-layout {
  display: block;
  flex: 0 0 auto;
  min-height: 0;
  height: auto;
}

.lead-form-page #lead-form > .tab-pane {
  display: none;
}

.lead-form-page #lead-form > .tab-pane.show.active {
  display: block;
}

.lead-form-page #lead-detail-tabs-content,
.lead-form-page #lead-form.lead-form-layout .lead-form-tabs {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
}

.lead-form-page .lead-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  height: calc(100vh - 275px);
  width: 100%;
  max-width: 100%;
  min-height: 0;
  overflow: visible;
}

.lead-form-page .lead-overview-grid > * {
  min-width: 0;
  min-height: 0;
}

.lead-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  padding: 1.5rem 1.5rem;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
}

.lead-card--info {
}

.lead-card--followups {
}

.lead-card--cleanings {
}

.lead-card .row {
  margin-left: 0;
  margin-right: 0;
}

.lead-card--cleanings .cleanings-card {
  border-color: var(--color-border);
}

@media (max-width: 991px) {
  .lead-form-page .lead-overview-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .lead-card--info,
  .lead-card--followups,
  .lead-card--cleanings {
    grid-column: 1 / 2;
    grid-row: auto;
  }
}

/* ============================================================================
   Lead Detail Header Section
   ============================================================================ */

.lead-detail-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--color-bg);
}

.lead-detail-header {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem 0.5rem;
  box-shadow: var(--shadow-elevated);
  transition: box-shadow 0.2s ease;
}

.lead-detail-header__content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 4.5rem;
  margin-bottom: 0.75rem;
}

.lead-detail-header__row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: start;
}

.lead-detail-header__field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.lead-detail-header__field--full {
  grid-column: 1 / -1;
}

.lead-detail-header__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: var(--color-text-secondary);
  line-height: 1.2;
}

.lead-detail-header__value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-detail-header__edit-btn {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--color-primary-soft);
  border: 1px solid var(--color-primary-border);
  border-radius: 8px;
  color: var(--color-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lead-detail-header__edit-btn:hover {
  background: var(--color-primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(99, 102, 241, 0.25);
}

.lead-detail-header__edit-btn:active {
  transform: translateY(0);
}

.lead-detail-header__edit-btn svg {
  width: 18px;
  height: 18px;
}

.lead-summary-header {
  gap: 0.35rem;
}

.lead-tabs-row {
  padding: 0.5rem 0 0;
  margin-top: 0.75rem;
  display: flex;
  align-items: flex-end;
  width: 100%;
  background: transparent;
  border-top: 1px solid var(--color-border-subtle);
}

.lead-tabs-row .nav-tabs {
  border-bottom: 0;
  margin: 0;
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  width: 100%;
}

.lead-tabs-row .nav-item {
  margin-bottom: 0;
}

.lead-tabs-row .nav-tabs .nav-link {
  color: var(--color-text-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.9rem;
  background: transparent;
  font-weight: 600;
  transition: all 0.2s ease;
}

.lead-tabs-row .nav-tabs .nav-link:hover,
.lead-tabs-row .nav-tabs .nav-link:focus {
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border-color: var(--color-primary-border);
}

.lead-tabs-row .nav-tabs .nav-link.active {
  color: var(--color-text);
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.lead-summary-primary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.lead-summary-name {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
  line-height: 1.2;
}

.lead-summary-price {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.lead-summary-secondary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
  color: var(--color-text-secondary);
}

.lead-summary-contact {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.lead-summary-contact-item {
  white-space: nowrap;
  transition: color 0.15s ease;
}

.lead-summary-divider {
  opacity: 0.6;
}

.lead-summary-date {
  white-space: nowrap;
}

@media (max-width: 991px) {
  .lead-detail-header__row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 575px) {
  .lead-detail-header {
    padding: 0.75rem 1rem 0.5rem;
  }

  .lead-detail-header__content {
    padding-right: 2.5rem;
    margin-bottom: 0.5rem;
  }

  .lead-detail-header__row {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .lead-detail-header__edit-btn {
    width: 32px;
    height: 32px;
    top: 0.875rem;
    right: 1rem;
  }

  .lead-tabs-row {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .lead-tabs-row .nav-tabs {
    flex-wrap: nowrap;
    min-width: min-content;
  }

  .lead-tabs-row .nav-link {
    white-space: nowrap;
  }
}

@media (max-width: 768px) {
  .lead-summary-primary {
    flex-direction: column;
    align-items: flex-start;
  }

  .lead-summary-secondary {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .lead-summary-contact {
    gap: 0.35rem;
    flex-wrap: wrap;
  }
}

.lead-summary-contact-item[data-clip-target]:hover {
  color: var(--color-primary);
  text-decoration: underline;
  cursor: pointer;
}

.lead-form-page #lead-form.lead-form-layout .lead-form-actions {
  margin-top: 0.25rem;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.lead-form-page #lead-form.lead-form-layout .lead-form-actions__primary {
  padding-left: 0;
}

.lead-form-page #lead-form.lead-form-layout .lead-form-actions__secondary {
  justify-content: flex-end;
  padding-right: 0;
}

.btn,
.btn:focus {
  border-radius: var(--radius-sm);
}

.btn-outline-danger {
  color: var(--color-danger);
  border-color: var(--color-danger-border);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
  background: var(--color-danger-soft);
  color: var(--color-danger-hover);
}

.alert-warning {
  background: var(--color-warning-soft);
  border-color: var(--color-warning-border);
}

.alert-danger {
  background: var(--color-danger-soft);
  border-color: var(--color-danger-border);
}

.alert-success {
  background: var(--color-success-soft);
  border-color: var(--color-success-border);
}

.alert-info {
  background: var(--color-info-soft);
  border-color: var(--color-info-border);
}

.alert,
.alert-warning,
.alert-danger,
.alert-success,
.alert-info {
  color: var(--color-text);
}

.text-muted {
  color: var(--color-muted) !important;
}

.form-label,
label {
  color: var(--color-text);
}

.form-control,
.form-select,
.form-check-input,
.form-control:focus,
.form-select:focus {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  box-shadow: none;
}

.form-control,
.form-select {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  line-height: 1.2;
}

.form-control::placeholder,
.form-select::placeholder {
  color: var(--color-placeholder);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--color-primary);
  border-width: 1px;
  outline: none;
  box-shadow: none;
}

.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
  background: var(--color-surface-alt);
  color: var(--color-muted);
  border-color: var(--color-border-strong);
  opacity: 1;
  -webkit-text-fill-color: var(--color-muted);
}

.theme-light .form-control,
.theme-light .form-select,
.theme-light .form-check-input,
.theme-light .form-control:focus,
.theme-light .form-select:focus {
  background: var(--color-surface);
}

.theme-light .form-control:disabled,
.theme-light .form-select:disabled,
.theme-light .form-control[readonly] {
  background: var(--color-surface);
}

.theme-light .lead-card,
[data-theme='light'] .lead-card {
  border-color: var(--color-border);
  box-shadow: var(--shadow-elevated);
}

.theme-light .lead-detail-header,
[data-theme='light'] .lead-detail-header {
  border-color: var(--color-border);
  box-shadow: var(--shadow-elevated);
}

.auto-response-toggle.form-switch {
  padding-left: 3.2rem;
}

.auto-response-toggle .auto-response-switch {
  width: 3rem;
  height: 1.5rem;
  margin-left: -3.2rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  background-image: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
  cursor: pointer;
  transition: background-color var(--transition-base), border-color var(--transition-base),
    box-shadow var(--transition-base);
}

.auto-response-toggle .auto-response-switch::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.18rem;
  width: 1.14rem;
  height: 1.14rem;
  border-radius: 50%;
  background: var(--color-bg);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35);
  transform: translateY(-50%);
  transition: transform var(--transition-base), background-color var(--transition-base);
}

.auto-response-toggle .auto-response-switch::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 70%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
  transition: color var(--transition-base), left var(--transition-base),
    transform var(--transition-base);
}

.auto-response-toggle .auto-response-switch:focus {
  border-color: var(--color-primary);
  outline: 0;
  box-shadow: 0 0 0 0.2rem var(--color-focus-ring);
}

.auto-response-toggle .auto-response-switch:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 10px 24px var(--color-focus-ring);
}

.auto-response-toggle .auto-response-switch:checked::after {
  transform: translate(1.48rem, -50%);
  background: var(--color-surface);
}

.auto-response-toggle .auto-response-switch:checked::before {
  content: "";
  left: 30%;
  color: var(--color-text);
}

.auto-response-toggle .auto-response-switch:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  box-shadow: none;
}

#cleaningDetailsModal .form-control,
#cleaningDetailsModal .form-select,
#cleaningDetailsModal textarea,
#cleaningDetailsModal .input-group-text {
  border-color: var(--color-border) !important;
  box-shadow: none !important;
}

#cleaningDetailsModal .form-control:focus,
#cleaningDetailsModal .form-select:focus,
#cleaningDetailsModal textarea:focus {
  border-color: var(--color-primary) !important;
  box-shadow: none !important;
  outline: none !important;
}

#cleaningDetailsModal .time-needed-field .form-select {
  border-color: var(--color-border);
}

#cleaningDetailsModal .time-needed-field .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: none;
  outline: none;
}

#cleaningDetailsModal .time-needed-field .form-control-sm {
  border-color: var(--color-border);
}

#cleaningDetailsModal .time-needed-field .form-control-sm:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: none;
}

.lead-tab-section {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: clamp(1rem, 2vw, 1.5rem);
  margin: 0;
  box-shadow: var(--shadow-soft);
}

.theme-light .lead-tab-section {
  background: var(--color-surface);
}

.lead-tab-section legend {
  color: var(--color-muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 0.5rem;
  margin-bottom: 1.25rem;
}

.lead-tab-section[disabled] {
  opacity: 1;
}

.lead-tab-section[disabled] .form-control,
.lead-tab-section[disabled] .form-select,
.lead-tab-section[disabled] textarea,
.lead-tab-section[disabled] input,
.lead-tab-section[disabled] select {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
  cursor: not-allowed;
}

.lead-tab-section[disabled] .form-control::placeholder,
.lead-tab-section[disabled] .form-select::placeholder,
.lead-tab-section[disabled] textarea::placeholder,
.lead-tab-section[disabled] input::placeholder,
.lead-tab-section[disabled] select::placeholder {
  color: var(--color-muted);
  opacity: 1;
}

.input-group-text {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: background var(--transition-base), color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-base);
}

.btn:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 0;
}

.btn-primary {
  background: var(--color-primary);
  border-color: transparent;
  color: #fff;
}

.assign-cleaner-btn {
  color: var(--color-primary);
  border-color: var(--color-primary-border);
  background: var(--color-primary-soft);
}

.assign-cleaner-btn:hover,
.assign-cleaner-btn:focus {
  color: #fff;
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--color-primary-hover);
  border-color: transparent;
  color: #fff;
}

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

.btn-primary-soft {
  background: var(--btn-primary-soft-bg);
  border-color: var(--btn-primary-soft-border);
  color: var(--btn-primary-soft-text);
  box-shadow: var(--btn-primary-soft-shadow);
}

.btn-primary-soft:hover,
.btn-primary-soft:focus {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-surface);
  box-shadow: var(--btn-primary-soft-shadow-hover);
}

.btn-primary-soft:active {
  box-shadow: var(--btn-primary-soft-shadow);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  color: #fff;
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-check:checked + .btn-outline-primary,
.btn-check:active + .btn-outline-primary,
.btn-outline-primary:active,
.btn-outline-primary.active,
.show > .btn-outline-primary.dropdown-toggle {
  color: #fff;
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline-secondary {
  color: var(--color-muted);
  border-color: var(--color-border);
  background: rgba(255, 255, 255, 0.02);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  color: var(--color-text);
  background: var(--color-surface-hover);
  border-color: var(--color-border-strong);
}

.btn-outline-success {
  color: var(--color-success);
  border-color: var(--color-success-border);
  background: var(--color-success-soft);
}

.btn-outline-success:hover,
.btn-outline-success:focus {
  color: #ffffff;
  background: var(--color-success);
  border-color: var(--color-success);
}

.btn-success {
  background: var(--color-success);
  border-color: transparent;
  color: #ffffff;
}

.btn-success:hover,
.btn-success:focus {
  background: var(--color-success-hover);
  color: #ffffff;
  border-color: transparent;
}

.btn-link {
  color: var(--color-primary);
}

.btn-link:hover,
.btn-link:focus {
  color: var(--color-primary-hover);
}

.dropdown-menu {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
}

.dropdown-item {
  border-radius: var(--radius-sm);
  color: var(--color-text);
}

.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-item.active,
.dropdown-item:active {
  background: var(--color-primary-soft);
  color: var(--color-text);
}

.card {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
}

.card-header {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}

.card-body {
  color: var(--color-text);
}

.list-group {
  background: transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.list-group-item {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--color-border);
  color: var(--color-text);
}

.list-group-item + .list-group-item {
  border-top-color: var(--color-border);
}

.sequence-step {
  position: relative;
}

.sequence-step.is-collapsed {
  background: rgba(255, 255, 255, 0.04);
}

.sequence-step.is-collapsed .sequence-step-body {
  display: none;
}

.sequence-step .sequence-step-header {
  align-items: stretch;
}

.sequence-step .sequence-step-header .btn-outline-secondary {
  white-space: nowrap;
}

.sequence-step-panel {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: clamp(1rem, 2vw, 1.5rem);
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2vw, 1.5rem);
}

.sequence-step-panel .sequence-step-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sequence-step-panel .sequence-step-test-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
}

.sequence-step-panel .sequence-step-test-toggle__label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.sequence-step-panel .sequence-step-test-toggle__control {
  display: inline-flex;
  align-items: center;
}

.sequence-step-panel .sequence-test-toggle-input {
  display: none;
}

.sequence-step-panel .sequence-test-toggle-switch {
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  border: none;
  border-radius: 999px;
  background: var(--color-surface-alt);
  color: var(--color-muted);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.25rem;
  min-width: 6rem;
  height: 2rem;
  cursor: pointer;
  transition: color var(--transition-base), box-shadow var(--transition-base);
}

.sequence-step-panel .sequence-test-toggle-switch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 0.25rem var(--color-focus-ring);
}

.sequence-step-panel .sequence-test-toggle-switch__option {
  position: relative;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 1;
  transition: color var(--transition-base);
}

.sequence-step-panel .sequence-test-toggle-switch__option {
  color: inherit;
}

.sequence-step-panel .sequence-test-toggle-switch:not(.is-active) .sequence-test-toggle-switch__option--off,
.sequence-step-panel .sequence-test-toggle-switch.is-active .sequence-test-toggle-switch__option--on {
  color: var(--color-text);
}

.sequence-step-panel .sequence-test-toggle-switch__thumb {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  width: calc(50% - 0.3rem);
  height: calc(100% - 0.5rem);
  border-radius: 999px;
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-base), background-color var(--transition-base);
}

.sequence-step-panel .sequence-test-toggle-switch.is-active {
  box-shadow: var(--shadow-md);
}

.sequence-step-panel .sequence-test-toggle-switch.is-active .sequence-test-toggle-switch__option--off {
  color: var(--color-muted);
}

.sequence-step-panel .sequence-test-toggle-switch.is-active .sequence-test-toggle-switch__thumb {
  transform: translateX(calc(100% + 0.3rem));
  background: var(--color-primary);
}

.sequence-step-panel .nav-tabs {
  border-bottom: 1px solid var(--color-border);
  gap: 0.25rem;
  margin-bottom: 1.25rem;
}

.sequence-step-panel .nav-tabs .nav-item {
  margin-bottom: -1px;
}

.sequence-step-panel .nav-tabs .nav-link {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--color-muted);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  transition: color var(--transition-base), border-color var(--transition-base), background var(--transition-base);
}

.sequence-step-panel .nav-tabs .nav-link:hover,
.sequence-step-panel .nav-tabs .nav-link:focus {
  color: var(--color-text);
  background: var(--color-surface-hover);
  border-radius: var(--radius-sm);
}

.sequence-step-panel .nav-tabs .nav-link.active {
  color: var(--color-text);
  border-bottom-color: var(--color-primary);
  background: transparent;
}

.sequence-step-panel .email-version-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: clamp(1rem, 2vw, 1.25rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sequence-step-panel .email-version-panel + .email-version-panel {
  margin-top: 1rem;
}

.sequence-step-panel .email-version-panel textarea {
  min-height: 180px;
}

.sequence-version-split {
  margin-top: 1.25rem !important;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
}

.table {
  color: var(--color-text);
}

.table > :not(caption) > * > * {
  background-color: transparent;
  border-bottom: 1px solid var(--color-border);
  color: inherit;
}

.table thead th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border-strong);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(255, 255, 255, 0.03);
}

.table-hover > tbody > tr:hover > * {
  background-color: var(--color-primary-soft);
  color: var(--color-text);
}

.table-responsive {
  background: transparent;
}

.pagination {
  gap: 0.4rem;
}

.page-link {
  border-radius: var(--radius-sm) !important;
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  padding: 0.375rem 0.75rem;
  transition: background var(--transition-base), color var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

.page-link:hover,
.page-link:focus {
  background: var(--color-surface-hover);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.page-item.active .page-link {
  background: var(--color-primary-subtle);
  border-color: var(--color-primary-border);
  color: var(--color-primary-text);
}

.page-item.disabled .page-link {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text-disabled);
  opacity: 0.5;
}

/* DEPRECATED: Modal styles moved to /static/css/modals.css
   Keep commented for potential rollback until migration is complete and tested
   Date moved: 2025-12-14

.modal-content {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: var(--radius-sm);
}

.modal-header,
.modal-footer {
  border-color: var(--color-border);
}
*/

.modal-message-preview {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  padding: 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 18rem;
  width: 100%;
}

.badge.bg-success {
  background: var(--color-success-soft) !important;
  color: var(--color-success) !important;
}

.badge.bg-danger {
  background: var(--color-danger-soft) !important;
  color: var(--color-danger) !important;
}

.surface-panel {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: clamp(20px, 3vw, 28px);
}

.surface-panel--flush {
  padding: 0;
}

.surface-panel--subtle {
  background: var(--color-surface);
}

.theme-light .surface-panel.surface-panel--flush {
  background: var(--color-surface);
  border-color: var(--color-border);
}

.surface-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--color-muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.surface-divider {
  height: 1px;
  width: 100%;
  background: var(--color-border);
}

.table-empty-state {
  color: var(--color-muted);
  padding: 2.5rem;
}

.muted-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  font-weight: 600;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

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

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.table-responsive::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}

@media (max-width: 1024px) {
  .app-layout {
    flex-direction: column;
  }

  .app-sidebar {
    position: relative;
    width: 100%;
    min-height: unset;
    flex-direction: column;
  }

  .app-nav-link:hover,
  .app-nav-link:focus {
    transform: translateX(0);
  }

  .app-main {
    padding-top: 24px;
  }
}

@media (max-width: 640px) {
  .app-sidebar {
    padding: 24px 20px;
  }

  .app-nav-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }

  .app-nav-link {
    flex: 1 1 120px;
    justify-content: center;
  }

  .app-nav-footer {
    align-items: stretch;
  }
}

.openphone-connection-subtitle {
  color: inherit;
}

.openphone-checklist {
  margin: 0;
  padding: 0;
}

.openphone-checklist-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text);
  transition: border-color var(--transition-base), background var(--transition-base);
}

.openphone-checklist-item.is-complete {
  border-color: var(--color-success-border);
  background: var(--color-success-soft);
}

.openphone-checklist-item.is-pending {
  border-color: var(--color-danger-border);
  background: var(--color-danger-soft);
}

.openphone-checklist-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
  flex-shrink: 0;
}

.openphone-checklist-item.is-complete .openphone-checklist-indicator {
  background: var(--color-success);
  color: #ffffff;
}

.openphone-checklist-item.is-pending .openphone-checklist-indicator {
  background: var(--color-danger);
  color: #ffffff;
}

.openphone-checklist-label {
  display: inline-flex;
  flex-direction: column;
  gap: 0.25rem;
}

.openphone-webhook-helper {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  color: var(--color-text);
}

.openphone-webhook-header {
  border-bottom: none;
  padding-bottom: 0.75rem;
}

.openphone-webhook-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: var(--color-success-soft);
  color: var(--color-success);
}

.openphone-webhook-event-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.5rem 1rem;
}

.openphone-webhook-event-list li {
  position: relative;
  padding-left: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}

.openphone-webhook-event-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0.2rem;
  color: var(--color-success);
  font-size: 0.95rem;
}
.openphone-collapsible {
  transition: padding 0.2s ease;
}

.openphone-collapsible.is-collapsed {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.openphone-collapsible.is-collapsed [data-openphone-collapsible-body] {
  display: none;
}

.openphone-collapsible:not(.is-collapsed) .openphone-webhook-header {
  margin-bottom: 0.75rem;
}

.openphone-collapsible.is-collapsed .openphone-webhook-header {
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 0;
}
.openphone-collapsible .openphone-collapsible-toggle svg {
  transition: transform 0.2s ease;
}
.openphone-collapsible.is-collapsed .openphone-collapsible-toggle [data-openphone-collapsible-icon='collapse'] {
  display: none !important;
}
.openphone-collapsible.is-collapsed .openphone-collapsible-toggle [data-openphone-collapsible-icon='expand'] {
  display: inline;
}
.openphone-collapsible:not(.is-collapsed) .openphone-collapsible-toggle [data-openphone-collapsible-icon='collapse'] {
  display: inline;
}
.openphone-collapsible:not(.is-collapsed) .openphone-collapsible-toggle [data-openphone-collapsible-icon='expand'] {
  display: none !important;
}

.openphone-troubleshooting .accordion-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
  overflow: hidden;
}

.openphone-troubleshooting .accordion-item + .accordion-item {
  margin-top: 0.75rem;
}

.openphone-troubleshooting .accordion-button {
  color: var(--color-text);
  background: transparent;
  font-weight: 600;
}

.openphone-troubleshooting .accordion-button:focus {
  box-shadow: 0 0 0 0.2rem var(--color-focus-ring);
}

.openphone-troubleshooting .accordion-button:not(.collapsed) {
  color: var(--color-text);
  background: var(--color-primary-soft);
}

.openphone-troubleshooting .accordion-body {
  color: var(--color-muted);
  background: rgba(255, 255, 255, 0.03);
}

.openphone-team-card {
  background: var(--color-surface-alt);
  border-color: var(--color-border);
}

.openphone-team-card .table {
  color: var(--color-text);
  margin-bottom: 0;
}

.openphone-team-card .table thead {
  background: rgba(255, 255, 255, 0.04);
}

.openphone-team-card .table thead th,
.openphone-team-card .table tbody td {
  border-color: var(--color-border);
}

.openphone-team-card .table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.openphone-override-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  transition: background var(--transition-base), color var(--transition-base);
}

.openphone-override-status--default {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-muted);
}

.openphone-override-status--assigned {
  background: var(--color-primary);
  color: #ffffff;
}

/* Light Theme Overrides */
.theme-light .input-group-text {
  background: var(--color-surface);  /* Pure white like sidebar instead of purple-tinted */
}
