* {
  box-sizing: border-box;
}

:root {
  /* DARK MODE (DEFAULT) */
  --bg-main: #050505;
  --bg-header: #0a0a0a;
  --bg-surface: #111111;
  --bg-surface-elevated: #1a1a1a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-overlay: rgba(0, 0, 0, 0.85);
  --bg-drawer: #0a0a0a;
  --bg-hover: rgba(255, 255, 255, 0.05);

  --text-main: #ffffff;
  --text-dim: #94a3b8;
  --text-inverse: #000000;

  --border-main: #222222;
  --border-soft: rgba(255, 255, 255, 0.05);

  --accent-cyan: #00ffff;
  --accent-cyan-glow: rgba(0, 255, 255, 0.4);
  --accent-cyan-vibrant: #00ffff;
  --accent-cyan-border: rgba(0, 255, 255, 0.3);

  --accent-price: #ffc800;
  --accent-price-glow: rgba(255, 200, 0, 0.2);
  --accent-price-border: rgba(255, 200, 0, 0.4);

  --accent-green: #22c55e;
  --accent-green-glow: rgba(34, 197, 94, 0.3);
  --accent-red: #ff4444;
  --accent-red-glow: rgba(255, 68, 68, 0.3);

  --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  --primary-gradient: linear-gradient(to right, #22c55e, #3b82f6);
}

/* LIGHT MODE OVERRIDES */
html[data-theme='light'] {
  --bg-main: #f1f5f9; /* Slightly darker base for contrast */
  --bg-header: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-overlay: rgba(15, 23, 42, 0.4); /* Darker overlay for light mode */
  --bg-drawer: #ffffff;
  --bg-hover: rgba(14, 165, 233, 0.08);

  --text-main: #0f172a;
  --text-dim: #475569;
  --text-inverse: #ffffff;

  --border-main: #cbd5e1; /* Much clearer borders */
  --border-soft: #e2e8f0;

  --accent-cyan: #0284c7;
  --accent-cyan-glow: rgba(2, 132, 199, 0.15);
  --accent-cyan-vibrant: #0369a1;
  --accent-cyan-border: rgba(2, 132, 199, 0.3);

  --accent-price: #b45309;
  --accent-price-glow: rgba(180, 83, 9, 0.1);
  --accent-price-border: rgba(180, 83, 9, 0.3);

  --accent-green: #059669;
  --accent-green-glow: rgba(5, 150, 105, 0.15);
  --accent-red: #dc2626;
  --accent-red-glow: rgba(220, 38, 38, 0.15);

  --shadow-modal: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* System preference fallback */
@media (prefers-color-scheme: light) {
  html:not([data-theme='dark']):not([data-theme='light']) {
    --bg-main: #f8fafc;
    --bg-header: #ffffff;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --bg-card: #ffffff;
    --bg-overlay: rgba(255, 255, 255, 0.9);
    --bg-drawer: #ffffff;
    --bg-hover: rgba(15, 23, 42, 0.04);

    --text-main: #0f172a;
    --text-dim: #64748b;
    --text-inverse: #ffffff;

    --border-main: #e2e8f0;
    --border-soft: #f1f5f9;

    --accent-cyan: #0ea5e9;
    --accent-cyan-glow: rgba(14, 165, 233, 0.15);
    --accent-cyan-vibrant: #0284c7;
    --accent-cyan-border: rgba(14, 165, 233, 0.3);

    --accent-price: #b45309;
    --accent-price-glow: rgba(180, 83, 9, 0.1);
    --accent-price-border: rgba(180, 83, 9, 0.3);

    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.15);
    --accent-red: #ef4444;
    --accent-red-glow: rgba(239, 68, 68, 0.15);

    --shadow-modal: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
  }
}

/* App Shell / Nested Scroll System */
/* App Shell / Nested Scroll System (LEGACY - Moving to Native Scroll) */
.agmart-app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    position: relative;
    background: var(--bg-main);
}

.agmart-main-scroll {
    flex: 1;
    overflow-y: visible;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 80px; /* Universal footer spacing */
    display: flex;
    flex-direction: column;
}

/* Scrollbar Visibility (Subtle but Functional) */
.agmart-main-scroll::-webkit-scrollbar {
    width: 6px;
}
.agmart-main-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.agmart-main-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Global scroll lock helper */
.agmart-scroll-lock {
    overflow: hidden !important;
}

body.agmart-app-body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    height: auto;
    overflow: visible;
    background: var(--bg-main);
}



*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Base resets */
html,
body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg-main);
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  overflow-x: hidden;
  overflow-y: visible;
  min-height: 100vh;
  height: auto;
  overscroll-behavior-y: auto;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea, [contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}

/* Responsive Container Utility */
.agmart-container {
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .agmart-container {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* App Bar */
/* Unified Header System */
#app-bar,
.unified-header,
.glass-header {
  height: 48px;
  width: 100%;
  background: var(--bg-header);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  justify-content: center; /* Center the content wrapper */
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 3000;
  padding: 0;
}

/* Header inner content should match page container */
#app-bar > div:first-child,
.unified-header > div:first-child,
.glass-header > div:first-child {
  width: 100%;
  max-width: 1280px;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  margin: 0 auto;
}

/* Theme-aware Header Icons */
.header-icon-clear {
  color: #94a3b8; /* Default Dim */
  transition: all 0.2s ease;
}

.header-icon-clear:hover {
  color: var(--text-main);
  transform: scale(1.1);
}

html[data-theme='light'] .header-icon-clear {
  color: #475569; /* Darker slate for light mode visibility */
}

html[data-theme='dark'] .header-icon-clear {
  color: #cbd5e1; /* Brighter slate for dark mode clarity */
}

.app-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-dim);
  transition: background 0.2s, color 0.2s;
}

.app-icon-btn:hover {
  background: var(--bg-card);
  color: var(--text-main);
}

#app-logo {
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 2px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
}

#backend-status {
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 1px;
  font-weight: bold;
  text-transform: uppercase;
}

/* Utility for back button */
/* Ensure back-btn alignment is perfect */
.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-cyan);
  cursor: pointer;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1.2px;
  transition: all 0.2s ease;
  height: 100%;
  /* Fill header height for better tap target */
  padding: 0 4px;
}

.back-btn iconify-icon {
  font-size: 24px;
}

.back-btn:hover {
  background: rgba(0, 255, 255, 0.05);
  transform: translateX(-2px);
}

.back-btn iconify-icon {
  font-size: 24px;
}

/* Unified Header Title System */
.header-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  pointer-events: none;
}

.header-title-main {
  font-size: 11px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 1.5px;
  margin: 0;
  line-height: 1;
  text-transform: uppercase;
}

.header-title-sub {
  font-size: 7px;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 2px 0 0 0;
  opacity: 0.9;
}

/* Animations */
@keyframes pulse {
  0% {
    opacity: 0.4;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.4;
  }
}

.loading-text {
  animation: pulse 1.5s infinite ease-in-out;
}

/* <link rel="stylesheet" href="/styles.css?v=47"> */
/* Market List View Styles */
.chip {
  padding: 8px 15px;
  background: var(--bg-surface);
  border: 1px solid var(--border-main);
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 100px;
  text-align: center;
}

.chip:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--text-dim);
  transform: translateY(-2px);
}

.chip.active {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: var(--text-inverse);
  font-weight: 700;
  box-shadow: 0 0 15px var(--accent-green-glow);
}

/* Heart Toggle Styles */
.heart-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  background: var(--bg-overlay);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
}

.heart-toggle:hover {
  background: var(--bg-overlay);
  transform: scale(1.15);
  color: var(--text-main);
}

.heart-toggle.active {
  color: var(--accent-red);
  background: var(--accent-red-glow);
  border-color: var(--accent-red);
  text-shadow: 0 0 10px var(--accent-red-glow);
}

.heart-toggle.pop {
  animation: heart-pop 0.3s ease-out;
}

@keyframes heart-pop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.4);
  }

  100% {
    transform: scale(1.15);
  }
}

#histogram-wrapper {
  pointer-events: none;
  position: relative;
  width: 100%;
  height: 100px;
  z-index: 60;
  top: 115px;
}

#active-crop-card {
  width: 100%;
  /* Spans end-to-end on widescreens */
  flex-shrink: 0;
  margin: 0;
  display: flex;
  align-items: center;
  padding: 0 15px;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  #active-crop-card {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    border-radius: 0;
  }
}

@media (min-width: 768px) {
  #histogram-wrapper {
    top: 125px;
    height: 120px;
  }
}

.vol-cutoff-handle {
  pointer-events: auto !important;
  cursor: grab;
  z-index: 100;
  width: 14px;
  height: 24px;
  background: var(--text-main) !important;
  border-radius: 2px;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
  display: block !important;
  transform: translateX(-50%);
  position: absolute;
  top: 50%;
}

.vol-cutoff-handle::after {
  content: attr(data-label);
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  color: var(--text-main);
  white-space: nowrap;
  background: var(--bg-overlay);
  padding: 1px 4px;
  border-radius: 3px;
}

.market-list-row {
  display: flex;
  flex-direction: column;
  padding: 15px 15px;
  /* Increased padding */
  border-bottom: 1px solid var(--border-main);
  transition: background 0.2s;
  cursor: pointer;
}

#market-search:focus {
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 8px var(--accent-cyan-glow);
}

.sort-chip {
  padding: 4px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-main);
  border-radius: 12px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sort-chip:hover {
  border-color: var(--text-dim);
  color: var(--text-main);
}

.sort-chip.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: var(--text-inverse);
}

/* Search Highlighting */
.market-list-row mark {
  background: var(--accent-cyan-glow);
  color: var(--text-main);
  padding: 0 2px;
  border-radius: 2px;
}

@media (max-width: 400px) {
  #list-header {
    padding: 8px 10px !important;
  }

  #list-header .sort-chip {
    padding: 3px 8px !important;
    font-size: 9px !important;
  }

  #market-search {
    padding: 5px 10px !important;
    font-size: 10px !important;
  }
}

/* Crop Selection Redesign - Unified Controller */
.unified-controller {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 2px 4px;
  margin-left: auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  height: 32px;
  width: fit-content;
  white-space: nowrap;
}

.ctrl-btn {
  width: 32px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  border-radius: 16px;
  flex-shrink: 0;
}

.ctrl-btn:hover {
  background: var(--accent-cyan-glow);
  color: var(--text-main);
}

.ctrl-btn.play-pause-btn {
  width: 34px;
  height: 34px;
  margin: 0 -2px;
  background: var(--bg-card);
  border: 1px solid var(--accent-cyan-glow);
  position: relative;
  z-index: 2;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.ctrl-btn.play-pause-btn:hover {
  background: var(--accent-cyan-glow);
  border-color: var(--accent-cyan);
}

.crop-nav-btn {
  font-size: 20px;
  font-weight: bold;
}

/* Ticker Autoplay Controls Consolidated */
.ticker-control-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.ticker-control-btn:hover {
  background: var(--accent-cyan-glow);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Playing state - brighter ring */
.ticker-control-btn.active {
  background: var(--accent-cyan-glow);
  border-color: var(--accent-cyan-glow);
  color: var(--accent-cyan);
}

.progress-ring {
  position: absolute;
  top: -1px;
  left: -1px;
  width: 34px;
  height: 34px;
  pointer-events: none;
}

.progress-ring circle {
  transform: rotate(-90deg);
  transform-origin: 18px 18px;
  transition: stroke-dashoffset 0.1s linear;
}

.ticker-control-btn *,
.ticker-control-btn svg {
  pointer-events: none;
}

/* Search Page Alphabetical UI */
.letter-divider {
  grid-column: 1 / -1;
  background: var(--bg-card);
  padding: 5px 15px;
  color: var(--accent-cyan);
  font-size: 14px;
  font-weight: bold;
  border-left: 3px solid var(--accent-cyan);
  margin-top: 15px;
  border-radius: 4px;
  text-transform: uppercase;
  width: 100%;
  box-sizing: border-box;
}

.price-scale {
  width: 100%;
  height: 24px;
  position: relative;
  margin-top: 8px;
  /* Reduced from 12px for closer alignment */
  display: flex;
  align-items: center;
}

.price-scale-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-main);
  z-index: 1;
}

.price-shadow {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--bg-overlay);
  /* Darker and more opaque */
  z-index: 6;
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: width 0.1s ease-out;
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.color-bar-gradient {
  z-index: 1;
  /* Lowest */
  position: relative;
}

#price-shadow-left {
  left: 0;
  justify-content: flex-end;
  border-right: 1px solid var(--border-soft);
}

#price-shadow-right {
  right: 0;
  justify-content: flex-start;
  border-left: 1px solid var(--border-soft);
}


.price-range-bar {
  position: absolute;
  height: 1px;
  background: var(--accent-cyan-glow);
  z-index: 2;
  box-shadow: 0 0 5px var(--accent-cyan-glow);
}

.price-dot {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

.price-dot.min {
  background: var(--text-dim);
}

.price-dot.max {
  background: var(--text-dim);
}

.price-dot.modal {
  background: var(--accent-cyan);
  width: 5px;
  height: 5px;
  box-shadow: 0 0 8px var(--accent-cyan);
  z-index: 4;
}

.price-scale-tick {
  position: absolute;
  top: 14px;
  font-size: 8px;
  color: var(--text-dim);
  /* Brighter tick labels */
  transform: translateX(-50%);
  font-family: monospace;
}

.price-scale-tick:last-child {
  transform: translateX(-100%);
}

.market-list-row:hover {
  background: var(--bg-card);
}

.market-list-name {
  flex: 1;
  font-size: 13px;
  font-weight: bold;
}

.market-list-meta {
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 2px;
}

.market-list-stats {
  text-align: left;
  width: 120px;
}

.market-list-val {
  font-size: 12px;
  font-weight: 900;
  color: var(--text-main);
}

.market-list-label {
  font-size: 8px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.market-list-diff {
  font-size: 8px;
  font-weight: bold;
}

.market-list-diff.pos {
  color: var(--accent-green);
}

.market-list-diff.neg {
  color: var(--accent-red);
}

.market-list-range {
  font-size: 9px;
  color: var(--text-dim);
  font-family: monospace;
}

/* GPS Pulse */
#toggle-gps.active svg,
#list-gps-toggle.active svg {
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 5px var(--accent-cyan));
  animation: gps-pulse 2s infinite;
}

@keyframes gps-pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

/* Custom Scrollbar for List View */
#market-list-view::-webkit-scrollbar {
  width: 8px;
}

#market-list-view::-webkit-scrollbar-track {
  background: var(--bg-main);
}

#market-list-view::-webkit-scrollbar-thumb {
  background: var(--border-main);
  border-radius: 4px;
}

#market-list-view::-webkit-scrollbar-thumb:hover {
  background: var(--border-soft);
}

/* Active Sort Column Glow */
.sort-column-active {
  color: var(--accent-cyan) !important;
  text-shadow: 0 0 8px var(--accent-cyan), 0 0 12px var(--accent-cyan);
}

.sort-arrow-active {
  color: var(--accent-cyan) !important;
  text-shadow: 0 0 8px var(--accent-cyan), 0 0 12px var(--accent-cyan);
  opacity: 1.0 !important;
}

/* Alphabet Divider for A-Z Sort */
.letter-divider {
  width: 100%;
  padding: 20px 0 10px;
  margin-top: 10px;
  font-size: 24px;
  font-weight: 900 !important;
  color: var(--accent-cyan) !important;
  border-bottom: 1px solid var(--accent-cyan-glow);
  text-shadow: 0 0 15px var(--accent-cyan-glow), 0 0 30px var(--accent-cyan) !important;
  letter-spacing: 2px;
  font-family: 'Inter', sans-serif;
  opacity: 1 !important;
}

/* ================== MARKET DETAIL PAGE (market.html) ================== */
.market-hero {
  background: linear-gradient(135deg, var(--bg-main) 0%, var(--bg-header) 100%);
  padding: 60px 20px 0;
  border-bottom: 1px solid var(--border-soft);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.market-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 140%;
  height: 140%;
  pointer-events: none;
}

html[data-theme='dark'] .market-hero::before {
  background: radial-gradient(circle, var(--accent-cyan-glow) 0%, transparent 70%);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme='light']) .market-hero::before {
    background: radial-gradient(circle, var(--accent-cyan-glow) 0%, transparent 70%);
  }
}

.market-hero h1 {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 8px;
  background: linear-gradient(to bottom, var(--text-main) 50%, var(--text-dim) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  margin-top: 0;
}

.market-hero p {
  color: var(--accent-cyan);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 25px;
}

.market-stats-overview {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 30px auto 0;
  max-width: 100%;
}

.market-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  padding: 15px 25px;
  border-radius: 16px;
  min-width: 150px;
  backdrop-filter: blur(10px);
}

.market-stat-card .label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  margin-bottom: 5px;
}

.market-stat-card .value {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-main);
}

.market-stat-card .value span {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 4px;
}

.commodity-container {
  padding: 30px 20px;
  max-width: 100%;
  margin: 0;
}

#crop-selector-container {
  width: 100% !important;
  max-width: none !important;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rail-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.3s ease;
  min-width: 60px;
}

.rail-item.active,
.rail-item:hover {
  opacity: 1;
  transform: scale(1.05);
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding-bottom: 80px;
  /* Fix clipping on Mobile */
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.rail-img-wrap {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid transparent;
  margin-bottom: 5px;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

.rail-item.active .rail-img-wrap {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.rail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rail-days {
  font-size: 9px;
  color: var(--text-dim);
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 8px;
}

.rail-item.active .rail-days {
  color: var(--text-main);
  background: var(--accent-cyan-glow);
}

/* Crop List Styles */
/* Redundant definition removed to avoid conflict with vertical layout */
/* 
.comm-item-new {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px 12px 12px 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 10px;
}
*/

.comm-item-new:hover {
  background: var(--border-soft);
  border-color: var(--accent-cyan-glow);
  transform: translateX(3px);
}

.comm-img-new {
  width: 70px;
  height: 70px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border-soft);
}

.comm-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.comm-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comm-name-new {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

.comm-variety-new {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.5px;
}

.comm-stats-row {
  display: flex;
  gap: 20px;
  align-items: center;
}

.comm-data-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.comm-data-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comm-data-col.price-highlight {
  text-align: right;
}

.data-label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.data-value {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
}

.data-value.modal {
  color: var(--accent-cyan);
  font-size: 16px;
  font-weight: 700;
}

.comm-stat-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.comm-stat-box .label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.comm-stat-box .val {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
}

.comm-stat-box .val.cyan {
  color: var(--accent-cyan);
  font-size: 16px;
  font-weight: 700;
}

.price-trend {
  font-size: 10px;
  font-weight: bold;
  margin-left: 5px;
}

.price-trend.up {
  color: var(--accent-green);
}

.price-trend.down {
  color: var(--accent-red);
}

/* Circular Visualization Styles */
/* Intel Section */
.intel-viz-section {
  padding: 10px 20px 20px 20px;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
}

/* Year Filter Chips */
#year-filter-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 30px;
  z-index: 10;
}

.year-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.year-chip:hover {
  background: var(--border-soft);
  color: var(--text-main);
}

.year-chip.active {
  background: var(--accent-cyan-glow);
  border-color: var(--accent-cyan);
  color: var(--text-main);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.intel-viz-container {
  position: relative;
  width: 320px;
  height: 320px;
  margin: 0 auto;
}

#circular-intel-canvas {
  width: 100%;
  height: 100%;
}

.intel-center-info {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.intel-center-info .month-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 2px;
}

.intel-center-info .volume-label {
  font-size: 16px;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: 1px;
  text-transform: uppercase;
}



.monthly-legend {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.month-tag {
  font-size: 10px;
  color: var(--text-dim);
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid var(--border-soft);
}

/* Price Scale Styles for Crop Cards */
.price-scale {
  position: relative;
  width: 100%;
  height: 30px;
  margin-top: 15px;
}

.price-scale-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-soft);
  transform: translateY(-50%);
}

.price-range-bar {
  position: absolute;
  top: 50%;
  height: 4px;
  background: var(--accent-cyan-glow);
  transform: translateY(-50%);
  border-radius: 2px;
}

.price-dot {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid var(--bg-main);
}

.price-dot.min {
  background: #818cf8;
}

.price-dot.max {
  background: #34d399;
}

.price-dot.modal {
  background: var(--accent-cyan);
  width: 12px;
  height: 12px;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.price-scale-tick {
  position: absolute;
  font-size: 9px;
  color: var(--text-dim);
  transform: translateX(-50%);
  white-space: nowrap;
  top: 100%;
  margin-top: 3px;
}

.price-scale-label {
  position: absolute;
  font-size: 8px;
  color: var(--text-dim);
  transform: translateX(-50%);
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.5px;
}

@media (max-width: 650px) {
  .market-stats-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    width: 100%;
    padding: 0 5px;
    box-sizing: border-box;
    margin-top: 15px;
    /* Pull it up slightly */
  }

  .market-stat-card {
    min-width: 0;
    padding: 6px 2px;
    /* Much tighter padding */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    /* Slightly smaller radius */
  }

  .market-stat-card .label {
    font-size: 7px;
    /* Smaller label */
    letter-spacing: 0.5px;
    text-align: center;
    margin-bottom: 2px;
  }

  .market-stat-card .value {
    font-size: 13px;
    /* Slightly smaller value */
    text-align: center;
  }

  .comm-item-new {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .comm-stats-row {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }
}

/* ================== SKELETON LOADING (SEQUENTIAL) ================== */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--bg-surface);
}

.skeleton::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background-image: linear-gradient(90deg,
      rgba(255, 255, 255, 0) 0,
      var(--border-soft) 20%,
      var(--bg-card) 60%,
      rgba(255, 255, 255, 0));
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

#map-container.skeleton {
  background: var(--bg-main);
}

#controls-container.skeleton {
  background: var(--bg-main);
  border-top: 1px solid var(--border-main);
}

.skeleton>* {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.skeleton-revealed>* {
  opacity: 1;
}

/* Debug Status Pill (Bottom Left) */
#debug-status-pill {
  position: fixed;
  bottom: 10px;
  left: 10px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-main);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-dim);
  z-index: 9000;
  font-family: monospace;
  pointer-events: none;
  display: flex;
  gap: 8px;
  align-items: center;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-main);
}

.status-dot.ok {
  background: #00ff00;
  box-shadow: 0 0 5px #00ff00;
}

.status-dot.warn {
  background: #ff9f43;
}

.status-dot.error {
  background: #ff4444;
  box-shadow: 0 0 5px #ff4444;
}

/* Global Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  background-color: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background-color: var(--border-main);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-dim);
}


/* ================== AUTH PROMPT OVERLAY ================== */
#auth-prompt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  z-index: 200000;
  display: none;
  /* Changed from dynamic hide to explicit hide */
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#auth-prompt-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.auth-modal {
  background: var(--bg-header);
  border: 1px solid var(--border-main);
  padding: 40px;
  border-radius: 24px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

#auth-prompt-overlay.visible .auth-modal {
  transform: scale(1) translateY(0);
}

.auth-modal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
}

.auth-icon-circle {
  width: 60px;
  height: 60px;
  background: var(--accent-green-glow);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: var(--accent-green);
}

.btn-auth-primary {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--primary-gradient);
  color: var(--text-inverse);
  text-decoration: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.btn-auth-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px var(--accent-green-glow);
}

.btn-auth-secondary {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: #666;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-auth-secondary:hover {
  color: var(--text-main);
  background: var(--bg-card);
}

/* ================== CATEGORY BAR CHART ================== */
.category-analysis-container {
  margin-bottom: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 20px 20px 0;
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.header-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.analysis-header h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.analysis-stats-summary {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  opacity: 0.8;
}

.analysis-stats-summary span {
  color: var(--accent-cyan);
}

#analysis-date-note {
  font-size: 11px;
  color: var(--accent-cyan);
  background: rgba(0, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
}

.bar-chart-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: auto;
  padding-top: 0;
  padding-bottom: 0;
  justify-content: space-between;
  box-sizing: border-box;
}

.category-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: auto;
  align-self: flex-end;
  min-width: 0;
  overflow: visible;
}

.bar-visual {
  width: 14px;
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 4px;
  cursor: pointer;
}

.bar-visual:hover {
  filter: brightness(1.2);
  transform: scaleY(1.05);
}

.bar-val-vertical {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%) rotate(-90deg);
  transform-origin: center center;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
  color: rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.bar-label {
  display: block;
  font-size: 14px;
  margin-top: 6px;
  text-align: center;
  opacity: 0.5;
  transition: opacity 0.25s ease, transform 0.25s ease;
  cursor: pointer;
}

.category-bar-item:hover .bar-label {
  opacity: 0.85;
}

.category-bar-item.active .bar-label {
  opacity: 1;
  transform: scale(1.2);
}

/* Category Specific Colors */
.cat-color-1 {
  background: #3b82f6;
}

/* Cereals - Blue */
.cat-color-12 {
  background: #8b5cf6;
}

/* Pulses - Purple */
.cat-color-14 {
  background: #22c55e;
}

/* Vegetables - Green */
.cat-color-7 {
  background: #ef4444;
}

/* Fruits - Red */
.cat-color-13 {
  background: #f59e0b;
}

/* Spices - Amber */
.cat-color-9 {
  background: #06b6d4;
}

/* Oilseeds - Cyan */
.cat-color-3 {
  background: #ec4899;
}

/* Dry Fruits - Pink */
.cat-color-4 {
  background: #6366f1;
}

/* Fibre Crops - Indigo */
.cat-color-2 {
  background: #a16207;
}

/* Drug & Narcotics - Brown */
.cat-color-6 {
  background: #059669;
}

/* Forest Products - Emerald */
.cat-other {
  background: #64748b;
}

.btn-auth-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px var(--accent-green-glow);
}

.btn-auth-secondary {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: #666;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-auth-secondary:hover {
  color: var(--text-main);
  background: var(--bg-card);
}

/* ================== CATEGORY BAR CHART ================== */
.category-analysis-container {
  margin-bottom: 25px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 20px 20px 0;
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.header-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.analysis-header h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.analysis-stats-summary {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  opacity: 0.8;
}

.analysis-stats-summary span {
  color: var(--accent-cyan);
}

#analysis-date-note {
  font-size: 11px;
  color: var(--accent-cyan);
  background: rgba(0, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
}

.bar-chart-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: auto;
  padding-top: 0;
  padding-bottom: 0;
  justify-content: space-between;
  box-sizing: border-box;
}

.category-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: auto;
  align-self: flex-end;
  min-width: 0;
  overflow: visible;
}

.bar-visual {
  width: 14px;
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 4px;
  cursor: pointer;
}

.bar-visual:hover {
  filter: brightness(1.2);
  transform: scaleY(1.05);
}

.bar-val-vertical {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%) rotate(-90deg);
  transform-origin: center center;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
  color: rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.bar-label {
  display: block;
  font-size: 14px;
  margin-top: 6px;
  text-align: center;
  opacity: 0.5;
  transition: opacity 0.25s ease, transform 0.25s ease;
  cursor: pointer;
}

.category-bar-item:hover .bar-label {
  opacity: 0.85;
}

.category-bar-item.active .bar-label {
  opacity: 1;
  transform: scale(1.2);
}

/* Category Specific Colors */
.cat-color-1 {
  background: #3b82f6;
}

/* Cereals - Blue */
.cat-color-12 {
  background: #8b5cf6;
}

/* Pulses - Purple */
.cat-color-14 {
  background: #22c55e;
}

/* Vegetables - Green */
.cat-color-7 {
  background: #ef4444;
}

/* Fruits - Red */
.cat-color-13 {
  background: #f59e0b;
}

/* Spices - Amber */
.cat-color-9 {
  background: #06b6d4;
}

/* Oilseeds - Cyan */
.cat-color-3 {
  background: #ec4899;
}

/* Dry Fruits - Pink */
.cat-color-4 {
  background: #6366f1;
}

/* Fibre Crops - Indigo */
.cat-color-2 {
  background: #a16207;
}

/* Drug & Narcotics - Brown */
.cat-color-6 {
  background: #059669;
}

/* Forest Products - Emerald */
.cat-other {
  background: #64748b;
}

/* Other - Slate */

/* Chips color overrides */
/* Chips color overrides - Inactive (Outline) */
.chip.cat-color-1 {
  border-color: #3b82f6;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.chip.cat-color-12 {
  border-color: #8b5cf6;
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
}

.chip.cat-color-14 {
  border-color: #22c55e;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}

.chip.cat-color-7 {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.chip.cat-color-13 {
  border-color: #f59e0b;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.chip.cat-color-9 {
  border-color: #06b6d4;
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.1);
}

.chip.cat-color-3 {
  border-color: #ec4899;
  color: #ec4899;
  background: rgba(236, 72, 153, 0.1);
}

.chip.cat-color-4 {
  border-color: #6366f1;
  color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
}

.chip.cat-color-2 {
  border-color: #a16207;
  color: #a16207;
  background: rgba(161, 98, 7, 0.1);
}

.chip.cat-color-6 {
  border-color: #059669;
  color: #059669;
  background: rgba(5, 150, 105, 0.1);
}

/* Active State (Solid) */
.chip.cat-color-1.active {
  background: #3b82f6 !important;
  border-color: #3b82f6;
  color: white;
}

.chip.cat-color-12.active {
  background: #8b5cf6 !important;
  border-color: #8b5cf6;
  color: white;
}

.chip.cat-color-14.active {
  background: #22c55e !important;
  border-color: #22c55e;
  color: white;
}

.chip.cat-color-7.active {
  background: #ef4444 !important;
  border-color: #ef4444;
  color: white;
}

.chip.cat-color-13.active {
  background: #f59e0b !important;
  border-color: #f59e0b;
  color: white;
}

.chip.cat-color-9.active {
  background: #06b6d4 !important;
  border-color: #06b6d4;
  color: white;
}

.chip.cat-color-3.active {
  background: #ec4899 !important;
  border-color: #ec4899;
  color: white;
}

.chip.cat-color-4.active {
  background: #6366f1 !important;
  border-color: #6366f1;
  color: white;
}

.chip.cat-color-2.active {
  background: #a16207 !important;
  border-color: #a16207;
  color: white;
}

.chip.cat-color-6.active {
  background: #059669 !important;
  border-color: #059669;
  color: white;
}

.chip .chip-name {
  font-size: 12px;
  font-weight: 700;
}

.chip .chip-stats {
  font-size: 9px;
  opacity: 0.7;
  font-weight: 500;
}

.bs-chip-carousel {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.bs-chip-carousel::-webkit-scrollbar {
    display: none;
}

.bs-chip {
    padding: 8px 16px;
    border-radius: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-soft);
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.bs-chip.active {
    background: var(--accent-green-glow);
    border-color: var(--accent-green);
    color: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green-glow);
}

/* Globally Hide Debug Status Elements */
#backend-status,
#debug-overlay {
  display: none !important;
}

/* ===== MARKET PAGE: CROP CARD (REDESIGNED) ===== */
.commodity-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px 80px;
}

.comm-item-new {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 14px 16px 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 5px;
}

/* 52-Week Price Bar Redesign */
.price-range-container {
  margin: 12px 0 8px;
  width: 100%;
}

.price-range-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  padding: 0 2px;
}

.range-low, .range-high {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  font-family: 'Inter', sans-serif;
}

.range-title {
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-dim);
  opacity: 0.5;
  letter-spacing: 0.8px;
}

.price-range-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  position: relative;
  overflow: visible;
}

.range-fill {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg, #22d3ee, #22c55e);
  opacity: 0.6;
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.3);
}

.modal-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: #22c55e;
  border: 2.5px solid #050505;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
  z-index: 2;
}

.comm-item-new:hover {
  background: var(--border-soft);
  border-color: var(--text-dim);
}

/* Top row: image + name */
.comm-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding-right: 32px;
  /* Fixed: Prevent overlap with top-right graph icon */
  box-sizing: border-box;
}

.comm-img-new {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-surface);
}

.comm-title {
  flex: 1;
  min-width: 0;
}

.comm-name-new {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comm-variety-new {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comm-graph-btn {
  position: absolute;
  /* Fixed: Force top-right positioning */
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  background: var(--accent-cyan-glow);
  border: 1px solid var(--accent-cyan-glow);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 0;
}

.comm-graph-btn:hover {
  background: var(--accent-cyan-glow);
  border-color: var(--accent-cyan);
  transform: scale(1.15);
  box-shadow: 0 0 15px var(--accent-cyan-glow);
}

/* 52-week price bar */
.price-scale {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.price-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.price-scale-track {
  position: relative;
  height: 2px;
  background: var(--border-soft);
  border-radius: 2px;
  overflow: visible;
  margin: 6px 0;
}

.price-range-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 2px;
  background: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan-glow);
  border-radius: 2px;
}

.price-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--bg-main);
  z-index: 2;
}

.price-dot.min {
  background: #3b82f6;
}

.price-dot.max {
  background: #ef4444;
}

.price-dot.modal {
  background: #22c55e;
  width: 10px;
  height: 10px;
}

/* Bottom stats row */
.comm-stats-row {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border-soft);
  padding-top: 10px;
}

.comm-stat-cell {
  flex: 1;
  text-align: center;
  padding: 0 4px;
}

.comm-stat-cell+.comm-stat-cell {
  border-left: 1px solid var(--border-soft);
}

.comm-stat-cell.highlight .data-value.modal {
  color: #22c55e;
  font-weight: 700;
}

.data-label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.data-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

/* Simplified Search UI Styles */
.search-wrap:focus-within {
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 8px var(--accent-cyan-glow);
}

.search-wrap:hover {
  border-color: #666 !important;
}

/* ================== MARKET SOCIAL MEDIA FEED ================== */
#market-social-feed {
  margin: 20px auto;
  max-width: 95%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.social-feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 15px;
  margin-left: 10px;
  margin-right: 10px;
}

.social-feed-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

.social-filter-tabs {
  display: flex;
  gap: 10px;
}

.social-tab {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.social-tab.has-sublabel {
  padding: 4px 14px;
}

.social-tab.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: var(--text-inverse);
  box-shadow: 0 0 15px var(--accent-cyan-glow);
}

/* Post Input Box */
.post-input-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
  /* For preview tags */
  margin-left: 10px;
  margin-right: 10px;
}

.composer-wrapper {
  position: relative;
  width: 100%;
  min-height: 110px;
  background: transparent;
}

#social-post-text {
  position: relative;
  width: 100%;
  min-height: 110px;
  background: transparent;
  border: none;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: #fff !important;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  padding: 10px !important;
  margin: 0;
  resize: none;
  outline: none;
  z-index: 2;
  white-space: pre-wrap;
  word-wrap: break-word;
  -webkit-text-fill-color: transparent !important;
  caret-color: #fff !important;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  padding: 10px !important;
  margin: 0;
  resize: none;
  outline: none;
  z-index: 2;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
  box-sizing: border-box;
}

.highlighter {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  padding: 10px !important;
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
  z-index: 1;
  pointer-events: none;
  box-sizing: border-box;
}

/* Tag Styles in Highlighter */
.hl-purpose {
  color: var(--accent-green);
  /* font-weight: 700 removed for alignment */
  background: rgba(34, 197, 94, 0.1);
  border-radius: 4px;
  padding: 0;
}

.hl-crop {
  color: var(--accent-cyan);
  /* font-weight: 700 removed for alignment */
  background: rgba(0, 255, 255, 0.1);
  border-radius: 4px;
  padding: 0;
}

.hl-market {
  color: #60a5fa;
  /* Blue-400 matching design system */
  /* font-weight: 700 removed for alignment */
  background: rgba(96, 165, 250, 0.1);
  border-radius: 4px;
  padding: 0;
}

#social-post-text::placeholder {
  color: rgba(255, 255, 255, 0.25) !important;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.25) !important;
}

.btn-post-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px var(--accent-green-glow);
}

/* Social Post Cards */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  transition: background 0.3s;
  position: relative;
  /* For top-right tags */
}
.post-card:hover {
  background: var(--border-soft);
}

.post-hashtag {
  color: var(--accent-cyan);
  font-weight: 700;
  opacity: 0.7;
  cursor: pointer;
  transition: filter 0.2s;
  text-shadow: 0 0 5px var(--accent-cyan-glow);
}

.post-mention {
  color: #ffc800;
  font-weight: 700;
  opacity: 0.7;
  cursor: pointer;
  transition: filter 0.2s;
  text-shadow: 0 0 5px rgba(255, 200, 0, 0.3);
}

.hl-purpose { color: #22c55e; font-weight: 700; opacity: 0.9; }
.hl-crop { color: #00ffff; font-weight: 700; opacity: 0.9; }
.hl-market { color: #ffc800; font-weight: 700; opacity: 0.9; }

.home-post-btn {
  background: var(--accent-green);
  color: var(--text-inverse);
  border: none;
  padding: 7px 14px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.post-hashtag:hover, .post-mention:hover {
  filter: brightness(1.3);
  text-decoration: underline;
  opacity: 1;
}

.tag-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 0 4px 0 0;
  text-transform: lowercase;
  letter-spacing: 0.3px;
  display: inline-block;
  transition: all 0.2s;
  background: transparent;
  border: none;
  opacity: 0.65;
}

.tag-badge:hover {
  opacity: 1;
}

.post-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.tag-context {
  color: var(--accent-cyan);
  background: transparent;
  border: none;
}

/* Distinct color for Market tags if both present */
.tag-context[innerHTML^="@"], .tag-market {
  color: #ffc800 !important;
  background: transparent !important;
  border: none !important;
}

.tag-purpose {
  /* margin-right removed in favor of gap */
}

.tag-purpose.sell {
  color: var(--accent-green) !important;
}

.tag-purpose.buy {
  color: var(--accent-cyan) !important;
}

.tag-purpose.oth {
  color: var(--accent-price) !important;
}

#social-posts-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Draft Preview Tags */
#draft-preview-tags {
  position: absolute;
  top: 10px;
  right: 15px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.draft-tag {
  font-size: 7px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 8px;
  text-transform: uppercase;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-main);
  box-shadow: var(--shadow-modal);
  z-index: 20;
}

.post-card-header {
  display: flex;
  gap: 12px;
  align-items: center;
  height: 50px;
  margin-bottom: 0;
}

.post-avatar-wrap {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-soft);
}

.profile-img,
.post-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-user-info {
  flex: 1;
}

.post-user-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-meta {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.post-location-tag {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 8px;
}

.post-category-badge {
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Content & Media */
.post-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
}

.post-media-grid {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 12px;
  padding-bottom: 8px;
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE and Edge */
}

.post-media-grid::-webkit-scrollbar {
  display: none;
  /* Hide scrollbar for Chrome, Safari and Opera */
}

.post-media-wrapper {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-main);
  flex-shrink: 0;
  width: 140px;
  height: 140px;
  border: 1px solid var(--border-soft);
}

.post-media-wrapper img,
.post-media-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-timestamp {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  color: rgba(255, 255, 255, 0.8);
  font-size: 7.5px;
  padding: 12px 6px 4px;
  font-weight: 700;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  z-index: 5;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Journal Timeline Styles */
.journal-container {
  max-width: 100%;
  margin: 0;
  padding: 20px;
  position: relative;
}

.activity-entry {
  position: relative;
  padding-left: 28px;
  margin-bottom: 24px;
  z-index: 2;
}

.activity-entry::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 10px; /* Start from the dot center */
  bottom: -24px; /* Connect to next entry's dot */
  width: 2px;
  background: var(--accent-green-glow);
  z-index: 1;
}

.activity-entry:last-child::before {
  display: none; /* No line after the last dot */
}

.activity-dot {
  position: absolute;
  left: 6px;
  top: 0;
  width: 10px;
  height: 10px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-green-glow);
}

.activity-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.activity-date {
  font-size: 11px;
  color: var(--accent-green);
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
}

/* Inquiry Section Styles */
.replies-section {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--border-soft);
}

.reply-input-wrap {
  display: flex;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 10px;
}

.reply-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 13px;
  outline: none;
}

.reply-input-wrap button {
  background: #22c55e;
  color: #000;
  border: none;
  padding: 4px 12px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.reply-input-wrap button:hover {
  background: #16a34a;
}
}

.activity-media {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.activity-media img,
.activity-media video {
  width: 100% !important;
  height: auto !important;
  max-height: 700px;
  border-radius: 12px;
  object-fit: contain;
  display: block;
  background: var(--bg-surface-elevated);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Global Chat & Journal Aesthetics */
.msg-history {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px;
  overflow-y: auto;
}

.msg-bubble {
  width: 100%;
  max-width: 100%;
  padding: 20px 24px;
  border-radius: 24px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  box-sizing: border-box;
}

.activity-media img,
.activity-media video {
  height: 240px;
  width: auto;
  border-radius: 8px;
  object-fit: cover;
}

.msg-bubble.received {
  align-self: flex-start;
  background: var(--bg-surface);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Light Mode specific contrast fix */
[data-theme="light"] .msg-bubble.received {
  background: #ffffff;
  color: #1a1a1a;
  border-color: #e2e8f0;
}

.msg-bubble.sent {
  align-self: flex-end;
  background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 210, 255, 0.15);
}

.msg-sender-tag {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.msg-ts-tag {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 6px;
  display: block;
  text-align: right;
}

.chat-input-footer {
  padding: 12px 16px;
  background: var(--bg-header);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-attach-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-attach-btn:hover {
  background: var(--accent-cyan-glow);
  border-color: var(--accent-cyan);
  transform: scale(1.05);
}

.chat-input-field {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 24px;
  padding: 10px 18px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input-field:focus {
  border-color: var(--accent-cyan);
}

.chat-send-btn {
  background: var(--accent-cyan);
  color: var(--text-inverse);
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-send-btn:hover {
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
  transform: scale(1.05);
}

.last-updated-tag {
  font-size: 8px;
  color: #ffd700;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 8px;
  padding: 1px 6px;
  background: rgba(255, 215, 0, 0.1);
  border: 0.5px solid rgba(255, 215, 0, 0.2);
  border-radius: 4px;
}


.post-action {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #888;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

.post-card-footer {
  display: flex;
  flex-direction: column;
  margin-top: 5px;
  position: relative;
}

.post-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
  margin-bottom: 6px;
  padding-left: 2px;
}

.footer-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 8px; /* Vertical gap 12px if wrapped, horizontal 8px */
  padding-top: 12px;
  padding-bottom: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-stats {
  display: flex;
  gap: 16px; /* Slightly tighter gap */
}

@media (max-width: 400px) {
  .footer-stats {
    gap: 12px;
  }
  .post-contact-btn {
    flex: 1; /* Stretch button if it wraps alone */
    min-width: 100px;
  }
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #999;
  cursor: pointer;
  transition: color 0.2s;
}

.action-btn:hover {
  color: var(--accent-cyan);
}

.post-contact-btn {
  background: transparent;
  border: 1.5px solid var(--accent-cyan);
  color: var(--accent-cyan);
  padding: 4px 12px;
  border-radius: 18px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}

.post-contact-btn:hover {
  background: var(--accent-cyan);
  color: var(--text-inverse);
  box-shadow: 0 0 20px var(--accent-cyan-glow);
}

.contact-btn {
  color: var(--accent-cyan) !important;
  text-shadow: 0 0 10px var(--accent-cyan-glow);
  transition: all 0.3s ease;
}

.contact-btn:hover {
  transform: scale(1.2);
  filter: drop-shadow(0 0 8px var(--accent-cyan));
}

.contact-btn iconify-icon {
  animation: contact-pulse 2s infinite;
}

@keyframes contact-pulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 0px var(--accent-cyan)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 5px var(--accent-cyan)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0px var(--accent-cyan)); }
}

.action-btn.liked {
  color: #ef4444;
  /* Heart Red */
}

/* Nested Replies */
.replies-section {
  margin-top: 15px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.reply-card {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  animation: fadeIn 0.3s ease;
}

.reply-avatar-wrap {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.reply-profile-img,
.reply-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
}

.reply-content {
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: 12px;
  flex: 1;
}

.reply-user {
  font-size: 11px;
  font-weight: 800;
  color: #60a5fa;
  margin-bottom: 2px;
}

.reply-text {
  font-size: 12.5px;
  color: #ccc;
  line-height: 1.4;
}

.reply-date {
  font-size: 9px;
  color: #555;
  margin-top: 4px;
}

.reply-input-wrap {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.reply-input-wrap input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 12px;
  outline: none;
}

.reply-input-wrap button {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 0 15px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* Media Previews */
#media-preview-container {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.media-preview-item {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}

.media-preview-item img,
.media-preview-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-media-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: rgba(239, 68, 68, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.remove-media-btn:hover {
  background: #ef4444;
  transform: scale(1.1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hidden Bot UI */
#market-mitra-launcher,
#market-mitra-chat {
  display: none !important;
}

.social-feed-info-wrap {
  flex: 1;
}

.social-stats-label {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
  font-weight: 500;
}

.social-feed-transition {
  font-size: 12px;
  color: var(--text-main);
  font-weight: 600;
  text-align: center;
  padding: 20px 10px;
  width: 100%;
  opacity: 1;
}

/* Purpose Chips Filters & Selectors */
.post-input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
}

.post-tools {
  display: flex;
  gap: 15px;
  align-items: center;
}

.post-purpose-selection {
  display: flex;
  gap: 6px;
  align-items: center;
}

.social-purpose-filters {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 12px 5px;
  margin: 10px 0;
  scrollbar-width: none;
}

.social-purpose-filters::-webkit-scrollbar {
  display: none;
}

.purpose-filter-chip {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.purpose-filter-chip:hover {
  background: rgba(255, 255, 255, 0.1);
}

.purpose-filter-chip.active[data-val="ALL"] {
  background: #334155;
  color: #fff;
  border-color: #475569;
}

.purpose-filter-chip.active[data-val="SELL"] {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: #10b981;
}

.purpose-filter-chip.active[data-val="BUY"] {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border-color: #3b82f6;
}

.purpose-filter-chip.active[data-val="OTH"] {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: #f59e0b;
}

.feed-search-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 4px 10px;
  margin-left: 4px;
  min-width: 80px;
}

.feed-search-wrap iconify-icon {
  font-size: 14px;
  color: var(--text-dim);
  margin-right: 6px;
}

.feed-search-wrap input {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 10px;
  outline: none;
  width: 100%;
}

.purpose-sel-chip {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s;
  white-space: nowrap;
}

.purpose-sel-chip[data-val="SELL"].active {
  border-color: var(--accent-green);
  color: var(--accent-green);
  background: var(--accent-green-glow);
  box-shadow: 0 0 10px var(--accent-green-glow);
}

.purpose-sel-chip[data-val="BUY"].active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: var(--accent-cyan-glow);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.purpose-sel-chip[data-val="OTH"].active {
  border-color: var(--accent-price);
  color: var(--accent-price);
  background: var(--accent-price-glow);
  box-shadow: 0 0 10px var(--accent-price-glow);
}

.purpose-tag-feed {
  font-size: 9px;
  padding: 0;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-left: 4px;
  text-transform: lowercase;
  opacity: 0.6;
  background: transparent !important;
  border: none !important;
}

.purpose-tag-feed.sell {
  color: #10b981;
}

.purpose-tag-feed.buy {
  color: #60a5fa;
}

.purpose-tag-feed.oth {
  color: #fbbf24;
}

/* Scroll to Top Button */
#btn-scroll-top {
  position: fixed;
  bottom: 30px;
  right: 25px;
  z-index: 9999;
  background: #10b981;
  color: white;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transform: translateY(20px);
  outline: none;
}

#btn-scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#btn-scroll-top:hover {
  background: #059669;
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.4);
}

#btn-scroll-top:active {
  transform: scale(0.95);
}

/* Live Status Badge & Breathing Effect */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.5px;
  border: 1px solid rgba(16, 185, 129, 0.2);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  margin-left: 8px;
  vertical-align: middle;
}

.live-badge:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.live-timeline-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 6px 0;
  box-sizing: border-box;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(16, 185, 129, 0.02);
  transition: background 0.2s;
}

.live-timeline-column:hover {
  background: rgba(16, 185, 129, 0.1);
}

.breathing-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: breathing 2s ease-in-out infinite;
}

@keyframes breathing {
  0% {
    transform: scale(0.85);
    box-shadow: 0 0 0px rgba(16, 185, 129, 0);
  }

  50% {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
  }

  100% {
    transform: scale(0.85);
    box-shadow: 0 0 0px rgba(16, 185, 129, 0);
  }
}

.live-pulse-text {
  animation: textPulse 2s ease-in-out infinite;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

@keyframes textPulse {
  0% {
    transform: scale(1);
    opacity: 0.9;
    text-shadow: 0 0 5px rgba(16, 185, 129, 0.2);
  }

  50% {
    transform: scale(1.05);
    opacity: 1;
    text-shadow: 0 0 15px rgba(16, 185, 129, 0.8);
  }

  100% {
    transform: scale(1);
    opacity: 0.9;
    text-shadow: 0 0 5px rgba(16, 185, 129, 0.2);
  }
}

@media (max-width: 768px) {
  #btn-scroll-top {
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
  }
}

/* Floating Scroll Button (Market Page) */
#floating-scroll-btn {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 50px;
  height: 50px;
  background: #10b981;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  z-index: 2000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#floating-scroll-btn:hover {
  transform: scale(1.1) translateY(-5px);
  background: #059669;
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.4);
}

#floating-scroll-btn svg {
  transition: transform 0.3s;
}

#floating-scroll-btn:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  #floating-scroll-btn {
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
  }
}

/* Social Post Delete Button */
.delete-post-btn {
  background: transparent;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

.delete-post-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.delete-post-btn svg {
  display: block;
}

/* AGMART CUSTOM CAMERA UI */
#agmart-camera-overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: #000;
  z-index: 99999 !important;
  display: none;
  flex-direction: column;
  color: white;
  font-family: 'Outfit', sans-serif;
}

#camera-stream {
  flex: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(1);
}

.camera-ui-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  padding: 30px 20px 50px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 0%, transparent 15%, transparent 85%, rgba(0, 0, 0, 0.5) 100%);
}

.camera-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: auto;
}

.camera-close-btn {
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.camera-timer-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(239, 68, 68, 0.8);
  padding: 6px 15px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.3s;
}

.camera-timer-wrap.active {
  opacity: 1;
}

.hourglass-icon {
  width: 20px;
  height: 20px;
  display: none;
}

.hourglass-icon.active {
  display: block;
  animation: hourglass-spin 2s infinite ease-in-out;
}

@keyframes hourglass-spin {
  0% {
    transform: rotate(0deg);
  }

  50% {
    transform: rotate(180deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.camera-bottom-actions {
  display: flex;
  justify-content: space-around;
  align-items: center;
  pointer-events: auto;
}

.shutter-btn {
  width: 76px;
  height: 76px;
  background: white !important;
  border: 5px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: 50% !important;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  cursor: pointer;
  padding: 0;
}

.shutter-btn:active {
  transform: scale(0.9);
  background: #eee !important;
}

.shutter-inner {
  width: 58px;
  height: 58px;
  border: 2px solid #000;
  border-radius: 50%;
  pointer-events: none;
}

/* CAMERA FLASH EFFECT */
#camera-flash {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 100000;
  display: none;
  pointer-events: none;
}

@keyframes flash-anim {
  0% {
    opacity: 0;
    display: block;
  }

  30% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    display: none;
  }
}

.camera-flash-active {
  display: block !important;
  animation: flash-anim 0.3s ease-out forwards;
}

.record-btn {
  width: 76px;
  height: 76px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.record-inner {
  width: 60px;
  height: 60px;
  background: #ef4444;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.record-btn.recording .record-inner {
  border-radius: 12px;
  transform: scale(0.6);
}

#timer-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 900;
  color: white;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  z-index: 10;
}

.camera-flip-btn {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.camera-mode-switcher {
  position: absolute;
  bottom: 195px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 30px;
  pointer-events: auto;
  z-index: 6;
}

.mode-tab {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.6);
  padding-bottom: 5px;
  border-bottom: 2px solid transparent;
}

.mode-tab.active {
  color: #10b981;
  border-color: #10b981;
}

.gallery-fallback-link {
  margin-top: 15px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: underline;
  cursor: pointer;
  pointer-events: auto;
  text-align: center;
}

.camera-user-card {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 5;
}

.camera-user-card img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid #10b981;
  object-fit: cover;
}

.camera-user-card .user-name {
  font-size: 12px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
}

.camera-gps-card {
  position: absolute;
  bottom: 80px;
  left: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  gap: 15px;
  z-index: 5;
  overflow: visible;
}

.gps-map-inset {
  width: 80px;
  height: 80px;
  background: #111;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  flex-shrink: 0;
}

.gps-map-inset img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gps-data-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.gps-address {
  font-size: 13px;
  font-weight: 800;
  color: #10b981;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gps-coords {
  font-family: monospace;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.5px;
}

.gps-timestamp {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
}

.trusted-seal {
  position: absolute;
  top: -8px;
  right: 12px;
  background: #10b981;
  color: black;
  font-size: 8px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* AgMart Premium Navigation Redesign - Hardened for Global Visibility */
.floating-footer {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-header) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid var(--accent-cyan-border) !important;
  box-shadow: var(--shadow-modal), 0 0 10px var(--accent-cyan-glow) !important;
  border-radius: 40px;
  padding: 4px 12px !important;
  display: flex !important;
  align-items: center;
  gap: 2px !important;
  z-index: 9999 !important;
  min-width: 320px;
  height: 40px !important; /* Further reduced height */
  padding: 0 8px !important; /* Tightened padding */
  pointer-events: auto;
}

.nav-zone {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-divider {
  width: 1px;
  height: 18px !important;
  background: var(--border-soft);
  margin: 0 4px !important;
}

.nav-btn {
  display: flex;
  flex-direction: row; /* Horizontal layout */
  align-items: center;
  justify-content: center;
  gap: 4px !important; /* Reduced gap */
  padding: 4px 10px !important; /* Tightened padding */
  border-radius: 24px;
  color: var(--text-dim);
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1;
  cursor: pointer;
  position: relative;
  border: none !important;
  background: transparent !important;
}

/* Present Zone (Home) */
.zone-present .nav-btn.active {
  color: var(--accent-green) !important;
  background: var(--accent-green-glow) !important;
  border: 1px solid var(--accent-green-glow) !important;
}

/* Past Zone (Crops/Markets) */
.zone-past .nav-btn.active {
  color: var(--accent-cyan) !important;
  background: var(--accent-cyan-glow) !important;
  border: 1px solid var(--accent-cyan-border) !important;
}

.nav-btn iconify-icon {
  font-size: 16px !important;
}

.nav-btn span {
  font-size: 9px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.3px !important;
}

/* Live Indicator for Home */
.live-indicator {
  position: absolute;
  top: 8px;
  right: 20px;
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
  animation: nav-pulse 2s infinite;
}

@keyframes nav-pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.5);
    opacity: 0.5;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}




/* Global Aesthetics: Subtle Placeholders */
::placeholder {
  color: #94a3b8 !important;
  opacity: 0.4 !important;
  font-weight: 400 !important;
}

:-ms-input-placeholder {
  color: #94a3b8 !important;
  opacity: 0.4 !important;
}

::-ms-input-placeholder {
  color: #94a3b8 !important;
  opacity: 0.4 !important;
}

/* --- DASHBOARD OVERHAUL: INSIGHTS MODAL --- */
#insights-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#insights-modal.active {
  display: flex;
}

#insights-modal-content h3 {
  font-size: 16px;
  color: var(--accent-cyan);
  margin: 20px 0 10px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#insights-modal-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#insights-modal-content li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text-main);
}

#insights-modal-content li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-cyan);
  font-weight: bold;
}

#insights-btn:active {
  transform: scale(0.9);
}

/* --- DASHBOARD OVERHAUL: INTEGRATED LIST --- */
#market-list-view {
  visibility: visible !important;
  pointer-events: auto !important;
  position: relative !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

#market-list-view .market-item {
  transition: background 0.2s;
}

#market-list-view .market-item:hover {
  background: rgba(6, 182, 212, 0.05);
}

.sort-chip.active {
  background: var(--accent-cyan);
  color: #000;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

/* Composer Highlighter Colors */
.hl-purpose {
  color: #22c55e;
  font-weight: 700;
  opacity: 0.9;
}

.hl-crop {
  color: #00ffff;
  font-weight: 700;
  opacity: 0.9;
}

.hl-market {
  color: #ffc800;
  font-weight: 700;
  opacity: 0.9;
}

/* Placeholder Styling for Highlighter */
.placeholder-wrap {
  opacity: 0.5;
  font-style: italic;
  font-size: 13px;
}

.composer-wrapper textarea::placeholder {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  opacity: 0 !important;
}

/* Global Composer Styles moved from homepage.html */
.home-composer {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  margin-bottom: 12px;
}

.home-composer .composer-wrapper {
  position: relative;
  width: 100%;
  min-height: 110px;
}

.home-composer #social-post-text {
  position: relative;
  padding: 10px !important;
  min-height: 110px;
  background: transparent;
  border: none;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: #fff !important;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  width: 100%;
  font-family: inherit;
  z-index: 2;
  overflow-y: auto;
  box-sizing: border-box;
}

.home-composer .highlighter {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 10px !important;
  box-sizing: border-box;
  overflow-y: auto;
}

.home-tool-btn {
  background: none;
  border: none;
  padding: 4px;
  color: var(--accent-cyan);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.home-tool-btn:hover {
  color: #fff;
}

.home-post-btn {
  background: var(--accent-green);
  color: var(--text-inverse);
  border: none;
  padding: 7px 14px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.home-post-btn:hover {
  box-shadow: 0 5px 15px var(--accent-green-glow);
}

/* Glass Header System */
.glass-header {
  background: var(--bg-header) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 3000;
}

/* Drawer System */
#drawer-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: var(--bg-overlay) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  z-index: 9500 !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

#drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

#user-drawer {
  position: fixed !important;
  top: 0 !important;
  left: -320px !important;
  width: 300px !important;
  height: 100% !important;
  background: var(--bg-drawer) !important;
  border-right: 1px solid var(--border-soft) !important;
  z-index: 10000 !important;
  transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex !important;
  flex-direction: column !important;
  box-shadow: var(--shadow-modal) !important;
}

#user-drawer.active {
  left: 0 !important;
}

.drawer-header {
  padding: 40px 25px 30px;
  background: linear-gradient(to bottom, rgba(16, 185, 129, 0.1), transparent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.drawer-user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.drawer-avatar {
  width: 54px;
  height: 54px;
  background: var(--bg-surface-elevated);
  border: 2px solid var(--accent-green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 20px;
  color: var(--accent-green);
}

.drawer-menu {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
}

.drawer-item {
  padding: 12px 25px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}

.drawer-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.drawer-section-label {
  padding: 20px 25px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.6;
}

.drawer-footer {
  padding: 20px;
  border-top: 1px solid var(--border-soft);
}

.logout-btn-drawer {
  width: 100%;
  padding: 12px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 12px;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.logout-btn-drawer:hover {
  background: #ef4444 !important;
  color: #fff !important;
}

.theme-selector-wrap {
  padding: 0 25px;
  margin-top: 10px;
}

.theme-segmented-ctrl {
  display: flex;
  background: var(--bg-surface-elevated);
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
}

.theme-btn {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.theme-btn.active {
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
}

/* Drawer Contact Info */
.drawer-contact-info {
  padding: 12px 20px;
  margin-top: auto;
  border-top: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.1);
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--text-dim);
  font-size: 9px;
  font-weight: 500;
  transition: color 0.2s;
  cursor: pointer;
}

.contact-row:hover {
  color: var(--text-main);
}

.contact-row:last-child {
  margin-bottom: 0;
}

.contact-row iconify-icon {
  font-size: 12px;
  color: var(--accent-cyan);
}




/* LIGHT MODE COMPATIBILITY */
html[data-theme='light'] .header-title-main { color: var(--text-main) !important; }
html[data-theme='light'] .header-title-sub { color: var(--text-dim) !important; }
html[data-theme='light'] .drawer-avatar { background: var(--bg-surface-elevated) !important; color: var(--accent-green) !important; }
html[data-theme='light'] .drawer-item { color: var(--text-main) !important; }
html[data-theme='light'] .drawer-item:hover { background: var(--bg-hover) !important; }
html[data-theme='light'] .sort-chip { background: var(--bg-surface-elevated); color: var(--text-dim); }
html[data-theme='light'] .sort-chip.active { background: var(--accent-cyan); color: #fff !important; }
html[data-theme='light'] .day-bar { background: var(--bg-surface-elevated); }
html[data-theme='light'] .day-date { color: var(--text-main) !important; text-shadow: none !important; }
html[data-theme='light'] .day-name { color: var(--text-dim) !important; }
html[data-theme='light'] .back-nav-btn { color: var(--text-dim) !important; }
html[data-theme='light'] .back-nav-btn:hover { color: var(--text-main) !important; }
html[data-theme='light'] .home-hint { color: var(--text-dim) !important; }
html[data-theme='light'] #social-post-text { caret-color: var(--text-main) !important; }
html[data-theme='light'] .highlighter { color: var(--text-main) !important; }
html[data-theme='light'] .hl-purpose { color: var(--accent-green) !important; }
html[data-theme='light'] .hl-crop { color: var(--accent-cyan) !important; }
html[data-theme='light'] .hl-market { color: var(--accent-price) !important; }
html[data-theme='light'] .placeholder-wrap { color: var(--text-dim) !important; opacity: 0.7 !important; }
html[data-theme='light'] .commodity-card { background: #ffffff !important; border: 1px solid #e2e8f0 !important; }
html[data-theme='light'] .commodity-name { color: var(--text-main) !important; }
html[data-theme='light'] .price-main { color: var(--text-main) !important; }
html[data-theme='light'] .arrivals-value { color: var(--text-main) !important; }
html[data-theme='light'] .sort-icon-btn { border-color: var(--border-main) !important; background: var(--bg-surface-elevated) !important; }
html[data-theme='light'] .sort-icon-btn.active { background: var(--accent-cyan-glow) !important; border-color: var(--accent-cyan) !important; color: var(--accent-cyan) !important; }
html[data-theme='light'] .feed-search-wrap { background: var(--bg-surface-elevated) !important; border-color: var(--border-main) !important; }
html[data-theme='light'] #feed-search-input { color: var(--text-main) !important; }
html[data-theme='light'] .media-preview-item { background: var(--bg-surface-elevated) !important; border-color: var(--border-soft) !important; }
/* --- Unified Social Composer Styles --- */
.social-composer {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-modal);
  margin-bottom: 0;
  position: relative; /* Fixed: Added for absolute draft-preview-tags */
}

.horizontal-divider {
  height: 1px;
  background: var(--border-main);
  margin: 12px 0 16px;
  opacity: 0.8;
  width: 100%;
}

/* Hashtag Suggestions Box */
.hashtag-suggestions {
  position: absolute;
  bottom: calc(100% + 10px); /* Floating offset */
  left: 0;
  width: 100%;
  max-height: 300px;
  min-height: 160px; /* Taller by default for 2-3 options */
  background: #111111;
  backdrop-filter: blur(30px);
  border: 1.5px solid rgba(0, 255, 255, 0.4);
  border-radius: 16px;
  box-shadow: 0 -15px 50px rgba(0,0,0,0.8), 0 0 20px rgba(0, 255, 255, 0.1);
  z-index: 9999; 
  overflow-y: auto;
  display: none;
  flex-direction: column;
  animation: slideUpFade 0.2s ease-out;
}

@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  min-height: 55px;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover, .suggestion-item.active {
  background: var(--accent-cyan-glow);
}

.suggestion-img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.suggestion-media-wrap {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.suggestion-placeholder {
  width: 100%;
  height: 100%;
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  font-size: 18px;
}

.suggestion-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.suggestion-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-cat {
  font-size: 7px !important;
  font-weight: 500 !important;
  color: var(--text-dim) !important;
  opacity: 0.5 !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: -2px;
  display: block;
}

.suggestion-item iconify-icon {
  font-size: 18px;
  color: var(--accent-cyan);
}

/* --- Market Social Section (Intelligence Page) --- */
.market-social-section {
  margin-top: 40px;
  padding: 0 0 100px 0; /* Extra bottom padding for scroll */
}

.social-feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.social-feed-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.social-stats-label {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 700;
  margin-top: 2px;
}

/* Consolidated into line 2440 section */

.social-purpose-filters {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}

.purpose-filter-chip {
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}

.purpose-filter-chip.active {
  background: var(--accent-cyan-glow);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.social-composer .composer-wrapper {
  position: relative;
  width: 100%;
  min-height: 56px; /* Reduced base height (~2.5 lines) */
}

.social-composer #social-post-text {
  position: relative;
  padding: 10px !important;
  min-height: 56px;
  background: transparent;
  border: none;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: var(--accent-cyan) !important;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  width: 100%;
  font-family: inherit;
  z-index: 2;
  overflow-y: auto;
  box-sizing: border-box;
}

.social-composer #social-post-text::placeholder {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  opacity: 0 !important;
}

.social-composer .highlighter {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 10px !important;
  box-sizing: border-box;
  overflow-y: auto;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
  flex-wrap: nowrap;
}

.social-tools {
  display: flex;
  gap: 10px;
  align-items: center;
}

.social-tool-btn {
  background: none;
  border: none;
  padding: 4px;
  color: var(--accent-cyan);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.social-post-btn {
  background: var(--accent-green);
  color: var(--text-inverse);
  border: none;
  padding: 7px 14px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.social-post-btn:hover {
  box-shadow: 0 5px 15px var(--accent-green-glow);
}


/* ================== HASHTAG SUGGESTIONS ================== */
.composer-wrapper {
  position: relative;
}

.hashtag-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-header);
  border: 1px solid var(--border-main);
  border-radius: 12px;
  margin-top: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

.suggestion-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
  transition: all 0.2s;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item iconify-icon {
  color: var(--accent-cyan);
  font-size: 16px;
  flex-shrink: 0;
}

.suggestion-img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-soft);
}

.suggestion-item span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.suggestion-item:hover, .suggestion-item.active {
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
}

.suggestion-item.active span {
  color: var(--accent-cyan);
}

/* Draft Tag Styling */
.draft-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  margin-right: 5px;
  margin-bottom: 5px;
}

.tag-purpose.sell { background: transparent; color: var(--accent-green) !important; border: none; }
.tag-purpose.buy { background: transparent; color: #3b82f6 !important; border: none; }
.tag-purpose.oth { background: transparent; color: var(--text-dim) !important; border: none; }

.tag-hashtag {
  background: transparent;
  color: var(--accent-cyan);
  border: none;
}

.tag-context {
  background: transparent;
  color: var(--accent-cyan);
  border: none;
}

/* HIGH PRIORITY OVERRIDES FOR COMPACT FEED */
#social-posts-container.space-y-2 > .post-card {
    margin-top: 6px !important;
    margin-bottom: 0 !important;
}

.post-card {
    padding: 14px 16px !important;
    gap: 12px !important;
}

.post-card-header {
    margin-bottom: 0 !important;
    height: 44px !important;
}

.post-text {
    line-height: 1.4 !important;
    margin-top: -2px !important;
}

.post-card-footer {
    /* override removed */
}

/* --- Pull to Refresh --- */
.ptr-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40; /* Behind the glass header but above content */
    pointer-events: none;
    transition: transform 0.2s cubic-bezier(0, 0, 0.2, 1);
    transform: translateY(-100%);
}

.ptr-container.pulling {
    transform: translateY(0);
}

.ptr-indicator {
    width: 36px;
    height: 36px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--accent-cyan-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 10px var(--accent-cyan-glow);
    color: var(--accent-cyan);
    transition: transform 0.1s linear;
}

.ptr-indicator iconify-icon {
    font-size: 20px;
}

.ptr-indicator.refreshing iconify-icon {
    animation: ptr-spin 0.8s linear infinite;
}

@keyframes ptr-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ptr-glow {
    position: absolute;
    width: 100px;
    height: 40px;
    background: radial-gradient(ellipse at center, var(--accent-cyan-glow) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.ptr-container.pulling .ptr-glow {
    opacity: 0.4;
}

/* --- Top Progress Bar Loader --- */
.top-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-cyan);
    box-shadow: 0 0 12px var(--accent-cyan-glow);
    z-index: 10001; /* Above everything */
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    opacity: 1;
}

.top-loader.loading {
    animation: top-loader-progress 2s infinite ease-in-out;
}

@keyframes top-loader-progress {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(-30%); }
    100% { transform: translateX(100%); }
}

.top-loader.finishing {
    transform: translateX(0);
    opacity: 0;
    transition: transform 0.2s, opacity 0.5s 0.2s;
}

/* Social Verification Badge */
.trust-badge-corner {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  font-size: 9px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
  z-index: 5;
}

.harvest-status-tag {
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: pre-line;
  text-transform: uppercase;
  text-align: left;
}

/* Exit Confirmation Dialog */
.exit-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.exit-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 24px;
  padding: 30px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.exit-modal h2 {
  font-size: 18px;
  margin-bottom: 12px;
  color: #fff;
}

.exit-modal p {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.exit-btn-group {
  display: flex;
  gap: 12px;
}

.exit-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.exit-btn-yes {
  background: #ef4444;
  color: white;
}

.exit-btn-no {
  background: var(--bg-surface-elevated);
  color: white;
  border: 1px solid var(--border-soft);
}

