@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=DM+Mono:wght@400;500&display=swap');

/* ─── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

/* ─── Tokens ─────────────────────────────────── */
:root {
  --green-50:  #f0fdf4; --green-100: #dcfce7; --green-200: #bbf7d0;
  --green-300: #86efac; --green-400: #4ade80; --green-500: #22c55e;
  --green-600: #16a34a; --green-700: #15803d; --green-800: #166534; --green-900: #14532d;
  --amber-100: #fef3c7; --amber-500: #f59e0b; --amber-700: #b45309;
  --red-100: #fee2e2;   --red-500: #ef4444;   --red-700: #b91c1c;
  --blue-100: #dbeafe;  --blue-500: #3b82f6;  --blue-700: #1d4ed8;
  --n0: #fff; --n50: #f8fafc; --n100: #f1f5f9; --n200: #e2e8f0;
  --n300: #cbd5e1; --n400: #94a3b8; --n500: #64748b;
  --n600: #475569; --n700: #334155; --n800: #1e293b; --n900: #0f172a;
  --earth-100:#faebd7; --earth-400:#cc9544; --earth-600:#8b6220;

  /* Semantic */
  --bg:       var(--n50);
  --surface:  var(--n0);
  --muted:    var(--n100);
  --border:   var(--n200);
  --txt:      var(--n900);
  --txt2:     var(--n500);
  --txt3:     var(--n400);
  --accent:   var(--green-600);
  --accent-h: var(--green-700);
  --topbar-bg: linear-gradient(135deg, #14532d 0%, #166534 52%, #0f766e 100%);
  --topbar-ink: #f8fafc;
  --topbar-soft: rgba(255,255,255,.14);
  --topbar-border: rgba(187,247,208,.22);

  /* Sidebar */
  --sb-bg:   var(--n900);
  --sb-txt:  var(--n300);
  --sb-act:  var(--green-600);
  --sb-hov:  rgba(255,255,255,.07);
  --sb-w:    252px;

  /* Misc */
  --topbar-h: 82px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08),0 2px 4px rgba(0,0,0,.04);
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: linear-gradient(135deg, #f8fbff 0%, #eaf3ff 48%, #dcecff 100%);
  color: var(--txt);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Shell ──────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

/* ─── Sidebar ────────────────────────────────── */
.sidebar {
  width: var(--sb-w);
  background: var(--sb-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200;
  transform: translateX(-100%);
  transition: transform .24s cubic-bezier(.4,0,.2,1);
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
}
.sidebar.open { transform: translateX(0); }
@media (min-width: 1024px) {
  .sidebar, .sb-overlay, .hamburger { display: none !important; }
  .main { margin-left: 0; width: 100%; }
}
.sb-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 199;
}
.sb-overlay.on { display: block; }

/* Logo */
.sb-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
}
.sb-logo-icon {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--green-600);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}
.sb-logo-name { font-size: 15px; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.sb-logo-sub  { font-size: 10px; color: var(--green-400); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* Nav */
.sb-section { padding: 14px 12px 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--n500); }
.sb-nav { padding: 0 8px; }
.sb-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--sb-txt);
  font-size: 13.5px; font-weight: 500;
  transition: background .13s, color .13s;
  margin-bottom: 1px;
}
.sb-nav a:hover  { background: var(--sb-hov); color: #fff; }
.sb-nav a.active { background: var(--sb-act); color: #fff; }
.sb-nav a svg { width: 17px; height: 17px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sb-badge { margin-left: auto; background: var(--green-400); color: var(--green-900); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }

/* Sidebar footer user */
.sb-footer { margin-top: auto; padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.sb-user {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: var(--r-md); cursor: pointer;
  text-decoration: none;
  transition: background .13s;
}
.sb-user:hover { background: var(--sb-hov); }
.avatar {
  border-radius: 50%;
  background: var(--green-700); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.av-sm  { width: 28px; height: 28px; font-size: 11px; }
.av-md  { width: 36px; height: 36px; font-size: 13px; }
.av-lg  { width: 48px; height: 48px; font-size: 17px; }
.sb-user-name { font-size: 13px; font-weight: 600; color: #fff; }
.sb-user-role { font-size: 11px; color: var(--n500); }

/* ─── Main ───────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 14px 34px rgba(20,83,45,.22);
}
.hamburger {
  width: 36px; height: 36px; border: none; background: none; cursor: pointer;
  border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center;
  color: var(--topbar-ink); flex-shrink: 0;
}
.hamburger:hover { background: var(--topbar-soft); }
.hamburger svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.topbar-logo {
  display: none;
  align-items: center;
  gap: 10px;
  color: var(--topbar-ink);
  font-size: 26px;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0;
  white-space: nowrap;
}
.topbar-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(220,252,231,.18);
  box-shadow: inset 0 0 0 1px rgba(220,252,231,.24);
  font-size: 18px;
}
.topbar-page-title { font-size: 16px; font-weight: 700; color: var(--topbar-ink); letter-spacing: 0; }
.desktop-nav {
  display: none;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.desktop-nav a {
  color: rgba(248,250,252,.78);
  text-decoration: none;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  position: relative;
  transition: background .16s, color .16s, box-shadow .16s, transform .16s;
}
.desktop-nav a:hover {
  background: var(--topbar-soft);
  color: #fff;
  transform: translateY(-1px);
}
.desktop-nav a.active {
  background: #dcfce7;
  color: var(--green-800);
  box-shadow: inset 0 -4px 0 var(--amber-500), 0 10px 22px rgba(15,23,42,.16);
}
.desktop-nav a svg {
  width: 25px;
  height: 25px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.desktop-nav a span { display: none; }
.topbar-search {
  flex: 1; max-width: 280px; position: relative;
  display: none;
}
@media (min-width: 600px) { .topbar-search { display: block; } }
.topbar-search input {
  width: 100%; height: 46px;
  background: rgba(255,255,255,.13); border: 1.5px solid rgba(220,252,231,.28);
  border-radius: 22px; padding: 0 16px 0 42px;
  font-size: 14px; font-family: inherit; color: #fff; outline: none;
  transition: border-color .15s, background .15s;
}
.topbar-search input::placeholder { color: rgba(248,250,252,.68); }
.topbar-search input:focus { border-color: var(--green-300); background: rgba(255,255,255,.20); }
.ts-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: rgba(248,250,252,.72); stroke: currentColor; fill: none; stroke-width: 2; }
.search-preview {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 300;
  padding: 8px;
  background: var(--surface);
  border: 1px solid rgba(187,247,208,.55);
  border-radius: var(--r-lg);
  box-shadow: 0 18px 38px rgba(15,23,42,.22);
}
.search-preview[hidden] { display: none; }
.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border-radius: var(--r-md);
  color: var(--txt);
  text-decoration: none;
}
.search-result:hover {
  background: var(--green-50);
}
.search-result-img {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.search-result-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--green-100);
  color: var(--green-800);
  font-weight: 800;
}
.search-result-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.search-result-name {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-meta {
  color: var(--txt2);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-empty {
  padding: 12px;
  color: var(--txt2);
  font-size: 13px;
}
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.icon-btn {
  width: 36px; height: 36px; border: none; background: none; cursor: pointer;
  border-radius: var(--r-md); display: flex; align-items: center; justify-content: center;
  color: rgba(248,250,252,.82); text-decoration: none; position: relative;
  transition: background .13s, color .13s;
}
.icon-btn:hover { background: var(--topbar-soft); color: #fff; }
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.notif-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--amber-500); border-radius: 50%; border: 2px solid var(--green-800); }
.topbar-profile {
  display: none;
  align-items: center;
  gap: 10px;
  padding-left: 4px;
}
.topbar-role {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
}
.topbar-user {
  max-width: 100px;
  color: var(--green-200);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.2;
}
.logout-btn {
  display: none;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border-radius: 16px;
  background: #ef4444;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  box-shadow: 0 10px 20px rgba(239,68,68,.28);
}
.logout-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.logout-btn:hover { background: #dc2626; }

/* ─── Page ───────────────────────────────────── */
.page {
  padding: 20px 16px;
  max-width: 1280px; width: 100%; margin: 0 auto;
  animation: fadeUp .2s ease;
}
@media (min-width: 640px)  { .page { padding: 24px; } }
@media (min-width: 1024px) { .page { padding: 32px; } }
@media (max-width: 1023px) { .page { padding-bottom: 80px; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity:1; transform: none; } }

/* Page header */
.ph { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.ph-title { font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
.ph-sub { font-size: 14px; color: var(--txt2); margin-top: 2px; }

/* ─── Cards ──────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 20px; }
.card-hd {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card-hd-title { font-size: 14px; font-weight: 700; }
.card-ft { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--muted); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* AI decision support */
.ai-panel {
  border-color: rgba(59,130,246,.20);
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
}
.ai-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.ai-kicker {
  color: var(--blue-700);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.ai-title {
  margin-top: 2px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
}
.ai-advice-list {
  display: grid;
  gap: 12px;
}
.ai-advice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, .34fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: #fff;
}
.ai-advice-row.ai-danger {
  border-color: rgba(239,68,68,.28);
  background: linear-gradient(180deg, #fff 0%, #fff7f7 100%);
}
.ai-advice-row.ai-warning {
  border-color: rgba(245,158,11,.32);
  background: linear-gradient(180deg, #fff 0%, #fffbeb 100%);
}
.ai-advice-row.ai-opportunity {
  border-color: rgba(59,130,246,.28);
  background: linear-gradient(180deg, #fff 0%, #eff6ff 100%);
}
.ai-advice-row.ai-success {
  border-color: rgba(34,197,94,.24);
  background: linear-gradient(180deg, #fff 0%, #f0fdf4 100%);
}
.ai-advice-main {
  min-width: 0;
}
.ai-advice-title {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
}
.ai-next-step,
.ai-inline-step {
  color: var(--green-800);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}
.ai-evidence {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
}
.ai-evidence span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--n100);
  color: var(--n700);
  font-size: 11px;
  font-weight: 700;
}
.recommendation-reason {
  padding: 10px;
  border: 1px solid var(--blue-100);
  border-radius: var(--r-md);
  background: #f8fbff;
  color: var(--txt2);
  font-size: 12px;
  line-height: 1.45;
}
@media (max-width: 760px) {
  .ai-summary {
    flex-direction: column;
  }
  .ai-summary .btn {
    width: 100%;
  }
  .ai-advice-row {
    grid-template-columns: 1fr;
  }
  .ai-evidence {
    gap: 5px;
  }
}

/* 2D delivery map */
.delivery-map {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid var(--green-100);
  border-radius: var(--r-lg);
  background:
    radial-gradient(circle at 18% 18%, rgba(34,197,94,.22), transparent 24%),
    radial-gradient(circle at 84% 24%, rgba(59,130,246,.16), transparent 20%),
    linear-gradient(135deg, #effaf1 0%, #f8fafc 58%, #e0f2fe 100%);
}
.geo-grid {
  position: absolute;
  inset: 0;
  opacity: .34;
  background-image:
    linear-gradient(rgba(22,101,52,.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22,101,52,.12) 1px, transparent 1px);
  background-size: 28px 28px;
}
.geo-water {
  position: absolute;
  right: -10%;
  bottom: -22%;
  width: 58%;
  height: 58%;
  border-radius: 50%;
  background: rgba(14,165,233,.14);
  border: 1px solid rgba(14,165,233,.16);
}
.geo-field {
  position: absolute;
  border-radius: 18px;
  background: repeating-linear-gradient(
    45deg,
    rgba(22,163,74,.18),
    rgba(22,163,74,.18) 8px,
    rgba(187,247,208,.40) 8px,
    rgba(187,247,208,.40) 16px
  );
  border: 1px solid rgba(22,163,74,.14);
}
.field-a {
  left: 7%;
  top: 14%;
  width: 26%;
  height: 24%;
  transform: rotate(-8deg);
}
.field-b {
  right: 12%;
  top: 44%;
  width: 24%;
  height: 22%;
  transform: rotate(9deg);
}
.map-route,
.map-route-fill {
  position: absolute;
  left: 14%;
  top: 54%;
  height: 8px;
  border-radius: 999px;
  transform: translateY(-50%);
}
.map-route {
  right: 14%;
  background: repeating-linear-gradient(
    90deg,
    rgba(71,85,105,.42),
    rgba(71,85,105,.42) 12px,
    rgba(255,255,255,.8) 12px,
    rgba(255,255,255,.8) 20px
  );
  box-shadow: 0 5px 14px rgba(15,23,42,.12);
}
.map-route-fill {
  width: calc(var(--delivery-progress) - 14%);
  background: linear-gradient(90deg, var(--green-600), var(--blue-500));
  box-shadow: 0 0 18px rgba(22,163,74,.34);
}
.map-pin {
  position: absolute;
  top: 54%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: translate(-50%, -50%);
  z-index: 3;
}
.map-pin-start { left: 14%; }
.map-pin-end { left: 86%; }
.map-pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 5px solid var(--green-700);
  box-shadow: 0 0 0 6px rgba(22,163,74,.14);
}
.map-pin-end .map-pin-dot {
  border-color: var(--blue-700);
  box-shadow: 0 0 0 6px rgba(59,130,246,.14);
}
.map-pin-label {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: var(--txt);
  font-size: 11px;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}
.delivery-vehicle {
  position: absolute;
  left: var(--delivery-progress);
  top: 54%;
  z-index: 4;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--green-700);
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 14px 26px rgba(15,23,42,.25);
  transform: translate(-50%, -50%);
  transition: left .35s ease;
}
.delivery-vehicle svg {
  width: 25px;
  height: 25px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.delivery-map.is-idle .delivery-vehicle {
  background: var(--n600);
  animation: deliveryIdle 1.8s ease-in-out infinite;
}
.delivery-map.is-moving .delivery-vehicle {
  animation: deliveryMove 1.1s ease-in-out infinite;
}
.delivery-map.is-delivered .delivery-vehicle {
  background: var(--green-600);
}
.map-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
@keyframes deliveryIdle {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.05); }
}
@keyframes deliveryMove {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-4px); }
}
@media (max-width: 640px) {
  .delivery-map { min-height: 220px; }
  .map-meta { grid-template-columns: 1fr; }
}

/* Timeline and receipts */
.timeline-list {
  display: grid;
  gap: 14px;
}
.timeline-item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 10px;
  position: relative;
}
.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: -14px;
  width: 2px;
  background: var(--border);
}
.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green-600);
  box-shadow: 0 0 0 4px var(--green-100);
  margin-top: 3px;
  position: relative;
  z-index: 1;
}
.delivery-proof-full,
.message-attachment img {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  object-fit: cover;
}
.delivery-proof-full {
  max-height: 360px;
  margin-top: 8px;
}
.message-attachment {
  display: block;
  margin-top: 10px;
}
.message-attachment img {
  max-height: 220px;
}
.receipt-card {
  max-width: 860px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.receipt-head,
.receipt-grid,
.receipt-total {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
.receipt-head {
  align-items: flex-start;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.receipt-no {
  text-align: right;
}
.receipt-no span {
  display: block;
  color: var(--txt2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.receipt-no strong {
  display: block;
  font-size: 20px;
}
.receipt-grid {
  margin-top: 22px;
}
.receipt-grid > div {
  flex: 1;
}
.receipt-total {
  align-items: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.receipt-total span {
  color: var(--txt2);
  font-weight: 700;
}
.receipt-total strong {
  color: var(--green-700);
  font-size: 26px;
}
@media print {
  .topbar,
  .sidebar,
  .mob-nav,
  .site-footer,
  .ph .btn,
  .ph .flex {
    display: none !important;
  }
  body,
  .page {
    background: #fff !important;
  }
  .page {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }
  .receipt-card {
    box-shadow: none;
    border-color: #ddd;
  }
}

/* Stat card */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, transform .18s;
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
  width: 42px; height: 42px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.si-green { background: var(--green-100); color: var(--green-700); }
.si-amber { background: var(--amber-100); color: var(--amber-700); }
.si-blue  { background: var(--blue-100);  color: var(--blue-700); }
.si-red   { background: var(--red-100);   color: var(--red-700); }
.stat-lbl { font-size: 12px; color: var(--txt2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-val { font-size: 28px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.stat-note { font-size: 12px; color: var(--txt2); }

/* Analytics graph dashboard */
.analytics-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 16px;
}
.analytics-card .card-body { overflow: hidden; }
.chart-list,
.mini-chart-list,
.dual-chart-list,
.compare-list {
  display: grid;
  gap: 14px;
}
.chart-row,
.dual-chart-row,
.compare-row {
  display: grid;
  align-items: center;
  gap: 14px;
}
.chart-row { grid-template-columns: minmax(130px, .34fr) minmax(160px, 1fr) minmax(92px, auto); }
.dual-chart-row { grid-template-columns: minmax(130px, .28fr) minmax(180px, 1fr) minmax(84px, auto); }
.compare-row {
  grid-template-columns: minmax(160px, .5fr) minmax(180px, 1fr) auto;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.compare-row:last-child { border-bottom: none; padding-bottom: 0; }
.compare-row:first-child { padding-top: 0; }
.chart-label {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.chart-label span {
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-label small,
.dual-bars span,
.compare-meter span {
  color: var(--txt2);
  font-size: 11px;
  font-weight: 700;
}
.chart-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: var(--n100);
  border: 1px solid var(--border);
  overflow: hidden;
}
.chart-track.sm { height: 10px; }
.chart-fill {
  width: max(var(--bar), 3%);
  height: 100%;
  border-radius: inherit;
  transition: width .25s ease;
}
.fill-green { background: linear-gradient(90deg, var(--green-500), var(--green-700)); }
.fill-blue { background: linear-gradient(90deg, #60a5fa, var(--blue-700)); }
.fill-amber { background: linear-gradient(90deg, #fbbf24, var(--amber-700)); }
.fill-red { background: linear-gradient(90deg, #f87171, var(--red-700)); }
.fill-gray { background: linear-gradient(90deg, var(--n300), var(--n600)); }
.chart-value {
  color: var(--txt);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}
.mini-chart-row { display: grid; gap: 8px; }
.dual-bars { display: grid; gap: 8px; }
.dual-bars > div {
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 8px;
}
.trend-chart {
  min-height: 220px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  padding-top: 8px;
}
.trend-col {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 150px auto;
  align-items: end;
  gap: 8px;
  text-align: center;
}
.trend-value {
  min-height: 18px;
  color: var(--txt2);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trend-bar {
  width: min(42px, 78%);
  height: max(var(--bar), 4%);
  justify-self: center;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, var(--green-500), var(--blue-500));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.24);
}
.trend-label {
  color: var(--txt2);
  font-size: 12px;
  font-weight: 800;
}
.compare-meter {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 72px;
  align-items: center;
  gap: 10px;
}
@media (max-width: 900px) {
  .analytics-chart-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 599px) {
  .chart-row,
  .dual-chart-row,
  .compare-row {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
  }
  .chart-label span {
    white-space: normal;
  }
  .chart-value {
    text-align: left;
  }
  .compare-meter {
    grid-template-columns: 1fr;
  }
  .trend-chart {
    gap: 8px;
    min-height: 180px;
  }
  .trend-col {
    grid-template-rows: auto 118px auto;
  }
  .trend-value {
    font-size: 10px;
  }
}

/* ─── Grid ───────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%,200px),1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%,220px),1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%,160px),1fr)); }
.g-2col { grid-template-columns: 1fr 1fr; }
@media (max-width:640px) { .g-2col { grid-template-columns: 1fr; } }

/* ─── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; border: 1.5px solid transparent;
  transition: all .13s; text-decoration: none; white-space: nowrap;
  user-select: none; line-height: 1;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: var(--r-lg); }
.btn-block { width: 100%; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn-secondary { background: var(--surface); color: var(--txt); border-color: var(--border); }
.btn-secondary:hover { background: var(--muted); }
.btn-ghost { background: transparent; color: var(--txt2); border-color: transparent; }
.btn-ghost:hover { background: var(--muted); color: var(--txt); }
.btn-danger { background: var(--red-500); color: #fff; border-color: var(--red-500); }
.btn-danger:hover { background: var(--red-700); }
.btn-amber { background: var(--amber-500); color: #fff; border-color: var(--amber-500); }
.btn-amber:hover { background: var(--amber-700); }

/* ─── Badges ─────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.b-green  { background: var(--green-100);  color: var(--green-700); }
.b-amber  { background: var(--amber-100);  color: var(--amber-700); }
.b-red    { background: var(--red-100);    color: var(--red-700); }
.b-blue   { background: var(--blue-100);   color: var(--blue-700); }
.b-gray   { background: var(--n100);       color: var(--n600); }

/* ─── Table ──────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-lg); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; padding: 10px 16px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--txt2); border-bottom: 1px solid var(--border);
  background: var(--muted); white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--muted); }

/* ─── Forms ──────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--txt); }
.form-hint  { font-size: 12px; color: var(--txt2); }
.form-control {
  width: 100%; height: 42px;
  padding: 0 12px;
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  font-size: 14px; font-family: inherit; color: var(--txt); background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22,163,74,.12); }
.form-control::placeholder { color: var(--txt3); }
textarea.form-control { height: auto; padding: 10px 12px; resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-row { display: grid; gap: 12px; }
@media (min-width: 480px) { .form-row.cols-2 { grid-template-columns: 1fr 1fr; } }
.form-error { font-size: 12px; color: var(--red-700); margin-top: 2px; }

/* Radio cards */
.radio-group { display: flex; flex-direction: column; gap: 10px; }
.radio-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; transition: border-color .13s, background .13s;
}
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--green-50); }
.radio-card input { accent-color: var(--accent); width: 17px; height: 17px; cursor: pointer; }
.radio-card-label { font-size: 14px; font-weight: 600; }
.radio-card-sub { font-size: 12px; color: var(--txt2); }

/* ─── Alerts / Flash ─────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: var(--r-md); border: 1px solid;
  font-size: 14px; margin-bottom: 16px;
}
.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; stroke: currentColor; fill: none; stroke-width: 2; }
.alert-success { background: var(--green-50);  border-color: var(--green-200); color: var(--green-800); }
.alert-warning { background: var(--amber-100); border-color: #fcd34d;          color: var(--amber-700); }
.alert-danger  { background: var(--red-100);   border-color: #fca5a5;          color: var(--red-700); }
.alert-info    { background: var(--blue-100);  border-color: #93c5fd;          color: var(--blue-700); }

/* ─── Product cards (marketplace) ───────────── */
.product-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%,240px),1fr)); }
.product-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, transform .18s;
  display: flex; flex-direction: column;
}
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.product-img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  background: var(--green-50);
}
.product-img-placeholder {
  width: 100%; aspect-ratio: 4/3;
  background: var(--green-50);
  display: flex; align-items: center; justify-content: center;
  font-size: 42px;
}
.product-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.product-name { font-size: 15px; font-weight: 700; }
.product-desc { font-size: 13px; color: var(--txt2); flex: 1; }
.product-meta { font-size: 12px; color: var(--txt2); display: flex; align-items: center; gap: 4px; }
.product-meta svg { width: 13px; height: 13px; }
.product-price { font-size: 18px; font-weight: 800; color: var(--accent); letter-spacing: -.02em; }
.product-ft { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

/* ─── Notification item ──────────────────────── */
.notif-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-icon {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
  background: var(--green-100); color: var(--green-700);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.notif-msg { font-size: 14px; }
.notif-time { font-size: 12px; color: var(--txt3); margin-top: 2px; }

/* ─── Auth pages ─────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 50%, var(--n800) 100%);
  padding: 24px 16px;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  overflow: hidden;
}
.auth-header {
  background: var(--green-800);
  padding: 28px 28px 24px;
  text-align: center;
}
.auth-logo { font-size: 32px; margin-bottom: 6px; }
.auth-title { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.auth-sub   { font-size: 13px; color: var(--green-300); margin-top: 2px; }
.auth-body  { padding: 28px; }
.auth-footer { text-align: center; font-size: 13px; color: var(--txt2); padding: 0 28px 24px; }
.auth-footer a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* Site footer */
.site-footer {
  width: calc(100% - 32px);
  max-width: 1280px;
  margin: 0 auto 24px;
  color: rgba(248,250,252,.82);
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-800) 58%, #0f766e 100%);
  border: 1px solid rgba(187,247,208,.18);
  border-radius: var(--r-lg);
  box-shadow: 0 18px 40px rgba(20,83,45,.18);
  overflow: hidden;
}
.footer-main {
  display: grid;
  gap: 24px;
  padding: 28px;
}
.footer-brand p {
  max-width: 440px;
  margin-top: 10px;
  color: rgba(248,250,252,.72);
  font-size: 14px;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}
.footer-logo-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green-500);
  color: var(--green-900);
  font-weight: 800;
}
.footer-heading {
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}
.footer-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}
.footer-col a,
.footer-col span {
  color: rgba(248,250,252,.76);
  text-decoration: none;
}
.footer-col a:hover {
  color: #fff;
}
.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.footer-social a {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.18);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.footer-social a:hover {
  background: var(--green-500);
  color: var(--green-900);
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 18px;
  padding: 14px 28px;
  color: rgba(248,250,252,.68);
  font-size: 12px;
  border-top: 1px solid rgba(255,255,255,.12);
  background: rgba(15,23,42,.18);
}
@media (max-width: 1023px) {
  .site-footer {
    margin-bottom: 92px;
  }
}

/* ─── Mobile bottom nav ──────────────────────── */
.mob-nav {
  display: flex;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  z-index: 150; padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 1024px) { .mob-nav { display: none; } }
.mob-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 9px 4px;
  text-decoration: none; color: var(--txt3);
  font-size: 10px; font-weight: 600; transition: color .13s;
}
.mob-nav a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mob-nav a.active { color: var(--accent); }

/* Phone experience */
@media (max-width: 599px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }
  body {
    background: linear-gradient(180deg, #effaf1 0%, #f8fafc 42%, #eef6ff 100%);
  }
  .shell,
  .main,
  .topbar,
  .page {
    max-width: 100vw;
  }
  .topbar {
    height: auto;
    min-height: 96px;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 12px;
  }
  .hamburger,
  .icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(255,255,255,.10);
  }
  .topbar-page-title {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-right {
    gap: 8px;
    margin-left: 0;
  }
  .topbar-search {
    display: block;
    flex: 0 0 100%;
    order: 5;
    max-width: none;
    width: 100%;
  }
  .topbar-search input {
    height: 42px;
    border-radius: 16px;
    background: rgba(255,255,255,.16);
  }
  .search-preview {
    top: calc(100% + 8px);
    max-height: min(360px, 62vh);
    overflow-y: auto;
  }
  .page {
    padding: 14px 12px 104px;
  }
  .ph {
    gap: 10px;
    margin-bottom: 16px;
  }
  .ph-title {
    font-size: 20px;
    line-height: 1.2;
    letter-spacing: 0;
  }
  .ph-sub {
    font-size: 13px;
  }
  .ph > .btn,
  .ph > .flex {
    width: 100%;
  }
  .ph > .flex .btn {
    flex: 1;
  }
  .card,
  .product-card,
  .crop-news-card {
    border-radius: 16px;
  }
  .card-body {
    padding: 16px;
  }
  .card-hd {
    padding: 13px 16px;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .stat {
    min-height: 118px;
    padding: 16px;
  }
  .stat-val {
    font-size: 24px;
  }
  .grid,
  .product-grid {
    gap: 12px;
  }
  .product-grid {
    grid-template-columns: 1fr;
  }
  .product-img,
  .product-img-placeholder {
    aspect-ratio: 16 / 10;
  }
  .product-body {
    padding: 13px 14px;
  }
  .product-ft {
    padding: 12px 14px;
  }
  .btn {
    min-height: 44px;
    border-radius: 14px;
  }
  .btn-sm {
    min-height: 38px;
    padding: 8px 12px;
  }
  .form-control {
    min-height: 46px;
    border-radius: 14px;
    font-size: 16px;
  }
  textarea.form-control {
    min-height: 112px;
  }
  .table-wrap {
    margin: 0 -4px;
    border-radius: 14px;
    overflow: visible;
  }
  table {
    min-width: 0;
  }
  .table-wrap thead {
    display: none;
  }
  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
  }
  .table-wrap tbody {
    display: grid;
    gap: 12px;
  }
  .table-wrap tbody tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
  }
  .table-wrap tbody tr:hover {
    background: var(--surface);
  }
  .table-wrap tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
    text-align: right;
  }
  .table-wrap tbody td:last-child {
    border-bottom: none;
  }
  .table-wrap tbody td::before {
    content: attr(data-label);
    color: var(--txt2);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    text-align: left;
    flex: 0 0 96px;
  }
  .table-wrap tbody td > .flex {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .seller-products-card .card-hd {
    align-items: center;
  }
  .seller-products-card .card-hd-title {
    font-size: 16px;
  }
  .seller-products-card .card-hd > .flex {
    flex: 1 1 auto;
    justify-content: flex-end;
    min-width: 0;
  }
  .seller-products-card .card-hd .btn-sm {
    flex: 0 1 auto;
    padding-inline: 11px;
  }
  .seller-products-table {
    margin: 0;
    padding: 12px;
  }
  .seller-products-table tbody {
    gap: 14px;
  }
  .seller-products-table tbody tr {
    padding: 14px;
    border-radius: 18px;
    overflow: hidden;
  }
  .seller-products-table tbody td {
    gap: 12px;
    min-width: 0;
    max-width: 100%;
    text-align: left;
  }
  .seller-products-table tbody td::before {
    flex: 0 0 92px;
  }
  .seller-products-table .seller-cell-stack,
  .seller-products-table .seller-insight-stack {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    display: grid;
    justify-items: end;
    gap: 4px;
    text-align: right;
    overflow-wrap: anywhere;
  }
  .seller-products-table .seller-insight-stack {
    justify-items: start;
    text-align: left;
  }
  .seller-products-table .seller-insight-stack .badge {
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
  }
  .seller-products-table .ai-inline-step {
    padding: 8px 10px;
    border: 1px solid var(--green-100);
    border-radius: 12px;
    background: var(--green-50);
  }
  .seller-products-table tbody td[data-label="Product"] {
    align-items: center;
    justify-content: flex-start;
    padding-top: 2px;
    padding-bottom: 12px;
    text-align: left;
  }
  .seller-products-table tbody td[data-label="Product"]::before {
    display: none;
  }
  .seller-products-table tbody td[data-label="Product"] > .flex {
    width: 100%;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: nowrap;
  }
  .seller-products-table tbody td[data-label="Product"] img,
  .seller-products-table tbody td[data-label="Product"] > .flex > div:first-child {
    width: 58px !important;
    height: 58px !important;
    border-radius: 14px !important;
    flex-shrink: 0;
  }
  .seller-products-table tbody td[data-label="Product"] .font-bold {
    min-width: 0;
    font-size: 18px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }
  .seller-products-table tbody td[data-label="Price"] .font-bold {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 17px;
    line-height: 1.35;
    text-align: right;
    white-space: normal;
  }
  .seller-products-table tbody td[data-label="Description"] {
    max-width: none !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
  }
  .seller-products-table tbody td[data-label="Actions"] > .flex {
    width: 100%;
    justify-content: stretch;
  }
  thead th {
    padding: 12px 14px;
  }
  .timeline-item {
    grid-template-columns: 14px 1fr;
  }
  .receipt-card {
    padding: 18px;
    border-radius: 16px;
  }
  .receipt-head,
  .receipt-grid,
  .receipt-total {
    flex-direction: column;
  }
  .receipt-no {
    text-align: left;
  }
  .site-footer {
    width: calc(100% - 24px);
    border-radius: 18px;
  }
  .footer-main {
    padding: 22px;
    gap: 20px;
  }
  .footer-bottom {
    padding: 14px 22px;
  }
  .mob-nav {
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid rgba(226,232,240,.95);
    border-radius: 22px;
    box-shadow: 0 18px 34px rgba(15,23,42,.18);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(14px);
  }
  .mob-nav a {
    min-height: 54px;
    border-radius: 16px;
    font-size: 10px;
    color: var(--n500);
  }
  .mob-nav a.active {
    color: var(--green-800);
    background: var(--green-100);
  }
  .mob-nav a svg {
    width: 21px;
    height: 21px;
  }
}

@media (max-width: 380px) {
  .mob-nav {
    overflow-x: auto;
    justify-content: flex-start;
  }
  .mob-nav a {
    flex: 0 0 64px;
  }
  .mob-nav::-webkit-scrollbar {
    display: none;
  }
}

/* ─── Utilities ──────────────────────────────── */
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; } .justify-center { justify-content: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; } .h-full { height: 100%; }
.text-sm { font-size: 13px; } .text-xs { font-size: 11px; } .text-lg { font-size: 17px; }
.text-muted { color: var(--txt2); } .text-danger { color: var(--red-700); }
.text-success { color: var(--green-700); } .font-bold { font-weight: 700; }
.font-mono { font-family: 'DM Mono', monospace; font-size: 13px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.section-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--txt3); margin-bottom: 10px; }
.rounded-full { border-radius: 9999px; }
.skeleton { background: linear-gradient(90deg,var(--n100) 25%,var(--n200) 50%,var(--n100) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--n300); border-radius: 99px; }

/* Crop news */
.crop-news-hero {
  display: grid;
  grid-template-columns: minmax(0,1.4fr) minmax(280px,.8fr);
  gap: 18px;
  align-items: stretch;
  background: linear-gradient(135deg, var(--green-900), var(--green-700));
  color: #fff;
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.news-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -8px 0 20px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--txt2);
  border: 1px solid var(--border);
  background: var(--surface);
}
.news-status::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.news-status span {
  color: var(--txt);
  font-weight: 800;
}
.news-status.live {
  border-color: var(--green-200);
  background: var(--green-50);
}
.news-status.live::before { background: var(--green-500); }
.news-status.fallback {
  border-color: #fde68a;
  background: #fffbeb;
}
.news-status.fallback::before { background: var(--amber-500); }
.crop-news-hero .section-lbl { color: var(--green-200); margin-bottom: 8px; }
.crop-news-hero h1 {
  max-width: 720px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: 0;
}
.crop-news-hero p {
  max-width: 680px;
  margin-top: 12px;
  color: var(--green-100);
  font-size: 15px;
}
.crop-news-hero-panel {
  display: grid;
  gap: 10px;
  align-content: center;
}
.crop-news-highlight {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-md);
  padding: 12px 14px;
}
.crop-news-highlight span {
  display: block;
  color: var(--green-200);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 3px;
}
.crop-news-highlight strong {
  display: block;
  color: #fff;
  font-size: 14px;
  line-height: 1.35;
}
.crop-news-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%,280px),1fr)); }
.crop-news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.crop-news-card-top,
.crop-news-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.crop-news-date,
.crop-news-footer span {
  color: var(--txt2);
  font-size: 12px;
  font-weight: 600;
}
.crop-news-card h2 {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}
.crop-news-card p {
  color: var(--txt2);
  font-size: 14px;
}
.crop-news-impact {
  background: var(--green-50);
  border: 1px solid var(--green-100);
  border-radius: var(--r-md);
  color: var(--green-900);
  font-size: 13px;
  padding: 12px;
  margin-top: auto;
}
.crop-news-impact span,
.crop-note span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
}
.crop-note {
  background: var(--n50);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  color: var(--txt2);
  font-size: 14px;
}
.crop-note span { color: var(--txt); }
@media (max-width: 760px) {
  .crop-news-hero { grid-template-columns: 1fr; padding: 22px; }
  .crop-news-card-top,
  .crop-news-footer { align-items: flex-start; flex-direction: column; }
}

/* Desktop layout polish */
@media (min-width: 1024px) {
  .topbar {
    padding: 0 34px;
    gap: 24px;
  }
  .topbar-logo {
    display: inline-flex;
  }
  .topbar-page-title {
    display: none;
  }
  .desktop-nav {
    display: flex;
    order: 2;
    margin: 0 auto;
  }
  .topbar-search {
    order: 1;
    flex: 0 1 240px;
    max-width: 240px;
  }
  .topbar-right { order: 3; }
  .page {
    max-width: 1500px;
    min-height: calc(100vh - var(--topbar-h) - 72px);
    margin-top: 64px;
    margin-bottom: 48px;
    padding: 42px 46px 56px;
    background: rgba(255,255,255,.88);
    border: 1px solid rgba(226,232,240,.9);
    border-radius: 30px;
    box-shadow: 0 24px 60px rgba(37,99,235,.10);
  }
  .topbar-profile,
  .logout-btn { display: inline-flex; }
  .site-footer {
    max-width: 1500px;
    margin-bottom: 48px;
    border-radius: 24px;
  }
  .footer-main {
    grid-template-columns: 1.4fr .8fr .8fr;
    padding: 32px 38px;
  }
  .footer-bottom {
    padding: 16px 38px;
  }
  .ph {
    align-items: center;
    margin-bottom: 28px;
  }
  .ph-title {
    font-size: 26px;
    line-height: 1.15;
    letter-spacing: 0;
  }
  .ph-sub {
    font-size: 15px;
  }
  .grid {
    gap: 20px;
  }
  .g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%,280px),1fr)); }
  .g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%,260px),1fr)); }
  .g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%,220px),1fr)); }
  .product-grid {
    gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(min(100%,260px),1fr));
  }
  .card-body {
    padding: 24px;
  }
  .card,
  .product-card,
  .crop-news-card {
    border-radius: 22px;
  }
  .card-hd {
    padding: 16px 24px;
  }
  .stat {
    min-height: 156px;
  }
  .table-wrap {
    border-radius: var(--r-md);
  }
  table {
    font-size: 14.5px;
  }
  thead th {
    padding: 12px 18px;
  }
  tbody td {
    padding: 15px 18px;
  }
}

@media (min-width: 1440px) {
  .topbar {
    padding: 0 48px;
  }
  .desktop-nav {
    gap: 12px;
  }
  .topbar-search {
    flex-basis: 280px;
    max-width: 280px;
  }
  .page {
    max-width: 1660px;
    padding: 48px 54px 64px;
  }
  .site-footer {
    max-width: 1660px;
  }
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px,1fr));
  }
  .crop-news-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px,1fr));
  }
}

@media (min-width: 1024px) and (max-width: 1180px) {
  .topbar {
    gap: 12px;
    padding: 0 22px;
  }
  .topbar-logo {
    font-size: 22px;
  }
  .topbar-logo-mark {
    width: 30px;
    height: 30px;
  }
  .topbar-search {
    display: none;
  }
  .desktop-nav {
    gap: 4px;
  }
  .desktop-nav a {
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }
  .desktop-nav a svg {
    width: 22px;
    height: 22px;
  }
  .topbar-profile {
    display: none;
  }
  .logout-btn {
    height: 44px;
    padding: 0 16px;
    border-radius: 14px;
  }
}

/* ── AgriChain mobile polish ─────────────────── */
@media (max-width: 599px) {

  /* Wider label column for long labels (Stock Left, AI Risk, Tracking) */
  .table-wrap tbody td::before {
    flex: 0 0 100px;
    font-size: 10px;
  }

  /* Action column buttons: stack vertically, full-width touch targets */
  .table-wrap tbody td > .flex.items-center {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: 100%;
  }
  .table-wrap tbody td > .flex.items-center .btn {
    width: 100%;
    justify-content: center;
    min-height: 40px;
  }

  /* ph Back/secondary button: auto width, not stretched */
  .ph > a.btn,
  .ph > .btn-secondary {
    width: auto !important;
    align-self: flex-start;
  }

  /* AI price suggestion box: stack vertically on phone */
  #ai-price-suggestion {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
  }
  #ai-price-suggestion button {
    width: 100%;
    margin-left: 0 !important;
  }

  /* AI badge inside table card */
  .ai-risk-badge {
    display: inline-flex;
    justify-content: flex-end;
  }

  .seller-products-table tbody td[data-label="Product"] > .flex.items-center {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
  }
  .seller-products-table tbody td[data-label="Product"] > .flex.items-center .font-bold {
    width: auto;
    text-align: left;
  }
}
