/* AcreSprayer App Stylesheet
 * Custom CSS with Glassmorphism, Agrarian Palette, and Responsive Mobile Controls
 */

/* ==========================================================================
   1. Design System & CSS Variables
   ========================================================================== */
:root {
  /* Default: Light Theme */
  --bg-dark: #f1f5f9;
  --bg-dark-grad-start: #f8fafc;
  --bg-dark-grad-end: #e2e8f0;
  --bg-panel: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.75);
  --border-glass: rgba(0, 0, 0, 0.08);
  --border-active: rgba(16, 185, 129, 0.45);
  
  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  /* Agrarian Brand Colors */
  --color-emerald: #059669;
  --color-emerald-glow: rgba(5, 150, 105, 0.15);
  --color-emerald-dark: #047857;
  --color-amber: #d97706;
  --color-amber-glow: rgba(217, 119, 6, 0.15);
  --color-indigo: #4f46e5;
  --color-indigo-glow: rgba(79, 70, 229, 0.15);
  --color-danger: #dc2626;
  --color-danger-glow: rgba(220, 38, 38, 0.15);

  /* Theming Helpers */
  --bg-input: #ffffff;
  --bg-input-focus: #ffffff;
  --bg-header: rgba(248, 250, 252, 0.8);
  --bg-year-select: rgba(0, 0, 0, 0.04);
  --bg-progress-track: rgba(0, 0, 0, 0.05);
  --bg-dialog: rgba(255, 255, 255, 0.95);
  --bg-dialog-backdrop: rgba(15, 23, 42, 0.4);
  --bg-radio-option: #ffffff;
  --bg-stat-card: rgba(0, 0, 0, 0.02);
  --bg-timeline-card: #ffffff;
  --bg-timeline-card-hover: rgba(248, 250, 252, 0.7);
  --bg-timeline-grid: rgba(0, 0, 0, 0.03);
  --bg-timeline-empty: rgba(0, 0, 0, 0.01);
  --bg-settings-card: #ffffff;
  --bg-csv-box: rgba(0, 0, 0, 0.02);
  --bg-table-th: rgba(0, 0, 0, 0.04);
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-thumb-hover: #94a3b8;
  --text-brand-start: #0f172a;
  --text-brand-end: #059669;
  --bg-btn-secondary: rgba(0, 0, 0, 0.04);
  --bg-btn-secondary-hover: rgba(0, 0, 0, 0.08);
  --border-btn-secondary: rgba(0, 0, 0, 0.08);
  --text-btn-secondary: #475569;
  --border-btn-secondary-hover: rgba(0, 0, 0, 0.15);
  
  /* UI Layout constants */
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
  --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.12);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-display: 'Outfit', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
}

[data-theme="dark"] {
  --bg-dark: #080b11;
  --bg-dark-grad-start: #080b11;
  --bg-dark-grad-end: #0d121d;
  --bg-panel: #0f1422;
  --bg-glass: rgba(15, 20, 34, 0.65);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-active: rgba(16, 185, 129, 0.4);
  
  /* Text */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Agrarian Brand Colors */
  --color-emerald: #10b981;
  --color-emerald-glow: rgba(16, 185, 129, 0.25);
  --color-emerald-dark: #047857;
  --color-amber: #f59e0b;
  --color-amber-glow: rgba(245, 158, 11, 0.2);
  --color-indigo: #6366f1;
  --color-indigo-glow: rgba(99, 102, 241, 0.25);
  --color-danger: #ef4444;
  --color-danger-glow: rgba(239, 68, 68, 0.2);

  /* Theming Helpers */
  --bg-input: rgba(0, 0, 0, 0.3);
  --bg-input-focus: rgba(0, 0, 0, 0.5);
  --bg-header: rgba(13, 18, 29, 0.75);
  --bg-year-select: rgba(0, 0, 0, 0.3);
  --bg-progress-track: rgba(255, 255, 255, 0.05);
  --bg-dialog: rgba(13, 18, 30, 0.85);
  --bg-dialog-backdrop: rgba(4, 6, 10, 0.85);
  --bg-radio-option: rgba(255, 255, 255, 0.02);
  --bg-stat-card: rgba(0, 0, 0, 0.2);
  --bg-timeline-card: rgba(255, 255, 255, 0.02);
  --bg-timeline-card-hover: rgba(255, 255, 255, 0.04);
  --bg-timeline-grid: rgba(0, 0, 0, 0.15);
  --bg-timeline-empty: rgba(255, 255, 255, 0.01);
  --bg-settings-card: rgba(255, 255, 255, 0.01);
  --bg-csv-box: rgba(0, 0, 0, 0.25);
  --bg-table-th: rgba(0, 0, 0, 0.4);
  --scrollbar-thumb: #1e293b;
  --scrollbar-thumb-hover: #334155;
  --text-brand-start: #ffffff;
  --text-brand-end: #10b981;
  --bg-btn-secondary: rgba(30, 41, 59, 0.6);
  --bg-btn-secondary-hover: rgba(51, 65, 85, 0.75);
  --border-btn-secondary: var(--border-glass);
  --text-btn-secondary: var(--text-primary);
  --border-btn-secondary-hover: rgba(255, 255, 255, 0.15);
  
  /* UI Layout constants overrides for dark mode depth */
  --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   2. Reset & Core Elements
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 10% 10%, rgba(16, 185, 129, 0.04) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(99, 102, 241, 0.04) 0px, transparent 50%),
    linear-gradient(180deg, var(--bg-dark-grad-start) 0%, var(--bg-dark-grad-end) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--bg-dark);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* ==========================================================================
   3. Accessible Typography & Buttons
   ========================================================================== */
.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

button:focus-visible, 
input:focus-visible, 
select:focus-visible, 
textarea:focus-visible {
  outline: 3px solid var(--color-emerald);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--border-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  min-height: 48px; /* Touch target minimum */
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--color-emerald);
  color: #042f20;
  box-shadow: 0 4px 14px var(--color-emerald-glow);
}
.btn-primary:hover {
  background-color: #34d399;
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
}

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

.btn-danger {
  background-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.35);
  color: #ffffff;
}

.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.btn-loading {
  pointer-events: none;
  opacity: 0.85;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--border-radius-md);
}

.btn-dialog-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.btn-dialog-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* ==========================================================================
   4. Header & Navigation Structure
   ========================================================================== */
.app-header {
  border-bottom: 1px solid var(--border-glass);
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.brand-icon {
  color: var(--color-emerald);
  filter: drop-shadow(0 0 8px var(--color-emerald-glow));
}
.brand h1 {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-brand-start) 40%, var(--text-brand-end) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.year-selector-container {
  display: flex;
  align-items: center;
  background: var(--bg-year-select);
  padding: 2px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-glass);
  height: 44px;
  box-sizing: border-box;
}
.year-selector-container #btn-add-year {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: var(--border-radius-sm);
}
.year-dropdown {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  padding: 0 12px;
  outline: none;
  cursor: pointer;
  height: 38px;
  min-height: unset;
}
.year-dropdown option {
  background-color: var(--bg-panel);
  color: var(--text-primary);
}
.header-controls .btn {
  height: 44px;
  min-height: 44px;
  padding: 0 1.25rem;
  box-sizing: border-box;
}
.header-controls .btn-icon {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
}

/* Farm Summary Banner */
.farm-summary-panel {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 2.5rem;
  width: 100%;
}

.summary-metric {
  display: flex;
  flex-direction: column;
}
.metric-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 2px;
}
.metric-value {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}
.phase-badge {
  color: var(--color-emerald);
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.summary-progress-container {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform var(--transition-fast), filter var(--transition-fast);
}
.summary-progress-container:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}
.click-prompt {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: none;
  font-weight: normal;
  margin-left: 6px;
  opacity: 0.7;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}
.summary-progress-container:hover .click-prompt {
  opacity: 1;
  color: var(--color-emerald);
}
.summary-progress-container .metric-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.progress-percent {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-emerald);
}

/* Base Progress Bar */
.progress-bar-track {
  height: 8px;
  background: var(--bg-progress-track);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
  transition: width 0.4s cubic-bezier(0.1, 0.8, 0.25, 1);
}

/* Phase Tab Switcher */
.phase-navigation {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  gap: 8px;
  border-top: 1px solid var(--border-glass);
}
.phase-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 1rem 0.5rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}
.phase-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}
.phase-tab.active {
  color: var(--color-emerald);
  border-bottom-color: var(--color-emerald);
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}
.tab-number {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.75rem;
  transition: all var(--transition-fast);
}
.phase-tab.active .tab-number {
  background: var(--color-emerald-glow);
  border-color: var(--color-emerald);
  color: var(--color-emerald);
}

/* ==========================================================================
   5. Dashboard Grid & Cards
   ========================================================================== */
.dashboard-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.search-box {
  flex: 1;
  max-width: 450px;
}
.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border-radius: var(--border-radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  min-height: 48px;
}
.search-box input:focus {
  border-color: var(--color-emerald);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 1px var(--color-emerald);
  outline: none;
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

/* Elegant Field Cards */
.field-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}
.field-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-active);
  box-shadow: var(--shadow-md), 0 0 15px rgba(16, 185, 129, 0.08);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.field-meta h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}
.field-crop-tag {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-emerald);
  border: 1px solid rgba(16, 185, 129, 0.15);
}
.field-crop-tag.blank {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border-color: var(--border-glass);
  font-style: italic;
}

.field-size-badge {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 4px 10px;
  border-radius: 20px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.card-progress-section {
  margin: 1.25rem 0;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
}
.progress-val-text {
  color: var(--text-secondary);
}
.progress-val-pct {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
}

/* Card Progress Bar styling based on status */
.progress-bar-track.card-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.progress-bar-fill.not-started {
  background: transparent;
  width: 0% !important;
}
.progress-bar-fill.partial {
  background: linear-gradient(90deg, var(--color-amber) 0%, #fbbf24 100%);
  box-shadow: 0 0 6px var(--color-amber-glow);
}
.progress-bar-fill.complete {
  background: linear-gradient(90deg, var(--color-emerald) 0%, #34d399 100%);
  box-shadow: 0 0 6px var(--color-emerald-glow);
}

/* OVER-SPRAYING STRIPES ANIMATION */
.progress-bar-fill.oversprayed {
  background-color: var(--color-indigo);
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255, 255, 255, 0.2) 10px,
    rgba(255, 255, 255, 0.2) 20px
  );
  box-shadow: 0 0 8px var(--color-indigo-glow);
  animation: progress-bar-stripes 2s linear infinite;
}

@keyframes progress-bar-stripes {
  0% { background-position: 0 0; }
  100% { background-position: 40px 0; }
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  border-top: 1px solid var(--border-glass);
  padding-top: 1rem;
}
.card-actions .btn {
  flex: 1;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  min-height: 40px;
}

/* Card Badge Statuses */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px solid transparent;
}
.badge-not-started {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  border-color: var(--border-glass);
}
.badge-partial {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-amber);
  border-color: rgba(245, 158, 11, 0.2);
}
.badge-complete {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-emerald);
  border-color: rgba(16, 185, 129, 0.2);
}
.badge-oversprayed {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.25);
}

/* Empty State Styling */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-glass);
  border: 1px dashed var(--border-glass);
  border-radius: var(--border-radius-lg);
  backdrop-filter: blur(10px);
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.1));
}
.empty-state h3 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}
.empty-state p {
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto 1.5rem auto;
}
.empty-state-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==========================================================================
   6. Modern Dialog Popups (Glassmorphism Modal)
   ========================================================================== */
.glass-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  border: 1px solid var(--border-glass);
  background: var(--bg-dialog);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  color: var(--text-primary);
  border-radius: var(--border-radius-lg);
  padding: 1.75rem;
  max-width: 550px;
  width: 90%;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.5);
  outline: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.glass-dialog[open] {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.glass-dialog.dialog-large {
  max-width: 750px;
}

.glass-dialog::backdrop {
  background: var(--bg-dialog-backdrop);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: backdrop-filter 0.25s ease;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.75rem;
}
.dialog-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}
.dialog-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 2px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 2rem;
  border-top: 1px solid var(--border-glass);
  padding-top: 1.25rem;
}
.dialog-actions.justify-between {
  justify-content: space-between;
}
.dialog-actions .right-actions {
  display: flex;
  gap: 12px;
}

/* ==========================================================================
   7. Premium Form Layouts & Inputs
   ========================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.colspan-2 {
  grid-column: span 2;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Input Fields Custom Design */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  min-height: 48px;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-emerald);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 1px var(--color-emerald);
}

/* Inputs with suffixes (like 'acres', 'km/h') */
.input-suffix-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.input-suffix-wrapper input {
  padding-right: 4.5rem; /* space for suffix text */
}
.input-suffix {
  position: absolute;
  right: 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

.form-help {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.form-help.warning {
  color: var(--color-amber);
}

/* Field info banner inside Job dialog */
.field-info-summary {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  padding: 0.85rem 1.25rem;
  border-radius: var(--border-radius-md);
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.9rem;
}
.info-label {
  color: var(--text-secondary);
  font-weight: 500;
}
.info-value {
  color: var(--text-primary);
  font-weight: 700;
}

/* Elegant Dual Input Method Toggles (Custom card selectors) */
.input-method-fieldset {
  border: none;
  margin-bottom: 1.5rem;
}
.input-method-legend {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.radio-option {
  position: relative;
}
.radio-option input[type="radio"] {
  position: absolute;
  top: 15px;
  right: 15px;
  accent-color: var(--color-emerald);
  width: 1.1rem;
  height: 1.1rem;
  z-index: 2;
}

.radio-option label {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background: var(--bg-radio-option);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  height: 100%;
}
.radio-option label strong {
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.radio-option label span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Glow when active */
.radio-option input[type="radio"]:checked + label {
  background: rgba(16, 185, 129, 0.08);
  border-color: var(--color-emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.08);
}

/* ==========================================================================
   8. History Timeline & Details
   ========================================================================== */
.history-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.history-stats .stat-card {
  background: var(--bg-stat-card);
  border: 1px solid var(--border-glass);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-md);
  display: flex;
  flex-direction: column;
  text-align: center;
}
.history-stats .stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.history-stats .stat-val {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}
.history-stats .badge {
  margin: 4px auto 0 auto;
}

/* Timeline Cards */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 5px;
}

.timeline-card {
  position: relative;
  background: var(--bg-timeline-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all var(--transition-fast);
}
.timeline-card:hover {
  background: var(--bg-timeline-card-hover);
  border-color: var(--border-active);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.timeline-title {
  display: flex;
  flex-direction: column;
}
.timeline-title strong {
  font-size: 1.1rem;
  color: var(--color-emerald);
  font-family: var(--font-display);
}
.timeline-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Timeline grid parameters */
.timeline-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  background: var(--bg-timeline-grid);
  padding: 0.75rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
}
.timeline-item {
  display: flex;
  flex-direction: column;
}
.timeline-item span {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}
.timeline-item strong {
  color: var(--text-primary);
  font-weight: 600;
}

.timeline-notes {
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-left: 2px solid var(--border-glass);
  padding-left: 8px;
}

.timeline-empty {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-secondary);
  font-style: italic;
  background: var(--bg-timeline-empty);
  border: 1px dashed var(--border-glass);
  border-radius: var(--border-radius-md);
}

/* ==========================================================================
   9. Settings Content & CSV Previews
   ========================================================================== */
.settings-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.firebase-info-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 1.25rem;
  border-radius: var(--border-radius-lg);
}
.firebase-info-card .card-icon {
  font-size: 1.75rem;
  line-height: 1;
}
.firebase-info-card h3 {
  color: #c7d2fe;
  margin-bottom: 4px;
}
.firebase-info-card p {
  font-size: 0.85rem;
  color: #a5b4fc;
}
.future-note {
  margin-top: 6px;
  font-weight: 500;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.settings-card {
  background: var(--bg-settings-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.settings-card h3 {
  font-size: 1.15rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 6px;
}
.settings-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.csv-template-box {
  background: var(--bg-csv-box);
  border: 1px solid var(--border-glass);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
}
.csv-template-box code {
  color: var(--color-amber);
  font-weight: 600;
  background: rgba(245, 158, 11, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  align-self: flex-start;
  font-family: monospace;
}
.template-link {
  color: var(--color-emerald);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  margin-top: 4px;
  align-self: flex-start;
}
.template-link:hover {
  text-decoration: underline;
}

.file-upload-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.btn-full {
  width: 100%;
}
.file-selected-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

/* CSV Table Importer Preview */
.csv-preview-container {
  border: 1px solid var(--border-active);
  background: rgba(16, 185, 129, 0.02);
  border-radius: var(--border-radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: fade-in 0.3s ease;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.csv-preview-container h4 {
  font-size: 0.9rem;
  color: var(--color-emerald);
}

.csv-table-wrapper {
  max-height: 180px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-sm);
}
#csv-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}
#csv-preview-table th, 
#csv-preview-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-glass);
}
#csv-preview-table th {
  background: var(--bg-table-th);
  color: var(--text-secondary);
  font-weight: 600;
  position: sticky;
  top: 0;
}
#csv-preview-table tr:last-child td {
  border-bottom: none;
}

.csv-preview-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.btn-sm {
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.backup-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Dialog Bullet Lists */
.dialog-bullet-list {
  padding-left: 20px;
  margin: 0.75rem 0 1.25rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.dialog-bullet-list li {
  margin-bottom: 6px;
}

/* Helper Utilities */
.hidden {
  display: none !important;
}
.justify-between {
  justify-content: space-between;
}

/* Status indicator dot in footer */
.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-indicator.online {
  background-color: var(--color-emerald);
  box-shadow: 0 0 6px var(--color-emerald);
}
.status-text {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

/* ==========================================================================
   10. Layout Responsiveness & Desktop Styles
   ========================================================================== */
.app-footer {
  border-top: 1px solid var(--border-glass);
  padding: 1.5rem;
  text-align: center;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .farm-summary-panel {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
  .summary-progress-container {
    grid-column: span 2;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .app-header {
    position: static;
  }
  .header-top {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 0.75rem 1rem;
  }
  .brand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }
  .brand h1 {
    font-size: 1.25rem;
  }
  .brand-icon {
    width: 24px;
    height: 24px;
  }
  .header-farm-badge {
    background: transparent;
    border: none;
    padding: 0;
    font-size: 0.95rem;
    max-width: 140px;
  }
  .header-controls {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
  }
  .year-selector-container {
    margin-right: auto;
  }
  .year-dropdown {
    font-size: 0.95rem;
    padding: 0 8px;
  }
  #btn-add-year {
    display: none;
  }
  #btn-open-settings, #btn-sign-out {
    padding: 0;
    width: 44px;
    height: 44px;
    justify-content: center;
    flex-shrink: 0;
  }
  .btn-theme-toggle {
    width: 44px;
    height: 44px;
  }
  .btn-text {
    display: none;
  }
  .user-email-display {
    display: none !important;
  }
  .farm-summary-panel {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
  }
  .summary-metric {
    flex-direction: column;
    align-items: flex-start;
  }
  .metric-label {
    font-size: 0.7rem;
  }
  .metric-value {
    font-size: 1.1rem;
  }
  .summary-progress-container {
    grid-column: span 2;
    margin-top: 2px;
  }
  .summary-progress-container .metric-header {
    margin-bottom: 4px;
  }
  .click-prompt {
    display: none;
  }
  .progress-percent {
    font-size: 0.95rem;
  }
  .progress-bar-track {
    height: 6px;
  }
  .phase-navigation {
    flex-direction: row;
    gap: 8px;
    padding: 0 1rem;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .phase-navigation::-webkit-scrollbar {
    display: none;
  }
  .phase-tab {
    flex: 0 0 auto;
    padding: 0.75rem 0.25rem;
    border-bottom: 2px solid transparent;
    border-left: none;
    font-size: 0.85rem;
    justify-content: center;
  }
  .phase-tab.active {
    border-bottom-color: var(--color-emerald);
    border-left-color: transparent;
  }
  .tab-number {
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
  }
  
  .dashboard-main {
    padding: 1.5rem 1rem;
  }
  .action-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box {
    max-width: 100%;
  }
  
  .fields-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  .colspan-2 {
    grid-column: span 1;
  }
  .radio-group {
    grid-template-columns: 1fr;
  }
  .history-stats {
    grid-template-columns: 1fr 1fr;
  }
  .dialog-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .dialog-actions .right-actions {
    flex-direction: column-reverse;
  }
  .dialog-actions .btn {
    width: 100%;
  }
  .backup-actions {
    grid-template-columns: 1fr;
  }
  .app-footer {
    padding: 1rem;
    justify-content: center;
  }
}

/* ==========================================================================
   11. Theme Switcher Styles
   ========================================================================== */
.btn-theme-toggle {
  background: var(--bg-btn-secondary);
  border: 1px solid var(--border-btn-secondary);
  color: var(--text-btn-secondary);
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.btn-theme-toggle:hover {
  background: var(--bg-btn-secondary-hover);
  color: var(--text-primary);
  border-color: var(--border-active);
}
.btn-theme-toggle svg {
  transition: transform var(--transition-normal);
}
.btn-theme-toggle:hover svg {
  transform: rotate(15deg);
}

/* SVG Visibility depending on theme */
[data-theme="dark"] .theme-icon-sun {
  display: block;
}
[data-theme="dark"] .theme-icon-moon {
  display: none;
}
.theme-icon-sun {
  display: none;
}
.theme-icon-moon {
  display: block;
}

/* ==========================================================================
   12. Authentication and App Lockdown Styles
   ========================================================================== */

/* Farm name display in header */
.header-farm-badge {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-emerald);
  background: transparent;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* User email display in header */
.user-email-display {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-secondary);
  background: var(--bg-year-select);
  border: 1px solid var(--border-glass);
  padding: 0 12px;
  border-radius: var(--border-radius-md);
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  height: 44px;
  min-height: 44px;
  box-sizing: border-box;
}

/* User logged out state overlay */
body.logged-out .app-header,
body.logged-out .dashboard-main,
body.logged-out .app-footer {
  filter: blur(4px);
  pointer-events: none;
}

/* Inert elements visual indication */
[inert] {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
  user-select: none;
}

/* Auth Dialog Headers */
.auth-brand {
  margin-bottom: 4px;
}
.auth-header {
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 1.5rem;
}

/* Tab Navigation inside Auth Modal */
.auth-tabs {
  display: flex;
  background: var(--bg-year-select);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 4px;
  margin-bottom: 1.5rem;
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 0.5rem;
  cursor: pointer;
  border-radius: 8px;
  transition: all var(--transition-fast);
  text-align: center;
}
.auth-tab:hover {
  color: var(--text-primary);
}
.auth-tab.active {
  background: var(--color-emerald);
  color: #042f20;
  box-shadow: var(--shadow-sm);
}

/* Submit button full width helper */
.btn-full {
  width: 100%;
}

/* Error Banner in Auth Dialog */
.auth-error-banner {
  background: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(220, 38, 38, 0.3);
  padding: 10px 14px;
  border-radius: var(--border-radius-md);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}
.auth-error-banner.hidden {
  display: none;
}
.auth-error-banner .error-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Glass Dialog Max-Height & Scroll fixes */
.glass-dialog {
  max-height: 90vh;
  overflow-y: auto;
}

/* Header Role Badge */
.header-role-badge {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
  border: 1px solid transparent;
}
.header-role-badge.role-admin {
  background: var(--color-emerald-glow);
  color: var(--color-emerald);
  border-color: rgba(16, 185, 129, 0.2);
}
.header-role-badge.role-operator {
  background: var(--color-indigo-glow);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.25);
}
.header-role-badge.role-viewer {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border-color: var(--border-glass);
}

/* Farm Profile Naming Panel */
.farm-profile-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 1.5rem;
}
.farm-profile-details {
  flex: 1;
}
.farm-name-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.farm-name-wrapper h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}
.farm-name-wrapper input {
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  outline: none;
}
.farm-name-wrapper input:focus {
  border-color: var(--color-emerald);
}

.farm-unit-wrapper {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.farm-unit-wrapper label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.farm-unit-wrapper select {
  width: auto;
  min-width: 140px;
  padding: 6px 12px;
  font-size: 0.9rem;
}


/* Section dividers inside Settings Dialog */
.settings-section-divider {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-emerald);
  margin: 2rem 0 1rem 0;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--color-emerald-glow);
}

/* Collaborators Grid overrides */
.settings-grid.farm-collab-grid {
  grid-template-columns: 1fr;
  margin-bottom: 1rem;
}

#invite-form {
  display: grid;
  grid-template-columns: 2fr 1fr auto;
  gap: 1.25rem;
  align-items: flex-end;
}

@media (max-width: 650px) {
  #invite-form {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Members Table styling */
.members-table-wrapper {
  overflow-x: auto;
  margin-top: 1rem;
  background: var(--bg-timeline-grid);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-glass);
}
#members-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
#members-table th, #members-table td {
  padding: 10px 14px;
  text-align: left;
}
#members-table th {
  background: var(--bg-table-th);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 600;
}
#members-table td {
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-primary);
}
#members-table tr:last-child td {
  border-bottom: none;
}
#members-table td .btn {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 0.8rem;
}
#members-table td select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  padding: 4px;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
}

/* Pending invites section */
.pending-invites-section {
  margin-top: 1.5rem;
  border-top: 1px dashed var(--border-glass);
  padding-top: 1.25rem;
}
.pending-invites-section h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}
.pending-invites-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pending-invite-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-timeline-card);
  border: 1px solid var(--border-glass);
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
}
.invite-info {
  display: flex;
  flex-direction: column;
}
.invite-email {
  font-weight: 600;
  color: var(--text-primary);
}
.invite-role-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.pending-invite-item .btn {
  min-height: 28px;
  padding: 2px 8px;
  font-size: 0.75rem;
}
.text-right {
  text-align: right !important;
}

/* ==========================================================================
   13. Fullscreen Glassmorphic Loading Screen
   ========================================================================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  background: var(--bg-dark);
  background-image: 
    radial-gradient(at 10% 10%, rgba(16, 185, 129, 0.04) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(99, 102, 241, 0.04) 0px, transparent 50%),
    linear-gradient(180deg, var(--bg-dark-grad-start) 0%, var(--bg-dark-grad-end) 100%);
  background-attachment: fixed;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

/* Blur overlay when hidden */
.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2.5rem;
  border-radius: var(--border-radius-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-lg);
  max-width: 380px;
  width: 90%;
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.loading-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-emerald);
  animation: logo-pulse 2s ease-in-out infinite;
}

.loading-logo svg {
  filter: drop-shadow(0 0 8px var(--color-emerald-glow));
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3.5px solid rgba(16, 185, 129, 0.12);
  border-top: 3.5px solid var(--color-emerald);
  border-radius: 50%;
  animation: spin 0.9s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.05);
}

.loading-text {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  margin-top: 0.25rem;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--color-emerald) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes logo-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.95;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

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

/* Crop Progress Dialog Custom Styles */
.crop-progress-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: 450px;
  overflow-y: auto;
  padding-right: 6px;
  margin-top: 1rem;
}
.crop-progress-item {
  background: var(--bg-stat-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all var(--transition-fast);
}
.crop-progress-item:hover {
  background: var(--bg-timeline-card-hover);
  border-color: var(--border-active);
}
.crop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.crop-name-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.crop-name-tag {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.crop-acres-details {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.crop-fields-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.crop-field-pill {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.crop-field-pill:hover {
  background: rgba(16, 185, 129, 0.08);
  border-color: var(--color-emerald);
  color: var(--color-emerald);
  transform: translateY(-1px);
}
