/* ==================
   SIDEBAR DESKTOP LAYOUT
   Opt-in dark theme + left sidebar nav, used by pages that set
   content_for(:sidebar_layout). Scoped entirely under .sb-root so it
   cannot leak into the existing light-theme desktop pages or mobile
   (mobile never renders .sb-root — see layouts/application.html.erb).
   Trials is the pilot page; more pages adopt this incrementally.
   ================== */

/* ---- Theme tokens -------------------------------------------------------
   Palette and fonts live on :root, deliberately separate from the .sb-root
   layout rules below, so a theme can be swapped without touching layout.
   Every rule in this file reads these variables — no raw hex in a rule
   unless it's genuinely theme-independent (e.g. pure-black overlays).

   To add a light theme later: define the same variable names under a
   [data-theme="light"] block (stub below) and set that attribute on <html>.
   Nothing else in this file needs to change.
   ------------------------------------------------------------------------ */

:root {
  --sb-bg:        #0d0f13;
  --sb-surface:   #12151b;
  --sb-surface-2: #171a20;
  --sb-surface-3: #20242d;  /* hover/raised: was hard-coded in many rules */
  --sb-border:    #22262f;
  --sb-border-2:  #2a2f3a;
  --sb-row-div:   #1b1e25;
  --sb-row-hover: #161a21;
  --sb-row-active: #2b2b2b;  /* selected row while a detail panel is open */
  --sb-badge-bg:  #1c2029;   /* location / neutral pills */
  --sb-text:      #e7e9ec;
  --sb-text-2:    #8b93a1;
  --sb-text-3:    #565d6b;
  --sb-text-bright: #f2f4f6;  /* code links — brighter than --sb-text */
  --sb-text-dim:  #d5d8dd;    /* primary cell text, dropdown items */
  --sb-green:     #0f7a52;
  --sb-accent:    #34d399;
  --sb-nav-hover: #191d24;
  --sb-input-bg:  #1a1e26;
  --sb-badge-plant: #1e3a5f;  /* plot-plant pill, distinct from plain plot */

  /* Semantic colours — used by score badges, status icons, flashes. */
  --sb-good:      #4ade80;
  --sb-warn:      #fbbf24;
  --sb-bad:       #f87171;
  --sb-info:      #7dd3fc;
  --sb-muted-fg:  #9ca3af;

  --sb-font:      'Manrope', sans-serif;
  --sb-mono:      'IBM Plex Mono', monospace;

  /* Colour-scheme hint drives native controls (scrollbars, date pickers). */
  --sb-color-scheme: dark;
}

/* Light theme stub — fill in and set data-theme="light" on <html> to use.
   Left commented so it can't affect anything until deliberately enabled.

:root[data-theme="light"] {
  --sb-bg: #ffffff; --sb-surface: #f7f8fa; --sb-surface-2: #eef0f3;
  ...
  --sb-color-scheme: light;
}
*/

.sb-root {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--sb-bg);
  color: var(--sb-text);
  font-family: var(--sb-font);
}

.sb-root a { color: var(--sb-accent); }
.sb-root a:hover { color: var(--sb-accent); text-decoration: underline; }

/* Dark scrollbars for every scroll container inside the sidebar theme
   (.sb-table-wrap, .sb-content, the detail panel). color-scheme drives
   Firefox + the native fallback; the ::-webkit rules style Chrome. */
.sb-root { color-scheme: var(--sb-color-scheme); scrollbar-color: var(--sb-border-2) transparent; }

.sb-root ::-webkit-scrollbar { width: 12px; height: 12px; }
.sb-root ::-webkit-scrollbar-track { background: transparent; }

.sb-root ::-webkit-scrollbar-thumb {
  background: var(--sb-border-2);
  border-radius: 999px;
  border: 3px solid var(--sb-surface);
}

.sb-root ::-webkit-scrollbar-thumb:hover { background: var(--sb-text-3); }
.sb-root ::-webkit-scrollbar-corner { background: transparent; }

/* ---- Sidebar ---- */

.sb-sidebar {
  width: 212px;
  flex-shrink: 0;
  background: var(--sb-surface);
  border-right: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
}

/* The lower padding used to clear the crop dropdown that sat here; with
   that removed the first nav item would butt up against the wordmark. */
.sb-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px 34px;
  text-decoration: none;
}

.sb-sidebar-logo-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--sb-green);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.sb-sidebar-logo-mark img { display: block; width: 16px; height: 16px; }

.sb-sidebar-wordmark { font-weight: 800; font-size: 15px; letter-spacing: .2px; color: var(--sb-text); }

.sb-root .sb-sidebar-crop, .sb-root .sb-sidebar-crop:focus {
  margin: 0 8px 16px;
  background: var(--sb-input-bg);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text);
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  padding: 6px 8px;
}

.sb-nav-item, .sb-root .sb-nav-item {
  display: flex;
  align-items: center;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 9px 10px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: var(--sb-text);
  text-decoration: none;
  gap: 8px;
}

.sb-root .sb-nav-item, .sb-root .sb-nav-item:hover { text-decoration: none; }
.sb-root .sb-nav-item:hover { background: var(--sb-nav-hover); color: var(--sb-text); }

.sb-nav-item.active { background: var(--sb-green); color: #fff; }
.sb-nav-item.active:hover { background: var(--sb-green); color: #fff; }

.sb-nav-badge {
  background: var(--sb-surface-3);
  color: var(--sb-text-2);
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 20px;
  padding: 1px 6px;
  margin-left: auto;
}

.sb-sidebar-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--sb-text-dim);
  padding: 10px 8px 0;
  border-top: 1px solid var(--sb-border);
}

.sb-sidebar-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--sb-border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--sb-text);
}

.sb-sidebar-user-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
}

/* ---- Main column ---- */

.sb-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; }

/* Seed Book wraps .sb-topbar/.sb-content in an extra data-controller="basket"
   div (for the Select/+Add-to-basket Stimulus controller) that .sb-main
   never expected as a direct child. Without flex passthrough here, that
   div isn't a flex item participating in .sb-main's column layout, so
   .sb-content's flex:1/min-height:0 has no flex context to size against —
   it grows to fit all rows instead of clipping, and the whole *page*
   scrolls instead of just .sb-table-wrap scrolling internally. */
.sb-main > [data-controller="basket"] {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.sb-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  height: 56px;
  background: var(--sb-surface);
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}

.sb-topbar-title { font-size: 14px; font-weight: 700; color: var(--sb-text); }
.sb-topbar-subtitle { font-size: 11.5px; color: var(--sb-text-2); }

.sb-topbar-attachments { display: flex; align-items: center; gap: 14px; margin-left: auto; flex-wrap: wrap; }

.sb-topbar-attachment-item { display: inline-flex; align-items: center; gap: 3px; }

.sb-topbar-attachment-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sb-text-2);
  text-decoration: underline;
  white-space: nowrap;
}

.sb-topbar-attachment-link:hover { color: var(--sb-accent); text-decoration: underline; }

.sb-topbar-attachment-remove {
  background: none;
  border: none;
  color: var(--sb-text-dim);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.sb-topbar-attachment-item:hover .sb-topbar-attachment-remove { opacity: 1; }
.sb-topbar-attachment-remove:hover { color: var(--sb-bad); }

.sb-topbar-actions { position: relative; margin-left: 14px; }

/* Pushes the actions to the far right of the topbar. Field List gets this
   for free from .sb-topbar-attachments' margin-left:auto; pages without an
   attachments block (Trials) need it explicitly. */
.sb-topbar-actions--end { margin-left: auto; }

.sb-btn-primary {
  background: var(--sb-green);
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sb-btn-primary:hover { color: #fff; opacity: .92; text-decoration: none; }
.sb-btn-primary:disabled, .sb-btn-primary:disabled:hover { opacity: .45; cursor: not-allowed; }
/* link_to buttons are <a>s, and `.sb-root a` / `.sb-root a:hover` (0,1,1 /
   0,2,1) beat the single-class rules above — leaving them accent-green with
   a hover underline while the <button>s beside them are white. Restate at
   anchor specificity so both kinds look identical. */
.sb-root a.sb-btn-primary, .sb-root a.sb-btn-primary:hover { color: #fff; text-decoration: none; }
.sb-root a.sb-btn-secondary, .sb-root a.sb-btn-secondary:hover { color: var(--sb-text); text-decoration: none; }
/* Toggled-on state of a green action button (Plant List "Assign keys" while
   assign mode is active): bright accent so it reads as "on", not merely green. */
.sb-btn-primary.btn-select-active, .sb-btn-primary.btn-select-active:hover,
.sb-root a.sb-btn-primary.btn-select-active, .sb-root a.sb-btn-primary.btn-select-active:hover { background: var(--sb-accent); color: #0b1f17; }

.sb-btn-secondary {
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text);
  font-size: 13px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sb-btn-secondary:hover { background: var(--sb-surface-3); color: var(--sb-text); text-decoration: none; }
.sb-btn-secondary.btn-select-active { background: var(--sb-green); border-color: var(--sb-green); color: #fff; }

.sb-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.45);
  min-width: 190px;
  padding: 6px;
  z-index: 40;
  display: none;
}

.sb-dropdown-menu.show { display: block; }

.sb-dropdown-item {
  font-size: 13px;
  font-weight: 600;
  color: var(--sb-text-dim);
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: block;
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.sb-dropdown-item:hover { background: var(--sb-surface-3); color: var(--sb-text-dim); text-decoration: none; }

/* Menu entries rendered as <a> lose to `.sb-root a { color: accent }` on
   specificity, so they'd come out green instead of muted. Needs the
   double-class form to win. */
.sb-root a.sb-dropdown-item { color: var(--sb-text-dim); text-decoration: none; }
.sb-root a.sb-dropdown-item:hover { color: var(--sb-text); text-decoration: none; }

/* ---- Page content ---- */

.sb-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 28px 24px; /* top was 24px; tightened 2026-08-23 so the toolbar sits closer to the topbar */
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
}

.sb-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(52,211,153,0.08);
  border: 1px solid rgba(52,211,153,0.25);
  color: var(--sb-accent);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.sb-banner-close { cursor: pointer; color: var(--sb-accent); opacity: .6; font-size: 16px; line-height: 1; background: none; border: none; }

/* ---- Toolbar ---- */

.sb-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; flex-shrink: 0; }

.sb-root .sb-input, .sb-root .sb-select {
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text);
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 8px;
  outline: none;
}

.sb-root .sb-input:focus, .sb-root .sb-select:focus { background: var(--sb-surface-2); border-color: var(--sb-green); }
.sb-root .sb-select { padding: 9px 10px; }
.sb-root .sb-input { width: 220px; }
.sb-root .sb-input::placeholder { color: var(--sb-text-2); }

.sb-root .search-wrap { position: relative; display: inline-flex; align-items: center; }
.sb-root .search-wrap .sb-input { padding-right: 26px; }
.sb-root .search-clear { color: var(--sb-text-3); }
.sb-root .search-clear:hover { color: var(--sb-text); background: none; }

.sb-toolbar-clear { color: var(--sb-text-3); font-size: 13px; cursor: pointer; background: none; border: none; }
.sb-toolbar-clear:hover { color: var(--sb-text-2); }

.sb-toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
/* Action button group (Plant List topbar: CSV / Update markers / Assign keys
   / Select) — a flex row with a button-sized gap. */
.sb-toolbar-actions { display: flex; align-items: center; gap: 10px; }
/* Cycling filter button (Plant List Cross / Seeded): label = current state,
   click = next state. Tight padding and no min-width to save toolbar room
   (the button resizes to its label); green text marks a non-default state.
   Double-class form
   because `.sb-root a` would otherwise win the colour. */
.sb-cycle-btn { padding: 9px 10px; text-align: center; justify-content: center; white-space: nowrap; }
/* Default state reads in plain white (not the slightly-grey --sb-text), so
   the green "set" state is an unmistakable contrast. */
.sb-root a.sb-cycle-btn, .sb-root a.sb-cycle-btn:hover { color: #fff; }
/* Set state: same bright accent green as the programs/categories dropdown's
   .has-selection — text only, the border stays the normal button border. */
.sb-root a.sb-cycle-btn--set, .sb-root a.sb-cycle-btn--set:hover { color: var(--sb-accent); text-decoration: none; }
.sb-toolbar-count { font-size: 13px; color: var(--sb-text-2); }

.sb-view-switch { display: flex; background: var(--sb-surface-2); border: 1px solid var(--sb-border-2); border-radius: 8px; padding: 3px; gap: 2px; }

.sb-view-switch-item, .sb-root .sb-view-switch-item {
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--sb-text);
  text-decoration: none;
}

.sb-root .sb-view-switch-item, .sb-root .sb-view-switch-item:hover { text-decoration: none; }
.sb-root .sb-view-switch-item:hover { color: var(--sb-text); }
.sb-view-switch-item.active { background: var(--sb-green); color: #fff; }
.sb-view-switch-item.active:hover { color: #fff; }

/* Standalone pill (not grouped in a .sb-view-switch box) — needs its own
   background/border/padding since it has no container to inherit from. */
.sb-view-switch-item--solo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
  padding: 8px 14px;
}
.sb-view-switch-item--solo.active { border-color: var(--sb-green); }

/* ---- Table ---- */

.sb-table-wrap {
  border: 1px solid var(--sb-border);
  border-radius: 10px;
  background: var(--sb-surface);
  min-width: 1080px;
  flex: 1;
  min-height: 240px;
  overflow: auto;
}

/* tabindex="0" makes the table keyboard-scrollable (arrows/PageDown/Home/
   End/Space) since a plain overflow:auto div is never focusable on its
   own — suppress the default focus ring, which would otherwise outline
   the whole table oddly against the dark theme. */
.sb-table-wrap:focus { outline: none; }
.sb-table-wrap:focus-visible { outline: 2px solid var(--sb-green); outline-offset: -2px; }

.sb-table { width: 100%; border-collapse: collapse; table-layout: fixed; }

.sb-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 16px;
  background: var(--sb-surface-2);
  border-bottom: 1px solid var(--sb-border);
  font-size: 11px;
  font-weight: 700;
  color: var(--sb-text-2);
  letter-spacing: .5px;
  text-transform: uppercase;
  text-align: left;
}

.sb-table thead th:first-child { border-top-left-radius: 9px; }
.sb-table thead th:last-child { border-top-right-radius: 9px; }

.sb-table th, .sb-table td { border-left: none; border-right: none; }

.sb-table tbody td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--sb-row-div);
  border-top: none;
  font-size: 13.5px;
  vertical-align: middle;
  color: var(--sb-text);
}

.sb-table tbody tr[data-href] { cursor: pointer; }
.sb-table tbody tr:hover td { background: var(--sb-row-hover); }
.sb-table tbody tr.sb-row-active td { background: var(--sb-row-active); }
.sb-table tbody tr.sb-row-active td:first-child { box-shadow: inset 2px 0 0 var(--sb-text-2); }

.sb-plot-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: var(--sb-green);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* Dark blue variant for Plot-Plant badges (Plant List, Photos) — visually
   distinct from Field List's plain Plot badge (stays green), so it's
   immediately clear whether a pill refers to a plot or a plot-plant. */
.sb-plot-badge--plant { background: var(--sb-badge-plant); }

.sb-code-link { font-family: var(--sb-mono); font-size: 14.5px; font-weight: 600; color: var(--sb-text-bright); }

/* Plant number on Photos cards (e.g. "#6") — same mono font/size as the
   seedkey code link, colored to match the blue plot-plant pill
   (.sb-plot-badge--plant). Font-size set explicitly since it'd otherwise
   inherit .sb-photo-seedkey-inline's smaller 11.5px instead of matching
   .sb-code-link's 14.5px. */
.sb-plant-no { font-family: var(--sb-mono); font-weight: 600; font-size: 14.5px; color: var(--sb-info); margin-right: 5px; }

/* Generation (e.g. "BC2F7") next to plant#/seedkey — same size as the
   seedkey/plant#, slightly dimmer since it's secondary info. */
.sb-photo-generation { font-size: 14.5px; color: var(--sb-text); margin-left: 3px; }

/* Seedkey link on plot-plant (Plant List sourced) Photos cards — blue to
   match the plot-plant pill, instead of the default near-white. */
.sb-root .sb-code-link.sb-code-link--plant { color: var(--sb-info); }
.sb-root .sb-code-link.sb-code-link--plant:hover { color: var(--sb-accent); }
.sb-root .sb-code-link { text-decoration: none; }
.sb-root .sb-code-link:hover { text-decoration: underline; color: var(--sb-accent); }

.sb-cell-primary { font-size: 12.5px; font-weight: 600; color: var(--sb-text-dim); }
.sb-cell-tag { font-size: 10px; font-weight: 700; color: var(--sb-text-3); letter-spacing: .3px; margin-top: 2px; }
.sb-cell-parents { font-family: var(--sb-mono); font-size: 13px; color: var(--sb-text-2); }
.sb-cell-plotplant { font-family: var(--sb-mono); font-size: 11px; color: var(--sb-text-3); margin-top: 2px; }
/* Basket Markers cell: the source plant's markers under the seed's own, with
   a tiny muted "plant" label so the two pill rows can't be confused. */
.basket-plant-markers { margin-top: 3px; display: flex; align-items: baseline; gap: 5px; }
.basket-plant-markers-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sb-text-3);
  flex: 0 0 auto;
}
.sb-cell-parent-tag { font-size: 10.5px; color: var(--sb-text-dim); font-weight: 600; margin-top: 2px; }
.sb-cell-muted { color: var(--sb-text-3); font-size: 12.5px; }

.sb-location-badge {
  background: var(--sb-badge-bg);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text-2);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
}

/* ---- Modal (Entries / Field info) ---- */

.sb-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.sb-modal-backdrop.show { display: flex; }

.sb-modal {
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
  border-radius: 14px;
  padding: 24px;
  width: 420px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}

.sb-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.sb-modal-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--sb-text); }
.sb-modal-close { cursor: pointer; color: var(--sb-text-2); font-size: 18px; background: none; border: none; }

.sb-modal-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--sb-text);
  letter-spacing: .4px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.sb-modal-radio-row { display: flex; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.sb-modal-radio-row label { display: flex; align-items: center; gap: 7px; font-size: 13.5px; cursor: pointer; color: var(--sb-text); }

.sb-modal-file {
  width: 100%;
  background: var(--sb-bg);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text-2);
  font-size: 12.5px;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 18px;
  box-sizing: border-box;
}

.sb-modal-submit { width: 100%; margin-bottom: 12px; }
.sb-modal-footer-link { text-align: center; font-size: 12.5px; }

/* ==================
   DROPDOWNS (single definition for all of them)
   Every filter/select in the sidebar theme is a <details class="program-
   dropdown"> with a .program-dropdown-summary trigger and a panel of
   checkbox (multi) or radio (single) options — used for crop, program,
   category, location, lab code and the per-row Lab picker.

   Native <select> is deliberately avoided: an open one is drawn by the
   OS, so its hover highlight stays bright blue whatever the CSS says.

   Two sizes, sharing everything else:
     (default)          toolbar filters
     .sb-row-dropdown   compact, matches .inline-input inside table rows
   ================== */

/* Type-to-filter combobox — a plain text input plus a filtered suggestion
   list. Used where the option list is too long to scroll comfortably and
   free text must stay allowed (the Seedbook form's Program). Unlike
   .program-dropdown there's no hidden field: the visible input carries the
   form name, so it submits whether the value was typed or picked. */
.sb-root .sb-combo { position: relative; }

.sb-root .sb-combo-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0,0,0,.45);
}

.sb-root .sb-combo-panel[hidden] { display: none; }

.sb-root .sb-combo-option {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--sb-text);
  font: inherit;
  font-size: 13px;
  text-align: left;
}

/* Keyboard highlight (↑/↓) and hover share one look, so the active row
   reads the same however the user got there. */
.sb-root .sb-combo-option:hover,
.sb-root .sb-combo-option.is-active { background: var(--sb-surface-3); }
.sb-root .sb-combo-option[hidden] { display: none; }

.sb-root .sb-combo-empty {
  margin: 0;
  padding: 7px 10px;
  color: var(--sb-text-3);
  font-size: 13px;
}
.sb-root .sb-combo-empty[hidden] { display: none; }

.sb-root .program-dropdown-summary {
  border: 1px solid var(--sb-border-2);
  border-radius: 6px;
  background: var(--sb-surface-2);
  color: var(--sb-text);
  max-width: none;
  /* Right padding clears the ::after chevron from forms.css. */
  padding: 9px 28px 9px 10px;
  font-size: 13px;
  font-family: var(--sb-font);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  box-sizing: border-box;
}

.sb-root .program-dropdown-summary::after { color: var(--sb-text-3); }
.sb-root .program-dropdown[open] .program-dropdown-summary { border-color: var(--sb-green); }

/* Green text when the dropdown has an active selection, so it's obvious
   at a glance which filters are currently narrowing the list. */
.sb-root .program-dropdown-summary.has-selection { color: var(--sb-accent); }

.sb-root .program-dropdown-panel {
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0,0,0,.45);
  min-width: 140px;
}

.sb-root .program-dropdown-option { color: var(--sb-text); }
.sb-root .program-dropdown-option:hover { background: var(--sb-surface-3); }

/* Tick/dot in the theme's green rather than the browser default blue. */
.sb-root .program-dropdown-option input[type="checkbox"],
.sb-root .program-dropdown-option input[type="radio"] { accent-color: var(--sb-green); }

/* Single-select controls use radios so only one value can be picked, but a
   radio's round dot looks out of place next to the square checkboxes it
   sits beside. Draw them as squares to match — behaviour stays radio (one
   at a time), only the marker changes. Applies to the dropdown panels and
   to inline radio groups like the Basket's Append/Replace. */
.sb-root .program-dropdown-option input[type="radio"],
.sb-root .action-bar-check input[type="radio"],
.sb-root .sb-modal-radio-row input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border: 1px solid var(--sb-text-3);
  border-radius: 3px;
  background: var(--sb-bg);
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  margin: 0;
}

.sb-root .program-dropdown-option input[type="radio"]:checked,
.sb-root .action-bar-check input[type="radio"]:checked,
.sb-root .sb-modal-radio-row input[type="radio"]:checked {
  background: var(--sb-green);
  border-color: var(--sb-green);
}

/* Checkmark, drawn as a rotated L so it matches the native checkbox tick. */
.sb-root .program-dropdown-option input[type="radio"]:checked::after,
.sb-root .action-bar-check input[type="radio"]:checked::after,
.sb-root .sb-modal-radio-row input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 3px;
  height: 7px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* In-row variant: full-width and sized like the .inline-input fields
   beside it, so a table row reads as one set of controls. */
.sb-root .sb-row-dropdown { display: block; width: 100%; }

.sb-root .sb-row-dropdown .program-dropdown-summary {
  width: 100%;
  background: var(--sb-bg);
  padding: 3px 24px 3px 6px;
  font-size: 12.5px;
}

.sb-root .action-bar-check { color: var(--sb-text-2); }

/* ---- Dark overrides for Bootstrap pagination (Seed Book toolbar) ---- */

.sb-root .pagination .page-link {
  background: var(--sb-surface-2);
  border-color: var(--sb-border-2);
  color: var(--sb-text-2);
}

.sb-root .pagination .page-link:hover { background: var(--sb-surface-3); color: var(--sb-text); }

.sb-root .pagination .page-item.active .page-link {
  background-color: var(--sb-green);
  border-color: var(--sb-green);
  color: #fff;
}

.sb-root .pagination .page-item.disabled .page-link {
  background: var(--sb-surface-2);
  border-color: var(--sb-border-2);
  color: var(--sb-text-3);
}

/* ---- Dark overrides for shared attachment-pill / flash partials reused on this page ---- */

.sb-root .trial-attachment-item {
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text-2);
}

.sb-root .trial-attachment-link { color: var(--sb-text); }
.sb-root .flash-notice, .sb-root .flash-alert { margin-bottom: 16px; }

/* ==================
   FIELD DETAIL PANEL
   Desktop-only right-side slide-in panel opened from the Trials
   sidebar-layout table. Unlike the other .sb-modal-backdrop popups this
   one does NOT dim/block the table — it stays open and interactive
   (click a row or use ↑/↓) while the panel content swaps to match.
   .sb-field-modal-root resets the .sb-root app-shell flex/100vh rules
   (built for the Trials page) back to normal block flow, since this
   content sits inside a scrollable panel box, not a full viewport.
   Reuses the same dark tokens/fonts as Trials — see top of file.
   ================== */

.sb-field-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(840px, 100vw);
  background: var(--sb-surface);
  border-left: 1px solid var(--sb-border-2);
  box-shadow: -12px 0 32px rgba(0,0,0,.35);
  z-index: 500;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

.sb-field-panel.show { transform: translateX(0); }

/* The Plant Detail panel can be opened from *inside* the Field Detail panel
   (a selection card on the Plot detail), so it has to sit above it rather
   than share the same slot — closing it reveals the plot underneath again. */
.sb-plant-panel-stacked { z-index: 520; }

/* Same reasoning for the Seedbook panel: the Plot detail's SeedKey heading and
   its Plant/Selections cards all open it from inside the Field Detail panel.
   Sits above the plot but below Parents (540), which can be opened from here. */
#sb-seed-detail-panel { z-index: 530; }

/* Parents panel — always opened from inside the Field Detail or Plant panel,
   so it sits above both; closing it reveals whichever one is underneath. */
.sb-parents-panel {
  z-index: 540;
  width: min(560px, 100vw);
}

.sb-parents-panel .sb-parents-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--sb-border-2);
}

.sb-parents-panel .sb-parents-panel-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--sb-text);
}

/* "Parents of" stays bold with the title; the seedKey + name after it are
   lighter so they read as the subject rather than the label. Both retitle
   on drill-back. */
.sb-parents-panel .sb-parents-panel-of {
  font-weight: 700;
  color: var(--sb-text);
}

.sb-parents-panel .sb-parents-panel-key {
  font-weight: 500;
  color: var(--sb-text-2);
  margin-left: 0.4rem;
}

/* Bootstrap's .btn-close is a dark SVG — invert it for the dark surface. */
.sb-parents-panel .btn-close { filter: invert(1) grayscale(1) brightness(1.6); opacity: .7; }
.sb-parents-panel .btn-close:hover { opacity: 1; }

/* The reused mobile parent blocks assume a light sheet; re-tone for dark. */
.sb-parents-panel .pl-parent-block + .pl-parent-block { border-top-color: var(--sb-border-2); }
.sb-parents-panel .pl-parent-name-plain { color: var(--sb-text); }
.sb-parents-panel .pl-parent-seedkey { color: var(--sb-text-2); }
.sb-parents-panel .pl-parent-remarks { color: var(--sb-text-2); }
.sb-parents-panel .pl-parent-markers-label { color: var(--sb-text-2); }
.sb-parents-panel .pl-parent-label-strong { color: var(--sb-accent); }
.sb-parents-panel .none-text { color: var(--sb-text-2); }

/* The drill-back pill inside the panel, same blue treatment as the trigger. */
.sb-parents-panel .fl-parents-pill {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--sb-info);
  font-weight: 700;
  cursor: pointer;
}

.sb-parents-panel .fl-parents-pill:hover { text-decoration: underline; }

.sb-field-modal-box {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 28px;
}

.sb-field-modal-root {
  height: auto;
  min-height: 0;
  overflow: visible;
  display: block;
  background: transparent;
}

.sb-field-modal-root > div[style*="max-width"] { max-width: none !important; }

/* Force Photos above Notes/Selections/Markers (single column) regardless of
   panel width — the shared col-md-5/col-md-7 markup is also used by the
   standalone full-page view, where side-by-side at desktop width stays
   as-is; this override only applies inside the panel. */
.sb-field-modal-root .row.g-3 { display: flex; flex-direction: column; }
.sb-field-modal-root .row.g-3 > [class*="col-"] { width: 100%; max-width: 100%; flex: none; }

.sb-field-modal-root .detail-topbar { margin-bottom: 14px; }

.sb-field-modal-root .screen-title {
  color: var(--sb-text-2);
  font-family: var(--sb-font);
}

.sb-field-modal-root .btn-close { filter: invert(1) grayscale(1) brightness(1.6); opacity: 0.7; }
.sb-field-modal-root .btn-close:hover { opacity: 1; }

/* Field Detail *panel* only (not the standalone full-page view, which has
   no adjacent list to navigate via and still needs prev/next): the JS that
   injects this content into the Trials panel adds .sb-in-panel to the
   wrapper — see openFieldPanel()/loadFieldPanel() in trials/show.html.erb.
   Prev/next is redundant there since ↑/↓ on the table does the same job;
   Close moves to the right like a normal drawer close button. */
.sb-field-modal-root.sb-in-panel .detail-nav { display: none; }
.sb-field-modal-root.sb-in-panel .btn-close { order: 2; margin-left: auto; }

/* Prev/next on the detail topbars = Bootstrap's pagination component
   (shared/_detail_nav). Bootstrap paints it from --bs-pagination-* variables
   (default white bg, blue text), so theme the *variables* here rather than
   fighting its selectors; `.sb-root a.page-link` restates colour/underline at
   anchor specificity because `.sb-root a` would otherwise win. */
.sb-field-modal-root .detail-pager {
  --bs-pagination-bg: var(--sb-surface-2);
  --bs-pagination-color: #fff;
  --bs-pagination-border-color: var(--sb-border-2);
  --bs-pagination-hover-bg: var(--sb-green);
  --bs-pagination-hover-color: #fff;
  --bs-pagination-hover-border-color: var(--sb-green);
  --bs-pagination-focus-bg: var(--sb-surface-3);
  --bs-pagination-focus-color: #fff;
  --bs-pagination-focus-box-shadow: none;
  --bs-pagination-disabled-bg: var(--sb-surface);
  --bs-pagination-disabled-color: var(--sb-text-3);
  --bs-pagination-disabled-border-color: var(--sb-border);
  --bs-pagination-padding-x: 0.8rem;
  --bs-pagination-padding-y: 0.4rem;
  --bs-pagination-font-size: 15px;
  --bs-pagination-border-radius: 8px;
}
.sb-root .detail-pager a.page-link, .sb-root .detail-pager a.page-link:hover { color: var(--bs-pagination-color); text-decoration: none; }
.sb-root .detail-pager a.page-link:hover { color: var(--bs-pagination-hover-color); }
.sb-field-modal-root .detail-pager .page-link { font-weight: 700; line-height: 1.2; }
.sb-field-modal-root .detail-pager .page-link .bi { font-size: 14px; -webkit-text-stroke: 0.6px currentColor; }
/* The counter is a disabled "page" — but readable, not greyed out. */
.sb-field-modal-root .detail-pager-counter .page-link { color: var(--sb-text); font-size: 13px; font-weight: 600; min-width: 5.5rem; text-align: center; }
/* The close X grows to match the pager height. */
.sb-field-modal-root .detail-topbar .btn-close { width: 1.1em; height: 1.1em; font-size: 18px; opacity: .85; }
/* Legacy .nav-btn (mobile-era) dark overrides, kept for any remaining use. */
.sb-field-modal-root .nav-btn { color: var(--sb-text-2); border-color: var(--sb-border-2); }
.sb-field-modal-root .nav-btn:hover { background: var(--sb-surface-3); color: var(--sb-text); }
.sb-field-modal-root .nav-btn--disabled { color: #444; border-color: var(--sb-border); }
.sb-field-modal-root .nav-counter { color: var(--sb-text-2); }

.sb-field-modal-root h1,
.sb-field-modal-root .fl-info-line { color: var(--sb-text); }
.sb-field-modal-root .fl-info-line { color: var(--sb-text-2); }
.sb-field-modal-root .fl-parents-line { color: var(--sb-text-2); }
/* Matches .fl-parents-link's size so the line doesn't change height depending
   on whether the parents happen to be clickable. */
.sb-field-modal-root .fl-parents-text { color: var(--sb-text); font-size: 14px; }
/* Double-class form on purpose: `.sb-root a` (element+class) outranks a bare
   `.fl-seedkey-link`, and `.sb-field-modal-root h1` would otherwise repaint it
   as plain body text. Accent green reads as the link it is on the dark card. */
.sb-field-modal-root .fl-seedkey-link,
.sb-field-modal-root h1 .fl-seedkey-link { color: var(--sb-accent); }
.sb-field-modal-root .fl-seedkey-link:hover { color: var(--sb-accent); text-decoration: underline; }

/* Long free-text table cells (remarks, actions) cap at 3 lines — on narrow
   laptops the fixed column widths squeeze these columns hard, and an
   unclamped remark wraps one word per line into a 15-line row. Inner div,
   not the td: -webkit-box on a table cell breaks row layout. Full text
   stays available in the detail panel (and via the title tooltip). */
.sb-root .sb-clamp3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sb-field-modal-root .text-muted { color: var(--sb-text-2) !important; }

/* Parents line, when there's parent data to show: blue + bold, and clickable
   (opens the Parents panel). A bare .fl-parents-link would lose to
   `.sb-root a`-style element+class rules, hence the .sb-field-modal-root
   prefix — see the specificity note in CLAUDE.md. */
.sb-field-modal-root .fl-parents-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  /* `font: inherit` above resets to the line's 12px, so the size has to come
     after it — it's the parents that get read here, not the label. */
  font-size: 14px;
  color: var(--sb-info);
  font-weight: 700;
  cursor: pointer;
  margin-right: 0.25rem;
}

.sb-field-modal-root .fl-parents-link:hover { text-decoration: underline; }

.sb-field-modal-root .card {
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text);
}

.sb-field-modal-root .card-subtitle,
.sb-field-modal-root .text-body-secondary { color: var(--sb-text) !important; }

.sb-field-modal-root .pl-field-label { color: var(--sb-text-2); }

/* .fl-notes-card only tightens .card-body's inner padding (built for
   mobile); .card's own outer padding (1.25rem) was still stacking on top
   of it here, making the panel's Notes card border-to-textarea gap much
   larger than intended. Zero it out for the panel specifically. */
.sb-field-modal-root .fl-notes-card { padding: 0; margin-left: 0; margin-right: 0; }
.sb-field-modal-root .fl-notes-card .card-body { padding: 10px 12px; }
.sb-field-modal-root .fl-notes-card .pl-edit { gap: 0.4rem; }
.sb-field-modal-root .fl-notes-card .pl-edit > div:has(#fl-save-msg) { min-height: 0 !important; }

.sb-field-modal-root .fl-photos-card { padding: 0; }
.sb-field-modal-root .fl-photos-card .card-body { padding: 10px 12px !important; }

.sb-field-modal-root .fl-selections-card { padding: 0; }
.sb-field-modal-root .fl-selections-card .card-body { padding: 10px 12px !important; }

/* Notes card fields: the Remarks/Fruit Remarks textareas and the Program /
   Category / Generation inputs share one look (Bootstrap's .form-control-sm
   otherwise gives the inputs a smaller font, tighter padding and a 4px
   radius — they read as a different control). `input.form-control` out-
   specifies Bootstrap's .form-control-sm. */
.sb-field-modal-root .pl-edit textarea,
.sb-field-modal-root .pl-edit input.form-control {
  background: var(--sb-bg);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text);
  font-size: 13px;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  min-height: 0;
  line-height: 1.4;
}

.sb-field-modal-root .pl-edit textarea:focus,
.sb-field-modal-root .pl-edit input.form-control:focus {
  border-color: var(--sb-green);
  background: var(--sb-bg);
  color: var(--sb-text);
  box-shadow: none;
}
.sb-field-modal-root .pl-save-msg { color: var(--sb-accent); }

.sb-field-modal-root .field-card {
  background: var(--sb-surface);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text);
}

/* The whole card is the click target, so the hover background is the affordance
   — `.sb-root a:hover`'s underline would otherwise strike through every bit of
   text inside it. */
.sb-field-modal-root .field-card,
.sb-field-modal-root .field-card:hover { text-decoration: none; }

.sb-field-modal-root .field-card:hover { background: var(--sb-surface-3); color: var(--sb-text); }
.sb-field-modal-root .field-card-name { color: var(--sb-text); }
.sb-field-modal-root .field-card-gen,
.sb-field-modal-root .field-card-parents,
.sb-field-modal-root .field-card-parents-inline { color: var(--sb-text-2); }

.sb-field-modal-root .data-table {
  background: var(--sb-surface);
  border: 1px solid var(--sb-border-2);
}

.sb-field-modal-root .data-table th {
  background: var(--sb-surface-2);
  color: var(--sb-text-2);
  border-bottom-color: var(--sb-border-2);
}

.sb-field-modal-root .data-table td { color: var(--sb-text); border-bottom-color: var(--sb-row-div); }
.sb-field-modal-root .data-table tbody tr:hover { background: var(--sb-nav-hover); }

.sb-field-modal-root .none-text { color: var(--sb-text-2); }

.sb-field-modal-root .btn-outline-success {
  color: var(--sb-accent);
  border-color: var(--sb-green);
}

.sb-field-modal-root .btn-outline-success:hover { background: var(--sb-green); color: #fff; }

.sb-field-modal-root .btn-dark { background: #000; }

/* ==================
   PLANT LIST (Select/Assign action bar + inline collection-code input)
   ================== */

.sb-root .select-action-bar { margin-bottom: 0; }

/* ==================
   SEED BOOK (Select/basket checkbox column)
   The shared .basket-col { display: none } rule (forms.css) removes the
   cell from table layout entirely outside select-mode. Combined with
   table-layout:fixed + explicit <col> widths, a display:none <td> throws
   off the column-to-cell width mapping for every subsequent cell in the
   row, causing text to render overlapping adjacent columns. Keep the
   cell in flow at all times here and only hide its checkbox instead.
   ================== */

.sb-root .sb-table .basket-col { display: table-cell !important; }
.sb-root .sb-table .basket-col .basket-checkbox,
.sb-root .sb-table .basket-col .basket-select-all { visibility: hidden; }
.sb-root .select-mode .sb-table .basket-col .basket-checkbox,
.sb-root .select-mode .sb-table .basket-col .basket-select-all { visibility: visible; }

.sb-root .collection-input {
  width: 28px;
  background: var(--sb-bg);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text);
}

.sb-root .collection-input:focus { border-color: var(--sb-green); background: var(--sb-bg); }

/* ==================
   TRIALS LIST (per-row inline edit)
   Each row swaps display spans for .inline-input fields via the trial-row
   Stimulus controller; the light theme styles those in forms.css.
   ================== */

.sb-root .inline-input {
  background: var(--sb-bg);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 12.5px;
  font-family: var(--sb-font);
  /* Fill the column rather than the input's intrinsic width. A native
     date input is ~135px wide (text + picker button) — wider than these
     columns, so without this each one spills over the next cell and the
     End date field ends up under the Finished checkbox. */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.sb-root .inline-input:focus { outline: none; border-color: var(--sb-green); background: var(--sb-bg); }
.sb-root .inline-input--wide { width: 100%; }

/* Chrome renders the picker glyph near-black on the dark field, so invert
   it. Kept bright and scaled up — at the default size and a dim opacity
   it's a hard target to find, let alone hit. */
.sb-root .inline-input[type="date"] { padding-left: 4px; padding-right: 2px; cursor: pointer; }
.sb-root .sb-input[type="date"] { cursor: pointer; }
.sb-root .inline-input::-webkit-calendar-picker-indicator,
.sb-root .sb-input::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: .9;
  cursor: pointer;
  margin-left: 0;
  padding-left: 2px;
  transform: scale(1.25);
  transform-origin: center;
}
.sb-root .inline-input::-webkit-calendar-picker-indicator:hover,
.sb-root .sb-input::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* Green ring while the picker is open, so it's clear which field it belongs
   to when two sit stacked (Pollination start/end). */
.sb-root .inline-input[type="date"]:focus { border-color: var(--sb-green); }

/* Two date inputs in one cell (Pollination start/end). The cell is
   white-space:nowrap and inputs are inline-block, so they'd sit side by
   side and the second would overflow into End date — stack them. The
   :not([hidden]) guard matters: a bare display:block would override the
   hidden attribute and reveal every date field on every row. */
.sb-root .sb-table td > .inline-input[type="date"]:not([hidden]) { display: block; }
.sb-root .sb-table td > .inline-input + .inline-input { margin-top: 4px; }

/* Column-header subtitle, e.g. Pollination "start - end", which tells the
   two stacked date inputs apart without labelling each row. */
.sb-root .sb-table thead th .sb-th-sub {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .2px;
  text-transform: none;
  color: var(--sb-text-3);
}

/* The reveal-on-hover rule in tables.css is scoped to .data-table, so the
   pencil would never appear in an .sb-table row without this. */
.sb-root .row-edit-btn {
  border-color: var(--sb-border-2);
  color: var(--sb-text);
  background: none;
  font-size: 14px;
}

.sb-root .sb-table tbody tr:hover .row-edit-btn { opacity: 1; }
.sb-root .row-edit-btn:hover { color: var(--sb-accent); border-color: var(--sb-accent); }

/* ==================
   MARKERS LIST
   Every field is always editable (no pencil), one hidden form per row.
   The .markers-table rules in forms.css are light-theme and outrank the
   plain .sb-root .inline-input rules above on specificity, so the dark
   overrides here have to match that same two-class weight.
   ================== */

.sb-root .markers-table .inline-input {
  background: var(--sb-bg);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 12.5px;
  font-family: var(--sb-font);
  width: 100%;
  box-sizing: border-box;
}

.sb-root .markers-table .inline-input:focus {
  outline: none;
  border-color: var(--sb-green);
  background: var(--sb-bg);
}

/* Widths come from the colgroup here, so the fixed light-theme widths
   would only fight it. */
.sb-root .markers-table .inline-input--short,
.sb-root .markers-table .inline-input--tiny,
.sb-root .markers-table .inline-input--wide { width: 100%; }

.sb-root .markers-table select.inline-input { cursor: pointer; }

.sb-root .markers-table .sb-btn-primary { padding: 4px 12px; font-size: 12px; }


/* Inactive markers stay legible — 0.45 opacity on the dark surface makes
   them near-invisible, so dim the text instead. */
.sb-root .markers-table .row-inactive td { opacity: 1; color: var(--sb-text-3); }
.sb-root .markers-table .row-inactive .inline-input { color: var(--sb-text-3); }
.sb-root .markers-table .row-inactive .sb-code-link { color: var(--sb-text-3); }

/* The "add a marker" row, marked out from the saved rows above it. */
.sb-root .markers-table .row-new td {
  background: var(--sb-surface-2);
  border-top: 1px solid var(--sb-border-2);
}

/* ==================
   BASKET
   ================== */

/* ---- Dropdown action button (shared/_sb_menu_button) ----
   Positioning context per menu: without one, every .sb-dropdown-menu
   anchors to the same ancestor and they stack on top of each other. */
.sb-root .sb-menu-wrap { position: relative; display: inline-flex; }

.sb-root .sb-menu-caret { font-size: 10px; line-height: 1; }

/* button_to wraps its button in a <form>; strip the form's own box so the
   entry lines up with plain <a>/<button> items in the same menu. */
.sb-root .sb-dropdown-menu form { margin: 0; padding: 0; display: block; }

/* ---- Bootstrap dropdown-menu (sidebar user menu) ----
   Bootstrap's own light styling shows through otherwise. Scoped to
   .sb-root so the legacy navbar's menus are untouched. */
.sb-root .dropdown-menu {
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.45);
  padding: 6px;
  --bs-dropdown-link-color: var(--sb-text-dim);
  --bs-dropdown-link-hover-color: var(--sb-text);
  --bs-dropdown-link-hover-bg: var(--sb-surface-3);
  --bs-dropdown-link-active-color: var(--sb-text);
  --bs-dropdown-link-active-bg: var(--sb-surface-3);
}

.sb-root .dropdown-menu .dropdown-item {
  color: var(--sb-text-dim);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.sb-root .dropdown-menu .dropdown-item:hover,
.sb-root .dropdown-menu .dropdown-item:focus {
  background: var(--sb-surface-3);
  color: var(--sb-text);
}

.sb-root .dropdown-menu .dropdown-divider {
  border-top-color: var(--sb-border-2);
  margin: 5px 2px;
}

/* Logout is a <button> inside a <form>; the form has to fill the menu or
   the button's width:100% resolves against a shrink-wrapped parent. */
.sb-root .dropdown-menu form { width: 100%; margin: 0; }

/* ---- Database info (popup + standalone page) ---- */

.sb-root .sb-db-source {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--sb-text);
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--sb-border-2);
}

.sb-root .sb-db-list {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: baseline;
  gap: 9px 14px;
  margin: 0;
  padding: 0;
  font-size: 13px;
}

.sb-root .sb-db-list dt {
  color: var(--sb-text);
  font-weight: 600;
  margin: 0;
}

/* margin-inline-start is the UA default on <dd> and would push values out
   of their grid cell wherever a CSS reset isn't in play. */
.sb-root .sb-db-list dd {
  margin: 0;
  margin-inline-start: 0;
  color: var(--sb-text);
  font-family: var(--sb-mono);
  word-break: break-all;
}

.sb-root .sb-db-warning {
  margin: 16px 0 0;
  padding: 9px 11px;
  border: 1px solid var(--sb-warn);
  border-radius: 8px;
  color: var(--sb-warn);
  font-size: 12.5px;
}

/* ==================
   ADMIN — USERS
   ================== */

/* Outline pills, matching the score badges rather than the light theme's
   pale-tinted fills, which wash out on the dark surface. */
.sb-root .role-badge {
  background: transparent;
  border: 1.4px solid var(--sb-text-3);
  color: var(--sb-text-2);
  border-radius: 999px;
  padding: 2px 9px;
}

.sb-root .role-badge--admin  { border-color: var(--sb-bad);  color: var(--sb-bad); }
.sb-root .role-badge--editor { border-color: var(--sb-warn); color: var(--sb-warn); }
.sb-root .role-badge--viewer { border-color: var(--sb-good); color: var(--sb-good); }

/* Compact buttons for use inside a table row. */
.sb-root .sb-btn-sm {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 6px;
}

/* ---- Simple form card (admin user add/edit) ---- */

.sb-root .sb-form-card {
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
  border-radius: 12px;
  padding: 22px 24px;
  max-width: 520px;
}

.sb-root .sb-form-field { margin-bottom: 16px; }

.sb-root .sb-form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--sb-text);
  margin-bottom: 5px;
}

/* .sb-input is fixed-width for toolbars; form fields fill the card. */
.sb-root .sb-input--block { width: 100%; box-sizing: border-box; }

.sb-root .sb-form-field .program-dropdown,
.sb-root .sb-form-field .program-dropdown-summary { width: 100%; box-sizing: border-box; }

.sb-root .sb-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

/* Wider variant for forms with paired fields (New Seedkey). */
.sb-root .sb-form-card--wide { max-width: 760px; }

/* Two fields side by side, stacking on narrow viewports. */
.sb-root .sb-form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.sb-root .sb-form-row > .sb-form-field { flex: 1; min-width: 220px; }

/* For short codes (Crop, Collection) — sized to content rather than
   stretched across the card. */
.sb-root .sb-form-row--compact > .sb-form-field { flex: 0 0 180px; min-width: 180px; }

/* Female/Male parent pairs plus the free-text Parents field on one line.
   The pairs need room for a seedkey + plant number; Parents takes the rest. */
.sb-root .sb-form-row--pedigree { flex-wrap: nowrap; }
.sb-root .sb-form-row--pedigree > .sb-form-field { flex: 0 0 auto; min-width: 0; }
.sb-root .sb-form-row--pedigree > .sb-form-field:nth-child(-n+2) { flex: 0 0 230px; }
.sb-root .sb-form-row--pedigree > .sb-form-field:last-child { flex: 1 1 auto; }

@media (max-width: 1100px) {
  .sb-root .sb-form-row--pedigree { flex-wrap: wrap; }
  .sb-root .sb-form-row--pedigree > .sb-form-field:last-child { flex: 1 1 100%; }
}

.sb-root .sb-required { color: var(--sb-bad); }

.sb-root .sb-field-note {
  color: var(--sb-text-3);
  font-size: 12.5px;
  margin: 0;
  padding: 8px 0;
}

/* SeedKey + plant number, sized to their content. */
.sb-root .sb-parent-pair { display: flex; gap: 8px; }
.sb-root .sb-parent-pair .sb-input { flex: 1; min-width: 0; }
.sb-root .sb-input--narrow { flex: 0 0 76px; width: 76px; }

.sb-root .sb-textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--sb-bg);
  border: 1px solid var(--sb-border-2);
  border-radius: 8px;
  color: var(--sb-text);
  font-family: var(--sb-font);
  font-size: 13px;
  padding: 8px 10px;
  resize: vertical;
}

.sb-root .sb-textarea:focus { outline: none; border-color: var(--sb-green); }
.sb-root .sb-textarea::placeholder { color: var(--sb-text-2); }

/* ==================
   SPLASH (desktop landing page inside the sidebar shell)
   ================== */

.sb-root .sb-splash-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sb-root .sb-splash {
  text-align: center;
  padding-bottom: 40px;
}

.sb-root .sb-splash-logo { margin-bottom: 14px; }

.sb-root .sb-splash-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--sb-text);
  margin: 0 0 4px;
}

.sb-root .sb-splash-year {
  font-size: 15px;
  color: var(--sb-text);
  margin: 0 0 26px;
}

/* .sb-root a underlines on hover and would tint the label green — the CTA
   is a button, so it keeps white text and no underline. */
.sb-root a.sb-splash-cta,
.sb-root a.sb-splash-cta:hover {
  display: inline-flex;
  padding: 11px 26px;
  font-size: 14px;
  color: #fff;
  text-decoration: none;
}

.sb-root .sb-splash-build {
  font-size: 11.5px;
  color: var(--sb-text-2);
  margin: 34px 0 0;
}

/* Explanatory paragraph above a table or form. */
.sb-root .sb-note {
  color: var(--sb-text-2);
  font-size: 12.5px;
  max-width: 760px;
  margin: 0 0 14px;
  flex-shrink: 0;
}

/* The confirm form owns the remaining height so its table scrolls and the
   submit row stays visible at the bottom. */
.sb-root .sb-confirm-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.sb-root .sb-confirm-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  flex-shrink: 0;
}

/* Pager under a table that pages server-side (Marker Data Detail). */
.sb-root .sb-pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  flex-shrink: 0;
}

.sb-modal-hint {
  font-size: 12px;
  color: var(--sb-text-2);
  text-align: center;
  margin: 0;
}

/* f.submit renders <input type="submit">, which Bootstrap's reset styles
   before .sb-btn-secondary gets a chance — restate it at input specificity. */
.sb-root input[type="submit"].sb-btn-secondary,
.sb-root input[type="submit"].sb-btn-primary {
  -webkit-appearance: none;
  appearance: none;
  background: var(--sb-green);
  border: none;
  color: #fff;
}

.sb-root input[type="submit"].sb-btn-primary:hover { opacity: .92; }

.sb-root input[type="submit"].sb-btn-secondary {
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text);
}

.sb-root input[type="submit"].sb-btn-secondary:hover { background: var(--sb-surface-3); }

/* The "Choose File" button is a shadow-DOM part, reachable only through
   this selector — otherwise it stays light against the dark field. */
.sb-root .sb-modal-file::file-selector-button {
  background: var(--sb-surface-3);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text);
  border-radius: 5px;
  padding: 4px 12px;
  margin-right: 12px;
  font-family: var(--sb-font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.sb-root .sb-modal-file::file-selector-button:hover { background: var(--sb-border-2); }

.sb-root .sb-btn-danger {
  background: transparent;
  border: 1px solid var(--sb-bad);
  color: var(--sb-bad);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--sb-font);
  cursor: pointer;
}

.sb-root .sb-btn-danger:hover { background: var(--sb-bad); color: #fff; }

.sb-root .sb-row-remove {
  background: none;
  border: none;
  color: var(--sb-text-2);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
}

.sb-root .sb-row-remove:hover { color: var(--sb-bad); }

.sb-root .sb-empty {
  color: var(--sb-text-2);
  font-size: 13.5px;
  padding: 24px 4px;
}

/* ---- Label config ---- */

.sb-root .sb-copies-input { width: 70px; text-align: right; }

.sb-root .sb-label-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
}


.sb-root .sb-calibration-card {
  margin-top: 26px;
  padding: 14px 16px;
  border: 1px solid var(--sb-border-2);
  border-radius: 10px;
  background: var(--sb-surface-2);
  max-width: 560px;
  flex-shrink: 0;
}

.sb-root .sb-calibration-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--sb-text);
  margin-bottom: 4px;
}

.sb-root .sb-calibration-note {
  color: var(--sb-text-2);
  font-size: 12.5px;
  font-weight: 400;
  margin-bottom: 10px;
}

.sb-root .sb-calibration-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Trials "Finished" column: ✓ green = finished, ✗ red = still running.
   Named for what they show, not for the light theme's --active/--finished
   pair, whose sense is inverted relative to the column header. */
.sb-root .status-icon--yes { color: var(--sb-good); }
.sb-root .status-icon--no { color: var(--sb-bad); }

/* Bootstrap Icons glyph rather than the 📄 emoji, which renders as bright
   white "paper" against the dark table (and falls back to a boxed glyph in
   fonts that lack it). Needs the double-class form to beat .sb-root a. */
.sb-root .attachment-link,
.sb-root a.attachment-link {
  color: var(--sb-text);
  text-decoration: none;
  font-size: 16px;
  margin-right: 4px;
}

.sb-root a.attachment-link:hover { color: var(--sb-accent); text-decoration: none; }

/* + New trial form, revealed by the panel-toggle controller */
.sb-new-trial-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
  border-radius: 10px;
}

.sb-new-trial-row label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--sb-text);
  margin-bottom: 4px;
}

/* ==================
   PLANT DETAIL PANEL (photos carousel, resistances strip, parents block,
   dt/dd Plant info list, position inputs) — reuses .sb-field-modal-root.
   ================== */

.sb-field-modal-root .pl-new-seed { color: var(--sb-accent); }

.sb-field-modal-root .pl-resistances {
  background: var(--sb-bg);
  border: 1px solid var(--sb-border-2);
}
.sb-field-modal-root .pl-resistances-label { color: var(--sb-text-2); }

.sb-field-modal-root .pl-carousel-main {
  background: var(--sb-bg);
  border: 1px solid var(--sb-border-2);
  /* Cards now stack full-width (2026-08-23); cap the main frame instead of
     letting the 50% rule scale it with the card. Thumbs shrink to match. */
  width: 180px;
}
.sb-field-modal-root .pl-thumb, .sb-field-modal-root .pl-thumb-add { flex-basis: 50px; width: 50px; height: 50px; }

/* New name row above the markers block: label and input on one line; the
   input matches the Notes fields. */
.sb-field-modal-root .pl-newname-row { display: flex; align-items: center; gap: 10px; }
.sb-field-modal-root .pl-newname-row .pl-field-label { white-space: nowrap; }
.sb-field-modal-root .pl-newname-input {
  flex: 1;
  background: var(--sb-bg); border: 1px solid var(--sb-border-2); color: var(--sb-text);
  font-size: 13px; padding: 0.45rem 0.6rem; border-radius: 6px; max-width: 520px;
}
.sb-field-modal-root .pl-newname-input:focus { border-color: var(--sb-green); background: var(--sb-bg); color: var(--sb-text); box-shadow: none; }

/* Plant card: one read-only line — Trial · Selected · Entered · Updated. */
.sb-field-modal-root .pl-plant-line { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13px; color: var(--sb-text); }
.sb-field-modal-root .pl-plant-line-label { color: var(--sb-text-2); margin-right: 4px; }
.sb-field-modal-root .pl-carousel-main-add { color: var(--sb-text-3); }
.sb-field-modal-root .pl-carousel-main-add:hover { background: var(--sb-surface-3); color: var(--sb-accent); }

/* No photos: collapse the main frame entirely rather than showing a large
   empty placeholder box. The "+" tile in the strip below is then the only
   add affordance. The element itself stays in the DOM — the carousel JS
   looks up #pl-main-frame unconditionally. */
.sb-field-modal-root .pl-carousel-main--empty {
  display: none;
}
.sb-field-modal-root .pl-carousel-nav { background: rgba(23,26,32,0.85); color: var(--sb-text); }
.sb-field-modal-root .pl-carousel-nav:hover { background: var(--sb-surface-2); }

.sb-field-modal-root .pl-thumb:hover { border-color: var(--sb-accent); }
.sb-field-modal-root .pl-thumb.pl-thumb--active { border-color: var(--sb-green); }
.sb-field-modal-root .pl-thumb-add {
  border: 1.5px dashed var(--sb-border-2);
  background: var(--sb-bg);
  color: var(--sb-text-3);
}
.sb-field-modal-root .pl-thumb-add:hover { border-color: var(--sb-accent); color: var(--sb-accent); }

.sb-field-modal-root dt.text-body-secondary { color: var(--sb-text-2) !important; }
.sb-field-modal-root dd { color: var(--sb-text); }

.sb-field-modal-root .pl-parent-block + .pl-parent-block { border-top-color: var(--sb-border-2); }
/* Plant Detail Parents card: female and male side by side, 50:50, with a
   vertical divider between them instead of the stacked top-border rule. */
.sb-field-modal-root .pl-parents-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.sb-field-modal-root .pl-parents-grid .pl-parent-block { min-width: 0; }
.sb-field-modal-root .pl-parents-grid .pl-parent-block + .pl-parent-block { margin-top: 0; padding-top: 0; border-top: 0; padding-left: 18px; border-left: 1px solid var(--sb-border-2); }
.sb-field-modal-root .pl-parent-label { color: var(--sb-text-2); display: flex; align-items: center; gap: 6px; }
/* ♀ / ♂ at label size (11px) were unreadable — draw them large and bright. */
.sb-field-modal-root .pl-parent-sex { font-size: 20px; line-height: 1; color: var(--sb-text); }
.sb-field-modal-root .pl-parent-name { color: var(--sb-text); }
.sb-field-modal-root .pl-parent-seedkey { color: var(--sb-text-2); }
.sb-field-modal-root .pl-parent-remarks { color: var(--sb-text-2); }

.sb-field-modal-root .form-control-sm {
  background: var(--sb-bg);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text);
}
.sb-field-modal-root .form-control-sm:focus { border-color: var(--sb-green); background: var(--sb-bg); color: var(--sb-text); }
.sb-field-modal-root .form-label { color: var(--sb-text-2); }

.sb-field-modal-root .btn-primary {
  background: var(--sb-green);
  border-color: var(--sb-green);
}
.sb-field-modal-root .text-success { color: var(--sb-accent) !important; }
.sb-field-modal-root .btn-outline-danger { color: var(--sb-bad); border-color: #7f2b2b; }
.sb-field-modal-root .btn-outline-danger:hover { background: #7f2b2b; color: #fff; }
.sb-field-modal-root .border-top { border-color: var(--sb-border-2) !important; }

/* ==================
   SEEDBOOK DETAIL PANEL
   The Seedbook detail is a two-column .panels-grid of collapsible cards
   (Identification/Lineage/Classification | Photos/Trials/Parents/Markers/
   Children/Ancestors) with .field-row key-value lists, Bootstrap .table
   blocks and a photo carousel — none of which the Field/Plant Detail
   panels use. Everything below re-skins those light-theme card/field/
   table styles (cards.css) for the dark panel. Reuses .sb-field-modal-root
   so the shell reset + shared overrides above still apply.
   ================== */

/* Title row */
.sb-field-modal-root .detail-seedkey { color: var(--sb-accent); font-family: var(--sb-mono); }
.sb-field-modal-root .detail-name { color: var(--sb-text); }
.sb-field-modal-root .detail-grown-check { color: var(--sb-accent); }
.sb-field-modal-root .detail-gen-badge {
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text-2);
}
.sb-field-modal-root .detail-footer { color: var(--sb-text-3); }

/* In the panel the two columns are stacked — 380px + 780px side by side
   doesn't fit, same reasoning as the .row.g-3 override for Field Detail. */
.sb-field-modal-root.sb-in-panel .panels-grid { flex-direction: column; }
.sb-field-modal-root.sb-in-panel .panels-left,
.sb-field-modal-root.sb-in-panel .panels-right { flex: none; width: 100%; max-width: 100%; }

/* Cards */
.sb-field-modal-root .panels-grid .card {
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border-2);
}

.sb-field-modal-root .panels-grid .card-header {
  background: var(--sb-surface);
  border-bottom: 1px solid var(--sb-border-2);
}

.sb-field-modal-root .panel-title { color: var(--sb-text); }
.sb-field-modal-root .icon-btn { color: var(--sb-text); }
.sb-field-modal-root .icon-btn:hover { color: var(--sb-accent); }

/* Key/value field rows */
.sb-field-modal-root .field-row { border-bottom-color: var(--sb-row-div); }
.sb-field-modal-root .field-label { color: var(--sb-text-2); }
.sb-field-modal-root .field-value { color: var(--sb-text); }
.sb-field-modal-root .field-value.mono { color: var(--sb-accent); font-family: var(--sb-mono); }
.sb-field-modal-root .field-value.muted { color: var(--sb-text-3); }
.sb-field-modal-root .field-value a { color: var(--sb-accent); }

/* Bootstrap tables inside the cards (Markers/Children/Ancestors).
   Bootstrap 5.3 paints every cell with `background-color: var(--bs-table-bg)`,
   which defaults to --bs-body-bg (white) — so the cells rendered as solid
   white blocks over the dark card no matter what colour the text was. Only
   hovered rows looked right, because .table-hover sets --bs-table-bg-state
   and the hover rule below repaints them. Fix at the variable, not the
   selector: specificity was never the problem here. */
.sb-field-modal-root .panels-grid .table {
  --bs-table-color: var(--sb-text);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--sb-row-div);
  --bs-table-striped-color: var(--sb-text);
  --bs-table-striped-bg: transparent;
  --bs-table-active-color: var(--sb-text);
  --bs-table-active-bg: var(--sb-surface-3);
  --bs-table-hover-color: var(--sb-text);
  color: var(--sb-text);
}
.sb-field-modal-root .panels-grid .table th {
  color: var(--sb-text-2);
  border-bottom-color: var(--sb-border-2);
  background: transparent;
}
.sb-field-modal-root .panels-grid .table td {
  border-bottom-color: var(--sb-row-div);
  color: var(--sb-text);
}
.sb-field-modal-root .panels-grid .table a { color: var(--sb-accent); }

/* .table-hover paints a light --bs-table-hover-bg over the row otherwise */
.sb-field-modal-root .panels-grid .table-hover > tbody > tr:hover > * {
  background-color: var(--sb-surface-3);
  color: var(--sb-text);
  --bs-table-accent-bg: transparent;
}

/* Section headings inside the Markers/Children/Ancestors cards ("female
   parents", "Marker Data", …). cards.css hardcodes #888, which disappears
   against the dark surface — these are structural labels, not hints. */
.sb-field-modal-root .panels-grid .panel-subtitle { color: var(--sb-text-2); }

/* The generation "(F1)" spans and the plain-text markers fallback in those
   tables carry Bootstrap's .text-muted / a bare inline font-size only, so
   they inherit a light-theme grey. Keep table cell content at full
   brightness — it's primary content, not secondary. */
.sb-field-modal-root .panels-grid .table td .text-muted { color: var(--sb-text-2) !important; }
.sb-field-modal-root .panels-grid .table td span:not([class]) { color: var(--sb-text); }

/* Photo carousel + inline-edit controls */
.sb-field-modal-root .photo-carousel { scrollbar-color: var(--sb-border-2) transparent; }
.sb-field-modal-root .photo-upload-spinner { color: var(--sb-text-2); }
.sb-field-modal-root .upload-error { color: var(--sb-bad); }

/* Seedbook Detail: the source plant's read-only twins (remarks / fruit
   remarks / markers) — slightly muted so the editable seed rows read as the
   primary fields. */
.sb-field-modal-root .field-value--plant { color: var(--sb-text-2); }

.sb-field-modal-root .inline-edit-input {
  background: var(--sb-bg);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text);
}
.sb-field-modal-root .inline-edit-input:focus {
  border-color: var(--sb-green);
  /* Restated on purpose: forms.css paints input[type="text"]:focus and
     textarea:focus white at (0,2,1), which beats the (0,2,0) base rule
     above exactly when the field is focused — dark until clicked, then
     white with light-grey text. A focus rule that only sets border-color
     lets that through; (0,3,0) here wins. Don't "simplify" these away. */
  background: var(--sb-bg);
  color: var(--sb-text);
}

/* Trials cards — .field-card-name carries an inline light grey in the
   markup, so the remarks line needs !important to win here. */
/* Plain (mobile-style) plot pill. Excludes the blue plot-plant variant, which
   brings its own background/colour from .sb-plot-badge--plant. */
.sb-field-modal-root .field-card-plot-pill:not(.sb-plot-badge) {
  background: var(--sb-surface);
  border: 1px solid var(--sb-border-2);
  color: var(--sb-text-2);
}

/* Plot-plant pill at the top of the Plant Detail panel. Bootstrap's .badge
   brings its own font-size/padding, so the badge sizing is restated against
   the combined selector to win. */
/* Editors can click the pill to reopen the collapsed position row. */
.sb-field-modal-root .pl-pill-editable { cursor: pointer; }
.sb-field-modal-root .pl-pill-editable:hover { filter: brightness(1.35); }

.sb-field-modal-root .badge.sb-plot-badge--plant {
  background: var(--sb-badge-plant);
  color: #fff;
  height: 24px;
  min-width: 26px;
  padding: 0 9px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
}

/* Blue plot-plant pill on the selection card. .field-card-plot-pill (cards.css)
   sets a cramped 20px/12px and loses nothing to .sb-plot-badge on specificity,
   so size and colour are restated here — white on blue, large enough to read. */
.sb-field-modal-root .field-card-plot-pill.sb-plot-badge--plant {
  background: var(--sb-badge-plant);
  border: 0;
  color: #fff;
  height: 24px;
  min-width: 26px;
  padding: 0 9px;
  font-size: 14px;
  font-weight: 700;
}
.sb-field-modal-root .field-card .field-card-name { color: var(--sb-text-2) !important; }

/* SeedKey · Name shown inline after the plot-plant pill on the selection card
   (desktop panel only). SeedKey is the identifier, so it gets the mono/bright
   treatment; the name follows in the secondary tone. */
.sb-field-modal-root .field-card-seedkey-inline {
  font-family: var(--sb-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--sb-text-bright);
}

.sb-field-modal-root .field-card-newname-inline {
  font-size: 13px;
  color: var(--sb-text-2);
}

/* ==================
   PHOTOS PAGE
   ================== */

.sb-photo-wall-wrap { flex: 1; overflow-y: auto; min-height: 0; }

.sb-photo-wall {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

@media (max-width: 1400px) { .sb-photo-wall { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 1100px) { .sb-photo-wall { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 800px)  { .sb-photo-wall { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 500px)  { .sb-photo-wall { grid-template-columns: repeat(2, 1fr); } }

.sb-photo-card {
  background: var(--sb-surface);
  border: 1px solid var(--sb-border);
  border-radius: 10px;
  overflow: hidden;
}

.sb-photo-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s ease;
}

.sb-photo-card img:hover { opacity: 0.85; }

.sb-photo-caption { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.sb-photo-plot-plant { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12.5px; }
.sb-photo-seedkey-inline { font-weight: 400; font-size: 11.5px; color: var(--sb-text); }
.sb-photo-seedkey { font-size: 12px; color: var(--sb-text-2); }
.sb-photo-name { font-size: 12px; color: var(--sb-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-photo-markers { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 2px; }

/* ==================
   CHECKBOXES (Plant List select/assign columns)
   accent-color alone only recolors the CHECKED state in most browsers —
   an unchecked native checkbox keeps its light OS-default box/border
   regardless, which is why it still read as a plain white square. Turning
   off native rendering (appearance:none) and drawing the box ourselves
   keeps both states dark-themed.
   ================== */

.sb-root input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  accent-color: var(--sb-green);
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--sb-text-2);
  border-radius: 3px;
  background: var(--sb-bg);
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
  position: relative;
}

.sb-root input[type="checkbox"]:checked {
  background: var(--sb-green);
  border-color: var(--sb-green);
}

.sb-root input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.sb-root input[type="checkbox"]:indeterminate {
  background: var(--sb-green);
  border-color: var(--sb-green);
}

.sb-root input[type="checkbox"]:indeterminate::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 6px;
  width: 7px;
  height: 2px;
  background: #fff;
}

/* ---------------------------------------------------------------------------
   Data Query console (insights#index)
   --------------------------------------------------------------------------- */

.sb-root .iq-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--sb-text);
  margin-bottom: 6px;
}

.sb-root .iq-textarea {
  width: 100%;
  background: var(--sb-bg);
  color: var(--sb-text);
  border: 1px solid var(--sb-border-2);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.sb-root .iq-textarea:focus {
  outline: none;
  border-color: var(--sb-accent);
}

.sb-root .iq-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.sb-root .iq-hint,
.sb-root .iq-result-meta {
  font-size: 11.5px;
  color: var(--sb-text-2);
}

.sb-root .iq-result-meta { margin-bottom: 10px; }
.sb-root .iq-truncated { color: var(--sb-warn); }
.sb-root .iq-empty { color: var(--sb-text-2); margin: 0; }

.sb-root .iq-error {
  border-color: var(--sb-bad);
  color: var(--sb-text);
}

.sb-root .iq-error strong { color: var(--sb-bad); }

.sb-root .iq-examples { margin-top: 14px; }

.sb-root .iq-examples summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--sb-text-2);
}

.sb-root .iq-examples ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.sb-root .iq-examples li { margin-bottom: 6px; }

.sb-root .iq-examples code,
.sb-root .iq-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--sb-text-bright);
}

.sb-root .iq-code {
  display: block;
  background: var(--sb-bg);
  border: 1px solid var(--sb-border);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 8px 0 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.sb-root .iq-setup-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--sb-text);
  margin: 0 0 10px;
}

.sb-root .iq-setup p { color: var(--sb-text); font-size: 13px; }
.sb-root .iq-setup .iq-note { color: var(--sb-text-2); font-size: 12px; margin-bottom: 0; }

/* Wide result sets scroll inside the card rather than the page. */
.sb-root .iq-table-wrap {
  overflow-x: auto;
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid var(--sb-border);
  border-radius: 6px;
}

/* Bootstrap paints every cell with --bs-table-bg (defaults to white), which
   renders solid white blocks over the dark card. Override the variable, not
   the selector — see CLAUDE.md. */
.sb-root .iq-table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--sb-text);
  --bs-table-striped-bg: var(--sb-surface-2);
  --bs-table-striped-color: var(--sb-text);
  --bs-table-hover-bg: var(--sb-surface-3);
  --bs-table-hover-color: var(--sb-text);
  margin: 0;
  font-size: 12.5px;
}

.sb-root .iq-table th {
  position: sticky;
  top: 0;
  background: var(--sb-surface-2);
  color: var(--sb-text);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--sb-border-2);
}

.sb-root .iq-table td {
  color: var(--sb-text-dim);
  border-color: var(--sb-border);
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------------------------------------------------------------------------
   AI Chat (ai#index)
   --------------------------------------------------------------------------- */

.sb-root .ai-chat-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* full content width (beats .sb-form-card's 520px cap) — wide remark
     tables need the room */
  max-width: none;
}

.sb-root .ai-transcript {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 62vh;
  min-height: 180px;
  overflow-y: auto;
  padding: 4px 2px;
}

.sb-root .ai-msg { display: flex; }
.sb-root .ai-msg--user { justify-content: flex-end; }

.sb-root .ai-msg-body {
  max-width: 92%;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.55;
  /* Answers are markdown shown as text; pre-wrap keeps tables and SQL
     blocks legible without an HTML renderer. */
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--sb-text);
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-border);
}

.sb-root .ai-msg--user .ai-msg-body {
  background: var(--sb-badge-plant);
  border-color: var(--sb-border-2);
}

.sb-root .ai-msg--bot .ai-msg-body {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.sb-root .ai-msg--error .ai-msg-body { border-color: var(--sb-bad); color: var(--sb-bad); }

/* AI Chat: proposal confirm cards */
.sb-root .ai-proposal {
  border: 1px solid var(--sb-warn);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--sb-surface-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sb-root .ai-proposal--done { border-color: var(--sb-accent); }

.sb-root .ai-proposal-summary {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sb-text);
}

.sb-root .ai-proposal-tablewrap { overflow-x: auto; max-height: 40vh; overflow-y: auto; }
.sb-root .ai-proposal-actions { display: flex; align-items: center; gap: 12px; }
.sb-root .ai-apply-ok  { color: var(--sb-accent); }
.sb-root .ai-apply-err { color: var(--sb-bad); }

/* Sidebar AI submenu (<details> group holding AI Chat + Data Query) */
.sb-root .sb-nav-group-toggle {
  list-style: none;              /* hide default disclosure triangle */
  justify-content: space-between;
}
.sb-root .sb-nav-group-toggle::-webkit-details-marker { display: none; }
.sb-root .sb-nav-group-toggle::after {
  content: "\203A";              /* › — rotates to point down when open */
  font-size: 15px;
  color: var(--sb-text-2);
  transition: transform 0.15s;
}
.sb-root .sb-nav-group[open] > .sb-nav-group-toggle::after { transform: rotate(90deg); }
.sb-root .sb-nav-sub { padding-left: 26px; font-size: 13px; }

/* AI Chat: "View SQL" fold inside answer bubbles */
.sb-root .ai-sql { margin: 6px 0 2px; }
.sb-root .ai-sql summary {
  display: inline-block;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--sb-accent);
  border: 1px solid var(--sb-border-2);
  border-radius: 6px;
  padding: 3px 10px;
}
.sb-root .ai-sql summary::-webkit-details-marker { display: none; }
.sb-root .ai-sql[open] summary { color: var(--sb-text-2); }
.sb-root .ai-sql pre {
  margin: 8px 0 0;
  background: var(--sb-bg);
  border: 1px solid var(--sb-border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--sb-text-bright);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Data Query: query + results cards go full width like the chat
   (the 520px .sb-form-card cap is for actual forms; the setup notice
   keeps it deliberately). */
.sb-root .iq-wide { max-width: none; }

/* AI Chat: per-answer copy chip (sits right of the bubble, bottom-aligned) */
.sb-root .ai-msg--bot { align-items: flex-end; gap: 6px; }
.sb-root .ai-copy {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--sb-text-2);
  background: none;
  border: 1px solid var(--sb-border-2);
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
}
.sb-root .ai-copy:hover { color: var(--sb-text); border-color: var(--sb-text-3); }

/* AI Chat: one Q/A pair per .ai-exchange so it can be deleted as a unit */
.sb-root .ai-exchange { display: flex; flex-direction: column; gap: 10px; }
.sb-root .ai-delete:hover { color: var(--sb-bad); border-color: var(--sb-bad); }

/* AI Chat: add-to-basket chip */
.sb-root .ai-basket:hover:not(:disabled) { color: var(--sb-accent); border-color: var(--sb-accent); }
.sb-root .ai-basket:disabled { color: var(--sb-accent); cursor: default; }

/* Plant Detail markers block — dark overrides for plant_list/_markers. */
.sb-field-modal-root .pl-markers { background: var(--sb-surface-2); border-color: var(--sb-border); }
.sb-field-modal-root .pl-markers .pl-resistances-label { color: var(--sb-text-2); }
.sb-field-modal-root .marker-pills-x { color: var(--sb-text-2); }
.sb-field-modal-root .pl-markers-update { border-color: var(--sb-accent); color: var(--sb-accent); }
.sb-field-modal-root .pl-markers-update:not(:disabled):hover { background: color-mix(in srgb, var(--sb-accent) 15%, transparent); }

/* ✎ Edit-markers controls in the dark panel. The input must restate
   background+color on :focus — forms.css paints text inputs white on focus at
   higher specificity than a plain class (see CLAUDE.md). */
.sb-field-modal-root .pl-markers-edit { border-color: var(--sb-border); color: var(--sb-text-2); }
.sb-field-modal-root .pl-markers-edit:hover { color: var(--sb-text); background: var(--sb-surface-3, var(--sb-surface-2)); }
.sb-field-modal-root .pl-markers-edit-input { background: var(--sb-surface); border-color: var(--sb-border); color: var(--sb-text); }
.sb-field-modal-root .pl-markers-edit-input:focus { background: var(--sb-surface); color: var(--sb-text); border-color: var(--sb-accent); }
.sb-field-modal-root .pl-markers-edit-save { border-color: var(--sb-accent); color: var(--sb-accent); }
.sb-field-modal-root .pl-markers-edit-save:not(:disabled):hover { background: color-mix(in srgb, var(--sb-accent) 15%, transparent); }
.sb-field-modal-root .pl-markers-edit-cancel { border-color: var(--sb-border); color: var(--sb-text-2); }
.sb-field-modal-root .pl-markers-edit-msg { color: var(--sb-text-2); }

/* Bulk "Update markers" preview (trial_markers/preview). */
.sb-root .tm-table td { vertical-align: top; }
.sb-root .tm-raw { font-family: var(--sb-mono); font-size: 11px; margin-top: 4px; }
.sb-root .tm-raw--changed { color: var(--sb-accent); }
.sb-root .tm-row--changed td:first-child { box-shadow: inset 3px 0 0 var(--sb-accent); }

/* Detail topbars (Plant / Field Detail, standalone and Trial Plants panel):
   close button at the top right, like a drawer; prev/next sit just left of
   it. The stacked-panel rule above (.sb-in-panel) keeps close right when the
   nav is hidden. */
.sb-field-modal-root .detail-topbar .detail-nav { order: 1; margin-left: auto; }
.sb-field-modal-root .detail-topbar .btn-close  { order: 3; margin-left: 14px; }
.sb-field-modal-root.sb-in-panel .detail-topbar .btn-close { margin-left: auto; }
/* Plant Detail's "✓ Saved" autosave indicator (editors only) sits between
   prev/next and the X. When the nav is hidden (.sb-in-panel) it takes over
   the right-push from the X, which then just trails it — `~` works because
   the indicator precedes X in the DOM. visibility (not display) toggles it,
   so the topbar never reflows when it appears. */
.sb-field-modal-root .detail-topbar .pl-topbar-save { order: 2; margin-left: 14px; display: flex; align-items: center; gap: 10px; }
.sb-field-modal-root.sb-in-panel .detail-topbar .pl-topbar-save { margin-left: auto; }
.sb-field-modal-root.sb-in-panel .detail-topbar .pl-topbar-save ~ .btn-close { margin-left: 14px; }

/* Detail topbar tidy-up: a subtle divider under the PLANT/FIELD DETAIL bar,
   a little more room before the title row, and the title row's right-hand
   button (Seeded) pulled in so it doesn't sit directly under the close X. */
.sb-field-modal-root .detail-topbar {
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--sb-border);
}
/* Clear the panel's close X — on the column, not the button, so Seeded and
   Seeds keep one shared right edge (2026-09-02). */
.sb-field-modal-root .pl-status-col { margin-right: 28px; }

/* Selection-card program/category tags on the Plot Detail: blue, white text
   (same blue as the plot-plant pill) instead of the light grey chips. */
.sb-field-modal-root .field-card-tags .trial-card-tag {
  background: var(--sb-badge-plant);
  color: #fff;
  border: none;
}

/* Keep the FIELD/PLANT DETAIL bar (title + close X) pinned while the panel
   scrolls. The panel box (.sb-field-modal-box) is the scroll container with
   20px/24px padding: the negative margins let the bar span the full width
   and sit flush at the top, its own padding restores the inset. */
.sb-field-modal-root .detail-topbar {
  position: sticky;
  top: -20px;
  z-index: 5;
  margin: -20px -24px 12px;
  padding: 20px 24px 8px;
  background: var(--sb-surface);
}

/* Assign-seedkeys mode: the Collection code box must be typeable — fill the
   (now 110px) column and never collapse below a readable width. */
.sb-root .collection-input { width: 100%; min-width: 64px; box-sizing: border-box; }

/* ==================
   SEEDBOOK DETAIL — 2026-08-25 redesign (design_handoff_seedbook_detail).
   Grouped hairline grids instead of the flat label/value list. Tokens are
   the handoff's exact values, scoped to this screen; fonts reuse the app's
   loaded stacks (JetBrains Mono is already global; Inter stands in for the
   mock's Inter Tight). The inline-edit machinery is untouched — only laid
   out differently.
   ================== */
.sb-field-modal-root {
  --sbd-bg: #0C1210;
  --sbd-header-bg: #0E1513;
  --sbd-cell-bg: #101816;
  --sbd-hairline: #1A2320;
  --sbd-border: #1C2521;
  --sbd-hover: #1A2320;
  --sbd-text: #E6EDE9;
  --sbd-muted: #8B9A94;
  --sbd-label: #5D6E68;
  --sbd-empty: #46534E;
  --sbd-accent: #6EE7A8;
  --sbd-accent-ink: #06120C;
  --sbd-badge-bg: #1A2724;
  --sbd-badge-fg: #9FB0A9;
  --sbd-purple: #D3A9F0;
}

/* Panel chrome takes the design's darker ground. Literal hex on purpose:
   the --sbd-* tokens live on .sb-field-modal-root, which is INSIDE the
   fetched content — var() here resolves invalid → transparent panel with
   the table showing through (the 2026-08-25 "two screens" bug). */
#sb-seed-detail-panel { width: min(720px, 100vw); background: #0C1210; }
#sb-seed-detail-panel .sb-field-modal-box { background: #0C1210; }

/* Eyebrow (the existing sticky detail-topbar restyled). .sbd-topbar marks
   the Seedbook one so its background matches the design header without
   touching the Plant/Field Detail topbars. */
.sb-field-modal-root .detail-topbar.sbd-topbar { background: #0E1513; border-bottom-color: #1C2521; }

.sb-field-modal-root .detail-topbar .screen-title {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sbd-label);
}
.sb-root a.sbd-iconbtn, .sb-root a.sbd-iconbtn:hover {
  width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center;
  justify-content: center; color: var(--sbd-muted); font-size: 13px; text-decoration: none;
}
.sb-root a.sbd-iconbtn:hover { background: var(--sbd-hover); color: var(--sbd-text); }
.sb-field-modal-root .detail-topbar .sbd-expand { order: 2; margin-left: 14px; }
/* Expand only makes sense inside the slide-in panel. */
.sb-field-modal-root:not(.sb-in-panel) .sbd-expand { display: none; }

/* Header block */
.sb-field-modal-root .sbd-header { display: flex; flex-direction: column; gap: 16px; margin-bottom: 18px; }
.sb-field-modal-root .sbd-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.sb-field-modal-root .sbd-title-left { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.sb-field-modal-root .sbd-seedkey {
  font-family: var(--sb-mono, "JetBrains Mono", monospace);
  font-size: 24px; font-weight: 500; letter-spacing: -0.02em; color: var(--sbd-accent);
}
.sb-field-modal-root .sbd-name-row { display: flex; align-items: center; gap: 10px; }
.sb-field-modal-root .sbd-name { font-size: 17px; font-weight: 500; color: var(--sbd-text); }
.sb-field-modal-root .sbd-gen-badge {
  font-family: var(--sb-mono, "JetBrains Mono", monospace); font-size: 11px;
  padding: 3px 8px; border-radius: 999px; background: var(--sbd-badge-bg); color: var(--sbd-badge-fg);
}
.sb-field-modal-root .sbd-basket-btn {
  flex: none; padding: 7px 13px; border-radius: 9px; border: none; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--sbd-accent-ink); background: var(--sbd-accent);
}
.sb-field-modal-root .sbd-basket-btn:disabled { opacity: .6; cursor: default; }

/* Header action chips */
.sb-field-modal-root .sbd-header-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.sb-field-modal-root .sbd-copy-btn {
  padding: 7px 13px; border-radius: 9px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: #C3CFCA;
  background: transparent; border: 1px solid #2C3833;
}
.sb-field-modal-root .sbd-copy-btn:hover { color: var(--sbd-text); border-color: var(--sbd-muted); }

/* Tabs */
.sb-field-modal-root .sbd-tabs { display: flex; gap: 14px; border-bottom: 1px solid var(--sbd-border); }
.sb-field-modal-root .sbd-tab {
  background: none; border: none; padding: 9px 4px; margin-bottom: -1px; cursor: pointer;
  font-size: 12.5px; color: var(--sbd-muted); border-bottom: 2px solid transparent;
}
.sb-field-modal-root .sbd-tab:hover { color: var(--sbd-text); }
.sb-field-modal-root .sbd-tab--active { color: var(--sbd-text); font-weight: 600; border-bottom-color: var(--sbd-accent); }

/* Body: stacked panels. The lineage pane also carries .panels-grid (for its
   descendant card/table rules), so layout props are restated here to win. */
.sb-field-modal-root .sbd-pane { display: flex; flex-direction: column; gap: 14px; padding: 0; align-items: stretch; }

/* Hairline grids: 1px gaps over the hairline colour read as dividers. */
.sb-field-modal-root .sbd-grid {
  display: grid; gap: 1px; background: var(--sbd-hairline);
  border: 1px solid var(--sbd-hairline); border-radius: 12px; overflow: hidden;
}
.sb-field-modal-root .sbd-grid--ident { grid-template-columns: 2fr 0.7fr 1.3fr 1fr; }
.sb-field-modal-root .sbd-grid--class { grid-template-columns: repeat(3, 1fr); }
.sb-field-modal-root .sbd-cell {
  background: var(--sbd-cell-bg); padding: 13px 15px;
  display: flex; flex-direction: column; gap: 5px; min-width: 0;
}
.sb-field-modal-root .sbd-cell--span { grid-column: 1 / -1; }
.sb-field-modal-root .sbd-label {
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sbd-label);
}
.sb-field-modal-root .sbd-cell .field-value,
.sb-field-modal-root .sbd-card .field-value,
.sb-field-modal-root .sbd-row .field-value { font-size: 14px; color: var(--sbd-text); }
.sb-field-modal-root .sbd-accent, .sb-field-modal-root .sbd-cell .field-value.sbd-accent { color: var(--sbd-accent); }
.sb-field-modal-root .sbd-program { color: var(--sbd-purple); }
.sb-field-modal-root .sbd-category { color: var(--sbd-accent); }
.sb-field-modal-root .sbd-empty, .sb-field-modal-root .sbd-cell .field-value.sbd-empty { color: var(--sbd-empty); font-size: 13px; }

/* Finished checkbox — design spec: 16px, 4px radius, dark ground. */
.sb-field-modal-root .sbd-finished-cb {
  width: 16px; height: 16px; border-radius: 4px; accent-color: var(--sbd-accent);
  background: var(--sbd-bg); border: 1.5px solid #2C3833; appearance: auto; cursor: pointer; margin: 2px 0 0;
}
.sb-field-modal-root .sbd-finished-cb:disabled { cursor: default; opacity: .6; }

/* Edit pencils: cards.css reveals .icon-btn only via .field-row:hover — the
   redesign's containers are .sbd-cell/.sbd-card/.sbd-row, so restate the
   reveal for them (faint at rest so the affordance is discoverable). */
.sb-field-modal-root .sbd-cell .icon-btn,
.sb-field-modal-root .sbd-card .icon-btn,
.sb-field-modal-root .sbd-row .icon-btn { opacity: .35; }
.sb-field-modal-root .sbd-cell:hover .icon-btn,
.sb-field-modal-root .sbd-card:hover .icon-btn,
.sb-field-modal-root .sbd-row:hover .icon-btn { opacity: 1; }

/* Marker cards */
.sb-field-modal-root .sbd-cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sb-field-modal-root .sbd-card {
  padding: 14px 15px; border-radius: 12px; background: var(--sbd-cell-bg);
  border: 1px solid var(--sbd-border); display: flex; flex-direction: column; gap: 11px; min-width: 0;
}
.sb-field-modal-root .sbd-chiprow { display: flex; flex-wrap: wrap; gap: 7px; }

/* Remarks rows */
.sb-field-modal-root .sbd-rows {
  display: flex; flex-direction: column; gap: 1px; background: var(--sbd-hairline);
  border: 1px solid var(--sbd-hairline); border-radius: 12px; overflow: hidden;
}
.sb-field-modal-root .sbd-row { background: var(--sbd-cell-bg); padding: 14px 15px; display: flex; gap: 16px; }
.sb-field-modal-root .sbd-rowlabel { width: 132px; flex: none; padding-top: 2px; }
.sb-field-modal-root .sbd-rowvalue { font-size: 14px; line-height: 1.5; min-width: 0; }

/* The old two-column panels-grid no longer wraps this screen; cards that
   remain (Photos, Trials, Parents, Markers, Children, Ancestors) pick up
   the design's surfaces. */
.sb-field-modal-root .sbd-pane .card {
  background: var(--sbd-cell-bg); border: 1px solid var(--sbd-border); border-radius: 12px;
}
.sb-field-modal-root .sbd-pane .card .card-header {
  background: transparent; border-bottom: 1px solid var(--sbd-hairline);
}
.sb-field-modal-root .sbd-pane .panel-title {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sbd-label);
}

/* Photos tab: two-column tile grid (design: 168px tiles); star = default. */
.sb-field-modal-root .sbd-tab-count { font-family: var(--sb-mono, monospace); font-size: 10.5px; color: var(--sbd-label); margin-left: 3px; }
.sb-field-modal-root #sbd-pane-photos .photo-carousel { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; overflow: visible; }
.sb-field-modal-root #sbd-pane-photos .photo-thumb-wrap { width: auto; margin: 0; }
.sb-field-modal-root #sbd-pane-photos .photo-thumb-img-row { width: auto; height: auto; } /* base rule fixes it at 150x150 */
.sb-field-modal-root #sbd-pane-photos .photo-thumb img { width: 100%; height: 168px; object-fit: cover; border-radius: 12px; }
.sb-field-modal-root #sbd-pane-photos .photo-thumb-wrap--best .photo-thumb img { outline: 2px solid var(--sbd-accent); outline-offset: -2px; }
.sb-field-modal-root .btn-photo-best {
  position: absolute; top: 6px; left: 6px; z-index: 5;
  width: 26px; height: 26px; border-radius: 8px; border: none; cursor: pointer;
  background: rgba(12, 18, 16, 0.72); color: #C3CFCA; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sb-field-modal-root .btn-photo-best:hover { color: var(--sbd-accent); }
.sb-field-modal-root .btn-photo-best--on { color: var(--sbd-accent); }

/* Narrow: stack the grids to one column (design: below ~560px). */
@media (max-width: 560px) {
  .sb-field-modal-root .sbd-grid--ident, .sb-field-modal-root .sbd-grid--class { grid-template-columns: 1fr; }
  .sb-field-modal-root .sbd-cards2 { grid-template-columns: 1fr; }
}

/* Copy-to-clipboard toast (press "c" / the panel's Copy chip). Fixed to the
   viewport, so it works inside panels too. */
#sb-copy-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(8px);
  background: #101816; color: #E6EDE9; border: 1px solid #2C3833;
  padding: 8px 16px; border-radius: 9px; font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease;
  z-index: 950;
}
#sb-copy-toast.sb-copy-toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==================
   MARKER EVIDENCE modal (ⓘ on Plant / Plot / Seedbook Detail, desktop).
   Appended to <body> by application.js so panel transforms can't trap it.
   ================== */
.me-open-btn {
  background: none; border: none; cursor: pointer; padding: 0 2px;
  color: var(--sb-accent); font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; vertical-align: middle;
}
.me-open-btn:hover { color: var(--sb-text); }

#marker-evidence-modal { display: none; }
#marker-evidence-modal.me-show { display: block; }
#marker-evidence-modal .me-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 900;
}
#marker-evidence-modal .me-box {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(760px, 94vw); max-height: 80vh; overflow-y: auto; z-index: 910;
  background: var(--sb-surface); border: 1px solid var(--sb-border-2);
  border-radius: 12px; padding: 18px 20px; color: var(--sb-text);
}
.me-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.me-title { font-size: 15px; font-weight: 700; }
.me-subtitle { font-size: 12px; color: var(--sb-text-2); margin-top: 2px; }
.me-head .btn-close { filter: invert(1) grayscale(1) brightness(1.6); opacity: .7; }
.me-head .btn-close:hover { opacity: 1; }
.me-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.me-table th {
  text-align: left; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--sb-text-3); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--sb-border-2);
}
.me-table td { padding: 7px 8px; border-bottom: 1px solid var(--sb-border); vertical-align: top; }
.me-table .mono { font-family: var(--sb-mono, monospace); }
.me-score { font-weight: 700; }
.me-row--used td { background: rgba(52, 211, 153, 0.07); }
.me-row--used td:first-child { box-shadow: inset 2px 0 0 var(--sb-accent); }
.me-row--inherited td { color: var(--sb-text-2); }
.me-muted { color: var(--sb-text-3); }
.me-pills { margin-right: 8px; }
.me-raw { font-size: 11px; color: var(--sb-text-3); }
.me-panel { background: var(--sb-surface-2); border: 1px solid var(--sb-border-2); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.me-panel-label { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sb-text-3); font-weight: 600; margin-bottom: 8px; }
.me-consolidated { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.me-consolidated + .me-consolidated { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--sb-border); }
.me-consolidated-label { flex: 0 0 200px; font-size: 12px; color: var(--sb-text-2); }
.me-update-btn { margin-left: auto; padding: 6px 12px; font-size: 12px; }
.me-uptodate { margin-left: auto; font-size: 11.5px; color: var(--sb-text-3); }
.me-consolidated .me-raw { font-size: 12px; }
.me-empty { color: var(--sb-text-2); font-size: 13px; margin: 8px 0; }
.me-legend { font-size: 11.5px; color: var(--sb-text-3); margin: 10px 0 0; }
