@font-face {
  font-family: "Jost Local";
  src: url("../media/fonts/Jost-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #f3f5f3;
  --surface: #ffffff;
  --surface-muted: #eef1ee;
  --ink: #202421;
  --muted: #626b65;
  --subtle: #7c857f;
  --line: #d8ddd9;
  --line-strong: #b8c1ba;
  --green: #17483d;
  --green-dark: #10372f;
  --green-soft: #dfeae5;
  --gold: #bd8951;
  --gold-soft: #eadac6;
  --danger: #a33a31;
  --danger-soft: #f7e7e4;
  --success: #28755f;
  --focus: #146dba;
  --shadow: 0 12px 32px rgba(20, 45, 37, 0.08);
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: "Jost Local", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
a,
input,
textarea,
summary {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  box-shadow: 0 0 0 3px rgba(20, 109, 186, 0.24);
  border-color: var(--focus);
}

[hidden] {
  display: none !important;
}

.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;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto minmax(250px, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 72px;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: var(--green);
  text-decoration: none;
}

.brand img {
  display: block;
  width: 42px;
  height: 42px;
  border: 1px solid var(--gold-soft);
}

.brand-copy {
  display: grid;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 16px;
  font-weight: 740;
}

.brand-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.view-tabs {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 3px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.view-tab {
  min-width: 112px;
  min-height: 34px;
  padding: 7px 16px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 640;
}

.view-tab:hover {
  color: var(--ink);
}

.view-tab.is-active {
  background: var(--surface);
  color: var(--green);
  box-shadow: 0 1px 3px rgba(16, 55, 47, 0.12);
}

.status {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
  max-width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(40, 117, 95, 0.13);
}

.status.is-busy .status-dot {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(189, 137, 81, 0.16);
}

.status.is-error {
  color: var(--danger);
}

.status.is-error .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(163, 58, 49, 0.12);
}

.app-shell {
  width: min(1580px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.workbench {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  align-items: start;
  gap: 20px;
}

.control-rail {
  position: sticky;
  top: 94px;
  display: grid;
  gap: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.rail-section {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.section-heading,
.surface-head,
.archive-headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  align-items: baseline;
  margin-bottom: 12px;
}

.section-heading h2,
.surface-head h1,
.surface-head h2,
.archive-headline h1,
.field-group h2 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 720;
  line-height: 1.25;
  text-wrap: balance;
}

.section-heading span {
  color: var(--subtle);
  font-size: 11px;
}

.file-drop {
  display: grid;
  place-items: center;
  min-height: 92px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--green);
  text-align: center;
  cursor: pointer;
  transition: border-color 180ms ease-out, background 180ms ease-out;
}

.file-drop:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-drop strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.file-drop span {
  color: var(--muted);
  font-size: 11px;
}

.file-drop:has(input:focus-visible) {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(20, 109, 186, 0.24);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 680;
  line-height: 1.2;
  transition: background 170ms ease-out, border-color 170ms ease-out, color 170ms ease-out, transform 170ms ease-out;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.button-full {
  width: 100%;
}

.file-drop + .button {
  margin-top: 10px;
}

.button-primary {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.button-primary:hover:not(:disabled) {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

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

.button-secondary:hover:not(:disabled) {
  background: var(--green-soft);
  border-color: var(--green);
}

.button-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.button-quiet:hover:not(:disabled) {
  background: var(--surface-muted);
  color: var(--ink);
}

.season-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.season-option {
  position: relative;
  cursor: pointer;
}

.season-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.season-thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 4px;
  background: var(--surface-muted);
}

.season-thumb::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  background: linear-gradient(to top, rgba(13, 31, 26, 0.78), transparent);
  pointer-events: none;
}

.season-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.season-thumb b {
  position: absolute;
  z-index: 1;
  left: 8px;
  bottom: 6px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 650;
}

.season-option:hover .season-thumb {
  border-color: var(--gold);
}

.season-option input:checked + .season-thumb {
  border-color: var(--green);
  box-shadow: 0 0 0 2px var(--green-soft);
}

.season-option input:focus-visible + .season-thumb {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(20, 109, 186, 0.24);
}

.rail-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: var(--surface-muted);
}

.rail-summary div {
  min-width: 0;
}

.rail-summary span,
.surface-head p,
.archive-headline p,
.table-title-row p {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.rail-summary strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--green);
  font-size: 16px;
}

.rail-actions {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
}

.editor-stack {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.surface {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.surface-head {
  align-items: center;
  padding: 19px 22px;
  border-bottom: 1px solid var(--line);
}

.surface-head h1 {
  font-size: 19px;
}

.surface-head h2 {
  font-size: 17px;
}

.surface-head p {
  margin-top: 4px;
}

.surface-head p strong {
  color: var(--green);
  font-weight: 650;
}

.field-grid {
  display: grid;
  gap: 14px;
}

.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 20px 22px;
}

.object-grid {
  grid-template-columns: 1fr 1fr 0.75fr;
}

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

.field-wide {
  grid-column: 1 / -1;
}

.field {
  display: block;
  min-width: 0;
}

.field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
}

.field input,
.field textarea,
.archive-search input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
  line-height: 1.35;
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
}

.field textarea {
  min-height: 76px;
  resize: vertical;
}

.field input:hover,
.field textarea:hover,
.archive-search input:hover {
  border-color: #919d94;
}

.field input::placeholder,
.field textarea::placeholder,
.archive-search input::placeholder {
  color: #68736c;
  opacity: 1;
}

.field-group {
  padding: 20px 22px;
  border-top: 1px solid var(--line);
}

.field-group h2 {
  margin-bottom: 13px;
}

.advanced-settings {
  border-top: 1px solid var(--line);
}

.advanced-settings summary {
  min-height: 48px;
  padding: 14px 22px;
  color: var(--green);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.advanced-settings summary:hover {
  background: var(--surface-muted);
}

.advanced-content {
  border-top: 1px solid var(--line);
}

.advanced-content .compact-grid {
  padding-bottom: 14px;
}

.asset-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 22px 20px;
}

.check-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.check-control input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--green);
}

.asset-file {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--green);
  cursor: pointer;
  font-size: 12px;
}

.asset-file:hover {
  background: var(--green-soft);
  border-color: var(--green);
}

.asset-file input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.table-title-row {
  align-items: center;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  height: 46px;
  padding: 7px 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th:last-child,
td:last-child {
  border-right: 0;
}

th {
  height: 42px;
  background: var(--green-dark);
  color: #ffffff;
  font-size: 11px;
  font-weight: 650;
  text-align: left;
}

tbody tr:nth-child(even):not(.empty-row) {
  background: #f8faf8;
}

tbody tr:hover:not(.empty-row) {
  background: var(--green-soft);
}

td input,
td textarea {
  width: 100%;
  min-height: 32px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

td textarea {
  min-height: 40px;
  resize: vertical;
}

td input:hover,
td textarea:hover {
  border-color: var(--line-strong);
  background: #ffffff;
}

td input:focus,
td textarea:focus {
  border-color: var(--focus);
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(20, 109, 186, 0.16);
}

.col-number {
  width: 48px;
  text-align: center;
}

.col-unit {
  width: 92px;
}

.col-qty {
  width: 88px;
}

.col-money {
  width: 132px;
}

.col-action {
  width: 48px;
  text-align: center;
}

.number-cell {
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 620;
}

.row-remove,
.offer-delete {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.row-remove:hover,
.offer-delete:hover {
  background: var(--danger-soft);
  border-color: #e6b5af;
  color: var(--danger);
}

.empty-row td {
  height: 150px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.table-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  min-height: 66px;
  padding: 14px 22px;
  background: var(--surface-muted);
  border-top: 1px solid var(--line);
}

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

.table-total strong {
  min-width: 150px;
  color: var(--green);
  font-size: 22px;
  text-align: right;
}

.archive-layout {
  max-width: 1180px;
  margin: 0 auto;
}

.archive-headline {
  align-items: flex-end;
  margin-bottom: 18px;
}

.archive-headline h1 {
  font-size: 24px;
}

.archive-headline p {
  margin-top: 4px;
}

.archive-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(520px, 100%);
}

.archive-search .field {
  flex: 1 1 auto;
}

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

.offer-card {
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 138px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 5px 18px rgba(20, 45, 37, 0.05);
  transition: border-color 170ms ease-out, transform 170ms ease-out, box-shadow 170ms ease-out;
}

.offer-card:hover {
  border-color: var(--green);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(20, 45, 37, 0.09);
}

.offer-card strong {
  padding-right: 34px;
  color: var(--green);
  font-size: 16px;
}

.offer-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.offer-season {
  align-self: end;
  width: fit-content;
  padding: 3px 7px;
  border-radius: 3px;
  background: var(--green-soft);
  color: var(--green) !important;
  font-size: 10px !important;
  font-weight: 650;
}

.offer-delete {
  position: absolute;
  top: 10px;
  right: 10px;
}

.archive-loading,
.archive-empty {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 40;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(16, 55, 47, 0.18);
  font-size: 13px;
}

.toast.is-error {
  border-color: #d69b95;
  background: var(--danger-soft);
  color: #722820;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr auto auto;
    gap: 16px;
  }

  .workbench {
    grid-template-columns: 280px minmax(0, 1fr);
  }

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

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

  .object-grid .field:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr auto;
  }

  .view-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .view-tab {
    flex: 1 1 50%;
  }

  .status {
    grid-column: 2;
    grid-row: 1;
  }

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

  .control-rail {
    position: static;
  }

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

  .rail-actions {
    grid-template-columns: 1fr auto;
  }

  .compact-grid,
  .object-grid {
    grid-template-columns: 1fr;
  }

  .object-grid .field:last-child {
    grid-column: auto;
  }

  .archive-headline {
    align-items: stretch;
    flex-direction: column;
  }

  .archive-search {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .topbar {
    padding: 10px 14px;
  }

  .brand-copy small,
  .status-dot {
    display: none;
  }

  .status {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-shell {
    padding: 12px;
  }

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

  .rail-actions {
    grid-template-columns: 1fr;
  }

  .surface-head,
  .field-group,
  .compact-grid {
    padding-left: 15px;
    padding-right: 15px;
  }

  .table-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .asset-controls {
    align-items: stretch;
    flex-direction: column;
    padding-left: 15px;
    padding-right: 15px;
  }

  .archive-search {
    align-items: stretch;
    flex-direction: column;
  }

  .table-total {
    align-items: flex-end;
    flex-direction: column;
    gap: 4px;
  }
}

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