/* iOS Premium Styling for Jersey CRM */

:root {
  /* Dark Mode Default Theme (OLED Friendly) */
  --bg-primary: #000000;
  --bg-secondary: #1c1c1e;
  --bg-tertiary: #2c2c2e;
  --bg-input: #1c1c1e;
  
  --accent-blue: #0a84ff;
  --accent-green: #30d158;
  --accent-orange: #ff9f0a;
  --accent-red: #ff453a;
  --accent-gray: #8e8e93;
  
  --text-primary: #ffffff;
  --text-secondary: #8e8e93;
  --text-tertiary: #545456;
  
  --border-color: #38383a;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --glass-bg: rgba(28, 28, 30, 0.85);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
  --transition-speed: 0.28s;
  --transition-curve: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Toggle */
.light-theme {
  --bg-primary: #f2f2f7;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f2f2f7;
  --bg-input: #e9e9eb;
  
  --accent-blue: #007aff;
  --accent-green: #34c759;
  --accent-orange: #ff9500;
  --accent-red: #ff3b30;
  --accent-gray: #8e8e93;
  
  --text-primary: #000000;
  --text-secondary: #8e8e93;
  --text-tertiary: #aeaeb2;
  
  --border-color: #d1d1d6;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Base resets & layout */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: #121212; /* outer dark border on desktop */
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
}

/* Phone Screen Simulator Container */
#phone-container {
  width: 100%;
  max-width: 430px; /* iPhone 15 Pro Max size */
  height: 900px;
  max-height: 100vh;
  background-color: var(--bg-primary);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-color);
  transition: background-color var(--transition-speed);
}

@media (max-width: 480px) {
  #phone-container {
    max-width: 100%;
    height: 100vh;
    border: none;
    box-shadow: none;
  }
}

/* Header Style */
.app-header {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 55px 16px 12px 16px; /* Top padding leaves space for simulated status bar */
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 45px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  z-index: 110;
  pointer-events: none;
}

.status-icons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.header-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.header-action-btn {
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-action-btn:active {
  opacity: 0.6;
}

/* App Scrollable Content Area */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(88px + var(--safe-area-bottom)); /* Leave space for bottom tab bar */
  -webkit-overflow-scrolling: touch;
}

/* Bottom Tab Navigation */
.tab-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(65px + var(--safe-area-bottom));
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: var(--safe-area-bottom);
  z-index: 100;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  flex: 1;
  height: 100%;
  cursor: pointer;
  transition: color 0.15s;
  gap: 4px;
}

.tab-item svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.tab-item.active {
  color: var(--accent-blue);
}

/* View Control */
.view-panel {
  display: none;
  animation: fadeIn var(--transition-speed) var(--transition-curve);
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Elements */
.metrics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background-color: var(--bg-secondary);
  border-radius: 14px;
  padding: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, background-color var(--transition-speed);
}

.metric-card:active {
  transform: scale(0.98);
}

.metric-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-subtext {
  font-size: 11px;
  color: var(--accent-green);
  margin-top: 4px;
  font-weight: 600;
}

.metric-subtext.neutral {
  color: var(--text-secondary);
}

/* Search bar styling */
.search-container {
  position: relative;
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  background-color: var(--bg-input);
  border: none;
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  transition: all 0.2s;
}

.search-input:focus {
  background-color: var(--bg-tertiary);
  box-shadow: 0 0 0 1.5px var(--accent-blue);
}

.search-suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-top: 6px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 120;
  box-shadow: var(--shadow-lg);
  display: none;
}

.suggestion-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

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

.suggestion-name {
  font-weight: 600;
  font-size: 15px;
}

.suggestion-address {
  font-size: 12px;
  color: var(--text-secondary);
}

.suggestion-source {
  align-self: flex-end;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-blue);
  background: rgba(10, 132, 255, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
}

.suggestion-source.osm {
  color: var(--accent-green);
  background: rgba(48, 209, 88, 0.15);
}

/* List section titles */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 18px 0 10px 0;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.filter-btn {
  font-size: 14px;
  color: var(--accent-blue);
  background: none;
  border: none;
  cursor: pointer;
}

/* Leads List Layout */
.leads-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lead-item-card {
  background-color: var(--bg-secondary);
  border-radius: 14px;
  padding: 16px;
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: transform 0.15s, background-color var(--transition-speed);
}

.lead-item-card:active {
  transform: scale(0.98);
  background-color: var(--bg-tertiary);
}

.lead-card-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0; /* allows text truncation */
}

.lead-business-name {
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-address {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-meta-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: capitalize;
}

.badge.priority-high {
  background-color: rgba(255, 69, 58, 0.15);
  color: var(--accent-red);
}

.badge.priority-medium {
  background-color: rgba(255, 159, 10, 0.15);
  color: var(--accent-orange);
}

.badge.priority-low {
  background-color: rgba(142, 142, 147, 0.15);
  color: var(--text-secondary);
}

.badge.stage-prospecting {
  background-color: rgba(142, 142, 147, 0.15);
  color: var(--text-secondary);
}

.badge.stage-qualification {
  background-color: rgba(175, 82, 222, 0.15);
  color: #af52de;
}

.badge.stage-discovery {
  background-color: rgba(10, 132, 255, 0.15);
  color: var(--accent-blue);
}

.badge.stage-proposal {
  background-color: rgba(100, 210, 255, 0.15);
  color: #64d2ff;
}

.badge.stage-negotiation {
  background-color: rgba(255, 159, 10, 0.15);
  color: var(--accent-orange);
}

.badge.stage-closed_won {
  background-color: rgba(48, 209, 88, 0.15);
  color: var(--accent-green);
}

.badge.stage-closed_lost {
  background-color: rgba(255, 69, 58, 0.15);
  color: var(--accent-red);
}

.lead-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  padding-left: 12px;
}

.lead-estimate-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-green);
}

.lead-chevron {
  color: var(--text-tertiary);
}

/* iOS Segmented Control */
.segmented-control {
  display: flex;
  background-color: var(--bg-input);
  border-radius: 8px;
  padding: 2px;
  margin-bottom: 16px;
  position: relative;
  user-select: none;
}

.segment-item {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  z-index: 2;
  transition: color 0.15s;
}

.segment-item.active {
  color: var(--text-primary);
}

.segmented-control-bg {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc(33.333% - 2.6px);
  background-color: var(--bg-tertiary);
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  z-index: 1;
  transition: transform var(--transition-speed) cubic-bezier(0.2, 0.8, 0.2, 1);
}

.light-theme .segmented-control-bg {
  background-color: var(--bg-secondary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

.form-group-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 6px;
  padding-left: 4px;
}

.form-card {
  background-color: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.form-row:last-child {
  border-bottom: none;
}

.form-label {
  width: 100px;
  font-size: 15px;
  color: var(--text-primary);
}

.form-control {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
}

.form-control::placeholder {
  color: var(--text-tertiary);
}

.form-textarea {
  width: 100%;
  height: 80px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  resize: none;
  padding: 12px 16px;
}

/* Contacts Dynamic Form List */
.contact-item-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  position: relative;
  animation: slideIn var(--transition-speed) var(--transition-curve);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.contact-item-row:last-child {
  border-bottom: none;
}

.contact-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.contact-index-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-blue);
}

.remove-contact-btn {
  background: none;
  border: none;
  color: var(--accent-red);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.contact-input {
  background-color: var(--bg-input);
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.contact-input:focus {
  box-shadow: 0 0 0 1px var(--accent-blue);
}

.contact-notes {
  grid-column: span 2;
  height: 50px;
  resize: none;
}

.add-contact-btn-wrapper {
  padding: 12px 16px;
  text-align: center;
}

.action-text-btn {
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Product list selectors */
.products-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background-color: var(--border-color);
}

.product-select-card {
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s;
}

.product-select-card:active {
  background-color: var(--bg-tertiary);
}

.product-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.custom-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: transparent;
}

.product-select-card.selected .custom-checkbox {
  background-color: var(--accent-green);
  border-color: var(--accent-green);
  color: white;
}

.product-name-desc {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.product-select-name {
  font-weight: 600;
  font-size: 15px;
}

.product-select-desc {
  font-size: 11px;
  color: var(--text-secondary);
}

.product-price-label {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.product-select-card.selected .product-price-label {
  color: var(--accent-green);
}

/* Submit Area */
.form-submit-row {
  margin: 24px 0 16px 0;
  display: flex;
  gap: 12px;
}

.btn {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-align: center;
}

.btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.btn-primary {
  background-color: var(--accent-blue);
  color: white;
}

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

.btn-danger {
  background-color: var(--accent-red);
  color: white;
}

/* Bottom Sheet Details View */
.bottom-sheet-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 150;
  display: none;
  animation: fadeInOpacity var(--transition-speed) var(--transition-curve);
}

.bottom-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85%;
  background-color: var(--bg-secondary);
  border-radius: 18px 18px 0 0;
  z-index: 160;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform var(--transition-speed) var(--transition-curve);
}

.bottom-sheet.open {
  transform: translateY(0);
}

.bottom-sheet-drag-handle {
  width: 36px;
  height: 5px;
  background-color: var(--border-color);
  border-radius: 3px;
  margin: 10px auto;
  flex-shrink: 0;
}

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

.bottom-sheet-title {
  font-size: 20px;
  font-weight: 700;
}

.bottom-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

/* Details Page Widgets */
.detail-meta-card {
  background-color: var(--bg-tertiary);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.detail-address {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.4;
}

.detail-quick-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.action-pill-btn {
  flex: 1;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px;
  color: var(--accent-blue);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.action-pill-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.action-pill-btn:active {
  background-color: var(--border-color);
}

.detail-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin: 18px 0 8px 0;
  padding-left: 2px;
}

.detail-contact-card {
  background-color: var(--bg-tertiary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 14px;
  margin-bottom: 12px;
}

.detail-contact-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.detail-contact-name {
  font-weight: 600;
  font-size: 15px;
}

.detail-contact-role {
  font-size: 11px;
  font-weight: 700;
  background-color: rgba(10, 132, 255, 0.15);
  color: var(--accent-blue);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.detail-contact-body {
  font-size: 13px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-contact-link {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 500;
}

.detail-contact-notes {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-style: italic;
}

.product-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.product-tag {
  background-color: rgba(48, 209, 88, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(48, 209, 88, 0.2);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 12px;
}

/* Settings List Style */
.settings-section {
  margin-bottom: 20px;
}

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

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  text-decoration: none;
  color: var(--text-primary);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row:active {
  background-color: var(--bg-tertiary);
}

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

.settings-row-left svg {
  color: var(--accent-blue);
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.settings-label {
  font-size: 15px;
  font-weight: 500;
}

.settings-value {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Toggle Switch Style (iOS native) */
.switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-input);
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 27px;
  width: 27px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

input:checked + .slider {
  background-color: var(--accent-green);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Animations and helpers */
@keyframes fadeInOpacity {
  from { opacity: 0; }
  to { opacity: 1; }
}

.d-none {
  display: none !important;
}

/* Toast Notification */
.toast {
  position: absolute;
  top: 55px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background-color: var(--accent-blue);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spin-animation {
  animation: spin 1.2s linear infinite;
}

/* Leaflet iOS-Style Popup Adjustments */
.leaflet-popup-content-wrapper {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-radius: 12px !important;
  border: 1px solid var(--border-color) !important;
  font-family: inherit !important;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-tip {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
}

.leaflet-popup-content {
  margin: 12px 14px !important;
  font-size: 14px;
  line-height: 1.4;
}

.leaflet-popup-close-button {
  color: var(--text-secondary) !important;
}

/* Authentication panel rules */
#login-panel {
  display: none;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100% - 60px);
  overflow-y: auto;
}

#login-panel.active {
  display: flex !important;
}

/* Pre-estimator quantity steppers */
.product-price-qty-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.stepper {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  height: 28px;
}

.stepper-btn {
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: 16px;
  font-weight: 600;
  width: 28px;
  height: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
}

.stepper-btn:active {
  background-color: var(--border-color);
}

.stepper-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 24px;
  text-align: center;
  padding: 0 4px;
}

/* Purchase History Styles */
.purchase-history-card {
  background-color: rgba(48, 209, 88, 0.05); /* very light transparent green */
  border: 1px dashed var(--accent-green);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.purchase-history-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 10px;
}

.purchase-status-badge {
  background-color: var(--accent-green);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.purchase-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.purchase-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-primary);
}

.purchase-item-name {
  font-weight: 600;
}

.purchase-item-qty {
  color: var(--text-secondary);
  font-size: 12px;
  margin-left: 6px;
}

.purchase-item-price {
  font-weight: 700;
  color: var(--accent-green);
}

/* Admin Table styles */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

.admin-table th {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 700;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1.5px solid var(--border-color);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Purchase Entry Form Styles */
.purchase-item-row-form {
  border-bottom: 1px dashed var(--border-color);
  padding: 12px 16px;
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.purchase-item-row-form:last-child {
  border-bottom: none;
}

.purchase-form-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1fr;
  gap: 8px;
}

.purchase-form-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* Follow-up alert container styling */
.followup-alert-card {
  background-color: rgba(255, 69, 58, 0.06); /* very light transparent red */
  border: 1px dashed var(--accent-red);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.light-theme .followup-alert-card {
  background-color: rgba(255, 59, 48, 0.04);
}

.followup-alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 8px;
}

.followup-alert-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-red);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.followup-alert-count {
  font-size: 11px;
  font-weight: 800;
  background-color: var(--accent-red);
  color: white;
  padding: 2px 7px;
  border-radius: 10px;
}

.followup-alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.followup-alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
}

.followup-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.followup-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.followup-item-label {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.followup-item-biz {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.followup-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.followup-badge.overdue {
  background-color: rgba(255, 69, 58, 0.15);
  color: var(--accent-red);
}

.followup-badge.today {
  background-color: rgba(255, 159, 10, 0.15);
  color: var(--accent-orange);
}

/* Follow-up Checklist widget inside details */
.detail-followup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
  transition: background-color 0.2s;
}

.detail-followup-row:last-child {
  border-bottom: none;
}

.detail-followup-row.completed {
  background-color: rgba(48, 209, 88, 0.02);
}

.detail-followup-row.completed .detail-followup-text {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.detail-followup-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.2s;
}

.detail-followup-subtext {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
