/* ===================================================================
   Krishi Seva Kendra — Design tokens
   Palette: grown from soil + crop, not a generic SaaS kit.
   Headline serif: Fraunces (organic, characterful)
   Body sans: Inter (clean, legible at small sizes for form-heavy pages)
   =================================================================== */

:root {
  --soil-900: #2b2117;
  --soil-700: #4a3a28;
  --leaf-900: #1c3d1f;
  --leaf-700: #2e6b31;
  --leaf-500: #3f8a3f;
  --leaf-100: #e4efe0;
  --leaf-050: #f2f7ee;
  --wheat-500: #d9a441;
  --wheat-600: #c08a28;
  --wheat-100: #faedd2;
  --clay-600: #b5502e;
  --cream: #faf7ef;
  --paper: #ffffff;
  --ink: #262019;
  --ink-soft: #5b5348;
  --ink-faint: #8c8375;
  --line: #e4ddcd;
  --line-strong: #cfc5ac;
  --danger: #a5311f;
  --danger-bg: #fbe9e5;
  --success: #276b3a;
  --success-bg: #e7f2e5;

  --font-head: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --shadow-card: 0 1px 2px rgba(43, 33, 23, 0.06), 0 6px 20px rgba(43, 33, 23, 0.06);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  color: var(--leaf-900);
  margin: 0 0 0.5em;
  line-height: 1.15;
  font-weight: 600;
}

h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 500; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1em; color: var(--ink-soft); }

a { color: var(--leaf-700); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

button, input, select, textarea { font-family: inherit; font-size: 1rem; }

:focus-visible {
  outline: 2px solid var(--leaf-500);
  outline-offset: 2px;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.95rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--leaf-700); color: #fff; }
.btn-primary:hover { background: var(--leaf-900); }

.btn-accent { background: var(--wheat-500); color: var(--soil-900); }
.btn-accent:hover { background: var(--wheat-600); }

.btn-outline { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-outline:hover { border-color: var(--leaf-700); color: var(--leaf-700); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #7f2517; }

.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
}

.card-flat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

/* ---------- Forms ---------- */
.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--soil-700);
  margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--leaf-500);
  outline: none;
}
.field textarea { resize: vertical; min-height: 90px; }
.field-hint { font-size: 0.78rem; color: var(--ink-faint); margin-top: 4px; }
.field-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: 0.02em;
}
.badge-available, .badge-approved, .badge-fulfilled, .badge-active { background: var(--success-bg); color: var(--success); }
.badge-outofstock, .badge-rejected, .badge-deactivated { background: var(--danger-bg); color: var(--danger); }
.badge-pending { background: var(--wheat-100); color: var(--wheat-600); }

/* ---------- Top navigation ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 247, 239, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-size: 1.25rem;
  color: var(--leaf-900);
  font-weight: 600;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--leaf-700);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.nav-links a {
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.nav-links a:hover, .nav-links a.active { color: var(--leaf-900); background: var(--leaf-100); text-decoration: none; }
.nav-cta { display: flex; align-items: center; gap: 10px; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 6px; }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--paper);
    flex-direction: column;
    align-items: stretch;
    padding: 10px 16px 16px;
    border-bottom: 1px solid var(--line);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; }
  .nav-cta { display: none; }
  .nav-cta.open { display: flex; flex-direction: column; padding: 0 16px 16px; }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--leaf-900);
  color: #d9e4d4;
  margin-top: 4rem;
  padding: 2.5rem 0 1.5rem;
}
.site-footer a { color: #d9e4d4; }
.site-footer h4 { color: #fff; font-family: var(--font-body); font-size: 0.95rem; font-weight: 600; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.8rem;
  color: #a9bda3;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Hero ---------- */
.hero {
  padding: 64px 0 56px;
  background: linear-gradient(180deg, var(--leaf-050) 0%, var(--cream) 100%);
  border-bottom: 1px solid var(--line);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3rem;
  align-items: center;
}
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }
.hero-eyebrow-free { color: var(--wheat-600); font-weight: 600; font-size: 0.95rem; margin-bottom: 0.6rem; }
.hero-actions { display: flex; gap: 12px; margin-top: 1.6rem; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 2rem; margin-top: 2.2rem; flex-wrap: wrap; }
.hero-stat b { display: block; font-family: var(--font-head); font-size: 1.6rem; color: var(--leaf-900); }
.hero-stat span { font-size: 0.82rem; color: var(--ink-faint); }

/* ---------- Weather chip (hero accent) ---------- */
.weather-chip {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.4rem;
}
.weather-chip-top { display: flex; align-items: center; justify-content: space-between; }
.weather-temp { font-family: var(--font-head); font-size: 2.6rem; color: var(--leaf-900); }
.weather-place { font-size: 0.85rem; color: var(--ink-faint); text-transform: capitalize; }
.weather-cond { font-size: 0.95rem; color: var(--ink-soft); text-transform: capitalize; margin-top: 2px; }
.weather-meta { display: flex; gap: 1.2rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--ink-faint); }
.weather-icon { width: 56px; height: 56px; }

/* ---------- Section ---------- */
.section { padding: 56px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 1.8rem; flex-wrap: wrap; gap: 12px; }
.section-head p { margin: 0; }

/* ---------- Grids ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.4rem; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Product card ---------- */
.product-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.product-card:hover { border-color: var(--leaf-500); transform: translateY(-2px); }
.product-thumb {
  height: 240px;
  background: var(--leaf-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--leaf-700);
}
.product-body { padding: 1.1rem; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-cat { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--wheat-600); font-weight: 600; }
.product-name { font-family: var(--font-head); font-size: 1.05rem; color: var(--leaf-900); margin: 0; }
.product-price { font-size: 1.05rem; font-weight: 600; color: var(--soil-900); margin-top: 4px; }
.product-price span { font-size: 0.78rem; font-weight: 400; color: var(--ink-faint); }
.product-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; }

/* ---------- Category chip strip ---------- */
.chip-row { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid var(--line-strong);
  background: var(--paper);
  padding: 8px 16px;
  border-radius: 100px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--ink-soft);
}
.chip.active { background: var(--leaf-700); border-color: var(--leaf-700); color: #fff; }

/* ---------- Icon tile ---------- */
.icon-tile {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--leaf-100);
  display: flex; align-items: center; justify-content: center;
  color: var(--leaf-700);
  margin-bottom: 12px;
}

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 640px; }
thead th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--leaf-050);
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--leaf-050); }

.product-detail-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 2.4rem; }
@media (max-width: 760px) { .product-detail-grid { grid-template-columns: 1fr; } }

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
}
.auth-card { width: 100%; max-width: 440px; }
.auth-head { text-align: center; margin-bottom: 1.6rem; }

/* ---------- Dashboard layout ---------- */
.dash-layout { display: grid; grid-template-columns: 230px 1fr; gap: 2rem; align-items: start; }
@media (max-width: 860px) { .dash-layout { grid-template-columns: 1fr; } }
.dash-side { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 4px; }
.dash-side a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: 0.92rem; font-weight: 500;
}
.dash-side a:hover, .dash-side a.active { background: var(--leaf-100); color: var(--leaf-900); text-decoration: none; }
.dash-side .dash-side-heading { font-size: 0.72rem; text-transform: uppercase; color: var(--ink-faint); padding: 10px 14px 4px; letter-spacing: 0.04em; }

.stat-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 1.2rem; }
.stat-card b { display: block; font-family: var(--font-head); font-size: 1.9rem; color: var(--leaf-900); }
.stat-card span { font-size: 0.82rem; color: var(--ink-faint); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--ink-faint); }
.empty-state .icon-tile { margin: 0 auto 14px; }

/* ---------- Alerts / toast ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.88rem; margin-bottom: 1rem; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(165,49,31,0.25); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(39,107,58,0.25); }

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--soil-900);
  color: #fff;
  padding: 12px 22px;
  border-radius: 100px;
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
#toast.error { background: var(--danger); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(38, 32, 25, 0.5);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal-box { background: var(--paper); border-radius: var(--radius-lg); padding: 1.6rem; width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--ink-faint); font-size: 1.3rem; line-height: 1; }

/* ---------- Skeleton loading ---------- */
.skeleton { background: linear-gradient(90deg, var(--line) 25%, #efe9d9 37%, var(--line) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Utility ---------- */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-center { text-align: center; }
.text-muted { color: var(--ink-faint); }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; align-items: center; gap: 10px; }
.hidden { display: none !important; }

/* Product image */
.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    padding: 8px;
    box-sizing: border-box;
}