:root, html, body {
  --bg-color: #F2F2F7; 
  --surface-color: #FFFFFF; 
  --surface-solid: #FFFFFF;
  --text-color: #1C1C1E;
  --text-muted: #52525b;
  --border-color: rgba(60, 60, 67, 0.12); 
  --primary: #248a3d; 
  --primary-hover: #1b6837;
  --glass-blur: blur(20px) saturate(180%);
  --card-radius: 16px;
  --shadow-apple: 0 2px 12px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
}

[data-theme="dark"], html[data-theme="dark"], body[data-theme="dark"] {
  --bg-color: #000000 !important;
  --surface-color: #1C1C1E !important;
  --surface-solid: #1C1C1E !important;
  --text-color: #FFFFFF !important;
  --text-muted: #a1a1aa !important;
  --border-color: rgba(84, 84, 88, 0.28) !important;
  --primary: #30D158 !important;
  --shadow-apple: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
}

html {
  font-size: 90% !important; 
  -webkit-text-size-adjust: 100% !important; 
  text-size-adjust: 100% !important;
}

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", sans-serif !important; 
  -webkit-tap-highlight-color: transparent !important;
  }
:focus-visible {
  outline: 2px solid var(--primary) !important;
  outline-offset: 2px !important;
}

/* HABILITACIÓN TÁCTIL UNIVERSAL PARA TODOS LOS BOTONES */
button, a, input, select, textarea, [role="button"], .btn, .nav-btn, .bottom-nav-item, .user-profile, .hamburger-btn, .close-btn, .topbar-version-btn {
  touch-action: manipulation !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  -webkit-tap-highlight-color: transparent !important;
}

body, html { 
  -webkit-font-smoothing: antialiased !important; 
  -moz-osx-font-smoothing: grayscale !important; 
  background-color: var(--bg-color) !important; 
  color: var(--text-color) !important; 
  overflow-x: hidden; 
  min-height: 100%;
  min-height: 100dvh;
}

i[class*="ph-"], i.ph {
  margin-right: 8px !important;
  vertical-align: -0.12em !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.nav-icon-badge i, 
.metric-icon i, 
.avatar i, 
.sidebar-close-btn i, 
.close-btn i, 
.hamburger-btn i,
.bottom-nav-item i,
.profile-photo-circle i,
.topbar-version-btn i {
  margin-right: 0 !important;
  vertical-align: middle !important;
}

h1, h2, h3, h4 { color: var(--text-color) !important; font-weight: 700; }
.page-title { letter-spacing: -0.02em; margin-bottom: 1.25rem; font-size: 1.55rem; font-weight: 800; }

#app { 
  height: 100vh; 
  height: 100dvh; 
  display: flex; 
  width: 100vw;
  overflow: hidden;
  position: relative;
}

.sidebar {
  background: var(--surface-color) !important; 
  backdrop-filter: var(--glass-blur); 
  -webkit-backdrop-filter: var(--glass-blur); 
  border-right: 0.5px solid var(--border-color) !important; 
  z-index: 1000; 
  flex-direction: column; 
  flex-shrink: 0; 
  width: 290px; 
  padding: calc(1.25rem + env(safe-area-inset-top, 0px)) 0.85rem 1.25rem 0.85rem; 
  display: flex;
}
.sidebar-close-btn { color: var(--text-muted); cursor: pointer; border-radius: 12px; background: 0 0; border: none; padding: .25rem; font-size: 1.4rem; display: none; }
.sidebar-header { justify-content: space-between; align-items: center; margin-bottom: 1.25rem; padding: 0 0.4rem; display: flex; }

.logo {
  display: flex !important;
  align-items: center !important;
  font-size: 1.35rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
  user-select: none !important;
  text-decoration: none !important;
  color: var(--text-color) !important;
}
.logo i {
  color: #30D158 !important;
  font-size: 1.85rem !important;
  flex-shrink: 0 !important;
  margin-right: 12px !important;
}
.logo span {
  color: #000000 !important;
  font-weight: 800 !important;
}
[data-theme="dark"] .logo span {
  color: #FFFFFF !important;
}

.sidebar-nav {
  flex-direction: column;
  flex-grow: 1;
  gap: 0.15rem;
  display: flex;
  overflow-y: auto;
  padding-right: 2px;
}

.nav-section-group { margin-bottom: 0.6rem; }
.nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted) !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0.5rem 0 0.25rem 0;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.nav-section-title:hover {
  background-color: rgba(118, 118, 128, 0.08);
  color: var(--text-color) !important;
}
.nav-caret {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  margin-right: 0 !important;
}
.nav-section-items {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-left: 0.1rem;
  transition: all 0.25s ease;
}
.nav-section-items.collapsed {
  display: none !important;
}
.nav-section-title.collapsed .nav-caret {
  transform: rotate(-90deg);
}

.nav-btn {
  color: var(--text-color) !important;
  border-radius: 12px !important;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
  text-align: left;
  background: transparent;
  border: none;
  align-items: center;
  padding: 0.5rem 0.65rem !important;
  font-size: 0.9rem !important;
  font-weight: 500;
  display: flex;
  width: 100%;
}
.nav-btn:hover {
  background-color: rgba(118, 118, 128, 0.08) !important;
}
.nav-btn.active {
  background-color: var(--primary) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(36, 138, 61, 0.3);
}
.nav-btn.active .nav-icon-badge {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}

.nav-icon-badge {
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.15rem !important;
  flex-shrink: 0 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15) !important;
  margin-right: 12px !important;
}

.badge-glob   { background: linear-gradient(135deg, #248a3d, #166534) !important; }
.badge-art    { background: linear-gradient(135deg, #16a34a, #15803d) !important; }
.badge-ind    { background: linear-gradient(135deg, #0284c7, #0369a1) !important; }
.badge-lab    { background: linear-gradient(135deg, #8b5cf6, #6d28d9) !important; }
.badge-inv    { background: linear-gradient(135deg, #db2777, #9d174d) !important; }
.badge-tea    { background: linear-gradient(135deg, #ea580c, #c2410c) !important; }
.badge-sales  { background: linear-gradient(135deg, #0d9488, #0f766e) !important; }
.badge-fin    { background: linear-gradient(135deg, #059669, #047857) !important; }
.badge-usr    { background: linear-gradient(135deg, #7c3aed, #5b21b6) !important; }
.badge-junior { background: linear-gradient(135deg, #f59e0b, #ec4899) !important; }
.badge-help   { background: linear-gradient(135deg, #64748b, #475569) !important; }

.sidebar-footer { border-top: 0.5px solid var(--border-color); margin-top: auto; padding-top: 0.75rem; }

/* OVERLAY CON ANULACIÓN FÍSICA CUANDO INACTIVO */
.sidebar-overlay { 
  position: fixed !important; 
  top: 0; 
  left: 0; 
  width: 0 !important; 
  height: 0 !important; 
  background: rgba(0,0,0,0.5); 
  z-index: 950; 
  opacity: 0; 
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important; 
}
.sidebar-overlay.active { 
  display: block !important;
  visibility: visible !important;
  pointer-events: auto !important; 
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  opacity: 1 !important;
}

.main-content { 
  flex-direction: column; 
  flex-grow: 1; 
  display: flex; 
  overflow-y: auto; 
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.topbar {
  background: var(--surface-color) !important; 
  border-bottom: 0.5px solid var(--border-color) !important; 
  z-index: 50; 
  justify-content: space-between; 
  align-items: center; 
  height: calc(60px + env(safe-area-inset-top, 0px)); 
  padding: env(safe-area-inset-top, 0px) 1.5rem 0 1.5rem; 
  display: flex; 
  position: sticky; 
  top: 0;
  flex-shrink: 0;
}
.topbar-version-btn {
  background: rgba(118, 118, 128, 0.1);
  border: none;
  border-radius: 8px;
  padding: 4px 8px;
  color: var(--text-color);
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}

.user-profile, #user-profile-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  cursor: pointer !important;
  padding: 4px 6px !important;
  border-radius: 24px !important;
  background: transparent !important;
  border: none !important;
  min-height: 44px !important;
  min-width: 44px !important;
  touch-action: manipulation !important;
  user-select: none !important;
}
.user-profile:active, #user-profile-btn:active {
  transform: scale(0.96) !important;
  opacity: 0.85 !important;
}

.avatar {
  background: #248a3d !important;
  color: #ffffff !important;
  border-radius: 50%;
  font-weight: 700;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  cursor: pointer !important;
}

.hamburger-btn { 
  background: transparent; 
  border: none; 
  color: var(--text-color); 
  width: 44px; 
  height: 44px; 
  font-size: 1.7rem; 
  cursor: pointer; 
  display: none; 
  align-items: center; 
  justify-content: center; 
  border-radius: 12px; 
}

.views-container { 
  padding: 1.5rem; 
  padding-bottom: 120px; 
  position: relative; 
  width: 100%;
}
.view { display: none; }
.view.active { display: block; }

.glass { 
  background: var(--surface-color) !important; 
  border: 0.5px solid var(--border-color) !important; 
  border-radius: var(--card-radius) !important; 
  box-shadow: var(--shadow-apple); 
}

.metrics-grid { 
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); 
  gap: 1rem; 
  margin-bottom: 1.5rem; 
  display: grid; 
}
.metric-card { 
  align-items: center; 
  gap: 0.85rem; 
  padding: 1rem 1.15rem; 
  display: flex; 
  border-radius: 16px !important;
}
.metric-icon { 
  border-radius: 12px; 
  justify-content: center; 
  align-items: center; 
  width: 44px; 
  height: 44px; 
  font-size: 1.4rem; 
  display: flex; 
  flex-shrink: 0;
}
.harvest-icon { color: #22c55e; background: rgba(34, 197, 94, 0.12); }
.tea-icon { color: #eab308; background: rgba(234, 179, 8, 0.12); }
.revenue-icon { color: #3b82f6; background: rgba(59, 130, 246, 0.12); }
.workers-icon { color: #a855f7; background: rgba(168, 85, 247, 0.12); }
.metric-info h3 { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 700; margin-bottom: 2px; }
.metric-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.unit { color: var(--text-muted); font-size: .85rem; font-weight: 500; }

.charts-section { grid-template-columns: 2fr 1fr; gap: 1.25rem; display: grid; }
.chart-card { padding: 1.25rem; }

.top-list { flex-direction: column; gap: 0.6rem; list-style: none; display: flex; margin-top: 0.85rem; }
.top-list li { border-bottom: 0.5px solid var(--border-color); justify-content: space-between; align-items: center; padding-bottom: 0.5rem; display: flex; font-size: 0.9rem; }
.top-list li.empty-state { color: var(--text-muted); border: none; justify-content: center; padding: 1.5rem 0; font-style: italic; }
.rank-num { font-weight: 800; color: var(--text-muted); margin-right: 0.6rem; display: inline-block; min-width: 24px; }

.btn { 
  border-radius: 12px !important; 
  font-weight: 600 !important; 
  letter-spacing: -0.01em !important; 
  border: none !important; 
  cursor: pointer; 
  justify-content: center; 
  align-items: center; 
  gap: 0.4rem; 
  padding: 0.55rem 1.1rem; 
  font-size: 0.88rem; 
  display: inline-flex; 
}
.btn:active { transform: scale(0.97) !important; opacity: 0.8 !important; }
.btn-primary { background-color: var(--primary) !important; color: #ffffff !important; }
.btn-secondary { background: rgba(118, 118, 128, 0.1) !important; color: var(--text-color) !important; }
.btn-secondary.active-mode { background-color: var(--primary) !important; color: #fff !important; }
.w-full { width: 100%; }

.view-header { justify-content: space-between; align-items: center; margin-bottom: 1.25rem; display: flex; flex-wrap: wrap; gap: 10px; }

.segmented-control {
  display: inline-flex;
  background: rgba(118, 118, 128, 0.1);
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
  user-select: none;
  max-width: 100%;
  overflow-x: auto;
}
.segmented-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.segmented-btn:hover { color: var(--text-color); }
.segmented-btn.active-mode {
  background: var(--surface-solid);
  color: var(--text-color);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.table-container { padding: 0 !important; border-radius: var(--card-radius) !important; overflow-x: auto !important; width: 100% !important; }
.data-table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
.data-table th { color: var(--text-muted) !important; font-weight: 600 !important; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 0.5px solid var(--border-color) !important; padding: 0.85rem 1rem; text-align: left; }
.data-table td { border-bottom: 0.5px solid var(--border-color) !important; font-weight: 400 !important; padding: 0.85rem 1rem; text-align: left; }
.data-table tr:last-child td { border-bottom: none !important; }

.form-group { margin-bottom: 1.15rem; }
.form-group label { margin-bottom: 0.4rem; font-size: 0.85rem; font-weight: 600; color: var(--text-color); display: block; }
input, select, textarea { background-color: rgba(118, 118, 128, 0.08) !important; border: 0.5px solid var(--border-color) !important; border-radius: 10px !important; padding: 10px 14px !important; color: var(--text-color) !important; font-family: inherit !important; font-size: 15px !important; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--primary) !important; background-color: var(--surface-solid) !important; }

.badge { font-weight: 700 !important; border-radius: 6px !important; padding: 3px 8px !important; border: 1px solid transparent !important; font-size: 0.76rem !important; display: inline-flex !important; align-items: center !important; gap: 4px !important; letter-spacing: 0.01em !important; }
.badge-active { color: #15803d !important; background-color: rgba(22, 163, 74, 0.12) !important; border-color: rgba(22, 163, 74, 0.28) !important; }
.badge-pending { color: #9a3412 !important; background-color: rgba(234, 88, 12, 0.12) !important; border-color: rgba(234, 88, 12, 0.28) !important; }
.badge-danger { color: #991b1b !important; background-color: rgba(220, 38, 38, 0.12) !important; border-color: rgba(220, 38, 38, 0.28) !important; }
.badge-info { color: #0369a1 !important; background-color: rgba(2, 132, 199, 0.12) !important; border-color: rgba(2, 132, 199, 0.28) !important; }
.badge-purple { color: #6b21a8 !important; background-color: rgba(124, 58, 237, 0.12) !important; border-color: rgba(124, 58, 237, 0.28) !important; }

[data-theme="dark"] .badge-active { color: #4ade80 !important; background-color: rgba(74, 222, 128, 0.16) !important; border-color: rgba(74, 222, 128, 0.32) !important; }
[data-theme="dark"] .badge-pending { color: #fb923c !important; background-color: rgba(251, 146, 60, 0.16) !important; border-color: rgba(251, 146, 60, 0.32) !important; }
[data-theme="dark"] .badge-danger { color: #f87171 !important; background-color: rgba(248, 113, 113, 0.16) !important; border-color: rgba(248, 113, 113, 0.32) !important; }
[data-theme="dark"] .badge-info { color: #38bdf8 !important; background-color: rgba(56, 189, 248, 0.16) !important; border-color: rgba(56, 189, 248, 0.32) !important; }
[data-theme="dark"] .badge-purple { color: #c084fc !important; background-color: rgba(192, 132, 252, 0.16) !important; border-color: rgba(192, 132, 252, 0.32) !important; }

.compact-select { padding: 6px 10px !important; font-size: 0.82rem !important; border-radius: 8px !important; min-height: 34px !important; font-weight: 600 !important; }
.input-with-icon { align-items: center; display: flex; position: relative; }
.input-with-icon input { padding-right: 3rem; }
.input-with-icon span { color: var(--text-muted); font-weight: 500; position: absolute; right: 1rem; }

.harvest-layout { grid-template-columns: 350px 1fr; align-items: start; gap: 1.5rem; display: grid; }
.harvest-form-card, .harvest-list-card { padding: 1.5rem; }

/* MODALES: ANULACIÓN GEOMÉTRICA CUANDO INACTIVOS */
.modal-overlay { 
  position: fixed !important; 
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 0 !important; 
  height: 0 !important; 
  background: rgba(0, 0, 0, 0.75) !important; 
  backdrop-filter: blur(8px) !important; 
  -webkit-backdrop-filter: blur(8px) !important; 
  z-index: 99999 !important; 
  display: none !important; 
  visibility: hidden !important;
  opacity: 0 !important; 
  pointer-events: none !important; 
  overflow: hidden !important;
}
.modal-overlay.active { 
  display: flex !important; 
  visibility: visible !important;
  opacity: 1 !important; 
  pointer-events: auto !important; 
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  align-items: center !important; 
  justify-content: center !important; 
}

.modal-card { 
  border-radius: 20px !important; 
  border: 0.5px solid var(--border-color) !important; 
  background: var(--surface-solid) !important; 
  box-shadow: 0 20px 40px rgba(0,0,0,0.3) !important; 
  width: 100%; 
  max-width: 500px; 
  padding: 1.75rem; 
  max-height: 88vh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  position: relative;
}
.modal-header { justify-content: space-between; align-items: center; margin-bottom: 1.25rem; display: flex; }
.close-btn { background: rgba(118, 118, 128, 0.12); border-radius: 50%; color: var(--text-color); border: none; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.modal-actions { 
  justify-content: flex-end; 
  gap: 0.75rem; 
  margin-top: 1.5rem; 
  display: flex; 
  position: sticky !important; 
  bottom: 0 !important; 
  background: var(--surface-solid) !important; 
  z-index: 10 !important;
  padding-top: 0.75rem;
  padding-bottom: 0.25rem;
}

.bottom-nav-bar { 
  position: fixed; 
  bottom: 0; 
  left: 0; 
  width: 100%; 
  display: none; 
  justify-content: space-around; 
  align-items: center; 
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px)); 
  border-radius: 20px 20px 0 0; 
  z-index: 900; 
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.08); 
  background: var(--surface-color);
  border-top: 0.5px solid var(--border-color);
}
.bottom-nav-item { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  flex: 1; 
  color: var(--text-muted); 
  background: transparent; 
  border: none; 
  cursor: pointer; 
  padding: 4px 2px; 
  border-radius: 10px; 
}
.bottom-nav-item i { font-size: 1.35rem; margin-bottom: 2px; }
.bottom-nav-item span { font-size: 0.65rem; font-weight: 600; letter-spacing: -0.02em; text-align: center; }

.shortcut-option { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border-color); border-radius: 14px; margin-bottom: 8px; cursor: pointer; background: rgba(118, 118, 128, 0.04); }
.shortcut-option.selected { background: rgba(52, 197, 89, 0.12); border-color: #34C759; }

.resv-card { padding: 1.15rem; display: flex; flex-direction: column; gap: 0.75rem; border: 0.5px solid var(--border-color) !important; border-radius: var(--card-radius); }
.resv-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 0.5px solid var(--border-color); padding-bottom: 0.6rem; }
.resv-date-tag { font-weight: 700; font-size: 0.9rem; color: var(--text-color); display: flex; align-items: center; }
.resv-time-tag { font-weight: 700; font-size: 0.85rem; color: var(--text-muted); background: rgba(118, 118, 128, 0.08); padding: 3px 7px; border-radius: 6px; }

.login-container {
  background: var(--bg-color);
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
}
.login-card {
  text-align: center;
  width: 100%;
  max-width: 380px;
  padding: 2.25rem;
}
.login-header { margin-bottom: 1.75rem; }
.login-header h2 { margin-top: 0.75rem; font-size: 1.75rem; color: var(--text-color) !important; }
.login-header p { color: var(--text-muted); }

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .user-profile { padding: 0 !important; }
  .topbar { padding: calc(0.35rem + env(safe-area-inset-top, 0px)) 0.85rem 0.35rem 0.85rem !important; height: calc(56px + env(safe-area-inset-top, 0px)) !important; }
  .hamburger-btn, .sidebar-close-btn { display: flex !important; }

  /* SIDEBAR TOTALMENTE ANULADA EN MÓVIL CUANDO ESTÁ CERRADA */
  .sidebar { 
    width: 0 !important; 
    height: 0 !important; 
    position: fixed; 
    top: 0; 
    left: 0; 
    z-index: 1000; 
    box-shadow: 4px 0 24px rgba(0,0,0,0.25); 
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important; 
  }
  .sidebar.open { 
    display: flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
    width: 285px !important;
    height: 100% !important;
    height: 100dvh !important;
  }
  
  .views-container { padding: 12px !important; padding-bottom: 110px !important; width: 100% !important; }
  .page-title { font-size: 1.3rem !important; margin-bottom: 0.65rem !important; }

  .metrics-grid { 
    grid-template-columns: 1fr 1fr !important; 
    gap: 8px !important; 
    margin-bottom: 1rem !important; 
  }
  .metric-card { 
    padding: 0.75rem !important; 
    gap: 0.5rem !important;
  }
  .metric-icon { 
    width: 36px !important; 
    height: 36px !important; 
    font-size: 1.2rem !important; 
    border-radius: 8px !important;
  }
  .metric-info h3 { font-size: 0.68rem !important; }
  .metric-value { font-size: 1.2rem !important; }

  .charts-section, .harvest-layout { display: flex !important; flex-direction: column !important; gap: 1rem !important; }
  .harvest-form-card, .harvest-list-card { width: 100% !important; padding: 1.15rem !important; }

  .glass { padding: 1rem !important; }
  .modal-card { width: calc(100% - 24px) !important; margin: auto !important; max-height: 88vh !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch !important; padding: 1.25rem !important; }
  
  .data-table th, .data-table td { padding: 0.75rem 0.6rem !important; font-size: 0.78rem !important; }
  
  .view-header { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; }
  .view-header .page-title { margin-bottom: 0 !important; }

  .mobile-actions-grid-4, .mobile-actions-grid-2, .mobile-report-filters-buttons {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    width: 100% !important;
  }
  .mobile-actions-grid-4 .btn, .mobile-actions-grid-2 .btn, .mobile-report-filters-buttons .btn {
    width: 100% !important;
    padding: 0.5rem 0.3rem !important;
    font-size: 0.75rem !important;
    justify-content: center !important;
  }

  .mobile-report-filters { display: flex !important; flex-direction: column !important; gap: 6px !important; width: 100% !important; }
  .mobile-report-filters .input { width: 100% !important; }
}






.bottom-nav-item.active-shortcut {
  color: var(--primary) !important;
  font-weight: 700 !important;
}
.bottom-nav-item.active-shortcut i {
  color: var(--primary) !important;
  transform: scale(1.18);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}


.perm-check {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  cursor: pointer !important;
  user-select: none !important;
  margin-bottom: 4px !important;
  padding: 6px 8px !important;
  border-radius: 8px !important;
  transition: all 0.15s ease !important;
  font-size: 0.83rem !important;
  font-weight: 500 !important;
  color: var(--text-color) !important;
  width: 100% !important;
  text-align: left !important;
}
.perm-check:hover {
  background: rgba(118, 118, 128, 0.12) !important;
}
.perm-check input[type="checkbox"] {
  width: 18px !important;
  min-width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 5px !important;
  accent-color: var(--primary) !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}
.perm-card {
  background: rgba(118, 118, 128, 0.05) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  padding: 10px 12px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}
.perm-card-title {
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
  margin-bottom: 4px !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

/* ESTILOS DE MATRIZ DE PERMISOS EN TABLA */
.perm-table-check, input.perm-table-check[type="checkbox"] {
  width: 20px !important;
  min-width: 20px !important;
  height: 20px !important;
  min-height: 20px !important;
  margin: 0 auto !important;
  padding: 0 !important;
  border-radius: 6px !important;
  accent-color: var(--primary) !important;
  cursor: pointer !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

.swal2-container { z-index: 9999999 !important; }

/* =========================================
   CERRADURA VISUAL DE EDICIÓN Y FORMULARIOS
   ========================================= */
body[data-art-edit="false"] .art-edit-only,
body[data-ind-edit="false"] .ind-edit-only,
body[data-tea-edit="false"] .tea-edit-only,
body[data-fin-edit="false"] .fin-edit-only,
body[data-inv-edit="false"] .inv-edit-only,
body[data-agr-edit="false"] .agr-edit-only {
    display: none !important;
}

/* Expansión de listas al ocultar los formularios de carga */
body[data-art-edit="false"] #harvests .harvest-layout,
body[data-ind-edit="false"] #ind-harvests .harvest-layout {
    display: block !important;
}
body[data-art-edit="false"] .harvest-form-card,
body[data-ind-edit="false"] .harvest-form-card {
    display: none !important;
}

.hide-desktop { display: none !important; }
@media (max-width: 768px) {
  .hide-desktop { display: flex !important; }
}


/* =======================================================
   VIAJE VISUAL & STORYTELLING DE TRAZABILIDAD (ANIMADO)
   ======================================================= */
.visual-timeline-track {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-left: 3rem;
  margin-top: 1rem;
}
.visual-timeline-track::before {
  content: '';
  position: absolute;
  top: 15px;
  bottom: 15px;
  left: 20px;
  width: 3px;
  background: linear-gradient(180deg, #22c55e 0%, #0A84FF 35%, #8b5cf6 65%, #f59e0b 85%, #ec4899 100%);
  border-radius: 4px;
}
.visual-step-card {
  position: relative;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease;
}
.visual-step-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.visual-node {
  position: absolute;
  left: -3rem;
  top: 12px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-solid);
  border: 3px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.4);
  z-index: 2;
}
.story-slide-view {
  background: linear-gradient(145deg, #0f172a 0%, #020617 100%);
  border-radius: 20px;
  padding: 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.1);
}
.story-progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  flex: 1;
  overflow: hidden;
  position: relative;
}
.story-progress-fill {
  height: 100%;
  background: #38bdf8;
  width: 0%;
  transition: width 0.3s ease;
}
.story-progress-fill.active {
  background: #22c55e;
  width: 100%;
}

/* FILTRO ESPECTRAL SATELITAL DE FALSO COLOR INFRARROJO (CIR) */
.cir-infrared-tiles {
  filter: hue-rotate(290deg) saturate(3.2) contrast(1.25) brightness(0.9) !important;
}
.ndvi-contrast-tiles {
  filter: saturate(1.4) contrast(1.15) !important;
}

/* SKELETON LOADERS CON ANIMACIÓN SHIMMER */
.skeleton {
  background: linear-gradient(90deg, rgba(118, 118, 128, 0.08) 25%, rgba(118, 118, 128, 0.2) 50%, rgba(118, 118, 128, 0.08) 75%) !important;
  background-size: 200% 100% !important;
  animation: skeleton-shimmer 1.4s infinite ease-in-out !important;
  border-radius: 6px !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06) 25%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.06) 75%) !important;
  background-size: 200% 100% !important;
}

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

/* =======================================================
   REGLAS DE SEGURIDAD Y CENSURA RBAC PARA COSECHEROS
   ======================================================= */
body[data-role="cosechero"] .role-admin,
body[data-role="cosechero"] .role-encargado,
body[data-role="cosechero"] [data-view="dashboard"],
body[data-role="cosechero"] [data-view="art-chacras"],
body[data-role="cosechero"] [data-view="art-secadero"],
body[data-role="cosechero"] [data-view="factory"],
body[data-role="cosechero"] [data-view="analytics"],
body[data-role="cosechero"] [data-view="ind-dashboard"],
body[data-role="cosechero"] [data-view="ind-workers"],
body[data-role="cosechero"] [data-view="ind-secadero"],
body[data-role="cosechero"] [data-view="global-dashboard"],
body[data-role="cosechero"] [data-view="proyecciones"] {
    display: none !important;
}
to { transform: translateY(-15px); }
}
