/* ===== Clean Air Treatment Manager - Global Styles ===== */
:root {
  --green: #78be20;
  --green-dark: #5a9616;
  --green-light: #e8f5d8;
  --blue: #1d428a;
  --blue-dark: #152f6b;
  --blue-light: #e0ecf8;
  --red: #e74c3c;
  --red-light: #fde8e8;
  --orange: #f39c12;
  --orange-light: #fef3cd;
  --yellow: #f1c40f;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --teal: #0d9488;
  --teal-light: #ccfbf1;
  --gray-50: #f8f9fa;
  --gray-100: #f0f0f0;
  --gray-200: #e0e0e0;
  --gray-300: #ccc;
  --gray-500: #888;
  --gray-700: #555;
  --gray-900: #333;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
  --gradient-green: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  --gradient-blue: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  --gradient-card: linear-gradient(180deg, #ffffff 0%, #f8fafb 100%);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --header-height: 56px;
  --bottom-nav-height: 64px;
  --side-nav-width: 260px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== Login Page ===== */
.login-body {
  background: linear-gradient(135deg, #8dc8e8 0%, var(--blue) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-container {
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  width: 100%;
  max-width: 400px;
}

.login-header {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: white;
  padding: 30px 20px;
  text-align: center;
}

.logo-box {
  background: white;
  padding: 12px;
  border-radius: var(--radius);
  display: inline-block;
  margin-bottom: 15px;
}

.logo-box img {
  width: 200px;
  height: auto;
}

.login-header h1 { font-size: 22px; margin-bottom: 4px; }
.login-header p { font-size: 14px; opacity: 0.9; }

.login-form { padding: 30px 20px; }

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
  background: white;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(120, 190, 32, 0.15);
}

.error-msg {
  color: var(--red);
  font-size: 14px;
  margin-bottom: 12px;
  min-height: 20px;
}

.install-banner {
  padding: 15px 20px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  text-align: center;
}

.install-banner p {
  font-size: 13px;
  color: var(--gray-700);
  margin-bottom: 8px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-green);
  color: white;
  box-shadow: 0 2px 8px rgba(120,190,32,0.25);
}
.btn-primary:hover { box-shadow: 0 4px 15px rgba(120,190,32,0.4); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.97); }

.btn-secondary {
  background: var(--gradient-blue);
  color: white;
  box-shadow: 0 2px 8px rgba(29,66,138,0.2);
}
.btn-secondary:hover { box-shadow: 0 4px 15px rgba(29,66,138,0.35); transform: translateY(-1px); }
.btn-secondary:active { transform: translateY(0) scale(0.97); }

.btn-danger {
  background: linear-gradient(135deg, var(--red), #c0392b);
  color: white;
  box-shadow: 0 2px 8px rgba(231,76,60,0.25);
}
.btn-danger:active { transform: scale(0.97); }

.btn-outline {
  background: transparent;
  border: 2px solid var(--green);
  color: var(--green-dark);
}
.btn-outline:hover { background: var(--green); color: white; }
.btn-outline:active { transform: scale(0.97); }

.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; border-radius: 50%; min-width: 40px; min-height: 40px; }

/* ===== App Header ===== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-height) + env(safe-area-inset-top, 0));
  padding-top: env(safe-area-inset-top, 0);
  background: linear-gradient(135deg, var(--green) 0%, #6ab51e 50%, var(--green-dark) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: max(16px, env(safe-area-inset-left, 0));
  padding-right: max(16px, env(safe-area-inset-right, 0));
  z-index: 100;
  box-shadow: 0 2px 12px rgba(90, 150, 22, 0.35);
}

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

.menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: all 0.2s;
}

.header-title { font-size: 18px; font-weight: 700; }

.user-name {
  font-size: 14px;
  opacity: 0.9;
}

/* ===== Side Nav ===== */
.side-nav {
  position: fixed;
  top: 0;
  left: -var(--side-nav-width);
  left: -260px;
  width: var(--side-nav-width);
  height: 100vh;
  background: white;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.side-nav.open { transform: translateX(260px); }

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.nav-overlay.open { opacity: 1; pointer-events: auto; }

.nav-header {
  padding: 20px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.nav-logo {
  width: 160px;
  height: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  color: var(--gray-700);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-item svg { width: 22px; height: 22px; flex-shrink: 0; }
.nav-item:hover { background: var(--gray-50); color: var(--green-dark); }
.nav-item.active {
  color: var(--green-dark);
  background: #f0f9e8;
  border-left-color: var(--green);
  font-weight: 600;
}

.nav-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 8px 0;
}

.nav-footer {
  margin-top: auto;
  padding: 20px;
  border-top: 1px solid var(--gray-200);
}

/* ===== Main Content ===== */
.main-content {
  margin-top: calc(var(--header-height) + env(safe-area-inset-top, 0));
  padding: 16px;
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0) + 16px);
  min-height: calc(100vh - var(--header-height));
}

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0));
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: white;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  text-decoration: none;
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 500;
  flex: 1;
  transition: color var(--transition-fast), transform var(--transition-spring);
}

.bottom-nav-item svg { width: 24px; height: 24px; transition: transform var(--transition-spring); }
.bottom-nav-item.active { color: var(--green-dark); font-weight: 700; }
.bottom-nav-item.active svg { transform: scale(1.1); }
.bottom-nav-item.active::after {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  margin-top: 1px;
}
.bottom-nav-item:active { transform: scale(0.9); }

/* ===== Cards ===== */
.card {
  background: var(--gradient-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid rgba(0,0,0,0.04);
  transition: box-shadow var(--transition-normal);
}

.card-header {
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--gray-50) 0%, rgba(248,249,250,0.5) 100%);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 16px;
  color: var(--blue);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-body { padding: 16px; }

.card-accent {
  border-left: 4px solid var(--green);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(120,190,32,0.08);
}

/* ===== Page Headers ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.page-header h2 {
  font-size: 22px;
  color: var(--blue);
}

/* ===== Search Bar ===== */
.search-bar {
  position: relative;
  margin-bottom: 16px;
}

.search-bar input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  font-size: 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  background: white;
  font-family: inherit;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(120, 190, 32, 0.15);
}

.search-bar svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--gray-500);
}

/* ===== Filter Pills ===== */
.filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.pill {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid var(--gray-200);
  background: white;
  color: var(--gray-700);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.pill.active {
  border-color: var(--green);
  background: #e8f5d8;
  color: var(--green-dark);
}

/* ===== Data Table ===== */
.data-row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background var(--transition-fast), border-left-color var(--transition-fast), transform var(--transition-fast);
  border-left: 3px solid transparent;
  animation: fadeSlideIn 0.3s ease-out both;
}
.data-row:nth-child(1) { animation-delay: 0ms; }
.data-row:nth-child(2) { animation-delay: 30ms; }
.data-row:nth-child(3) { animation-delay: 60ms; }
.data-row:nth-child(4) { animation-delay: 90ms; }
.data-row:nth-child(5) { animation-delay: 120ms; }
.data-row:nth-child(n+6) { animation-delay: 150ms; }

.data-row:hover { background: var(--gray-50); border-left-color: var(--green); }
.data-row:active { transform: scale(0.99); }
.data-row:last-child { border-bottom: none; }

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

.data-row-main { flex: 1; min-width: 0; }
.data-row-main h4 {
  font-size: 15px;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-row-main p {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 2px;
}

.data-row-right {
  text-align: right;
  flex-shrink: 0;
  margin-left: 12px;
}

/* ===== Badge / Tag ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-green { background: #dcf5c8; color: #2d6a1e; }
.badge-blue { background: #d0e4f7; color: #1a3a7a; }
.badge-red { background: #fdd; color: #b91c1c; }
.badge-orange { background: #fee4b8; color: #92400e; }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }
.badge-muted { background: #e5e7eb; color: #6b7280; }

/* ===== Stat Cards ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--gradient-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid rgba(0,0,0,0.04);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-spring), box-shadow var(--transition-normal);
}
.stat-card:active { transform: scale(0.97); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-green);
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: -0.02em;
}

.stat-card .stat-label {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.stat-card-green::before { background: var(--gradient-green); }
.stat-card-blue::before { background: var(--gradient-blue); }
.stat-card-orange::before { background: linear-gradient(135deg, var(--orange), #e67e22); }
.stat-card-red::before { background: linear-gradient(135deg, var(--red), #c0392b); }
.stat-card-teal::before { background: linear-gradient(135deg, var(--teal), #0f766e); }
.stat-card-purple::before { background: linear-gradient(135deg, var(--purple), #6d28d9); }

/* ===== Inventory Colors ===== */
.stock-ok { color: var(--green-dark); }
.stock-low { color: var(--orange); }
.stock-out { color: var(--red); }

/* ===== Detail View ===== */
.detail-section {
  margin-bottom: 20px;
}

.detail-section h3 {
  font-size: 14px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--gray-200);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 15px;
  border-bottom: 1px solid var(--gray-100);
}

.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--gray-500); }
.detail-value { font-weight: 600; text-align: right; max-width: 60%; }

/* ===== Form Styles (in-app) ===== */
.app-form .form-group {
  margin-bottom: 16px;
}

.app-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group .form-hint {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
}

.checkbox-group input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--green);
}

.checkbox-group label {
  font-size: 15px;
  font-weight: 500;
  color: var(--gray-900);
  margin: 0;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: white;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.modal-header h3 { font-size: 18px; color: var(--blue); }

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 10px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  line-height: 1;
  border-radius: 8px;
}
.modal-close:active {
  background: var(--gray-100);
}

.modal-body { padding: 16px; }
.modal-footer {
  padding: 16px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 10px;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-500);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  color: var(--gray-300);
  opacity: 1;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--gray-700);
  margin-bottom: 8px;
  font-weight: 700;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ===== Loading ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== Back button ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green-dark);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  margin-bottom: 12px;
  cursor: pointer;
}

/* ===== Calculator specific ===== */
.calc-result {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--green);
  padding: 16px;
  margin-bottom: 12px;
}

.calc-result h4 {
  color: var(--blue);
  margin-bottom: 10px;
  font-size: 16px;
}

.calc-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

.calc-line.highlight {
  font-weight: 700;
  font-size: 16px;
  color: var(--green-dark);
  padding-top: 10px;
  border-top: 2px solid var(--gray-200);
  margin-top: 6px;
}

/* ===== Toast notifications ===== */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  z-index: 500;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  color: white;
  background: var(--gray-900);
}

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

.toast.toast-success { background: var(--gradient-green); }
.toast.toast-error { background: linear-gradient(135deg, var(--red), #c0392b); }

/* ===== Sync Badge (offline indicator) ===== */
.sync-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--red);
  color: white;
  animation: pulse-badge 2s ease-in-out infinite;
  margin-right: 8px;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ===== Locked Badge (compliance lock) ===== */
.locked-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.locked-badge::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
}

/* ===== Tab Bar ===== */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.tab:hover {
  color: var(--green-dark);
}

.tab.active {
  color: var(--green-dark);
  border-bottom-color: var(--green);
}

/* ===== Dropdown Results (property typeahead) ===== */
.dropdown-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid var(--gray-200);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 50;
  max-height: 250px;
  overflow-y: auto;
}

.dropdown-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
  transition: background 0.1s;
}

.dropdown-item:hover {
  background: #f0f9e8;
}

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

/* ===== Timeline (IPM observations) ===== */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gray-200);
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
  padding-bottom: 4px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--gray-200);
}

.timeline-date {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.timeline-content {
  background: white;
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow);
}

.timeline-content p {
  font-size: 14px;
  color: var(--gray-700);
  line-height: 1.5;
}

.timeline-user {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 6px;
}

/* ===== Photo Grid (IPM photos) ===== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.15s;
}

.photo-grid img:hover {
  opacity: 0.8;
}

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox img {
  max-width: 95%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== IPM Status Badges ===== */
.ipm-status-active { background: #fde8e8; color: var(--red); }
.ipm-status-monitoring { background: #fef3cd; color: #856404; }
.ipm-status-resolved { background: #e8f5d8; color: var(--green-dark); }

/* ===== Desktop adjustments ===== */
@media (min-width: 768px) {
  .bottom-nav { display: none; }

  .main-content {
    padding-bottom: 16px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
  }

  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .modal {
    border-radius: var(--radius);
    max-width: 500px;
    box-shadow: var(--shadow-xl);
  }

  .modal-overlay {
    align-items: center;
  }

  .modal {
    transform: translateY(20px) scale(0.98);
  }
  .modal-overlay.open .modal {
    transform: translateY(0) scale(1);
  }
}

/* ===== Skeleton Loading ===== */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin-bottom: 8px; width: 80%; }
.skeleton-text-short { height: 14px; margin-bottom: 8px; width: 50%; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; }
.skeleton-card { height: 80px; margin-bottom: 12px; border-radius: var(--radius); }
.skeleton-stat { height: 90px; border-radius: var(--radius); }

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Scheduling ===== */
.schedule-date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  justify-content: center;
}

.schedule-date-input {
  font-size: 16px;
  padding: 6px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  text-align: center;
  background: white;
}

.week-bar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 8px;
}

.week-day {
  text-align: center;
  padding: 6px 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.week-day:hover { background: var(--gray-100); }
.week-day-selected { background: var(--blue); color: white; }
.week-day-selected:hover { background: var(--blue-dark); }
.week-day-today:not(.week-day-selected) { outline: 2px solid var(--green); }

.week-day-name {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  opacity: 0.7;
}

.week-day-num {
  display: block;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.week-day-count {
  display: block;
  font-size: 11px;
  opacity: 0.7;
}

.schedule-entry {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  gap: 10px;
}

.schedule-entry:last-child { border-bottom: none; }
.schedule-entry-done { opacity: 0.55; }

/* Service type color accents */
.schedule-entry[data-svc-color="green"] { border-left: 4px solid #78be20; }
.schedule-entry[data-svc-color="purple"] { border-left: 4px solid #7c3aed; }
.schedule-entry[data-svc-color="amber"] { border-left: 4px solid #f59e0b; }
.schedule-entry[data-svc-color="blue"] { border-left: 4px solid #3b82f6; }

.svc-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}
.svc-pill-green { background: #e8f5d8; color: #3d7a0f; }
.svc-pill-purple { background: #ede9fe; color: #5b21b6; }
.svc-pill-amber { background: #fef3c7; color: #92400e; }
.svc-pill-blue { background: #dbeafe; color: #1e40af; }

.schedule-entry-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.schedule-entry-order {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  flex-shrink: 0;
  margin-top: 2px;
}

.schedule-entry-info {
  flex: 1;
  min-width: 0;
}

.schedule-entry-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--blue);
}

.schedule-entry-addr {
  font-size: 13px;
  color: var(--gray-700);
}

.schedule-entry-meta {
  font-size: 12px;
  color: var(--gray-500);
}

.schedule-entry-meta a {
  color: var(--blue);
  text-decoration: none;
}

.schedule-entry-notes {
  font-size: 12px;
  color: var(--gray-500);
  font-style: italic;
  margin-top: 2px;
}

.schedule-entry-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.schedule-entry-btns {
  display: flex;
  gap: 4px;
}

.tech-select, .form-select-sm {
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: white;
  max-width: 130px;
}

.page-header {
  margin-bottom: 12px;
}
.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
}

/* Season overview */
.season-card {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
}
.season-card:last-child { border-bottom: none; }

.season-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.season-card-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--blue);
}
.season-card-addr {
  font-size: 13px;
  color: var(--gray-700);
}

.season-rounds {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 0;
  -webkit-overflow-scrolling: touch;
}

.round-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 44px;
}

.round-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  transition: transform 0.15s;
}
.round-dot:hover { transform: scale(1.15); }

.round-dot-completed { background: var(--green); }
.round-dot-scheduled { background: var(--blue); }
.round-dot-skipped { background: var(--gray-300); }
.round-dot-overdue { background: var(--red); }

.round-date {
  font-size: 10px;
  color: var(--gray-500);
  white-space: nowrap;
}

/* Progress bar */
.progress-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.3s;
}

@media (max-width: 767px) {
  .schedule-entry {
    flex-direction: column;
  }
  .schedule-entry-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
  }
}

/* ===== Calendar View ===== */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  justify-content: center;
  padding: 4px 0;
}
.cal-nav .btn:active { transform: scale(0.92); transition: transform 0.1s; }
.cal-month-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue);
  min-width: 180px;
  text-align: center;
}
.cal-grid {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.cal-header-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: linear-gradient(180deg, var(--gray-50) 0%, #f3f4f6 100%);
  border-bottom: 2px solid var(--gray-200);
}
.cal-header-cell {
  text-align: center;
  padding: 10px 2px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gray-500);
  letter-spacing: 0.5px;
}
.cal-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--gray-100);
}
.cal-row:last-child { border-bottom: none; }
.cal-cell {
  min-height: 64px;
  padding: 4px;
  border-right: 1px solid var(--gray-100);
  position: relative;
  overflow: hidden;
  transition: background 0.15s;
  background: var(--gray-50);
}
.cal-cell:last-child { border-right: none; }
.cal-cell-has-entries { background: white; }
.cal-cell-outside { background: var(--gray-100); opacity: 0.5; }
.cal-cell-today {
  background: linear-gradient(135deg, #f0f9e8 0%, #e0f2d0 100%) !important;
  box-shadow: inset 0 0 0 2px var(--green);
}
.cal-cell-today .cal-day-num {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(120, 190, 32, 0.4);
}
.cal-cell-weekend:not(.cal-cell-today) { background: #f5f5f5; }
.cal-cell-weekend:not(.cal-cell-today).cal-cell-has-entries { background: #fafafa; }
.cal-cell-weekend .cal-day-num { color: var(--gray-500); }
.cal-cell-drop-target {
  background: #e0ecf8 !important;
  outline: 2px solid var(--blue);
  outline-offset: -2px;
  animation: cal-drop-pulse 0.8s ease-in-out infinite;
}
@keyframes cal-drop-pulse {
  0%, 100% { background-color: #e0ecf8; }
  50% { background-color: #d0e0f4; }
}
.cal-day-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.cal-day-num:active {
  background: var(--gray-200);
  transform: scale(0.9);
}
.cal-cell-today .cal-day-num:active {
  background: var(--green-dark);
  transform: scale(0.9);
}
.cal-entries {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}
.cal-entry {
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: auto;
  transition: transform 0.15s, box-shadow 0.15s;
  border-left: 2px solid transparent;
}
.cal-entry:active { transform: scale(0.96); }
.cal-entry-scheduled { background: #e0ecf8; color: var(--blue); border-left-color: var(--blue); }
.cal-entry-completed { background: #e8f5d8; color: #3a7d2a; border-left-color: var(--green); }
.cal-entry-skipped {
  background: var(--gray-100); color: var(--gray-500); border-left-color: var(--gray-300);
  text-decoration: line-through; opacity: 0.7;
}
.cal-entry-overdue { background: #fde8e8; color: var(--red); border-left-color: var(--red); font-weight: 600; }
.cal-entry-dragging {
  opacity: 0.3;
  background: var(--gray-200) !important;
  border-left-color: var(--gray-300) !important;
}
.cal-entry-name { font-weight: 500; }
.cal-entry-more {
  font-size: 10px;
  color: var(--blue);
  padding: 2px 4px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.15s;
}
.cal-entry-more:active { background: var(--gray-100); }
.cal-count-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(29, 66, 138, 0.3);
}
.cal-drag-ghost {
  position: fixed;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: white;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(29, 66, 138, 0.35);
  z-index: 1000;
  pointer-events: none;
  transform: translate(-50%, -100%);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: cal-ghost-appear 0.15s ease-out;
}
@keyframes cal-ghost-appear {
  from { opacity: 0; transform: translate(-50%, -90%) scale(0.8); }
  to { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}
@media (min-width: 768px) {
  .cal-cell { min-height: 90px; padding: 6px 8px; }
  .cal-entry { font-size: 11px; padding: 3px 6px; }
  .cal-day-num { font-size: 14px; min-width: 28px; min-height: 28px; }
  .cal-count-badge { min-width: 22px; height: 22px; font-size: 10px; }
  .cal-entry:hover {
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    transform: translateY(-1px);
  }
}

/* ===== Calendar Day Modal ===== */
.day-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: day-modal-fade-in 0.2s ease-out;
}
@keyframes day-modal-fade-in {
  from { opacity: 0; } to { opacity: 1; }
}
.day-modal-backdrop.drag-active {
  background: rgba(0,0,0,0.08);
  pointer-events: none;
}
.day-modal-backdrop.drag-active .day-modal {
  opacity: 0.3;
  pointer-events: none;
}
.day-modal {
  background: white;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
  animation: day-modal-slide-up 0.25s ease-out;
  overflow: hidden;
}
@keyframes day-modal-slide-up {
  from { transform: translateY(100%); } to { transform: translateY(0); }
}
.day-modal-handle {
  width: 36px;
  height: 4px;
  background: var(--gray-300);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}
.day-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.day-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
}
.day-modal-count {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 500;
}
.day-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.day-modal-body {
  overflow-y: auto;
  padding: 8px 12px 20px;
  -webkit-overflow-scrolling: touch;
}
.day-modal-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  border-left: 4px solid var(--blue);
  background: #f8fafc;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s;
  user-select: none;
  -webkit-user-select: none;
}
.day-modal-entry:active { transform: scale(0.97); }
.day-modal-entry-scheduled { background: #e0ecf8; border-left-color: var(--blue); }
.day-modal-entry-completed { background: #e8f5d8; border-left-color: var(--green); }
.day-modal-entry-skipped { background: #f5f5f5; border-left-color: var(--gray-400); }
.day-modal-entry-overdue { background: #fde8e8; border-left-color: var(--red); }
.day-modal-entry-info {
  flex: 1;
  min-width: 0;
}
.day-modal-entry-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.day-modal-entry-detail {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}
.day-modal-entry-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.day-modal-entry-status-scheduled { background: #dbeafe; color: var(--blue); }
.day-modal-entry-status-completed { background: #dcfce7; color: #166534; }
.day-modal-entry-status-skipped { background: #f3f4f6; color: var(--gray-500); }
.day-modal-entry-status-overdue { background: #fee2e2; color: var(--red); }
.day-modal-entry.dragging-from-modal {
  opacity: 0.3;
  transform: scale(0.95);
}
.day-modal-empty {
  text-align: center;
  color: var(--gray-400);
  padding: 24px;
  font-size: 14px;
}
.day-modal-drag-hint {
  text-align: center;
  font-size: 11px;
  color: var(--gray-400);
  padding: 4px 0 8px;
}
@media (min-width: 768px) {
  .day-modal-backdrop { align-items: center; }
  .day-modal {
    border-radius: 16px;
    max-height: 60vh;
    margin-bottom: 0;
  }
}

/* ===== Soil Testing ===== */

/* pH Gauge - horizontal gradient bar with marker */
.soil-ph-gauge {
  position: relative;
  height: 28px;
  border-radius: 14px;
  background: linear-gradient(90deg,
    #e53e3e 0%,      /* 4.0 - very acidic */
    #ed8936 15%,     /* 5.0 */
    #ecc94b 25%,     /* 5.5 */
    #48bb78 35%,     /* 6.0 - optimal start */
    #38a169 50%,     /* 6.5 - ideal */
    #48bb78 60%,     /* 7.0 - optimal end */
    #ecc94b 70%,     /* 7.5 */
    #ed8936 80%,     /* 8.0 */
    #e53e3e 100%     /* 10.0 - very alkaline */
  );
  overflow: visible;
  box-shadow: var(--shadow-xs);
}

.soil-ph-marker {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 36px;
  background: white;
  border: 2px solid var(--gray-900);
  border-radius: 3px;
  transform: translateX(-50%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  z-index: 1;
}

.soil-ph-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--gray-500);
}

.soil-ph-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.soil-ph-optimal {
  position: absolute;
  top: -18px;
  font-size: 10px;
  font-weight: 600;
  color: var(--green-dark);
  white-space: nowrap;
}

/* N-P-K Nutrient Bars */
.soil-bar-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.soil-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.soil-bar-label {
  width: 32px;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  flex-shrink: 0;
}

.soil-bar-track {
  flex: 1;
  height: 20px;
  background: var(--gray-100);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.soil-bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 4px;
}

.soil-bar-fill-n { background: linear-gradient(90deg, #48bb78, #38a169); }
.soil-bar-fill-p { background: linear-gradient(90deg, #4299e1, #3182ce); }
.soil-bar-fill-k { background: linear-gradient(90deg, #ed8936, #dd6b20); }

.soil-bar-value {
  width: 60px;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Color indicators for soil values */
.soil-optimal { color: var(--green-dark); }
.soil-marginal { color: var(--orange); }
.soil-critical { color: var(--red); }

/* Soil test card summary */
.soil-summary {
  padding: 16px;
}

.soil-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  margin: 16px 0 8px;
}

.soil-section-title:first-child { margin-top: 0; }

.soil-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}

.soil-detail-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}

.soil-detail-label {
  color: var(--gray-500);
}

.soil-detail-value {
  font-weight: 600;
}

/* Previous soil tests list */
.soil-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.15s;
}

.soil-history-row:active {
  background: var(--gray-50);
  transform: scale(0.99);
}

.soil-history-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.soil-history-date {
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-900);
}

.soil-history-lab {
  font-size: 12px;
  color: var(--gray-500);
}

.soil-history-ph {
  font-weight: 700;
  font-size: 16px;
}

/* Exchangeable Cation Bars */
.soil-cation-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.soil-cation-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.soil-cation-label {
  font-weight: 700;
  font-size: 14px;
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.soil-cation-bar-wrap {
  flex: 1;
  min-width: 0;
}

.soil-cation-meta {
  display: flex;
  gap: 4px;
  font-size: 11px;
  color: var(--gray-700);
  margin-top: 2px;
}

.soil-cation-deficit {
  font-weight: 700;
  font-size: 13px;
  width: 52px;
  text-align: right;
  flex-shrink: 0;
}

/* Base Saturation Stacked Bar */
.soil-basesat-bar {
  display: flex;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
}

.soil-basesat-seg {
  min-width: 2px;
  transition: width 0.3s ease;
}

.soil-basesat-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.soil-basesat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.soil-basesat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* 3-column trace element grid */
.soil-detail-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ===== Pricing Matrix Table ===== */
.pricing-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.pricing-matrix-table th {
  background: var(--gray-50);
  padding: 10px 12px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}
.pricing-matrix-table th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--gray-50);
  z-index: 1;
}
.pricing-matrix-table td {
  padding: 8px 12px;
  text-align: right;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
.pricing-matrix-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: white;
  z-index: 1;
  color: var(--gray-900);
}
.pricing-matrix-table tbody tr:hover td {
  background: var(--green-light);
}
.pricing-matrix-table tbody tr:hover td:first-child {
  background: var(--green-light);
}
.pricing-cell {
  cursor: pointer;
  transition: color var(--transition-fast);
}
.pricing-cell:hover {
  color: var(--green-dark);
  font-weight: 600;
}

/* ===== Estimates & Proposals ===== */

/* Status filter tabs */
.est-status-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.est-tab {
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid var(--gray-200);
  background: white;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.est-tab.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
.est-tab-count {
  background: rgba(0,0,0,0.1);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 4px;
}
.est-tab.active .est-tab-count {
  background: rgba(255,255,255,0.25);
}

/* List cards */
.est-list-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  border-left: 4px solid transparent;
}
.est-list-card:hover { box-shadow: var(--shadow-md); }
.est-list-card:active { transform: scale(0.99); }
.est-list-card[data-status="accepted"] { border-left-color: var(--green); }
.est-list-card[data-status="sent"] { border-left-color: var(--blue); }
.est-list-card[data-status="declined"] { border-left-color: var(--red); }
.est-list-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.est-list-card-customer h4 { font-size: 15px; color: var(--gray-900); }
.est-list-card-customer p { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.est-list-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.est-monthly {
  font-size: 22px;
  font-weight: 800;
  color: var(--green-dark);
  letter-spacing: -0.02em;
}
.est-monthly small {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
}
.est-total {
  display: block;
  font-size: 12px;
  color: var(--gray-400);
}
.est-list-card-meta {
  text-align: right;
  font-size: 12px;
  color: var(--gray-400);
}
.est-list-card-meta span { display: block; }

/* Builder: Price summary (sticky) */
.est-price-summary {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  color: white;
  position: sticky;
  top: 56px;
  z-index: 10;
  box-shadow: var(--shadow-lg);
}
.est-price-monthly {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
}
.est-price-amount {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.03em;
  transition: transform 0.2s;
}
.est-price-pop { transform: scale(1.08); }
.est-price-label {
  font-size: 18px;
  font-weight: 500;
  opacity: 0.8;
}
.est-price-details {
  font-size: 14px;
  opacity: 0.7;
  margin-top: 4px;
}

/* Builder: Section cards */
.est-section .est-section-body { transition: max-height 0.3s, padding 0.3s; overflow: hidden; }
.est-section.collapsed .est-section-body { max-height: 0; padding-top: 0; padding-bottom: 0; }
.est-section.collapsed .est-toggle-icon { transform: rotate(-90deg); }
.est-section-toggle { cursor: pointer; user-select: none; }
.est-toggle-icon { transition: transform 0.2s; font-size: 14px; color: var(--gray-400); }
.est-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  font-size: 15px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.est-input:focus { border-color: var(--green); outline: none; }

/* Builder: Service toggles */
.est-service-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.2s, opacity 0.2s;
  gap: 12px;
}
.est-service-item:last-child { border-bottom: none; }
.est-service-item.excluded {
  opacity: 0.45;
  background: var(--gray-50);
}
.est-service-item.excluded .est-price-input {
  color: var(--gray-400);
}
.est-toggle-switch {
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--gray-200);
  position: relative;
  cursor: pointer;
  transition: background 0.25s;
  flex-shrink: 0;
}
.est-toggle-switch.on { background: var(--green); }
.est-toggle-knob {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.25s;
}
.est-toggle-switch.on .est-toggle-knob { transform: translateX(18px); }
.est-service-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.est-service-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
}
.est-service-type {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 2px;
}
.est-service-price { text-align: right; flex-shrink: 0; }
.est-price-input {
  width: 90px;
  padding: 8px 10px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  text-align: right;
  color: var(--gray-900);
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.est-price-input:focus { border-color: var(--green); outline: none; }
.est-service-season {
  font-size: 11px;
  color: var(--gray-400);
  text-align: right;
  margin-top: 2px;
}

/* Builder: Payment months picker */
.est-months-picker {
  display: flex;
  gap: 8px;
}
.est-month-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  background: white;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.est-month-btn.active {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green-dark);
}

/* Builder: Actions */
.est-actions { margin-top: 16px; padding-bottom: 24px; }

/* Detail: Proposal card */
.est-proposal-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--gray-100);
}
.est-proposal-customer {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid var(--gray-100);
}
.est-proposal-customer h3 { font-size: 18px; color: var(--gray-900); }
.est-proposal-customer p { font-size: 14px; color: var(--gray-500); margin-top: 4px; }
.est-proposal-price-hero {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  padding: 28px 20px;
  text-align: center;
  color: white;
}
.est-hero-monthly {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.est-hero-label {
  font-size: 16px;
  opacity: 0.8;
  margin-top: 2px;
}
.est-hero-total {
  font-size: 14px;
  opacity: 0.6;
  margin-top: 8px;
}
.est-proposal-services {
  padding: 20px;
}
.est-proposal-services h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-400);
  margin-bottom: 12px;
  font-weight: 600;
}
.est-proposal-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
}
.est-proposal-line:last-child { border-bottom: none; }
.est-proposal-line.excluded { color: var(--gray-400); text-decoration: line-through; }
.est-proposal-check { color: var(--green); font-weight: 700; margin-right: 10px; }
.est-proposal-rounds { font-size: 11px; color: var(--gray-400); margin-left: 4px; }
.est-proposal-line-price { font-weight: 600; color: var(--gray-700); }
.est-proposal-message {
  padding: 16px 20px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  font-size: 14px;
  color: var(--gray-700);
  font-style: italic;
}

/* Preview: Client-facing proposal mock */
.est-preview-container {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
  overflow: hidden;
  max-width: 480px;
  margin: 0 auto 24px;
}
.est-preview-header {
  padding: 28px 24px 20px;
  text-align: center;
  background: linear-gradient(180deg, var(--gray-50) 0%, white 100%);
}
.est-preview-header h2 {
  font-size: 20px;
  color: var(--blue);
  margin-top: 8px;
}
.est-preview-header p { font-size: 14px; color: var(--gray-700); margin-top: 4px; }
.est-preview-price {
  padding: 32px 24px;
  text-align: center;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: white;
}
.est-preview-monthly { display: flex; align-items: flex-start; justify-content: center; }
.est-preview-dollar {
  font-size: 28px;
  font-weight: 700;
  margin-top: 8px;
  opacity: 0.8;
}
.est-preview-amount {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.est-preview-period {
  font-size: 16px;
  opacity: 0.7;
  margin-top: 4px;
}
.est-preview-total {
  font-size: 14px;
  opacity: 0.5;
  margin-top: 12px;
}
.est-preview-divider {
  height: 1px;
  background: var(--gray-100);
}
.est-preview-services {
  padding: 24px;
}
.est-preview-services h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-400);
  font-weight: 600;
  margin-bottom: 16px;
}
.est-preview-service-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
  color: var(--gray-700);
}
.est-preview-service-row:last-child { border-bottom: none; }
.est-preview-message {
  margin: 0 24px 24px;
  padding: 16px;
  background: var(--green-light);
  border-radius: 8px;
  font-size: 14px;
  color: var(--green-dark);
}
.est-preview-valid {
  text-align: center;
  padding: 12px;
  font-size: 12px;
  color: var(--gray-400);
}
.est-preview-cta {
  padding: 0 24px 28px;
}
.est-preview-btn {
  background: var(--green);
  color: white;
  text-align: center;
  padding: 16px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ===== Follow-ups (client request capture) ===== */
.fu-tabs {
  display: flex;
  gap: 4px;
  padding: 0 2px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.fu-tab {
  flex: 0 0 auto;
  background: var(--gray-100);
  color: var(--gray-700);
  border: none;
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s;
}
.fu-tab:active { transform: scale(0.97); }
.fu-tab.active {
  background: var(--green);
  color: white;
  box-shadow: 0 2px 8px rgba(120, 190, 32, 0.3);
}
.fu-tab-count {
  background: rgba(0,0,0,0.1);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.fu-tab.active .fu-tab-count { background: rgba(255,255,255,0.25); }

.fu-bucket { margin-bottom: 12px; }
.fu-bucket .card-header { padding: 10px 16px; }
.fu-bucket .card-header h3 { font-size: 15px; }

.fu-row .data-row-main { cursor: pointer; }
.fu-row-done { opacity: 0.6; }

.fu-done-btn {
  background: var(--green) !important;
  color: white !important;
  font-size: 18px;
  font-weight: 700;
}
.fu-done-btn:active { transform: scale(0.9); }

.fu-segments {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.fu-seg, .fu-seg-w {
  flex: 1 1 auto;
  min-width: 80px;
  background: var(--gray-100);
  color: var(--gray-700);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.fu-seg.active, .fu-seg-w.active {
  background: #eafbd6;
  color: var(--green-dark, #2d5a0f);
  border-color: var(--green);
}
.fu-seg:active, .fu-seg-w:active { transform: scale(0.97); }

.fu-autocomplete {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.fu-autocomplete:empty {
  display: none;
}
.fu-ac-item {
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--gray-100);
}
.fu-ac-item:last-child { border-bottom: none; }
.fu-ac-item:hover, .fu-ac-item:active { background: var(--gray-50); }

/* Floating quick-capture button */
.fu-fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--bottom-nav-height, 72px) + 16px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-green, linear-gradient(135deg, var(--green), var(--green-dark)));
  color: white;
  border: none;
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  box-shadow: 0 6px 20px rgba(120, 190, 32, 0.45);
  cursor: pointer;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fu-fab:hover { transform: scale(1.08); }
.fu-fab:active { transform: scale(0.95); }

/* Dashboard follow-ups widget */
.fu-dash-widget {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 16px;
}
.fu-dash-bucket {
  background: var(--gray-50);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid transparent;
}
.fu-dash-bucket:hover {
  border-color: var(--green);
  background: white;
}
.fu-dash-bucket:active { transform: scale(0.97); }
.fu-dash-bucket-count {
  font-size: 24px;
  font-weight: 800;
  color: var(--blue);
  line-height: 1;
  margin-bottom: 4px;
}
.fu-dash-bucket-label {
  font-size: 11px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.fu-dash-bucket.today .fu-dash-bucket-count { color: var(--green-dark, #2d5a0f); }
.fu-dash-bucket.urgent .fu-dash-bucket-count { color: var(--red); }

.fu-dash-split {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
  font-size: 12px;
  color: var(--gray-600);
  justify-content: center;
}
.fu-dash-split strong { color: var(--gray-800); font-size: 13px; }
