:root {
  color-scheme: light;
  --bg: #ecfdf5;
  --bg-2: #f0fdf9;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --text: #0f1f17;
  --muted: #4f6f61;
  --border: rgba(16, 100, 70, 0.14);
  --accent: #047857;
  --accent-2: #059669;
  --accent-soft: rgba(4, 120, 87, 0.14);
  --accent-glow: rgba(14, 165, 120, 0.35);
  --accent-hover: #065f46;
  --danger: #b91c1c;
  --success: #047857;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 22px 50px rgba(6, 78, 59, 0.09), 0 4px 16px rgba(6, 78, 59, 0.05);
  --shadow-hover: 0 26px 55px rgba(6, 78, 59, 0.13), 0 10px 24px rgba(6, 78, 59, 0.07);
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --app-sidebar-w: 268px;
  --app-header-h: 3.65rem;
  --glass: rgba(255, 255, 255, 0.82);
  --glass-2: rgba(255, 255, 255, 0.72);
  --chip: rgba(255, 255, 255, 0.92);
  --chip-hover: #ffffff;
  --toggle-track: rgba(255, 255, 255, 0.78);
  --toggle-knob: #ffffff;
  /* Session workspace: calm canvas + chrome */
  --workspace-canvas: #f4f7f5;
  --workspace-content-max: 1120px;
  /* Form controls (inputs, selects, collapsible shells) */
  --control-radius: 10px;
  --input-bg: #ffffff;
  --input-border: rgba(15, 31, 23, 0.14);
  --input-shade: inset 0 1px 2px rgba(15, 31, 23, 0.06);
  --form-well-bg: rgba(4, 120, 87, 0.045);
  --form-well-border: rgba(4, 120, 87, 0.1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071713;
  --bg-2: #06201a;
  --surface: rgba(10, 28, 22, 0.72);
  --surface-solid: #071f19;
  --text: #e6fff6;
  --muted: rgba(230, 255, 246, 0.72);
  --border: rgba(110, 231, 183, 0.16);
  --accent: #34d399;
  --accent-2: #10b981;
  --accent-soft: rgba(52, 211, 153, 0.14);
  --accent-glow: rgba(16, 185, 129, 0.22);
  --accent-hover: #a7f3d0;
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.32), 0 4px 16px rgba(0, 0, 0, 0.22);
  --shadow-hover: 0 26px 55px rgba(0, 0, 0, 0.4), 0 10px 24px rgba(0, 0, 0, 0.26);
  --glass: rgba(7, 31, 25, 0.78);
  --glass-2: rgba(7, 31, 25, 0.68);
  --chip: rgba(7, 31, 25, 0.9);
  --chip-hover: rgba(9, 37, 30, 0.95);
  --toggle-track: rgba(7, 31, 25, 0.9);
  --toggle-knob: rgba(230, 255, 246, 0.92);
  --workspace-canvas: #050d0a;
  --input-bg: #0c1815;
  --input-border: rgba(110, 231, 183, 0.22);
  --input-shade: inset 0 1px 3px rgba(0, 0, 0, 0.28);
  --form-well-bg: rgba(16, 185, 129, 0.06);
  --form-well-border: rgba(110, 231, 183, 0.14);
}

/* Auto dark-mode without requiring data-theme. */
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    color-scheme: dark;
    --bg: #071713;
    --bg-2: #06201a;
    --surface: rgba(10, 28, 22, 0.72);
    --surface-solid: #071f19;
    --text: #e6fff6;
    --muted: rgba(230, 255, 246, 0.72);
    --border: rgba(110, 231, 183, 0.16);
    --accent: #34d399;
    --accent-2: #10b981;
    --accent-soft: rgba(52, 211, 153, 0.14);
    --accent-glow: rgba(16, 185, 129, 0.22);
    --accent-hover: #a7f3d0;
    --shadow: 0 22px 50px rgba(0, 0, 0, 0.32), 0 4px 16px rgba(0, 0, 0, 0.22);
    --shadow-hover: 0 26px 55px rgba(0, 0, 0, 0.4), 0 10px 24px rgba(0, 0, 0, 0.26);
    --glass: rgba(7, 31, 25, 0.78);
    --glass-2: rgba(7, 31, 25, 0.68);
    --chip: rgba(7, 31, 25, 0.9);
    --chip-hover: rgba(9, 37, 30, 0.95);
    --toggle-track: rgba(7, 31, 25, 0.9);
    --toggle-knob: rgba(230, 255, 246, 0.92);
    --workspace-canvas: #050d0a;
    --input-bg: #0c1815;
    --input-border: rgba(110, 231, 183, 0.22);
    --input-shade: inset 0 1px 3px rgba(0, 0, 0, 0.28);
    --form-well-bg: rgba(16, 185, 129, 0.06);
    --form-well-border: rgba(110, 231, 183, 0.14);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .page-bg .blob {
    animation: none !important;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

img,
video,
canvas {
  max-width: 100%;
  height: auto;
}

@keyframes fade-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float-blob {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(3%, -2%) scale(1.03);
  }
}

@keyframes shimmer-edge {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

@keyframes flash-pop {
  from {
    opacity: 0;
    transform: translateX(-10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.55;
  background: var(--workspace-canvas);
  overflow-x: clip;
}

html[data-theme="dark"] body {
  background: var(--workspace-canvas);
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
  opacity: 0.14;
}

body.has-session .page-bg {
  opacity: 0.1;
}

.page-bg .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.55;
  animation: float-blob 18s ease-in-out infinite;
}

.page-bg .blob-a {
  width: min(72vw, 560px);
  height: min(72vw, 560px);
  background: radial-gradient(circle at 30% 30%, #34d399 0%, transparent 65%);
  top: -12%;
  left: -8%;
}

.page-bg .blob-b {
  width: min(60vw, 480px);
  height: min(60vw, 480px);
  background: radial-gradient(circle at 70% 70%, #6ee7b7 0%, transparent 60%);
  bottom: -10%;
  right: -6%;
  animation-delay: -7s;
}

html[data-theme="dark"] .page-bg .blob {
  opacity: 0.45;
  filter: blur(56px);
}

html[data-theme="dark"] .page-bg .blob-a {
  background: radial-gradient(circle at 30% 30%, rgba(52, 211, 153, 0.85) 0%, transparent 60%);
}

html[data-theme="dark"] .page-bg .blob-b {
  background: radial-gradient(circle at 70% 70%, rgba(16, 185, 129, 0.75) 0%, transparent 58%);
}

.page-frame {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow-x: clip;
}

.contain {
  max-width: min(1080px, 100%);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.site-header__inner--full,
.app-header__inner--full {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

@media (max-width: 640px) {
  .contain {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .site-header__inner--full,
  .app-header__inner--full {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-width: 420px) {
  .contain {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .site-header__inner--full,
  .app-header__inner--full {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--surface-solid);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(15, 31, 23, 0.04);
}

html[data-theme="dark"] .site-header {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding-top: 0.72rem;
  padding-bottom: 0.72rem;
  flex-wrap: wrap;
}

@media (max-width: 560px) {
  .site-header__inner {
    gap: 0.65rem;
    justify-content: center;
  }

  .site-brand {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .site-nav {
    width: 100%;
    justify-content: center;
  }
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  min-width: min(100%, 14rem);
  transition: opacity 0.2s ease;
}

.site-brand:hover {
  opacity: 0.94;
}

.site-brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 12px;
}

.site-brand-heading {
  margin: 0;
  font-size: clamp(0.9rem, 2.5vw, 1.06rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.22;
}

.site-brand-tagline {
  margin: 0.12rem 0 0;
  font-size: 0.74rem;
  color: var(--muted);
}

.brand-mark--header {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
}

.brand-mark--header .icon-svg {
  width: 22px;
  height: 22px;
}

.site-main {
  flex: 1 0 auto;
  min-width: 0;
  max-width: 100%;
}

.shell {
  width: 100%;
  min-width: 0;
  max-width: min(1080px, 100%);
  margin-left: auto;
  margin-right: auto;
  padding: 1.65rem 1.25rem 2.5rem;
  animation: fade-rise 0.68s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

@media (max-width: 640px) {
  .shell {
    padding: 1.2rem 1rem 2.1rem;
  }
}

@media (max-width: 420px) {
  .shell {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }
}

.shell--session {
  max-width: min(var(--workspace-content-max), 100%);
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.45rem;
  flex-wrap: wrap;
}

.header-clock {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.header-clock__time {
  color: var(--accent-hover);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
  .header-clock--guest {
    display: none;
  }
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.46rem 0.92rem;
  border-radius: 999px;
  font-size: 0.87rem;
  font-weight: 600;
  text-decoration: none !important;
  color: var(--accent);
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease,
    filter 0.2s ease;
}

.site-nav .nav-link:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.nav-link.is-active:not(.nav-link--cta) {
  background: rgba(236, 253, 245, 0.98);
  border-color: rgba(4, 120, 87, 0.28);
  color: var(--accent-hover);
}

.nav-link--cta {
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  color: #fff !important;
  border-color: transparent;
  box-shadow: 0 8px 22px rgba(4, 120, 87, 0.24);
}

.nav-link--cta:hover {
  filter: brightness(1.06);
  box-shadow: 0 12px 26px rgba(4, 120, 87, 0.3);
}

.nav-link--cta.is-active {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 10px 24px rgba(4, 120, 87, 0.28);
}

.nav-link--quiet {
  background: transparent;
  cursor: pointer;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.nav-logout {
  margin: 0;
  padding: 0;
  display: inline;
}

.nav-logout .nav-link {
  margin: 0;
}

.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 2.35rem 0 1.85rem;
  background: var(--surface-solid);
  border-top: 1px solid var(--border);
}

html[data-theme="dark"] .site-footer {
  background: var(--surface-solid);
}

.footer-grid {
  display: grid;
  gap: 1.85rem;
  padding-bottom: 1.65rem;
}

@media (min-width: 720px) {
  .footer-grid {
    grid-template-columns: 1.22fr 0.95fr 1fr;
    gap: 2rem 2.25rem;
    align-items: start;
  }
}

.footer-title {
  margin: 0 0 0.45rem;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.footer-desc {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.55;
  max-width: 36rem;
}

.footer-heading {
  margin: 0 0 0.6rem;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.footer-links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.footer-links a {
  font-size: 0.87rem;
  font-weight: 500;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-links--plain .footer-plain {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.5;
}

.footer-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border);
  font-size: 0.77rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .site-footer {
    padding: 1.85rem 0 1.4rem;
  }

  .footer-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
}

.footer-meta {
  opacity: 0.95;
}

.dash-hint {
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.icon-svg {
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.92;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-underline-offset 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
  text-underline-offset: 5px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #059669 0%, #10b981 45%, #047857 100%);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
  color: #ecfdf5;
  position: relative;
  overflow: hidden;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(255, 255, 255, 0.35) 48%,
    transparent 62%
  );
  animation: shimmer-edge 4.5s linear infinite;
  opacity: 0.35;
}

.brand-mark .icon-svg {
  color: currentColor;
  position: relative;
  z-index: 1;
  width: 26px;
  height: 26px;
}

.grid-auth {
  display: grid;
  gap: 2rem;
}

@media (min-width: 880px) {
  .grid-auth {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: start;
  }
}

@media (min-width: 880px) and (max-width: 1024px) {
  .grid-auth {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--surface-solid);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.85rem 1.75rem;
  box-shadow: 0 1px 2px rgba(15, 31, 23, 0.06), 0 4px 14px rgba(15, 31, 23, 0.05);
  position: relative;
  max-width: 100%;
  overflow: hidden;
  animation: fade-rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: 0.06s;
}

html[data-theme="dark"] .panel {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 28px rgba(0, 0, 0, 0.4);
}

.panel + .panel {
  margin-top: 1.25rem;
}

@media (max-width: 640px) {
  .panel {
    padding: 1.35rem 1.15rem;
    border-radius: 11px;
  }

  .panel h2 {
    font-size: 1.28rem;
  }
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.42rem;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.panel h2 .icon-svg {
  padding: 6px;
  border-radius: 10px;
  background: var(--accent-soft);
}

.panel .lede {
  margin: 0 0 1.35rem;
  color: var(--muted);
  font-size: 0.96rem;
}

.panel h3 {
  margin-top: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.panel h3 .icon-svg {
  padding: 6px;
  border-radius: 10px;
  background: var(--accent-soft);
}

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1.1rem;
  position: sticky;
  top: calc(var(--app-header-h, 0px) + 0.85rem);
  z-index: 20;
}

.flash {
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  animation: flash-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  box-shadow: 0 14px 32px rgba(6, 78, 59, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-left-width: 4px;
  border-left-style: solid;
}

.flash:nth-child(2) {
  animation-delay: 0.05s;
}
.flash:nth-child(3) {
  animation-delay: 0.1s;
}

.flash-error {
  background: linear-gradient(135deg, #fef2f2, #fff7ed);
  color: #991b1b;
  border: 1px solid #fecaca;
  border-left-color: #ef4444;
}

/* Stock shortfall alert (modal, promoted from flash in base layout). */
.flash-alert-backdrop {
  z-index: 1100;
}

.flash-alert-modal {
  width: min(420px, calc(100vw - 2rem));
  border-color: #fecaca;
  box-shadow: 0 28px 70px rgba(153, 27, 27, 0.18);
}

html[data-theme="dark"] .flash-alert-modal {
  border-color: rgba(248, 113, 113, 0.35);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
}

.flash-alert-modal__head {
  background: linear-gradient(135deg, #fef2f2, #fff7ed);
  color: #991b1b;
}

html[data-theme="dark"] .flash-alert-modal__head {
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.35), rgba(55, 20, 20, 0.5));
  color: #fecaca;
}

.flash-alert-modal__head .modal__title {
  color: inherit;
}

.flash-alert-modal__head .icon-svg {
  color: #dc2626;
  flex-shrink: 0;
}

html[data-theme="dark"] .flash-alert-modal__head .icon-svg {
  color: #f87171;
}

.flash-alert-modal__body {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
}

.flash-alert-modal__footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 0;
  padding-bottom: 0;
}

.flash-success {
  background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-left-color: #10b981;
}

.table-empty {
  padding: 1.2rem 0.9rem;
  color: var(--muted);
  text-align: center;
}

.product-thumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--chip);
  display: block;
}

.thumb-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px dashed rgba(15, 31, 23, 0.22);
  background: var(--chip);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.thumb-placeholder .icon-svg {
  width: 20px;
  height: 20px;
}

/* Warehouse: stock form polish */
.warehouse-stock-grid {
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--glass);
}

.warehouse-form-banner {
  margin-top: 0.25rem;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.9), rgba(240, 253, 244, 0.55));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

html[data-theme="dark"] .warehouse-form-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(7, 31, 25, 0.6));
}

.warehouse-form-banner__left {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.warehouse-form-banner__title {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.warehouse-form-banner__right {
  flex: 0 0 auto;
  text-align: right;
  min-width: min(100%, 16rem);
}

.warehouse-stock-in-banner-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.warehouse-stock-in-banner__row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.12rem;
}

.warehouse-stock-in-banner__label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.warehouse-stock-in-banner__value {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.warehouse-subhead {
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  border: 1px dashed rgba(15, 31, 23, 0.14);
  background: rgba(255, 255, 255, 0.38);
}

html[data-theme="dark"] .warehouse-subhead {
  background: rgba(7, 31, 25, 0.35);
  border-color: rgba(230, 255, 246, 0.16);
}

.warehouse-subhead__title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.warehouse-subhead__meta {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (min-width: 880px) {
  .warehouse-stock-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

.warehouse-item-picker {
  position: relative;
}

.warehouse-item-picker input[data-item-input] {
  letter-spacing: 0.02em;
}

.warehouse-item-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  max-height: min(55vh, 18rem);
  overflow: auto;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border-radius: 12px;
  border: 1px solid rgba(15, 31, 23, 0.14);
  background: var(--surface, #fff);
  box-shadow: 0 12px 40px rgba(15, 31, 23, 0.12);
}

html[data-theme="dark"] .warehouse-item-suggestions {
  border-color: rgba(230, 255, 246, 0.12);
  background: var(--surface, rgba(12, 22, 18, 0.98));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.warehouse-item-suggestions__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  margin: 0 0 0.28rem;
  padding: 0.45rem 0.55rem;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.35;
  cursor: pointer;
  color: var(--text);
}

.warehouse-item-suggestions__main {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.warehouse-item-suggestions__stock {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 0.1rem;
}

.warehouse-item-suggestions__row:last-child {
  margin-bottom: 0;
}

.warehouse-item-suggestions__row:hover,
.warehouse-item-suggestions__row:focus {
  filter: brightness(0.97);
  outline: none;
}

html[data-theme="dark"] .warehouse-item-suggestions__row:hover,
html[data-theme="dark"] .warehouse-item-suggestions__row:focus {
  filter: brightness(1.08);
}

.warehouse-item-suggestions__row--in-session {
  background: rgba(34, 197, 94, 0.42);
}

.warehouse-item-suggestions__row--no-session {
  background: rgba(239, 68, 68, 0.42);
}

.warehouse-session-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.warehouse-session-legend__swatch {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

.warehouse-session-legend__swatch--in {
  background: rgba(34, 197, 94, 0.42);
}

.warehouse-session-legend__swatch--out {
  background: rgba(239, 68, 68, 0.42);
}

.warehouse-supplier-status[data-supplier-status-kind="registered"] {
  color: var(--text);
  border-left: 3px solid rgba(34, 197, 94, 0.85);
  padding-left: 0.65rem;
  margin-top: 0.25rem;
}

.warehouse-supplier-status[data-supplier-status-kind="new"] {
  color: var(--muted);
  border-left: 3px solid rgba(251, 146, 60, 0.9);
  padding-left: 0.65rem;
  margin-top: 0.25rem;
}

.warehouse-stock-form .form-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

.warehouse-stock-actions {
  margin: 0.75rem 0 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.warehouse-action-btn {
  border-radius: 999px;
  padding: 0.65rem 1.05rem;
}

/* make the disclosure stand out when opened */
[data-stock-form] {
  margin-top: 0.85rem;
}

.warehouse-stock-kpi {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.recipient-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.65rem 0.2rem;
}

.recipient-list--table {
  display: block;
  padding: 0;
  gap: 0;
}

.recipient-list--table .distribution-farmers-table {
  width: 100%;
  min-width: 0;
}

.distribution-farmers-table tbody tr.dist-farmer-select-row:not(.dist-row--product-hide):not([hidden]) {
  cursor: pointer;
}

.distribution-farmers-table tbody tr.dist-farmer-select-row:not(.dist-row--product-hide):not([hidden]) input {
  cursor: auto;
}

.distribution-farmers-table .dist-col-check,
.distribution-employees-table .dist-col-check {
  width: 2.5rem;
}

.distribution-farmers-table .dist-col-land,
.distribution-farmers-table .dist-col-rate,
.distribution-farmers-table .dist-col-use {
  text-align: right;
}

.distribution-farmers-table .dist-col-rate {
  white-space: normal;
  font-size: 0.82rem;
  line-height: 1.2;
}

.distribution-farmers-table .dist-col-qty,
.distribution-employees-table .dist-col-qty {
  width: 6.75rem;
  vertical-align: middle;
}

.warehouse-plain-section {
  margin-top: 1.75rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  .warehouse-plain-section {
    padding-top: 1.15rem;
  }
}

.warehouse-plain-heading {
  margin: 0 0 0.35rem;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.warehouse-plain-meta {
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
  max-width: 48rem;
}

/* --- Warehouse distribution: professional layout (page-scoped) --- */
.warehouse-dist-page {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.warehouse-dist-form form {
  min-width: 0;
  max-width: 100%;
}

.warehouse-dist-page .warehouse-plain-heading {
  font-size: clamp(1.05rem, 0.95rem + 0.55vw, 1.22rem);
  font-weight: 700;
  letter-spacing: -0.028em;
  margin-bottom: 0.4rem;
}

.warehouse-dist-page .warehouse-plain-meta {
  margin-bottom: clamp(0.85rem, 2vw, 1.15rem);
  max-width: 42rem;
  line-height: 1.55;
}

.warehouse-dist-form {
  margin-top: 0;
}

.warehouse-dist-page .warehouse-dist-form > .warehouse-plain-heading {
  margin-top: 0.15rem;
}

.warehouse-dist-page .warehouse-dist-form-grid {
  gap: clamp(0.9rem, 2vw, 1.2rem);
  min-width: 0;
}

@media (max-width: 720px) {
  .warehouse-dist-page .warehouse-dist-form-grid--recipients {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 880px) {
  .warehouse-dist-page .warehouse-stock-grid {
    grid-template-columns: 1fr !important;
  }
}

.warehouse-dist-subhead {
  margin-top: clamp(1.1rem, 2.5vw, 1.65rem) !important;
  padding-top: 1.15rem !important;
  border-top: 1px solid var(--border) !important;
}

.warehouse-dist-page .warehouse-subhead__title {
  font-size: clamp(0.88rem, 0.82rem + 0.25vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.warehouse-dist-page .warehouse-subhead__meta {
  font-size: 0.84rem;
  max-width: 40rem;
}

/* Subtle data shell: scroll + edge definition without heavy “cards” */
.warehouse-dist-page .warehouse-dist-table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-solid);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  max-width: 100%;
  min-width: 0;
}

html[data-theme="dark"] .warehouse-dist-page .warehouse-dist-table-wrap {
  background: var(--surface-solid);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.warehouse-dist-summary {
  margin: 0.75rem 0 0;
  padding: 0.62rem 0.85rem;
  border-radius: 10px;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--accent-hover);
  background: var(--accent-soft);
  border: 1px solid rgba(4, 120, 87, 0.12);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

html[data-theme="dark"] .warehouse-dist-summary {
  border-color: rgba(110, 231, 183, 0.2);
  color: var(--text);
}

.warehouse-dist-summary.warehouse-dist-summary--stock-short {
  color: #991b1b;
  background: linear-gradient(135deg, #fef2f2, #fff7ed);
  border-color: #fecaca;
}

html[data-theme="dark"] .warehouse-dist-summary.warehouse-dist-summary--stock-short {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.28);
  border-color: rgba(248, 113, 113, 0.35);
}

.distribution-farmers-table tbody tr.dist-farmer-select-row--stock-short > td {
  background: linear-gradient(135deg, #fef2f2, #ffe4e6) !important;
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.2);
}

html[data-theme="dark"] .distribution-farmers-table tbody tr.dist-farmer-select-row--stock-short > td {
  background: rgba(127, 29, 29, 0.32) !important;
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.25);
}

.warehouse-dist-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: flex-end;
}

@media (max-width: 520px) {
  .warehouse-dist-form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .warehouse-dist-form-actions .button {
    width: 100%;
    justify-content: center;
  }
}

/* Split recipients: side-by-side desktop, stacked mobile */
.warehouse-dist-split {
  width: 100%;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.warehouse-dist-split > thead > tr > th {
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  padding: 0.62rem 0.75rem;
  background: var(--chip);
  border-bottom: 1px solid var(--border);
}

.warehouse-dist-split > tbody > tr > td {
  padding: 0;
  vertical-align: top;
  border-bottom: none;
}

@media (min-width: 901px) {
  .warehouse-dist-split {
    min-width: min(920px, 100%);
    table-layout: fixed;
  }

  .warehouse-dist-split > tbody > tr > td[data-col="farmers"] {
    border-right: 1px solid var(--border);
    width: 50%;
    max-width: 50%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .warehouse-dist-split > tbody > tr > td[data-col="employees"] {
    width: 50%;
    max-width: 50%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 900px) {
  .warehouse-dist-split > thead {
    display: none;
  }

  .warehouse-dist-split > tbody > tr {
    display: flex;
    flex-direction: column;
  }

  .warehouse-dist-split > tbody > tr > td {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    border-right: none !important;
    /* One scroll container: .warehouse-dist-table-wrap. Nested overflow-x:auto
       here caused clipped / misaligned farmer text on narrow mobile browsers. */
    overflow-x: visible;
    min-width: 0;
  }

  .warehouse-dist-split > tbody > tr > td[data-col="farmers"] {
    border-bottom: 1px solid var(--border);
  }
}

.warehouse-dist-page .warehouse-dist-split .recipient-list--table {
  padding: 0.4rem 0.3rem 0.55rem;
  max-width: 100%;
  min-width: 0;
}

@media (min-width: 901px) {
  .warehouse-dist-page .warehouse-dist-split .recipient-list--table {
    padding: 0.55rem 0.45rem 0.65rem;
  }
}

/* Let nested recipient tables shrink inside split columns; full-width wraps still scroll when needed */
.warehouse-dist-page .distribution-farmers-table.data-table,
.warehouse-dist-page .distribution-employees-table.data-table {
  min-width: min(900px, 100%);
}

.warehouse-dist-page .distribution-directory-table.data-table {
  min-width: min(720px, 100%);
}

.distribution-directory-table--sessions .dist-directory-farmer-cell {
  min-width: 11rem;
}
.distribution-directory-table--sessions .dist-directory-phone {
  display: block;
  margin-top: 0.12rem;
}
.distribution-directory-table--sessions .numeric-col {
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}
.distribution-directory-table--sessions .dist-directory-acres-cell .dist-directory-acres-pair {
  font-variant-numeric: tabular-nums;
}
.distribution-directory-table--sessions .dist-directory-acres-sep {
  opacity: 0.5;
  padding: 0 0.25rem;
  font-weight: 500;
}
.distribution-directory-table--sessions .dist-directory-acres-session {
  font-weight: 600;
}
.distribution-directory-table--sessions .dist-directory-acres-unit {
  display: block;
  margin-top: 0.08rem;
  font-size: 0.72rem;
}

/* Warehouse stock transactions audit table */
.warehouse-stock-tx-table .numeric-col {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.warehouse-stock-tx-row--in td {
  background: rgba(34, 197, 94, 0.12);
}

.warehouse-stock-tx-row--out td {
  background: rgba(251, 146, 60, 0.1);
}

html[data-theme="dark"] .warehouse-stock-tx-row--in td {
  background: rgba(34, 197, 94, 0.14);
}

html[data-theme="dark"] .warehouse-stock-tx-row--out td {
  background: rgba(251, 146, 60, 0.12);
}

/* Products module: “in session” list — all rows are active registrations */
.module-products-session-table .module-products-session-table__row td {
  background: rgba(34, 197, 94, 0.12);
}

html[data-theme="dark"] .module-products-session-table .module-products-session-table__row td {
  background: rgba(34, 197, 94, 0.14);
}

.module-products-session-table .numeric-col {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.module-products-session-table tbody tr.module-products-session-table__row--link {
  cursor: pointer;
}
.module-products-session-table tbody tr.module-products-session-table__row--link:hover td,
.module-products-session-table tbody tr.module-products-session-table__row--link:focus-visible td {
  filter: brightness(0.97);
}
html[data-theme="dark"] .module-products-session-table tbody tr.module-products-session-table__row--link:hover td,
html[data-theme="dark"] .module-products-session-table tbody tr.module-products-session-table__row--link:focus-visible td {
  filter: brightness(1.08);
}

/* Farmers per-crop list: row opens farmer detail for that crop */
.farmer-one-crop-table tbody tr.farmer-one-crop-table__row--link {
  cursor: pointer;
}
.farmer-one-crop-table tbody tr.farmer-one-crop-table__row--link:hover td,
.farmer-one-crop-table tbody tr.farmer-one-crop-table__row--link:focus-visible td {
  filter: brightness(0.97);
}
html[data-theme="dark"] .farmer-one-crop-table tbody tr.farmer-one-crop-table__row--link:hover td,
html[data-theme="dark"] .farmer-one-crop-table tbody tr.farmer-one-crop-table__row--link:focus-visible td {
  filter: brightness(1.08);
}

/* Farmers in session list: row opens all active sessions for that farmer */
.farmers-in-session-table tbody tr.farmers-in-session-table__row--link {
  cursor: pointer;
}
.farmers-in-session-table tbody tr.farmers-in-session-table__row--link:hover td,
.farmers-in-session-table tbody tr.farmers-in-session-table__row--link:focus-visible td {
  filter: brightness(0.97);
}
html[data-theme="dark"] .farmers-in-session-table tbody tr.farmers-in-session-table__row--link:hover td,
html[data-theme="dark"] .farmers-in-session-table tbody tr.farmers-in-session-table__row--link:focus-visible td {
  filter: brightness(1.08);
}

/* Farmer sessions page: row opens crop session detail */
.farmer-all-sessions-table tbody tr.farmer-all-sessions-table__row--link {
  cursor: pointer;
}
.farmer-all-sessions-table tbody tr.farmer-all-sessions-table__row--link:hover td,
.farmer-all-sessions-table tbody tr.farmer-all-sessions-table__row--link:focus-visible td {
  filter: brightness(0.97);
}
html[data-theme="dark"] .farmer-all-sessions-table tbody tr.farmer-all-sessions-table__row--link:hover td,
html[data-theme="dark"] .farmer-all-sessions-table tbody tr.farmer-all-sessions-table__row--link:focus-visible td {
  filter: brightness(1.08);
}

/* Farmers module: optional row selection → sidebar “Register farming session” pre-fills farmer */
.data-table tbody tr.farmer-select-row {
  cursor: pointer;
}

/* Warehouse stock page: items in active farming session — listed first (see query) + green tint */
.warehouse-active-items-table tbody tr.warehouse-active-items-table__row--in-session {
  background: rgba(34, 197, 94, 0.3);
}
.warehouse-active-items-table tbody tr.warehouse-active-items-table__row--in-session:hover {
  background: rgba(34, 197, 94, 0.42);
}
html[data-theme="dark"] .warehouse-active-items-table tbody tr.warehouse-active-items-table__row--in-session {
  background: rgba(34, 197, 94, 0.2);
}
html[data-theme="dark"] .warehouse-active-items-table tbody tr.warehouse-active-items-table__row--in-session:hover {
  background: rgba(34, 197, 94, 0.3);
}
/* Farmers distribution: crop column alignment */
.distribution-farmers-table .dist-col-crop {
  text-align: left;
  vertical-align: middle;
}

.dist-row--product-hide {
  display: none !important;
}

.farming-session-farmer-list {
  max-height: min(28rem, 60vh);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: rgba(255, 255, 255, 0.35);
}

.farming-session-farmer-pick {
  display: grid;
  grid-template-columns: auto 1fr minmax(6rem, 7.5rem);
  gap: 0.55rem 0.75rem;
  align-items: start;
  padding: 0.5rem 0.35rem;
  margin: 0;
  border-radius: 8px;
}
.farming-session-farmer-pick:hover {
  background: rgba(16, 100, 70, 0.06);
}
.farming-session-farmer-pick__check input[type="checkbox"] {
  margin-top: 0.35rem;
}
.farming-session-farmer-pick__metrics {
  font-size: 0.82rem;
  line-height: 1.35;
  margin-top: 0.25rem;
}
.farming-session-farmer-pick__acres .num-input {
  width: 100%;
}

.farming-session-farmer-pick__acres input[data-fs-farmer-acres].is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px rgba(185, 28, 28, 0.22);
}

.farming-session-acres-live {
  margin: 0.22rem 0 0;
  padding: 0;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.35;
  max-width: 18rem;
}

.farming-session-acres-live--error {
  color: var(--danger);
}

.farming-session-acres-live--warn {
  color: rgb(113, 63, 18);
}

.farming-session-acres-live--ok {
  color: var(--muted);
}

.farming-session-form-alert {
  display: block;
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(185, 28, 28, 0.35);
  background: rgba(254, 242, 242, 0.85);
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
}

html[data-theme="dark"] .farming-session-form-alert {
  background: rgba(127, 29, 29, 0.2);
  border-color: rgba(252, 165, 165, 0.35);
  color: #fecaca;
}

@media (max-width: 640px) {
  .farming-session-farmer-pick {
    grid-template-columns: 1fr;
  }
  .farming-session-farmer-pick__check {
    grid-column: 1;
  }
  .farming-session-farmer-pick__acres {
    grid-column: 1;
  }
}

.farming-session-land-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.farming-session-land-badge--partial {
  background: rgba(234, 179, 8, 0.18);
  color: rgb(113, 63, 18);
}
.farming-session-land-badge--full {
  background: rgba(34, 197, 94, 0.2);
  color: rgb(20, 83, 45);
}

.farmer-session-crop-list {
  margin: 0;
  padding-left: 1.15rem;
  max-width: 28rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.farmer-session-crop-list li {
  margin-bottom: 0.35rem;
}

.farmer-session-crop-list li:last-child {
  margin-bottom: 0;
}

.farmer-land-compare {
  font-weight: 700;
  font-size: 0.85rem;
}

.farmer-land-compare--ok {
  color: rgb(20, 83, 45);
}

.farmer-land-compare--over {
  color: var(--danger);
}

.warehouse-dist-page .warehouse-dist-form .input-wrap select {
  min-width: 0;
  max-width: 100%;
}

/* Narrow screens: table-layout fixed + % columns (rem-based “auto” col broke WebKit width math and clipped the farmer column) */
@media (max-width: 640px) {
  .warehouse-dist-page .distribution-farmers-table.data-table,
  .warehouse-dist-page .distribution-employees-table.data-table {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    table-layout: fixed;
    direction: ltr;
    border-collapse: collapse;
  }

  /* Avoid sticky thead inside nested scrollports on mobile (layout / paint glitches). */
  .warehouse-dist-page .distribution-farmers-table.data-table th,
  .warehouse-dist-page .distribution-employees-table.data-table th {
    position: static;
    top: auto;
  }

  .warehouse-dist-page .distribution-farmers-table th,
  .warehouse-dist-page .distribution-farmers-table td,
  .warehouse-dist-page .distribution-employees-table th,
  .warehouse-dist-page .distribution-employees-table td {
    padding: 0.42rem 0.28rem;
    font-size: 0.8rem;
    text-align: left;
    vertical-align: top;
    box-sizing: border-box;
  }

  .warehouse-dist-page .distribution-farmers-table thead th,
  .warehouse-dist-page .distribution-employees-table thead th {
    font-size: 0.6rem;
    letter-spacing: 0.035em;
    line-height: 1.25;
  }

  /* Farmers: checkbox, name, crop, land, amt/acre, session acres (edit), qty */
  .warehouse-dist-page .distribution-farmers-table thead th:nth-child(1),
  .warehouse-dist-page .distribution-farmers-table tbody td:nth-child(1) {
    width: 6%;
    min-width: 2.35rem;
    padding-left: 0.35rem;
    padding-right: 0.15rem;
  }

  .warehouse-dist-page .distribution-farmers-table thead th:nth-child(2),
  .warehouse-dist-page .distribution-farmers-table tbody td:nth-child(2) {
    width: 24%;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .warehouse-dist-page .distribution-farmers-table thead th:nth-child(3),
  .warehouse-dist-page .distribution-farmers-table tbody td:nth-child(3) {
    width: 10%;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
    text-align: right;
  }

  .warehouse-dist-page .distribution-farmers-table thead th:nth-child(4),
  .warehouse-dist-page .distribution-farmers-table tbody td:nth-child(4) {
    width: 13%;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
    text-align: right;
    font-size: 0.78rem;
  }

  .warehouse-dist-page .distribution-farmers-table thead th:nth-child(5),
  .warehouse-dist-page .distribution-farmers-table tbody td:nth-child(5) {
    width: 12%;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
    text-align: right;
  }

  .warehouse-dist-page .distribution-farmers-table thead th:nth-child(6),
  .warehouse-dist-page .distribution-farmers-table tbody td:nth-child(6) {
    width: 19%;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
    text-align: right;
    vertical-align: middle;
  }

  .warehouse-dist-page .distribution-farmers-table thead th:nth-child(7),
  .warehouse-dist-page .distribution-farmers-table tbody td:nth-child(7) {
    width: 16%;
    padding-left: 0.15rem;
    padding-right: 0.2rem;
    vertical-align: middle;
  }

  .warehouse-dist-page .distribution-farmers-table .dist-col-land {
    white-space: normal;
  }

  .warehouse-dist-page .distribution-farmers-table .farmer-dist-acres {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .warehouse-dist-page .distribution-farmers-table input.dist-qty--readonly-land {
    background: rgba(127, 127, 127, 0.08);
    cursor: default;
  }

  /* Employees */
  .warehouse-dist-page .distribution-employees-table thead th:nth-child(1),
  .warehouse-dist-page .distribution-employees-table tbody td:nth-child(1) {
    width: 12%;
    min-width: 2.65rem;
    padding-left: 0.35rem;
    padding-right: 0.2rem;
  }

  .warehouse-dist-page .distribution-employees-table thead th:nth-child(2),
  .warehouse-dist-page .distribution-employees-table tbody td:nth-child(2) {
    width: 40%;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .warehouse-dist-page .distribution-employees-table thead th:nth-child(3),
  .warehouse-dist-page .distribution-employees-table tbody td:nth-child(3) {
    width: 23%;
    min-width: 0;
    word-break: break-word;
  }

  .warehouse-dist-page .distribution-employees-table thead th:nth-child(4),
  .warehouse-dist-page .distribution-employees-table tbody td:nth-child(4) {
    width: 25%;
    vertical-align: middle;
  }

  .warehouse-dist-page .recipient-qty {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding-left: 0.35rem !important;
    padding-right: 0.35rem !important;
  }

  .warehouse-dist-page .dashboard-header .dash-title {
    font-size: clamp(1rem, 4.5vw, 1.2rem);
  }
}

@media (min-width: 641px) {
  .warehouse-dist-page .warehouse-dist-form .distribution-farmers-table tbody td,
  .warehouse-dist-page .warehouse-dist-form .distribution-employees-table tbody td {
    font-size: 0.88rem;
  }
}

.warehouse-dist-directory {
  margin-top: clamp(1.75rem, 4vw, 2.35rem);
  padding-top: clamp(1.25rem, 3vw, 1.85rem);
}

/* Warehouse distribution: flat product grid (no glass card) */
.warehouse-dist-form .warehouse-stock-grid {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.warehouse-dist-form .warehouse-subhead {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

html[data-theme="dark"] .warehouse-dist-form .warehouse-subhead {
  background: transparent;
  border: none;
}

.recipient-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  border: 1px solid rgba(15, 31, 23, 0.1);
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

.recipient-row--qty {
  align-items: center;
}

.recipient-row__main {
  flex: 1;
  min-width: 12rem;
}

.recipient-row__qty {
  width: 120px;
}

.recipient-row__qty input {
  width: 100%;
  padding-left: 0.85rem !important;
  padding-right: 0.85rem !important;
  text-align: right;
}

html[data-theme="dark"] .recipient-row {
  background: rgba(7, 31, 25, 0.35);
  border-color: rgba(230, 255, 246, 0.14);
}

.recipient-row:hover {
  background: rgba(236, 253, 245, 0.7);
}

.recipient-row input[type="checkbox"] {
  margin-top: 0.2rem;
}
.form-grid {
  display: grid;
  gap: 1.05rem;
  min-width: 0;
}

.panel .form-grid,
.panel .form-disclosure__body .form-grid {
  gap: 1.2rem;
  padding: 1.15rem 1.2rem;
  margin-top: 0.35rem;
  border-radius: 12px;
  background: var(--form-well-bg);
  border: 1px solid var(--form-well-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

html[data-theme="dark"] .panel .form-grid,
html[data-theme="dark"] .panel .form-disclosure__body .form-grid {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

@media (max-width: 640px) {
  .panel .form-grid,
  .panel .form-disclosure__body .form-grid {
    padding: 1rem;
  }
}

.stagger-fields .field:nth-child(1) {
  animation-delay: 0.08s;
}
.stagger-fields .field:nth-child(2) {
  animation-delay: 0.12s;
}
.stagger-fields .field:nth-child(3) {
  animation-delay: 0.16s;
}
.stagger-fields .field:nth-child(4) {
  animation-delay: 0.2s;
}
.stagger-fields .field:nth-child(5) {
  animation-delay: 0.24s;
}
.stagger-fields .field:nth-child(6) {
  animation-delay: 0.28s;
}
.stagger-fields .field:nth-child(7) {
  animation-delay: 0.32s;
}
.stagger-fields .field:nth-child(8) {
  animation-delay: 0.36s;
}

.field {
  min-width: 0;
  animation: fade-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.label-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.label-row span {
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text);
}

.label-row .icon-svg {
  opacity: 0.88;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 100%;
  min-width: 0;
}

.input-wrap--addon .input-addon {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

.input-wrap--addon .input-addon--prefix {
  left: 0.6rem;
  right: auto;
}

/* Note: padding for .input-wrap--addon + input.num-input is set *after*
   the generic `.input-wrap input[type="number"]` block so the shorthand
   does not wipe out right space for the unit chip. */

/* Keep number inputs visually consistent */
input.num-input[type="number"] {
  appearance: textfield;
}

input.num-input[type="number"]::-webkit-outer-spin-button,
input.num-input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.input-wrap > svg:first-child {
  position: absolute;
  left: 0.85rem;
  pointer-events: none;
  color: var(--accent);
  opacity: 0.75;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.input-wrap:focus-within > svg:first-child {
  opacity: 1;
  transform: scale(1.05);
}

.input-wrap input[type="text"],
.input-wrap input[type="email"],
.input-wrap input[type="password"],
.input-wrap input[type="number"],
.input-wrap input[type="date"],
.input-wrap input[type="search"],
.input-wrap select {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.78rem 0.95rem 0.78rem 2.75rem;
  border-radius: var(--control-radius);
}

/* Addon numeric fields: reserve space for the suffix unit chip (and optional KES prefix).
   Placed after generic `.input-wrap input` padding so we are not overridden by shorthand. */
.input-wrap.input-wrap--addon input.num-input[type="number"] {
  text-align: right;
  padding-right: 4.85rem;
}

.input-wrap.input-wrap--addon .input-addon--prefix + input.num-input[type="number"] {
  padding-left: 4.2rem;
  padding-right: 1rem;
}

.input-wrap.input-wrap--addon.warehouse-buying-price-wrap .input-addon--prefix + input.num-input[type="number"] {
  padding-right: 4.85rem;
}

.input-wrap select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--input-bg);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 12px) 52%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.1rem;
}

/* Live search / inventory pickers: larger, uniform control size */
.input-wrap input[type="search"],
.input-wrap input[data-farmer-search],
.input-wrap input[data-item-input] {
  min-height: 3.05rem;
  padding: 0.88rem 1.05rem 0.88rem 2.9rem;
  font-size: 0.94rem;
  line-height: 1.4;
}

.input-wrap input[type="search"] {
  text-transform: none;
  letter-spacing: normal;
}

.live-search-wrap {
  width: 100%;
  flex: 1 1 18rem;
  max-width: min(42rem, 100%);
  min-width: 0;
}

.row-buttons .live-search-wrap {
  flex: 1 1 20rem;
  max-width: min(42rem, 100%);
}

.panel .field .live-search-wrap {
  max-width: min(42rem, 100%);
}

.input-wrap--password > input[type="password"],
.input-wrap--password > input[type="text"] {
  padding-right: 2.85rem;
}

.pw-toggle {
  position: absolute;
  right: 0.32rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.pw-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.pw-toggle:focus {
  outline: none;
}

.pw-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.pw-toggle-icon {
  width: 19px;
  height: 19px;
  display: block;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="file"],
select,
textarea {
  border-radius: var(--control-radius);
  border: 1px solid var(--input-border);
  font: inherit;
  background: var(--input-bg);
  box-shadow: var(--input-shade);
  transition: border-color 0.2s ease, box-shadow 0.22s ease, background 0.2s ease;
}

textarea {
  width: 100%;
  min-height: 6.75rem;
  padding: 0.85rem 1rem;
  line-height: 1.5;
  resize: vertical;
}

.row-form select {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.72rem 0.85rem;
}

/* Uniform uppercase inputs (except email). */
.input-wrap input[type="text"],
.row-form input[type="text"],
.row-form input[type="number"],
.row-form input[type="date"],
.input-wrap select,
textarea {
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.input-wrap input[type="email"],
.row-form input[type="email"] {
  text-transform: none;
  letter-spacing: normal;
}

.input-suffix {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  pointer-events: none;
}

/* Amount / yield per acre: caption stacked inside the control (below the input, within the field). */
.input-wrap.input-wrap--per-acre-block {
  align-items: flex-start;
}

.input-wrap.input-wrap--per-acre-block > svg:first-child {
  top: 1.42rem;
  transform: translateY(-50%);
}

.input-per-acre-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.input-per-acre-amount-row {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
}

.input-per-acre-amount-row .pill[data-package-size-uom-badge] {
  flex-shrink: 0;
  align-self: center;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.input-wrap.input-wrap--per-acre-block .input-per-acre-amount-row > input[type="text"] {
  flex: 1;
  min-width: 0;
  width: auto;
  min-height: 2.85rem;
  padding: 0.78rem 0.95rem 0.78rem 2.75rem;
  border-radius: var(--control-radius);
}

.input-wrap.input-wrap--per-acre-block .input-per-acre-stack > input[type="text"] {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.78rem 0.95rem 0.78rem 2.75rem;
  border-radius: var(--control-radius);
}

.input-per-acre-live {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--muted);
  padding: 0 0.35rem 0 2.75rem;
  white-space: normal;
  min-height: 1.35em;
}

.modal-input-with-caption {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
  min-width: 0;
}

.modal-input-with-caption > input[type="text"],
.modal-input-with-caption > input[type="number"] {
  width: 100%;
}

.modal-input-with-caption .input-per-acre-amount-row {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
}

.modal-input-with-caption .input-per-acre-amount-row > input[type="text"] {
  flex: 1;
  min-width: 0;
}

.modal-input-with-caption .input-per-acre-live {
  padding-left: 0.1rem;
}

input[type="file"] {
  padding: 0.72rem 0.95rem;
  cursor: pointer;
  border-style: dashed;
  border-width: 1.5px;
  background: var(--form-well-bg);
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="date"]:hover,
input[type="search"]:hover,
select:hover,
textarea:hover {
  border-color: rgba(4, 120, 87, 0.38);
}

html[data-theme="dark"] input[type="text"]:hover,
html[data-theme="dark"] input[type="email"]:hover,
html[data-theme="dark"] input[type="password"]:hover,
html[data-theme="dark"] input[type="number"]:hover,
html[data-theme="dark"] input[type="date"]:hover,
html[data-theme="dark"] input[type="search"]:hover,
html[data-theme="dark"] select:hover,
html[data-theme="dark"] textarea:hover {
  border-color: rgba(52, 211, 153, 0.38);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--input-shade);
  background: var(--input-bg);
}

.hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  margin-top: 0.25rem;
}

button .icon-svg,
.button .icon-svg {
  width: 18px;
  height: 18px;
  color: inherit;
  opacity: 0.95;
}

button,
.button {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0.72rem 1.25rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 12px 28px rgba(4, 120, 87, 0.28);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: transform 0.2s ease, box-shadow 0.22s ease, filter 0.2s ease;
}

button:hover,
.button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  filter: brightness(1.03);
}

button:active,
.button:active {
  transform: translateY(0);
}

.button-ghost,
button.button-ghost {
  background: rgba(255, 255, 255, 0.65);
  color: var(--accent);
  box-shadow: none;
  border: 1px solid var(--border);
}

button.button-ghost:hover {
  background: rgba(236, 253, 245, 0.95);
  border-color: rgba(4, 120, 87, 0.28);
}

html[data-theme="dark"] .button-ghost,
html[data-theme="dark"] button.button-ghost {
  background: rgba(7, 31, 25, 0.92);
  color: var(--accent);
  border-color: var(--border);
}

html[data-theme="dark"] button.button-ghost:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(52, 211, 153, 0.3);
}

/* Action icon colors (farmers table, etc.) */
.action-icon.action-icon--edit {
  color: #2563eb; /* blue */
}

.action-icon.action-icon--activate {
  color: #16a34a; /* green */
}

.action-icon.action-icon--unsuspend {
  color: #7c3aed; /* purple */
}

.action-icon.action-icon--suspend {
  color: #d97706; /* amber */
}

.action-icon.action-icon--delete {
  color: var(--danger); /* red */
}

.action-icon:hover {
  filter: brightness(0.95);
}

.side-note {
  padding: 1.35rem 1.25rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: 0 16px 36px rgba(6, 78, 59, 0.06);
  color: var(--muted);
  font-size: 0.93rem;
  animation: fade-rise 0.68s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: 0.14s;
}

.side-note .note-head {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}

.side-note .note-head .icon-svg {
  margin-top: 2px;
  padding: 7px;
  border-radius: 10px;
  background: var(--accent-soft);
}

.side-note .note-head p {
  margin: 0;
  align-self: center;
  font-weight: 700;
  color: var(--text);
}

.side-note strong {
  color: var(--text);
}

.side-note p {
  margin: 0 0 0.75rem;
}

.side-note p:last-child {
  margin-bottom: 0;
}

.dashboard-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin: 0 0 1.5rem;
  padding: 0 0 1rem;
  border-bottom: 1px solid var(--border);
  animation: fade-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

@media (max-width: 640px) {
  .dashboard-header {
    margin-bottom: 1.15rem;
    padding-bottom: 0.85rem;
  }
}

/* Farmer + crop detail: crop summary left, profile dropdown floats */
.farmer-crop-detail-header {
  align-items: flex-start;
  overflow: visible;
  position: relative;
  z-index: 2;
}

.farmer-all-sessions-topbar {
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}

.farmer-farm-summary-anchor {
  position: relative;
  flex: 0 1 22rem;
  max-width: 22rem;
  width: 100%;
  margin-right: auto;
  margin-left: 0;
  align-self: flex-start;
  z-index: 29;
}

.farmer-farm-summary-anchor .farmer-crop-profile__panel {
  left: 0;
  right: auto;
}

.farmer-farm-summary__lead {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.farmer-farm-summary__lead .icon-svg {
  width: 22px;
  height: 22px;
}

.farmer-crop-detail-header__main {
  flex: 1 1 18rem;
  min-width: 0;
}

.farmer-crop-detail-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.farmer-crop-detail-thumb-wrap {
  display: inline-flex;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.farmer-crop-detail-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--form-well-border);
  border-radius: var(--control-radius);
  background: var(--form-well-bg);
}

.farmer-crop-detail-items__session {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.farmer-crop-detail-items__session + .farmer-crop-detail-items__session {
  padding-top: 0.75rem;
  border-top: 1px solid var(--form-well-border);
}

.farmer-crop-detail-items__session-head {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.farmer-crop-detail-items__session-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.75rem;
}

.farmer-crop-detail-items__item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 9rem;
}

.farmer-crop-detail-items__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.farmer-crop-detail-items__value {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.farmer-crop-profile-anchor {
  position: relative;
  flex: 0 1 22rem;
  max-width: 22rem;
  width: 100%;
  margin-left: auto;
  align-self: flex-start;
  z-index: 30;
}

.farmer-crop-profile {
  margin: 0;
  width: 100%;
  max-width: 100%;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

html[data-theme="dark"] .farmer-crop-profile {
  background: transparent;
  box-shadow: none;
}

.farmer-crop-profile__summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-solid);
  box-shadow: 0 4px 20px rgba(6, 78, 59, 0.1);
}

html[data-theme="dark"] .farmer-crop-profile__summary {
  background: rgba(15, 40, 32, 0.82);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.farmer-crop-profile__summary::-webkit-details-marker {
  display: none;
}

.farmer-crop-profile__avatar-wrap {
  flex-shrink: 0;
}

.farmer-crop-profile__avatar-img {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-soft);
}

.farmer-crop-profile__avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.farmer-crop-profile__summary-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  text-align: left;
}

.farmer-crop-profile__kicker {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.farmer-crop-profile__name-line {
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.farmer-crop-profile__chev {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.farmer-crop-profile[open] .farmer-crop-profile__chev {
  transform: rotate(180deg);
}

.farmer-crop-profile__panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  left: auto;
  width: min(22rem, calc(100vw - 2rem));
  max-height: min(72vh, 30rem);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 1rem 1rem;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  z-index: 50;
  -webkit-overflow-scrolling: touch;
}

html[data-theme="dark"] .farmer-crop-profile__panel {
  background: rgba(18, 42, 34, 0.98);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.55);
}

.farmer-crop-profile__details {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

.farmer-crop-profile__detail {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.farmer-crop-profile__detail-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
}

.farmer-crop-profile__detail-label .icon-svg {
  flex-shrink: 0;
  opacity: 0.9;
}

.farmer-crop-profile__detail-value {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
}

@media (max-width: 768px) {
  .farmer-crop-detail-header {
    flex-direction: column;
  }

  .farmer-farm-summary-anchor {
    max-width: none;
    width: 100%;
    margin-right: 0;
  }

  .farmer-crop-profile-anchor {
    max-width: none;
    margin-left: 0;
    width: 100%;
  }

  .farmer-crop-profile__panel {
    right: 0;
    left: 0;
    width: auto;
    max-width: none;
  }
}

.dash-title {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .dash-title {
    font-size: 1.28rem;
  }
}

.dash-title .icon-svg {
  padding: 6px;
  border-radius: 10px;
  background: var(--accent-soft);
}

.dash-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 56rem;
}

.dashboard-header.warehouse-dist-page__header {
  margin-bottom: clamp(1.15rem, 3vw, 1.85rem);
  padding-bottom: clamp(1rem, 2.5vw, 1.35rem);
}

@media (max-width: 640px) {
  .dashboard-header.warehouse-dist-page__header {
    margin-bottom: 1.15rem;
    padding-bottom: 0.85rem;
  }
}

.dash-card-lede {
  margin-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.pill-warn {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.role-display {
  text-transform: capitalize;
}

/* --- Signed-in layout (header / sidebar / app footer) --- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.layout-session {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  max-width: 100%;
}

.layout-session__body {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  position: relative;
}

.layout-session__stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--workspace-canvas);
}

html[data-theme="dark"] .layout-session__stage {
  background: var(--workspace-canvas);
}

.site-main--session {
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

.app-header {
  flex-shrink: 0;
  min-height: var(--app-header-h);
  background: var(--surface-solid);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(15, 31, 23, 0.04);
  z-index: 400;
}

html[data-theme="dark"] .app-header {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.app-header__inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.85rem 1.25rem;
  flex-wrap: wrap;
  padding-top: 0.62rem;
  padding-bottom: 0.62rem;
  min-height: var(--app-header-h);
}

.app-header__left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.app-header-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.55rem;
  height: 2.55rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--glass-2);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.app-header-back:hover {
  background: var(--accent-soft);
  border-color: rgba(4, 120, 87, 0.26);
}

.app-header-back:focus {
  outline: none;
}

.app-header-back:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-header-back .icon-svg {
  width: 22px;
  height: 22px;
}

.app-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.55rem;
  height: 2.55rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--glass-2);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.app-sidebar-toggle:hover {
  background: var(--accent-soft);
  border-color: rgba(4, 120, 87, 0.26);
}

.app-sidebar-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-sidebar-toggle .icon-svg {
  width: 20px;
  height: 20px;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.app-header__brand:hover {
  opacity: 0.94;
}

.app-header__logo {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #059669 0%, #10b981 55%, #047857 100%);
  color: #ecfdf5;
  box-shadow: 0 6px 16px rgba(4, 120, 87, 0.2);
}

.app-header__logo .icon-svg {
  width: 20px;
  height: 20px;
  color: inherit;
}

.app-header__titles {
  display: flex;
  flex-direction: column;
  gap: 0.06rem;
  min-width: 0;
}

.app-header__title {
  font-size: 0.97rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.app-header__subtitle {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.app-header__right {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  position: relative;
  margin-left: auto;
}

.app-header__right .header-clock {
  background: var(--glass-2);
}

@media (max-width: 720px) {
  .app-header__right .header-clock__date {
    display: none;
  }
}

@media (max-width: 480px) {
  .app-header__right .header-clock {
    padding: 0.28rem 0.55rem;
    font-size: 0.78rem;
  }

  .app-header__right .header-clock__date {
    display: none;
  }
}

.header-user-menu {
  position: relative;
  z-index: 420;
}

.header-user-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.55rem 0.35rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--chip);
  cursor: pointer;
  font: inherit;
  color: inherit;
  max-width: min(100vw - 8rem, 22rem);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.header-user-menu__trigger:hover {
  background: var(--chip-hover);
  border-color: rgba(4, 120, 87, 0.28);
}

.header-user-menu__trigger:focus {
  outline: none;
}

.header-user-menu__trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.header-user-menu.is-open .header-user-menu__trigger {
  box-shadow: 0 8px 28px rgba(6, 78, 59, 0.12);
  border-color: rgba(4, 120, 87, 0.35);
}

.header-user-menu__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 14px rgba(6, 78, 59, 0.12);
}

.header-user-menu__avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  color: #ecfdf5;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.header-user-menu__summary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.06rem;
  min-width: 0;
  text-align: left;
}

.header-user-menu__name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user-menu__role {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: capitalize;
}

.header-user-menu__chevron {
  flex-shrink: 0;
  margin-left: 0.15rem;
  color: var(--muted);
  transition: transform 0.22s ease;
}

.header-user-menu.is-open .header-user-menu__chevron {
  transform: rotate(180deg);
}

.header-user-menu__panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: min(15rem, calc(100vw - 2rem));
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 48px rgba(6, 78, 59, 0.14);
}

html[data-theme="dark"] .header-user-menu__panel {
  background: rgba(7, 31, 25, 0.94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

/* --- Theme toggle (modern switch) --- */

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.35rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--toggle-track);
  box-shadow: 0 10px 22px rgba(6, 78, 59, 0.08);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.22s ease, background 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(6, 78, 59, 0.12);
  border-color: rgba(4, 120, 87, 0.26);
}

.theme-toggle:focus {
  outline: none;
}

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

.theme-toggle::before {
  content: "";
  position: absolute;
  inset: 4px auto 4px 4px;
  width: 1.55rem;
  border-radius: 999px;
  background: var(--toggle-knob);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
  transform: translateX(0);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s ease;
}

html[data-theme="dark"] .theme-toggle::before {
  transform: translateX(1.25rem);
}

.theme-toggle__icon {
  position: absolute;
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  color: var(--accent);
  opacity: 0.95;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease, color 0.2s ease;
}

.theme-toggle__icon .icon-svg {
  width: 18px;
  height: 18px;
  color: currentColor;
}

.theme-toggle__icon--sun {
  left: 6px;
  transform: scale(1);
}

.theme-toggle__icon--moon {
  right: 6px;
  transform: scale(1);
}

html[data-theme="dark"] .theme-toggle__icon--sun {
  opacity: 0.5;
}

html[data-theme="dark"] .theme-toggle__icon--moon {
  opacity: 1;
  color: #e6fff6;
}

html[data-theme="light"] .theme-toggle__icon--moon {
  opacity: 0.6;
}

.header-user-menu__panel[hidden] {
  display: none !important;
}

.header-user-menu__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.62rem 0.75rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none !important;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s ease;
}

.header-user-menu__item:hover {
  background: var(--accent-soft);
}

.header-user-menu__item .icon-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--accent);
}

.header-user-menu__item--btn {
  margin-top: 0.15rem;
}

.header-user-menu__logout-form {
  margin: 0;
  padding: 0;
}

.profile-layout {
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 720px) {
  .profile-layout {
    grid-template-columns: 200px 1fr;
    align-items: start;
  }
}

@media (min-width: 1100px) {
  .profile-layout {
    grid-template-columns: 240px 1fr;
  }
}

.profile-avatar-block {
  text-align: center;
}

.profile-photo-lg {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

@media (max-width: 420px) {
  .profile-photo-lg {
    width: 132px;
    height: 132px;
  }

  .profile-photo-lg--fallback {
    font-size: 1.95rem;
  }
}

.profile-photo-lg--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  color: #ecfdf5;
  font-size: 2.25rem;
  font-weight: 700;
}

.profile-name {
  margin: 1rem 0 0.25rem;
  font-size: 1.12rem;
  font-weight: 700;
}

.profile-role {
  margin: 0;
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: capitalize;
}

.profile-fields {
  margin: 0;
  display: grid;
  gap: 1rem;
}

@media (min-width: 980px) {
  /* On desktop, make profile fields auto-fit into two columns */
  .profile-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.25rem;
    row-gap: 1.05rem;
  }

  /* Keep actions full width if inside profile fields */
  .profile-fields .actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .profile-layout {
    gap: 1.25rem;
  }

  .profile-avatar-block {
    text-align: left;
    display: grid;
    grid-template-columns: 110px 1fr;
    column-gap: 0.85rem;
    align-items: center;
  }

  .profile-avatar-block .profile-photo-lg,
  .profile-avatar-block .profile-photo-lg--fallback {
    margin: 0;
  }

  .profile-avatar-block .field {
    grid-column: 1 / -1;
  }
}

.profile-field dt {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.profile-field dd {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.profile-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9rem;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(15, 31, 23, 0.06);
}

@media (max-width: 639px) {
  .header-user-menu__summary {
    display: none;
  }

  .header-user-menu__trigger {
    padding: 0.32rem;
    border-radius: 50%;
  }

  .header-user-menu__chevron {
    display: none;
  }
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--app-header-h);
  background: rgba(15, 31, 23, 0.38);
  z-index: 280;
  border: none;
  padding: 0;
  margin: 0;
}

.sidebar-backdrop[hidden] {
  display: none !important;
}

body.sidebar-open .sidebar-backdrop:not([hidden]) {
  display: block;
}

.app-sidebar {
  flex-shrink: 0;
  width: var(--app-sidebar-w);
  background: var(--surface-solid);
  border-right: 1px solid var(--border);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  z-index: 320;
}

html[data-theme="dark"] .app-sidebar {
  box-shadow: none;
}

.app-sidebar__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 1.15rem 1rem 1rem;
}

.app-sidebar__section {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.app-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.app-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.62rem 0.72rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none !important;
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.app-sidebar__link .icon-svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  color: var(--accent);
}

.app-sidebar__link:hover:not(.app-sidebar__link--signout) {
  background: var(--accent-soft);
  border-color: rgba(4, 120, 87, 0.15);
}

.app-sidebar__link.is-active {
  background: var(--accent-soft);
  border-color: rgba(4, 120, 87, 0.22);
  color: var(--accent-hover);
}

html[data-theme="dark"] .app-sidebar__link.is-active {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(52, 211, 153, 0.22);
  color: var(--text);
}

.app-sidebar__bottom {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.app-sidebar__logout-form {
  margin: 0;
  width: 100%;
}

.app-sidebar__link--signout {
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  border-color: transparent;
}

.app-sidebar__link--signout:hover {
  background: rgba(254, 242, 242, 0.9);
  border-color: rgba(185, 28, 28, 0.22);
  color: var(--danger);
}

html[data-theme="dark"] .app-sidebar__link--signout:hover {
  background: rgba(185, 28, 28, 0.14);
  border-color: rgba(239, 68, 68, 0.22);
  color: #fecaca;
}

.app-sidebar__link--signout:hover .icon-svg {
  color: var(--danger);
}

.app-sidebar__hint {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.45;
}

.app-sidebar__hint--bottom {
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px dashed rgba(15, 31, 23, 0.08);
  font-size: 0.72rem;
}

html[data-theme="dark"] .app-sidebar__hint--bottom {
  border-top-color: rgba(230, 255, 246, 0.14);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.35rem;
}

@media (max-width: 480px) {
  .settings-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-actions .button,
  .settings-actions .button-ghost {
    width: 100%;
    justify-content: center;
  }
}

.settings-card-title {
  margin-top: 0;
}

.panel .form-grid > .settings-card-title {
  grid-column: 1 / -1;
  margin: 1.35rem 0 0.25rem;
  padding: 0.55rem 0 0.55rem;
  border-bottom: 1px solid var(--form-well-border);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-hover);
}

.panel .form-grid > .settings-card-title:first-child {
  margin-top: 0;
  padding-top: 0;
}

.settings-lede-tight {
  margin-bottom: 0 !important;
}

.panel .actions,
.panel .form-actions {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--form-well-border);
}

/* Tables + row action panels */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-solid);
}

html[data-theme="dark"] .table-wrap {
  background: rgba(7, 31, 25, 0.55);
}

/* Modal (edit popup) */
body.modal-open {
  overflow: hidden;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 31, 23, 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 1000;
}

.modal {
  width: min(760px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 28px 70px rgba(6, 78, 59, 0.22);
  outline: none;
}

html[data-theme="dark"] .modal {
  background: rgba(7, 31, 25, 0.94);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
  background: inherit;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.modal__title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.modal__body {
  padding: 1.1rem;
}

.modal__close {
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
}

.modal__footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 0.85rem 0;
  margin-top: 0.95rem;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.82), transparent);
}

html[data-theme="dark"] .modal__footer {
  background: linear-gradient(to top, rgba(7, 31, 25, 0.98), rgba(7, 31, 25, 0.82), transparent);
}

/* Make the edit popup form feel structured */
.modal .form-grid {
  gap: 1rem;
}

.modal .settings-card-title {
  margin: 0.35rem 0 0.1rem;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal .row-form {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(15, 31, 23, 0.08);
  border-radius: 14px;
  padding: 0.85rem;
}

html[data-theme="dark"] .modal .row-form {
  background: rgba(7, 31, 25, 0.7);
  border-color: rgba(230, 255, 246, 0.12);
}

.modal .row-form input,
.modal .row-form select {
  min-height: 2.5rem;
}

.modal-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.modal-field {
  min-width: 0;
}

.modal-field--span2 {
  grid-column: span 2;
}

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

.modal-row > input {
  flex: 1;
}

.modal-preview {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  border: 1px solid rgba(15, 31, 23, 0.1);
  background: rgba(255, 255, 255, 0.65);
}

html[data-theme="dark"] .modal-preview {
  background: rgba(7, 31, 25, 0.72);
  border-color: rgba(230, 255, 246, 0.12);
}

.modal-preview__img {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 10px 22px rgba(6, 78, 59, 0.14);
}

.modal-preview__link {
  font-weight: 700;
}

.modal-value {
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(15, 31, 23, 0.08);
  background: rgba(255, 255, 255, 0.55);
  font-weight: 600;
}

html[data-theme="dark"] .modal-value {
  background: rgba(7, 31, 25, 0.7);
  border-color: rgba(230, 255, 246, 0.12);
}

@media (min-width: 860px) {
  .modal {
    width: min(980px, calc(100vw - 2rem));
  }
}

@media (min-width: 720px) {
  .modal .row-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 0.75rem;
    row-gap: 0.6rem;
  }
}

@media (min-width: 1100px) {
  .modal .row-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Keep file inputs readable in the modal grid */
.modal input[type="file"] {
  text-transform: none;
  letter-spacing: normal;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.data-table.distribution-farmers-table {
  min-width: 600px;
}

.data-table.distribution-employees-table {
  min-width: 520px;
}

.data-table.distribution-directory-table {
  min-width: 760px;
}

.data-table th,
.data-table td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid rgba(15, 31, 23, 0.08);
  vertical-align: top;
  font-size: 0.9rem;
}

.data-table th {
  position: sticky;
  top: 0;
  background: var(--chip);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  font-weight: 800;
  z-index: 1;
}

.data-table tr:hover td {
  background: rgba(236, 253, 245, 0.55);
}

.data-table tr.is-suspended td {
  background: rgba(254, 226, 226, 0.65);
}

.data-table tr.is-suspended:hover td {
  background: rgba(254, 202, 202, 0.75);
}

.data-table tr.is-suspended .profile-code {
  background: rgba(185, 28, 28, 0.08);
}

.row-actions {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--chip);
  padding: 0.35rem 0.5rem;
}

.row-actions__summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent-hover);
}

.row-actions__body {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.7rem;
}

.row-form {
  display: grid;
  gap: 0.45rem;
}

.row-form input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.72rem 0.85rem;
  border-radius: var(--control-radius);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  box-shadow: var(--input-shade);
  font: inherit;
}

.row-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  width: 100%;
  min-width: 0;
}

/* Collapsible register forms */
.form-disclosure {
  margin-top: 0.75rem;
  border: 1px solid var(--form-well-border);
  border-radius: 12px;
  background: var(--surface-solid);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 31, 23, 0.05);
}

.form-disclosure__summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--form-well-bg);
  border-bottom: 1px solid transparent;
}

.form-disclosure__summary::-webkit-details-marker {
  display: none;
}

.form-disclosure__summary-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.form-disclosure__summary-inner .icon-svg {
  width: 18px;
  height: 18px;
  padding: 6px;
  border-radius: 10px;
  background: var(--accent-soft);
}

.form-disclosure__body {
  padding: 0.25rem 1rem 1.1rem;
  background: var(--surface-solid);
}

.form-disclosure[open] .form-disclosure__summary {
  border-bottom-color: var(--form-well-border);
  background: var(--form-well-bg);
}

@media (max-width: 640px) {
  .form-disclosure__body {
    padding: 0.15rem 0.85rem 1rem;
  }
}

@media (min-width: 720px) {
  .row-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .row-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.app-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--surface-solid);
}

html[data-theme="dark"] .app-footer {
  background: var(--surface-solid);
}

.app-footer__inner {
  padding-top: 1rem;
  padding-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

@media (min-width: 640px) {
  .app-footer__inner {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.65rem 1.25rem;
  }
}

.app-footer__links {
  font-size: 0.8rem;
  color: var(--muted);
}

.app-footer__sep {
  margin: 0 0.35rem;
  opacity: 0.55;
}

.app-footer__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  font-size: 0.76rem;
  color: var(--muted);
}

.app-footer__badge {
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(4, 120, 87, 0.1);
  color: var(--accent-hover);
  font-weight: 600;
}

html[data-theme="dark"] .app-footer__badge {
  background: rgba(16, 185, 129, 0.14);
  color: var(--text);
}

@media (min-width: 960px) {
  /* App shell: keep header + sidebar fixed; only the main column scrolls. */
  body.has-session {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body.has-session .layout-session {
    flex: 1;
    min-height: 0;
  }

  .layout-session__stage {
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  .app-sidebar__inner {
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }

  .app-sidebar-toggle {
    display: none;
  }

  .sidebar-backdrop {
    display: none !important;
  }
}

@media (max-width: 959px) {
  .layout-session__body {
    flex-direction: column;
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: var(--app-header-h);
    bottom: 0;
    width: min(var(--app-sidebar-w), 88vw);
    transform: translateX(-102%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: none;
  }

  .app-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 18px 0 48px rgba(6, 78, 59, 0.14);
  }

  .layout-session__stage {
    width: 100%;
  }

  body.sidebar-open {
    overflow: hidden;
  }
}

@media (max-width: 480px) {
  .app-header__inner {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    flex-wrap: nowrap;
    gap: 0.5rem;
  }

  .app-header__left {
    gap: 0.4rem;
  }

  .app-header-back,
  .app-sidebar-toggle {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
  }

  .app-header-back .icon-svg,
  .app-sidebar-toggle .icon-svg {
    width: 20px;
    height: 20px;
  }

  .app-header__logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .app-header__logo .icon-svg {
    width: 18px;
    height: 18px;
  }

  .app-header__title {
    font-size: 0.92rem;
  }

  .app-header__subtitle {
    display: none;
  }

  .app-header__right {
    margin-left: auto;
    flex-wrap: nowrap;
    gap: 0.45rem;
  }

  .header-user-menu__avatar {
    width: 36px;
    height: 36px;
  }

  .app-sidebar {
    width: min(var(--app-sidebar-w), 92vw);
  }

  .app-sidebar__inner {
    padding: 1rem 0.85rem 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar {
    transition-duration: 0.01ms !important;
  }
}

/* --- Finance: product purchase detail ----------------------------------- */

.finance-purchase-detail-page {
  max-width: var(--workspace-content-max);
  margin-inline: auto;
}

.finance-purchase-detail-page .finance-purchase-detail__hero.dashboard-header {
  margin-bottom: 1.35rem;
  padding: 1.25rem 1.35rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  align-items: center;
}

.finance-purchase-detail-page .finance-purchase-detail__hero .dash-meta {
  margin-top: 0.65rem;
  margin-bottom: 0;
}

.finance-purchase-detail__badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.finance-purchase-detail__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

html[data-theme="dark"] .finance-purchase-detail__badge {
  color: var(--accent);
}

.finance-purchase-detail__badge.is-muted {
  background: var(--form-well-bg);
  color: var(--muted);
}

.finance-purchase-detail__panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 1rem;
}

.finance-purchase-detail__panel-head h3 {
  margin: 0;
}

.finance-purchase-detail__panel-desc {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 36rem;
  line-height: 1.45;
}

.finance-purchase-detail__stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.65rem;
}

@media (min-width: 720px) {
  .finance-purchase-detail__stats {
    grid-template-columns: repeat(auto-fill, minmax(11.25rem, 1fr));
  }
}

.finance-purchase-detail__stat {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.72rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--form-well-bg);
  min-height: 4.35rem;
  justify-content: center;
  animation: fade-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.finance-purchase-detail__stat:nth-child(1) {
  animation-delay: 0.03s;
}
.finance-purchase-detail__stat:nth-child(2) {
  animation-delay: 0.06s;
}
.finance-purchase-detail__stat:nth-child(3) {
  animation-delay: 0.09s;
}
.finance-purchase-detail__stat:nth-child(4) {
  animation-delay: 0.12s;
}
.finance-purchase-detail__stat:nth-child(5) {
  animation-delay: 0.15s;
}
.finance-purchase-detail__stat:nth-child(6) {
  animation-delay: 0.18s;
}
.finance-purchase-detail__stat:nth-child(7) {
  animation-delay: 0.21s;
}
.finance-purchase-detail__stat:nth-child(8) {
  animation-delay: 0.24s;
}
.finance-purchase-detail__stat:nth-child(9) {
  animation-delay: 0.27s;
}
.finance-purchase-detail__stat:nth-child(10) {
  animation-delay: 0.3s;
}

@media (prefers-reduced-motion: reduce) {
  .finance-purchase-detail__stat {
    animation: none !important;
  }
}

.finance-purchase-detail__stat--wide {
  grid-column: 1 / -1;
}

@media (min-width: 600px) {
  .finance-purchase-detail__stat--wide {
    grid-column: span 2;
  }
}

@media (min-width: 900px) {
  .finance-purchase-detail__stat--wide {
    grid-column: span 3;
  }
}

.finance-purchase-detail__stat-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  line-height: 1.25;
}

.finance-purchase-detail__stat-value {
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--text);
  line-height: 1.25;
  word-break: break-word;
}

.finance-purchase-detail__stat-value .pill {
  vertical-align: middle;
  margin-left: 0.15rem;
}

.finance-purchase-detail__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.finance-purchase-detail__toolbar h3 {
  margin: 0;
}

.finance-purchase-detail__toolbar-note {
  margin: 0.35rem 0 0;
  font-size: 0.84rem;
  color: var(--muted);
  max-width: 32rem;
}

.finance-purchase-detail-page .button.button-back-soft {
  border-radius: 999px;
  padding-inline: 1rem;
  font-weight: 700;
  border-color: var(--border);
  background: var(--chip);
}

.finance-purchase-detail-page .button.button-back-soft:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.finance-purchase-detail__table-wrap {
  margin-top: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface-solid);
}

html[data-theme="dark"] .finance-purchase-detail__table-wrap {
  background: rgba(7, 31, 25, 0.45);
}

.finance-purchase-detail__tx-table {
  min-width: 720px;
}

.finance-purchase-detail__tx-table .numeric-col {
  font-variant-numeric: tabular-nums;
}

.finance-purchase-detail__movement-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
}

.finance-purchase-detail__movement-pill--in {
  background: rgba(236, 253, 245, 0.95);
  color: #065f46;
  border-color: rgba(167, 243, 208, 0.95);
}

.finance-purchase-detail__movement-pill--out {
  background: rgba(254, 242, 242, 0.95);
  color: #7f1d1d;
  border-color: rgba(254, 202, 202, 0.95);
}

html[data-theme="dark"] .finance-purchase-detail__movement-pill--in {
  background: rgba(6, 78, 59, 0.45);
  color: var(--accent-hover);
  border-color: rgba(52, 211, 153, 0.28);
}

html[data-theme="dark"] .finance-purchase-detail__movement-pill--out {
  background: rgba(127, 29, 29, 0.35);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.35);
}

.finance-purchase-detail__tx-row--in td:first-child {
  box-shadow: inset 3px 0 0 0 rgba(16, 185, 129, 0.55);
}

.finance-purchase-detail__tx-row--out td:first-child {
  box-shadow: inset 3px 0 0 0 rgba(239, 68, 68, 0.45);
}

.finance-purchase-detail__alloc-placeholder {
  color: var(--muted);
  font-weight: 600;
}

.finance-purchase-detail__alloc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, var(--accent-soft), transparent);
  color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(6, 78, 59, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

html[data-theme="dark"] .finance-purchase-detail__alloc-btn {
  color: var(--accent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.finance-purchase-detail__alloc-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(6, 78, 59, 0.12);
}

.finance-purchase-detail__alloc-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.finance-purchase-detail__alloc-btn .icon-svg {
  width: 1.1rem;
  height: 1.1rem;
}

@keyframes finance-alloc-modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-backdrop.modal-backdrop--alloc-detail:not([hidden]) {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal.modal--alloc-detail {
  width: min(440px, calc(100vw - 2rem));
  max-height: min(560px, calc(100vh - 2rem));
}

.modal.modal--alloc-detail .modal__body {
  padding-top: 0.85rem;
}

.modal.modal--alloc-detail .modal__title .icon-svg {
  opacity: 0.85;
}

.modal.modal--alloc-detail .modal__subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.45;
}

.modal-backdrop.modal-backdrop--alloc-detail:not([hidden]) .modal.modal--alloc-detail {
  animation: finance-alloc-modal-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .modal-backdrop.modal-backdrop--alloc-detail:not([hidden]) .modal.modal--alloc-detail {
    animation: none !important;
  }
}

.alloc-detail-date-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--form-well-bg);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}

.alloc-detail-date-chip .icon-svg {
  width: 1rem;
  height: 1rem;
  opacity: 0.75;
  flex-shrink: 0;
}

.alloc-detail-table-wrap {
  margin-top: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  max-height: 260px;
  overflow-y: auto;
}

.alloc-detail-table-wrap .alloc-detail-table {
  min-width: 0;
}

.alloc-detail-table.data-table th,
.alloc-detail-table.data-table td {
  padding: 0.55rem 0.65rem;
  font-size: 0.86rem;
}

.alloc-detail-table.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.alloc-detail-table.data-table tbody tr:nth-child(even) td {
  background: rgba(4, 120, 87, 0.04);
}

html[data-theme="dark"] .alloc-detail-table.data-table tbody tr:nth-child(even) td {
  background: rgba(52, 211, 153, 0.06);
}

.modal.modal--alloc-detail .modal__footer {
  padding-bottom: 1rem;
}

.modal.modal--alloc-detail .modal__footer .button-primary-soft {
  font-weight: 700;
  border-radius: 999px;
  padding-inline: 1.25rem;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

html[data-theme="dark"] .modal.modal--alloc-detail .modal__footer .button-primary-soft {
  color: var(--accent);
}

/* --- Finance: product purchases list ------------------------------------ */

.finance-purchase-list-page {
  max-width: var(--workspace-content-max);
  margin-inline: auto;
}

.finance-purchase-list-page .finance-purchase-list-page__hero.dashboard-header {
  margin-bottom: 1.35rem;
  padding: 1.25rem 1.35rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.finance-purchase-list-page .finance-purchase-list-page__hero .dash-meta {
  margin-top: 0.65rem;
  margin-bottom: 0;
}

.finance-purchase-list-page__badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.finance-purchase-list-page__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

html[data-theme="dark"] .finance-purchase-list-page__badge {
  color: var(--accent);
}

.finance-purchase-list-page__badge.is-muted {
  background: var(--form-well-bg);
  color: var(--muted);
}

.finance-purchase-list-page__panel-head {
  margin-bottom: 1rem;
}

.finance-purchase-list-page__panel-head h3 {
  margin: 0;
}

.finance-purchase-list-page__panel-desc {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 42rem;
  line-height: 1.45;
}

.finance-purchase-list-page__stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .finance-purchase-list-page__stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.finance-purchase-list-page__stat {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.72rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--form-well-bg);
  justify-content: center;
  min-height: 4rem;
  animation: fade-rise 0.52s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.finance-purchase-list-page__stat:nth-child(1) {
  animation-delay: 0.03s;
}
.finance-purchase-list-page__stat:nth-child(2) {
  animation-delay: 0.06s;
}
.finance-purchase-list-page__stat:nth-child(3) {
  animation-delay: 0.09s;
}

@media (prefers-reduced-motion: reduce) {
  .finance-purchase-list-page__stat {
    animation: none !important;
  }
}

.finance-purchase-list-page__stat--note {
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .finance-purchase-list-page__stat--note {
    grid-column: span 1;
  }
}

.finance-purchase-list-page__stat-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.finance-purchase-list-page__stat-value {
  font-size: 1.02rem;
  font-weight: 750;
  color: var(--text);
  line-height: 1.25;
}

.finance-purchase-list-page__stat-value--small {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
}

.finance-purchase-list-page__table-wrap {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface-solid);
}

html[data-theme="dark"] .finance-purchase-list-page__table-wrap {
  background: rgba(7, 31, 25, 0.45);
}

.finance-purchase-list-page__table {
  min-width: 820px;
}

.finance-purchase-list-page__col-view {
  width: 3.35rem;
  text-align: center;
}

.finance-purchase-list-page__action-cell {
  width: 3.35rem;
  text-align: center;
  vertical-align: middle;
}

.finance-purchase-list-page__view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, var(--accent-soft), transparent);
  color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(6, 78, 59, 0.08);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

html[data-theme="dark"] .finance-purchase-list-page__view-btn {
  color: var(--accent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

/* --- Crops session: required products (inputs) ---------------------------- */

.crop-required-products-page {
  max-width: var(--workspace-content-max);
  margin-inline: auto;
}

.crop-required-products-page .crop-required-products-page__hero.dashboard-header {
  margin-bottom: 1.35rem;
  padding: 1.25rem 1.35rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.crop-required-products-page .dash-meta {
  margin-top: 0.55rem;
}

.crop-required-products-page__badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.crop-required-products-page__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

html[data-theme="dark"] .crop-required-products-page__badge {
  color: var(--accent);
}

.crop-required-products-page__badge.is-muted {
  background: var(--form-well-bg);
  color: var(--muted);
}

.crop-required-products-page__panel-head h3 {
  margin: 0 0 0.35rem;
}

.crop-required-products-page__panel-desc {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 46rem;
}

.crop-required-products-page__table-wrap {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: auto;
  background: var(--surface-solid);
}

html[data-theme="dark"] .crop-required-products-page__table-wrap {
  background: rgba(7, 31, 25, 0.45);
}

.crop-required-products-page__table {
  min-width: 980px;
}

.crop-required-products-page__table .numeric-col {
  font-variant-numeric: tabular-nums;
}

.crop-required-products-page__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 750;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.crop-required-products-page__pill .icon-svg {
  width: 0.95rem;
  height: 0.95rem;
}

.crop-required-products-page__pill--stock {
  background: rgba(236, 253, 245, 0.85);
  color: #065f46;
}

.crop-required-products-page__pill--manual {
  background: rgba(254, 243, 199, 0.65);
  color: #92400e;
}

html[data-theme="dark"] .crop-required-products-page__pill--stock {
  background: rgba(6, 78, 59, 0.45);
  color: var(--accent-hover);
}

html[data-theme="dark"] .crop-required-products-page__pill--manual {
  background: rgba(120, 53, 15, 0.35);
  color: #fcd34d;
}

.crop-required-products-page__empty {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: var(--form-well-bg);
}

.crop-required-products-page__col-view {
  width: 3.35rem;
  text-align: center;
}

.crop-required-products-page__action-cell {
  width: 3.35rem;
  text-align: center;
  vertical-align: middle;
}

.crop-required-products-page__row--click {
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.crop-required-products-page__row--click:hover td {
  background: rgba(236, 253, 245, 0.55);
}

html[data-theme="dark"] .crop-required-products-page__row--click:hover td {
  background: rgba(52, 211, 153, 0.07);
}

.crop-required-products-page__row--click:focus {
  outline: none;
}

.crop-required-products-page__row--click:focus-visible td:first-child {
  box-shadow: inset 3px 0 0 0 var(--accent);
}

/* --- Crops session: required product farmer breakdown --------------------- */

.crop-required-detail-page {
  max-width: var(--workspace-content-max);
  margin-inline: auto;
}

.crop-required-detail-page__hero.dashboard-header {
  margin-bottom: 1.35rem;
  padding: 1.25rem 1.35rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.crop-required-detail-page__item-card {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--form-well-bg);
}

.crop-required-detail-page__item-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.crop-required-detail-page__item-title {
  margin: 0 0 0.35rem;
  font-size: 1.08rem;
  font-weight: 750;
  color: var(--text);
}

.crop-required-detail-page__panel-head h3 {
  margin: 0 0 0.35rem;
}

.crop-required-detail-page__panel-desc {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 44rem;
}

.crop-required-detail-page__stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.crop-required-detail-page__grand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  flex: 1 1 16rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--accent-soft);
}

.crop-required-detail-page__stock-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  flex: 1 1 12rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--form-well-bg);
}

.crop-required-detail-page__stock-chip-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.crop-required-detail-page__stock-chip-value {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.crop-required-detail-page__issue-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  flex: 1 1 12rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--chip);
}

.crop-required-detail-page__issue-chip-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.crop-required-detail-page__issue-chip-value {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.crop-required-detail-page__issue-chip-hint {
  flex-basis: 100%;
  margin: 0;
}

@media (min-width: 520px) {
  .crop-required-detail-page__issue-chip-hint {
    flex-basis: auto;
    margin-left: auto;
  }
}

.crop-required-detail-page__grand-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.crop-required-detail-page__grand-value {
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.crop-required-detail-page__table-wrap {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: auto;
  background: var(--surface-solid);
}

html[data-theme="dark"] .crop-required-detail-page__table-wrap {
  background: rgba(7, 31, 25, 0.45);
}

.crop-required-detail-page__table {
  min-width: 980px;
}

.crop-required-detail-page__data-row--over td {
  box-shadow: inset 3px 0 0 0 rgba(217, 119, 6, 0.65);
}

.crop-required-detail-page__over-hint {
  margin-top: 0.2rem;
  color: #b45309;
  font-weight: 650;
}

html[data-theme="dark"] .crop-required-detail-page__over-hint {
  color: #fcd34d;
}

.crop-required-detail-page__table .numeric-col {
  font-variant-numeric: tabular-nums;
}

.crop-required-detail-page__col-check {
  width: 2.5rem;
  text-align: center;
  vertical-align: middle;
}

.crop-required-detail-page__col-check input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.crop-required-detail-page__stock-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.crop-required-detail-page__stock-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

@media (min-width: 720px) {
  .crop-required-detail-page__stock-actions {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
  }
}

.crop-required-detail-page__selection-live {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.35);
}

html[data-theme="dark"] .crop-required-detail-page__selection-live {
  background: rgba(7, 31, 25, 0.35);
}

.crop-required-detail-page__selection-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.crop-required-detail-page__selection-value {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.crop-required-detail-page__stock-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: flex-end;
}

.crop-required-detail-page__note-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: min(100%, 14rem);
}

.crop-required-detail-page__note-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.crop-required-detail-page__note-field input {
  min-height: 2.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--control-radius);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  font-weight: 600;
}

button[data-stock-submit]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.crop-required-detail-page__deficit-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(185, 28, 28, 0.42);
  background: rgba(254, 226, 226, 0.94);
  color: #7f1d1d;
  font-size: 0.88rem;
  line-height: 1.45;
}

.crop-required-detail-page__deficit-alert .icon-svg {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.08rem;
}

.crop-required-detail-page__deficit-alert-body strong {
  display: block;
  margin-bottom: 0.25rem;
}

html[data-theme="dark"] .crop-required-detail-page__deficit-alert {
  background: rgba(127, 29, 29, 0.42);
  border-color: rgba(248, 113, 113, 0.38);
  color: #fecaca;
}

.crop-required-detail-page__remainder-global-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.75rem 0.95rem;
  margin-bottom: 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(185, 28, 28, 0.45);
  background: rgba(254, 226, 226, 0.96);
  color: #7f1d1d;
  font-size: 0.88rem;
  line-height: 1.45;
}

.crop-required-detail-page__remainder-global-alert .icon-svg {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.06rem;
}

html[data-theme="dark"] .crop-required-detail-page__remainder-global-alert {
  background: rgba(127, 29, 29, 0.42);
  border-color: rgba(248, 113, 113, 0.38);
  color: #fecaca;
}

.crop-required-detail-page__no-remainder-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(180, 83, 9, 0.45);
  background: rgba(254, 243, 199, 0.94);
  color: #92400e;
  font-size: 0.88rem;
  line-height: 1.45;
}

.crop-required-detail-page__no-remainder-alert .icon-svg {
  flex-shrink: 0;
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.06rem;
}

.crop-required-detail-page__no-remainder-body strong {
  display: block;
  margin-bottom: 0.25rem;
}

html[data-theme="dark"] .crop-required-detail-page__no-remainder-alert {
  background: rgba(120, 53, 15, 0.42);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fde68a;
}

.crop-required-detail-page__table-wrap--remainder-blocked {
  border-color: rgba(185, 28, 28, 0.35);
  box-shadow: inset 0 0 0 1px rgba(254, 202, 202, 0.5);
  background: rgba(254, 242, 242, 0.35);
}

html[data-theme="dark"] .crop-required-detail-page__table-wrap--remainder-blocked {
  border-color: rgba(248, 113, 113, 0.28);
  box-shadow: inset 0 0 0 1px rgba(127, 29, 29, 0.35);
  background: rgba(69, 10, 10, 0.25);
}

.crop-required-detail-page__data-row--no-remainder td {
  background: rgba(254, 243, 199, 0.82) !important;
}

.crop-required-detail-page__data-row--no-remainder:hover td {
  background: rgba(253, 224, 139, 0.88) !important;
}

html[data-theme="dark"] .crop-required-detail-page__data-row--no-remainder td {
  background: rgba(120, 53, 15, 0.42) !important;
}

html[data-theme="dark"] .crop-required-detail-page__data-row--no-remainder:hover td {
  background: rgba(146, 64, 14, 0.5) !important;
}

.crop-required-detail-page__data-row--deficit td {
  background: rgba(254, 202, 202, 0.78) !important;
}

.crop-required-detail-page__data-row--deficit:hover td {
  background: rgba(248, 113, 113, 0.52) !important;
}

html[data-theme="dark"] .crop-required-detail-page__data-row--deficit td {
  background: rgba(153, 27, 27, 0.45) !important;
}

html[data-theme="dark"] .crop-required-detail-page__data-row--deficit:hover td {
  background: rgba(185, 28, 28, 0.52) !important;
}

.finance-purchase-list-page__view-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(6, 78, 59, 0.12);
}

.finance-purchase-list-page__view-btn:focus {
  outline: none;
}

.finance-purchase-list-page__view-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.finance-purchase-list-page__view-btn .icon-svg {
  width: 1.1rem;
  height: 1.1rem;
}

.finance-purchase-list-page__table .numeric-col {
  font-variant-numeric: tabular-nums;
}

.finance-purchase-list-page__row {
  cursor: pointer;
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

.finance-purchase-list-page__row td {
  vertical-align: middle;
}

.finance-purchase-list-page__row:hover td {
  background: rgba(236, 253, 245, 0.72);
}

html[data-theme="dark"] .finance-purchase-list-page__row:hover td {
  background: rgba(52, 211, 153, 0.08);
}

.finance-purchase-list-page__row:focus {
  outline: none;
}

.finance-purchase-list-page__row:focus-visible td {
  box-shadow: inset 0 0 0 2px var(--accent);
  background: rgba(236, 253, 245, 0.85);
}

html[data-theme="dark"] .finance-purchase-list-page__row:focus-visible td {
  background: rgba(52, 211, 153, 0.12);
}

.finance-purchase-list-page__product-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: flex-start;
}

.finance-purchase-list-page__code {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent-hover);
}

html[data-theme="dark"] .finance-purchase-list-page__code {
  color: var(--accent);
}

.finance-purchase-list-page__name {
  font-weight: 650;
  color: var(--text);
}

.finance-purchase-list-page__muted {
  color: var(--muted);
  font-weight: 600;
}

.finance-purchase-list-page__type-pill {
  display: inline-flex;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--text);
}
