@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Syne:wght@700;800&display=swap');

:root {
  --green-900: #1f4d2e;
  --green-700: #2e6b3f;
  --green-500: #4a9b5f;
  --yellow-500: #e2b93b;
  --yellow-300: #f4d97a;
  --brown-700: #6f4e37;
  --brown-500: #8a6245;
  --earth-50:  #faf7f2;
  --earth-100: #f2ece0;
  --card: #ffffff;
  --text: #1e1e1e;
  --muted: #6b7280;
  --success: #1f8a3a;
  --danger: #c0392b;
  --shadow: 0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.05);
  --shadow-hover: 0 8px 28px rgba(0,0,0,0.12), 0 18px 40px rgba(0,0,0,0.08);
  --radius: 14px;
  --transition: 0.18s ease;
  --focus: rgba(74,155,95,0.4);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

*:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus);
  border-radius: inherit;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--earth-50);
  background-image:
    radial-gradient(ellipse 70% 50% at 15% -5%, rgba(226,185,59,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 85% 95%, rgba(46,107,63,0.07) 0%, transparent 55%);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, .brand, .trading-price, .kpi h4, .section-title {
  font-family: 'Syne', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.container {
  width: min(1180px, 94%);
  margin: 0 auto;
}

/* ── Header & Nav ─────────────────────────────── */
header {
  background: rgba(31,77,46,0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.nav {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.3px;
  color: #fff;
}

/* Fix the broken ?? leaf across all pages via CSS */
.brand .leaf {
  font-size: 1.2rem;
  color: var(--yellow-300);
  font-style: normal;
}

.brand .leaf::before {
  content: "🌿";
}

.nav-links {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.nav-links a {
  text-decoration: none;
  color: rgba(255,255,255,0.85);
  background: transparent;
  border: 1px solid transparent;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 700;
  position: relative;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: var(--yellow-500);
  border-radius: 2px;
  transition: transform 0.22s ease;
}

.nav-links a:not(.active):hover::after {
  transform: translateX(-50%) scaleX(1);
}

.nav-links a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: rgba(255,255,255,0.12);
}

.nav-links a.active {
  background: var(--yellow-500);
  color: #1f2937;
  border-color: var(--yellow-500);
  font-weight: 700;
}

/* ── Auth bar (injected by auth.js) ────────────── */
.auth-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
}

button.nav-auth {
  color: #1f2937;
  background: var(--yellow-500);
  border: 1px solid var(--yellow-500);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

button.nav-auth:hover {
  background: var(--yellow-300);
  border-color: var(--yellow-300);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(226,185,59,0.35);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  color: #fff;
  font-size: 0.875rem;
  font-family: inherit;
  transition: background var(--transition);
}
.user-chip:hover { background: rgba(255,255,255,0.18); }

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--yellow-500);
  color: #1f2937;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-name-block { display: flex; flex-direction: column; gap: 1px; text-align: left; }
.user-name { font-size: 0.8rem; font-weight: 600; color: #fff; line-height: 1; }
.user-role-badge { font-size: 0.65rem; font-weight: 600; color: var(--yellow-300); text-transform: capitalize; letter-spacing: 0.3px; line-height: 1; }
.chevron { font-size: 0.7rem; color: rgba(255,255,255,0.6); }

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid #e8e0d0;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  min-width: 200px;
  z-index: 100;
  overflow: hidden;
}
.user-dropdown.open { display: block; }

.dropdown-section { padding: 6px; }
.dropdown-section + .dropdown-section { border-top: 1px solid #f0ebe0; }
.dropdown-section-title { font-size: 0.7rem; font-weight: 700; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; padding: 4px 8px 6px; }

.dropdown-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px;
  font-size: 0.875rem; color: var(--text);
  background: transparent; border: none; cursor: pointer;
  text-decoration: none; font-family: inherit;
  transition: background var(--transition);
}
.dropdown-item:hover { background: var(--earth-100); }
.dropdown-item.active { color: var(--green-700); font-weight: 600; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: #fef2f2; }

/* ── Main & Layout ────────────────────────────── */
main {
  padding: 24px 0 40px;
}

.grid-3,
.grid-4 {
  display: grid;
  gap: 14px;
}

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

/* ── Cards ────────────────────────────────────── */
.hero-main,
.card,
.metric,
.kpi {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.hero-main {
  padding: 28px 30px;
  border-top: 5px solid var(--yellow-500);
}

.hero-main h1 {
  font-size: clamp(1.45rem, 3vw, 2rem);
  color: var(--green-900);
  margin-bottom: 10px;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.card {
  padding: 16px;
  border: 1px solid #ede9e0;
}

.card h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin-bottom: 6px;
}

/* ── Typography helpers ───────────────────────── */
.section-title {
  font-size: 1.25rem;
  color: var(--brown-700);
  margin-bottom: 10px;
  letter-spacing: -0.3px;
}

.subtle {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 14px;
  line-height: 1.6;
}

.meta {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 4px;
  line-height: 1.5;
}

/* ── Badges & Chips ───────────────────────────── */
.badge {
  font-size: 0.75rem;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.badge.verified {
  background: #d9f8e5;
  color: var(--success);
  border: 1px solid #9de2b8;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f5f0e8;
  border: 1px solid #e8dfc8;
  color: #5f4c2e;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  margin-right: 6px;
  margin-top: 4px;
}

.rating {
  color: #d97706;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ── Buttons ──────────────────────────────────── */
button,
.btn {
  border: none;
  cursor: pointer;
  border-radius: 9px;
  padding: 9px 16px;
  font-weight: 600;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.875rem;
  transition: background var(--transition), opacity var(--transition), transform var(--transition), box-shadow var(--transition);
}

button:active, .btn:active { transform: scale(0.98); }

.btn {
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: linear-gradient(135deg, var(--green-500) 0%, var(--green-900) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(31,77,46,0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--green-700) 0%, #122a1c 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(31,77,46,0.35);
  opacity: 1;
}

.btn-secondary {
  background: var(--yellow-500);
  color: #1f2937;
}

.btn-secondary:hover {
  background: var(--yellow-300);
  transform: translateY(-1px);
  opacity: 1;
}

.btn-row,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* ── Forms ────────────────────────────────────── */
.filters {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 0.8fr;
  gap: 10px;
  margin-bottom: 16px;
}

input,
select {
  border: 1px solid #ddd6c8;
  border-radius: 9px;
  padding: 9px 12px;
  background: #fff;
  width: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.875rem;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(74,155,95,0.15);
}

/* ── Profile & Listing heads ──────────────────── */
.profile-head,
.listing-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

/* ── Listing images ───────────────────────────── */
.listing-image {
  width: 100%;
  height: 130px;
  border-radius: 10px;
  margin-bottom: 10px;
  object-fit: cover;
  border: 1px solid #ededed;
  transition: transform var(--transition);
}

.card:hover .listing-image {
  transform: scale(1.02);
}

/* ── Price & Stock ────────────────────────────── */
.price {
  color: var(--green-700);
  font-weight: 800;
  font-size: 1rem;
  font-family: 'Syne', sans-serif;
}

.stock.low {
  color: var(--danger);
  font-weight: 700;
  font-size: 0.85rem;
}

/* ── KPI strip ────────────────────────────────── */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.kpi {
  padding: 14px 16px;
  border-top: 4px solid var(--brown-500);
}

.kpi h4 {
  font-size: 1.4rem;
  color: var(--green-900);
  margin-top: 6px;
  letter-spacing: -0.5px;
}

/* ── Metrics ──────────────────────────────────── */
.metric {
  padding: 16px;
  border-top: 4px solid var(--green-500);
}

.metric.dark {
  background: #0f172a;
  border: 1px solid rgba(148,163,184,0.12);
  border-top: 4px solid #22c55e;
}

.metric h3 {
  font-size: 1.4rem;
  color: var(--green-900);
  margin: 4px 0;
  letter-spacing: -0.5px;
}

.metric.dark h3,
.metric.dark .meta {
  color: #e5edf8;
}

/* ── Progress bars ────────────────────────────── */
.progress {
  height: 7px;
  background: #ede9dd;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--green-500);
  border-radius: 99px;
  transition: width 0.6s ease;
}

/* ── Timeline ─────────────────────────────────── */
.timeline {
  list-style: none;
  display: grid;
  gap: 10px;
}

.timeline li {
  background: #fff;
  border-radius: 10px;
  border-left: 4px solid var(--yellow-500);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  transition: box-shadow var(--transition);
}

.timeline li:hover {
  box-shadow: var(--shadow-hover);
}

/* ── Cart panel ───────────────────────────────── */
.cart-panel {
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: min(340px, calc(100% - 28px));
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.16);
  border: 1px solid #e8e0d0;
  padding: 16px;
  z-index: 60;
}

.cart-panel h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green-900);
  margin-bottom: 4px;
}

.cart-items {
  max-height: 180px;
  overflow-y: auto;
  margin: 10px 0;
  display: grid;
  gap: 7px;
  scrollbar-width: thin;
  scrollbar-color: var(--earth-100) transparent;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  background: var(--earth-50);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--earth-100);
}

/* ── Analytics shell ──────────────────────────── */
.analytics-shell { margin-bottom: 20px; }
.marketplace-callout { margin-bottom: 18px; }

.analytics-header,
.analytics-toolbar,
.analytics-grid,
.analytics-notes,
.chart-card-head {
  display: grid;
  gap: 12px;
}

.analytics-header {
  grid-template-columns: 1.6fr auto;
  align-items: center;
  margin-bottom: 12px;
}

.analytics-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.analytics-toolbar {
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 14px;
}

.analytics-grid {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 12px;
}

/* ── Chart cards ──────────────────────────────── */
.chart-card {
  position: relative;
  background: #fff;
  border: 1px solid #ede9d6;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}

.chart-card-head {
  grid-template-columns: 1.4fr 1fr;
  align-items: start;
  margin-bottom: 12px;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  background: #faf7ef;
  border: 1px solid #efe1ba;
  border-radius: 999px;
  padding: 4px 10px;
}

.legend-swatch {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
  flex-shrink: 0;
}

.legend-swatch.green { background: #22c55e; }
.legend-swatch.red   { background: #ef4444; }
.legend-swatch.gold  { background: var(--yellow-500); }
.legend-swatch.blue  { background: #3b82f6; }

.chart-surface {
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
}

.tv-surface {
  min-height: 420px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(148,163,184,0.12);
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-hit { cursor: crosshair; }
.chart-hit:hover { fill: rgba(74,155,95,0.07); }

.chart-tooltip {
  margin-top: 10px;
  background: #f8f6ee;
  border: 1px solid #efe1ba;
  border-radius: 9px;
  padding: 9px 13px;
  color: #5f4c2e;
  font-size: 0.875rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, monospace;
}

.tv-tooltip {
  margin: 0;
  background: transparent;
  border: none;
  padding: 0;
  color: #94a3b8;
  font-size: 0.82rem;
}

.analytics-notes {
  grid-template-columns: repeat(3, 1fr);
}

/* ── History table ────────────────────────────── */
.history-table { display: grid; gap: 6px; }

.history-row {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 6px;
  font-size: 0.82rem;
  padding: 7px 0;
  border-bottom: 1px solid #f0ede5;
}

.history-head {
  font-weight: 700;
  color: var(--green-900);
  font-size: 0.8rem;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ── Analytics page hero ──────────────────────── */
.analytics-page-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

/* ── Trading panel ────────────────────────────── */
.trading-panel {
  background: linear-gradient(175deg, #172033 0%, #0f172a 100%);
  border: 1px solid rgba(51,65,85,0.8);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(15,23,42,0.3);
  padding: 20px;
  margin-bottom: 18px;
}

.trading-toolbar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.toolbar-group { display: grid; gap: 6px; }

.toolbar-label {
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.trading-panel select {
  background: rgba(15,23,42,0.85);
  color: #e5edf8;
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 8px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding: 8px 10px;
}

.trading-panel select:focus {
  border-color: rgba(148,163,184,0.45);
  box-shadow: 0 0 0 2px rgba(148,163,184,0.1);
}

.trading-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.trading-kicker {
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.trading-price {
  color: #f8fafc;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: -1px;
  line-height: 1.1;
}

.trading-change {
  color: #22c55e;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 4px;
}

.ohlc-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  color: #94a3b8;
  font-size: 0.85rem;
}

.ohlc-strip strong { color: #f8fafc; font-family: 'Syne', sans-serif; }

.chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) 300px;
  gap: 14px;
}

.chart-stage {
  background: rgba(2,6,23,0.3);
  border: 1px solid rgba(148,163,184,0.12);
  border-radius: 14px;
  padding: 14px;
}

.analytics-sidepanel { display: grid; gap: 12px; }

.tv-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.legend-pill.dark {
  background: rgba(15,23,42,0.75);
  color: #cbd5e1;
  border: 1px solid rgba(148,163,184,0.2);
}

.chart-footer-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  color: #94a3b8;
  font-size: 0.82rem;
}

/* ── SVG chart helpers ────────────────────────── */
.tv-axis          { fill: #8da0bd; font-size: 11px; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.tv-grid          { stroke: rgba(148,163,184,0.15); stroke-dasharray: 4 6; }
.tv-crosshair     { stroke: rgba(226,232,240,0.3); stroke-dasharray: 4 5; }
.tv-hover-dot     { fill: #f8fafc; stroke: #38bdf8; stroke-width: 2; }
.tv-forecast-line { stroke: #60a5fa; stroke-width: 2; stroke-dasharray: 6 5; }
.forecast-soft    { fill: rgba(96,165,250,0.08); }
.forecast-strong  { fill: rgba(96,165,250,0.16); }

/* ── Print styles for PDF export ─────────────── */
@media print {
  header, .cart-panel, .analytics-actions, .trading-toolbar { display: none !important; }
  body { background: #fff; }
  .trading-panel { background: #0f172a; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 1000px) {
  .hero-split           { grid-template-columns: 1fr; }
  .hero-preview         { display: none; }
  .grid-4               { grid-template-columns: repeat(2, 1fr); }
  .grid-3               { grid-template-columns: 1fr 1fr; }
  .filters              { grid-template-columns: 1fr 1fr; }
  .kpi-strip            { grid-template-columns: 1fr 1fr; }
  .analytics-header,
  .chart-card-head      { grid-template-columns: 1fr; }
  .analytics-toolbar    { grid-template-columns: repeat(3, 1fr); }
  .analytics-grid,
  .analytics-notes      { grid-template-columns: 1fr 1fr; }
  .legend-row,
  .analytics-actions    { justify-content: flex-start; }
  .trading-toolbar,
  .chart-layout         { grid-template-columns: 1fr 1fr; }
  .analytics-page-hero,
  .trading-summary,
  .chart-footer-meta    { flex-direction: column; align-items: flex-start; }
  .ohlc-strip           { justify-content: flex-start; }
}

/* ── Hero split layout (home) ─────────────────── */
.hero-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}

.hero-text { display: flex; flex-direction: column; }

.market-preview-card {
  background: linear-gradient(160deg, var(--green-900) 0%, #122a1c 100%);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.preview-badge {
  background: rgba(226,185,59,0.18);
  color: var(--yellow-300);
  border: 1px solid rgba(226,185,59,0.28);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  letter-spacing: 0.3px;
}

.preview-meta { font-size: 0.7rem; color: rgba(255,255,255,0.45); }

.preview-items { display: grid; gap: 8px; margin-bottom: 16px; }

.preview-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  padding: 8px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
}

.preview-crop { flex: 1; color: rgba(255,255,255,0.88); }
.preview-price { font-weight: 700; color: var(--yellow-300); font-size: 0.8rem; }
.preview-trend { font-size: 0.73rem; font-weight: 700; min-width: 50px; text-align: right; }
.preview-trend.up   { color: #4ade80; }
.preview-trend.down { color: #f87171; }

.preview-cta {
  display: block;
  text-align: center;
  border-radius: 999px;
  font-size: 0.82rem;
  padding: 9px 14px;
}

/* ── Benefit cards ────────────────────────────── */
.benefit-card { padding: 20px; }

.benefit-icon {
  font-size: 1.5rem;
  margin-bottom: 10px;
  display: block;
  line-height: 1;
}

.benefit-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin-bottom: 5px;
  color: var(--green-900);
}

.benefit-card .meta { font-size: 0.82rem; line-height: 1.55; margin-top: 0; }

/* ── Auth modal ───────────────────────────────── */
.auth-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.52);
  backdrop-filter: blur(5px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-modal {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.22);
  padding: 36px;
  width: min(440px, 100%);
  position: relative;
  border: 1px solid var(--earth-100);
  animation: modal-in 0.22s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-modal h2 {
  font-size: 1.5rem;
  color: var(--green-900);
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.auth-modal-sub { color: var(--muted); font-size: 0.875rem; margin-bottom: 20px; }

.auth-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--earth-100);
  border: none;
  border-radius: 999px;
  width: 30px; height: 30px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.auth-modal-close:hover { background: #e8dfc8; }

.auth-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green-900);
  margin-bottom: 4px;
  margin-top: 12px;
  letter-spacing: 0.2px;
}

.auth-error {
  color: var(--danger);
  font-size: 0.82rem;
  min-height: 20px;
  margin-top: 8px;
}

.auth-submit {
  width: 100%;
  margin-top: 16px;
  padding: 11px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--muted);
}

.auth-optional { color: var(--muted); font-weight: 400; }

.link-btn {
  background: none; border: none;
  color: var(--green-700); font-weight: 600;
  cursor: pointer; font-size: inherit; font-family: inherit; padding: 0;
  text-decoration: underline;
}
.link-btn:hover { color: var(--green-900); }

.role-picker { display: flex; gap: 10px; margin: 4px 0 8px; }

.role-option {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.875rem; cursor: pointer; color: var(--text);
}
.role-option input { width: auto; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Dashboard ────────────────────────────────── */
.section-block { margin-top: 20px; }
.dash-avatar-wrap { position: relative; display: inline-block; flex-shrink: 0; }
.dash-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--green-700); color: #fff;
  font-size: 1.5rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; border: 3px solid var(--yellow-500);
}
.dash-avatar img { width: 100%; height: 100%; object-fit: cover; }
.dash-avatar-edit {
  position: absolute; bottom: 0; right: -2px;
  background: var(--yellow-500); border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; cursor: pointer;
}
.dash-avatar-edit input { display: none; }
.dashboard-hero { display: flex; align-items: center; gap: 20px; }
.dash-identity { flex: 1; }
.dash-identity h2 { font-size: 1.3rem; color: var(--green-900); margin-bottom: 4px; }
.dash-identity .org { font-size: 0.9rem; color: var(--muted); margin-bottom: 6px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 10px; font-size: 0.82rem; color: var(--muted); }
.dash-actions { flex-shrink: 0; }
.listings-table { display: grid; gap: 8px; margin-top: 12px; }
.listing-row {
  display: grid; grid-template-columns: 48px 1fr 1fr auto auto auto;
  gap: 10px; align-items: center;
  background: #fff; border: 1px solid #ede9e0;
  border-radius: 10px; padding: 10px 14px;
}
.row-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.row-title { font-weight: 600; font-size: 0.875rem; color: var(--text); }
.row-sub { font-size: 0.78rem; color: var(--muted); }
.row-price { font-weight: 700; color: var(--green-700); font-size: 0.9rem; }
.row-stock { font-size: 0.875rem; font-weight: 600; }
.row-actions { display: flex; gap: 6px; }
.row-actions button { padding: 5px 10px; border-radius: 7px; font-size: 0.78rem; background: var(--earth-100); color: var(--text); border: 1px solid #ddd; }
.row-actions button.danger { background: #fef2f2; color: var(--danger); border-color: #fca5a5; }
.empty-state {
  text-align: center; padding: 40px 20px;
  background: var(--earth-50); border-radius: 14px;
  border: 1px dashed #d4c9b5; margin-top: 12px;
}
.empty-state .emoji { font-size: 2.5rem; display: block; margin-bottom: 10px; }
.empty-state h3 { font-size: 1.1rem; color: var(--green-900); margin-bottom: 6px; }
.empty-state p { font-size: 0.875rem; color: var(--muted); }

@media (max-width: 620px) {
  .grid-4, .grid-3,
  .filters, .kpi-strip,
  .analytics-toolbar,
  .analytics-grid,
  .analytics-notes      { grid-template-columns: 1fr; }
  .trading-toolbar,
  .chart-layout         { grid-template-columns: 1fr; }
  .nav                  { justify-content: center; }
  .nav-links            { justify-content: center; }
  .history-row          { grid-template-columns: 1fr 1fr; }
  .hero-main            { padding: 20px; }
  .trading-panel        { padding: 14px; }
}
