:root {
  --green-900: #263f35;
  --green-800: #315847;
  --green-700: #3e6d59;
  --sage-100: #eef5f0;
  --blue-100: #dfeef4;
  --gold-200: #ead9a5;
  --rose-100: #f5e1dd;
  --paper: #fbfaf7;
  --surface: #ffffff;
  --line: #d8dfd9;
  --line-strong: #bdc9c0;
  --ink: #1f2933;
  --muted: #60707b;
  --shadow: 0 16px 38px rgba(31, 41, 51, 0.12);
  --radius: 8px;
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 24px 18px;
  background: var(--green-900);
  color: #fff;
}

.brand {
  display: grid;
  gap: 14px;
  align-items: start;
  margin-bottom: 28px;
}

.brand-logo {
  display: block;
  width: min(194px, 100%);
  height: auto;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
}

.brand p,
.batch-label {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.12;
  letter-spacing: 0;
}

.filter-block {
  padding: 18px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.block-title {
  display: block;
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.season-list {
  display: grid;
  gap: 7px;
}

.season-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
}

.season-button.active {
  border-color: rgba(234, 217, 165, 0.86);
  color: #fff;
  background: rgba(234, 217, 165, 0.16);
}

.season-button span:last-child {
  color: var(--gold-200);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.rail select,
.rail input {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  padding: 0 10px;
  outline: none;
}

.rail select option {
  color: var(--ink);
}

.rail input::placeholder {
  color: rgba(255, 255, 255, 0.52);
}

.content {
  min-width: 0;
  padding: 26px 30px 42px;
}

.topbar {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.topbar .batch-label {
  color: var(--muted);
}

.topbar h2 {
  margin: 0;
  color: var(--green-900);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: 0;
}

.view-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.toggle,
.secondary {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--green-900);
  background: transparent;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 750;
}

.toggle.active {
  color: #fff;
  background: var(--green-800);
}

.secondary {
  border-color: var(--line);
  background: var(--surface);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(31, 41, 51, 0.04);
}

.kpi span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  color: var(--green-900);
  font-size: 27px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(300px, 1fr) minmax(260px, 0.82fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 20px;
}

.panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(31, 41, 51, 0.04);
}

.panel-head {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 13px;
}

.panel-head h3,
.results-head h3 {
  margin: 0;
  color: var(--green-900);
  font-size: 17px;
  line-height: 1.2;
}

.panel-head span,
.results-head span {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.bar-list,
.vendor-list,
.review-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 58px;
  gap: 10px;
  align-items: center;
  min-height: 28px;
}

.bar-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.bar-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: var(--sage-100);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green-700);
}

.bar-value {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.vendor-row,
.review-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.vendor-row:first-child,
.review-row:first-child {
  border-top: 0;
}

.vendor-row strong,
.review-row strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.vendor-row span,
.review-row span {
  color: var(--muted);
  font-size: 12px;
}

.vendor-total,
.review-total {
  color: var(--green-900);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.review-panel {
  background: linear-gradient(180deg, #fff 0%, #fbfbf8 100%);
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 12px;
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.item-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(31, 41, 51, 0.04);
}

.thumb {
  display: grid;
  position: relative;
  min-height: 185px;
  place-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--sage-100);
}

.thumb img {
  width: 100%;
  height: 185px;
  object-fit: contain;
  padding: 14px;
  background: #fff;
}

.no-photo {
  display: grid;
  width: 96px;
  height: 96px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  color: var(--green-800);
  background: rgba(255, 255, 255, 0.7);
  font-size: 26px;
  font-weight: 850;
}

.season-chip {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: #fff;
  background: rgba(38, 63, 53, 0.88);
  font-size: 11px;
  font-weight: 800;
}

.card-body {
  padding: 13px;
}

.card-body h4 {
  min-height: 43px;
  margin: 0 0 9px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 11px;
}

.meta div {
  min-width: 0;
}

.meta span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.meta strong {
  display: block;
  overflow: hidden;
  color: var(--green-900);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-foot {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.card-foot span {
  color: var(--muted);
  font-size: 12px;
}

.card-foot button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--green-900);
  background: var(--surface);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.assignment-row {
  margin-bottom: 11px;
}

.season-select-label {
  display: grid;
  gap: 5px;
  min-width: 132px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.season-select {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--green-900);
  background: var(--surface);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
  outline: none;
  text-transform: none;
}

.season-select:focus {
  border-color: var(--green-700);
  box-shadow: 0 0 0 3px rgba(62, 109, 89, 0.14);
}

.detail-list .season-select-label {
  max-width: 220px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #fff;
  background: var(--green-800);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

th[data-sort] {
  cursor: pointer;
}

td {
  color: var(--ink);
  font-size: 13px;
}

td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.hidden {
  display: none;
}

.item-dialog {
  width: min(920px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.item-dialog::backdrop {
  background: rgba(20, 30, 26, 0.48);
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--surface);
  font-size: 22px;
  line-height: 1;
}

.dialog-layout {
  display: grid;
  grid-template-columns: minmax(240px, 360px) 1fr;
  min-height: 420px;
}

.dialog-image {
  display: grid;
  place-items: center;
  background: var(--sage-100);
}

.dialog-image img {
  width: 100%;
  height: 100%;
  max-height: 560px;
  object-fit: contain;
  padding: 24px;
  background: #fff;
}

.dialog-info {
  padding: 34px 30px 28px;
}

.dialog-info h3 {
  margin: 0 34px 18px 0;
  color: var(--green-900);
  font-size: 24px;
  line-height: 1.22;
}

.detail-list {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px 16px;
  margin: 0;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  word-break: break-word;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    height: auto;
    padding: 18px;
  }

  .season-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content {
    padding: 20px 16px 34px;
  }

  .topbar,
  .results-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .results-actions {
    justify-content: flex-start;
  }

  .kpi-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .dialog-layout {
    grid-template-columns: 1fr;
  }

  .dialog-image {
    min-height: 280px;
  }
}

@media (max-width: 560px) {
  .season-list {
    grid-template-columns: 1fr;
  }

  .item-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    gap: 8px;
  }
}
