:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --line: #ddd5cb;
  --text: #221f1c;
  --muted: #6a5f54;
  --button: #1f1f1f;
  --button-hover: #000;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  background: linear-gradient(180deg, #f7f4ef, var(--bg));
  color: var(--text);
}

.admin-wrap {
  width: min(1040px, 94%);
  margin: 0 auto;
  padding: 18px 0 90px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #84796d;
}

h1,
h2,
h3,
p { margin: 0; }

h1 { font-size: clamp(1.4rem, 3.4vw, 2rem); }
h2 { font-size: clamp(1.05rem, 2.5vw, 1.4rem); }

.muted {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.back-link {
  text-decoration: none;
  color: #67493a;
  font-weight: 700;
  font-size: 14px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
}

.stack { display: grid; gap: 10px; }
.grid { display: grid; gap: 10px; }
.two { grid-template-columns: 1fr 1fr; }
.full { grid-column: 1 / -1; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 86px;
  resize: vertical;
}

button {
  border: 1px solid var(--button);
  background: var(--button);
  color: #fff;
  border-radius: 10px;
  min-height: 44px;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: var(--button-hover); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.secondary:hover { background: #f0ebe3; }

.hint {
  color: #786d61;
  font-size: 12px;
}

.product-list {
  display: grid;
  gap: 12px;
}

.product-compact {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  display: grid;
  grid-template-columns: 112px 1fr;
  min-height: 112px;
  cursor: pointer;
}

.product-compact:hover {
  background: #fbf8f4;
}

.compact-thumb {
  background: #eee6dc;
}

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

.compact-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-content: center;
  color: #7b6e61;
  font-weight: 700;
}

.compact-body {
  padding: 10px 12px;
  display: grid;
  gap: 5px;
  align-content: center;
}

.compact-body h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.compact-desc {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.compact-meta {
  margin: 0;
  color: #4f453d;
  font-size: 0.78rem;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(19, 17, 15, 0.5);
}

.admin-modal[hidden] {
  display: none;
}

.admin-dialog {
  width: min(840px, 100%);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.editor-block {
  border-top: 1px solid var(--line);
  padding: 10px;
  display: grid;
  gap: 10px;
  background: #faf8f5;
}

.editor-block[hidden] {
  display: none;
}

.editor-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-footer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-footer-actions button {
  min-height: 42px;
}

.variants,
.images-preview,
.video-preview {
  display: grid;
  gap: 8px;
}

.variant-row {
  display: grid;
  grid-template-columns: 1fr 120px 100px;
  gap: 8px;
}

.image-item,
.video-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  display: grid;
  gap: 8px;
  background: #fff;
}

.image-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
}

.video-item video {
  width: 100%;
  max-height: 220px;
  border-radius: 8px;
  background: #000;
}

.sticky-actions {
  position: sticky;
  bottom: 8px;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
  background: rgba(244, 242, 238, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.status {
  min-height: 24px;
  margin: 8px 0 0;
  font-weight: 700;
  font-size: 14px;
}

@media (max-width: 860px) {
  .two,
  .variant-row,
  .sticky-actions,
  .admin-header {
    grid-template-columns: 1fr;
  }

  .admin-header {
    display: grid;
    align-items: start;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .product-compact {
    grid-template-columns: 92px 1fr;
    min-height: 92px;
  }

  .admin-wrap {
    width: 96%;
    padding-bottom: 104px;
  }

  .admin-dialog {
    width: 100%;
    max-height: 100dvh;
    border-radius: 10px;
    padding: 10px;
  }

  .editor-footer-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .editor-footer-actions button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .admin-header h1 {
    font-size: 1.25rem;
  }

  .panel {
    padding: 10px;
  }

  .product-compact {
    grid-template-columns: 84px 1fr;
    min-height: 84px;
  }

  .compact-body h3 {
    font-size: 0.95rem;
  }

  .compact-desc {
    font-size: 0.8rem;
  }

  .compact-meta {
    font-size: 0.74rem;
  }
}

@media (hover: none) and (pointer: coarse) {
  input,
  textarea,
  select {
    font-size: 16px;
  }
}
