.brand-logo {
  display: block;
  width: auto;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
}

/* Override Tailwind preflight: img { max-width:100%; height:auto } */
img.brand-logo.login-brand__logo {
  height: 6rem;
  max-height: 6rem;
  max-width: 11rem;
}

img.brand-logo.sidebar-brand__logo {
  height: 2.75rem;
  max-height: 2.75rem;
  max-width: 4rem;
}

img.brand-logo.mobile-header__logo {
  height: 1.75rem;
  max-height: 1.75rem;
  max-width: 2.5rem;
}

img.brand-logo.dashboard-page-header__logo {
  height: 1.25rem;
  max-height: 1.25rem;
  max-width: 1.75rem;
}

@media (min-width: 768px) {
  img.brand-logo.dashboard-page-header__logo {
    height: 1.5rem;
    max-height: 1.5rem;
    max-width: 2rem;
  }
}

img.brand-logo.header-brand__logo {
  height: 1.75rem;
  max-height: 1.75rem;
  max-width: 2.5rem;
  object-fit: contain;
}

/* Sidebar brand — logo above compact single-line title */
.sidebar-brand .brand-logo-wrap {
  gap: 0.375rem;
  align-items: center;
  text-align: center;
}

.sidebar-brand__title {
  display: block;
  font-size: 0.6875rem;
  line-height: 1.2;
  font-weight: 700;
  color: #006e1c;
  text-align: center;
  white-space: nowrap;
  max-width: 100%;
}

.sidebar-brand__title .bi {
  display: inline;
  white-space: nowrap;
}

.sidebar-brand__title .bi-en,
.sidebar-brand__title .bi-ar {
  display: inline;
}

/* Sidebar section headers vs item links */
.nav-section-label {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #1a1c19;
}

.nav-section-label .bi-en,
.nav-section-label .bi-ar {
  font-weight: 700;
}

.nav-item-link .nav-item-text {
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-item-link .nav-item-icon {
  font-size: 1.25rem;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* V9: enforce light Green + White theme (ignore OS dark mode) */
html {
  color-scheme: light;
}

input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  color-scheme: light;
}

.custom-card {
  background: #ffffff;
  box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.04);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.3s ease;
}
.custom-card:hover {
  box-shadow: 0px 8px 30px rgba(0, 0, 0, 0.08);
}
.custom-card--interactive:hover {
  transform: translateY(-2px);
}

/* Dashboard KPI cards — 4-up single row */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 1rem;
}
.dash-kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 7rem;
  height: 100%;
  min-width: 0;
}
.dash-kpi-card__label {
  line-height: 1.25;
}
.dash-kpi-card__value {
  font-variant-numeric: tabular-nums;
}
.dash-kpi-card__unit {
  line-height: 1.25;
}

/* Desktop default: show 4-up grid, hide mobile hero layout.
   (Do not use Tailwind md:block — it is not in the compiled bundle.) */
.dash-kpi-mobile {
  display: none;
}
.dash-kpi-desktop {
  display: block;
}

/* Dashboard vegetables — compact list under rice KPIs.
   Prefer 1 row of 6; if that would cramp cards, use 3+3 or 2+2+2.
   Skip 4/5 columns so the last row never looks half-empty. */
.dash-veg-card {
  container-type: inline-size;
  container-name: veg;
}
.dash-veg-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}
.dash-veg-grid {
  --veg-gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--veg-gap);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}
@media (min-width: 640px) {
  .dash-veg-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1440px) {
  .dash-veg-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
@container veg (max-width: 31.99rem) {
  .dash-veg-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@container veg (min-width: 32rem) {
  .dash-veg-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@container veg (min-width: 64rem) {
  .dash-veg-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
.dash-veg-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.75rem 0.875rem;
  border-radius: 0.75rem;
  background: #f4f7f2;
  border: 1px solid #e3e8e0;
}
.dash-veg-item--empty {
  opacity: 0.55;
}
.dash-veg-item__name {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.dash-veg-item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1.25;
}
.dash-veg-item__yield {
  font-weight: 700;
  font-size: 0.9375rem;
  white-space: nowrap;
}
.dash-veg-empty {
  margin: 0;
}
@container veg (min-width: 64rem) {
  .dash-veg-item {
    padding: 0.625rem 0.75rem;
  }
  .dash-veg-item__name {
    font-size: 0.8125rem;
  }
  .dash-veg-item__yield {
    font-size: 0.875rem;
  }
}

/* Farm map: desktop spatial layout by default; mobile chip+grid is hidden */
.farm-map-mobile {
  display: none;
}
.farm-map-desktop {
  display: block;
}

@media (min-width: 1280px) {
  .dash-kpi-card {
    min-height: 8rem;
  }
}

.scroll-hide::-webkit-scrollbar { display: none; }
.scroll-hide { -ms-overflow-style: none; scrollbar-width: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

button, a.btn { cursor: pointer; transition: all 0.15s; }
button:active, a.btn:active { transform: scale(0.97); }
input:focus, select:focus, textarea:focus {
  outline: none; box-shadow: 0 0 0 3px rgba(0,110,28,0.25); border-color: #006e1c;
}
.select-field-native:focus {
  box-shadow: none;
  border-color: transparent;
}

/* Chart page multi-select dropdown */
.stats-ms {
  position: relative;
}
.stats-ms-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #becab9;
  border-radius: 0.75rem;
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.stats-ms-trigger:hover {
  border-color: #8a9a86;
}
.stats-ms.is-open .stats-ms-trigger {
  border-color: #006e1c;
  box-shadow: 0 0 0 3px rgba(0, 110, 28, 0.2);
}
.stats-ms-trigger-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1a1c19;
  font-size: 0.9375rem;
}
.stats-ms-chevron {
  flex-shrink: 0;
  color: #5c6359;
  transition: transform 0.15s ease;
}
.stats-ms.is-open .stats-ms-chevron {
  transform: rotate(180deg);
}
.stats-ms-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #becab9;
  border-radius: 0.75rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.stats-ms-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem;
  border-bottom: 1px solid #e2e8de;
}
.stats-ms-list {
  max-height: 16rem;
  overflow-y: auto;
}
.stats-ms-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  min-height: 44px;
  cursor: pointer;
  border-top: 1px solid #eef2ea;
}
.stats-ms-option:first-child {
  border-top: 0;
}
.stats-ms-option:hover {
  background: #f4f7f2;
}
.stats-ms-option input {
  width: 1rem;
  height: 1rem;
  margin-top: 0.2rem;
  flex-shrink: 0;
}
.stats-ms-option--season {
  align-items: flex-start;
}

.pagination-size-select {
  width: 3.25rem;
  min-width: 3.25rem;
  padding-right: 0.125rem;
  text-align: center;
  text-align-last: center;
}
.hist-season-select {
  width: 100%;
  min-width: 0;
}
.hist-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.hist-season-summary {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 12rem;
  padding: 0.75rem 1rem;
  border: 1px solid #becab9;
  border-radius: 0.75rem;
  background: #ffffff;
}
.hist-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid #becab9;
  border-radius: 1rem;
  background: #ffffff;
}
.hist-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.625rem;
}
.hist-filter-bar--secondary {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(190, 202, 185, 0.5);
}
.hist-filter-field {
  flex: 0 0 auto;
  min-width: 0;
}
.hist-filter-field--season {
  flex: 1 1 14rem;
  min-width: 12rem;
}
.hist-filter-field--scope {
  width: 9rem;
}
.hist-filter-plot-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.625rem;
  flex: 0 1 auto;
}
.hist-filter-field--block {
  width: 5.25rem;
}
.hist-filter-field--harvest {
  width: 8.5rem;
}
.hist-filter-field--plot {
  flex: 0 1 14rem;
  width: 14rem;
  max-width: 100%;
}
.hist-filter-field--action {
  flex: 0 0 auto;
  padding-bottom: 1px;
}
.hist-season-pick-card input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #006e1c;
  flex-shrink: 0;
}
.hist-filter-field--search {
  flex: 1 1 14rem;
  min-width: 12rem;
  max-width: 20rem;
}
.hist-filter-search {
  position: relative;
  width: 100%;
}
.hist-filter-search__icon {
  pointer-events: none;
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.125rem;
  color: #5c6b5e;
  line-height: 1;
}
.hist-filter-search__input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.5rem;
  border: 1px solid #dbe3d6;
  border-radius: 0.5rem;
  background: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.hist-filter-search__input:focus {
  outline: none;
  border-color: #006e1c;
  box-shadow: 0 0 0 3px rgba(0, 110, 28, 0.12);
}
.hist-filter-field select {
  width: 100%;
}
.hist-filter-field .select-field {
  width: 100%;
  max-width: 100%;
}
/* Historical filters — unified soft custom dropdowns */
.hist-filter-panel .select-field-trigger {
  background: #ffffff;
  border-color: #dbe3d6;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.hist-filter-panel .select-field-trigger:hover {
  background: #f4f7f2;
  border-color: #b8cdb8;
  box-shadow: 0 2px 8px rgba(0, 78, 28, 0.06);
}
.hist-filter-panel .select-field.is-open .select-field-trigger,
.hist-filter-panel .select-field-trigger:focus-visible {
  border-color: #006e1c;
  box-shadow: 0 0 0 3px rgba(0, 110, 28, 0.12);
  background: #ffffff;
}
.hist-filter-panel .select-field-panel {
  border-color: #dbe3d6;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}
.hist-filter-panel .select-field-option {
  transition: background-color 0.18s ease, color 0.18s ease;
}
.hist-filter-panel .select-field-option:hover,
.hist-filter-panel .select-field-option.is-focused {
  background: #eef5ee;
  color: #006e1c;
}
.hist-filter-panel .select-field-option.is-selected {
  background: #e3f2e6;
  color: #006e1c;
}
@media (max-width: 1023px) {
  .hist-page-header {
    flex-direction: column;
  }
  .hist-season-summary {
    width: 100%;
    min-width: 0;
  }
  .hist-filter-field--season,
  .hist-filter-field--scope,
  .hist-filter-field--search,
  .hist-filter-plot-group,
  .hist-filter-field--harvest {
    width: calc(50% - 0.3125rem);
    max-width: none;
    flex: 1 1 calc(50% - 0.3125rem);
  }
  .hist-filter-plot-group .hist-filter-field--block,
  .hist-filter-plot-group .hist-filter-field--plot {
    width: auto;
    flex: 1 1 auto;
    max-width: none;
  }
  .hist-filter-field--action {
    width: 100%;
  }
}
@media (max-width: 639px) {
  .hist-filter-panel {
    padding: 0.75rem;
  }
  .hist-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .hist-filter-field--season,
  .hist-filter-field--scope,
  .hist-filter-field--search,
  .hist-filter-plot-group,
  .hist-filter-field--harvest,
  .hist-filter-field--action {
    width: 100%;
    flex: 1 1 auto;
    max-width: none;
  }
}
table tbody tr { cursor: default; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ *
 * Spatial Farm Map — mirrors aerial photo (image3.jpeg)          *
 *                                                                 *
 * North:  I12…I1 / H12…H1 / G12…G1  (12 equal cols each)        *
 * Road:   [pond] F4 F3 F2 F1 [pond]                              *
 * South:  E(5×3) | D(18 strips) | C(23 strips)                   *
 *         | [infra] | B(4×2) | A(18 strips)                      *
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.farm-map-wrapper {
  background: #edf2ea;
  border: 1px solid rgba(0,110,28,0.15);
  border-radius: 18px;
  padding: 16px;
  overflow-x: auto;   /* horizontal scroll on narrow viewports */
  overflow-y: visible;
}
.farm-map-wrapper--compact {
  max-height: 38rem;
  overflow-y: auto;
}

/* Always-wide outer container — never collapses north rows */
.farm-spatial-map {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 880px;
}

/* ── Zone label chip ── */
.farm-zone-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(0,110,28,0.75);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(0,110,28,0.09);
  border-radius: 4px;
  padding: 2px 6px;
  margin-bottom: 4px;
  text-align: center;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── North zone: always 12-col, scaled to match E-block area ── */
.farm-north-zone {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 560px;
}
.farm-north-zone > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.farm-north-row {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  min-height: 0;
}
.farm-north-zone .farm-plot-tile,
.farm-north-zone .farm-plot-gap {
  min-height: 0;
  height: 100%;
}
.farm-north-zone .farm-plot-tile,
.farm-e-grid .farm-plot-tile,
.farm-b-grid .farm-plot-tile {
  justify-content: center;
  align-items: stretch;
}

/* ── Road / F band ── */
.farm-road-band {
  position: relative;
  background: rgba(195,182,148,0.18);
  border: 1px dashed rgba(140,125,90,0.4);
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  min-height: 78px;
}
.farm-road-band-label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: #7a6e50;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.farm-road-pond {
  width: 68px;
  height: 50px;
  border-radius: 50%;
  background: rgba(0,110,28,0.35);
  border: 2px solid rgba(0,80,20,0.55);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}
.farm-road-pond-label {
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  line-height: 1.15;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.farm-f-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(58px, 84px));
  gap: 4px;
}

/* ── South zone ──
   CSS Grid with 6 columns matching aerial proportions:
   E(5fr wide) | D(80px strip) | C(72px strip) |
   infra(50px) | B(4fr wide)   | A(72px strip)
   Fixed height so all columns align regardless of plot count.
*/
.farm-south-zone {
  display: grid;
  grid-template-columns: 5fr 80px 72px 50px 4fr 72px;
  gap: 6px;
  min-height: 480px;
  height: auto;
  align-items: stretch;
}

/* Generic column section wrapper */
.farm-south-section {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

/* ── E block: 5 cols × 3 equal rows, fills section height ── */
.farm-e-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
}
.farm-e-grid .farm-plot-tile,
.farm-e-grid .farm-plot-gap {
  min-height: 0;   /* override global button rule */
  height: 100%;
  width: 100%;
}

/* ── D / C / A: strips, fill section height evenly ── */
.farm-col-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.farm-col-zone .farm-plot-tile {
  flex: 1 1 auto;
  min-height: 16px;
  padding: 2px 3px;
  border-radius: 4px;
  border-width: 1px;
  font-size: 8px;
  line-height: 1;
  gap: 2px;
}
.farm-col-zone .farm-plot-tile .farm-strip-label {
  font-size: 8px;
  font-weight: 700;
  font-family: monospace;
  color: currentColor;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

/* ── Infrastructure gap (between C and B blocks) ── */
.farm-south-infra {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(155,143,110,0.1);
  border: 1px dashed rgba(140,128,95,0.3);
  border-radius: 8px;
  color: rgba(120,108,75,0.55);
  gap: 5px;
  padding: 6px 2px;
}
.farm-south-infra .material-symbols-outlined {
  font-size: 15px;
}
.farm-south-infra-label {
  font-size: 7.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  writing-mode: vertical-rl;
}

/* ── B section: zone label + infra spacer top + 4×2 grid bottom ── */
.farm-b-section {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.farm-b-infra {
  flex: 1;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  margin-bottom: 4px;
  background: rgba(155, 143, 110, 0.06);
  border: 1px dashed rgba(140, 128, 95, 0.22);
  border-radius: 8px;
}
.farm-b-warehouse {
  width: 33.333%;
  height: 33.333%;
  min-width: 3.25rem;
  min-height: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  background: linear-gradient(180deg, rgba(198, 190, 168, 0.42) 0%, rgba(155, 143, 110, 0.18) 100%);
  border: 2px solid rgba(96, 86, 62, 0.55);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  color: rgba(80, 72, 52, 0.85);
}
.farm-b-warehouse .material-symbols-outlined {
  font-size: 18px;
  color: rgba(80, 72, 52, 0.8);
}
.farm-b-warehouse-label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.15;
}
.farm-b-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  flex-shrink: 0;
}
.farm-b-grid .farm-plot-tile {
  min-height: 90px;   /* B plots are large — match E row height */
}

/* ── Plot tiles (base) ── */
.farm-map-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1.5px solid rgba(0, 0, 0, 0.55);
}
.farm-map-legend-swatch--crop { background: #76b947; }
.farm-map-legend-swatch--rotation { background: #c0c0c0; }

.farm-plot-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  min-height: 52px;
  border-width: 2px;
  border-style: solid;
  border-radius: 7px;
  padding: 4px 3px 5px;
  cursor: pointer;
  transition: box-shadow 0.12s ease, transform 0.12s ease;
  gap: 2px;
  box-sizing: border-box;
  color: #111;
  overflow: visible;
}
button.farm-plot-tile.farm-plot-tile--crop,
.farm-plot-tile.farm-plot-tile--crop,
.farm-block-cell.farm-plot-tile--crop,
.farm-plot-list-swatch.farm-plot-tile--crop,
.farm-overview-cell.farm-plot-tile--crop {
  background-color: #76b947;
  border-color: rgba(0, 0, 0, 0.55);
  color: #111;
}
button.farm-plot-tile.farm-plot-tile--rotation,
button.farm-plot-tile.farm-plot-tile--missing,
.farm-plot-tile.farm-plot-tile--rotation,
.farm-plot-tile.farm-plot-tile--missing,
.farm-block-cell.farm-plot-tile--rotation,
.farm-plot-list-swatch.farm-plot-tile--rotation,
.farm-overview-cell.farm-plot-tile--rotation {
  background-color: #c0c0c0;
  border-color: rgba(0, 0, 0, 0.45);
  color: #333;
}
.farm-plot-tile--missing {
  cursor: default;
  opacity: 0.55;
}
.farm-plot-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 800;
  font-size: 13px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-align: center;
  flex-shrink: 0;
}
.farm-plot-meta {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1px;
  width: 100%;
  min-width: 0;
  margin-top: 1px;
}
.farm-plot-meta-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  font-size: 8px;
  font-weight: 600;
  line-height: 1.15;
  min-width: 0;
  padding: 1px 1px 0;
  text-align: center;
}
.farm-plot-meta-k {
  flex-shrink: 0;
  opacity: 0.7;
  font-weight: 700;
  font-size: 7px;
  letter-spacing: 0.01em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.farm-plot-meta-v {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
  font-size: 8.5px;
}
.farm-plot-tip {
  display: none;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  z-index: 40;
  min-width: 240px;
  max-width: 320px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #1a1c19;
  color: #f4f5f4;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  text-align: left;
  pointer-events: none;
  white-space: normal;
}
.farm-plot-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: #1a1c19;
}
/* North tiles sit at the top of the map — show tip to the right so it is not clipped */
.farm-plot-tile--north .farm-plot-tip {
  left: calc(100% + 10px);
  right: auto;
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
}
.farm-plot-tile--north .farm-plot-tip::after {
  top: 50%;
  left: auto;
  right: 100%;
  transform: translateY(-50%);
  border: 8px solid transparent;
  border-right-color: #1a1c19;
  border-top-color: transparent;
}
.farm-plot-tip-id {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(244, 245, 244, 0.18);
}
.farm-plot-tip-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  font-size: 14px;
  line-height: 1.45;
  margin-top: 8px;
}
.farm-plot-tip-label {
  color: rgba(244, 245, 244, 0.72);
  flex-shrink: 0;
  font-weight: 600;
}
.farm-plot-tip-value {
  font-weight: 700;
  text-align: right;
  word-break: break-word;
}
.farm-plot-tile--north .farm-plot-id {
  font-size: 14px;
}
.farm-plot-tile--north .farm-plot-meta-line {
  font-size: 8px;
}
.farm-plot-tile--strip {
  padding: 2px 2px;
  gap: 1px;
  min-height: 22px;
  align-items: center;
}
.farm-plot-tile--strip .farm-plot-id {
  font-size: 9px;
}
/* Thin / compact tiles: keep id only, details on hover tip */
.farm-plot-tile--strip .farm-plot-meta,
.farm-plot-tile--compact .farm-plot-meta {
  display: none;
}
/* Hover tips on fine pointers — touch uses plot drawer instead.
   Keep tip for all tiles (incl. north); tiles themselves no longer lift. */
@media (hover: hover) and (pointer: fine) {
  .farm-plot-tile:hover .farm-plot-tip,
  .farm-plot-tile:focus-visible .farm-plot-tip {
    display: block;
  }
}
button.farm-plot-tile {
  min-height: unset;
  background-image: none;
  -webkit-appearance: none;
  appearance: none;
}
/* Highlight only — no lift/scale (avoids covering adjacent plot data) */
.farm-plot-tile:hover {
  box-shadow: 0 0 0 2px rgba(0, 110, 28, 0.45), 0 2px 8px rgba(0, 0, 0, 0.12);
  z-index: 20;
  position: relative;
}
@media (hover: none) {
  .farm-plot-tile:hover {
    box-shadow: none;
  }
}
/* Farm map card must not float on hover (would shift whole grid) */
#farm-map .custom-card--interactive:hover {
  transform: none;
}
/* Tip above tile; raise stacking so it isn't clipped by neighbors */
.farm-plot-tile:hover .farm-plot-tip,
.farm-plot-tile:focus-visible .farm-plot-tip {
  z-index: 50;
}
/* F-row large tiles */
.farm-plot-tile--lg {
  min-height: 72px;
}
.farm-plot-tile--lg .farm-plot-meta-line {
  font-size: 9px;
}
/* Invisible gap spacer */
.farm-plot-gap {
  min-height: 46px;
  visibility: hidden;
  pointer-events: none;
}
/* Compact mode overrides */
.farm-map-wrapper--compact .farm-plot-tile     { min-height: 34px; }
.farm-map-wrapper--compact .farm-plot-tile--lg { min-height: 44px; }
.farm-map-wrapper--compact .farm-plot-gap      { min-height: 34px; }
.farm-map-wrapper--compact .farm-b-grid .farm-plot-tile { min-height: 60px; }
.farm-map-wrapper--compact .farm-north-zone { min-height: 300px; }
.farm-map-wrapper--compact .farm-plot-tile .farm-plot-meta {
  display: none;
}
.farm-map-scroll-hint {
  display: none;
}
.htmx-indicator { opacity: 0; transition: opacity 200ms; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }

.shell-ltr { direction: ltr; }

/* Mobile sidebar drawer */
#sidebar-drawer {
  transition: transform 0.25s ease;
}
body.drawer-open #sidebar-drawer {
  transform: translateX(0) !important;
}

/* Minimum touch targets */
button, a.btn, input[type="submit"] { min-height: 44px; }
select, input[type="date"], input[type="number"], input[type="text"] { min-height: 44px; }
select.pagination-size-select {
  min-height: unset;
  height: auto;
  padding: 0.25rem 0.375rem;
  padding-right: 0.125rem;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
}

.user-menu-avatar {
  width: 2.75rem;
  height: 2.75rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  border: none;
  border-radius: 9999px;
  aspect-ratio: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--color-primary-container, #b7f397);
  color: var(--color-on-primary-container, #002204);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}
.user-menu-avatar:hover {
  box-shadow: 0 0 0 2px rgba(0, 110, 28, 0.25);
}
.user-menu-avatar:active {
  transform: scale(0.97);
}

.bi       { display: inline; direction: ltr; }
.bi-en   { font-weight: 700; }
.bi-ar   { font-size: 0.75em; opacity: 0.6; direction: rtl; unicode-bidi: isolate; }

/* Language switching: show only the active language */
:root[lang="en"] .bi-ar { display: none; }
:root[lang="ar"] .bi-en { display: none; }
:root[lang="ar"] .bi-ar { font-size: inherit; opacity: 1; }

/* Long bilingual labels: stack EN above AR when both visible (rare) */
.label-stacked .bi {
  display: block;
}

.label-stacked .bi-en {
  display: block;
}

.label-stacked .bi-ar {
  display: block;
  margin-top: 0.125rem;
}

.modal-content {
  background: #ffffff;
  box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.04);
  border-radius: 16px;
}

/* PC: wider modals + readable bilingual field labels */
@media (min-width: 768px) {
  .modal-overlay .modal-content.max-w-lg {
    max-width: 40rem;
  }

  .modal-overlay .modal-content.max-w-2xl {
    max-width: 52rem;
  }

  .modal-overlay .modal-content.max-w-4xl {
    max-width: 60rem;
  }

  .modal-overlay .modal-content.max-w-5xl {
    max-width: 72rem;
  }

  .modal-content label {
    white-space: normal;
    overflow: visible;
    line-height: 1.35;
  }

  .modal-content form .grid > div {
    min-width: 0;
  }
}

/* Confirm dialog actions — solid colors (Tailwind purge omits dynamic bg-error) */
.confirm-dialog__btn {
  min-height: 44px;
  padding: 0.5rem 1.25rem;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  border-width: 1px;
  border-style: solid;
}

.confirm-dialog__btn:active {
  transform: scale(0.97);
}

.confirm-dialog__btn--cancel {
  color: #3f4a3c;
  background: #ffffff;
  border-color: #becab9;
}

.confirm-dialog__btn--cancel:hover {
  background: #edeeef;
}

.confirm-dialog__btn--ok {
  color: #ffffff;
  background: #006e1c;
  border-color: #006e1c;
}

.confirm-dialog__btn--ok:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.confirm-dialog__btn--danger {
  color: #ffffff;
  background: #ba1a1a;
  border-color: #93000a;
}

.confirm-dialog__btn--danger:hover {
  background: #93000a;
  box-shadow: 0 10px 15px -3px rgba(186, 26, 26, 0.25), 0 4px 6px -4px rgba(186, 26, 26, 0.2);
}

.role-perm-layout {
  display: grid;
  grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.role-perm-role {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 52px;
  padding: 0.75rem 1rem;
  color: inherit;
  text-decoration: none;
}

.role-perm-role:hover {
  background: rgba(0, 110, 28, 0.04);
}

.role-perm-role.is-selected {
  background: rgba(0, 110, 28, 0.08);
  box-shadow: inset 3px 0 0 #006e1c;
}

.role-perm-badge {
  flex-shrink: 0;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #edeeef;
  color: #5d655c;
  font-size: 0.6875rem;
  font-weight: 600;
}

.role-perm-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 48px;
  padding: 0.5rem 1.25rem;
  cursor: pointer;
}

.role-perm-row--group {
  background: #f7f9f6;
}

.role-perm-row--nested {
  padding-left: 2.75rem;
}

.role-perm-row input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #006e1c;
  flex-shrink: 0;
}

.role-perm-kind {
  flex-shrink: 0;
  color: #5d655c;
  font-size: 0.75rem;
}

@media (max-width: 767px) {
  .role-perm-layout {
    grid-template-columns: 1fr;
  }
}

/* ── Responsive card/table toggle for shared historical includes ─────
   The season-compare and official-yield blocks render BOTH variants;
   mobile sees stacked cards, desktop sees the full table. Applies to
   boss view links and logged-in pages alike. */
.boss-only-desktop {
  display: none;
}
@media (min-width: 768px) {
  .boss-only-desktop {
    display: block;
  }
  .boss-only-mobile {
    display: none;
  }
}
