/* ==========================================================================
   AgrowBizz — base design system.
   Implements the FarmMate Style Guide tokens (v1.0) as the site-wide base CSS,
   shared by the marketing website and the logged-in app so they feel like one
   product. A product of RX ALPHA TECH.
   ========================================================================== */

:root {
  /* Core palette (Style Guide §01) */
  --forest:  #24493B;   /* primary dark green */
  --soil:    #6B4A32;   /* brown */
  --clay:    #C0663B;   /* terracotta — emphasis */
  --teal:    #0F766E;   /* ACCENT — CTAs & live data */
  --teal-dk: #0b5a54;
  --paper:   #F4EEE3;   /* warm page background */
  --surface: #FBF7EF;   /* card surface */
  --hairline:#E4DBCC;   /* borders */
  --ink:     #2A2320;   /* text */
  --muted:   #6B5E52;   /* secondary text */
  --alert:   #B6902A;   /* amber / warning */
  --danger:  #B6902A;   /* legacy alias used in older templates */

  /* Species colors (Style Guide §03) */
  --sp-cow: #24493B; --sp-horse: #C0663B; --sp-goat: #0F766E;
  --sp-sheep: #B6902A; --sp-chicken: #8A4B2E; --sp-other: #6B5E52;

  /* Type — Archivo (grotesque) + JetBrains Mono for figures/codes */
  --font-sans: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(42, 35, 32, 0.04), 0 8px 24px rgba(42, 35, 32, 0.06);
  --maxw: 1080px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  font-size: 16px;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); }

/* --- Type scale (Style Guide §02) ------------------------------------------ */
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 3vw, 2rem); font-weight: 700; }
h2 { font-size: 1.4rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
.display {
  font-size: clamp(2.3rem, 6vw, 3.6rem);
  font-weight: 800; line-height: 1.04; letter-spacing: -0.025em; margin: 0 0 1rem;
}
.label {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--muted);
}
.figure { font-family: var(--font-mono); font-weight: 600; }
.accent { color: var(--clay); }
.muted { color: var(--muted); font-size: 0.92rem; }

/* --- Layout ---------------------------------------------------------------- */
.container { max-width: 640px; margin: 2rem auto; padding: 0 1.25rem; }
.container.wide { max-width: var(--maxw); }
.section { padding: 3.5rem 0; }
.section.tint { background: var(--surface); }
.section.dark { background: var(--forest); color: var(--paper); }
.section.dark h1, .section.dark h2, .section.dark h3 { color: #fff; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

/* --- Site header (app shell) ----------------------------------------------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.25rem; background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.brand {
  font-weight: 800; color: var(--forest); text-decoration: none; font-size: 1.2rem;
  letter-spacing: -0.02em; display: inline-flex; align-items: center; gap: 0.5rem;
}
.brand .dot { color: var(--teal); }
.site-header nav { display: flex; align-items: center; gap: 1rem; }
.site-header nav a { color: var(--ink); text-decoration: none; }

/* --- Buttons (Style Guide §05 — min 48px, rounded not soft) ----------------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0.6rem 1.25rem;
  background: var(--teal); color: #fff; border: 1px solid var(--teal);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 1rem;
  font-weight: 600; cursor: pointer; text-decoration: none; transition: filter .15s;
}
button:hover, .btn:hover { filter: brightness(0.94); }
.btn.dark { background: var(--forest); border-color: var(--forest); }
.btn.secondary, .btn.ghost {
  background: transparent; color: var(--ink); border-color: var(--hairline);
}
.btn.secondary:hover, .btn.ghost:hover { background: rgba(42,35,32,0.04); filter: none; }
.btn.on-dark { background: #fff; color: var(--forest); border-color: #fff; }
.btn.small { min-height: 38px; padding: 0.4rem 0.9rem; font-size: 0.9rem; }

/* --- Forms ----------------------------------------------------------------- */
form p { margin: 0 0 1rem; }
label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], select, textarea {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal);
}
.helptext { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }
ul.errorlist { color: var(--clay); list-style: none; padding: 0; margin: 0.25rem 0; font-size: 0.9rem; }
form.inline { display: inline; margin: 0; }
.linkbtn { background: none; border: 0; color: var(--ink); cursor: pointer; padding: 0; font: inherit; min-height: 0; }
.linkbtn:hover { filter: none; text-decoration: underline; }

/* --- Messages -------------------------------------------------------------- */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.msg { padding: 0.65rem 0.9rem; border-radius: var(--radius-sm); margin-bottom: 0.5rem; border: 1px solid var(--hairline); background: var(--surface); }
.msg.success { background: #e7f1ea; border-color: #cfe3d6; color: #1e4620; }
.msg.error, .msg.warning { background: #f6efda; border-color: #ecdcae; color: #6f5510; }

/* --- Cards, lists, tables -------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow);
}
.stacklist { list-style: none; padding: 0; margin: 0.5rem 0; }
.stacklist li { padding: 0.55rem 0; border-bottom: 1px solid var(--hairline); }
.stacklist li:last-child { border-bottom: 0; }
.checkbox-list ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.checkbox-list label { font-weight: 400; display: inline-flex; align-items: center; gap: 0.35rem; }
.actions { display: flex; gap: 0.6rem; margin-top: 1rem; align-items: center; flex-wrap: wrap; }
.aux-links { margin-top: 1.25rem; font-size: 0.9rem; }
.filter { margin: 1rem 0; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.filter label { margin: 0; }
.filter select { width: auto; }

/* Search + filter bar (animal list) — all controls share one 44px height */
.filter-bar { --control-h: 44px; margin: 1rem 0 0.5rem; display: flex; gap: 0.5rem;
  align-items: center; flex-wrap: wrap; }
.filter-bar select {
  width: auto; min-width: 132px; height: var(--control-h); padding: 0 2rem 0 0.9rem;
  border: 1px solid var(--hairline); border-radius: 999px; background: var(--surface);
  color: var(--ink); font: inherit; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236B5E52' stroke-width='1.6'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 14px;
}
.filter-bar select:hover { border-color: var(--muted); }
.filter-bar .search-field { position: relative; flex: 1 1 260px; min-width: 220px; }
.filter-bar .search-field i { position: absolute; left: 0.95rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 18px; pointer-events: none; transition: color .15s ease; }
.filter-bar .search-field input[type="search"] {
  width: 100%; height: var(--control-h); margin: 0; padding: 0 1rem 0 2.6rem;
  border: 1px solid var(--hairline); border-radius: 999px; background: var(--surface);
  color: var(--ink); font: inherit; appearance: none; -webkit-appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.filter-bar .search-field input[type="search"]::placeholder { color: var(--muted); }
.filter-bar .search-field input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.filter-bar .search-field input[type="search"]:focus {
  outline: none; background: #fff; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15,118,110,0.14);
}
.filter-bar .search-field:focus-within i { color: var(--teal); }
.filter-bar select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,118,110,0.14); }
.filter-bar .btn { height: var(--control-h); min-height: var(--control-h); border-radius: 999px; }
.result-count { margin: 0.25rem 0 1rem; color: var(--muted); font-size: 0.85rem; }

.tbl { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.tbl th, .tbl td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--hairline); }
.tbl th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.tbl thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.tbl tbody tr { transition: background-color .12s ease; }
.tbl tbody tr:hover { background: rgba(15,118,110,0.055); }
.tbl tbody tr:last-child td { border-bottom: 0; }

/* Sortable headers (added by tables.js) */
.tbl th.dt-sortable { cursor: pointer; user-select: none; white-space: nowrap; padding-right: 1.4rem; position: relative; }
.tbl th.dt-sortable:hover { color: var(--ink); }
.tbl th.dt-sortable::after { content: "\2195"; position: absolute; right: 0.55rem; opacity: 0.3; font-size: 0.9em; }
.tbl th.dt-asc::after { content: "\2191"; opacity: 1; color: var(--teal); }
.tbl th.dt-desc::after { content: "\2193"; opacity: 1; color: var(--teal); }

/* Data-table toolbar (search + count) */
.dt-bar { display: flex; align-items: center; gap: 0.75rem; margin: 0.75rem 0 0.4rem; flex-wrap: wrap; }
.dt-search { position: relative; flex: 1 1 240px; min-width: 200px; }
.dt-search i { position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%); color: var(--muted);
  font-size: 17px; pointer-events: none; transition: color .15s ease; }
.dt-search input[type="search"] { width: 100%; height: 42px; margin: 0; padding: 0 1rem 0 2.5rem;
  border: 1px solid var(--hairline); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: inherit; appearance: none; -webkit-appearance: none; transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
.dt-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.dt-search input[type="search"]:focus { outline: none; background: #fff; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15,118,110,0.14); }
.dt-search:focus-within i { color: var(--teal); }
.dt-count { margin-left: auto; color: var(--muted); font-size: 0.82rem; font-family: var(--font-mono); white-space: nowrap; }

.tree, .tree ul { list-style: none; padding-left: 1.1rem; border-left: 1px solid var(--hairline); margin: 0.35rem 0; }
.tree > li:first-child { border-left: 0; }
.tree li { padding: 0.2rem 0; }

/* --- Chips & badges (Style Guide §05) -------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.6rem;
  border-radius: 999px; font-size: 0.78rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--hairline); color: var(--ink);
}
.chip.teal { background: rgba(15,118,110,0.1); border-color: rgba(15,118,110,0.25); color: var(--teal-dk); }
.chip.alert { background: rgba(182,144,42,0.12); border-color: rgba(182,144,42,0.3); color: #6f5510; }

/* --- AI advisor — chat screen ---------------------------------------------- */
.adv { display: flex; flex-direction: column; min-height: calc(100vh - 150px); }
.adv-head { display: flex; align-items: center; gap: 0.75rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--hairline); }
.adv-logo { width: 42px; height: 42px; border-radius: 13px; flex: none; display: inline-flex; align-items: center;
  justify-content: center; background: rgba(15,118,110,0.12); color: var(--teal); font-size: 1.4rem; }
.adv-head-t { flex: 1; min-width: 0; }
.adv-title { font-weight: 800; font-size: 1.15rem; line-height: 1.1; }
.adv-sub { font-size: 0.85rem; }
.adv-farm select { width: auto; min-width: 120px; padding: 0.4rem 0.7rem; border-radius: 999px; }
.adv-demo { margin: 0.9rem 0 0; }

.adv-stream { flex: 1; padding: 1.25rem 0 0.5rem; }
.adv-row { display: flex; gap: 0.55rem; align-items: flex-end; margin-bottom: 1rem; }
.adv-row.user { justify-content: flex-end; }
.adv-av { width: 34px; height: 34px; border-radius: 50%; flex: none; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 0.9rem; box-shadow: 0 0 0 3px var(--paper); }
.adv-av.ai { background: rgba(15,118,110,0.12); color: var(--teal); }
.adv-av.me { background: var(--forest); color: #fff; }
.adv-bubble { max-width: min(80%, 640px); padding: 0.7rem 0.95rem; border-radius: 18px; line-height: 1.55;
  background: var(--surface); border: 1px solid var(--hairline); border-bottom-left-radius: 5px; }
.adv-bubble p { margin: 0 0 0.55rem; }
.adv-bubble p:last-child { margin-bottom: 0; }
.adv-row.user .adv-bubble { background: var(--teal); color: #fff; border: 1px solid var(--teal);
  border-radius: 18px; border-bottom-right-radius: 5px; }

.adv-welcome { text-align: center; padding: 2rem 1rem 1.5rem; }
.adv-welcome h2 { margin: 0.75rem 0 0.35rem; }
.adv-welcome .adv-av.lg { width: 60px; height: 60px; font-size: 2rem; margin: 0 auto; box-shadow: none; }

.adv-history { margin-top: 1.5rem; }
.adv-hist-list { list-style: none; padding: 0; margin: 0.5rem 0 0; display: flex; flex-direction: column; gap: 0.45rem; }
.adv-hist-list a { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.9rem; text-decoration: none;
  color: var(--ink); background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; transition: border-color .15s ease; }
.adv-hist-list a:hover { border-color: var(--teal); }
.adv-hist-list .ah-ico { color: var(--teal); font-size: 1.15rem; }
.adv-hist-list .ah-t { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adv-hist-list .ah-d { font-size: 0.8rem; }
.adv-hist-list .ah-go { color: var(--muted); }

/* Composer — sticky to the bottom of the chat */
.adv-composer { position: sticky; bottom: 0; background: var(--paper); padding: 0.75rem 0 0.5rem; }
.adv-suggest { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.65rem; }
.sugg { min-height: 0; padding: 0.4rem 0.85rem; border-radius: 999px; font-size: 0.85rem; font-weight: 500;
  background: var(--surface); color: var(--ink); border: 1px solid var(--hairline); cursor: pointer; }
.sugg:hover { filter: none; border-color: var(--teal); color: var(--teal-dk); }
.adv-input { display: flex; align-items: flex-end; gap: 0.5rem; background: var(--surface);
  border: 1px solid var(--hairline); border-radius: 24px; padding: 0.35rem 0.35rem 0.35rem 1rem; box-shadow: var(--shadow); }
.adv-input:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,118,110,0.12); }
.adv-input textarea { flex: 1; border: 0; background: transparent; resize: none; padding: 0.55rem 0; margin: 0;
  font: inherit; line-height: 1.5; max-height: 160px; }
.adv-input textarea:focus { outline: none; }
.adv-send { width: 44px; height: 44px; min-height: 0; border-radius: 50%; padding: 0; flex: none; font-size: 1.15rem; }
.adv-send:disabled { opacity: 0.6; cursor: default; }
.adv-foot { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.4rem; padding: 0 0.4rem; font-size: 0.8rem; }
.adv-usage { margin-left: auto; }
.adv-thinking { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--teal-dk); font-weight: 600; }
.adv-thinking .dots { display: inline-flex; gap: 3px; }
.adv-thinking .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); display: inline-block;
  animation: adv-blink 1.2s infinite ease-in-out both; }
.adv-thinking .dots i:nth-child(2) { animation-delay: 0.2s; }
.adv-thinking .dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes adv-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* ==========================================================================
   Marketing website
   ========================================================================== */

/* Public nav */
.site-nav { border-bottom: 1px solid var(--hairline); background: var(--paper); position: sticky; top: 0; z-index: 20; }
.site-nav .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 0.9rem; padding-bottom: 0.9rem; }
.site-nav .links { display: flex; align-items: center; gap: 1.4rem; }
.site-nav .links a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.site-nav .links a:hover { color: var(--teal); }
.nav-menu { display: flex; align-items: center; gap: 1.4rem; }
@media (max-width: 720px) {
  .nav-menu { display: none; }
}

/* Badge pill (hero / section eyebrows) */
.badge { display: inline-flex; align-items: center; gap: 0.45rem; background: #E7F0EF;
  color: var(--teal); border-radius: 20px; padding: 0.4rem 0.85rem; font-size: 0.8rem;
  font-weight: 600; margin-bottom: 1.1rem; }
.badge.on-teal { background: rgba(255,255,255,0.14); color: #fff; }

/* Feature icon tile */
.feat-ico { width: 52px; height: 52px; border-radius: 14px; display: inline-flex;
  align-items: center; justify-content: center; margin-bottom: 1rem; font-size: 1.6rem; }
.feat-ico.green { background: #E7F0EF; color: var(--forest); }
.feat-ico.clay  { background: #F0E3D7; color: var(--soil); }
.feat-ico.teal  { background: #E7F0EF; color: var(--teal); }
.feat-ico.dark  { background: rgba(255,255,255,0.12); color: #5EC8BC; }

/* Hero */
.hero { padding: 3.5rem 0 2.5rem; background: radial-gradient(120% 120% at 0% 0%, #F7F2E8, #EFE7D9); }
.hero .wrap { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 2.5rem; align-items: center; }
.hero .lede { font-size: 1.1rem; color: var(--muted); max-width: 34ch; margin: 0 0 1.5rem; }
.hero-cta { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.hero-note { font-size: 0.85rem; color: var(--muted); }
.hero-art {
  background: var(--forest); border-radius: 20px; padding: 1.5rem; color: var(--paper);
  box-shadow: var(--shadow); min-height: 260px; display: flex; flex-direction: column; justify-content: center; gap: 0.75rem;
}
@media (max-width: 820px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
}

/* Species band */
.species-band { background: var(--forest); color: var(--paper); padding: 1.25rem 0; }
.species-band .wrap { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; }
.species-tag {
  display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.4rem 0.85rem;
  border-radius: 999px; font-weight: 600; font-size: 0.9rem; color: #fff;
}
.species-tag .code { font-family: var(--font-mono); font-size: 0.75rem; opacity: 0.85; }

/* Feature grid */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.5rem; }
.feature { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 1.4rem; }
.feature.dark { background: var(--forest); color: var(--paper); border-color: var(--forest); }
.feature.dark p { color: rgba(244,238,227,0.85); }
.feature h3 { margin-top: 0.25rem; }
.feature .ico { font-size: 1.5rem; }
@media (max-width: 820px) { .feature-grid { grid-template-columns: 1fr; } }

/* Stats */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; text-align: center; }
.stat .num { font-family: var(--font-mono); font-size: 2.2rem; font-weight: 700; color: var(--teal); }
.section.dark .stat .num { color: #6fd0c6; }
@media (max-width: 620px) { .stat-row { grid-template-columns: 1fr; gap: 1rem; } }

/* Advisor spotlight card */
.spotlight { background: var(--teal); color: #fff; border-radius: 20px; padding: 2rem; }
.spotlight .advisor-demo { background: rgba(255,255,255,0.12); border-radius: var(--radius); padding: 1rem; margin-top: 1rem; font-size: 0.95rem; }

/* CTA band */
.cta-band { background: var(--forest); color: var(--paper); }
.cta-band .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; padding-top: 2.5rem; padding-bottom: 2.5rem; }
.cta-band h2 { color: #fff; margin: 0; }

/* Pricing */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.5rem; align-items: start; }
.plan-card { position: relative; background: var(--surface); border: 1px solid var(--hairline); border-radius: 22px; padding: 2rem; display: flex; flex-direction: column; }
.plan-card.featured { background: var(--forest); color: var(--paper); border-color: var(--forest); box-shadow: 0 24px 48px -18px rgba(36,73,59,0.6); }
.pop-badge { position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: var(--teal); color: #fff; border-radius: 20px; padding: 0.35rem 1rem;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap; }
.price-toggle { display: inline-flex; background: #EAE1D0; border-radius: 12px; padding: 4px; margin-top: 0.5rem; }
.price-toggle a { padding: 0.55rem 1.25rem; border-radius: 9px; font-weight: 600; font-size: 0.9rem; color: var(--muted); text-decoration: none; }
.price-toggle a.active { background: var(--forest); color: #fff; }
.check-list li.no::before { content: "✕"; color: #A79A8B; }
.check-list li.no { color: #A79A8B; }
.plan-card.featured .muted, .plan-card.featured .check-list li { color: rgba(244,238,227,0.9); }
.plan-price { font-family: var(--font-mono); font-size: 2rem; font-weight: 700; margin: 0.5rem 0; }
.plan-price .per { font-family: var(--font-sans); font-size: 0.9rem; font-weight: 400; color: var(--muted); }
.plan-card.featured .plan-price .per { color: rgba(244,238,227,0.8); }
.check-list { list-style: none; padding: 0; margin: 1rem 0; flex: 1; }
.check-list li { padding: 0.35rem 0 0.35rem 1.5rem; position: relative; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--teal); font-weight: 700; }
.plan-card.featured .check-list li::before { color: #6fd0c6; }
@media (max-width: 820px) { .pricing-grid { grid-template-columns: 1fr; } }

/* Prose (about, long text) */
.prose { max-width: 68ch; }
.prose p { margin: 0 0 1rem; }

/* Footer */
.marketing-footer { background: var(--ink); color: rgba(244,238,227,0.75); padding: 2.5rem 0; }
.marketing-footer a { color: rgba(244,238,227,0.9); text-decoration: none; }
.marketing-footer a:hover { color: #fff; }
.marketing-footer .cols { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.marketing-footer .foot-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.marketing-footer .credit { margin-top: 1.5rem; font-size: 0.85rem; }

.site-footer { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: 0.9rem; }

/* ==========================================================================
   Logged-in app shell (sidebar layout, matching the design's web app)
   ========================================================================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex: none; background: var(--forest); color: #fff;
  display: flex; flex-direction: column; padding: 1.5rem 1rem;
  position: sticky; top: 0; height: 100vh;
  /* The nav can be taller than the viewport (owner has many links). Without
     this it spills out below the 100vh coloured box and the background looks
     like it "disappears" on scroll — scroll the nav inside the sidebar
     instead so the forest fill always covers the full viewport height. */
  overflow-y: auto;
}
/* Slim, on-brand scrollbar for the sidebar nav. */
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 8px; }
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.18) transparent; }
.side-brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none;
  color: #fff; padding: 0 0.5rem 1.25rem; margin-bottom: 0.5rem; flex: none;
  border-bottom: 1px solid rgba(255,255,255,0.1); }
.side-brand .mark { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center; }
.side-brand .mark i { font-size: 22px; color: var(--paper); }
.side-brand .name { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.side-brand .dot, .brand .dot { color: #5EC8BC; }

.side-nav { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.75rem; }
.side-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.85rem;
  border-radius: 12px; color: #9FBDB2; font-weight: 600; font-size: 0.95rem; text-decoration: none; }
.side-link i { font-size: 20px; }
.side-link:hover { color: #fff; background: rgba(255,255,255,0.06); }
.side-link.active { background: var(--teal); color: #fff; }

.side-user { margin-top: auto; display: flex; align-items: center; gap: 0.6rem; flex: none;
  padding: 0.75rem 0.5rem 0; border-top: 1px solid rgba(255,255,255,0.1); }
.side-user .avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--teal);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.side-user .who .n { font-size: 0.85rem; font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; }
.side-user .who .r { font-size: 0.72rem; color: #9FBDB2; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1.5rem;
  background: var(--surface); border-bottom: 1px solid var(--hairline); }
.app-topbar .spacer { flex: 1; }
.app-topbar .topbar-email { font-size: 0.85rem; }
.side-toggle { display: none; background: none; border: 0; color: var(--ink); min-height: 0; padding: 0; }
.side-toggle i { font-size: 24px; }
.app-content { flex: 1; padding: 1.75rem 2rem; max-width: 1100px; width: 100%; }
.app-footer { padding: 1.25rem 2rem; color: var(--muted); font-size: 0.85rem; }
.nav-scrim { display: none; }

@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .sidebar { transform: translateX(0); }
  .app.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 40; }
  .side-toggle { display: inline-flex; }
  .app-content { padding: 1.25rem; }
}

/* --- Dashboard ------------------------------------------------------------- */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.dash-head h1 { margin: 0.25rem 0 0; font-size: 1.9rem; font-weight: 800; }
.dash-head .eyebrow { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.dash-controls { display: flex; gap: 0.5rem; align-items: center; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px; padding: 1.1rem 1.25rem; }
.kpi .k { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.kpi .val { font-family: var(--font-mono); font-size: 1.65rem; font-weight: 600; margin-top: 0.35rem; }
.kpi .val.pos { color: var(--teal); }
.kpi .delta { font-size: 0.78rem; font-weight: 600; margin-top: 0.25rem; }
.kpi .delta.up { color: var(--teal); }
.kpi .delta.down { color: var(--clay); }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
.dash-grid.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .dash-grid, .dash-grid.even { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--hairline); border-radius: 18px; padding: 1.4rem 1.5rem; }
.panel h2, .panel h3 { margin: 0 0 0.25rem; font-size: 1.05rem; font-weight: 700; }
.panel .sub { font-size: 0.8rem; color: var(--muted); margin: 0 0 1rem; }

.bar-row { margin-bottom: 0.9rem; }
.bar-row .top { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.35rem; }
.bar-row .top .c { font-family: var(--font-mono); color: var(--muted); }
.bar-track { height: 10px; background: #EAE1D0; border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; }

.rank-list { display: flex; flex-direction: column; gap: 0.7rem; }
.rank-item { display: flex; align-items: center; gap: 0.85rem; }
.rank-item .num { font-family: var(--font-mono); font-weight: 600; width: 18px; color: var(--muted); }
.rank-item .num.first { color: var(--teal); }
.rank-item .av { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.rank-item .av i { font-size: 20px; }
.rank-item .who { flex: 1; min-width: 0; }
.rank-item .who .n { font-weight: 700; font-size: 0.95rem; }
.rank-item .who .m { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.rank-item .amt { font-family: var(--font-mono); font-weight: 600; color: var(--teal); }

/* --- Animal list (cards) --------------------------------------------------- */
.animal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0.85rem; }
.animal-card { display: flex; flex-direction: column; gap: 0.75rem; background: var(--surface);
  border: 1px solid var(--hairline); border-radius: 16px; padding: 1rem; text-decoration: none; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease; }
.animal-card:hover { border-color: var(--teal); box-shadow: 0 6px 18px rgba(15,118,110,0.08); }
.animal-card .head { display: flex; align-items: center; gap: 0.85rem; }
.animal-card .mark { width: 52px; height: 52px; border-radius: 14px; flex: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: #fff; }
.animal-card .mark i { font-size: 26px; }
.animal-card .mark img { width: 100%; height: 100%; object-fit: cover; }
.animal-card .ident { flex: 1; min-width: 0; }
.animal-card .ident .n { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.animal-card .ident .n .tag { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; color: var(--muted); }
.animal-card .ident .m { font-size: 0.82rem; color: var(--muted); }
.animal-card .head .chip { flex: none; }
.animal-card .meta-row { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; font-size: 0.8rem; color: var(--muted); }
.animal-card .meta-row span { display: inline-flex; align-items: center; gap: 0.3rem; }
.animal-card .meta-row i { font-size: 15px; color: var(--teal); }
.animal-card .stat-row { display: flex; gap: 0.6rem; border-top: 1px solid var(--hairline); padding-top: 0.7rem; }
.animal-card .stat { flex: 1; display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; color: var(--muted); }
.animal-card .stat b { color: var(--ink); font-weight: 700; }
.animal-card .stat i { font-size: 15px; color: var(--clay); }
.animal-card .stat.muted i { color: var(--muted); }

/* Status chips (shared by cards & profile) */
.chip.status-active { background: rgba(15,118,110,0.1); border-color: rgba(15,118,110,0.25); color: var(--teal-dk); }
.chip.status-sold { background: rgba(182,144,42,0.12); border-color: rgba(182,144,42,0.3); color: #6f5510; }
.chip.status-deceased,
.chip.status-culled,
.chip.status-closed,
.chip.status-archived { background: rgba(192,102,59,0.12); border-color: rgba(192,102,59,0.3); color: var(--clay); }

/* --- Flocks (poultry batches) ---------------------------------------------- */
.flock-card .count-line { display: flex; align-items: baseline; gap: 0.4rem; }
.flock-card .count-line .big { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 700; color: var(--ink); }
.flock-card .count-line .unit { font-size: 0.8rem; color: var(--muted); }
.flock-card .meter { height: 7px; border-radius: 999px; background: var(--hairline); overflow: hidden; }
.flock-card .meter > div { height: 100%; border-radius: 999px; }
.flock-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 0.6rem; margin: 1rem 0 0; }
.fs-tile { background: var(--surface); border: 1px solid var(--hairline); border-radius: 14px;
  padding: 0.85rem 0.9rem; text-align: center; }
.fs-tile .v { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; color: var(--forest); line-height: 1.1; }
.fs-tile .k { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin-top: 0.2rem; }

/* --- Animal profile -------------------------------------------------------- */
.animal-hero { position: relative; height: 220px; border-radius: 20px; overflow: hidden;
  background: linear-gradient(150deg, #2E5647, var(--forest)); display: flex;
  align-items: center; justify-content: center; }
.animal-hero .hero-photo { width: 100%; height: 100%; object-fit: cover; }
.animal-hero .hero-glyph { font-size: 120px; color: rgba(255,255,255,0.16); }
.animal-hero .hero-edit { position: absolute; top: 16px; right: 16px; width: 42px; height: 42px;
  border-radius: 12px; background: rgba(255,255,255,0.16); display: flex; align-items: center;
  justify-content: center; color: #fff; text-decoration: none; }
.animal-hero .hero-edit:hover { background: rgba(255,255,255,0.28); }
.animal-hero .hero-edit i { font-size: 20px; }
.animal-hero .hero-meta { position: absolute; left: 20px; bottom: 18px; right: 20px; color: #fff;
  text-shadow: 0 1px 12px rgba(0,0,0,0.35); }
.animal-hero .hero-name { font-size: 1.7rem; font-weight: 800; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.animal-hero .hero-name .tag { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
  background: rgba(255,255,255,0.2); padding: 0.2rem 0.5rem; border-radius: 6px; }
.animal-hero .hero-sub { font-size: 0.9rem; color: #CDE9E5; margin-top: 0.2rem; }

.split-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; }
.split-bar > div { height: 100%; }

.tree-card { display: flex; align-items: center; gap: 0.9rem; background: var(--forest);
  color: #fff; border-radius: 18px; padding: 1.1rem 1.25rem; text-decoration: none; }
.tree-card > i:first-child { font-size: 26px; color: #5EC8BC; }
.tree-card .t { font-weight: 700; }
.tree-card .s { font-size: 0.8rem; color: #CDE9E5; }
.tree-card > i:last-child { margin-left: auto; }
.rank-item .who .n a { color: inherit; text-decoration: none; }
.rank-item .who .n a:hover { color: var(--teal); }

/* --- Accounting P&L -------------------------------------------------------- */
.pl-hero { background: var(--teal); color: #fff; border-radius: 20px; padding: 1.5rem 1.75rem; }
.pl-hero .k { font-size: 0.85rem; color: #CDE9E5; font-weight: 600; }
.pl-hero .big { font-family: var(--font-mono); font-size: 2.4rem; font-weight: 600; letter-spacing: -0.01em; margin: 0.35rem 0; }
.pl-hero .row { display: flex; gap: 1.5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.18); }
.pl-hero .row .c { flex: 1; }
.pl-hero .row .c .l { font-size: 0.75rem; color: #CDE9E5; }
.pl-hero .row .c .v { font-family: var(--font-mono); font-size: 1.1rem; font-weight: 600; }

.brk-row { margin-bottom: 0.9rem; }
.brk-row .top { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.35rem; }
.brk-row .top .lbl-in { font-weight: 600; display: inline-flex; align-items: center; gap: 0.4rem; }
.brk-row .top .amt { font-family: var(--font-mono); color: var(--muted); }
.brk-track { height: 9px; background: #EAE1D0; border-radius: 5px; overflow: hidden; }
.brk-fill { height: 100%; border-radius: 5px; }
.rev-stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin-bottom: 0.9rem; }
.rev-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; font-size: 0.82rem; }
.rev-legend .item { display: flex; align-items: center; gap: 0.5rem; }
.rev-legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.rev-legend .amt { margin-left: auto; font-family: var(--font-mono); color: var(--muted); }

.empty-panel { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.locked-note { background: rgba(15,118,110,0.06); border: 1px dashed rgba(15,118,110,0.3);
  border-radius: 16px; padding: 1.5rem; text-align: center; }

/* ==========================================================================
   Log entry forms (production / health) — form header + rich fields
   ========================================================================== */
.form-head { display: flex; align-items: flex-start; gap: 0.9rem; margin-bottom: 1.25rem; }
.form-head h1 { margin: 0; }
.form-head .muted { margin: 0.15rem 0 0; }
.form-head-ico {
  flex: none; width: 46px; height: 46px; border-radius: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(15,118,110,0.1); color: var(--teal); font-size: 1.5rem;
}

/* Card form: fields separated by hairlines, not <p> margins */
.entry-form .field { margin-bottom: 1.15rem; }
.entry-form .field:last-of-type { margin-bottom: 0; }
.entry-form .field-label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.entry-form .field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem 1rem; margin-bottom: 1.15rem; }
@media (max-width: 480px) { .entry-form .field-grid { grid-template-columns: 1fr; } }

/* Segmented metric picker — species-aware pills backed by radio inputs */
.metric-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.metric-pill {
  position: relative; display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.9rem; border: 1px solid var(--hairline); border-radius: 999px;
  background: var(--surface); color: var(--muted); font-weight: 600; font-size: 0.9rem;
  cursor: pointer; margin: 0; user-select: none;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.metric-pill i { font-size: 1.05rem; }
.metric-pill input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.metric-pill:hover { border-color: var(--muted); }
.metric-pill.is-on {
  background: rgba(15,118,110,0.1); border-color: rgba(15,118,110,0.35);
  color: var(--teal-dk);
}
.metric-pill input:focus-visible + i { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 2px; }

/* Quantity with live unit suffix */
.qty-field { position: relative; }
.qty-field input { padding-right: 3.75rem; }
.qty-field .unit-suffix {
  position: absolute; right: 0.85rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-family: var(--font-mono); font-size: 0.85rem;
  pointer-events: none;
}

/* On-page searchable entries table */
.entries-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.25rem; }
.entries-head h2 { display: inline-flex; align-items: center; gap: 0.45rem; }
.entries-head .chip { font-family: var(--font-mono); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap .tbl { min-width: 640px; }
.tbl .row-actions { white-space: nowrap; font-size: 0.85rem; }
.entries-empty { padding: 1.25rem 0; }

/* "By" attribution cell — who recorded, and who last edited */
.by-cell .by-name { display: block; font-weight: 600; }
.by-cell .by-edit { display: block; font-size: 0.74rem; color: var(--muted); margin-top: 0.15rem; }
.by-cell .by-edit::before { content: "\270E\00A0"; }

/* ==========================================================================
   Staff quick entry — tap an animal, log in two taps
   ========================================================================== */
.qe-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0; }
.qe-fpill {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px;
  padding: 0.5rem 0.9rem; border: 1px solid var(--hairline); border-radius: 999px;
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: 0.92rem;
  cursor: pointer;
}
.qe-fpill:hover { border-color: var(--muted); filter: none; }
.qe-fpill.is-on { background: var(--forest); border-color: var(--forest); color: #fff; }
.qe-fpill.is-on i { color: #fff !important; }
.qe-fcount { font-family: var(--font-mono); font-size: 0.78rem; opacity: 0.7; }

.qe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; margin: 0.75rem 0 1.5rem; }
.qe-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 0.4rem; padding: 1.1rem 0.75rem; min-height: auto;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px;
  color: var(--ink); cursor: pointer; transition: transform .1s ease, box-shadow .15s ease, border-color .15s ease;
}
.qe-card:hover { filter: none; border-color: var(--teal); box-shadow: var(--shadow); }
.qe-card:active { transform: scale(0.97); }
.qe-card[hidden] { display: none; }
.qe-av {
  width: 62px; height: 62px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 1.9rem; overflow: hidden; flex: none;
}
.qe-av img { width: 100%; height: 100%; object-fit: cover; }
.qe-av.lg { width: 54px; height: 54px; font-size: 1.6rem; }
.qe-nm { font-weight: 700; font-size: 1rem; line-height: 1.15; }
.qe-meta { font-size: 0.78rem; color: var(--muted); }

.qe-recent { margin-top: 1.75rem; }
.qe-recent h2 { font-size: 1.05rem; display: inline-flex; align-items: center; gap: 0.45rem; margin-bottom: 0.75rem; }
.qe-recent h2 i { color: var(--teal); }
.qe-recent-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.qe-entry {
  display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 0.9rem;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 14px;
}
.qe-entry-ico {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem;
}
.qe-entry-main { flex: 1; min-width: 0; }
.qe-entry-name { font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qe-entry-sub { font-size: 0.82rem; color: var(--muted); }
.qe-entry-val { text-align: right; flex: none; }
.qe-entry-val .qty { font-weight: 700; font-size: 1.02rem; color: var(--teal-dk); }
.qe-entry-date { font-size: 0.74rem; margin-top: 0.1rem; }

/* Action sheet / modal */
.qe-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(30, 25, 22, 0.55);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
.qe-overlay[hidden] { display: none; }
@media (min-width: 620px) { .qe-overlay { align-items: center; padding: 1.5rem; } }
.qe-sheet {
  position: relative; width: 100%; max-width: 460px; background: var(--paper);
  border-radius: 22px 22px 0 0; padding: 1.5rem 1.25rem 1.75rem; box-shadow: var(--shadow);
  max-height: 92vh; overflow-y: auto; animation: qe-rise .22s ease;
}
@media (min-width: 620px) { .qe-sheet { border-radius: 22px; } }
@keyframes qe-rise { from { transform: translateY(24px); opacity: 0.4; } to { transform: translateY(0); opacity: 1; } }
.qe-close {
  position: absolute; top: 0.75rem; right: 0.85rem; width: 40px; height: 40px; min-height: 0;
  border-radius: 50%; background: rgba(42,35,32,0.06); color: var(--ink); border: 0;
  font-size: 1.6rem; line-height: 1; padding: 0;
}
.qe-close:hover { filter: none; background: rgba(42,35,32,0.12); }
.qe-sheet-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; padding-right: 2.5rem; }
.qe-sheet-name { font-weight: 800; font-size: 1.3rem; line-height: 1.1; }

.qe-q { font-weight: 700; font-size: 1.05rem; margin: 0.25rem 0 0.75rem; }
.qe-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.qe-choice {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem; min-height: auto;
  padding: 1.4rem 0.75rem; border-radius: 18px; border: 2px solid var(--hairline);
  background: var(--surface); color: var(--ink); cursor: pointer; text-align: center;
}
.qe-choice:hover { filter: none; }
.qe-choice .ico { font-size: 2.2rem; line-height: 1; }
.qe-choice .t { font-weight: 700; font-size: 1.05rem; }
.qe-choice small { color: var(--muted); font-size: 0.72rem; }
.qe-choice.prod:hover { border-color: var(--teal); background: rgba(15,118,110,0.06); }
.qe-choice.health:hover { border-color: var(--clay); background: rgba(192,102,59,0.06); }

.qe-panel .field-label { display: block; font-weight: 700; margin: 1rem 0 0.4rem; }
.qe-back {
  background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0.25rem 0;
  min-height: 0; font-weight: 600; margin-bottom: 0.25rem;
}
.qe-back:hover { filter: none; color: var(--ink); }
.qe-panel .metric-pill { font-size: 0.95rem; padding: 0.6rem 1rem; }
.qe-panel .metric-pill .emo { font-size: 1.2rem; }
.qty-field.big input { height: 60px; font-size: 1.6rem; font-family: var(--font-mono); font-weight: 700; padding-left: 1rem; }
.qty-field.big .unit-suffix { font-size: 1rem; right: 1rem; }
.qe-save { width: 100%; margin-top: 1.25rem; min-height: 54px; font-size: 1.05rem; }

/* ==========================================================================
   Jobs & routines
   ========================================================================== */
.job-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.9rem; margin-top: 0.75rem; }
.job-card {
  display: flex; flex-direction: column; gap: 0.4rem; padding: 1rem 1.1rem;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px;
  color: var(--ink); text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.job-card:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.job-card-top { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.job-title { font-weight: 700; font-size: 1.02rem; line-height: 1.25; }
.job-desc { font-size: 0.85rem; }
.job-meta { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 0.35rem; font-size: 0.8rem; color: var(--muted); }
.job-meta span { display: inline-flex; align-items: center; gap: 0.3rem; }

/* Status + priority chips */
.chip.job-pending { background: rgba(182,144,42,0.14); border-color: rgba(182,144,42,0.35); color: #6f5510; }
.chip.job-accepted { background: rgba(15,118,110,0.12); border-color: rgba(15,118,110,0.3); color: var(--teal-dk); }
.chip.job-hold { background: rgba(107,74,50,0.12); border-color: rgba(107,74,50,0.3); color: var(--soil); }
.chip.job-completed { background: #e7f1ea; border-color: #cfe3d6; color: #1e4620; }
.chip.prio-high { background: rgba(192,102,59,0.12); border-color: rgba(192,102,59,0.35); color: var(--clay); }

/* --- Job detail: professional header + two-column layout ------------------- */
.job-head { position: relative; overflow: hidden; padding-top: 1.85rem; }
.job-head::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--hairline); }
.job-head.job-pending::before { background: var(--alert); }
.job-head.job-accepted::before { background: var(--teal); }
.job-head.job-hold::before { background: var(--soil); }
.job-head.job-completed::before { background: #2f8f5b; }
.job-head-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.job-head-actions { margin-left: auto; display: inline-flex; gap: 0.4rem; }
.job-title-lg { margin: 0.85rem 0 0.25rem; font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 800; }
.job-desc-full { margin: 0 0 1.1rem; white-space: pre-line; color: var(--ink); }

.job-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem 1.25rem;
  padding-top: 1.1rem; border-top: 1px solid var(--hairline); }
@media (max-width: 520px) { .job-meta-grid { grid-template-columns: 1fr; } }
.meta-item { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.meta-k { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); display: inline-flex; align-items: center; gap: 0.35rem; }
.meta-v { font-weight: 600; display: inline-flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.mini-av { width: 26px; height: 26px; border-radius: 50%; flex: none; background: var(--teal); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 700; }
.mini-av.all { background: var(--soil); font-size: 0.85rem; }

.job-layout { display: grid; grid-template-columns: 1fr; gap: 1.25rem; margin-top: 1.25rem; }
@media (min-width: 860px) {
  .job-layout { grid-template-columns: 1.7fr 1fr; align-items: start; }
  .job-main { grid-column: 1; grid-row: 1; }
  .job-aside { grid-column: 2; grid-row: 1; }
  .report-card { position: sticky; top: 1rem; }
}

/* Report card */
.report-title { font-size: 1.05rem; display: inline-flex; align-items: center; gap: 0.45rem; margin: 0 0 0.9rem; }
.report-title i { color: var(--teal); }
.report-btn { width: 100%; margin-top: 1.1rem; min-height: 50px; }
.file-drop { position: relative; display: flex; align-items: center; gap: 0.6rem; cursor: pointer;
  padding: 0.85rem 1rem; border: 1.5px dashed var(--hairline); border-radius: var(--radius-sm);
  background: rgba(15,118,110,0.03); color: var(--muted); font-weight: 600; }
.file-drop:hover { border-color: var(--teal); color: var(--teal-dk); }
.file-drop i { font-size: 1.35rem; }
.file-drop input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-drop-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Activity stream */
.stream-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.stream-head h2 { margin: 0; display: inline-flex; align-items: center; gap: 0.45rem; font-size: 1.15rem; }
.stream-head h2 i { color: var(--teal); }
.stream { list-style: none; padding: 0; margin: 0; }
.stream-item { display: flex; gap: 0.85rem; position: relative; padding-bottom: 1.25rem; }
.stream-item:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 40px; bottom: -2px;
  width: 2px; background: var(--hairline); }
.stream-av { flex: none; width: 36px; height: 36px; border-radius: 50%; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem;
  background: var(--teal); color: #fff; box-shadow: 0 0 0 3px var(--paper); }
.stream-av.is-owner { background: var(--forest); }
.stream-av.seed { background: var(--surface); color: var(--muted); border: 1px solid var(--hairline); }
.stream-card { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 0.75rem 0.95rem; }
.stream-origin .stream-card { background: transparent; border-style: dashed; }
.stream-top { display: flex; align-items: baseline; gap: 0.6rem; }
.stream-name { font-weight: 700; }
.role-tag { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--forest); background: rgba(36,73,59,0.1); padding: 0.05rem 0.4rem; border-radius: 999px; }
.stream-time { margin-left: auto; font-size: 0.78rem; color: var(--muted); font-family: var(--font-mono); white-space: nowrap; }
.stream-status { font-size: 0.9rem; color: var(--muted); margin-top: 0.4rem; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.stream-comment { margin-top: 0.5rem; white-space: pre-line; line-height: 1.55; }
.stream-photo { display: inline-block; margin-top: 0.6rem; }
.stream-photo img { max-width: 240px; max-height: 200px; border-radius: 10px; border: 1px solid var(--hairline); display: block; }
.stream-hint { margin-top: 0.25rem; display: inline-flex; align-items: center; gap: 0.4rem; }

/* Routines */
.routine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.routine-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.5rem; }
.routine-steps { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.routine-steps li { display: flex; gap: 0.75rem; padding: 0.45rem 0; border-top: 1px solid var(--hairline); }
.routine-steps li:first-child { border-top: 0; }
.rt-time { font-family: var(--font-mono); font-weight: 700; color: var(--teal-dk); flex: none; min-width: 48px; }

/* Routine editor rows */
.rt-rows { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.35rem; }
.rt-row { display: grid; grid-template-columns: 110px 1.4fr 1.4fr 34px; gap: 0.5rem; align-items: center; }
.rt-row.rt-head { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.rt-row .rt-c input { margin: 0; }
.rt-row .rt-err { grid-column: 1 / -1; }
.rt-del { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; margin: 0; font-weight: 400; }
.rt-remove { color: var(--clay); font-size: 1.4rem; line-height: 1; }
.inline-check { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 600; }
.inline-check input { width: auto; }
@media (max-width: 560px) {
  .rt-row { grid-template-columns: 88px 1fr 30px; }
  .rt-row .rt-c.note { grid-column: 1 / -1; }
  .rt-row.rt-head { display: none; }
}

/* Staff roster */
.staff-cell { display: flex; align-items: center; gap: 0.65rem; }
.staff-cell .avatar {
  flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--teal);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
}
.staff-cell .nm { font-weight: 600; line-height: 1.2; }
.staff-cell .em { font-size: 0.85rem; }
.danger-link { color: var(--clay); }
.chip.status-active i, .chip.alert i { font-size: 0.9em; }

/* --- Customers (credit ledger) --------------------------------------------- */
.customer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem; margin-top: 1rem; }
.customer-card { display: flex; flex-direction: column; gap: 0.75rem; background: var(--surface);
  border: 1px solid var(--hairline); border-radius: 18px; padding: 1.1rem 1.2rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.customer-card:hover { border-color: var(--teal); box-shadow: 0 6px 18px rgba(15,118,110,0.08); }
.customer-card .head { display: flex; align-items: center; gap: 0.85rem; }
.customer-card .mark { width: 48px; height: 48px; border-radius: 14px; flex: none; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.15rem; }
.customer-card .ident { flex: 1; min-width: 0; }
.customer-card .ident .n { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.customer-card .ident .n a { color: inherit; text-decoration: none; }
.customer-card .ident .n a:hover { color: var(--teal-dk); }
.customer-card .ident .m { font-size: 0.8rem; color: var(--muted); display: flex;
  flex-wrap: wrap; gap: 0.2rem 0.7rem; }
.customer-card .ident .m span { display: inline-flex; align-items: center; gap: 0.3rem; }
.customer-card .ident .m i { font-size: 13px; color: var(--teal); }
.customer-card .head .chip { flex: none; }
.chip.due { background: rgba(138,75,46,0.1); border-color: rgba(138,75,46,0.3); color: #8A4B2E;
  font-family: var(--font-mono); }
.chip.settled { background: rgba(15,118,110,0.1); border-color: rgba(15,118,110,0.25); color: var(--teal-dk); }
.customer-card .stat-row { display: flex; gap: 0.6rem; border-top: 1px solid var(--hairline); padding-top: 0.7rem; }
.customer-card .stat { flex: 1; display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.78rem; color: var(--muted); }
.customer-card .stat b { color: var(--ink); font-weight: 700; font-family: var(--font-mono); }
.customer-card .stat i { font-size: 15px; color: var(--clay); }
.customer-card .cc-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.customer-card .cc-actions .btn { flex: 1; justify-content: center; white-space: nowrap; }

/* --- Form-head variants (danger = delete confirmations) --------------------- */
.form-head-ico.danger { background: rgba(138,75,46,0.12); color: #8A4B2E; }
.form-head-ico.gold { background: rgba(182,144,42,0.14); color: #6f5510; }

/* --- Billing: plan cards ---------------------------------------------------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem; margin-top: 1rem; align-items: stretch; }
.plan-card { position: relative; display: flex; flex-direction: column; gap: 0.6rem;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 18px;
  padding: 1.5rem 1.5rem 1.35rem; }
.plan-card.popular { border-color: var(--teal); box-shadow: 0 8px 24px rgba(15,118,110,0.10); }
.plan-card .pop-badge { position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: var(--teal); color: #fff; font-size: 0.66rem; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase; padding: 0.28rem 0.8rem;
  border-radius: 999px; white-space: nowrap; }
.plan-card h2 { margin: 0; font-size: 1.15rem; }
.plan-card .plan-desc { margin: 0; font-size: 0.85rem; color: var(--muted); }
.plan-card .price { margin: 0.4rem 0 0.2rem; }
.plan-card .price .amt { font-family: var(--font-mono); font-size: 2rem; font-weight: 700; }
.plan-card .price .per { font-size: 0.85rem; color: var(--muted); }
.plan-card .feat-list { list-style: none; padding: 0; margin: 0.35rem 0 0.8rem; flex: 1; }
.plan-card .feat-list li { display: flex; align-items: flex-start; gap: 0.5rem;
  padding: 0.4rem 0; font-size: 0.9rem; border-bottom: 1px solid var(--hairline); }
.plan-card .feat-list li:last-child { border-bottom: 0; }
.plan-card .feat-list i { color: var(--teal); font-size: 1.05rem; margin-top: 0.1rem; flex: none; }
.plan-card form { margin: 0; }
.plan-card .btn { width: 100%; justify-content: center; }
.plan-card .current-note { text-align: center; font-size: 0.85rem; color: var(--teal-dk);
  font-weight: 700; padding: 0.6rem 0; }

/* Subscription summary rows (billing manage) */
.sub-rows { display: flex; flex-direction: column; }
.sub-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.7rem 0; border-bottom: 1px solid var(--hairline); font-size: 0.92rem; }
.sub-row:last-child { border-bottom: 0; }
.sub-row .k { color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; gap: 0.45rem; }
.sub-row .k i { color: var(--teal); }
.sub-row .v { font-weight: 700; }

/* --- Auth / anonymous pages ------------------------------------------------- */
.auth-head { text-align: center; margin: 0.5rem 0 1.25rem; }
.auth-head .mark { width: 54px; height: 54px; border-radius: 16px; background: var(--forest);
  color: var(--paper); display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.7rem; margin-bottom: 0.7rem; }
.auth-head h1 { margin: 0; }
.auth-head .muted { margin: 0.3rem 0 0; }

/* --- Weight & growth chart (animal profile) --------------------------------- */
.wg-stats { display: flex; gap: 2rem; flex-wrap: wrap; margin: 0.9rem 0 0.3rem; }
.wg-stat .k { font-size: 0.75rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; }
.wg-stat .v { font-family: var(--font-mono); font-size: 1.45rem; font-weight: 600; margin-top: 0.15rem; }
.wg-stat .v span { font-family: var(--font-sans); font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.wg-stat .v.up { color: var(--teal); }
.wg-stat .v.down { color: var(--clay); }
.wchart { width: 100%; height: auto; display: block; margin-top: 0.5rem; }
.wchart .grid { stroke: var(--hairline); stroke-width: 1; }
.wchart .ylab, .wchart .xlab { font-family: var(--font-mono); font-size: 10px; fill: var(--muted); }
.wchart .ylab { text-anchor: end; }
.wchart .line { fill: none; stroke: #C0663B; stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round; }
.wchart .dot { fill: #C0663B; stroke: var(--surface); stroke-width: 2; }
.wchart .hit { fill: transparent; cursor: pointer; }
.wchart .hit:hover + .dlab { opacity: 1; }
.wchart .dlab { font-family: var(--font-mono); font-size: 11px; font-weight: 600; fill: var(--ink); }
.wg-table { margin-top: 0.75rem; }
.wg-table summary { font-size: 0.82rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.wg-table[open] summary { margin-bottom: 0.5rem; }

/* Sidebar section headings ---------------------------------------------------
   The nav grew past ~10 links once the accounting module landed; ungrouped it
   reads as a wall. A quiet uppercase label separates Farm / Money / Operations
   / Account without adding another interaction. */
.nav-section { margin: 1rem 0 0.25rem; padding: 0 0.85rem; font-size: 0.68rem;
  font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(255,255,255,0.42); }
.nav-section:first-child { margin-top: 0.25rem; }

/* --- Payables: bill line editor + overdue rows -----------------------------
   The bill form is the only screen in the product with a seven-column
   repeating row, so it needs its own grid rather than reusing .rt-row (which
   is sized for a routine's time/title/note). Same interaction model as the
   routine formset — add/remove rows client-side, DELETE checkbox for saved
   ones — so the two behave identically even though they look different.
   Collapses to a stacked card on narrow screens: a seven-column grid is
   unusable on a phone, and staff do enter bills from the field. */
.bl-rows { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.35rem; }
.bl-row { display: grid; gap: 0.4rem; align-items: center;
  grid-template-columns: 1.6fr 1.4fr 0.6fr 0.8fr 0.4fr 1fr 1fr 34px; }
.bl-row.bl-head { font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); }
.bl-row .bl-c input, .bl-row .bl-c select { margin: 0; width: 100%; }
.bl-row .bl-c.center { text-align: center; }
.bl-row .bl-c.center input { width: auto; }
.bl-row .bl-err { grid-column: 1 / -1; }
.bl-del { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem;
  margin: 0; font-weight: 400; }
.bl-remove { color: var(--clay); font-size: 1.4rem; line-height: 1; }

@media (max-width: 900px) {
  .bl-row { grid-template-columns: 1fr 1fr; }
  .bl-row.bl-head { display: none; }
  .bl-row { border: 1px solid var(--hairline); border-radius: 12px; padding: 0.6rem; }
}

/* An overdue bill has to be findable by eye in a long list; a tinted row does
   that without adding another badge column. */
.tbl tbody tr.row-alert { background: rgba(192,102,59,0.06); }
.tbl tbody tr.row-alert:hover { background: rgba(192,102,59,0.11); }

/* ==========================================================================
   Invoicing (sales app) — invoice list rows, line-item form, AR ageing.
   APPENDED block: only adds new class names, overrides nothing above.
   ========================================================================== */

/* Invoice status chips reuse the shared .chip.status-* vocabulary. Only the
   statuses the animal cards don't already define are added here. */
.chip.status-draft { background: rgba(154,141,126,0.14); border-color: rgba(154,141,126,0.32); color: var(--muted); }
.chip.status-sent { background: rgba(15,118,110,0.1); border-color: rgba(15,118,110,0.25); color: var(--teal-dk); }
.chip.status-partial { background: rgba(182,144,42,0.12); border-color: rgba(182,144,42,0.3); color: #6f5510; }
.chip.status-paid { background: rgba(36,73,59,0.12); border-color: rgba(36,73,59,0.28); color: var(--forest); }
.chip.status-cancelled { background: rgba(192,102,59,0.12); border-color: rgba(192,102,59,0.3); color: var(--clay); }

/* An overdue row has to be findable at a glance in a long list — the left rule
   survives greyscale printing where a background tint would not. */
.inv-tbl tbody tr.inv-overdue { background: rgba(192,102,59,0.06); box-shadow: inset 3px 0 0 var(--clay); }
.inv-tbl tbody tr.inv-draft { opacity: 0.72; font-style: italic; }
.inv-tbl tbody tr.inv-void td { text-decoration: line-through; color: var(--muted); }

/* Line editor: a compact grid per row rather than a wide table, so it stays
   usable on a phone without any JS. */
.inv-lines { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: 1.15rem; }
.inv-line { border: 1px solid var(--hairline); border-radius: 14px; padding: 0.9rem 1rem; background: var(--surface); }
.inv-line-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.7rem 0.9rem; }
.inv-line-grid .field { margin-bottom: 0; }
.inv-line-grid .field.wide { grid-column: 1 / -1; }
.inv-line-grid .field-label { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.inv-line-flags { display: flex; align-items: flex-end; gap: 1rem; }
.inv-line-flags label { display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.85rem; font-weight: 600; margin: 0; }
@media (max-width: 720px) { .inv-line-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .inv-line-grid { grid-template-columns: 1fr; } }

/* Per-document rows tucked under each customer in the ageing report. */
.ageing-detail td { font-size: 0.85rem; border-top: 0; }

/* ============================================================================
   Ledger (double-entry bookkeeping) — appended for the `ledger` app.
   Everything below is scoped to ledger screens: statement tables, the manual
   journal grid, the income/expense bar chart, and the balanced/out-of-balance
   health panels. Uses the existing design tokens only.
   ========================================================================== */

/* Health panels — reuse .panel, tint by state. */
.panel.ok { border-color: #cfe3d6; background: #f0f6f2; }
.panel.ok h3 { color: #1e4620; }
.panel.warn { border-color: #ecdcae; background: #f8f2e0; }
.panel.warn h3 { color: #6f5510; }
.panel.ok h3 i, .panel.warn h3 i { margin-right: 0.35rem; }

/* Numeric cells in statement tables: right-aligned, monospace, non-wrapping. */
.tbl td.led-num, .tbl th.led-num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }

/* Statement section headers, subtotals and the grand total. */
.tbl tr.led-section td { background: var(--surface); border-top: 2px solid var(--hairline);
  text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.05em; color: var(--muted); }
.tbl tr.led-total td { border-top: 1px solid var(--hairline); }
.tbl tr.led-grand td { border-top: 2px solid var(--forest); border-bottom: 2px solid var(--forest);
  background: rgba(36,73,59,0.04); }

/* Balance/summary rows rendered as a stack list (dashboard, cash flow). */
.stacklist.led-rows li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.stacklist.led-rows li .figure { white-space: nowrap; }

/* Income-vs-expense bar chart. Fixed viewBox, scales via width:100%. */
.bchart { width: 100%; height: auto; display: block; margin-top: 0.5rem; }
.bchart .grid { stroke: var(--hairline); stroke-width: 1; }
.bchart .axis { stroke: var(--muted); stroke-width: 1; }
.bchart .ylab, .bchart .xlab { font-family: var(--font-mono); font-size: 10px; fill: var(--muted); }
.bchart .ylab { text-anchor: end; }
.bchart .bar.income { fill: var(--teal); }
.bchart .bar.expense { fill: var(--clay); }
.bchart-legend { display: flex; gap: 1.25rem; margin-top: 0.5rem; font-size: 0.85rem; color: var(--muted); }
.bchart-legend .item { display: inline-flex; align-items: center; gap: 0.4rem; }
.bchart-legend .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.bchart-legend .swatch.income { background: var(--teal); }
.bchart-legend .swatch.expense { background: var(--clay); }

/* Manual journal grid — mirrors the routine editor's .rt-rows pattern. */
.jl-rows { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.35rem; }
.jl-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1.6fr 30px; gap: 0.5rem; align-items: center; }
.jl-row.jl-head { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.jl-row .jl-c input, .jl-row .jl-c select { margin: 0; }
.jl-row .jl-c.amount input { text-align: right; font-family: var(--font-mono); }
.jl-row .jl-err { grid-column: 1 / -1; color: var(--clay); font-size: 0.85rem; }
.jl-row.jl-totals { border-top: 2px solid var(--forest); padding-top: 0.5rem; margin-top: 0.25rem; }
.jl-row.jl-totals .amount { text-align: right; }
.jl-ok { color: var(--teal); font-weight: 600; }
.jl-bad { color: var(--clay); font-weight: 600; }
@media (max-width: 620px) {
  .jl-row { grid-template-columns: 1fr 1fr 26px; }
  .jl-row .jl-c.account { grid-column: 1 / -1; }
  .jl-row .jl-c.memo { grid-column: 1 / 3; }
  .jl-row.jl-head { display: none; }
}

/* ---------------------------------------------------------------------------
   Farms — the owner's multi-farm portfolio page (farms/farm_list.html).
   Reuses the card/token vocabulary; a responsive grid of farm summary cards.
   --------------------------------------------------------------------------- */
.farm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.farm-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  box-shadow: var(--shadow);
}
.farm-card.archived { opacity: 0.7; }
.farm-card-head { display: flex; align-items: flex-start; gap: 0.7rem; }
.farm-card-head .farm-mark {
  flex: none; width: 42px; height: 42px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--forest); color: var(--paper); font-size: 1.25rem;
}
.farm-card.archived .farm-mark { background: var(--muted); }
.farm-card-head .farm-id { flex: 1 1 auto; min-width: 0; }
.farm-card-head .farm-id h2 { margin: 0; font-size: 1.1rem; line-height: 1.2; }
.farm-card-head .farm-id .muted { font-size: 0.85rem; }
.farm-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  overflow: hidden; background: #fff;
}
.farm-stats .fs {
  display: flex; flex-direction: column; align-items: center;
  padding: 0.55rem 0.25rem;
}
.farm-stats .fs + .fs { border-left: 1px solid var(--hairline); }
.farm-stats .fs .n { font-weight: 800; font-size: 1.15rem; color: var(--forest); }
.farm-stats .fs .l { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.farm-species { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.farm-card-actions {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  margin-top: auto; padding-top: 0.35rem;
}

/* ---------------------------------------------------------------------------
   Invoice public share link (sales/invoice_detail.html "Share" panel).
   --------------------------------------------------------------------------- */
.share-panel .share-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.share-input {
  flex: 1 1 260px; min-width: 0;
  font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.9rem;
  padding: 0.55rem 0.7rem; border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink);
}
.share-input:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
@media (max-width: 560px) {
  .share-panel .share-row { flex-direction: column; align-items: stretch; }
  .share-panel .share-row .btn { justify-content: center; }
}

/* ---------------------------------------------------------------------------
   User profile (accounts/profile.html) + avatar images in the app chrome.
   --------------------------------------------------------------------------- */
/* Any .avatar can now hold a photo instead of an initial. */
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }

/* The sidebar user card is now a link to the profile. */
.side-user { text-decoration: none; border-radius: 12px; transition: background .15s ease; }
.side-user:hover { background: rgba(255,255,255,0.06); }
.side-user .who { min-width: 0; flex: 1 1 auto; }
.side-user-go { color: #9FBDB2; font-size: 16px; flex: none; }

.topbar-link { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--ink);
  text-decoration: none; font-size: 0.9rem; font-weight: 600; }
.topbar-link:hover { color: var(--teal); }

.profile-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .profile-grid { grid-template-columns: 1fr; } }

.avatar.lg { width: 72px; height: 72px; border-radius: 16px; background: var(--teal); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.75rem; flex: none; }
.avatar-field { display: flex; align-items: center; gap: 1rem; padding-bottom: 1rem; margin-bottom: 1rem;
  border-bottom: 1px solid var(--hairline); }
.avatar-controls { min-width: 0; }
.avatar-controls label { display: block; font-weight: 600; margin-bottom: 0.3rem; }

.chip-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }
