/* agroNET components (research R17, layer 2): only what Bootstrap doesn't have, prefix ag-, BEM-lite
   (block, __element, --modifier). Built from theme.css tokens only: no colour values here. */

/* ---------- KPI tile ---------- */
.ag-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: var(--agronet-space-3);
}

.ag-kpi {
    background: var(--agronet-surface);
    border: 1px solid var(--agronet-border);
    border-radius: var(--agronet-radius-md);
    padding: 9px var(--agronet-space-3);
    min-width: 0;
}

.ag-kpi__label {
    font-family: var(--agronet-font-mono);
    font-size: 10.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--agronet-text-muted);
}

.ag-kpi__value {
    font-size: 20px;
    font-weight: 700;
    color: var(--agronet-text);
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}

.ag-kpi__sub {
    font-size: var(--agronet-font-size-sm);
    color: var(--agronet-text-muted);
    font-variant-numeric: tabular-nums;
}

/* As the mockup: the state colours the sub-line ("standard X", "−N since placement"), the value stays ink. */
.ag-kpi--bad .ag-kpi__sub,
.ag-kpi__sub--bad { color: var(--agronet-status-urgent); }

.ag-kpi--warn .ag-kpi__sub { color: var(--agronet-status-today); }

.ag-kpi--ok .ag-kpi__sub,
.ag-kpi--good .ag-kpi__sub,
.ag-kpi__sub--good { color: var(--agronet-status-ok); }

/* ---------- Removable filter chip ---------- */
.ag-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--agronet-space-1);
    max-width: 100%;
    border: 1px solid var(--agronet-border);
    border-radius: var(--agronet-radius-pill);
    background: var(--agronet-surface);
    color: var(--agronet-text);
    padding: 2px 4px 2px 10px;
    font-size: var(--agronet-font-size-sm);
    font-weight: 600;
}

.ag-chip__remove {
    border: 0;
    background: transparent;
    color: var(--agronet-text-muted);
    padding: 0 6px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.ag-chip__remove:focus-visible { outline: 2px solid var(--agronet-green-bright); outline-offset: 1px; }

/* ---------- Status: pill and dot (always next to a text label) ---------- */
.ag-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: var(--agronet-radius-pill);
    padding: 1px 9px;
    font-size: var(--agronet-font-size-sm);
    font-weight: 600;
    white-space: nowrap;
    background: var(--agronet-status-neutral-bg);
    color: var(--agronet-text-muted);
}

.ag-pill--urgent { background: var(--agronet-status-urgent-bg); color: var(--agronet-status-urgent); }
.ag-pill--today { background: var(--agronet-status-today-bg); color: var(--agronet-status-today); }
.ag-pill--planned { background: var(--agronet-status-planned-bg); color: var(--agronet-status-planned); }
.ag-pill--ok { background: var(--agronet-status-ok-bg); color: var(--agronet-status-ok); }
.ag-pill--neutral { background: var(--agronet-surface-soft); color: var(--agronet-text-muted); border: 1px solid var(--agronet-border); }

.ag-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--agronet-status-neutral);
}

.ag-dot--urgent { background: var(--agronet-status-urgent); }
.ag-dot--today { background: var(--agronet-status-today); }
.ag-dot--planned { background: var(--agronet-status-planned); }
.ag-dot--ok { background: var(--agronet-status-ok); }
.ag-dot--neutral { background: var(--agronet-status-neutral); }

/* ---------- Segmented control: on a Bootstrap .btn-group ---------- */
.ag-seg {
    border: 1px solid var(--agronet-border-strong);
    border-radius: 9px;
    overflow: hidden;
    background: var(--agronet-surface);
}

.ag-seg > .btn {
    --bs-btn-padding-y: 5px;
    --bs-btn-padding-x: 12px;
    --bs-btn-font-size: 13px;
    --bs-btn-border-width: 0;
    --bs-btn-color: var(--agronet-text);
    --bs-btn-hover-bg: var(--agronet-surface-soft);
    --bs-btn-hover-color: var(--agronet-text);
    border-radius: 0;
}

.ag-seg > .btn.active,
.ag-seg > .btn[aria-pressed="true"],
.ag-seg > .btn-check:checked + .btn {
    background: var(--agronet-green);
    color: var(--agronet-surface);
    font-weight: 600;
}

.ag-seg > .btn:disabled { opacity: 0.4; }

/* The group clips its buttons (rounded box), so Bootstrap's focus glow never shows: an inset ring instead (SC-6). */
.ag-seg > .btn:focus-visible,
.ag-seg > .btn-check:focus-visible + .btn {
    outline: 2px solid var(--agronet-green-bright);
    outline-offset: -3px;
    box-shadow: none;
    z-index: 1;
}

/* ---------- Note ---------- */
.ag-note {
    background: var(--agronet-status-planned-bg);
    color: var(--agronet-status-planned);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12.5px;
}

.ag-note--warn { background: var(--agronet-status-today-bg); color: var(--agronet-status-today); }

/* ---------- Chart card: d3 sets these classes, colours come from tokens ---------- */
.ag-chart { position: relative; min-width: 0; }

.ag-chart__legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--agronet-space-1) var(--agronet-space-3);
    margin-bottom: var(--agronet-space-2);
    font-size: var(--agronet-font-size-sm);
}

.ag-chart__legend button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 0;
    padding: 2px 0;
    color: var(--agronet-text);
}

.ag-chart__legend button[aria-pressed="false"] { color: var(--agronet-text-muted); text-decoration: line-through; }
.ag-chart__legend button[aria-pressed="false"] .ag-chart__key { opacity: 0.35; }

.ag-chart__key {
    display: inline-block;
    width: 18px;
    border-top: 3px solid currentcolor;
}

.ag-chart__key--dashed { border-top-style: dashed; }
.ag-chart__key--dots { border-top-style: dotted; border-top-width: 4px; }

.ag-chart__svg { display: block; width: 100%; height: auto; overflow: visible; }
.ag-chart__svg:focus { outline: none; }
.ag-chart__svg:focus-visible { outline: 2px solid var(--agronet-green-bright); outline-offset: 2px; }
/* A sideways-scrolling table box made focusable by site.js: show where the keyboard is. */
[data-scroll-focus]:focus-visible { outline: 2px solid var(--agronet-green-bright); outline-offset: 2px; }

.ag-chart__svg text {
    font-size: 11px;
    fill: var(--agronet-text-muted);
    font-variant-numeric: tabular-nums;
}

.ag-chart__grid line { stroke: var(--agronet-chart-grid); }
.ag-chart__axis line,
.ag-chart__axis path { stroke: var(--agronet-border-strong); }

.ag-chart__note { margin-top: 6px; font-size: var(--agronet-font-size-sm); color: var(--agronet-text-muted); }

/* Series: line stroke and dot fill from the series token, set as "color" so a legend key can use currentcolor. */
.ag-series-1 { color: var(--agronet-series-1); }
.ag-series-2 { color: var(--agronet-series-2); }
.ag-series-3 { color: var(--agronet-series-3); }
.ag-series-4 { color: var(--agronet-series-4); }
.ag-series-std { color: var(--agronet-series-standard); }

.ag-chart__line { fill: none; stroke: currentcolor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ag-series-std .ag-chart__line,
.ag-chart__line--dashed { stroke-dasharray: 5 4; stroke-width: 1.5; }
.ag-chart__dot { fill: currentcolor; stroke: var(--agronet-surface); stroke-width: 2; }
.ag-chart__bar { fill: currentcolor; }
.ag-chart__bar--dim { fill-opacity: 0.45; }
.ag-chart__ref { stroke: var(--agronet-text); stroke-width: 2; stroke-dasharray: 4 3; pointer-events: none; }

/* A target band: a very light tint between dashed edges. */
.ag-band { fill: var(--agronet-band); fill-opacity: 0.4; }
.ag-band__edge { fill: none; stroke: var(--agronet-status-ok); stroke-width: 1.25; stroke-dasharray: 5 4; opacity: 0.7; pointer-events: none; }
.ag-band__label { fill: var(--agronet-status-ok); }
.ag-today { stroke: var(--agronet-border-strong); stroke-dasharray: 3 3; }
.ag-crosshair { stroke: var(--agronet-text-muted); stroke-width: 1; pointer-events: none; }
/* A bar past its end (a broiler cycle past its planned length, CycleDays): amber. */
.ag-bar--over > span { background: var(--agronet-status-today); }

/* Zoom (lineChart.js): a crosshair cursor over the plot, the stretch being selected in green, and Reset zoom at the
   chart's top right while zoomed. */
.ag-chart__svg { cursor: crosshair; user-select: none; -webkit-user-select: none; }
.ag-chart__brush { fill: var(--agronet-green); fill-opacity: .12; stroke: var(--agronet-green); stroke-width: 1; pointer-events: none; }
.ag-chart__zoom-reset {
    position: absolute; top: 0; right: 0; z-index: 1; padding: 2px 10px; font-size: 12px;
    border: 1px solid var(--agronet-border-strong); background: var(--agronet-surface); color: var(--agronet-text);
}
.ag-chart__zoom-reset:hover { border-color: var(--agronet-green); color: var(--agronet-green); }
.ag-chart__focus { fill: currentcolor; stroke: var(--agronet-surface); stroke-width: 2; pointer-events: none; }

.ag-tooltip {
    position: fixed;
    z-index: 1080;
    background: var(--agronet-surface);
    color: var(--agronet-text);
    border: 1px solid var(--agronet-border-strong);
    border-radius: 9px;
    box-shadow: var(--agronet-shadow-pop);
    padding: 7px 10px;
    font-size: 12.5px;
    pointer-events: none;
    white-space: nowrap; /* a chart tooltip is a small table: one line per row, as wide as it needs */
}

.ag-tooltip__title { font-weight: 700; margin-bottom: 2px; }

.ag-tooltip__row {
    display: flex;
    gap: var(--agronet-space-2);
    justify-content: space-between;
    font-variant-numeric: tabular-nums;
}

.ag-tooltip__key { display: inline-block; width: 10px; height: 3px; margin-right: 6px; vertical-align: middle; background: currentcolor; }

/* ---------- Table: sticky header rows; above phone width a long table scrolls in its own box (FR-SH-11) ---------- */
.ag-table { overflow-x: auto; }

.ag-table > table { margin-bottom: 0; font-variant-numeric: tabular-nums; }

.ag-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--agronet-surface);
    box-shadow: inset 0 -1px 0 var(--agronet-border-strong);
}

.ag-table thead tr + tr th { top: 28px; }

@media (min-width: 641px) {
    .ag-table { max-height: 75vh; }
}

/* ---------- Data sheet: the activity book grid ---------- */
.ag-sheet {
    overflow: auto;
    max-height: 75vh;
    border: 1px solid var(--agronet-border);
    border-radius: var(--agronet-radius-md);
    background: var(--agronet-surface);
}

.ag-sheet > table {
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.ag-sheet th,
.ag-sheet td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--agronet-border);
    white-space: nowrap;
}

.ag-sheet thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--agronet-surface-soft);
    font-weight: 600;
    text-align: center;
}

.ag-sheet thead tr + tr th { top: 28px; }

.ag-sheet__sticky {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--agronet-surface);
    box-shadow: inset -1px 0 0 var(--agronet-border);
}

.ag-sheet thead .ag-sheet__sticky { z-index: 4; background: var(--agronet-surface-soft); }

.ag-sheet__cell--editable input {
    width: 100%;
    min-width: 64px;
    border: 1px solid var(--agronet-border);
    border-radius: 4px;
    padding: 2px 6px;
    text-align: right;
    background: var(--agronet-surface);
    color: var(--agronet-text);
}

.ag-sheet__cell--editable input:focus { outline: 2px solid var(--agronet-green-bright); outline-offset: -1px; }
.ag-sheet__cell--locked { color: var(--agronet-text-muted); background: var(--agronet-surface-soft); }
.ag-sheet__cell--changed input { background: var(--agronet-status-today-bg); }
.ag-sheet__cell--error input { border-color: var(--agronet-status-urgent); background: var(--agronet-status-urgent-bg); }
.ag-sheet__row--today > td,
.ag-sheet__row--today > .ag-sheet__sticky { background: var(--agronet-status-planned-bg); }

/* ---------- Empty state ---------- */
.ag-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--agronet-space-2);
    padding: var(--agronet-space-6) var(--agronet-space-4);
    text-align: center;
    color: var(--agronet-text-muted);
}

.ag-empty__icon { display: inline-flex; opacity: 0.6; }
.ag-empty__icon .ag-icon { width: 28px; height: 28px; }

/* ---------- Map: markers use the status tokens ---------- */
.ag-map {
    position: relative;
    min-height: 320px;
    border-radius: var(--agronet-radius-md);
    overflow: hidden;
    background: var(--agronet-surface-soft);
}

.ag-map__layer { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.ag-map__layer .ag-marker,
.ag-map__layer .ag-farm-area { pointer-events: auto; }
.ag-map__fallback-note { position: absolute; left: 8px; bottom: 8px; z-index: 2; }

/* A farm on the map, as the mockup's farm box: a translucent card with a dashed border and the farm's name. */
.ag-farm-area { cursor: pointer; outline: none; }
.ag-farm-area__box {
    fill: var(--agronet-surface);
    fill-opacity: 0.6;
    stroke: var(--agronet-border-strong);
    stroke-width: 1;
    stroke-dasharray: 4 3;
}
.ag-farm-area:hover .ag-farm-area__box,
.ag-farm-area:focus-visible .ag-farm-area__box { stroke: var(--agronet-green); fill-opacity: 0.75; }
.ag-farm-area__name { font-size: 11px; font-weight: 600; fill: var(--agronet-text); pointer-events: none; }

.ag-marker { cursor: pointer; color: var(--agronet-status-neutral); }
.ag-marker rect { fill: var(--agronet-surface); stroke: currentcolor; stroke-width: 2; }
.ag-marker text { font-size: 11px; font-weight: 600; fill: var(--agronet-text); }
.ag-marker .ag-marker__status { fill: currentcolor; }
.ag-marker--urgent { color: var(--agronet-status-urgent); }
.ag-marker--today { color: var(--agronet-status-today); }
.ag-marker--planned { color: var(--agronet-status-planned); }
.ag-marker--ok { color: var(--agronet-status-ok); }
.ag-marker--selected rect { stroke-width: 3; fill: var(--agronet-status-planned-bg); }
.ag-marker:focus { outline: none; }
.ag-marker:focus-visible rect { stroke: var(--agronet-green-bright); stroke-width: 3; }
/* A house whose label would overlap another: its status dot in a white halo (label in the tooltip). */
.ag-marker--compact .ag-marker__halo { fill: var(--agronet-surface); stroke: currentcolor; stroke-width: 1.5; }
.ag-marker--compact.ag-marker--selected .ag-marker__halo,
.ag-marker--compact:focus-visible .ag-marker__halo { stroke: var(--agronet-green-bright); stroke-width: 3; }
.ag-marker--pin { color: var(--agronet-status-urgent); }

@media (prefers-reduced-motion: reduce) {
    .ag-chart *,
    .ag-map * { transition: none !important; }
}

/* ---------- List table: the mockup's tables (mono uppercase headers, quiet rows, clickable rows) ---------- */
.ag-list-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.ag-list-table th {
    font-family: var(--agronet-font-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--agronet-text-muted);
    text-align: start;
    padding: 6px 10px;
    white-space: nowrap;
}

.ag-list-table td { padding: 8px 10px; border-bottom: 1px solid var(--agronet-border); vertical-align: middle; }
.ag-list-table .ag-num { text-align: end; white-space: nowrap; }
/* Clickable rows (MT-L): the whole row opens the item (rowLinks.js); Enter on a focused row too. */
.ag-list-table tr[data-href],
.ag-list-table tr.ag-row-link { cursor: pointer; transition: background-color var(--ag-motion-fast, 0.15s) ease-out, opacity var(--ag-motion, 0.25s) ease-out; }
.ag-list-table tr[data-href]:hover,
.ag-list-table tr.ag-row-link:hover { background: var(--agronet-surface-soft); }
.ag-list-table tr.ag-row-link:focus-visible { outline: 2px solid var(--agronet-green); outline-offset: -2px; }
.ag-list-table tr.is-removing { opacity: 0; }
/* Delete on a row (MT-L): a borderless outline trash icon, red on hover and focus; it never opens the row. */
.ag-list-table td.ag-row-actions { width: 1%; white-space: nowrap; text-align: end; }
.ag-row-delete {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px;
    background: transparent; color: var(--agronet-text-muted); cursor: pointer;
    transition: color var(--ag-motion-fast, 0.15s) ease-out, background-color var(--ag-motion-fast, 0.15s) ease-out;
}
.ag-row-delete .ag-icon { width: 18px; height: 18px; }
.ag-row-delete:hover, .ag-row-delete:focus-visible { color: var(--agronet-status-urgent); background: var(--agronet-status-urgent-bg); }
.ag-row-delete:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.ag-row-delete:disabled { opacity: 0.4; cursor: not-allowed; }
.ag-list-table__link { color: var(--agronet-status-planned); }
.ag-list-table__chev { width: 1%; color: var(--agronet-green); font-size: 22px; line-height: 1; opacity: 0; transition: opacity 0.12s; }
.ag-list-table tr[data-href]:hover .ag-list-table__chev,
.ag-list-table tr[data-href]:focus-within .ag-list-table__chev,
.ag-list-table tr.ag-row-link:hover .ag-list-table__chev,
.ag-list-table tr.ag-row-link:focus-visible .ag-list-table__chev { opacity: 1; }
.ag-list-table__empty { color: var(--agronet-text-muted); }

/* ---------- Farm picker (_FarmPicker): caption "Farm", name, attention badge; searchable list of links ---------- */
.ag-farm { position: relative; min-width: 0; }

.ag-farm__button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--agronet-border-strong);
    border-radius: 10px;
    background: var(--agronet-surface-soft);
    color: var(--agronet-text);
    text-align: start;
}

.ag-farm__button:hover,
.ag-farm__button[aria-expanded="true"] { border-color: var(--agronet-green); }
.ag-farm__text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.ag-farm__text small { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; color: var(--agronet-text-muted); }
.ag-farm__text b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-farm__caret { color: var(--agronet-text-muted); font-size: 12px; }

.ag-farm__menu {
    position: absolute;
    top: 48px;
    left: 0;
    z-index: 30;
    width: min(320px, calc(100vw - 32px));
    max-height: min(380px, 60vh);
    overflow: auto;
    padding: 8px;
    background: var(--agronet-surface);
    border: 1px solid var(--agronet-border-strong);
    border-radius: var(--agronet-radius-lg);
    box-shadow: var(--agronet-shadow-pop);
}

.ag-farm__menu input { margin-bottom: 4px; }

.ag-farm__option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 7px;
    color: var(--agronet-text);
    font-size: 13.5px;
    text-decoration: none;
}

.ag-farm__option:hover,
.ag-farm__option:focus-visible { background: var(--agronet-surface-soft); color: var(--agronet-text); }
.ag-farm__option[aria-selected="true"] { background: var(--agronet-green-bg); color: var(--agronet-green-ink); font-weight: 600; }
.ag-farm__count { margin-left: auto; font-size: 12px; color: var(--agronet-text-muted); }

.ag-farm__badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--agronet-radius-pill);
    display: inline-grid;
    place-items: center;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1;
    color: var(--agronet-on-dark);
}

.ag-farm__badge--urgent { background: var(--agronet-status-urgent); }
.ag-farm__badge--today { background: var(--agronet-status-today); }
.ag-farm__badge--planned { background: var(--agronet-status-planned); }

/* ---------- Progress bar: "day N of P" (house heading, activity book rows) ---------- */
.ag-bar {
    display: block;
    height: 6px;
    border-radius: var(--agronet-radius-pill);
    background: var(--agronet-border);
    overflow: hidden;
}

.ag-bar > span { display: block; height: 100%; background: var(--agronet-green); border-radius: inherit; }

/* ---------- Multi-select dropdown (_MultiPick, multiPick.js): checkboxes with a filter, Check all, Uncheck all ---------- */
.ag-pick__toggle { text-align: start; }
.ag-pick__menu { width: 100%; padding: 8px; }
.ag-pick__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 6px; }
.ag-pick__tools .form-control { flex: 1 1 180px; }
.ag-pick__list { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; }
.ag-pick__list .form-check { padding: 4px 0 4px 1.75em; margin: 0; }
.ag-pick__sub { margin-left: 4px; font-size: 11.5px; color: var(--agronet-text-muted); }
.ag-pick__empty { margin: 4px 2px; font-size: 13px; color: var(--agronet-text-muted); }

/* Bootstrap's red outline button (#dc3545) is under 4.5:1 on the light surfaces; the theme's red text (axe, SC-6). */
.btn-outline-danger {
    --bs-btn-color: var(--agronet-status-urgent);
    --bs-btn-border-color: var(--agronet-status-urgent);
    --bs-btn-hover-bg: var(--agronet-status-urgent);
    --bs-btn-hover-border-color: var(--agronet-status-urgent);
    --bs-btn-active-bg: var(--agronet-status-urgent);
    --bs-btn-active-border-color: var(--agronet-status-urgent);
}

/* ======================= Motion (MT-G5): small transitions app-wide, built on the theme's motion tokens ======================= */
.ag-tabs__tab { transition: color var(--ag-motion-fast) var(--ag-ease-out), border-color var(--ag-motion) var(--ag-ease-out); }
.btn { transition: color var(--ag-motion-fast) var(--ag-ease-out), background-color var(--ag-motion-fast) var(--ag-ease-out),
    border-color var(--ag-motion-fast) var(--ag-ease-out), box-shadow var(--ag-motion-fast) var(--ag-ease-out), transform var(--ag-motion-fast) var(--ag-ease-out); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.form-control, .form-select { transition: border-color var(--ag-motion-fast) var(--ag-ease-out), box-shadow var(--ag-motion-fast) var(--ag-ease-out); }

/* Cards and KPI tiles rise in once when the page shows; tab panels that appear in place fade in. */
/* The separate translate / scale properties, never transform: Bootstrap places dropdowns and popovers with an inline
   transform, which an animation of transform would override (the profile menu opened over its button).
   Fill mode backwards, never both: a finished opacity animation that stays filled keeps a stacking context, and a
   Bootstrap modal inside the card or panel (Add vaccination, weighings) then sits under the body's backdrop. */
@keyframes ag-rise { from { opacity: 0; translate: 0 4px; } to { opacity: 1; translate: none; } }
@keyframes ag-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ag-pop { from { opacity: 0; translate: 0 -4px; scale: 0.98; } to { opacity: 1; translate: none; scale: none; } }
.ag-view .poultry-card,
.ag-view .ag-kpi { animation: ag-rise var(--ag-motion) var(--ag-ease-out) backwards; }
[data-rec-panel]:not([hidden]),
[data-chart]:not([hidden]) { animation: ag-fade var(--ag-motion) var(--ag-ease-out) backwards; }
.dropdown-menu.show,
.dash-farm__menu:not([hidden]) { animation: ag-pop var(--ag-motion-fast) var(--ag-ease-out) both; transform-origin: top; }
.toast.showing, .toast.show { transition: opacity var(--ag-motion) var(--ag-ease-out); }
.modal.fade .modal-dialog { transition: transform var(--ag-motion) var(--ag-ease-out); }

@media (prefers-reduced-motion: reduce) {
    .ag-view .poultry-card, .ag-view .ag-kpi, [data-rec-panel], [data-chart], .dropdown-menu.show, .dash-farm__menu { animation: none !important; }
    .btn:active:not(:disabled) { transform: none; }
}

/* The app's confirm dialog (_ConfirmModal, agronet.confirm): the question and Cancel / Confirm. */
/* Dialogs, everywhere (.ag-modal on the .modal): one frame for every dialog of the app, so no page restyles it.
   24 px sides; the title 17 px bold with the X on its line; the body 8 px under the header (24 px from the top when
   there is no header); the buttons on the right, 8 px apart, at least 96 px wide, 20 px from the bottom. Phones: 16 px. */
.ag-modal .modal-content { border: 0; border-radius: 14px; box-shadow: 0 18px 48px rgba(16, 24, 32, .18); }
.ag-modal .modal-header { align-items: flex-start; gap: 12px; border-bottom: 0; padding: 20px 24px 8px; }
.ag-modal .modal-title { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.35; }
.ag-modal .modal-header .btn-close { flex: none; margin: -2px -6px 0 auto; padding: 8px; }
.ag-modal .modal-body { padding: 8px 24px 4px; }
.ag-modal .modal-content > .modal-body:first-child { padding-top: 24px; }
.ag-modal .modal-footer { flex-wrap: wrap; gap: 8px; border-top: 0; padding: 16px 24px 20px; }
.ag-modal .modal-footer > * { margin: 0; }
.ag-modal .modal-footer .btn { min-width: 96px; }
/* Fields stacked straight in a dialog's body (label > input, one under the other): 12 px between them. */
.ag-modal .modal-body > * + :is(label, .flock-form__label, .ag-field) { margin-top: 12px; }
@media (max-width: 575.98px) {
    .ag-modal .modal-header { padding: 16px 16px 6px; }
    .ag-modal .modal-body { padding: 6px 16px 4px; }
    .ag-modal .modal-content > .modal-body:first-child { padding-top: 18px; }
    .ag-modal .modal-footer { padding: 14px 16px 16px; }
}

/* The confirm dialog (_ConfirmModal, agronet.confirm): a round sign, then the question beside it, its first line level
   with the sign's middle; a question mark in green, a delete (is-danger) a red warning and a red button. */
.ag-confirm .modal-dialog { max-width: 460px; }
.ag-confirm .modal-body { display: flex; align-items: flex-start; gap: 14px; }
.ag-confirm__sign {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
    border-radius: 50%; background: var(--agronet-green-bg); color: var(--agronet-green);
}
.ag-confirm__sign svg { width: 22px; height: 22px; }
.ag-confirm__sign .is-danger-sign, .ag-confirm.is-danger .ag-confirm__sign .is-ask-sign { display: none; }
.ag-confirm.is-danger .ag-confirm__sign .is-danger-sign { display: block; }
.ag-confirm.is-danger .ag-confirm__sign { background: rgba(var(--bs-danger-rgb), .1); color: var(--bs-danger); }
.ag-confirm__text { margin: 0; padding-top: 9px; font-size: 15px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.ag-confirm .modal-footer { padding-top: 20px; }

/* The pager under a paged list (_Pager, pager.js; spec MT-P1): "11–20 of 134" on the left, ‹ 1 … 4 5 6 … 14 › on the
   right; the current page filled green. 34 px targets; on a phone the range sits above the pages. */
.ag-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 12px; }
.ag-pager__range { font-size: 12.5px; color: var(--agronet-text-muted); font-variant-numeric: tabular-nums; }
.ag-pager__pages { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ag-pager__btn {
    display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px;
    border: 1px solid var(--agronet-border); border-radius: var(--agronet-radius-btn); background: var(--agronet-surface);
    color: var(--agronet-text); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; text-decoration: none;
    transition: background-color var(--ag-motion-fast) var(--ag-ease-out), border-color var(--ag-motion-fast) var(--ag-ease-out);
}
a.ag-pager__btn:hover { border-color: var(--agronet-border-strong); background: var(--agronet-surface-soft); color: var(--agronet-text); }
a.ag-pager__btn:focus-visible { outline: 2px solid var(--agronet-green); outline-offset: 2px; }
.ag-pager__btn.is-current, .ag-pager__btn.is-current:hover { border-color: var(--agronet-green); background: var(--agronet-green); color: #fff; }
.ag-pager__btn.is-off { opacity: 0.4; }
.ag-pager__btn > span { font-size: 17px; line-height: 1; }
.ag-pager__gap { padding: 0 4px; color: var(--agronet-text-muted); }
[data-paged][aria-busy="true"] .ag-table { opacity: 0.6; transition: opacity var(--ag-motion-fast) var(--ag-ease-out); }
@media (max-width: 560px) {
    .ag-pager { flex-direction: column; align-items: stretch; }
    .ag-pager__pages { justify-content: center; }
}

/* Date fields, everywhere (every input type=date / datetime-local / month): one look and one behaviour. The field is a
   normal form-control; the browser's own calendar icon is replaced by the frame's line icon (muted, green on hover), and
   a click anywhere in the field opens the calendar (site.js, showPicker), not only on the icon. Typing still works. */
input:is([type="date"], [type="datetime-local"], [type="month"]) { cursor: pointer; font-variant-numeric: tabular-nums; }
input:is([type="date"], [type="datetime-local"], [type="month"])::-webkit-datetime-edit { cursor: text; }
input:is([type="date"], [type="datetime-local"], [type="month"])::-webkit-calendar-picker-indicator {
    width: 16px; height: 16px; margin: 0 0 0 8px; padding: 0; opacity: 1; cursor: pointer;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23626e76' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
}
input:is([type="date"], [type="datetime-local"], [type="month"]):is(:hover, :focus)::-webkit-calendar-picker-indicator { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2317683a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
input:is([type="date"], [type="datetime-local"], [type="month"]):disabled { cursor: default; }
input:is([type="date"], [type="datetime-local"], [type="month"]):disabled::-webkit-calendar-picker-indicator { opacity: .45; cursor: default; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23626e76' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
[data-bs-theme="dark"] input:is([type="date"], [type="datetime-local"], [type="month"])::-webkit-calendar-picker-indicator { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa6ae' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); }

/* A value weighed in the mobile app (activity books, Growth & feed): the whole cell opens the day's masses. The cell
   keeps the sheet's padding; inside, a box like the sheet's inputs (same border, radius and height) holds the value and,
   on its right, the eye (16 px, a button for the keyboard). */
.sheet-weighed { cursor: pointer; }
.sheet-weighed__box {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    min-width: 76px; padding: 1px 3px 1px 8px;
    border: 1px solid var(--agronet-border); border-radius: 4px;
    background: var(--agronet-surface-soft); color: var(--agronet-text);
    transition: border-color var(--ag-motion-fast) var(--ag-ease-out), background-color var(--ag-motion-fast) var(--ag-ease-out);
}
.sheet-weighed__value { flex: 1; text-align: right; font-variant-numeric: tabular-nums; }
.sheet-weighed:hover .sheet-weighed__box { border-color: var(--agronet-green); background: var(--agronet-green-bg); }
.sheet-eye {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
    padding: 0; border: 0; border-radius: 4px; background: none; color: var(--agronet-text-muted); cursor: pointer;
}
.sheet-weighed:hover .sheet-eye { color: var(--agronet-green); }
.sheet-eye:focus-visible { outline: 2px solid var(--agronet-green); outline-offset: 1px; }
/* Outside the sheet (Growth & feed), no box: the text and the eye side by side. */
.ag-list-table .sheet-weighed__box { display: inline-flex; min-width: 0; padding: 0; border: 0; background: none; }
.ag-list-table .sheet-weighed__value { text-align: left; white-space: nowrap; }

/* The masses of a weighed day (_WeighingsModal, as the old app): the day, three tiles, the masses in a table that
   scrolls with its head kept, a bar per mass against the largest group. */
.ag-masses .modal-dialog { max-width: 460px; }
.ag-masses__sub {
    margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--agronet-border);
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--agronet-text-muted);
}
.ag-masses__sub:empty { display: none; }
.ag-masses__state { padding: 20px 0; text-align: center; color: var(--agronet-text-muted); }
.ag-masses__summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; }
.ag-masses__summary > div { padding: 8px 6px; border-radius: 8px; background: var(--agronet-surface-soft); text-align: center; }
.ag-masses__summary dt { font-size: 11.5px; font-weight: 600; color: var(--agronet-text-muted); } /* not uppercase: "[g]" stays a unit */
.ag-masses__summary dd { margin: 2px 0 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ag-masses__scroll { max-height: min(320px, 45vh); overflow-y: auto; border: 1px solid var(--agronet-border); border-radius: 8px; }
.ag-masses__scroll:focus-visible { outline: 2px solid var(--agronet-green); outline-offset: 2px; }
.ag-masses__table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.ag-masses__table th {
    position: sticky; top: 0; z-index: 1; padding: 7px 10px; background: var(--agronet-surface);
    border-bottom: 2px solid var(--agronet-border); font-size: 12px; font-weight: 600; color: var(--agronet-text-muted);
}
.ag-masses__table td { padding: 5px 10px; border-bottom: 1px solid var(--agronet-border); }
.ag-masses__table tr:last-child td { border-bottom: 0; }
.ag-masses__table .ag-num { text-align: right; white-space: nowrap; width: 1%; }
.ag-masses__mass { font-weight: 600; }
.ag-masses__bar { width: 100%; }
.ag-masses__bar span { display: block; height: 8px; min-width: 2px; border-radius: 4px; background: var(--agronet-green); }

/* A task's "Why" (the dashboard and the house pages' tasks table), as the mockup's: a soft row under the task, a small
   mono label and the explanation (user, 2026-12-02). */
/* The row has no padding of its own: the content's wrapper grows from 0 to its height (grid rows 0fr → 1fr) and fades
   in, so opening and shutting slide (site.js agronet.slideRow). */
.ag-table tr.dash-tasks__why > td, .ag-table tr.alerts-why > td,
.page-poultry-dashboard .dash-tasks tr.dash-tasks__why > td {
    padding: 0 10px; background: var(--agronet-surface-soft); border-bottom-width: 0; transition: border-bottom-width .22s ease; }
.ag-table tr.is-open > td, .page-poultry-dashboard .dash-tasks tr.is-open > td { border-bottom-width: 1px; }
.task-why-wrap { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .24s ease, opacity .2s ease; }
tr.is-open .task-why-wrap { grid-template-rows: 1fr; opacity: 1; }
.task-why { min-height: 0; overflow: hidden; padding: 0 2px; text-align: start; white-space: normal; }
.task-why > :first-child { margin-top: 8px; }
.task-why > :last-child { margin-bottom: 10px; }
@media (prefers-reduced-motion: reduce) {
    .task-why-wrap, .ag-table tr.dash-tasks__why > td, .ag-table tr.alerts-why > td { transition: none; }
}
.task-why h3 { margin: 0 0 2px; font-family: var(--agronet-font-mono); font-size: 10.5px;
    font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--agronet-text-muted); }
.task-why p { margin: 0; font-size: 13px; color: var(--agronet-text); }
