@font-face {
  font-family: "Onest";
  src: url("/assets/fonts/onest-cyrillic.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --milk: #f3f0e9;
  --paper: #fbfaf6;
  --ink: #171715;
  --muted: #68655f;
  --line: rgba(23, 23, 21, 0.19);
  --orange: #e85d18;
  --green: #176b44;
  --red: #a12e24;
  --shadow: 0 22px 70px rgba(42, 35, 27, 0.1);
}

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

html {
  background: var(--milk);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--milk);
  color: var(--ink);
  font-family: "Onest", Arial, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

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

button,
label,
select {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

.admin-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 10px clamp(16px, 3vw, 48px);
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 246, 0.94);
  backdrop-filter: blur(16px);
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.admin-brand__fruit {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--orange);
}

.admin-brand__fruit::after {
  position: absolute;
  top: -3px;
  right: -2px;
  width: 10px;
  height: 6px;
  border-radius: 8px 2px 8px 2px;
  background: #83946d;
  content: "";
  transform: rotate(-25deg);
}

.admin-brand span:last-child {
  display: grid;
}

.admin-brand strong {
  letter-spacing: -0.03em;
}

.admin-brand small {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-header__actions,
.editor-toolbar,
.save-cluster,
.card-heading,
.card-heading__actions {
  display: flex;
  align-items: center;
}

.admin-header__actions {
  gap: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 13px;
  font-weight: 700;
}

.button--primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}

.button--primary:hover {
  border-color: var(--orange);
  background: var(--orange);
  color: var(--ink);
}

.button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.admin-main {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: clamp(34px, 6vw, 92px) clamp(16px, 3vw, 48px) 100px;
}

.eyebrow {
  margin: 0 0 16px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.login-card {
  width: min(100%, 650px);
  margin: 7vh auto 0;
  padding: clamp(28px, 5vw, 64px);
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.login-card h1,
.editor-intro h1 {
  margin: 0;
  font-size: clamp(42px, 6vw, 86px);
  font-weight: 540;
  letter-spacing: -0.07em;
  line-height: 0.95;
}

.login-card > p:not(.eyebrow) {
  max-width: 520px;
  margin: 24px 0 34px;
  color: var(--muted);
}

.login-card label,
.product-editor__fields label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  font-size: 14px;
  font-weight: 450;
  letter-spacing: normal;
}

input,
select {
  min-height: 48px;
  padding: 0 13px;
}

textarea {
  min-height: 94px;
  padding: 12px 13px;
  resize: vertical;
}

.form-message,
.save-message,
.upload-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--red);
  font-size: 12px;
}

.editor-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(230px, 0.6fr);
  align-items: end;
  gap: 30px;
}

.editor-intro > div:first-child > p:last-child {
  max-width: 740px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.editor-intro__meta {
  display: grid;
  justify-items: end;
  padding-top: 18px;
  gap: 6px;
  border-top: 1px solid var(--line);
  text-align: right;
}

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

.editor-intro__meta strong {
  font-size: 18px;
}

.editor-toolbar {
  position: sticky;
  z-index: 10;
  top: 68px;
  justify-content: space-between;
  margin: 46px 0 22px;
  padding: 12px;
  gap: 12px;
  border: 1px solid var(--line);
  background: rgba(243, 240, 233, 0.94);
  backdrop-filter: blur(16px);
}

.save-cluster {
  justify-content: flex-end;
  gap: 14px;
}

.save-message {
  margin: 0;
  color: var(--green);
  text-align: right;
}

.catalog-editor {
  display: grid;
  gap: 18px;
}

.product-editor {
  display: grid;
  grid-template-columns: minmax(260px, 0.42fr) minmax(0, 1fr);
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 10px 40px rgba(42, 35, 27, 0.05);
}

.product-editor.is-hidden {
  opacity: 0.66;
}

.product-editor__media {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #d9d2c7;
}

.product-editor__media img {
  width: 100%;
  height: 100%;
  min-height: 520px;
  object-fit: cover;
}

.media-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.media-placeholder[hidden] {
  display: none;
}

.upload-button {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  display: grid;
  min-height: 48px;
  place-items: center;
  background: rgba(251, 250, 246, 0.94);
  color: var(--ink) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-message {
  position: absolute;
  top: 12px;
  right: 12px;
  left: 12px;
  margin: 0;
  padding: 8px 10px;
  background: rgba(23, 23, 21, 0.86);
  color: #fff;
  text-align: center;
}

.upload-message:empty {
  display: none;
}

.product-editor__fields {
  min-width: 0;
  padding: clamp(22px, 3vw, 42px);
}

.card-heading {
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.card-heading > span {
  color: var(--orange);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.06em;
}

.card-heading__actions {
  gap: 6px;
}

.card-heading__actions button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 12px;
}

.card-heading__actions button:hover {
  border-color: var(--orange);
  background: var(--orange);
}

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

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

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

.visibility-switch {
  display: flex !important;
  align-items: center;
  margin-top: 24px;
  gap: 12px !important;
  color: var(--ink) !important;
}

.visibility-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.visibility-switch span {
  position: relative;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 30px;
  background: #b9b3aa;
  transition: background 180ms ease;
}

.visibility-switch span::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: transform 180ms ease;
}

.visibility-switch input:checked + span {
  background: var(--green);
}

.visibility-switch input:checked + span::after {
  transform: translateX(20px);
}

.source-fields {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.source-fields summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .editor-intro,
  .product-editor {
    grid-template-columns: 1fr;
  }

  .editor-intro__meta {
    justify-items: start;
    text-align: left;
  }

  .product-editor__media {
    min-height: 560px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .product-editor__media img {
    min-height: 560px;
  }
}

@media (max-width: 650px) {
  .admin-header {
    align-items: flex-start;
  }

  .admin-header__actions .button:first-child {
    display: none;
  }

  .admin-main {
    padding-top: 32px;
  }

  .password-row,
  .field-grid--two,
  .field-grid--three {
    grid-template-columns: 1fr;
  }

  .editor-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .save-cluster {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .save-message {
    text-align: left;
  }

  .product-editor__media,
  .product-editor__media img {
    min-height: 470px;
  }

  .card-heading {
    align-items: flex-start;
    gap: 12px;
  }

  .card-heading__actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}
