:root {
  --green-dark: #006b3a;
  --green: #007a3d;
  --green-light: #4caf28;
  --gold: #ffcc29;
  --red: #c62828;
  --ink: #1e2721;
  --muted: #68746b;
  --line: #d8e2d3;
  --surface: #ffffff;
  --page: #f5f8f1;
  --soft: #eef6e9;
  --shadow: 0 16px 42px rgba(0, 65, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

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

.app-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  min-height: 92px;
  background: linear-gradient(105deg, #ffffff 0 17%, var(--green-dark) 17% 100%);
  color: #ffffff;
  box-shadow: 0 8px 26px rgba(0, 65, 34, 0.16);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 30px;
}

.brand-logo {
  width: 210px;
  height: 70px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 8px;
}

.brand-block h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand-block p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
}

.header-status {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 360px;
  padding: 0 32px;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
}

.status-label {
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.header-status strong {
  display: block;
  margin-top: 6px;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.25;
  max-height: 34px;
  overflow: hidden;
}

.workspace {
  padding: 18px;
}

.app-grid {
  display: grid;
  grid-template-columns: 300px minmax(620px, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

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

.settings-panel,
.export-panel {
  position: sticky;
  top: 18px;
  padding: 18px;
}

.panel-title,
.products-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  justify-content: flex-start;
  margin-bottom: 18px;
}

.panel-title h2,
.products-toolbar h2 {
  margin: 0;
  color: var(--green-dark);
  font-size: 21px;
  line-height: 1.1;
}

.panel-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green);
  font-weight: 800;
}

.asset-section {
  margin-bottom: 18px;
}

.store-section {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.store-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.store-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--green);
  border-radius: 7px;
  background: #ffffff;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.store-pill.active {
  background: var(--green-dark);
  color: #ffffff;
}

.store-section p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.field-label {
  display: block;
  margin: 12px 0 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.asset-preview {
  display: block;
  width: 100%;
  object-fit: cover;
  border: 1px solid var(--green);
  border-radius: 7px;
  background: #ffffff;
}

.logo-preview {
  height: 92px;
  object-fit: contain;
  padding: 10px;
}

.store-preview {
  height: 126px;
}

.file-button,
.secondary-button,
.primary-button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.file-button {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--green);
  background: #ffffff;
  color: var(--green-dark);
}

.file-button.compact {
  min-height: 34px;
  font-size: 12px;
}

.file-button.subtle {
  min-height: 34px;
  border-color: #d6e4d2;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
}

.file-button:hover,
.secondary-button:hover,
.primary-button:hover,
.download-button:not(.disabled):hover {
  transform: translateY(-1px);
}

.text-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cfd9ca;
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

.text-input:focus,
.product-fields input:focus,
.product-fields select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 122, 61, 0.12);
}

.textarea-input {
  min-height: 74px;
  resize: vertical;
}

.qr-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.qr-preview {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  background: #ffffff;
}

.products-panel {
  padding: 20px;
}

.products-toolbar {
  margin-bottom: 16px;
}

.products-toolbar p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
}

.secondary-button {
  border: 1px solid var(--green);
  background: #ffffff;
  color: var(--green-dark);
  padding: 0 14px;
}

.secondary-button.danger {
  border-color: #f1b9b9;
  color: #a52121;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.product-card {
  position: relative;
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 14px;
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.product-card.inactive {
  opacity: 0.58;
}

.product-number {
  position: absolute;
  top: 10px;
  left: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--green-dark);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  z-index: 2;
}

.icon-button {
  border: 0;
  background: transparent;
  color: var(--green);
}

.remove-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
}

.product-image-wrap {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
}

.product-image-wrap img {
  width: 112px;
  height: 136px;
  object-fit: cover;
  border: 1px dashed #b8c6b3;
  border-radius: 7px;
  background: var(--soft);
}

.photo-link {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.photo-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-actions .photo-link {
  flex: 1;
}

.danger-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: #a52121;
  text-align: right;
}

.product-fields label {
  display: block;
  color: #314035;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
}

.product-fields input,
.product-fields select {
  width: 100%;
  height: 31px;
  margin-top: 4px;
  border: 1px solid #d3ddd0;
  border-radius: 6px;
  padding: 5px 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
  font-size: 12px;
}

.price-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.promo-input {
  color: var(--red) !important;
  font-weight: 800;
}

.toggle-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.toggle-row input {
  width: 42px;
  height: 22px;
  accent-color: var(--green);
}

.preview-frame {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--soft);
}

.preview-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 1.414 / 1;
  object-fit: cover;
}

.preview-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 10px;
}

.preview-note {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.tab-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--green-dark);
  font-weight: 700;
  cursor: pointer;
}

.tab-button.active {
  border-color: var(--green);
  background: var(--soft);
}

.primary-button {
  width: 100%;
  min-height: 64px;
  border: 1px solid #e6b500;
  background: var(--gold);
  color: var(--green-dark);
  box-shadow: 0 10px 26px rgba(255, 204, 41, 0.25);
  font-size: 22px;
}

.download-button {
  width: 100%;
  margin-top: 12px;
  border: 1px solid var(--green);
  background: #ffffff;
  color: var(--green-dark);
  font-size: 18px;
}

.download-button.disabled {
  pointer-events: none;
  border-color: #d8ded5;
  color: #9aa49d;
  background: #f6f7f5;
}

.export-note {
  margin-top: 18px;
  border: 1px solid #b8dcc1;
  border-radius: 8px;
  padding: 14px;
  background: #f0f9f1;
  color: #315c3e;
  font-size: 13px;
  line-height: 1.35;
}

.export-note.error {
  border-color: #efb4b4;
  background: #fff4f4;
  color: #8d2222;
}

.is-busy {
  cursor: wait;
}

@media (max-width: 1240px) {
  .app-grid {
    grid-template-columns: 280px minmax(540px, 1fr);
  }

  .export-panel {
    position: static;
    grid-column: 1 / -1;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 980px) {
  .app-header {
    display: block;
    background: var(--green-dark);
  }

  .brand-block {
    padding: 18px;
  }

  .brand-logo {
    width: 150px;
  }

  .header-status {
    width: auto;
    padding: 0 18px 18px;
    border-left: 0;
  }

  .workspace {
    padding: 14px;
  }

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

  .settings-panel,
  .export-panel {
    position: static;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 560px) {
  .brand-block {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .brand-block h1 {
    font-size: 25px;
  }

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

  .product-card {
    grid-template-columns: 102px 1fr;
  }

  .toolbar-actions,
  .products-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .qr-row {
    grid-template-columns: 1fr;
  }
}
