@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ═══════════════════════════════════════════════
   DESIGN TOKENS — Earthwell Brand System
   ═══════════════════════════════════════════════ */
:root {
  --earth-darkest: #173404;
  --earth-dark:    #27500A;
  --earth-mid:     #3B6D11;
  --earth-bright:  #639922;
  --earth-light:   #C0DD97;
  --earth-pale:    #EAF3DE;
  --loam:          #633806;
  --loam-mid:      #8B5014;
  --loam-light:    #FAEEDA;
  --loam-warm:     #F5C87A;
  --ink:           #1a1a18;
  --muted:         #5a5a52;
  --faint:         #8a8a7a;
  --rule:          #d8d6cc;
  --page:          #fafaf7;
  --white:         #ffffff;

  --font-serif: 'Lora', Georgia, serif;
  --font-sans:  'DM Sans', system-ui, sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --shadow:    0 4px 24px rgba(23,52,4,0.08);
  --shadow-lg: 0 8px 40px rgba(23,52,4,0.13);
  --nav-h:     68px;
}

/* ═══════════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════════ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(250,250,247,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
  display: flex; align-items: center;
  transition: box-shadow 0.2s;
}
.nav.scrolled { box-shadow: 0 2px 20px rgba(23,52,4,0.08); }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 32px;
}
.nav-logo { display: flex; flex-direction: column; gap: 2px; text-decoration: none; transition: opacity 0.2s; }
.nav-logo:hover { opacity: 0.75; }
.nav-logo-name { font-family: var(--font-serif); font-size: 20px; font-weight: 600; color: var(--earth-darkest); letter-spacing: -0.02em; line-height: 1; }
.nav-logo-sub  { font-size: 10px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--earth-mid); line-height: 1; }
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; }
.nav-links a {
  font-size: 13px; font-weight: 400; color: var(--muted);
  padding: 6px 12px; border-radius: 4px;
  transition: color 0.15s, background 0.15s; text-decoration: none;
}
.nav-links a:hover, .nav-links a.active { color: var(--earth-darkest); background: var(--earth-pale); }
.nav-cta {
  font-size: 13px; font-weight: 500; padding: 8px 18px; border-radius: 4px;
  background: var(--earth-darkest); color: var(--earth-light);
  transition: background 0.15s, transform 0.1s; letter-spacing: 0.01em;
  text-decoration: none; display: inline-block; white-space: nowrap;
}
.nav-cta:hover { background: var(--earth-dark); transform: translateY(-1px); }
.nav-hamburger { display: none; flex-direction: column; gap: 5px; padding: 8px; background: none; border: none; cursor: pointer; }
.nav-hamburger span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; }

/* ═══════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--page);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }


/* ═══════════════════════════════════════════════
   HEADER (decorative bar — no text)
   ═══════════════════════════════════════════════ */
header {
  background: var(--earth-darkest);
  height: 48px;
  margin-top: var(--nav-h);
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(99,56,6,0.3) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 85% 30%, rgba(39,80,10,0.35) 0%, transparent 55%);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════
   MAIN
   ═══════════════════════════════════════════════ */
main {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

main.wide { max-width: 1000px; padding-left: 1.5rem; padding-right: 1.5rem; }

h1 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--earth-darkest);
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

h2 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--earth-darkest);
  margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════ */
.card, #batch-card, .admin-card {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  transition: box-shadow 0.2s;
}

/* ═══════════════════════════════════════════════
   BATCH TRACE FIELDS
   ═══════════════════════════════════════════════ */
.batch-label {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.status {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--loam-mid);
  margin-bottom: 1rem;
}

.field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--rule);
  gap: 1rem;
}

.field:last-child { border-bottom: none; }

.label {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  white-space: nowrap;
  flex-shrink: 0;
}

.field span:last-child,
.field a {
  font-size: 0.95rem;
  text-align: right;
  color: var(--ink);
}

.field a { color: var(--earth-mid); text-decoration: underline; }

/* ═══════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.1rem;
}

.form-group label,
.form-group .label-row {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.label-row a {
  font-size: 0.78rem;
  color: var(--earth-bright);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.label-row a:hover { text-decoration: underline; }

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--earth-bright);
  box-shadow: 0 0 0 3px rgba(99,153,34,0.12);
}

.form-group input[readonly] {
  background: var(--earth-pale);
  color: var(--earth-dark);
  font-weight: 500;
  cursor: default;
  border-color: var(--earth-light);
}

/* ═══════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.65rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--earth-darkest);
  color: var(--earth-light);
  box-shadow: 0 2px 8px rgba(23,52,4,0.2);
}

.btn-primary:hover:not(:disabled) {
  background: var(--earth-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(23,52,4,0.3);
}

.btn-secondary {
  background: var(--earth-pale);
  color: var(--earth-dark);
  border: 1px solid var(--earth-light);
}

.btn-secondary:hover:not(:disabled) { background: var(--earth-light); }

.btn-danger {
  background: var(--loam-light);
  color: var(--loam);
  border: 1px solid var(--loam-warm);
}

.btn-danger:hover:not(:disabled) { background: #f5e0c8; }

/* ═══════════════════════════════════════════════
   WALLET BAR
   ═══════════════════════════════════════════════ */
.wallet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding: 0.85rem 1.1rem;
  background: var(--earth-pale);
  border: 1px solid var(--earth-light);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

.wallet-address {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--earth-dark);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════ */
#toast {
  display: none;
  margin-top: 1.1rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.5;
}

#toast.success {
  background: var(--earth-pale);
  color: var(--earth-dark);
  border: 1px solid var(--earth-light);
}

#toast.error {
  background: var(--loam-light);
  color: var(--loam);
  border: 1px solid var(--loam-warm);
}

#toast a { color: inherit; font-weight: 600; }

/* ═══════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════ */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 0.875rem;
  box-shadow: var(--shadow);
}

thead { background: var(--earth-darkest); color: var(--earth-light); }

th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-sans);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--earth-pale); }

/* ═══════════════════════════════════════════════
   INVENTORY
   ═══════════════════════════════════════════════ */
.inventory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.count-badge {
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--earth-pale);
  border: 1px solid var(--earth-light);
  color: var(--earth-mid);
  padding: 0.25rem 0.85rem;
  border-radius: 20px;
}

.search-bar {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  margin-bottom: 1.1rem;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 4px rgba(23,52,4,0.06);
}

.search-bar:focus {
  outline: none;
  border-color: var(--earth-bright);
  box-shadow: 0 0 0 3px rgba(99,153,34,0.12);
}

.trace-link {
  color: var(--earth-mid);
  font-weight: 500;
  white-space: nowrap;
}

.trace-link:hover { color: var(--earth-darkest); text-decoration: underline; }

.cert-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--earth-pale);
  border: 1px solid var(--earth-light);
  color: var(--earth-mid);
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  margin: 0.1rem;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--faint);
  font-family: var(--font-serif);
  font-style: italic;
}

/* ═══════════════════════════════════════════════
   WEATHER PANEL
   ═══════════════════════════════════════════════ */
.weather-panel {
  display: none;
  margin-top: 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.weather-panel.visible { display: block; }
.weather-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0.9rem;
  background: var(--earth-pale);
  font-size: 0.68rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--earth-mid);
}
.weather-status { font-style: italic; font-weight: 400; color: var(--faint); }
.weather-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.weather-table th {
  padding: 0.4rem 0.75rem; text-align: left;
  font-size: 0.68rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--faint);
  border-bottom: 1px solid var(--rule); background: var(--page);
}
.weather-table td { padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--rule); color: var(--ink); }
.weather-table tr:last-child td { border-bottom: none; }
.weather-table tr:hover td { background: var(--earth-pale); }
.weather-summary {
  padding: 0.5rem 0.9rem; font-size: 0.8rem;
  color: var(--muted); border-top: 1px solid var(--rule); background: var(--page);
}
.rain-dot { color: #4a8cdf; }

/* ═══════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════ */
footer {
  text-align: center;
  padding: 1.75rem;
  font-size: 0.8rem;
  color: var(--faint);
  border-top: 1px solid var(--rule);
  background: var(--white);
  margin-top: auto;
}

footer a { color: var(--earth-mid); font-weight: 500; }
footer a:hover { color: var(--earth-darkest); text-decoration: underline; }

/* ═══════════════════════════════════════════════
   EYEBROW / UTILITY
   ═══════════════════════════════════════════════ */
.eyebrow {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--earth-bright);
}

/* ═══════════════════════════════════════════════
   TWO-COL GRID
   ═══════════════════════════════════════════════ */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }

/* ═══════════════════════════════════════════════
   MOBILE NAV
   ═══════════════════════════════════════════════ */
.nav-mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  background: var(--white);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 8px 24px rgba(23,52,4,0.10);
  z-index: 99;
  flex-direction: column;
  padding: 0.5rem 0 1rem;
}
.nav-mobile-menu.open { display: flex; }
.nav-mobile-menu a {
  display: block;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: background 0.15s;
}
.nav-mobile-menu a:last-child { border-bottom: none; }
.nav-mobile-menu a:hover { background: var(--earth-pale); }
.nav-mobile-menu a.active { color: var(--earth-darkest); font-weight: 500; }
.nav-mobile-menu .nav-mobile-cta {
  margin: 0.75rem 1.5rem 0;
  padding: 0.7rem 1.25rem;
  background: var(--earth-darkest);
  color: var(--earth-light);
  border-radius: 4px;
  text-align: center;
  font-weight: 500;
  font-size: 0.875rem;
}
.nav-mobile-menu .nav-mobile-cta:hover { background: var(--earth-dark); }

/* ═══════════════════════════════════════════════
   TABLE SCROLL WRAPPER
   ═══════════════════════════════════════════════ */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
}
.table-scroll table { border-radius: 0; min-width: 560px; }

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 640px) {
  .nav-links, .nav-cta { display: none !important; }
  .nav-hamburger { display: flex !important; }

  .two-col { grid-template-columns: 1fr; }
  .field { flex-direction: column; gap: 0.2rem; }
  .field span:last-child, .field a { text-align: left; }
  .hide-mobile { display: none; }
  main { padding-top: calc(var(--nav-h) + 1.25rem); padding-left: 1rem; padding-right: 1rem; }
  main.wide { padding-left: 1rem; padding-right: 1rem; }

  .card, #batch-card, .admin-card { padding: 1.25rem; }
  .wallet-bar { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .inventory-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

  .weather-table th, .weather-table td { padding: 0.35rem 0.5rem; font-size: 0.8rem; }
}
