/* Seed Database — theme tokens
   Two themes: "furrow" (light) and "loam" (dark). Every color in this file
   is a custom property; components below reference the properties, never a
   literal hex value, so the whole app's look swaps on data-theme. */

html[data-theme="furrow"] {
  --bg: #F6F3EA;
  /* Light header (trial — the previous dark-green header was
     --header-bg #24352A / --header-text #F3EFE3 / --header-sub #A9B8A6 with
     no border; the footer below keeps those dark values on its own tokens). */
  --header-bg: #FFFEFB;
  --header-text: #24352A;
  --header-sub: #6B6456;
  --header-border: #E3DCC9;
  --footer-bg: #24352A;
  --footer-text: #F3EFE3;
  --footer-sub: #A9B8A6;
  --tab-bg: #F0ECDE;
  --tab-text: #5B5642;
  --accent: #B6752C;
  --accent-text: #FFFFFF;
  --card-bg: #FFFEFB;
  --thumb-bg: #D7C9A3;
  --text-primary: #24352A;
  --text-secondary: #6B6456;
  --badge-bg: #EFE0C6;
  --badge-text: #8A5A22;
  --nav-bg: #FFFEFB;
  --nav-border: #E3DCC9;
  --nav-inactive: #B4AF9C;
  --toggle-track-off: #ECE7DA;
  --toggle-track-on: #4C7A52;
  --danger: #A33B2C;
  --danger-text: #FFFFFF;
  --warning: #BF5E28;
  --warning-text: #FFFFFF;
  --accent-green-bg: #DCE8D6;
  --accent-green-text: #2F4A38;
  --tab-border: #D2C7A5;
  --accent-green-border: #BFD8B5;
  --badge-border: #DDC79C;
  --card-border-strong: rgba(0, 0, 0, 0.35);
  --card-border: rgba(0, 0, 0, 0.16);
  --btn-border: rgba(0, 0, 0, 0.18);
  --accent-tint-bg: rgba(182, 117, 44, 0.12);
  /* Opaque variants of --accent-green-bg / --tab-bg, for floating or sticky
     UI (toasts, the sticky table header) that can't use a translucent fill —
     already solid here, so these are just aliases; loam's versions below are
     real flattened colors, since loam's own tokens are translucent rgba(). */
  --accent-green-solid: var(--accent-green-bg);
  --tab-bg-solid: var(--tab-bg);
  /* Magnifying glass inset in .catalog-search — an image can't read
     currentColor, so it's drawn in --text-secondary's value per theme. */
  --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B6456' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='20' y1='20' x2='16.2' y2='16.2'/%3E%3C/svg%3E");
  /* Floating panels only (dropdowns, menus): a soft warm shadow, not black. */
  --shadow-float: 0 4px 16px rgba(43, 38, 32, 0.12), 0 1px 3px rgba(43, 38, 32, 0.08);
}

html[data-theme="loam"] {
  --bg: #1C1A15;
  --header-bg: #242019;
  --header-text: #EDE8DC;
  --header-sub: #8C8874;
  --header-border: var(--card-border);
  --footer-bg: var(--header-bg);
  --footer-text: var(--header-text);
  --footer-sub: var(--header-sub);
  --tab-bg: rgba(237, 232, 220, 0.08);
  --tab-text: #C4BEAB;
  --accent: #C99A3E;
  --accent-text: #1C1A15;
  --card-bg: #26241D;
  --thumb-bg: #3A3728;
  --text-primary: #EDE8DC;
  --text-secondary: #8C8874;
  --badge-bg: rgba(107, 143, 90, 0.22);
  --badge-text: #9CC084;
  --nav-bg: #242019;
  --nav-border: rgba(237, 232, 220, 0.08);
  --nav-inactive: #8C8874;
  --toggle-track-off: #3A3728;
  --toggle-track-on: #6B8F5A;
  --danger: #D97A62;
  --danger-text: #1C1A15;
  --warning: #D98F4A;
  --warning-text: #1C1A15;
  --accent-green-bg: rgba(107, 143, 90, 0.22);
  --accent-green-text: #9CC084;
  --tab-border: rgba(237, 232, 220, 0.2);
  --accent-green-border: rgba(107, 143, 90, 0.45);
  --badge-border: rgba(107, 143, 90, 0.45);
  --card-border-strong: rgba(237, 232, 220, 0.35);
  --card-border: rgba(237, 232, 220, 0.16);
  --btn-border: rgba(237, 232, 220, 0.22);
  --accent-tint-bg: rgba(201, 154, 62, 0.16);
  /* --accent-green-bg / --tab-bg are translucent here (rgba) — fine for a
     small badge or a tab sitting flat on a card, but break anything that
     floats or stickies over other content (scrolled rows show through the
     sticky table header; page content shows through a toast). These are
     that same muted green / neutral flattened solid against --card-bg. */
  --accent-green-solid: #353C2A;
  --tab-bg-solid: #36342C;
  --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238C8874' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='20' y1='20' x2='16.2' y2='16.2'/%3E%3C/svg%3E");
  --shadow-float: 0 6px 20px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
}

:root {
  /* Desktop navbar height (border included) — the fixed page shells and
     the page-level sticky table header are positioned against this, so it
     must match .header's real height. */
  --header-height: 72px;
  /* Every page's title row is at least this tall, so a title lands at the
     same height whether it's next to 42px icon buttons, shorter text
     buttons, or nothing at all. */
  --title-row-height: 42px;
  /* Heading/display serif (h1–h3, brand, codes). Was Fraunces — switched
     for its curled "f". The font itself is loaded in base.html/500.html. */
  --font-display: "Literata", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.has-bottom-nav {
  padding-bottom: 4.5rem;
}

body,
.card,
.header,
.bottom-nav,
.badge,
.toggle-track,
input,
textarea,
select,
button {
  transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}

h1,
h2,
h3,
.display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

a {
  color: inherit;
  text-decoration: none;
}

/* A <button> that needs to read as plain inline text (same inherited color,
   no decoration) as the <a> rule above — e.g. a clickable cross parent with
   no real page of its own to link to, which opens its edit modal instead. */
.text-link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

/* A name inside text that's a link (lot code on a lot card, variety/crop on
   the lot page). Plain links above are deliberately undecorated; this one
   needs to read as clickable, so it gets a soft underline that turns accent
   on hover. */
.inline-link {
  text-decoration: underline;
  text-decoration-color: var(--tab-border);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.inline-link:hover,
.inline-link:focus-visible {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

[x-cloak] {
  display: none !important;
}

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

/* Header */

.header {
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--header-border);
  padding: 1.25rem;
}

.header .brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
}

.header nav,
.header-account {
  display: none;
}

.header-logo {
  display: none;
}

@media (min-width: 900px) {
  .header {
    position: sticky;
    top: 0;
    z-index: 40;
    /* Brand left, the right-hand group (search, calendar/map/analytics
       icons, account menu) at its own width on the right, and the tabs
       centered in the space between them. (Centering them on the whole
       page, 1fr auto 1fr, squeezed the search field once the icons were
       added; pinning them to the brand left a gap before the search.) */
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.5rem;
    height: var(--header-height);
    padding: 0 2rem;
  }
  .header-account {
    display: block;
  }
  /* Fills the whole right-hand column, with the account menu pinned to the
     far right; the search field (wide screens) grows into the space left. */
  .header-right {
    justify-self: stretch;
    justify-content: flex-end;
    min-width: 0;
  }
  .header-brand-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-self: start;
  }
  .header-logo {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f5f2ea;
    padding: 5px;
    object-fit: contain;
    box-sizing: border-box;
    border: 1px solid var(--card-border-strong);
  }
  .header nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    justify-self: center;
  }
  /* Tabs: the current page gets a soft green fill, the rest a cream fill
     on hover. */
  .header nav a {
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    color: var(--header-sub);
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
  }
  .header nav a:hover {
    background: var(--tab-bg);
    color: var(--header-text);
  }
  .header nav a.active {
    background: var(--accent-green-bg);
    color: var(--accent-green-text);
    font-weight: 600;
  }
}

/* Global search in the navbar (catalog:global_search), varieties only.
   Collapsed to a magnifying glass on phones and narrower desktops: opening it lays the
   field over the whole header bar (anchored to the sticky .header), so it
   never has to share room with the tabs. Wide desktops show the field
   inline next to the account menu instead. */

.header-right,
.header-search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-search-field {
  display: none;
}

.header-search.is-open .header-search-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 0 1.25rem;
  background: var(--header-bg);
}

.header-search-box {
  position: relative;
  flex: 1 1 auto;
  max-width: 640px;
  margin: 0 auto;
}

.header-search-box .catalog-search {
  width: 100%;
  margin: 0;
}

.header-search .icon-btn {
  color: var(--header-sub);
}

.header-search .icon-btn:hover {
  color: var(--accent);
}

/* Navbar calendar icon (catalog:calendar), next to search. */
.header-icon-link {
  color: var(--header-sub);
  flex-shrink: 0;
}

.header-icon-link:hover,
.header-icon-link.active {
  color: var(--accent);
}

@media (max-width: 899px) {
  /* Phones: the logo on the left, the search magnifying glass on the right
     (it's the only quick search now; Catalog and Lots dropped theirs); the
     opened field covers the header bar like on mid-size screens. */
  .header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }
  /* Phones: just the logo (the org name doesn't fit without being cut
     off; desktop shows it in full). The link's aria-label still names it. */
  .header {
    padding: 0.7rem 1.25rem;
  }
  .header-brand-row {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
  }
  .header-logo {
    display: block;
    width: 40px;
    height: 40px;
    padding: 5px;
    border-radius: 50%;
    border: 1px solid var(--card-border-strong);
    background: #f5f2ea;
    object-fit: contain;
    box-sizing: border-box;
  }
  .header .brand {
    display: none;
  }
}

@media (min-width: 900px) {
  .header-search.is-open .header-search-field {
    padding: 0 2rem;
  }
}

/* Search field open in the bar (no magnifying glass) on wide screens, and
   from 900px to 1099px, where the tabs fold into "More" and leave room. */
@media (min-width: 900px) and (max-width: 1099px), (min-width: 1440px) {
  /* Two classes, so it beats .icon-btn's own display (defined later). */
  .header-search .header-search-toggle,
  .header-search .header-search-close {
    display: none;
  }

  .header-search-field,
  .header-search.is-open .header-search-field {
    display: flex;
    position: static;
    padding: 0;
    background: none;
  }

  .header-search {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
  }

  .header-search-field,
  .header-search.is-open .header-search-field {
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  /* A set width: the right-hand grid column sizes to its content, so a
     flexible field would collapse to its minimum. */
  /* Just enough for the placeholder ("Search varieties and crops") plus a
     little breathing room. */
  .header-search-box {
    flex: 0 1 280px;
    width: 280px;
    max-width: 280px;
    margin: 0;
  }


}

/* Site header / footer (public marketing pages) */

.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--header-border);
}

.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
}

.site-header-inner,
.site-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.site-header .brand {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
}

.site-header .sub {
  color: var(--header-sub);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.site-footer {
  margin-top: 3rem;
}

.site-footer-inner {
  padding: 1.5rem;
  color: var(--footer-sub);
  font-size: 0.85rem;
}

.site-footer-inner a {
  color: var(--footer-text);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.back-link svg {
  width: 16px;
  height: 16px;
}

.back-link:hover {
  color: var(--text-primary);
}

/* Layout */

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem;
  width: 100%;
  flex: 1 0 auto;
}

.desktop-only {
  display: none;
}

.icon-btn-desktop-only {
  display: none !important;
}

.btn-label-desktop-only {
  display: none !important;
}

.catalog-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--title-row-height);
  margin-bottom: 1rem;
}

/* Catalog / Lots header: title + count + view/filter controls on the left,
   the add button and the ⋮ (downloads) on the right. */
.catalog-header-left {
  gap: 0.5rem;
  min-width: 0;
}

.catalog-view-controls {
  gap: 0.15rem;
  margin-left: 0.5rem;
}

/* Planning header: "Planning ‹ 2027 ›" year switcher (the year is the page's
   context, not a filter), the row counts, and the "+ Growout ▾" caret. */
.planning-year {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  padding: 0.1rem;
  border: 1px solid var(--nav-border);
  border-radius: 999px;
  background: var(--card-bg);
}

.planning-year-value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  padding: 0 0.25rem;
}

.planning-counts {
  font-size: 0.85rem;
  white-space: nowrap;
}

@media (max-width: 599px) {
  .planning-counts {
    display: none;
  }
}

.btn-caret {
  width: 14px;
  height: 14px;
  margin-left: 0.15rem;
}

/* Calendar page (catalog:calendar): events grouped by day. */
.calendar-filter-field {
  margin-bottom: 1rem;
}

.calendar-range-note {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.calendar-day + .calendar-day {
  margin-top: 1.25rem;
}

.calendar-day-heading {
  margin: 0 0 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--nav-border);
  font-size: 1rem;
}

.calendar-event {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.55rem 0.25rem;
  font-size: 0.9rem;
}

.calendar-event + .calendar-event {
  border-top: 1px solid var(--nav-border);
}

.calendar-event-body {
  min-width: 0;
}

.calendar-event-details {
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

/* Event type: plain bold text (not a badge), colored by group so a day
   scans at a glance; a fixed-width column keeps the events lined up. */
.calendar-event-type {
  flex: 0 0 8.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--badge-text);
}

.calendar-type-field-production {
  color: var(--accent-green-text);
}

.calendar-type-notes {
  color: var(--text-secondary);
}

.calendar-type-milestones {
  color: var(--accent);
}

@media (max-width: 599px) {
  .calendar-event {
    flex-direction: column;
    gap: 0.25rem;
  }
  .calendar-event-type {
    flex: none;
  }
}

/* Biennials on Planning: "Start in <year - 1>" next to the crop, and the
   reminder box listing next year's biennials (to be started this year). */
.planning-start-note {
  color: var(--accent);
  font-weight: 600;
}

.planning-callout {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--nav-border);
  border-radius: 12px;
  background: var(--tab-bg);
  font-size: 0.9rem;
}

.planning-callout-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin-top: 0.5rem;
}

/* Planning table's last column: a lot link (confirmed) or "Create lot". */
.planning-lot-col {
  text-align: left;
  white-space: nowrap;
}

.planning-create-lot {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn.small {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
}

/* Phones: the page's tool row (count, view toggle, search, filters, add) is
   tucked away behind a small tab hanging off the header's bottom line
   (templates/_mobile_tools_tab.html), and the two stick to the top of the
   screen together on scroll (.mobile-tools). */
.mobile-tools-tab {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  /* Nudged up 1px over the header's bottom line, so the tab joins it. */
  top: -1px;
  margin: 0 auto 0.9rem;
  padding: 0.3rem 0.8rem 0.4rem 0.95rem;
  background: var(--header-bg);
  border: 1px solid var(--header-border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 3px 8px rgba(43, 38, 32, 0.07);
  color: var(--header-sub);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.mobile-tools-tab svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.tools-open .mobile-tools-tab {
  color: var(--accent);
}

.tools-open .mobile-tools-tab svg {
  transform: rotate(180deg);
}

@media (max-width: 899px) {
  .catalog-page-shell:not(.tools-open) .catalog-header-row {
    display: none;
  }

  /* The tab and its row stick to the top of the screen together while the
     page scrolls, so the tools are one tap away from anywhere in a long
     list. See-through while closed, so only the tab floats over the list;
     opaque while open, so the list scrolls out of sight under the tools.
     Below the bottom nav, Try it pill, and modals (z-index 40+). */
  .mobile-tools {
    position: sticky;
    top: 0;
    z-index: 30;
    /* Pulled up over the page's top padding (only that: covering the
       header's border line too would erase it). */
    margin-top: -1.25rem;
    pointer-events: none;
  }

  .mobile-tools > * {
    pointer-events: auto;
  }

  .tools-open .mobile-tools {
    background: var(--bg);
    pointer-events: auto;
  }

  .mobile-tools .catalog-header-row {
    margin-bottom: 0;
    padding-bottom: 0.75rem;
  }
}

@media (min-width: 900px) {
  .mobile-tools-tab {
    display: none;
  }

  /* Desktop: the wrapper does nothing; the row lays out as it always has. */
  .mobile-tools {
    display: contents;
  }
}

@media (min-width: 900px) {
  .desktop-only {
    display: block;
  }
}

/* Catalog layout: sidebar filters (desktop) / sheet filters (mobile) + grid */

.catalog-layout {
  display: block;
}

/* Hidden by default (mobile uses the full-screen filter sheet, nothing to
   resize there) — shown only at the 900px+ breakpoint below, which must
   come after this rule in the file for the same reason .icon-btn-desktop-only
   documents: a later same-priority rule wins ties, so "hidden by default"
   has to be the earlier one. */
.catalog-filter-resize-handle {
  display: none;
}

.catalog-filters {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.catalog-filters-panel {
  background: var(--bg);
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 1.5rem 1.25rem;
}

/* Mobile-only Clear/Apply pair, pinned to the bottom of the scrolling filter
   sheet via position: sticky (not fixed — it should stay within the sheet's
   own rounded bottom edge, not float relative to the whole viewport) so it
   stays reachable no matter how far the category list is scrolled or how
   many sections are expanded. background must be opaque and match the
   panel's own (--bg is a solid hex in both themes, not translucent, so this
   is safe — see the sticky-table-header/toast-transparency fixes elsewhere
   for what happens when it isn't). */
.filter-sheet-actions {
  display: flex;
  gap: 0.75rem;
  position: sticky;
  bottom: 0;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  background: var(--bg);
  border-top: 1px solid var(--nav-border);
}

.filter-sheet-actions .btn {
  flex: 1;
}

@media (min-width: 900px) {
  /* Pins the whole page body (title row + the two-column layout) directly
     to the viewport below the fixed site header, instead of trying to make
     it exactly tall enough to fit within the page's natural flow. That
     "exactly tall enough" version (a height: calc(100vh - Npx) on a normal
     flow element) is what this started as, and it silently failed: <body>
     is `min-height: 100vh` (not `height`), so if the subtracted pixel count
     is even slightly off from the real nav height, <body> just grows past
     100vh to fit and the whole page falls back to ordinary scrolling — the
     bounded panes never get a chance to matter. Taking the shell out of
     flow with position: fixed sidesteps that arithmetic entirely: a fixed
     element can't contribute to <body>'s height at all, so there's nothing
     left to get wrong. max-width/margin/padding are repeated here because
     fixed positioning breaks out of .page's own box, not just its flow. */
  .catalog-page-shell {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.25rem;
  }

  .catalog-header-row {
    flex-shrink: 0;
    position: relative;
    /* .catalog-layout (the filter/card grid below) is also position:
       relative and comes later in the DOM — without an explicit z-index
       here, it wins the stacking order and paints over the quick-search
       results dropdown despite that dropdown's own z-index:60, since that
       value is only meaningful relative to siblings at the same stacking
       level. */
    z-index: 2;
  }

  /* Keeps the icon group at the far end of .catalog-header-row. (The row
     used to hold a page search box between title and icons; search now
     lives only in the navbar.) */
  .catalog-header-actions {
    margin-left: auto;
  }

  /* View/filter controls line up with the card grid's left edge (just past
     the filter sidebar's divider), the way the old page search box did:
     positioned from .catalog-header-row's own edge with the same variable
     the sidebar's width uses, so they follow the divider while it's dragged.
     (A margin wouldn't work: it would stack on the title's own width.) */
  .catalog-view-controls {
    position: absolute;
    top: 50%;
    left: calc(var(--catalog-filter-width, 240px) + 2.5rem);
    transform: translateY(-50%);
    margin-left: 0;
  }

  .catalog-layout {
    display: grid;
    grid-template-columns: var(--catalog-filter-width, 240px) 1fr;
    gap: 2.5rem;
    align-items: stretch;
    flex: 1 1 auto;
    /* Anchor for .catalog-filter-resize-handle below — it can't anchor to
       .catalog-filters itself, since that element's overflow-y: auto forces
       overflow-x to also compute as auto (a real CSS Overflow spec quirk:
       one non-visible axis forces the other away from visible too), which
       clips anything positioned outside its own box, handle included. */
    position: relative;
    /* Its own stacking context, below .catalog-header-row's z-index: 2, so
       the sticky list-view category headers (z-index: 10) stay inside it
       and can't paint over the header row's search-results dropdown. */
    z-index: 1;
    /* Without this, grid/flex items default to min-height: auto, which
       keeps them at least as tall as their content and defeats the whole
       point — they'd never actually shrink to fit the remaining space,
       so overflow-y: auto below would never have anything to do. */
    min-height: 0;
  }

  .catalog-filters {
    display: block !important;
    position: static;
    inset: auto;
    background: none;
    z-index: auto;
    /* The actual scroll boundary lives here, not on .catalog-filters-panel
       (its child) — a child resolving height: 100% off a grid-stretched
       parent is one more indirection than this needs, and it wasn't
       reliably producing a bounded box in practice. .catalog-filters is
       the real grid item .catalog-layout stretches, so give it the bounded
       height directly. */
    height: 100%;
    overflow-y: auto;
  }

  .catalog-filters-panel {
    background: none;
    width: auto;
    max-height: none;
    border-radius: 0;
    padding: 0 1.75rem 0 0;
  }

  /* Keeps "Clear filters" reachable no matter how far the category list is
     scrolled within .catalog-filters' own bounded scroll (see above) —
     sticky's containing block is that nearest scrolling ancestor, so top: 0
     pins it there regardless of the extra .catalog-filters-panel/form
     nesting in between. Needs its own opaque background (matching the page's
     own, since .catalog-filters-panel itself is transparent at this
     breakpoint) so scrolled category rows don't show through underneath it. */
  .catalog-clear-filters-sticky {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg);
    padding-bottom: 0.5rem;
  }

  .catalog-clear-filters-sticky .back-link {
    margin-bottom: 0;
  }

  .catalog-main {
    height: 100%;
    overflow-y: auto;
    /* Breathing room between the rightmost column of content and the
       scrollbar track, so it doesn't sit flush against the card/table edge. */
    padding-right: 1rem;
  }

  /* The table's own sticky header (see the Lot table section) is normally
     relative to the page's scroll — but inside this bounded, independently
     scrolling results pane, .catalog-main itself is the nearest scrolling
     ancestor, so the sticky offset needs to be relative to *its* top edge
     (0), not the page's. */
  .catalog-main .lot-table th {
    top: 0;
  }

  /* Positioned against .catalog-layout (a grid, no overflow of its own),
     not .catalog-filters — anchoring to .catalog-filters clipped the handle
     the moment its overflow-y: auto actually engaged (e.g. a category
     expanding past the visible height), since one non-visible overflow axis
     forces the other to compute as auto too, clipping anything positioned
     outside that box. Centered in the 2.5rem gap between the two grid
     columns via the same --catalog-filter-width variable the grid itself
     uses, rather than being its own grid column (avoids restructuring the
     2-column grid into 3 just for a drag strip). filter-resize.js drives the
     actual resize by setting --catalog-filter-width on .catalog-layout. */
  .catalog-filter-resize-handle {
    display: block;
    position: absolute;
    top: 0;
    left: calc(var(--catalog-filter-width, 240px) + 1.25rem - 5px);
    bottom: 0;
    width: 10px;
    cursor: col-resize;
    z-index: 5;
    touch-action: none;
  }

  .catalog-filter-resize-handle::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 4px;
    width: 2px;
    border-radius: 2px;
    background: var(--nav-border);
  }

  .catalog-filter-resize-handle:hover::after,
  .catalog-filter-resize-handle.is-dragging::after {
    background: var(--accent);
  }

  .mobile-only {
    display: none !important;
  }

  .icon-btn-desktop-only {
    display: inline-flex !important;
  }

  .btn-label-desktop-only {
    display: inline !important;
  }
}

/* Filter accordion */

.catalog-search {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.quick-search-wrap {
  position: relative;
}

.quick-search-wrap .catalog-search {
  margin-bottom: 0;
}

.quick-search-results {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--card-bg);
  border: 1px solid var(--nav-border);
  border-radius: 10px;
  box-shadow: var(--shadow-float);
  max-height: 320px;
  overflow-y: auto;
}

.actions-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.actions-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 60;
  min-width: 210px;
  background: var(--card-bg);
  border: 1px solid var(--nav-border);
  border-radius: 10px;
  box-shadow: var(--shadow-float);
  padding: 0.5rem;
}

.actions-menu-row {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.actions-menu-row:hover {
  background: var(--tab-bg);
}

.actions-menu-row .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.actions-menu-divider {
  height: 1px;
  margin: 0.35rem 0.25rem;
  background: var(--nav-border);
}

/* Navbar account menu (desktop) — a pill trigger opening the same
   .actions-menu dropdown the variety page's Actions button uses. */
.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem 0.25rem 0.25rem;
  border: 1px solid var(--nav-border);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--header-text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.user-menu-trigger:hover,
.user-menu-trigger.active {
  border-color: var(--card-border-strong);
}

.user-menu-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.8rem;
  font-weight: 700;
}

.user-menu-chevron {
  width: 14px;
  height: 14px;
  color: var(--header-sub);
}

/* Stay hidden until a response has actually put a result (or the "No
   matches" line) in the box, so there's no empty bordered band while the
   first search is in flight. :not(:has(*)) rather than :empty because the
   search endpoints answer a blank query with a few bare newlines, and
   :empty doesn't match whitespace. */
.quick-search-results:empty,
.quick-search-results:not(:has(*)) {
  display: none;
}

/* Full-width rows split by thin divider lines, the whole row turning green
   on hover. (The Actions/account menus are different on purpose: a few
   rounded rows inside a padded panel.) */
.quick-search-result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1rem;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

/* Sibling selector, so it also beats button.quick-search-result's border
   reset below. */
.quick-search-result + .quick-search-result {
  border-top: 1px solid var(--nav-border);
}

.quick-search-result:hover,
.quick-search-result:focus-visible {
  background: var(--accent-green-bg);
  outline: none;
}

/* A "pick this variety" result (used by the +Add lot / +Growout variety-search
   steps) is a <button>, not an <a> — reset the button defaults but keep
   everything else (padding, divider, hover) inherited from .quick-search-result
   above unchanged. */
button.quick-search-result {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
}

/* Used when .quick-search-results is the only content of a modal step (the
   variety-search steps below), rather than a small dropdown floating under an
   input alongside other page content — renders in normal flow instead of as
   a floating absolutely-positioned overlay. */
.quick-search-results-inline {
  position: static;
  box-shadow: none;
  border-color: var(--nav-border);
  margin-top: 0.75rem;
}

/* Name left, crop right on the same line. The name keeps its full width
   (up to 70% of the row); the crop takes whatever is left and only
   truncates when the row is genuinely full. */
.quick-search-result-name {
  flex: 0 0 auto;
  max-width: 70%;
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-search-result-meta {
  flex: 0 1 auto;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-search-empty {
  padding: 0.65rem 1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.filter-section + .filter-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--nav-border);
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  cursor: pointer;
}

.chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

[aria-expanded="false"] .chevron {
  transform: rotate(-90deg);
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-top: 0.6rem;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-option:hover {
  background: var(--tab-bg);
}

.filter-option input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  margin: 0;
  flex-shrink: 0;
}

.filter-option:has(input:checked) {
  color: var(--text-primary);
  font-weight: 600;
}

.filter-count {
  flex-shrink: 0;
  font-size: 0.8rem;
}

/* Cards / grid */

.variety-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

/* Same dashed-box "add" tile language as .photo-add-tile, adapted for the
   variety grid's own auto-sizing (no fixed aspect-ratio — grid's default
   align-items: stretch already matches this tile's height to whatever
   .variety-card thumb+body height the rest of the row settles on; this tile
   just centers its own content within that, however tall it ends up). */
.variety-add-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 160px;
  border: 1.5px dashed var(--nav-border);
  border-radius: 16px;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  text-align: center;
  padding: 1.5rem 1rem;
  cursor: pointer;
}

.variety-add-tile:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.variety-add-tile svg {
  width: 28px;
  height: 28px;
}

/* Phones: a full-width tile pushes the crop's actual varieties off the first
   screen, and the tool row's + already adds one. Kept when it's the only
   thing in the grid (a crop with no varieties yet), so the page isn't blank. */
@media (max-width: 899px) {
  .variety-add-tile:not(:only-child) {
    display: none;
  }
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  display: block;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--card-border);
}

a.card {
  transition: border-color 0.15s ease, border-width 0.15s ease, box-shadow 0.15s ease;
}

a.card:hover {
  border-width: 2px;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.grower-card {
  border: 1px solid var(--card-border-strong);
}

/* .card .body's own bottom padding is dropped here — when collapsed, the
   tinted .grower-card-header is the only thing in .body, so with no bottom
   padding left over its background now reaches the card's bottom edge
   too (clipped to the card's own rounded corners by .card's overflow:hidden)
   instead of leaving a blank strip of plain card background beneath it.
   The expanded detail area supplies its own bottom padding back (see
   .grower-card-details below) since it's no longer inherited from .body.
   Specificity bumped to .card.grower-card (three class selectors) rather
   than relying on source order against .card .body below — same equal-
   specificity/source-order tie CLAUDE.md already flags for .icon-btn-desktop-only,
   so this doesn't get silently re-broken by a future reorder of this file. */
.card.grower-card .body {
  padding-bottom: 0;
}

.grower-card-details {
  padding-bottom: 1rem;
}

/* Same full-bleed collapsed-header technique as .lot-card-header (extends
   the click hit area out to the card's own edges), plus a tinted background
   so the collapsed/header row reads as visually distinct from the dropped-
   down detail beneath it. --tab-bg is the same subtle section tint already
   used for tabs/filter rows elsewhere, reused here rather than inventing a
   new color. The card's own border-radius + overflow:hidden clips this to
   the card's rounded corners automatically — top corners always (header is
   always first), bottom corners too when collapsed (header is then also
   last, since the details div beneath is display:none from x-show).
   The bottom divider border only applies while expanded (.is-open, toggled
   via Alpine) — a collapsed card is meant to read as one solid color with
   no seam, not a color bar with a stray border floating above the card's
   own outer edge. */
.grower-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: calc(100% + 2rem);
  margin: -0.85rem -1rem 0;
  padding: 0.85rem 1rem;
  background: var(--tab-bg);
  border: none;
  text-align: left;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
}

.grower-card-header.is-open {
  border-bottom: 1px solid var(--card-border);
}

.variety-card {
  border: 1px solid var(--card-border-strong);
  /* Lets the grid column stay its own width instead of growing to fit a
     long unwrapped name (a grid item's min-width defaults to its content). */
  min-width: 0;
}

/* One line each, trailing off in "…", so every card in a row stays the same
   height. The full text is in the title attribute for hover. */
.variety-card .body .name,
.variety-card .body .meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Catalog list view (toggle alternative to .variety-grid) — the ancestor
   .catalog-page-shell carries the .catalog-view-list class via Alpine
   (:class, not x-show) specifically so the toggle keeps working after
   #variety-list-container is replaced by an htmx filter/search swap — a
   freshly-swapped node can't be trusted to resolve an ancestor's Alpine
   scope reliably (see the active/retired lot-badge toggle for the same
   lesson), but a plain CSS selector off a stable ancestor always works.
   Both views are always rendered; only one is ever visible. The "hidden by
   default" rule must come before its .catalog-view-list override in the
   file for the same reason .icon-btn-desktop-only does (see that class). */
.variety-list-view {
  display: none;
}

.catalog-view-list .variety-grid {
  display: none;
}

.catalog-view-list .variety-list-view {
  display: block;
}

.catalog-list-group + .catalog-list-group {
  margin-top: 1.5rem;
}

/* Breeding's own Grid/List toggle — same mechanism as Catalog's above (both
   views always rendered, toggled by a class on the stable page-shell
   ancestor, "hidden by default" rule ordered before its override for the
   same reason .icon-btn-desktop-only needs that order). Scoped to
   .breeding-page-shell specifically, not the shared .planning-page-shell
   (Planning reuses that same shell class for its own unrelated layout, and
   also already has its own .lot-grid/.lot-table-wrap content that must stay
   untouched by this toggle). */
.cross-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.breeding-page-shell .lot-grid,
.breeding-page-shell .lot-table-wrap {
  display: none;
}

.breeding-view-list .cross-grid {
  display: none;
}

/* Re-states the same mobile-card/desktop-table split .lot-grid/.lot-table-wrap
   already have elsewhere, rather than trying to "unhide" them generically —
   a bare display: grid/block here at every width would fight (and, by
   specificity, beat) their own @media(min-width:900px) rules above, showing
   the desktop table on mobile too. */
.breeding-view-list.breeding-page-shell .lot-grid {
  display: grid;
}

@media (min-width: 900px) {
  .breeding-view-list.breeding-page-shell .lot-grid {
    display: none;
  }

  .breeding-view-list.breeding-page-shell .lot-table-wrap {
    display: block;
  }
}

/* Sticky per-category section header — position: sticky headers stacked in
   normal flow naturally "hand off" to the next one as each .catalog-list-group
   scrolls out, no JS needed. top: 0 is correct in both the mobile (plain
   page-level scroll, no competing sticky header) and desktop (bounded,
   independently-scrolling .catalog-main pane) cases — unlike .lot-table th,
   this class is never used outside the Catalog list, so there's no other
   context needing a different offset. Its background must stay opaque
   (--bg is solid in both themes) since it floats over scrolled rows. */
.catalog-list-category-header {
  /* A section heading, not a banner: the category name in the heading
     serif over a single rule, no fill/box (matching the plain table
     headers). background is the opaque page color only so rows scrolling
     under the sticky header don't show through. */
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-primary);
  background: var(--bg);
  padding: 0.6rem 0.85rem 0.5rem;
  border-bottom: 1px solid var(--card-border-strong);
}

/* Muted outlined count beside the category name. */
.catalog-list-category-count {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  color: var(--text-secondary);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
}

.variety-list-row {
  text-decoration: none;
  color: inherit;
}

.variety-list-crop {
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* Planning's "Stage varieties" checklist — reuses .catalog-list-group/
   .catalog-list-category-header/.list-row wholesale (same grouped-list
   language as Catalog's list view) rather than inventing new chrome; only
   the checkbox-row specifics below are new. */
/* Planning's "Several varieties" checklist: rows sit indented under their
   category heading (Catalog's list view, which shares these group styles,
   is unchanged). */
.planning-stage-row {
  padding-left: 1.6rem;
}

.planning-stage-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  margin: 0;
  flex-shrink: 0;
}

.planning-stage-actions {
  margin-top: 1rem;
  padding: 0.85rem 0.5rem;
  background: var(--bg);
  border-top: 1px solid var(--nav-border);
}

@media (min-width: 900px) {
  /* Sticks to the bottom of the bounded, independently-scrolling
     #planning-content pane (see "Independently-scrolling layout") so
     "Stage selected" stays reachable no matter how long the checklist is.
     Left in normal flow on mobile instead of also being sticky there,
     since the fixed bottom nav already occupies that part of the screen. */
  .planning-stage-actions {
    position: sticky;
    bottom: 0;
  }
}

.hero-banner {
  position: relative;
  background-size: cover;
  background-position: center;
  border-radius: 20px;
  overflow: hidden;
  margin: 1.5rem 0 0.5rem;
  padding: 5rem 1.25rem;
  min-height: 60vh;
  display: flex;
  align-items: center;
}

.hero-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 15, 0.6);
}

.hero-banner-content {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
  color: #fff;
  width: 100%;
}

.hero-banner-content p {
  color: rgba(255, 255, 255, 0.85);
  /* Balances line lengths across the paragraph instead of the default
     ragged-last-line wrap — widely supported (Chrome/Edge/Firefox/Safari),
     a harmless no-op fallback to normal wrapping on anything older. */
  text-wrap: balance;
}

.hero-banner-content h2 {
  color: #fff;
}

/* Cards keep their normal (non-white) text regardless of the banner's white copy.
   Paragraphs need their own rule: .hero-banner-content p targets every <p>
   directly, which beats anything a <p> would only inherit from the card. */
.hero-banner-content .card {
  color: var(--text-primary);
  text-align: left;
}

.hero-banner-content .card p {
  color: var(--text-primary);
  text-wrap: wrap;
}

.login-card {
  max-width: 400px;
  margin: 2rem auto 0;
  padding: 1.75rem;
}

.org-card-carousel {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.org-card-track {
  flex: 1;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  text-align: center;
}

.org-card-row {
  display: inline-flex;
  gap: 1rem;
  padding: 0.25rem;
}

.org-card-row .card {
  scroll-snap-align: start;
  min-width: 180px;
  flex-shrink: 0;
}

.carousel-arrow {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.carousel-arrow svg {
  width: 18px;
  height: 18px;
}

.card .thumb {
  position: relative;
  background: var(--thumb-bg);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* No photo yet: a quiet off-white frame instead of the tan --thumb-bg, with
   a hairline separating it from the card's text below. */
.card .thumb.thumb-empty {
  background: var(--tab-bg);
  border-bottom: 1px solid var(--nav-border);
}

.thumb-badge {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.card .body {
  padding: 0.85rem 1rem 1rem;
}

.card .name {
  font-weight: 600;
  font-size: 1.05rem;
}

.card .meta {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.badge {
  display: inline-block;
  background: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.empty-state {
  color: var(--text-secondary);
  text-align: center;
  padding: 3rem 1rem;
}

/* Variety photo gallery */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

/* Fixed 2-column only on phone-sized screens, where the "add tile stretches
   when it's alone on its own row" trick below is calibrated to a known
   column count. Tablet and up get the same flexible column count as
   desktop so thumbnails don't balloon in size. */
@media (min-width: 600px) {
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

.photo-sortable {
  display: contents;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--thumb-bg);
  cursor: grab;
  /* manipulation (not none) — disables double-tap-zoom without blocking the
     browser's own scroll handling, which SortableJS's delay/delayOnTouchOnly
     config (base.html) needs to still work for a quick swipe-through. */
  touch-action: manipulation;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
  /* Without these, iOS's own long-press "Save Image" callout and the
     browser's native drag-image-out behavior both compete with SortableJS
     for the same touch-and-hold gesture and usually win, since neither is
     suppressed by default on an <img> — this is why drag-reorder worked on
     desktop (mouse) but not touch. */
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

.photo-thumb-hero {
  box-shadow: 0 0 0 2px var(--accent);
}

/* The "which cross photos should come along to the new variety" picker on
   the promote modal — deliberately its own small grid, not a reuse of
   .photo-thumb (that one's styled/behaved around drag-reorder + a delete
   button, neither of which apply here). */
.photo-pick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 0.25rem 0 0.5rem;
}

.photo-pick-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--thumb-bg);
  cursor: pointer;
}

.photo-pick-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-pick-item input {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
}

.photo-pick-item:has(input:checked) {
  box-shadow: 0 0 0 2px var(--accent);
}

/* SortableJS's chosenClass (base.html) — applied once the press-and-hold
   delay elapses and the photo is actually armed to drag, not on first touch.
   Rules after .photo-thumb-hero so this wins if the hero photo itself is the
   one being picked up. */
.photo-thumb-armed {
  opacity: 0.55;
  box-shadow: 0 0 0 3px var(--accent);
  cursor: grabbing;
}

.photo-hero-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.photo-hero-badge svg {
  width: 12px;
  height: 12px;
}

.photo-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.photo-delete svg {
  width: 14px;
  height: 14px;
}

.photo-delete.active {
  background: rgba(0, 0, 0, 0.75);
}

/* Lot photos: a ⋮ menu instead of a bare delete button. The thumb can't
   clip its contents (the dropdown has to escape it), so the image carries
   the rounded corners instead. */
.photo-thumb-with-menu {
  overflow: visible;
}

.photo-thumb-with-menu img {
  border-radius: 12px;
}

.photo-menu-wrap {
  position: absolute;
  top: 6px;
  right: 6px;
}

.photo-menu-wrap .photo-delete {
  position: static;
}

.photo-menu {
  min-width: 200px;
}

/* One line per row; the menu grows to fit long variety names. */
.photo-menu .actions-menu-row {
  white-space: nowrap;
}

/* Phones (2 fixed columns): left-column menus open rightward so they stay
   on screen. nth-of-type counts only the thumb divs. */
@media (max-width: 599px) {
  .photo-thumb-with-menu:nth-of-type(odd) .photo-menu {
    right: auto;
    left: 0;
  }
}

/* Small check on a lot photo that's already in the variety's photos. */
.photo-copied-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.photo-copied-badge svg {
  width: 13px;
  height: 13px;
}

.actions-menu-row.is-disabled {
  cursor: default;
  color: var(--text-secondary);
}

.actions-menu-row.is-disabled:hover {
  background: transparent;
}

.actions-menu-row-danger,
.actions-menu-row-danger .icon {
  color: var(--danger);
}

.photo-add-tile {
  align-self: stretch;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1.5px dashed var(--nav-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
}

.photo-add-tile-alone {
  grid-column: 1 / -1;
  align-self: start;
  aspect-ratio: auto;
  padding: 0.65rem 0;
  flex-direction: row;
  gap: 0.4rem;
}

.photo-add-tile svg {
  width: 20px;
  height: 20px;
}

@media (min-width: 600px) {
  .photo-add-tile-alone {
    grid-column: auto;
    align-self: stretch;
    aspect-ratio: 1;
    padding: 0;
    flex-direction: column;
    gap: 0.3rem;
  }

  .photo-add-tile svg {
    width: 22px;
    height: 22px;
  }
}

.sortable-ghost {
  opacity: 0.4;
}

.sortable-drag {
  cursor: grabbing;
}

/* Photo lightbox */

.lightbox-backdrop {
  align-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lightbox-image {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 12px;
  object-fit: contain;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox-close {
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
}

.lightbox-close svg {
  width: 20px;
  height: 20px;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
}

.lightbox-nav svg {
  width: 22px;
  height: 22px;
}

.lightbox-prev {
  left: 1rem;
}

/* Pill action under the photo (e.g. "Add to <variety>'s photos" on lot
   photos). Same translucent look as the close/nav buttons. */
.lightbox-action {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.lightbox-action:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox-action.is-done {
  cursor: default;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
}

.lightbox-action svg {
  width: 16px;
  height: 16px;
}

.lightbox-next {
  right: 1rem;
}

/* Toasts */

.toast-container {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: calc(100% - 2rem);
  max-width: 360px;
  align-items: center;
}

@media (min-width: 900px) {
  .toast-container {
    bottom: 1.5rem;
    left: auto;
    right: 1.5rem;
    transform: none;
    align-items: flex-end;
  }
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--nav-border);
  box-shadow: var(--shadow-float);
  font-size: 0.9rem;
}

.toast-success {
  background: var(--accent-green-solid);
  color: var(--accent-green-text);
  border-color: var(--accent-green-border);
}

.toast-error {
  background: var(--danger);
  color: var(--danger-text);
  border-color: var(--danger);
}

.toast-warning {
  background: var(--warning);
  color: var(--warning-text);
  border-color: var(--warning);
}

.toast-info {
  background: var(--tab-bg-solid);
  color: var(--tab-text);
  border-color: var(--tab-border);
}

.toast button {
  display: flex;
  flex-shrink: 0;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
}

.toast button:hover {
  opacity: 1;
}

.toast button svg {
  width: 14px;
  height: 14px;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-text);
  transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease,
    background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}

.btn:hover:not(:disabled) {
  filter: brightness(0.92);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.btn.secondary {
  /* Surface + hairline border (the base .btn border), not a grey fill. */
  background: var(--card-bg);
  color: var(--text-primary);
}

.btn.danger {
  background: var(--danger);
  color: var(--danger-text);
}

.btn.green {
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
}

.btn.warning {
  background: var(--warning);
  color: var(--warning-text);
}

.icon-btn {
  /* A bare glyph, no circle/fill — the box is only there to keep a
     comfortable tap target around the icon. Hover/active are signaled by
     color alone. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s ease;
}

.icon-btn:hover:not(:disabled) {
  color: var(--accent);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 8px;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

.icon-btn.active {
  color: var(--accent);
}

.icon-btn.small {
  width: 30px;
  height: 30px;
}

.icon-btn.small svg {
  width: 18px;
  height: 18px;
}

.icon-btn-info {
  width: 26px;
  height: 26px;
}

.icon-btn-info svg {
  width: 18px;
  height: 18px;
}

/* A plain "go to" arrow — no border/background at rest, unlike .icon-btn,
   so it reads as a stylized inline navigation glyph rather than another
   button sitting next to real action buttons (e.g. "Promote to variety").
   Used for the variety<->cross cross-links. */
.nav-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--accent);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.nav-arrow svg {
  width: 18px;
  height: 18px;
}

.nav-arrow:hover {
  transform: translateX(3px);
}

.danger-zone {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--nav-border);
}

/* Lot cards */

.lot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  /* Extend the clickable hit area out to the card's edges, covering the
     surrounding .card .body padding, so the whole collapsed card responds
     to a click/tap — not just the text or chevron. */
  width: calc(100% + 2rem);
  margin: -0.85rem -1rem 0;
  padding: 0.85rem 1rem 0;
  background: none;
  border: none;
  text-align: left;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
}

.badge-retired {
  background: var(--danger);
  color: var(--danger-text);
  border-color: var(--card-border);
  margin-top: 0;
}

.badge-active {
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
  border-color: var(--card-border);
  margin-top: 0;
}

.badge-toggle {
  cursor: pointer;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.badge-toggle:hover {
  filter: brightness(0.94);
}

.badge-toggle.is-off {
  opacity: 0.5;
}

/* Active/retired lot visibility on the variety detail page — driven by a class
   toggled on the ancestor (Alpine, reliable since that element is never itself
   swapped) combined with plain static data-attributes on each lot card (not
   Alpine, so hiding doesn't depend on Alpine re-initializing a freshly
   htmx-swapped card's own x-show, which proved unreliable). */

.hide-active-lots [data-lot-status="active"] {
  display: none;
}

.hide-retired-lots [data-lot-status="retired"] {
  display: none;
}

[data-has-active][data-has-retired] {
  display: none;
}

.hide-active-lots.hide-retired-lots [data-has-active="true"][data-has-retired="true"],
.hide-active-lots [data-has-active="true"][data-has-retired="false"],
.hide-retired-lots [data-has-active="false"][data-has-retired="true"] {
  display: block;
}

/* Product cards — same collapsible card shell as lot cards, plus a leading
   print icon button, so the two sit at equal height side by side. */

.product-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: calc(100% + 2rem);
  margin: -0.85rem -1rem 0;
  padding: 0.85rem 1rem 0;
  background: none;
  border: none;
  text-align: left;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
}

.product-card-header-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.lot-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--nav-border);
}

/* Record groups inside a lot-card section (Field, Inputs, … / Storage,
   Germination, …). A group only renders when it has something in it. */
.lot-record-group + .lot-record-group {
  margin-top: 1rem;
}

.lot-record-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  margin: 0 0 0.2rem;
  padding-left: 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.lot-record-group .lot-summary-line {
  margin: 0 0 0.25rem;
  padding-left: 0.75rem;
}

/* Everything under a group heading sits a little indented, so each group
   reads as a heading with its records beneath it. */
.lot-record-group > :not(.lot-record-group-title) {
  margin-left: 0.85rem;
}

.lot-record-line {
  padding: 0.2rem 0.75rem;
  font-size: 0.9rem;
}

/* Lot page: the card's frame goes away and the summary header and each
   section become their own cards; from 900px, Production and Inventory
   records sit side by side. (Variety-page lot cards keep one column.) */
.lot-card-page {
  background: none;
  border: none;
  box-shadow: none;
  overflow: visible;
}

.lot-card-page > .body {
  padding: 0;
}

.lot-card-page .lot-card-header,
.lot-card-page .lot-section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.lot-card-page .lot-card-header {
  width: auto;
  margin: 0;
  padding: 1rem 1.25rem;
}

.lot-card-page .lot-section {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
}

/* A collapsed section card opens on a click anywhere (see _lot_card.html). */
.lot-section:has(> .row .lot-section-toggle[aria-expanded="false"]) {
  cursor: pointer;
}

@media (min-width: 900px) {
  .lot-card-page .lot-record-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1.25rem;
    align-items: start;
  }
}

/* Add popup opened from a lot card section's "+" (_add_record_picker.html):
   heading + "Record type" dropdown on top, the chosen type's form below.
   One fixed height while picking, so switching types doesn't make the popup
   jump; a longer form scrolls inside it. */
.modal-sheet:has(.record-picker) {
  height: min(640px, 90vh);
}

/* Space between the dropdown and the form below it (the dropdown sits
   outside the <form>, so it doesn't get the form's own field spacing). */
.record-picker {
  margin-bottom: 1.25rem;
}

.list-row {
  display: block;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.65rem 0.75rem;
}

.note-body {
  min-width: 0;
}

.note-body p {
  margin: 0;
}

.list-row:hover {
  background: var(--tab-bg);
}

.list-row + .list-row {
  border-top: 1px solid var(--nav-border);
}

/* A .list-row rendered as a <button> (e.g. the lot stage picker). */
button.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
}

.stage-option.is-current {
  font-weight: 600;
}

/* Clickable summary line at the top of a lot-card section (population /
   area / isolation in Field, seed count in Inventory); opens its own modal. */
.lot-field-facts,
.lot-summary-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 0.6rem;
  cursor: pointer;
}

.lot-field-facts:hover,
.lot-summary-line:hover {
  color: var(--text-primary);
}

/* Two or three short form fields side by side (amount + unit, weight in/out). */
.field-pair {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0.75rem;
}

/* Collapsible lot-card section heading (chevron + title + count), see
   static/js/lot-sections.js. */
.lot-section-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.lot-section-toggle h3 {
  margin: 0;
}

.lot-section-toggle .badge {
  margin-top: 0;
}

.lot-section-body {
  margin-top: 0.6rem;
}

.taxonomy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
}

.taxonomy-row + .taxonomy-row {
  border-top: 1px solid var(--nav-border);
}

.taxonomy-row-indent {
  padding-left: 1rem;
}

.taxonomy-row-inactive {
  opacity: 0.55;
}

.taxonomy-row-clickable {
  cursor: pointer;
  border-radius: 8px;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  margin: 0 -0.5rem;
}

.taxonomy-row-clickable:hover {
  background: var(--tab-bg);
}

.taxonomy-category + .taxonomy-category {
  border-top: 1px solid var(--nav-border);
}

.taxonomy-crops {
  padding-bottom: 0.5rem;
}

.filter-subsection + .filter-subsection {
  margin-top: 0.5rem;
}

.filter-subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0.3rem 0.5rem;
  margin-top: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-category-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.05rem 0.5rem 0.05rem 0.1rem;
}

.filter-category-row .filter-subheader {
  margin-top: 0;
  padding: 0.15rem 0;
}

.lot-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

@media (min-width: 900px) {
  .lot-grid {
    display: none;
  }
}

/* Lot table (Lots, Planning, Breeding) — a plain ruled table: quiet
   uppercase column labels over a single rule (see .lot-table th below),
   then rows separated by divider lines (.lot-table td's border-bottom) on
   the ordinary page background. No border/background/radius on the table
   itself. Swaps in for .lot-grid at the same 900px breakpoint the rest of
   this page's layout already uses. This used to be a bordered, rounded
   card (and later a bordered green header box); keep the table itself
   border/radius/overflow-free — a sticky header inside anything with
   overflow set stops sticking, and rounded corners on a sticky header
   drift out of line with the body once it scrolls. */

.lot-table-wrap {
  overflow: visible;
}

.lot-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

/* Plain ruled table header (see .lot-table th below) — no border/radius
   of its own, so there's nothing for the sticky header to misalign against
   while scrolling. */
.lot-table th {
  /* Quiet column labels — small muted uppercase sans, a single rule
     underneath, no fill band. background is the (always opaque) page
     color only so rows scrolling under the sticky header don't show
     through. */
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--card-border-strong);
  white-space: nowrap;
  position: sticky;
  top: var(--header-height);
  z-index: 10;
}

.lot-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--nav-border);
  font-size: 0.9rem;
  vertical-align: middle;
}

.lot-table th.lot-table-status,
.lot-table td.lot-table-status {
  text-align: center;
}

.lot-table tbody tr {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.lot-table tbody tr:hover {
  background: var(--tab-bg);
}

.lot-table tbody tr:hover .lot-table-code {
  color: var(--accent);
}

.lot-table tbody tr:last-child td {
  border-bottom: none;
}

.lot-table-code {
  font-family: var(--font-display);
  color: var(--text-primary);
}

.lot-table-crop {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.lot-row {
  display: flex;
  flex-direction: column;
  color: inherit;
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--card-border-strong);
  overflow: hidden;
}

.lot-row:hover {
  border-width: 2px;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.lot-row-header {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: var(--accent-tint-bg);
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--card-border-strong);
}

.lot-row-title {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.lot-row-variety {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  color: var(--text-primary);
}

.lot-row-code-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  gap: 0.2rem;
}

.lot-row-code {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent);
}

.lot-row-crop {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.lot-row-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
}

.lot-row-info {
  min-width: 0;
  flex: 1;
}

@media (max-width: 899px) {
  .lot-row-year-line {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    min-width: 0;
  }

  .lot-row-grower {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
  }

  .lot-row-stats-line {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
  }

  .lot-row-stats-line .lot-row-sep {
    display: none;
  }
}

.lot-row svg {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  transition: transform 0.15s ease;
}

.lot-row:hover svg {
  transform: translateX(2px);
  color: var(--accent);
}

/* Settings: four labeled groups, each a panel of rows that open a popup
   (accounts/settings.html, accounts/_settings_row.html; owner's pick "C ·
   Grouped list" of four mockups). Two columns from 900px, one on phones. */

.settings-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.settings-groups-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

@media (min-width: 900px) {
  .settings-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem 1.75rem;
    align-items: start;
  }
}

.settings-group-title {
  margin: 0 0 0.5rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.settings-list {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.85rem 1.1rem;
  background: none;
  border: 0;
  border-top: 1px solid var(--nav-border);
  font: inherit;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

/* The first row has no line above it. (People's row sits in a
   display: contents wrapper, so it's never the list's first child.) */
.settings-list > .settings-row:first-child {
  border-top: 0;
}

.settings-row:hover {
  background: var(--tab-bg);
}

.settings-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.settings-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--badge-bg);
  color: var(--accent);
}

.settings-row-icon svg {
  width: 20px;
  height: 20px;
}

.settings-row-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.settings-row-name {
  font-weight: 600;
}

.settings-row-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Desktop: every description stays on one line (they're written to fit). */
@media (min-width: 900px) {
  .settings-row-desc {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.settings-row-status {
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.settings-row-chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-secondary);
}

/* Phones: the count moves up beside the name, so the description gets the
   row's full width and stays on one line like on desktop. */
@media (max-width: 899px) {
  .settings-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto 18px;
    grid-template-areas: "icon name status chevron" "icon desc desc chevron";
    column-gap: 0.85rem;
    row-gap: 0.1rem;
  }
  .settings-row-icon { grid-area: icon; }
  .settings-row-text { display: contents; }
  .settings-row-name { grid-area: name; }
  .settings-row-desc { grid-area: desc; }
  .settings-row-status { grid-area: status; }
  .settings-row-chevron { grid-area: chevron; }
}

/* Variety detail: Lots / Products side-by-side on wide screens */

.variety-columns {
  display: block;
}

@media (min-width: 900px) {
  .variety-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: start;
  }
}

/* Variety detail header: breadcrumb/title/details on the left, the Actions
   menu (things you do with the whole variety) on the right, lined up with
   the title rather than the breadcrumb above it. (It used to hold its own
   search box; the navbar's global search replaced it.) */

.variety-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.variety-header-info {
  min-width: 0;
}

/* The variety's menu (Edit variety, View usage, ...) is a ⋮ icon sharing
   a row with the breadcrumb: breadcrumb left, dots right, centered on each
   other by the flex row itself rather than by offsets. */
.variety-header-info {
  flex: 1 1 auto;
}

.variety-breadcrumb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* The icon keeps its 42px tap target, but negative margins stop it from
   making the row taller than the breadcrumb line, and line the glyph up
   with the content's right edge. */
.variety-header-actions {
  margin: -11px -0.6rem -11px 0;
}

/* Evenly spaced dots, a little heavier than the default icon so they're
   easy to spot. They stand taller than the breadcrumb's lowercase-heavy
   text, and when centered exactly the overhang below the baseline read as
   "low", so they're nudged up 1px. (Squeezing the dots closer together to
   fit the text height looked cramped; shrinking the icon made it too
   small to notice.) */
.variety-actions-icon svg {
  width: 20px;
  height: 20px;
  transform: translateY(-1px);
}

/* Lot page: the lot code heading under the breadcrumb row. */
/* Lot page heading (_lot_page_heading.html): lot code, stage pill, then the
   latest germ and inventory as small label / serif value / date. Wraps
   under the code on phones. */
.lot-page-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0.25rem 0 1.25rem;
}

.lot-page-heading .lot-page-title {
  margin: 0;
}

.lot-page-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1.25rem;
}

.lot-page-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  white-space: nowrap;
}

.lot-page-stat-label {
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.lot-page-stat-value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.lot-page-stat-date {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

/* Lot page summary card: the variety page's .variety-summary (About this lot
   | Photos | Notes, _lot_summary.html). The record section cards below it
   bring their own top margin. */
.variety-summary.lot-page-summary {
  margin-bottom: 0;
}

/* Notes + usage button: stacked on mobile, side by side on wide screens. */

/* Variety page summary card (variety_detail.html), like the lot page's:
   Info (1/4) | Photos (1/2) | Notes (1/4) with thin dividers; stacked on
   phones. */
.variety-page-title {
  margin: 0.25rem 0 0.9rem;
}

.variety-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 1.5rem;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--card-bg);
}

.variety-summary > div {
  min-width: 0;
  padding: 0.9rem 1.1rem;
}

.variety-summary > div + div {
  border-top: 1px solid var(--nav-border);
}

@media (min-width: 900px) {
  .variety-summary {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
  }

  .variety-summary > div + div {
    border-top: none;
    border-left: 1px solid var(--nav-border);
  }
}

/* Info part: like the back of a seed packet. "Label ······ Value" rows with
   a dotted leader, values in the display serif (owner's pick of three
   mockups, "ledger"). */
.variety-facts-title {
  margin-bottom: 0.55rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--nav-border);
  color: var(--badge-text);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.variety-facts {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
}

.variety-fact {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

/* One line per row: the label never shrinks or wraps, the dotted leader
   fills the gap, and a value that doesn't fit ends in "…" (its title shows
   it in full). A wrapping value used to keep its full box width, so the
   leader stopped short of the text. */
.variety-fact dt {
  display: flex;
  flex: 1 0 auto;
  align-items: baseline;
  gap: 0.5rem;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

/* The dotted leader fills whatever room the value leaves. */
.variety-fact dt::after {
  content: "";
  flex: 1 1 auto;
  min-width: 0.75rem;
  border-bottom: 1.5px dotted var(--card-border-strong);
  opacity: 0.45;
  transform: translateY(-4px);
}

.variety-fact dd {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  text-align: right;
}

.variety-fact dd .text-link-btn,
.variety-fact dd .text-secondary {
  font-family: var(--font-display);
}

.variety-summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.8rem;
}

.variety-tag {
  padding: 0.15rem 0.65rem;
  border: 1px solid var(--badge-border);
  border-radius: 999px;
  color: var(--badge-text);
  font-size: 0.75rem;
  font-weight: 600;
}

.variety-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.variety-summary-label {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
}

/* Five tiles that scale with the card, in one row (never wrapping) from
   600px. Phones wrap them three to a row instead, so they stay a decent
   size (one row of five was too small to see). */
.variety-photo-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

@media (min-width: 600px) {
  .variety-photo-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.variety-photo-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: var(--thumb-bg);
  cursor: pointer;
}

.variety-photo-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.variety-photo-tile.is-hero {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.variety-photo-star {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #1C1A15;
  color: #FFFFFF;
  font-size: 0.7rem;
}

.variety-photo-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  border: 1px dashed var(--btn-border);
  background: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.variety-photo-add svg {
  width: 20px;
  height: 20px;
}

.variety-photo-add:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.variety-photo-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  background: var(--text-primary);
  color: var(--bg);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
}

.variety-photo-more span {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.8;
}

.variety-photo-more:hover {
  filter: brightness(1.15);
}

/* The gallery popup ("View all" photos). */
.photo-gallery-sheet {
  max-width: 860px;
}

/* Notes, the right-hand part of the summary card. */
.variety-notes-card {
  display: flex;
  flex-direction: column;
}

.variety-notes-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.variety-notes-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.variety-notes-head .badge {
  margin-top: 0;
}

.variety-notes-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: auto;
}

.variety-notes-all {
  padding: 0.25rem 0.5rem;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.variety-notes-all:hover,
.variety-notes-all:focus-visible {
  background: var(--tab-bg);
  color: var(--text-primary);
}

/* One note per line, newest first; the full text is in the edit popup. */
.variety-note-line {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  width: 100%;
  min-width: 0;
  padding: 0.4rem 0.3rem;
  border: none;
  border-top: 1px solid var(--nav-border);
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.variety-note-line:hover,
.variety-note-line:focus-visible {
  background: var(--tab-bg);
}

.variety-note-date {
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.variety-note-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.variety-notes-empty {
  margin: 0.2rem 0 0.35rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* The "View all" popup's list. */
.variety-notes-list {
  max-height: 60vh;
  overflow-y: auto;
  border-top: 1px solid var(--nav-border);
}

.variety-notes-list-row {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 0.75rem;
  width: 100%;
  padding: 0.65rem 0.4rem;
  border: none;
  border-bottom: 1px solid var(--nav-border);
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.variety-notes-list-row:hover,
.variety-notes-list-row:focus-visible {
  background: var(--tab-bg);
}

.variety-notes-list-row .variety-note-date {
  padding-top: 0.1rem;
}

@media (min-width: 600px) {
  .variety-notes-row {
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
  }
}

/* Planning header: title row, then action buttons on their own line on
   mobile — side by side on wide screens, same breakpoint the table/card
   swap on this page already uses. */

.planning-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* The title half of the header — on mobile it's stacked on its own line
   above the action buttons, so it needs the standard row height itself. */
.planning-header > :first-child {
  min-height: var(--title-row-height);
}

@media (min-width: 900px) {
  .planning-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: var(--title-row-height);
  }

  /* Same fixed-shell approach as .catalog-page-shell (see that block for
     the full reasoning). Used by Breeding; Planning now uses
     .catalog-page-shell itself, like Catalog and Lots. */
  .planning-page-shell {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.25rem;
  }

  .planning-header {
    flex-shrink: 0;
  }
}

@media (max-width: 899px) {
  #variety-products {
    margin-top: 2rem;
  }
}

.settings-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.25rem;
}

.taxonomy-name-group {
  min-width: 0;
  flex: 1 1 auto;
}

.taxonomy-actions {
  flex-shrink: 0;
}

.truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-count-desktop {
  display: none;
}

.badge-count-mobile {
  display: inline;
}

@media (min-width: 900px) {
  .badge-count-desktop {
    display: inline;
  }

  .badge-count-mobile {
    display: none;
  }
}

@media (max-width: 399px) {
  .taxonomy-actions {
    gap: 0.1rem !important;
  }

  .icon-btn.small {
    width: 26px;
    height: 26px;
  }
}

/* Boxed subsection inside a lot-card section (stock seed usage, storage). */
.stock-seed-usage,
.lot-subsection {
  margin-top: 1.25rem;
  padding: 0.85rem;
  border: 1px solid var(--nav-border);
  border-radius: 12px;
}

/* View usage popup (_usage_modal.html): per section, headline totals and
   a table of the lots behind them. */
.usage-period {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0 0.75rem;
}

.usage-period > .field {
  flex: 1 1 240px;
}

.usage-period-range {
  padding-bottom: 1.6rem;
  font-size: 0.85rem;
}

.usage-custom-range {
  flex-basis: 100%;
  gap: 0.75rem;
}

.usage-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.9rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--nav-border);
  border-radius: 14px;
  background: var(--card-bg);
}

.usage-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.usage-section-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.usage-section-head .text-secondary {
  font-size: 0.78rem;
}

.usage-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.usage-total {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: var(--tab-bg);
}

.usage-total > span {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.usage-total strong {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.2;
}

.usage-total-on-hand {
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
}

.usage-total-on-hand > span {
  color: inherit;
}

.usage-total strong.usage-none {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.usage-inline-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.4rem;
  font-size: 0.92rem;
}

.usage-inline-totals .usage-none {
  font-weight: 500;
  color: var(--text-secondary);
}

.usage-table-wrap {
  overflow-x: auto;
}

.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.usage-table th {
  padding: 0.25rem 0.6rem 0.4rem 0;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.usage-table td {
  padding: 0.5rem 0.6rem 0.5rem 0;
  border-top: 1px solid var(--nav-border);
  white-space: nowrap;
}

.usage-table .num {
  padding-right: 0;
  padding-left: 0.6rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.usage-used {
  font-weight: 600;
}

.usage-retired {
  margin: 0 0 0 0.3rem;
  font-size: 0.68rem;
  vertical-align: 1px;
}

.usage-footnote {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.stock-seed-usage-header,
.lot-subsection-header {
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
  margin: -0.85rem -0.85rem 0.6rem;
  padding: 0.5rem 0.85rem;
  border-radius: 12px 12px 0 0;
}

/* Forms */

form .field {
  margin-bottom: 1rem;
}

/* "i" tooltip next to a form label (templates/_info_tip.html). Dark bubble
   with white text in both themes, opening below the label. The bubble is
   positioned against the label (not the icon) and capped at its width, so it
   never pokes out of a modal sheet and adds sideways scrolling on phones. */
.info-tip {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 0.3rem;
}

.info-tip-btn {
  display: inline-flex;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.info-tip-btn:hover,
.info-tip-btn[aria-expanded="true"] {
  color: var(--accent);
}

.info-tip-btn svg {
  width: 15px;
  height: 15px;
}

.info-tip-bubble {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 70;
  width: max-content;
  max-width: min(300px, 100%);
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: #1C1A15;
  color: #FFFFFF;
  box-shadow: var(--shadow-float);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
}

/* Settings option-list popups: the "i" beside the title explains the list.
   The bubble opens under the heading in body type, not the heading's. */
.options-modal-title {
  position: relative;
  margin: 0;
}

.options-modal-title .info-tip-btn svg {
  width: 17px;
  height: 17px;
}

.options-modal-title .info-tip-bubble {
  width: 280px;
  max-width: 280px;
  font-family: "Inter", system-ui, sans-serif;
  letter-spacing: normal;
}

form label,
.field label {
  position: relative;
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text-secondary);
}

form input,
form textarea,
form select,
.record-picker select,
.datepicker-display,
.catalog-search {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--nav-border);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
}

/* (.record-picker select: the add popup's "Record type" dropdown sits above
   the <form>, so it's listed explicitly to get the same field styling.)

   Search boxes only (the rule above is shared with every form field):
   magnifying glass inset on the left. */
input[type="search"].catalog-search {
  padding-left: 2.35rem;
  background: var(--card-bg) var(--search-icon) no-repeat 0.75rem center / 18px 18px;
}

/* No placeholder text on phones: it doesn't fit next to the close button
   on a narrow screen, and the magnifying glass already says what the box
   is for. Hidden by color rather than removed, so it's still read out by
   screen readers. */
@media (max-width: 899px) {
  input[type="search"].catalog-search::placeholder {
    color: transparent;
  }
}

form input:focus,
form textarea:focus,
form select:focus,
.record-picker select:focus,
.datepicker-display:focus-within,
.catalog-search:focus {
  outline: none;
  border-color: var(--accent);
}

form select:disabled,
form input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Password show/hide toggle (static/js/password-toggle.js) */

.password-field-wrap {
  position: relative;
}

.password-field-wrap input {
  padding-right: 2.5rem;
}

.password-toggle-btn {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  color: var(--text-secondary);
  cursor: pointer;
}

.password-toggle-btn svg {
  width: 18px;
  height: 18px;
}

.password-toggle-btn:hover {
  color: var(--text-primary);
}

form input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

form .errorlist {
  color: var(--danger);
  font-weight: 600;
  font-size: 0.8rem;
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0.75rem;
}

.no-spinner {
  -moz-appearance: textfield;
}

.no-spinner::-webkit-outer-spin-button,
.no-spinner::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Date picker */

.datepicker-wrapper {
  position: relative;
}

.datepicker-display {
  text-align: left;
  cursor: pointer;
}

.datepicker-display.is-placeholder {
  color: var(--text-secondary);
}

.datepicker-popover {
  position: fixed;
  z-index: 100;
  width: 280px;
  background: var(--card-bg);
  border: 1px solid var(--nav-border);
  border-radius: 10px;
  box-shadow: var(--shadow-float);
  padding: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.datepicker-popover.position-below {
  transform: translateY(-8px);
}

.datepicker-popover.position-above {
  transform: translateY(8px);
}

.datepicker-popover.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.datepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7rem;
}

.datepicker-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.datepicker-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--text-primary);
  cursor: pointer;
}

.datepicker-nav svg {
  width: 16px;
  height: 16px;
}

.datepicker-nav:hover:not(:disabled) {
  background: var(--tab-bg);
}

.datepicker-nav:disabled {
  color: var(--nav-inactive);
  cursor: not-allowed;
}

.datepicker-weekdays,
.datepicker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.datepicker-weekdays {
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.3rem;
}

.datepicker-grid {
  gap: 2px;
}

.datepicker-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}

.datepicker-day.filler {
  cursor: default;
}

.datepicker-day:hover:not(:disabled):not(.filler) {
  background: var(--tab-bg);
}

.datepicker-day.today {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.datepicker-day.selected {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.datepicker-day.disabled {
  color: var(--nav-inactive);
  cursor: not-allowed;
}

/* "Try it" checklist (demo and sandbox only — accounts/tour.py). A pill in
   the bottom-right corner (above the bottom nav on phones) that opens a
   card of steps above it. Below modals (z-index 50) so a modal covers it. */

.tour {
  position: fixed;
  right: 1rem;
  bottom: calc(4.75rem + env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
}

@media (min-width: 900px) {
  .tour {
    right: 1.5rem;
    bottom: 1.5rem;
  }
}

/* Keep toasts clear of the pill. */
body:has(.tour) .toast-container {
  bottom: 9rem;
}

@media (min-width: 900px) {
  body:has(.tour) .toast-container {
    bottom: 5rem;
  }
}

.tour-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow-float);
  transition: filter 0.15s ease, transform 0.15s ease;
}

.tour-pill:hover {
  filter: brightness(0.92);
  transform: translateY(-1px);
}

.tour-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.tour-pill:has(.tour-pulse) {
  animation: tour-pulse 1.1s ease-out 2;
}

@keyframes tour-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  100% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--accent) 0%, transparent); }
}

.tour-count {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.tour-count .icon {
  width: 18px;
  height: 18px;
}

.tour-panel {
  width: min(360px, calc(100vw - 2rem));
  max-height: calc(100vh - 11rem);
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--nav-border);
  border-radius: 10px;
  box-shadow: var(--shadow-float);
  padding: 1rem 1.1rem 0.75rem;
}

.tour-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.tour-panel-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.tour-all-done {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
  font-size: 0.85rem;
}

.tour-steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tour-step {
  display: flex;
  gap: 0.7rem;
  padding: 0.65rem 0;
}

.tour-step + .tour-step {
  border-top: 1px solid var(--nav-border);
}

.tour-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 0.1rem;
  border-radius: 50%;
  border: 1.5px solid var(--card-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tour-step.done .tour-check {
  background: var(--toggle-track-on);
  border-color: var(--toggle-track-on);
  color: #fff;
}

.tour-check svg {
  width: 12px;
  height: 12px;
}

.tour-step-body {
  min-width: 0;
}

.tour-step-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.tour-step.done .tour-step-title {
  color: var(--text-secondary);
  font-weight: 500;
}

.tour-optional {
  margin-left: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.tour-step-how {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.tour-hide {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.6rem 0 0.2rem;
  border: none;
  border-top: 1px solid var(--nav-border);
  background: none;
  font: inherit;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.tour-hide:hover {
  color: var(--text-primary);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Bottom nav (mobile) */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--nav-bg);
  border-top: 1px solid var(--nav-border);
  display: flex;
  z-index: 40;
}

.bottom-nav a,
.bottom-nav button {
  flex: 1;
  text-align: center;
  padding: 0.6rem 0 0.75rem;
  color: var(--nav-inactive);
  font-size: 0.7rem;
  font-weight: 600;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.bottom-nav a.active,
.bottom-nav button.active {
  color: var(--accent);
}

.bottom-nav .icon {
  width: 22px;
  height: 22px;
  display: block;
  margin: 0 auto 0.2rem;
}

@media (min-width: 900px) {
  .bottom-nav {
    display: none;
  }
  body {
    padding-bottom: 0;
  }
}

/* "More" bottom sheet (mobile only — desktop has room for plain nav links) */

.more-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.more-sheet-panel {
  background: var(--bg);
  width: 100%;
  max-width: 420px;
  border-radius: 20px 20px 0 0;
  padding: 1.25rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
}

.more-sheet-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.25rem;
  color: var(--text-primary);
  font-weight: 600;
}

.more-sheet-row + .more-sheet-row {
  border-top: 1px solid var(--nav-border);
}

.more-sheet-row .icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--text-secondary);
}

/* Logout is a <button> (inside a POST <form>, not a plain link), so it needs
   the native-button reset — same idea as button.quick-search-result. */
button.more-sheet-row {
  width: 100%;
  background: none;
  border: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

@media (min-width: 900px) {
  .more-sheet {
    display: none !important;
  }
}

/* Modal / sheet */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

@media (min-width: 900px) {
  .modal-backdrop {
    align-items: center;
  }
}

.modal-sheet {
  background: var(--bg);
  width: 100%;
  max-width: 520px;
  border-radius: 20px 20px 0 0;
  padding: 1.5rem;
  max-height: 90vh;
  overflow-y: auto;
}

@media (min-width: 900px) {
  .modal-sheet {
    border-radius: 20px;
  }
}

.modal-sheet-wide {
  max-width: 640px;
}

/* ✕ in a popup's top-right corner, for popups with no form to cancel
   (e.g. the lot stage picker). The sheet is its positioning box. */
.modal-sheet:has(> .modal-close-x) {
  position: relative;
}

.modal-close-x {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.modal-close-x:hover {
  background: var(--tab-bg);
  color: var(--text-primary);
}

.modal-close-x svg {
  width: 20px;
  height: 20px;
}

.chart-toggle {
  display: inline-flex;
  gap: 0.3rem;
  background: var(--card-bg);
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  padding: 0.25rem;
}

.chart-toggle-btn {
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--tab-text);
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.chart-toggle-btn.active {
  background: var(--accent);
  color: var(--accent-text);
}

/* Toggle switch */

.toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--toggle-track-off);
  /* Hairline so the light "off" track still shows against a light row. */
  box-shadow: inset 0 0 0 1px var(--btn-border);
  border-radius: 999px;
  cursor: pointer;
}

.toggle-track.on {
  background: var(--toggle-track-on);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.toggle-track.on .toggle-thumb {
  transform: translateX(20px);
}

.toggle-track.disabled {
  /* Locked, not faded: a committed growout should still read as clearly
     "on" — the not-allowed cursor is enough to say it can't be flipped. */
  cursor: not-allowed;
}

/* Utility */

.text-secondary {
  color: var(--text-secondary);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.space-between {
  justify-content: space-between;
}

/* ------------------------------------------------------------------
   Farm map (catalog/farm_map.html, static/js/farm-map.js)
   Plots are colored by status, never by crop: In use (solid green),
   Planned (striped), Empty (dashed). Searching dims everything but the
   plots where the crop grew. The drawing's own land/scenery colors come
   from the farm's SVG; only [data-location] shapes are restyled here.
   ------------------------------------------------------------------ */
.farm-map-page {
  --map-in-use: #8BAA7C;
  --map-in-use-stroke: #4F6E43;
  --map-planned: #F3E6CC;
  --map-planned-stripe: #D9B27A;
  --map-planned-stroke: #A9772F;
  --map-empty: #F6F2E8;
  --map-empty-stroke: #9E937A;
  --map-dim: #E9E3D2;
}

.farm-map-header .catalog-header-left {
  flex: 1 1 auto;
  flex-wrap: wrap;
}

/* In the header row, after the year picker and Map/List icons. */
.farm-map-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 320px;
  min-width: 0;
  margin-left: 0.5rem;
}

.farm-map-search input[type="search"] {
  flex: 1;
  min-width: 0;
}

.farm-map-status-line {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.farm-map-mode-pill {
  display: inline-flex;
  align-items: center;
  margin-right: 0.4rem;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  background: var(--text-primary);
  color: var(--bg);
  font-size: 0.8rem;
  font-weight: 600;
}

.farm-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.farm-map-layout.has-map,
.farm-map-layout.with-tray {
  grid-template-columns: minmax(0, 1fr) 320px;
}

/* No side panel without a drawing (unless planning), or in List view. */
.farm-map-layout:not(.has-map):not(.with-tray) .farm-map-panel,
.view-list .farm-map-layout:not(.with-tray) .farm-map-panel {
  display: none;
}

.view-list .farm-map-layout:not(.with-tray) {
  grid-template-columns: minmax(0, 1fr);
}

.farm-map-layout.has-map .farm-map-list,
.view-list .farm-map-map,
.view-list .farm-map-details-panel,
.view-list .farm-map-hint-map,
.view-list .farm-map-place-btn,
.farm-map-layout:not(.has-map) .farm-map-details-panel,
.farm-map-layout:not(.has-map) .farm-map-hint-map,
.farm-map-layout:not(.has-map) .farm-map-place-btn {
  display: none;
}

.farm-map-hint-list {
  display: none;
}

.view-list .farm-map-layout.has-map .farm-map-list {
  display: block;
}

.view-list .farm-map-hint-list,
.farm-map-layout:not(.has-map) .farm-map-hint-list {
  display: block;
}

.farm-map-canvas {
  border: 1px solid var(--nav-border);
  border-radius: 16px;
  overflow: hidden;
  background: #E4DCC2;
  line-height: 0;
}

.farm-map-canvas svg {
  display: block;
  width: 100%;
  height: auto;
}

.farm-map-canvas svg text {
  pointer-events: none;
  user-select: none;
}

.map-loc {
  cursor: pointer;
  stroke-width: 2;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.map-loc:focus {
  outline: none;
}

.map-loc.status-in-use {
  fill: var(--map-in-use);
  stroke: var(--map-in-use-stroke);
}

.map-loc.status-planned {
  fill: url(#farm-map-stripes);
  stroke: var(--map-planned-stroke);
}

.farm-map-stripe-base {
  fill: var(--map-planned);
}

.farm-map-stripe {
  fill: var(--map-planned-stripe);
}

.map-loc.status-empty {
  fill: var(--map-empty);
  stroke: var(--map-empty-stroke);
  stroke-dasharray: 6 4;
}

.map-loc.is-hit {
  fill: var(--map-in-use);
  stroke: #24352A;
  stroke-width: 3;
  stroke-dasharray: none;
}

.map-loc.is-dim {
  fill: var(--map-dim);
  stroke: var(--map-empty-stroke);
  opacity: 0.55;
}

.map-loc:hover,
.map-loc:focus-visible {
  filter: brightness(1.06) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.map-loc.is-selected {
  stroke: var(--accent);
  stroke-width: 4;
  stroke-dasharray: none;
}

.is-placing .map-loc {
  cursor: copy;
}

.is-placing .map-loc.status-empty {
  stroke: var(--accent);
  stroke-width: 3;
}

.farm-map-badge {
  pointer-events: none;
}

.farm-map-badge rect {
  fill: #1C1A15;
}

.farm-map-badge text {
  fill: #FFFFFF;
  font: 700 12px Inter, system-ui, sans-serif;
}

.farm-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  margin-top: 0.6rem;
  font-size: 0.85rem;
}

.farm-map-legend > span {
  display: inline-flex;
  align-items: center;
}

.farm-map-swatch {
  display: inline-block;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-right: 0.45rem;
  border-radius: 4px;
  box-sizing: border-box;
}

.farm-map-swatch.status-in-use,
.farm-map-swatch.is-hit {
  background: var(--map-in-use);
  border: 2px solid var(--map-in-use-stroke);
}

.farm-map-swatch.status-planned {
  background: repeating-linear-gradient(135deg, var(--map-planned-stripe) 0 3px, var(--map-planned) 3px 6px);
  border: 2px solid var(--map-planned-stroke);
}

.farm-map-swatch.status-empty {
  background: var(--map-empty);
  border: 2px dashed var(--map-empty-stroke);
}

.farm-map-swatch.is-dim {
  background: var(--map-dim);
  border: 2px solid var(--map-empty-stroke);
  opacity: 0.6;
}

/* Hover tooltip: dark with white text, like the info tips. Shared by the
   farm map and the Analytics charts (.chart-tooltip). */
.farm-map-tooltip,
.chart-tooltip {
  position: fixed;
  z-index: 80;
  max-width: 260px;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: #1C1A15;
  color: #FFFFFF;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  font-size: 0.8rem;
  line-height: 1.4;
  pointer-events: none;
}

.farm-map-tooltip-title {
  font-weight: 700;
  font-size: 0.85rem;
}

.farm-map-tooltip-sub {
  opacity: 0.7;
  margin-bottom: 0.3rem;
}

.farm-map-tooltip-hint {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  opacity: 0.65;
}

/* Side panel: Plan tray + location details. */
.farm-map-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: calc(var(--header-height, 64px) + 1rem);
}

.farm-map-tray,
.farm-map-details-panel {
  padding: 1rem 1.1rem;
  border: 1px solid var(--nav-border);
  border-radius: 16px;
  background: var(--card-bg);
}

.farm-map-tray h2,
.farm-map-details h2 {
  margin: 0;
  font-size: 1.15rem;
}

.farm-map-tray h3 {
  margin: 1rem 0 0.25rem;
  font-size: 0.95rem;
}

.farm-map-tray-hint {
  margin: 0.2rem 0 0.5rem;
  font-size: 0.82rem;
}

.farm-map-tray-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

.farm-map-tray-item + .farm-map-tray-item {
  border-top: 1px solid var(--nav-border);
}

.farm-map-place-btn.is-placing {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.farm-map-details-hint {
  margin: 0;
  font-size: 0.88rem;
}

.farm-map-details-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.6rem;
  margin-bottom: 0.5rem;
}

.farm-map-details-sub {
  flex-basis: 100%;
  font-size: 0.85rem;
}

.farm-map-status-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.farm-map-status-chip.status-in-use {
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
}

.farm-map-status-chip.status-planned {
  background: var(--badge-bg);
  color: var(--badge-text);
}

.farm-map-status-chip.status-empty {
  background: var(--tab-bg);
  color: var(--text-secondary);
}

/* Plot details (option "A"): small uppercase section labels, each lot or
   proposed growout a little card (name + stage, crop · code, then Move… and
   Open lot), a dashed "+ Plan next year here" row, past seasons below. */
.farm-map-label {
  margin: 1rem 0 0.45rem;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.farm-map-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.farm-map-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--nav-border);
  border-radius: 12px;
}

.farm-map-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 500;
}

.farm-map-item-top .badge {
  margin-top: 0;
  flex-shrink: 0;
}

.farm-map-item-sub {
  font-size: 0.82rem;
}

.farm-map-item-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.farm-map-item-action {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.farm-map-item-action svg {
  width: 13px;
  height: 13px;
}

.farm-map-item-action:hover,
.farm-map-item-action.is-accent {
  color: var(--accent);
}

/* "Move…" opens under the link, left-aligned; long farms scroll. */
.farm-map-move .farm-map-move-menu {
  left: 0;
  right: auto;
  max-height: 260px;
  overflow-y: auto;
}

.farm-map-move-menu-label {
  padding: 0.3rem 0.75rem 0.35rem;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.farm-map-plan-next {
  display: block;
  margin-top: 0.5rem;
  padding: 0.55rem;
  border: 1px dashed var(--card-border-strong);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.farm-map-plan-next:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.farm-map-none {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
}

.farm-map-place-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.farm-map-history {
  font-size: 0.88rem;
}

.farm-map-season {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr);
  gap: 0.5rem;
  padding: 0.3rem 0;
}

.farm-map-season + .farm-map-season {
  border-top: 1px solid var(--nav-border);
}

.farm-map-season-year {
  font-weight: 600;
}

/* Cards: phones always, desktop List view. */
.farm-map-group + .farm-map-group {
  margin-top: 1.25rem;
}

.farm-map-group-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.farm-map-card {
  border: 1px solid var(--nav-border);
  border-radius: 12px;
  background: var(--card-bg);
}

.farm-map-card + .farm-map-card {
  margin-top: 0.5rem;
}

.farm-map-card.is-dim {
  opacity: 0.6;
}

.farm-map-card.is-hit {
  border-color: var(--map-in-use-stroke);
}

.farm-map-card > summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  list-style: none;
}

.farm-map-card > summary::-webkit-details-marker {
  display: none;
}

.farm-map-card > summary .farm-map-swatch {
  margin-right: 0;
}

.farm-map-card > summary .chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform 0.15s ease;
}

.farm-map-card[open] > summary .chevron {
  transform: rotate(180deg);
}

.farm-map-card-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.farm-map-card-name {
  font-weight: 600;
}

.farm-map-card-meta {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 0.82rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.farm-map-card-status {
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
}

.farm-map-year-chip {
  display: inline-block;
  margin-right: 0.25rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: #1C1A15;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 600;
}

.farm-map-card-body {
  padding: 0 0.9rem 0.9rem;
}

.farm-map-card .farm-map-details-head {
  display: none;
}

.farm-map-card .farm-map-details > .farm-map-label:first-of-type {
  margin-top: 0;
}

.farm-map-card-children {
  margin-top: 0.75rem;
}

.farm-map-empty {
  max-width: 520px;
  margin: 0 auto;
}

.farm-map-empty-icon {
  width: 44px;
  height: 44px;
  color: var(--text-secondary);
}

.farm-map-empty h2 {
  margin: 0.75rem 0 0.5rem;
  color: var(--text-primary);
}

.farm-map-empty p {
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.farm-map-empty-actions {
  justify-content: center;
  gap: 0.5rem;
}

.location-badge-kind {
  font-weight: 400;
  opacity: 0.75;
  font-size: 0.75rem;
}

.location-add-form {
  margin-top: 0.75rem;
}

@media (max-width: 899px) {
  /* Phones: cards only, with the Plan tray above them. */
  .farm-map-layout,
  .farm-map-layout.has-map,
  .farm-map-layout.with-tray {
    grid-template-columns: minmax(0, 1fr);
  }

  .farm-map-map,
  .farm-map-details-panel,
  .farm-map-place-btn,
  .farm-map-hint-map {
    display: none !important;
  }

  .farm-map-layout.has-map .farm-map-list,
  .farm-map-hint-list {
    display: block;
  }

  .farm-map-layout:not(.with-tray) .farm-map-panel {
    display: none;
  }

  .farm-map-panel {
    position: static;
    order: -1;
  }

  .farm-map-search {
    flex-basis: 100%;
    margin-left: 0;
  }
}

@media (max-width: 899px) {
  /* Phones reach the Farm map from the More sheet; keep the top bar short. */
  #nav-farm-map-icon .header-icon-link {
    display: none;
  }
}

/* Farm map's Map/List toggle sits right after the year picker (the shared
   .catalog-view-controls is pinned to the filter sidebar's edge, which this
   page doesn't have). Desktop only: phones always get the cards. */
.farm-map-view-toggle {
  display: none;
  gap: 0.15rem;
}

@media (min-width: 900px) {
  .farm-map-view-toggle {
    display: flex;
  }
}

/* Farm map "Where has…" search: a pick-from-matches dropdown (reuses the
   header search's .quick-search-results), then what's being shown + Clear. */
.farm-map-search {
  flex-wrap: wrap;
  max-width: none;
}

.farm-map-search-box {
  flex: 0 1 380px;
  min-width: 0;
}

.farm-map-search-box input[type="search"] {
  width: 100%;
}

.farm-map-search-current {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.farm-map-search-answer {
  margin: 0.25rem 0 0.5rem;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
  font-size: 0.88rem;
  font-weight: 600;
}


/* ------------------------------------------------------------------
   Analytics (catalog/analytics.html, catalog/analytics.py)
   Chart series colors: five earthy hues, assigned in fixed order per
   chart, validated for color-blind separation in each theme (the dark
   steps are chosen for the Loam surface, not a flip of the light ones).
   ------------------------------------------------------------------ */
.analytics {
  --series-1: #2E7D32;
  --series-2: #E8913A;
  --series-3: #2F64B8;
  --series-4: #D873A8;
  --series-5: #8C6D00;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 2rem;
}

html[data-theme="loam"] .analytics {
  --series-1: #2F7F36;
  --series-2: #DA8632;
  --series-3: #6A93E0;
  --series-4: #D873AC;
  --series-5: #B3951A;
}

.series-1 { background: var(--series-1); }
.series-2 { background: var(--series-2); }
.series-3 { background: var(--series-3); }
.series-4 { background: var(--series-4); }
.series-5 { background: var(--series-5); }

.analytics-filter-hint {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
}

.analytics-clear {
  align-self: flex-start;
}

.analytics-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.analytics-tile,
.analytics-card {
  background: var(--card-bg);
  border: 1px solid var(--nav-border);
  border-radius: 14px;
}

.analytics-tile {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
}

.analytics-tile-label,
.analytics-tile-note {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.analytics-tile-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1.15;
}

.analytics-section-title {
  margin: 0.75rem 0 0;
  font-size: 1.2rem;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.analytics-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  padding: 1rem 1.2rem 1.15rem;
}

.analytics-card-wide {
  grid-column: 1 / -1;
}

.analytics-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.analytics-card-head h3 {
  margin: 0;
  font-size: 1rem;
}

.analytics-card-head p {
  margin: 0.15rem 0 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.analytics-empty {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.analytics-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  font-size: 0.8rem;
}

.analytics-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.analytics-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* Horizontal bars: label | bar | value. Thin bars, 4px rounded data end,
   2px gap between segments of a split bar. */
.analytics-bars {
  display: grid;
  grid-template-columns: minmax(80px, max-content) minmax(0, 1fr) 2.2rem;
  gap: 0.45rem 0.7rem;
  align-items: center;
  font-size: 0.85rem;
}

.analytics-bar-label {
  overflow: hidden;
  max-width: 11rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.analytics-bar-track {
  display: flex;
  height: 14px;
}

.analytics-bar {
  display: flex;
  gap: 2px;
  min-width: 3px;
  height: 100%;
  overflow: hidden;
  border-radius: 0 4px 4px 0;
  cursor: default;
}

.analytics-bar:focus-visible,
.analytics-col:focus-visible,
.analytics-stack > span:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.analytics-bar-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* One stacked bar (catalog coverage). */
.analytics-stack {
  display: flex;
  gap: 2px;
  height: 26px;
  overflow: hidden;
  border-radius: 4px;
}

.analytics-legend-values strong {
  margin-left: 0.15rem;
}

/* Stacked columns with a recessive axis and gridlines. */
.analytics-columns {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.5rem;
}

.analytics-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 180px;
  margin-top: -0.45rem;
  color: var(--text-secondary);
  font-size: 0.72rem;
  text-align: right;
}

.analytics-plot {
  position: relative;
  min-width: 0;
}

.analytics-gridlines {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 180px;
  pointer-events: none;
}

.analytics-gridlines span {
  border-top: 1px solid var(--nav-border);
}

.analytics-cols {
  position: relative;
  display: grid;
  gap: 1rem;
  height: 180px;
  padding: 0 0.5rem;
}

.analytics-col-slot {
  display: flex;
  align-items: flex-end;
  height: 100%;
}

.analytics-col {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  width: 100%;
  min-height: 0;
  cursor: default;
}

.analytics-col > span[class^="series-"]:last-of-type {
  border-radius: 4px 4px 0 0;
}

.analytics-col-value {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

.analytics-col-labels {
  display: grid;
  gap: 1rem;
  padding: 0.4rem 0.5rem 0;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-align: center;
}

/* Summary: the season start to shelf. */
.analytics-steps {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.analytics-step {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  background: var(--tab-bg);
}

.analytics-step.is-shelf {
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
}

.analytics-step-label,
.analytics-step-note {
  font-size: 0.75rem;
}

.analytics-step-note {
  color: var(--text-secondary);
}

.analytics-step-value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.1;
}

.analytics-step-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--nav-border);
}

.analytics-step-bar span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--series-1);
}

@media (max-width: 899px) {
  .analytics-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .analytics-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Phones reach Analytics from the More sheet. */
  .header-icon-desktop {
    display: none;
  }
}

/* Analytics Overview / Season tabs: a two-way toggle in the same pill shape
   as the year picker beside it; full width on phones. */
.analytics-tabbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
}

.analytics-tabs {
  display: inline-flex;
  padding: 0.2rem;
  border: 1px solid var(--nav-border);
  border-radius: 999px;
  background: var(--card-bg);
}

.analytics-tab {
  min-height: 2.25rem;
  padding: 0 1.1rem;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.analytics-tab.is-active {
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
}

.analytics-tab-note {
  font-size: 0.85rem;
}

@media (max-width: 899px) {
  .analytics-tabs {
    display: flex;
    width: 100%;
  }

  .analytics-tab {
    flex: 1;
    min-height: 2.75rem;
  }
}

/* Analytics drill-down: marks with data-drill are clickable (pointer +
   a lift on hover); the card's "Details" opens the whole breakdown. */
.analytics [data-drill] {
  cursor: pointer;
}

.analytics .analytics-bar[data-drill]:hover,
.analytics .analytics-col[data-drill]:hover,
.analytics-stack > span[data-drill]:hover,
.analytics .analytics-bar > span[data-drill]:hover,
.analytics .analytics-col > span[data-drill]:hover {
  filter: brightness(1.12);
}

.analytics-card-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.analytics-details-link {
  padding: 0.35rem 0.6rem;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.analytics-details-link:hover,
.analytics-details-link:focus-visible {
  background: var(--tab-bg);
  color: var(--text-primary);
}

/* Lifecycle steps are buttons now (each opens its lots). */
.analytics-steps > li {
  display: flex;
}

.analytics-steps > li.is-divider {
  margin-right: 0.6rem;
}

button.analytics-step {
  width: 100%;
  border: 1px solid transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.analytics-step:hover:not(:disabled),
button.analytics-step:focus-visible {
  border-color: var(--nav-border);
  filter: brightness(0.98);
}

button.analytics-step:disabled {
  cursor: default;
  opacity: 0.7;
}

/* The popup's table of records. */
.analytics-details .analytics-details-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: -0.5rem 0 1rem;
  font-size: 0.85rem;
}

.analytics-details-group {
  margin: 1.1rem 0 0.4rem;
  font-size: 0.95rem;
}

.analytics-details-group:first-child {
  margin-top: 0;
}

.analytics-details-table-wrap {
  overflow-x: auto;
}

/* Fixed layout + the same <colgroup> widths in every group's table
   (analytics.KIND_WIDTHS), so columns line up from group to group. The
   wrap scrolls sideways on phones rather than squeezing the columns. */
.analytics-details-table {
  width: 100%;
  min-width: 440px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.analytics-details-table th {
  padding: 0.35rem 0.6rem 0.35rem 0;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.analytics-details-table td {
  padding: 0.45rem 0.6rem 0.45rem 0;
  border-top: 1px solid var(--nav-border);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.analytics-details-more {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
}

@media (max-width: 899px) {
  .analytics-steps > li.is-divider {
    margin-right: 0;
  }
}

/* "Try it" checklist: step titles link to the spot (tour-spotlight.js). */
.tour-step-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--nav-border);
  text-underline-offset: 3px;
}

.tour-step-link:hover,
.tour-step-link:focus-visible {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* The highlighted element: a pulsing accent ring, no layout change. */
.tour-spotlight {
  position: relative;
  z-index: 5;
  border-radius: 10px;
  outline: 3px solid var(--accent);
  outline-offset: 4px;
  animation: tour-spotlight-pulse 1.6s ease-in-out infinite;
}

@keyframes tour-spotlight-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(182, 117, 44, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(182, 117, 44, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .tour-spotlight {
    animation: none;
  }
}

/* Its how-to, beside it: the same dark bubble as the info tips. */
.tour-callout {
  position: fixed;
  z-index: 75;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  width: min(320px, calc(100vw - 16px));
  padding: 0.8rem 0.9rem;
  border-radius: 10px;
  background: #1C1A15;
  color: #FFFFFF;
  box-shadow: var(--shadow-float);
  font-size: 0.85rem;
  line-height: 1.45;
}

.tour-callout p {
  align-self: stretch;
  margin: 0;
}

/* Phones and tablets (below the desktop navbar): the header is just the logo,
   so the search field is always open beside it, magnifier inset as on every
   search input; no toggle or close buttons. (It used to be a magnifier button
   that laid the field over the header, back when the org name took the room.) */
@media (max-width: 899px) {
  /* Lift the header (and its results dropdown) above the sticky
     "View / filter" tab (.mobile-tools, z-index 30) just below it. */
  .header {
    z-index: 40;
  }

  .header-brand-row {
    flex: 0 0 auto;
  }

  .header-right {
    flex: 1 1 auto;
    min-width: 0;
  }

  .header-search {
    flex: 1 1 auto;
    min-width: 0;
  }

  .header-search .header-search-toggle,
  .header-search .header-search-close {
    display: none;
  }

  .header-search-field,
  .header-search.is-open .header-search-field {
    display: flex;
    flex: 1 1 auto;
    position: static;
    min-width: 0;
    padding: 0;
    background: none;
  }

  .header-search-box {
    max-width: none;
    margin: 0;
  }
}

/* ------------------------------------------------------------------
   Staff dashboard (templates/staff/, accounts/staff.py). Built from the
   Analytics tiles/cards; these are the few staff-only pieces.
   ------------------------------------------------------------------ */
.staff-badge {
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--text-primary);
  color: var(--bg);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

@media (max-width: 899px) {
  .staff-badge {
    margin-left: 0.4rem;
  }
}

.staff-header-link {
  color: var(--header-sub);
  font-size: 0.9rem;
  white-space: nowrap;
}

.staff-header-link:hover {
  color: var(--accent);
}

@media (max-width: 899px) {
  .staff-header-link {
    display: none;
  }
}

.staff-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (min-width: 900px) {
  .staff-columns {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }
}

a.staff-tile-messages {
  color: var(--accent-green-text);
  background: var(--accent-green-bg);
  border-color: var(--accent-green-border);
  text-decoration: none;
}

a.staff-tile-messages .analytics-tile-label,
a.staff-tile-messages .analytics-tile-note {
  color: inherit;
}

.staff-tile-small {
  font-size: 1.25rem;
  line-height: 1.6;
}

.staff-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.4rem;
  border-radius: 999px;
  background: var(--accent);
  vertical-align: 2px;
}

.staff-quiet {
  color: var(--danger);
}

.staff-demo-badge {
  margin: 0 0 0 0.35rem;
  font-size: 0.7rem;
  vertical-align: 2px;
}

/* Tables (organizations, users). */
.staff-table-wrap {
  overflow-x: auto;
}

.staff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.staff-table th {
  padding: 0.3rem 0.75rem 0.5rem 0;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.staff-table td {
  padding: 0.6rem 0.75rem 0.6rem 0;
  border-top: 1px solid var(--nav-border);
}

.staff-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Organizations as cards on phones. */
.staff-org-cards {
  display: flex;
  flex-direction: column;
}

.staff-org-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--nav-border);
  color: inherit;
  font-size: 0.85rem;
  text-decoration: none;
}

.staff-org-card:first-child {
  border-top: none;
}

.staff-org-card-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}

/* Message lines (dashboard, organization page). */
.staff-message-line {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--nav-border);
  color: inherit;
  text-decoration: none;
}

.staff-message-line:hover .staff-message-text {
  color: var(--accent);
}

.staff-message-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.staff-message-meta strong {
  color: var(--text-primary);
}

.staff-message-text {
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Sandboxes per day. */
.staff-sandbox-chart {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 0.5rem;
  height: 140px;
}

.staff-sandbox-day {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  gap: 0.3rem;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.7rem;
  text-align: center;
}

.staff-sandbox-bar {
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--series-1);
}

/* Messages inbox: list | reading pane (desktop); one at a time on phones. */
.staff-inbox {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (min-width: 900px) {
  .staff-inbox {
    grid-template-columns: 380px minmax(0, 1fr);
  }
}

@media (max-width: 899px) {
  .staff-inbox:not(.is-picked) .staff-inbox-pane,
  .staff-inbox.is-picked .staff-inbox-list,
  .staff-messages-title.is-picked {
    display: none;
  }
}

.staff-inbox-list {
  gap: 0;
  padding: 0.6rem 0.6rem 0.4rem;
}

.staff-inbox-filters {
  display: flex;
  gap: 0.35rem;
  padding: 0.2rem 0.4rem 0.6rem;
}

.staff-filter {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.staff-filter.is-active {
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
}

.staff-inbox-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.7rem;
  border-top: 1px solid var(--nav-border);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}

.staff-inbox-row:hover {
  background: var(--tab-bg);
}

.staff-inbox-row.is-selected {
  background: var(--tab-bg);
  box-shadow: inset 3px 0 0 var(--accent);
}

.staff-inbox-who {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.staff-inbox-preview {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.staff-back {
  align-self: flex-start;
}

.staff-pane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.staff-pane-head h2 {
  margin: 0;
  font-size: 1.4rem;
}

.staff-pane-head p {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
}

.staff-pane-actions {
  gap: 0.5rem;
}

.staff-pane-actions form {
  margin: 0;
}

.staff-pane-message {
  font-size: 1rem;
  line-height: 1.6;
}

.staff-pane-message p {
  margin: 0 0 0.6rem;
}

.staff-pane-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.4rem 1rem;
  margin: 0;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: var(--tab-bg);
  font-size: 0.82rem;
}

.staff-pane-facts dt {
  color: var(--text-secondary);
}

.staff-pane-facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.staff-resolved {
  color: var(--accent-green-text);
  font-weight: 600;
}

.staff-note .field {
  margin-bottom: 0.5rem;
}

/* "Done by" on lot-record forms (catalog/_done_by_field.html). */
.done-by-empty {
  margin: 0;
  font-size: 0.9rem;
}

.done-by-add {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.done-by-add input {
  flex: 1 1 auto;
  min-width: 0;
}

.done-by-hint {
  margin-top: 0.4rem;
  font-size: 0.8rem;
}

/* Navbar at tablet widths (templates/_nav_more.html, option "A"). The bar
   gives up room in steps instead of letting tabs run into the icons:
   below 1280px the org name gives way to the logo alone; from 900px to
   1099px Planning / Growers / Breeding and the Calendar / Farm map /
   Analytics icons fold into a "More" tab after Catalog and Lots. Phones
   (< 900px) keep the bottom bar and its More sheet. */
.header .brand {
  max-width: 260px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nav-more {
  display: none;
}

.nav-more-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.45rem 0.9rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--header-sub);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-more-trigger svg {
  width: 14px;
  height: 14px;
}

.nav-more-trigger:hover,
.nav-more-trigger[aria-expanded="true"] {
  background: var(--tab-bg);
  color: var(--header-text);
}

.nav-more-trigger.active {
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
  font-weight: 600;
}

/* The menu opens under the tab, left-aligned (the shared .actions-menu
   is right-aligned for the account menu). Its rows sit inside <nav>, so
   undo the tab styling .header nav a gives every link there. */
.nav-more .actions-menu {
  left: 0;
  right: auto;
}

.header nav .nav-more .actions-menu-row {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
}

.header nav .nav-more .actions-menu-row:hover {
  background: var(--tab-bg);
}

.header nav .nav-more .actions-menu-row.is-current {
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
}

.header nav .nav-more .actions-menu-row.is-current .icon {
  color: inherit;
}

@media (min-width: 900px) and (max-width: 1279px) {
  .header .brand {
    display: none;
  }
}

@media (max-width: 1099px) {
  .header-icon-wide {
    display: none;
  }
}

@media (min-width: 900px) and (max-width: 1099px) {
  .header nav .nav-fold {
    display: none;
  }
  .nav-more {
    display: block;
  }
}

/* About popup (accounts/_about_modal.html): version, contact, What's new. */
.about-sheet {
  max-width: 560px;
}

.about-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.about-logo {
  display: block;
  width: 48px;
  height: 48px;
  padding: 6px;
  border-radius: 50%;
  border: 1px solid var(--card-border-strong);
  background: #f5f2ea;
  object-fit: contain;
  box-sizing: border-box;
  flex-shrink: 0;
}

.about-contact {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.35rem 1rem;
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--tab-bg);
  font-size: 0.9rem;
}

.about-contact dt {
  color: var(--text-secondary);
}

.about-contact dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.about-new-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

/* Newest first; older releases scroll inside the popup. */
.about-new {
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.about-release + .about-release {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--nav-border);
}

.about-release-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.about-release-version {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

.about-release ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.about-release li + li {
  margin-top: 0.3rem;
}

/* Full text of a cut-off value (static/js/truncate-tip.js): the dark
   .chart-tooltip, a little tighter for a single line. */
.truncate-tooltip {
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  font-family: Inter, system-ui, sans-serif;
}

/* Lot section headers (_lot_section_header.html): the title and its count
   as plain text ("12 records"). Also the Notes cards' "Notes · 4". */
.lot-section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  min-width: 0;
}

.lot-section-count {
  color: var(--text-secondary);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

/* "Notes · 4" (like "Photos · 2"): the count sits close after the heading. */
.variety-notes-head .notes-count {
  margin-left: -0.15rem;
}
