/* Nutrient-solution calculator — page-specific layout on top of shared-styles.
   Sections, forms, tables and buttons come from shared-styles.css; this only
   adds the ion grid, the product checklists and the status colouring the
   balance table needs. Colours are the modern-neutral tokens, never literals. */

/* The rail and the views. Same workspace shape as climate-workspace.css and
   weather.css: a rail column beside the content, plain block flow, and
   deliberately NOT position:sticky — .dash-shell, .dash-main and .container
   set overflow:hidden, and a sticky element cannot stick inside any ancestor
   that does. Views are .tab-content (shared-styles) so the help modal can
   tell which one is open. */
.nut-workspace {
  display: grid;
  grid-template-columns: var(--nut-rail-w, 230px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
}
.nut-workspace:has(.nut-rail--icons) {
  --nut-rail-w: 56px;
}
.nut-main {
  min-width: 0;
}
.nut-view {
  padding-top: 0;
}
.nut-view > * + * {
  margin-top: 1.5rem;
}
/* The result hosts are empty until there is something to say; no gap for them. */
.nut-view > :empty {
  display: none;
}

.nut-rail {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.5rem 0.4rem;
}
.nut-rail__title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.nut-rail__nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.nut-rail__item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.7rem;
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-weight: 600;
  text-align: left;
  line-height: 1.25;
  cursor: pointer;
}
.nut-rail__item svg {
  flex: 0 0 auto;
}
.nut-rail__item:hover {
  background: var(--accent-tint-08);
  color: var(--text-primary);
}
.nut-rail__item[aria-current='page'] {
  background: var(--accent-tint-08);
  color: var(--accent);
}
.nut-rail__label {
  min-width: 0;
}
/* The chevron on the rail's edge. */
.nut-rail__collapse {
  position: absolute;
  top: 1rem;
  right: -14px;
  z-index: 1;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-secondary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}
.nut-rail__collapse:hover {
  color: var(--accent);
  border-color: var(--accent);
}
/* Icons only. */
.nut-rail--icons .nut-rail__label {
  display: none;
}
.nut-rail--icons .nut-rail__item {
  justify-content: center;
  padding: 0.55rem 0;
}
.nut-rail--icons .nut-rail__collapse svg {
  transform: rotate(180deg);
}

/* Which greenhouse the page is about (greenhouse-picker.js). Stacked rather
   than inline: the rail is narrower than the label plus a select. */
.nut-rail__gh {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color, #e5e7eb);
}
.nut-rail__gh label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.nut-rail__gh select {
  width: 100%;
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border-color, #d0d5dd);
  background: var(--bg-card);
  color: var(--text-primary);
}
/* A select cannot shrink to an icon; collapsing the rail hides it. */
.nut-rail--icons .nut-rail__gh {
  display: none;
}

/* Where the calculation's crop came from — the cultivation in /setup, or why
   it could not say. Sits under the crop pickers. */
.nut-crop-setup {
  margin-top: 0.4rem;
}
.nut-crop-setup a {
  color: var(--accent);
}
/* A button that reads as a link: "use <crop> again" belongs in the sentence. */
.nut-link-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

/* Crop recipes: the compact preview under the pickers, and the booklet's
   table in the Crops view. */
.nut-crop-preview {
  margin-top: 0.5rem;
}
.nut-crop-table {
  width: auto;
  border-collapse: collapse;
}
.nut-crop-table th,
.nut-crop-table td {
  padding: 0.3rem 0.55rem;
  font-size: 0.85rem;
  white-space: nowrap;
}
/* Ion symbols keep their case: "Ca²⁺", not "CA²⁺" (thead th uppercases). */
.nut-crop-table thead th {
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  text-transform: none;
  letter-spacing: 0;
  padding: 0.35rem 0.55rem;
}
.nut-crop-table--full td:first-child {
  font-weight: 600;
  color: var(--text-primary);
}
.nut-crop-table__unit {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.nut-crop-preview__micros {
  margin-top: 0.35rem;
}
.nut-crop-notes {
  margin-top: 0.6rem;
}
/* With a tweak in, the preview shows booklet · adjustment · target as rows. */
.nut-crop-table__row {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8rem;
}
.nut-crop-table--adjusted tbody tr:not(:last-child) td,
.nut-crop-table--adjusted tbody tr:not(:last-child) th {
  color: var(--text-muted);
}
.nut-crop-table__target td,
.nut-crop-table__target th {
  color: var(--text-primary);
  font-weight: 600;
  border-top: 1px solid var(--border);
}

/* The recipe as one table: booklet row, adjustment inputs right under it, the
   target that results; macros left, a gap, micronutrients right. */
.nut-recipe-table {
  width: auto;
}
/* Buttons and notes here carry their own display rule; hidden must still win. */
.nut-crop-preview [hidden] {
  display: none !important;
}
.nut-recipe-table th,
.nut-recipe-table td {
  padding: 0.2rem 0.3rem;
}
.nut-recipe-table thead th {
  padding: 0.3rem 0.3rem;
}
/* The adjustment sits exactly under the recipe: every cell right-aligned, and
   a number cell padded by the input's own padding and border, so the digits
   of "13.25" and the "0" in the box below it end on the same line — whatever
   width the column is given. */
.nut-recipe-table thead th.nut-num,
.nut-recipe-table td.nut-num {
  text-align: right;
  padding-right: calc(0.6rem + 1px);
}
.nut-recipe-table td.nut-num:has(input) {
  padding-right: 0.3rem;
}
.nut-recipe-table td.nut-num input {
  display: inline-block;
  vertical-align: middle;
}
/* Sixteen numeric columns have to fit beside the row label: let the label wrap. */
.nut-recipe-table th.nut-crop-table__row {
  white-space: normal;
  max-width: 7.5rem;
  line-height: 1.2;
}
.nut-recipe-table input {
  width: 3.7rem;
  padding: 0.25rem 0.3rem;
  text-align: right;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.nut-recipe__gap {
  width: 0.6rem;
  padding: 0 !important;
  background: transparent !important;
}
.nut-recipe__groups th {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  padding-bottom: 0;
  border-bottom: 0;
  background: transparent;
}
.nut-recipe__groups .nut-recipe__ecph {
  text-align: center;
  white-space: nowrap;
}
.nut-recipe__booklet td {
  color: var(--text-secondary);
}
.nut-recipe__foot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.nut-recipe__foot:empty {
  display: none;
}
.nut-recipe__foot .btn--sm {
  margin-left: auto;
  width: auto;
}

/* The grower's own adjustments under the crop preview: one small cell per macro ion. */
.nut-adjust {
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}
.nut-adjust__head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.nut-adjust__head h4 {
  margin: 0;
}
.nut-adjust__head .btn--sm {
  margin-left: auto;
}
.nut-adjust__group {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}
.nut-adjust__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.5rem;
  margin: 0.3rem 0 0.4rem;
}
.nut-adjust__cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.nut-adjust__cell input {
  padding: 0.4rem 0.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* The grower's own fertilisers: the library table and the label editor. */
.nut-own {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.nut-own__head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.nut-own__head h4 {
  margin: 0;
  margin-right: auto;
}
.nut-own__head select {
  width: auto;
  max-width: 320px;
}
.nut-own-table td {
  vertical-align: top;
}
.nut-own-table td:first-child {
  width: 2.5rem;
}
.nut-own-table .nut-chip {
  white-space: nowrap;
}
.nut-own__meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.nut-own__actions-cell {
  white-space: nowrap;
  text-align: right;
}
.nut-own-editor {
  margin-top: 0.85rem;
  padding: 0.9rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}
.nut-own-editor h5 {
  margin: 0 0 0.5rem;
}
.nut-own__name {
  flex: 1 1 260px;
}
.nut-own__basis {
  margin-top: 0.5rem;
}
.nut-own__basis .nut-radio-row {
  margin-top: 0.25rem;
}
.nut-own__grid {
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
}
.nut-own__per100 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.nut-own__actions {
  margin-top: 0.75rem;
}
.nut-own__actions .btn-primary,
.nut-own__actions .btn-secondary {
  width: auto;
  flex: 0 0 auto;
}
.nut-own [hidden] {
  display: none;
}

/* The recipe's own balance: chip beside the ion that closes it. */
.nut-balance {
  display: flex;
  align-items: flex-start;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  margin: 0.25rem 0 0.75rem;
}
.nut-balance__chip {
  padding-top: 0.35rem;
  min-height: 1.6rem;
}
.nut-balance__chip .nut-note {
  margin: 0.5rem 0 0;
}
.nut-balance__pick {
  flex: 1 1 260px;
  max-width: 420px;
}
/* The floating ion: written by the page, not the grower. */
.nut-recipe-table input.nut-floating[readonly] {
  border-color: var(--accent);
  background: var(--accent-tint-08);
  color: var(--text-secondary);
}
.nut-recipe-table td[data-own-ec],
.nut-recipe-table td[data-own-ph] {
  color: var(--text-secondary);
}
.nut-crop-source {
  font-size: 0.72rem;
}
.nut-crops-title {
  margin: 0.25rem 0 0.5rem;
}
.nut-crops-title em {
  font-weight: 400;
  color: var(--text-muted);
}
.nut-crops-adj-h {
  margin: 1rem 0 0.35rem;
  font-size: 0.9rem;
}
.nut-crops-adj {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.nut-crops-adj li {
  margin: 0.15rem 0;
}

/* The Dashboard view: chips, legend and four stacked panels on one time axis. */
.nut-dash h3 {
  margin-top: 0;
}
.nut-dash__filters {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.nut-dash__chips,
.nut-dash__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
}
.nut-dash__chip,
.nut-dash__source {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.nut-dash__chip[aria-pressed='true'] {
  background: var(--accent-tint-08);
  border-color: var(--accent);
  color: var(--accent);
}
.nut-dash__source.is-off {
  opacity: 0.45;
  text-decoration: line-through;
}
.nut-dash__source small {
  color: var(--text-muted);
}
.nut-dash__swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: none;
}
.nut-dash__key {
  margin: 0;
}
.nut-dash__panels {
  display: grid;
  gap: 0.75rem;
}
.nut-dash__panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.75rem 0.4rem;
  background: var(--surface, #fff);
}
.nut-dash__panel h4 {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
}
.nut-dash__panel h4 small {
  color: var(--text-muted);
  font-weight: 400;
}
.nut-dash__svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: inherit;
}
.nut-dash__pt:hover,
.nut-dash__gap:hover {
  filter: brightness(0.85);
}

/* The Calculation view's summary strip: what it runs on, from the other views. */
.nut-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}
.nut-summary__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  padding: 0.35rem 0.4rem 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.85rem;
}
.nut-summary__label {
  color: var(--text-muted);
}
.nut-summary__value {
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}
.nut-summary__sub {
  color: var(--text-muted);
}

/* Narrow: the rail becomes a strip above the view; no icon mode. */
@media (max-width: 900px) {
  .nut-workspace,
  .nut-workspace:has(.nut-rail--icons) {
    grid-template-columns: minmax(0, 1fr);
  }
  .nut-rail__nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 0.25rem;
  }
  .nut-rail__item {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }
  .nut-rail__collapse {
    display: none;
  }
  .nut-rail--icons .nut-rail__label {
    display: inline;
  }
  .nut-rail--icons .nut-rail__item {
    justify-content: flex-start;
    padding: 0.55rem 0.8rem;
  }
}

.nut-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.nut-section-head h3 {
  margin-bottom: 0.25rem;
}
.nut-section-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* The batch import panel: many reports in, one review row each. */
.nut-import {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.6rem 0.9rem 0.7rem;
  margin: 0.5rem 0 0.75rem;
}
.nut-import.is-dragover {
  border-color: var(--accent);
  background: var(--accent-tint-08);
}
.nut-import__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.nut-import__head h4 {
  margin: 0;
}
.nut-import .help-text {
  margin: 0.35rem 0 0;
}
.nut-import__actions {
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}
/* .nut-actions sets display:flex, which would beat the hidden attribute. */
.nut-import [hidden] {
  display: none;
}
.nut-batch-table {
  margin-top: 0.6rem;
}
.nut-batch-table td {
  vertical-align: top;
}
.nut-import__file {
  font-weight: 600;
  color: var(--text-primary);
}
.nut-import__failed td {
  color: var(--danger);
}
.nut-import__select {
  display: block;
  width: 100%;
  min-width: 12rem;
  margin-top: 0.3rem;
  padding: 0.35rem 0.45rem;
  font-size: 0.85rem;
}
.nut-import__name {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.35rem 0.45rem;
  font-size: 0.85rem;
}
.nut-import__cult {
  margin-top: 0.3rem;
}
.nut-batch-table .nut-note {
  margin-top: 0.35rem;
  font-size: 0.8rem;
}

/* "Belongs to" in a single card's import preview: two columns of the same
   pieces the batch rows use. */
.nut-belongs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.5rem 1rem;
  margin: 0.5rem 0 0.75rem;
}
.nut-belongs__col .help-text {
  margin: 0;
}

/* Source cards: one per water, stamped from a template. */
.nut-source {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.6rem 0.75rem 0.7rem;
  margin: 0.5rem 0;
}
.nut-source__head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.nut-source__name {
  flex: 1 1 200px;
  min-width: 160px;
  padding: 0.5rem 0.6rem;
  font-weight: 600;
}
.nut-source__kind {
  flex: 0 1 190px;
  padding: 0.5rem 0.6rem;
}
/* The one primary action on a card: name it, fill it, save it — at the right
   of the row that holds the name. Everything else on the card is secondary. */
.nut-source__save {
  width: auto;
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}
.nut-source__save[disabled] {
  opacity: 0.6;
  cursor: progress;
}
.nut-source__actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.45rem;
  align-items: center;
}
/* Pushes Example / Clear / Remove to the far right of the utility row. */
.nut-source__spacer {
  flex: 1 1 0;
}
.nut-source__library {
  flex: 0 1 220px;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
}
/* The composition card: one row per source, the shares side by side, and the
   sum in the header. Red when they do not make 100 %; the calculation refuses
   the same state, so the card says it first. */
.nut-mix {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.6rem 0.9rem 0.5rem;
  margin: 0.75rem 0 0.5rem;
}
.nut-mix__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.nut-mix__head h4 {
  margin: 0;
}
.nut-mix__sum {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--success);
}
.nut-mix--bad .nut-mix__sum {
  color: var(--danger);
}
.nut-mix__rows {
  margin-top: 0.4rem;
}
.nut-mix__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--border);
}
.nut-mix__row:first-child {
  border-top: 0;
}
.nut-mix__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nut-mix__field {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.nut-mix__field input {
  width: 6.5rem;
  padding: 0.45rem 0.6rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.nut-mix--bad .nut-mix__field input {
  border-color: var(--danger);
}
.nut-mix .help-text {
  margin: 0.45rem 0 0;
}

/* Ten ions on one line. The tile is redrawn compact for it: symbol and unit
   share the top row, the name is one small line, the input fills the width.
   Under 1100px the row splits in two; on a phone the shared auto-fill grid
   takes over again. */
.nut-ion-grid__caption {
  margin-top: 0.55rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.nut-ion-grid.nut-ion-grid--source {
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0.2rem 0 0.4rem;
}
@media (max-width: 1100px) {
  .nut-ion-grid.nut-ion-grid--source {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .nut-ion-grid.nut-ion-grid--source {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}
.nut-ion-grid--source .nut-ion {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    'sym'
    'name'
    'input';
  gap: 0.1rem;
  padding: 0.4rem 0.5rem 0.45rem;
  min-width: 0;
}
.nut-ion-grid--source .nut-ion__sym {
  grid-area: sym;
  font-size: 0.88rem;
  white-space: nowrap;
}
.nut-ion-grid--source .nut-ion__unit {
  display: none;
}
.nut-ion-grid--source .nut-ion__name {
  grid-area: name;
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nut-ion-grid--source .nut-ion input {
  grid-area: input;
  width: 100%;
  min-width: 0;
  padding: 0.3rem 0.4rem;
  font-size: 0.9rem;
  margin-top: 0.15rem;
}

/* pH, measured EC and the micronutrients share one row. */
.nut-source__row2 {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}
.nut-source__field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.nut-source__field span {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.nut-source__field input {
  width: 8.5rem;
  padding: 0.3rem 0.45rem;
  font-size: 0.9rem;
}
/* The six micronutrients move to the next line as one group, never split. */
.nut-micro-group {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem 0.5rem;
  flex-wrap: nowrap;
}
.nut-micro-row__label {
  font-size: 0.7rem;
  color: var(--text-muted);
  align-self: center;
  padding-bottom: 0.35rem;
  white-space: nowrap;
}
.nut-source__note {
  margin-top: 0.4rem;
}
.nut-source__note:empty {
  display: none;
}
.nut-source__meta {
  margin-top: 0.35rem;
  font-size: 0.75rem;
}
.nut-source__meta:empty {
  display: none;
}
.nut-source__panel {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}
.nut-source__panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.nut-source__panel-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.nut-import-table td,
.nut-import-table th,
.nut-history-table td,
.nut-history-table th {
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
}
tr.nut-row--inuse td {
  background: var(--accent-tint-08);
}
.nut-scroll {
  overflow-x: auto;
}

/* Table headers are uppercased; "µ" would become a Greek capital mu — an M. */
.nut-th--keepcase {
  text-transform: none;
}

/* Micronutrient cells in a source card: element and a narrow input. */
.nut-micro-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.nut-micro-cell input {
  width: 4rem;
  padding: 0.3rem 0.4rem;
  font-size: 0.9rem;
  text-align: right;
}

/* Blend table: a column per source and the blend. */
.nut-blend-table th.nut-blend-col,
.nut-blend-table td.nut-blend-col {
  font-weight: 600;
  color: var(--text-primary);
  background: var(--accent-tint-08);
}
.nut-drain-helpers {
  margin: 0.75rem 0;
}
.nut-drain-helpers summary {
  cursor: pointer;
}

/* One tile per ion: chemical label, input, unit. */
.nut-ion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 0.5rem;
}
.nut-ion {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}
.nut-ion__sym {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.1;
}
.nut-ion__name {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.nut-ion input {
  padding: 0.5rem 0.6rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.nut-ion__unit {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
}

.nut-inline {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}
.nut-inline .input-item {
  min-width: 160px;
}

/* Target-source radios read as a segmented control. */
.nut-radio-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.nut-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.nut-radio input {
  margin: 0;
  padding: 0;
  width: auto;
  accent-color: var(--accent);
}
.nut-radio:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-tint-08);
  color: var(--text-primary);
}

/* Steiner ratio inputs: two compact rows. */
.nut-ratios {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 760px) {
  .nut-ratios {
    grid-template-columns: 1fr;
  }
}
.nut-ratio-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.5rem;
}
.nut-ratio-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.nut-ratio-group input {
  padding: 0.45rem 0.55rem;
  text-align: right;
}
.nut-ratio-sum {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Product checklists. */
.nut-products {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 900px) {
  .nut-products {
    grid-template-columns: 1fr;
  }
}
.nut-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.35rem 1rem;
}
.nut-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding: 0.35rem 0;
  cursor: pointer;
}
.nut-check input {
  margin: 0;
  padding: 0;
  width: auto;
  accent-color: var(--accent);
}
.nut-check__formula {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Micronutrient rows: target and product side by side. */
.nut-micro-table td input,
.nut-micro-table td select {
  padding: 0.45rem 0.6rem;
  width: 100%;
  min-width: 90px;
}
.nut-micro-table td input {
  text-align: right;
  max-width: 120px;
}

/* Calculate row. */
.nut-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1.5rem;
}

/* Results. */
.nut-results:empty {
  display: none;
}
.nut-props {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.nut-prop {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
}
.nut-prop__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.nut-prop__value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.nut-prop__sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.nut-readout-h {
  margin-top: 1rem;
}
.nut-ion-sym {
  font-weight: 600;
  color: var(--text-primary);
}
.nut-ion-name-inline {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.nut-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
thead th.nut-num {
  text-align: right;
}

.nut-diff--ok {
  color: var(--success);
}
.nut-diff--short {
  color: var(--warning);
  font-weight: 600;
}
.nut-diff--over {
  color: var(--danger);
  font-weight: 600;
}
tr.nut-row--off td {
  color: var(--text-muted);
}

.nut-note {
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0.75rem 0;
}
.nut-note--warn {
  border-left-color: var(--warning);
  background: var(--warning-bg);
  color: var(--warning);
}
.nut-note--bad {
  border-left-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
}
.nut-note--ok {
  border-left-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}

.nut-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  vertical-align: middle;
}
.nut-chip--ok {
  background: var(--success-bg);
  color: var(--success);
}
.nut-chip--warn {
  background: var(--warning-bg);
  color: var(--warning);
}
.nut-chip--bad {
  background: var(--danger-bg);
  color: var(--danger);
}

/* The "?" and its popover now live in css/shared-styles.css as .hh-info*,
   so light and the rest can have one too. */

/* Stock tanks: A and B side by side, each its own table. */
.nut-tanks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 1.5rem;
  margin: 0.75rem 0;
}
/* A grid child does not shrink below its table by default: let it, and scroll the table. */
.nut-tank {
  min-width: 0;
  overflow-x: auto;
}
@media (max-width: 900px) {
  .nut-tanks {
    grid-template-columns: 1fr;
  }
}
.nut-tank h5 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--text-primary);
}
.nut-tank table {
  margin-bottom: 0.35rem;
}
.nut-tank__total {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}
.nut-share {
  color: var(--text-muted);
  font-size: 0.8rem;
}
/* Each ion's share of the EC, and what each dose supplies: the audit columns.
   Eight columns have to fit, so these two tables sit tighter than the rest. */
.nut-audit-table thead th,
.nut-audit-table tbody td {
  padding: 0.6rem 0.65rem;
}
.nut-audit-table thead th.nut-th--keepcase {
  text-transform: none;
}
.nut-share-col {
  color: var(--text-secondary);
}
.nut-supplies {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.nut-formula {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Saved setups row. */
.nut-setups {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.nut-setups .input-item {
  min-width: 200px;
}
.nut-setups .btn-secondary,
.nut-setups .btn-primary {
  align-self: flex-end;
}
