:root {
  /* Organic Guardians: deep pine green from the wordmark, warm paper, white cards.
     Red is deliberately demoted to one job — withdrawal warnings. */
  --pine: #175243;           /* brand green */
  --pine-deep: #0F3D31;      /* sidebar/hero depths */
  --pine-soft: #1C5F4E;      /* hovers on green */
  --pine-tint: #E3EDE4;      /* green-tinted wells */
  --page: #F8F4EB;           /* warm paper */
  --panel: #175243;          /* sidebar */
  --inset: #F2EDE1;          /* table headers, wells */
  --card: #FFFFFF;
  --offset: #F2EDE1;
  --offset-deep: #E9E2D2;
  --line: #E4DCCB;
  --line-soft: #EDE7D9;
  --ink: #1E2B26;            /* green-black */
  --ink-2: #64726B;
  --ink-3: #98A49D;
  --cream: #FAF6ED;          /* text on green */
  --red: #C43717;            /* the withdrawal stamp — alerts only */
  --red-soft: #D33030;
  --red-tint: #F6E3DB;
  --sage: #DCE8DC;
  --sage-ink: #2F5D46;
  --terra: #E2976E;
  --terra-tint: #F4E4D3;
  --terra-ink: #8F5B33;
  --btn: #175243;
  --btn-hi: #0F3D31;
  --r-card: 16px;
  --r-ctl: 10px;
  --r-pill: 999px;
  --font-display: "Fraunces", Georgia, serif;
  --font-ui: "Inter", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", Courier, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 14.5px/1.62 var(--font-ui);
  background: var(--page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
::selection { background: #D8E6D9; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #C9C0AC; border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- back lights: a slow warm wash, barely there ---------- */
.lights { position: fixed; inset: 0; z-index: -2; background: var(--page); overflow: hidden; }
.lights > div { position: absolute; border-radius: 50%; will-change: transform, opacity; }
.beam {
  width: 1200px; height: 800px; top: -420px; left: 50%; margin-left: -600px;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.9), transparent 70%);
  filter: blur(60px);
  animation: pulse 18s ease-in-out infinite alternate;
}
.orb-a {
  width: 760px; height: 760px; top: -140px; left: -260px;
  background: radial-gradient(closest-side, rgba(23, 82, 67, 0.10), transparent 70%);
  filter: blur(80px);
  animation: drift-a 55s ease-in-out infinite alternate;
}
.orb-b {
  width: 680px; height: 680px; top: 34%; right: -280px;
  background: radial-gradient(closest-side, rgba(220, 232, 220, 0.5), transparent 70%);
  filter: blur(85px);
  animation: drift-b 70s ease-in-out infinite alternate;
}
.orb-c {
  width: 560px; height: 560px; bottom: -260px; left: 22%;
  background: radial-gradient(closest-side, rgba(226, 151, 110, 0.12), transparent 70%);
  filter: blur(85px);
  animation: drift-c 84s ease-in-out infinite alternate;
}
@keyframes pulse   { from { opacity: 0.7; transform: scale(1); } to { opacity: 1; transform: scale(1.05); } }
@keyframes drift-a { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(150px, 110px, 0) scale(1.12); } }
@keyframes drift-b { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(-160px, -120px, 0) scale(1.08); } }
@keyframes drift-c { from { transform: translate3d(0,0,0) scale(1.04); } to { transform: translate3d(130px, -100px, 0) scale(0.96); } }

/* paper grain */
.grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  background-size: 280px;
  mix-blend-mode: multiply;
}

/* ---------- the wordmark: arched SVG (text fallback for white-label) ---------- */
.archmark { display: block; height: auto; }
.archmark text { font-family: var(--font-display); font-weight: 500; fill: currentColor; }
.brandtext .archmark { width: 182px; }
.authbrand .archmark { width: 300px; filter: drop-shadow(0 14px 36px rgba(0, 20, 12, 0.3)); }
.wordstack { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 0.94; }
.wordstack .wb { margin-left: 0.55em; margin-top: -0.03em; }

/* ---------- shell: sidebar + main ---------- */
.shell { display: flex; min-height: 100vh; }

.side {
  width: 264px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  padding: 1.9rem 1.1rem 1.4rem;
  background: linear-gradient(180deg, var(--panel), var(--pine-deep));
  border-right: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  color: var(--cream);
}
.brand { display: flex; align-items: center; gap: 0.8rem; text-decoration: none; color: var(--cream); padding: 0 0.4rem; }
.brand:hover { color: var(--cream); }
.brandtext { display: flex; flex-direction: column; line-height: 1.02; }
.wordmark {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.42rem;
  letter-spacing: 0.005em;
  text-transform: none;
}
.tagline {
  font-size: 0.56rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: rgba(250, 246, 237, 0.55);
  margin-top: 6px;
}

.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0.54rem 0.85rem;
  border-radius: var(--r-ctl);
  text-decoration: none;
  color: rgba(250, 246, 237, 0.72);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background 0.15s, color 0.15s;
}
.side nav a:hover { background: rgba(255, 255, 255, 0.08); color: var(--cream); }
.side nav a.active { background: var(--page); color: var(--pine); font-weight: 600; box-shadow: 0 2px 8px rgba(0, 20, 12, 0.25); }
.tick {
  width: 5px; height: 5px; flex: none; border-radius: 99px;
  background: rgba(250, 246, 237, 0.3);
  transition: background 0.15s, box-shadow 0.15s;
}
.side nav a.active .tick { background: var(--pine); box-shadow: none; }

.sidefoot { margin-top: auto; padding: 1rem 0.85rem 0; border-top: 1px solid rgba(250, 246, 237, 0.16); }
.sidefoot .who { font-size: 0.84rem; font-weight: 600; display: flex; align-items: center; gap: 0.55rem; color: var(--cream); }
.sidefoot .role {
  font-size: 0.56rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em;
  color: rgba(250, 246, 237, 0.8); background: rgba(255, 255, 255, 0.12); border-radius: 6px; padding: 0.12rem 0.5rem;
}
.sidefoot form { margin-top: 0.45rem; }
.sidefoot .linkish { color: rgba(250, 246, 237, 0.6); }
.sidefoot .linkish:hover { color: var(--cream); }

main { flex: 1; min-width: 0; padding: 2.8rem 3.2rem 2rem; max-width: 1160px; }
footer { color: var(--ink-3); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.12em; padding: 3rem 0 1rem; text-align: center; font-weight: 500; }

@media (max-width: 880px) {
  .shell { flex-direction: column; }
  .side { position: static; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.8rem; padding: 0.9rem 1rem; border-bottom: 0; }
  .side nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .side nav a { padding: 0.35rem 0.65rem; font-size: 0.78rem; }
  .sidefoot { margin: 0; border: 0; padding: 0; display: flex; align-items: center; gap: 0.8rem; }
  main { padding: 1.6rem 1.2rem 2rem; }
}

/* ---------- type: Fraunces display over Inter text ---------- */
h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.85rem;
  text-transform: none;
  letter-spacing: 0.005em;
  line-height: 1.18;
  margin: 0 0 1.2rem;
  text-wrap: balance;
  color: var(--ink);
}
h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.18rem;
  text-transform: none;
  letter-spacing: 0.01em;
  margin: 2.2rem 0 0.7rem;
  color: var(--ink);
}
a { color: var(--pine); font-weight: 600; text-decoration-color: #B9CDBB; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--pine-deep); }
.muted { color: var(--ink-2); }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  padding: 1.5rem 1.7rem;
  margin-bottom: 1.3rem;
  box-shadow: 0 1px 2px rgba(30, 43, 38, 0.04), 0 16px 40px -24px rgba(30, 43, 38, 0.22);
}
.card.narrow { max-width: 440px; margin: 1.4rem auto; }
.grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); margin-bottom: 0.4rem; }
.stat .big {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2.4rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--pine);
}
.stat .sub {
  margin-top: 0.45rem;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-2);
}

/* ---------- forms ---------- */
label { display: block; margin: 0.7rem 0; font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.11em; color: var(--ink-2); }
input, select, textarea {
  display: block;
  width: 100%;
  padding: 0.6rem 0.75rem;
  margin-top: 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  font: 400 0.95rem/1.4 var(--font-ui);
  text-transform: none;
  letter-spacing: normal;
  background: #FFFEFB;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: var(--ink-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--pine);
  box-shadow: 0 0 0 3px rgba(23, 82, 67, 0.16);
}
a:focus-visible, button:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(23, 82, 67, 0.3); border-radius: 8px; }
input[type="checkbox"] { display: inline-block; width: auto; margin-right: 0.45rem; accent-color: var(--pine); }
label.inline { font-weight: 400; font-size: 0.85rem; text-transform: none; letter-spacing: normal; color: var(--ink); }
textarea { min-height: 4rem; }
.formrow { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.formrow > label { flex: 1; min-width: 150px; }

button {
  font: 600 0.84rem/1.3 var(--font-ui);
  text-transform: none;
  letter-spacing: 0.02em;
  background: var(--btn);
  color: var(--cream);
  border: 0;
  border-radius: var(--r-pill);
  padding: 0.62rem 1.45rem;
  cursor: pointer;
  margin-top: 0.7rem;
  transition: background 0.15s, transform 0.1s;
}
button:hover { background: var(--btn-hi); }
button:active { transform: translateY(1px); }
button.small { padding: 0.3rem 0.85rem; font-size: 0.72rem; margin: 0; }
button.danger { background: var(--red); }
button.danger:hover { background: #A22C10; }
button.linkish {
  background: none; color: var(--ink-2); text-decoration: underline;
  text-transform: none; letter-spacing: normal;
  text-underline-offset: 2px; padding: 0; margin: 0; font-weight: 400; font-size: inherit;
  border-radius: 0;
}
button.linkish:hover { background: none; color: var(--ink); }

/* ---------- tables ---------- */
.tablewrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  margin-bottom: 1.3rem;
  box-shadow: 0 1px 2px rgba(30, 43, 38, 0.04), 0 16px 40px -24px rgba(30, 43, 38, 0.22);
}
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.62rem 0.95rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-2);
  background: var(--inset);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { font-size: 0.86rem; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--inset); }
tr:last-child td { border-bottom: 0; }
td.empty { color: var(--ink-3); text-align: center; padding: 2rem; font-family: var(--font-ui); }

/* ---------- pills ---------- */
.pill {
  display: inline-block;
  padding: 0.14rem 0.6rem;
  border-radius: var(--r-pill);
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 0;
  background: var(--offset);
  color: var(--ink-2);
  white-space: nowrap;
  vertical-align: middle;
}
.pill.organic, .pill.ok { background: var(--sage); color: var(--sage-ink); }
.pill.warn { background: var(--terra-tint); color: var(--terra-ink); }
.pill.bad { background: var(--red-tint); color: var(--red); }

.flash {
  padding: 0.8rem 1.15rem;
  border-radius: var(--r-ctl);
  margin-bottom: 1.2rem;
  font-weight: 500;
  font-size: 0.87rem;
}
.flash.ok { background: var(--sage); color: var(--sage-ink); }
.flash.error { background: var(--red-tint); color: var(--red); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.toolbar h1 { margin: 0; }
.toolbar .actions { display: flex; gap: 0.55rem; align-items: center; }
.toolbar .actions form { margin: 0; }
.toolbar .actions a { text-decoration: none; }

.lot-line { display: grid; grid-template-columns: 1fr 150px; gap: 0.9rem; align-items: end; }
@media (max-width: 560px) { .lot-line { grid-template-columns: 1fr; gap: 0.2rem; } }

/* ---------- auth: full green, one white card ---------- */
body.auth { min-height: 100vh; background: linear-gradient(165deg, var(--panel), var(--pine-deep)); color: var(--cream); }
body.auth .lights, body.auth .grain { display: none; }
.authmain { max-width: 430px; margin: 0 auto; padding: 9vh 1.2rem 3rem; }
.authbrand { display: flex; flex-direction: column; align-items: center; margin-bottom: 1.9rem; }
.authbrand .authhome { text-decoration: none; color: inherit; }
.authbrand .authhome:hover { color: inherit; opacity: 0.92; }
.authbrand .wordmark.big {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2.9rem;
  color: var(--cream);
  text-transform: none;
  letter-spacing: 0.005em;
  text-shadow: 0 12px 40px rgba(0, 20, 12, 0.35);
}
.authbrand .tagline { margin-top: 0.8rem; font-size: 0.6rem; color: rgba(250, 246, 237, 0.55); }
.authmain .card { padding: 1.9rem 2rem; border: 0; box-shadow: 0 24px 70px -30px rgba(0, 20, 12, 0.55); }
.authmain h1 { font-size: 1.45rem; }
.authmain button { width: 100%; margin-top: 1.1rem; }
.authmain .flash.error { background: var(--red-tint); }

@media (prefers-reduced-motion: reduce) {
  .lights > div { animation: none; }
  .brand .mark, .authbrand .bigmark, tbody tr, button { transition: none; }
}

/* ---------- print: clean documents ---------- */
@media print {
  .lights, .grain, .side, footer, .toolbar .actions, .noprint, .flash { display: none !important; }
  body { background: #fff !important; color: #000; font-size: 11px; }
  .shell { display: block; }
  main { max-width: none; margin: 0; padding: 0; }
  main::before {
    content: "ORGANIC CERTIFICATION RECORD";
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.16em;
    border-bottom: 2px solid #000;
    padding-bottom: 0.35rem;
    margin-bottom: 1rem;
  }
  .card, .tablewrap { background: #fff; border: 1px solid #bbb; box-shadow: none; border-radius: 4px; break-inside: avoid; }
  h1, h2, td, .muted, label { color: #000; }
  th { color: #333; background: #f2f2f2; }
  .pill { background: none; border: 1px solid #999; color: #000; }
  tbody tr:hover { background: none; }
  a { color: inherit; text-decoration: none; }
}
