/* ==========================================================================
   VIHAA HERBAL - APP SPECIFIC COMPONENT STYLES
   Layout, Navigation, WhatsApp Mockup, Timeline, Modals & Views
   ========================================================================== */

/* Main Layout Structure */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1680px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 4rem; /* Bottom padding ensures content is never covered by sticky footer */
}

/* Glass Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  margin-bottom: 1.25rem;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow);
  position: sticky;
  top: 1rem;
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(77, 124, 15, 0.15));
}

.brand-title-wrap h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e381b;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-subtitle {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--brand-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Header Action & Status Bar */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.system-status-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  background: rgba(240, 248, 238, 0.9);
  border: 1px solid rgba(77, 124, 15, 0.2);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: #2e5223;
}

/* Navigation Tabs */
.app-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding: 0.4rem;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  box-shadow: var(--glass-shadow-sm);
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.15rem;
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.nav-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.8);
}

.nav-tab-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, #4d7c0f 0%, #325509 100%);
  box-shadow: 0 4px 15px -3px rgba(77, 124, 15, 0.45);
}

.nav-tab-btn svg {
  width: 17px;
  height: 17px;
}

.tab-badge {
  background: rgba(255, 255, 255, 0.25);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
}

/* Main Content Area */
.app-view {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

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

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

/* ----------------- DASHBOARD VIEW ----------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.35rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-sm);
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, rgba(77, 124, 15, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--glass-shadow);
  border-color: rgba(77, 124, 15, 0.3);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

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

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.green { background: rgba(220, 252, 231, 0.9); color: #15803d; }
.stat-icon.blue { background: rgba(224, 242, 254, 0.9); color: #0284c7; }
.stat-icon.purple { background: rgba(243, 232, 255, 0.9); color: #7c3aed; }
.stat-icon.amber { background: rgba(254, 243, 199, 0.9); color: #d97706; }
.stat-icon.rose { background: rgba(255, 228, 230, 0.9); color: #e11d48; }

.stat-value {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  color: #172a15;
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.stat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dashboard-split-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
  .dashboard-split-grid {
    grid-template-columns: 1fr;
  }
}

.channel-breakdown-card {
  padding: 1.5rem;
}

.channel-bars {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1rem;
}

.channel-bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.channel-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.825rem;
  font-weight: 600;
}

.progress-track {
  height: 8px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

.progress-fill.green { background: linear-gradient(90deg, #4d7c0f, #22c55e); }
.progress-fill.blue { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.progress-fill.purple { background: linear-gradient(90deg, #7c3aed, #c084fc); }
.progress-fill.amber { background: linear-gradient(90deg, #d97706, #fbbf24); }

/* Quick Action Banner */
.action-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(236, 252, 203, 0.65) 0%, rgba(209, 250, 229, 0.7) 100%);
  border: 1px solid rgba(77, 124, 15, 0.25);
  margin-bottom: 1.5rem;
  box-shadow: var(--glass-shadow-sm);
}

.action-banner-text h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: #1e381b;
  margin-bottom: 0.25rem;
}

.action-banner-text p {
  font-size: 0.875rem;
  color: #3b5a34;
}

.action-banner-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ----------------- ORDERS MANAGEMENT VIEW ----------------- */
.orders-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.toolbar-primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-box-wrap {
  position: relative;
  flex: 1;
  min-width: 280px;
}

.search-box-wrap svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-box-wrap input {
  padding-left: 2.75rem;
}

.toolbar-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filter-chips-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
}

.filter-chip {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.filter-chip:hover {
  background: #ffffff;
  color: var(--text-main);
  border-color: rgba(77, 124, 15, 0.3);
}

.filter-chip.active {
  background: #1e381b;
  color: #ffffff;
  border-color: #1e381b;
  box-shadow: 0 2px 4px rgba(30, 56, 27, 0.25);
}

.chip-badge-auto {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(234, 88, 12, 0.12);
  color: #c2410c;
  font-weight: 700;
  margin-left: 4px;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.filter-chip.active .chip-badge-auto {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.filter-chip .chip-icon {
  margin-right: 4px;
  font-size: 0.82rem;
}

.filter-chips-collapsible::-webkit-scrollbar {
  height: 5px;
  width: 5px;
}

.filter-chips-collapsible::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

.btn-preset-pill {
  padding: 0.25rem 0.6rem;
  font-size: 0.73rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-preset-pill:hover,
.btn-preset-pill.active {
  background: #1e381b;
  color: #ffffff;
  border-color: #1e381b;
}

/* ----------------- MASTERS TEMPLATE BUILDER ----------------- */
.masters-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .masters-layout {
    grid-template-columns: 1fr;
  }
}

.status-tabs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.status-template-card {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-template-card:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--brand-primary);
  transform: translateX(3px);
}

.status-template-card.active {
  background: #ffffff;
  border-color: var(--brand-primary);
  box-shadow: 0 4px 15px -3px rgba(77, 124, 15, 0.25);
  border-left: 4px solid var(--brand-primary);
}

.variables-chip-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0;
}

.var-tag {
  font-family: monospace;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(77, 124, 15, 0.1);
  color: #2b5507;
  border: 1px solid rgba(77, 124, 15, 0.2);
  cursor: pointer;
  transition: var(--transition-fast);
}

.var-tag:hover {
  background: var(--brand-primary);
  color: #ffffff;
  transform: translateY(-1px);
}

/* WhatsApp Phone Simulator */
.wa-simulator-box {
  background: #0b141a;
  border-radius: 36px;
  padding: 12px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
  max-width: 440px;
  margin: 0 auto;
}

.wa-screen {
  background: #e4ddd6;
  background-image: radial-gradient(#d3c7bc 1px, transparent 1px);
  background-size: 16px 16px;
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 580px;
}

.wa-header {
  background: #005c4b;
  color: #ffffff;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.wa-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  padding: 3px;
  object-fit: contain;
}

.wa-header-info h4 {
  font-size: 0.925rem;
  font-weight: 600;
  line-height: 1.1;
}

.wa-header-info p {
  font-size: 0.72rem;
  opacity: 0.85;
}

.wa-body {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.wa-bubble {
  align-self: flex-end;
  background: #d9fdd3;
  color: #111b21;
  padding: 0.75rem 0.95rem;
  border-radius: 12px 12px 2px 12px;
  box-shadow: 0 1px 1.5px rgba(11, 20, 26, 0.13);
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 88%;
  position: relative;
}

.wa-bubble-time {
  float: right;
  margin-left: 0.6rem;
  margin-top: 0.25rem;
  font-size: 0.68rem;
  color: #667781;
  display: flex;
  align-items: center;
  gap: 2px;
}

/* ----------------- ADMIN NOTIFICATIONS ----------------- */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.trigger-card {
  padding: 1.15rem 1.4rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.25s ease-out;
}

.trigger-card.collapsed {
  padding: 0.95rem 1.4rem;
  gap: 0;
  background: rgba(255, 255, 255, 0.78);
}

.trigger-card.collapsed:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--glass-shadow);
  border-color: rgba(77, 124, 15, 0.35);
}

.trigger-card.collapsed .trigger-card-body {
  display: none !important;
}

.trigger-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.trigger-card-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.trigger-card-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.trigger-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  animation: cardFadeIn 0.2s ease-out;
}

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

.btn-card-collapse {
  background: rgba(241, 245, 249, 0.9);
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fast);
}

.btn-card-collapse:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.btn-collapse-all-tool {
  background: rgba(255, 255, 255, 0.85);
  color: #334155;
  border: 1px solid var(--glass-border);
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fast);
}

.btn-collapse-all-tool:hover {
  background: #ffffff;
  color: #1e381b;
  border-color: rgba(77, 124, 15, 0.4);
  box-shadow: var(--glass-shadow-sm);
  transform: translateY(-1px);
}

.trigger-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.trigger-card-actions .actions-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-card-preview {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fast);
}

.btn-card-preview:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.btn-card-test {
  background: rgba(238, 242, 255, 0.95);
  color: #4338ca;
  border: 1px solid rgba(199, 210, 254, 0.9);
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fast);
}

.btn-card-test:hover {
  background: #e0e7ff;
  color: #312e81;
  border-color: #818cf8;
  transform: translateY(-1px);
}

.btn-card-save {
  background: linear-gradient(135deg, #15803d, #166534);
  color: #ffffff;
  border: 1px solid #14532d;
  padding: 0.45rem 1.05rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 2px 4px rgba(22, 101, 52, 0.2);
  transition: var(--transition-fast);
}

.btn-card-save:hover {
  background: linear-gradient(135deg, #166534, #14532d);
  box-shadow: 0 4px 8px rgba(22, 101, 52, 0.3);
  transform: translateY(-1px);
}

.btn-card-delete {
  background: rgba(254, 242, 242, 0.8);
  color: #dc2626;
  border: 1px solid rgba(252, 165, 165, 0.7);
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition-fast);
}

.btn-card-delete:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #f87171;
}

/* ----------------- SCHEDULER VIEW ----------------- */
.scheduler-hero {
  padding: 2rem;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(240, 249, 238, 0.8) 100%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.time-pill-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.time-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1px solid rgba(77, 124, 15, 0.3);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  color: #2e5223;
  box-shadow: var(--glass-shadow-sm);
}

.time-chip .remove-time-btn {
  background: none;
  border: none;
  color: #dc2626;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  padding: 0 2px;
}

/* ----------------- MODALS & DRAWERS ----------------- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 30, 15, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-card {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-lg);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: #1e381b;
}

.close-modal-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.close-modal-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

/* Order Details Drawer */
.drawer-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 30, 15, 0.35);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
}

.drawer-overlay.active {
  display: block;
}

.order-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 100%;
  max-width: 580px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: var(--glass-blur);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
  border-left: 1px solid var(--glass-border);
  z-index: 1001;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.order-drawer.active {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Tracking Timeline */
.timeline-list {
  position: relative;
  padding-left: 24px;
  margin-top: 1rem;
}

.timeline-list::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: rgba(77, 124, 15, 0.25);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.25rem;
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--brand-primary);
  box-shadow: 0 0 0 2px rgba(77, 124, 15, 0.2);
}

.timeline-dot.active {
  background: var(--brand-primary);
  border-color: #ffffff;
  box-shadow: 0 0 0 3px var(--brand-primary);
}

.timeline-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.925rem;
  color: #172a15;
}

.timeline-location {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-primary);
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--text-light);
}

.timeline-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 2.75rem; /* Sits cleanly above the thin sticky footer */
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.toast {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-lg);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 280px;
}

.toast.success { border-left: 4px solid #16a34a; }
.toast.error { border-left: 4px solid #dc2626; }
.toast.info { border-left: 4px solid #0284c7; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==================== STICKY THIN FOOTER ==================== */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 850;
  height: 32px;
  min-height: 32px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(77, 124, 15, 0.16);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  font-size: 0.74rem;
  color: var(--text-muted, #52634f);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  transition: all 0.2s ease;
}

.app-footer-inner {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.app-footer a {
  color: var(--brand-primary, #3f6e10);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease, text-decoration 0.15s ease;
}

.app-footer a:hover {
  text-decoration: underline;
  color: var(--brand-primary-hover, #31580b);
}

.app-footer .footer-left,
.app-footer .footer-right {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .app-container {
    padding: 0.75rem 0.75rem 4.5rem; /* Ensures no content is covered on mobile view */
  }
  .app-footer {
    height: auto;
    min-height: 34px;
    padding: 0.35rem 0.75rem;
    font-size: 0.7rem;
  }
  .app-footer-inner {
    flex-direction: column;
    gap: 0.2rem;
    text-align: center;
  }
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .mode-toggle-group {
    width: 100%;
    flex-direction: column;
  }
}

/* ==================== ENVIRONMENT MODE SWITCHER ==================== */
.mode-toggle-group {
  display: inline-flex;
  background: rgba(220, 230, 220, 0.45);
  padding: 6px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(77, 124, 15, 0.2);
  gap: 8px;
}

.btn-mode {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
}

.btn-mode .mode-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.btn-mode .mode-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-mode .mode-subtitle {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Hover State */
.btn-mode:hover {
  background: rgba(255, 255, 255, 0.85);
  transform: translateY(-1px);
}

/* Active Testing Mode */
.btn-mode#btnModeTesting.active {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #f59e0b;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
}
.btn-mode#btnModeTesting.active .mode-title {
  color: #b45309;
}
.btn-mode#btnModeTesting.active .mode-subtitle {
  color: #92400e;
  font-weight: 600;
}

/* Active Production Mode */
.btn-mode#btnModeProduction.active {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #10b981;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}
.btn-mode#btnModeProduction.active .mode-title {
  color: #065f46;
}
.btn-mode#btnModeProduction.active .mode-subtitle {
  color: #047857;
  font-weight: 600;
}

/* Mode Notice Banner */
.mode-banner {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all 0.3s ease;
}

.mode-banner-testing {
  background: rgba(254, 243, 199, 0.75);
  border-color: rgba(245, 158, 11, 0.45);
  color: #92400e;
}

.mode-banner-production {
  background: rgba(209, 250, 229, 0.75);
  border-color: rgba(16, 185, 129, 0.45);
  color: #065f46;
}

/* Header Chip for Mode */
.header-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.header-mode-badge.testing {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.header-mode-badge.production {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.header-mode-badge:hover {
  transform: scale(1.04);
}

/* ==========================================================================
   AUTHENTICATION & LOGIN OVERLAY STYLES
   ========================================================================== */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background-color: #0b1c11;
  background-image:
    radial-gradient(circle at 15% 25%, rgba(77, 124, 15, 0.4) 0px, transparent 45%),
    radial-gradient(circle at 85% 75%, rgba(16, 185, 129, 0.3) 0px, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(217, 119, 6, 0.15) 0px, transparent 50%),
    linear-gradient(135deg, rgba(11, 28, 17, 0.98) 0%, rgba(7, 16, 10, 0.98) 100%);
  background-attachment: fixed;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.auth-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 24px;
  box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(77, 124, 15, 0.18);
  padding: 2.5rem 2.25rem;
  animation: authCardEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #4d7c0f 0%, #10b981 50%, #d97706 100%);
}

@keyframes authCardEnter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-logo-img {
  height: 58px;
  width: auto;
  object-fit: contain;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 4px 8px rgba(77, 124, 15, 0.2));
}

.auth-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  color: #153215;
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem 0;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  background: rgba(77, 124, 15, 0.1);
  border: 1px solid rgba(77, 124, 15, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-input-group {
  margin-bottom: 1.15rem;
  position: relative;
}

.auth-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.35rem;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 0.95rem;
  color: #94a3b8;
  font-size: 1rem;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.auth-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.6rem;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.925rem;
  color: #0f172a;
  outline: none;
  transition: all 0.2s ease;
}

.auth-input:focus {
  border-color: #4d7c0f;
  box-shadow: 0 0 0 3px rgba(77, 124, 15, 0.15);
}

.auth-password-toggle {
  position: absolute;
  right: 0.85rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}

.auth-password-toggle:hover {
  color: #334155;
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  font-size: 0.825rem;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: #475569;
  cursor: pointer;
  user-select: none;
}

.auth-btn-submit {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, #4d7c0f 0%, #36590b 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 8px 20px -4px rgba(77, 124, 15, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.auth-btn-submit:hover {
  background: linear-gradient(135deg, #598f12 0%, #3f680d 100%);
  transform: translateY(-1.5px);
  box-shadow: 0 12px 24px -4px rgba(77, 124, 15, 0.55);
}

.auth-btn-submit:active {
  transform: translateY(0);
}

.auth-btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.auth-error-box {
  display: none;
  padding: 0.65rem 0.85rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #b91c1c;
  font-size: 0.825rem;
  font-weight: 600;
  margin-bottom: 1rem;
  align-items: center;
  gap: 0.5rem;
}

.auth-error-box.visible {
  display: flex;
}

.auth-demo-hint {
  margin-top: 1.5rem;
  padding: 0.75rem 0.9rem;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #475569;
}

.auth-demo-btn {
  background: #ffffff;
  border: 1px solid #94a3b8;
  color: #0f172a;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-demo-btn:hover {
  background: #f1f5f9;
  border-color: #4d7c0f;
  color: #4d7c0f;
}

/* User Profile & Logout Chip in Top Header */
.header-user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: #1e381b;
  box-shadow: var(--glass-shadow-sm);
}

.header-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4d7c0f 0%, #2e5223 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
}

.btn-header-logout {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: rgba(254, 242, 242, 0.9);
  color: #b91c1c;
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-header-logout:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
  transform: translateY(-1px);
}

/* ==================== FILTER PILLS & BADGES ==================== */
.filter-pills-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-pill-btn {
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(77, 124, 15, 0.2);
  background: rgba(255, 255, 255, 0.7);
  color: #1e381b;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.filter-pill-btn:hover {
  background: rgba(240, 248, 238, 0.9);
  border-color: #4d7c0f;
  transform: translateY(-1px);
}

.filter-pill-btn.active {
  background: linear-gradient(135deg, #365314 0%, #15803d 100%);
  color: #ffffff;
  border-color: #15803d;
  box-shadow: 0 2px 6px rgba(21, 128, 61, 0.25);
}

.filter-pill-btn.active .badge-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.badge-count {
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.08);
  font-size: 0.7rem;
  font-weight: 700;
}

.auto-detect-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 2px 8px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1e40af;
  border: 1px solid #93c5fd;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-active-state {
  display: inline-flex;
  padding: 2px 7px;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-active-state.off {
  background: #f1f5f9;
  color: #64748b;
  border-color: #cbd5e1;
}

/* ==================== GUIDED VARIABLE SELECTOR ==================== */
.guided-var-section {
  background: rgba(248, 250, 252, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
}

.variable-groups-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.var-group-box {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.var-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  min-width: 130px;
  padding-top: 4px;
}

.var-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
}

.var-chip-btn {
  padding: 0.3rem 0.65rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  color: #0f172a;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
  user-select: none;
}

.var-chip-btn:hover {
  background: #f0fdf4;
  border-color: #4d7c0f;
  color: #166534;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(77, 124, 15, 0.15);
}

.var-chip-btn:active {
  transform: translateY(0);
}

/* ==================== FORMATTING MINI TOOLBAR ==================== */
.formatting-mini-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 2px 4px;
}

.fmt-btn {
  background: none;
  border: none;
  font-size: 0.8rem;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  color: #334155;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fmt-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.fmt-sep {
  width: 1px;
  height: 14px;
  background: #cbd5e1;
  margin: 0 2px;
}

/* Guide Table */
.guide-table code.var-badge {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.8rem;
  color: #0369a1;
  border: 1px solid #e0f2fe;
}

/* Quick WhatsApp Test Channel Switcher */
.quick-type-btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 0.55rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  transition: all 0.2s ease;
  text-align: center;
  line-height: 1.25;
}
.quick-type-btn:hover {
  color: #1e293b;
  background: rgba(255, 255, 255, 0.7);
}
.quick-type-btn.active {
  background: #ffffff;
  color: #15803d;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
  font-weight: 700;
}

.preset-chip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.preset-chip:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}


