.ns-agriquery {
  --agri-ink: #123640;
  --agri-muted: #718089;
  --agri-line: #dde7dc;
  --agri-soft: #f4f7f4;
  --agri-accent: #04c905;
  --agri-accent-hover: #03ad04;
  margin: 22px 0 42px;
  padding: 16px;
  border-radius: 16px;
  color: var(--agri-ink);
  background: #f5f7f6;
}

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

.ns-agriquery button,
.ns-agriquery input {
  font: inherit;
}

.ns-agriquery button {
  cursor: pointer;
}

.ns-agriquery-workbench,
.ns-agriquery-results-panel {
  border: 1px solid #e6ece6;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(35, 73, 40, .035);
}

.ns-agriquery-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--agri-line);
}

.ns-agriquery-title {
  position: relative;
  display: inline-block;
  margin: 0;
  padding-bottom: 10px;
  color: var(--agri-ink);
  font-size: 22px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: .01em;
}

.ns-agriquery-title::after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 72px;
  height: 3px;
  background: var(--agri-accent);
  content: "";
}

.ns-agriquery-subtitle {
  margin: 4px 0 0;
  color: var(--agri-muted);
  font-size: 13px;
}

.ns-agriquery-tabs {
  display: flex;
  flex: none;
  gap: 3px;
  padding: 4px;
  border: 1px solid #e4eae4;
  border-radius: 9px;
  background: #f1f4f1;
}

.ns-agriquery-tabs button {
  min-width: 70px;
  height: 34px;
  padding: 0 17px;
  border: 0;
  border-radius: 6px;
  color: #5d6a70;
  background: transparent;
}

.ns-agriquery-tabs button:hover {
  color: var(--agri-accent);
}

.ns-agriquery-tabs button.is-active {
  color: #fff;
  background: var(--agri-accent);
  box-shadow: 0 2px 7px rgba(4, 201, 5, .22);
}

.ns-agriquery-search {
  padding: 22px 24px 20px;
}

.ns-agriquery-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px 24px;
}

.ns-agriquery-search.is-seed .ns-agriquery-fields {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.ns-agriquery-fields label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 9px;
}

.ns-agriquery-fields label > span {
  color: #314951;
  font-size: 14px;
  font-weight: 500;
}

.ns-agriquery-fields input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #d8dfe2;
  border-radius: 6px;
  outline: 0;
  color: var(--agri-ink);
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.ns-agriquery-fields input::placeholder {
  color: #a8b2b7;
}

.ns-agriquery-fields input:focus {
  border-color: #6edb69;
  box-shadow: 0 0 0 3px rgba(4, 201, 5, .12);
}

.ns-agriquery-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.ns-agriquery-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  color: #3c5058;
  font-size: 14px;
  cursor: pointer;
}

.ns-agriquery-checkbox input {
  width: 17px;
  height: 17px;
  accent-color: var(--agri-accent);
}

.ns-agriquery-reset,
.ns-agriquery-submit {
  height: 42px;
  padding: 0 24px;
  border-radius: 6px;
}

.ns-agriquery-reset {
  border: 1px solid #cfd7da;
  color: #243d46;
  background: #fff;
}

.ns-agriquery-reset:hover {
  border-color: var(--agri-accent);
  color: var(--agri-accent);
}

.ns-agriquery-submit {
  min-width: 92px;
  border: 1px solid var(--agri-accent);
  color: #fff;
  background: var(--agri-accent);
}

.ns-agriquery-submit:hover {
  border-color: var(--agri-accent-hover);
  background: var(--agri-accent-hover);
}

.ns-agriquery-submit:disabled {
  cursor: wait;
  opacity: .72;
}

.ns-agriquery-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.ns-agriquery-stat {
  position: relative;
  display: flex;
  min-height: 104px;
  flex-direction: column;
  justify-content: center;
  padding: 18px 21px;
  overflow: hidden;
  border: 1px solid #e3eae3;
  border-radius: 10px;
  background: #f7faf7;
}

.ns-agriquery-stat::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: #04c905;
  content: "";
}

.ns-agriquery-stat span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #42565d;
  font-size: 13px;
}

.ns-agriquery-stat span em {
  font-style: normal;
}

.ns-agriquery-stat svg {
  width: 21px;
  height: 21px;
  flex: none;
  fill: none;
  stroke: #58aa45;
  stroke-width: 1.5;
  opacity: .48;
}

.ns-agriquery-stat b {
  margin-top: 9px;
  color: var(--agri-ink);
  font-size: 29px;
  line-height: 1.1;
  font-weight: 650;
  font-family: "DIN Alternate", "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.ns-agriquery-stat.is-loading span,
.ns-agriquery-stat.is-loading b {
  width: 66%;
  height: 13px;
  border-radius: 4px;
  background: #eef2f3;
  animation: ns-agriquery-pulse 1.2s ease-in-out infinite;
}

.ns-agriquery-stat.is-loading b {
  width: 48%;
  height: 28px;
}

.ns-agriquery-results-panel {
  padding: 22px 24px 20px;
}

.ns-agriquery-results-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  border-bottom: 1px solid var(--agri-line);
}

.ns-agriquery-results-head h2 {
  position: relative;
  margin: 0;
  padding-bottom: 13px;
  color: var(--agri-ink);
  font-size: 17px;
  font-weight: 650;
}

.ns-agriquery-results-head h2::after {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 68px;
  height: 3px;
  background: var(--agri-accent);
  content: "";
}

.ns-agriquery-result-total {
  color: #596b72;
  font-size: 13px;
}

.ns-agriquery-status {
  display: flex;
  align-items: center;
  min-height: 20px;
  margin: 12px 0 8px;
  color: var(--agri-muted);
  font-size: 12px;
}

.ns-agriquery-status.is-loading {
  color: #41656e;
}

.ns-agriquery-status.is-loading::before,
.ns-agriquery-loading-card i,
.ns-agriquery-detail-loading i {
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid rgba(7, 59, 71, .18);
  border-top-color: var(--agri-accent);
  border-radius: 50%;
  animation: ns-agriquery-spin .75s linear infinite;
}

.ns-agriquery-status.is-loading::before {
  flex: none;
  content: "";
}

.ns-agriquery-status.is-error {
  color: #c74444;
}

.ns-agriquery-table-wrap {
  overflow-x: auto;
}

.ns-agriquery-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  table-layout: auto;
}

.ns-agriquery-table th,
.ns-agriquery-table td {
  padding: 16px 12px;
  border-bottom: 1px solid #e6eaec;
  text-align: left;
  vertical-align: middle;
}

.ns-agriquery-table th {
  color: #66776d;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  background: #f4f7f4;
}

.ns-agriquery-table td {
  color: #2d424a;
  font-size: 14px;
}

.ns-agriquery-table tbody tr {
  transition: background-color .16s ease;
}

.ns-agriquery-table tbody tr:hover {
  background: #f9fcf9;
}

.ns-agriquery-table tbody tr:last-child td {
  border-bottom: 0;
}

.ns-agriquery-table td:first-child {
  color: #267c1b;
  font-weight: 500;
}

.ns-agriquery-status-cell,
.ns-agriquery-action-cell {
  min-width: 82px;
  white-space: nowrap;
}

.ns-agriquery-badge {
  display: inline-flex;
  min-width: 48px;
  height: 26px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
}

.ns-agriquery-badge.is-valid {
  color: #289610;
  background: #e8f8e5;
}

.ns-agriquery-badge.is-inactive {
  color: #6b7280;
  background: #f3f4f6;
}

.ns-agriquery-badge.is-neutral {
  color: #4f6759;
  background: #eef3ee;
}

.ns-agriquery-detail-btn {
  padding: 6px 0;
  border: 0;
  color: var(--agri-accent);
  background: transparent;
  text-decoration: underline;
  text-decoration-color: rgba(37, 141, 18, .35);
  text-underline-offset: 4px;
}

.ns-agriquery-detail-btn:hover {
  color: var(--agri-accent-hover);
}

.ns-agriquery-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
  color: #556970;
  font-size: 13px;
}

.ns-agriquery-pager button {
  height: 34px;
  padding: 0 14px;
  border: 1px solid #d8dfe2;
  border-radius: 6px;
  color: #314951;
  background: #fff;
}

.ns-agriquery-pager button:hover:not(:disabled) {
  border-color: #9db0b6;
}

.ns-agriquery-pager button:disabled {
  cursor: default;
  opacity: .42;
}

.ns-agriquery-page-size {
  width: auto;
  min-width: 104px;
  height: 38px;
  padding: 8px 34px 8px 12px;
  border: 1px solid #d8dfe2;
  border-radius: 6px;
  outline: 0;
  color: #314951;
  background-color: #fff;
  font-size: 13px;
  line-height: 1.4;
}

.ns-agriquery-page-size:focus {
  border-color: var(--agri-accent);
  box-shadow: 0 0 0 3px rgba(4, 201, 5, .12);
}

.ns-agriquery-loading-card,
.ns-agriquery-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  color: #6c7d84;
}

.ns-agriquery-loading-card i,
.ns-agriquery-detail-loading i {
  display: inline-block;
}

.ns-agriquery-detail-mask {
  position: fixed;
  z-index: 10010;
  inset: 0;
  background: rgba(10, 34, 41, .52);
}

.ns-agriquery-detail {
  position: fixed;
  z-index: 10020;
  top: 50%;
  left: 50%;
  width: min(1120px, calc(100vw - 32px));
  max-height: min(86vh, 900px);
  padding: 28px;
  overflow: auto;
  border: 1px solid #dfe5e7;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(10, 34, 41, .25);
  transform: translate(-50%, -50%);
}

.ns-agriquery-detail[hidden],
.ns-agriquery-detail-mask[hidden] {
  display: none;
}

body.ns-agriquery-detail-open {
  overflow: hidden;
}

.ns-agriquery-detail h2 {
  margin: 0 70px 0 0;
  color: var(--agri-ink);
  font-size: 22px;
}

.ns-agriquery-close {
  position: absolute;
  top: 20px;
  right: 20px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid #d5dee1;
  border-radius: 6px;
  color: var(--agri-accent);
  background: #fff;
}

.ns-agriquery-detail-loading,
.ns-agriquery-detail-error {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 46px 0;
  color: #718089;
  text-align: center;
}

.ns-agriquery-detail-error {
  color: #c74444;
}

.ns-agriquery-detail-section {
  margin-top: 24px;
}

.ns-agriquery-detail-section:first-child {
  margin-top: 18px;
}

.ns-agriquery-detail-section h3 {
  margin: 0 0 10px;
  color: var(--agri-ink);
  font-size: 16px;
}

.ns-agriquery-detail-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--agri-line);
  border-left: 1px solid var(--agri-line);
}

.ns-agriquery-detail-field {
  display: grid;
  min-width: 0;
  grid-template-columns: 128px minmax(0, 1fr);
  border-right: 1px solid var(--agri-line);
  border-bottom: 1px solid var(--agri-line);
}

.ns-agriquery-detail-field.is-wide {
  grid-column: 1 / -1;
}

.ns-agriquery-detail-field dt,
.ns-agriquery-detail-field dd {
  min-width: 0;
  margin: 0;
  padding: 11px 14px;
  line-height: 1.6;
}

.ns-agriquery-detail-field dt {
  color: #607078;
  background: var(--agri-soft);
}

.ns-agriquery-detail-field dd {
  color: #263a42;
  word-break: break-word;
}

.ns-agriquery-detail-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--agri-line);
  border-radius: 6px;
}

.ns-agriquery-detail-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  text-align: center;
}

.ns-agriquery-detail-table.is-varieties {
  table-layout: fixed;
}

.ns-agriquery-detail-table.is-varieties th:nth-child(1) { width: 5%; }
.ns-agriquery-detail-table.is-varieties th:nth-child(2) { width: 9%; }
.ns-agriquery-detail-table.is-varieties th:nth-child(3) { width: 7%; }
.ns-agriquery-detail-table.is-varieties th:nth-child(4) { width: 10%; }
.ns-agriquery-detail-table.is-varieties th:nth-child(5) { width: 17%; }
.ns-agriquery-detail-table.is-varieties th:nth-child(6) { width: 14%; }
.ns-agriquery-detail-table.is-varieties th:nth-child(7) { width: 11%; }
.ns-agriquery-detail-table.is-varieties th:nth-child(8) { width: 17%; }
.ns-agriquery-detail-table.is-varieties th:nth-child(9) { width: 10%; }

.ns-agriquery-detail-table th,
.ns-agriquery-detail-table td {
  padding: 11px 14px;
  border-right: 1px solid var(--agri-line);
  border-bottom: 1px solid var(--agri-line);
  line-height: 1.55;
}

.ns-agriquery-detail-table th:last-child,
.ns-agriquery-detail-table td:last-child {
  border-right: 0;
}

.ns-agriquery-detail-table tbody tr:last-child td {
  border-bottom: 0;
}

.ns-agriquery-detail-table th {
  color: #394f57;
  background: var(--agri-soft);
  font-weight: 600;
  white-space: nowrap;
}

.ns-agriquery-detail-table td {
  color: #263a42;
  word-break: break-word;
  white-space: nowrap;
}

.ns-agriquery-detail-table.is-varieties td {
  overflow-wrap: anywhere;
  white-space: normal;
}

.ns-agriquery-detail-table.is-varieties th {
  white-space: normal;
}

.ns-agriquery-detail-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  color: #65786d;
  font-size: 12px;
}

.ns-agriquery-detail-pager button {
  height: 32px;
  padding: 0 12px;
  border: 1px solid #d6e0d6;
  border-radius: 6px;
  color: #365448;
  background: #fff;
}

.ns-agriquery-detail-pager button:hover:not(:disabled) {
  border-color: var(--agri-accent);
  color: var(--agri-accent);
}

.ns-agriquery-detail-pager button:disabled {
  cursor: default;
  opacity: .45;
}

.ns-agriquery-detail-pager b {
  color: #314951;
  font-weight: 500;
}

.ns-agriquery-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.ns-agriquery-detail-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 6px;
  color: #fff;
  background: var(--agri-accent);
}

.ns-agriquery-detail-actions a:hover {
  color: #fff;
  background: var(--agri-accent-hover);
}

@keyframes ns-agriquery-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ns-agriquery-pulse {
  50% {
    opacity: .45;
  }
}

@media (max-width: 1100px) {
  .ns-agriquery-fields,
  .ns-agriquery-search.is-seed .ns-agriquery-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ns-agriquery-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .ns-agriquery-head {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px 18px 16px;
  }

  .ns-agriquery-title {
    font-size: 20px;
  }

  .ns-agriquery-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .ns-agriquery-tabs button {
    flex: 1;
    min-width: 72px;
  }

  .ns-agriquery-search {
    padding: 18px;
  }

  .ns-agriquery-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .ns-agriquery-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ns-agriquery-results-panel {
    padding: 18px;
  }
}

@media (max-width: 560px) {
  body {
    min-width: 0 !important;
    overflow-x: hidden;
  }

  .ns-supply-wrap-con,
  .ns-topbar-in,
  .ns-join-bar-in,
  .ns-supply-header,
  .ns-supply-header-wrap,
  .ns-supply-header-search {
    width: 100% !important;
    min-width: 0 !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
    box-sizing: border-box;
  }

  .ns-topbar-left {
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
  }

  .ns-topbar-right {
    display: none !important;
  }

  .ns-agriquery-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .ns-agriquery-tabs button {
    height: 42px;
  }

  .ns-agriquery-form-actions {
    flex-wrap: wrap;
  }

  .ns-agriquery-checkbox {
    width: 100%;
    margin-right: 0;
  }

  .ns-agriquery-reset,
  .ns-agriquery-submit {
    height: 44px;
    flex: 1;
  }

  .ns-agriquery-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .ns-agriquery-stat {
    min-height: 88px;
    padding: 15px;
  }

  .ns-agriquery-stat b {
    font-size: 24px;
  }

  .ns-agriquery-detail {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 88vh;
    padding: 22px 18px;
    border-radius: 14px 14px 0 0;
    transform: none;
  }

  .ns-agriquery-detail-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .ns-agriquery-detail-field.is-wide {
    grid-column: auto;
  }

  .ns-agriquery-detail-field {
    grid-template-columns: 104px minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ns-agriquery-status.is-loading::before,
  .ns-agriquery-loading-card i,
  .ns-agriquery-detail-loading i,
  .ns-agriquery-stat.is-loading span,
  .ns-agriquery-stat.is-loading b {
    animation: none;
  }
}
