:root {
  --bg: #f8f2ef;
  --surface: rgba(255, 255, 255, 0.86);
  --ink: #1f1d20;
  --muted: #70656a;
  --accent: #b56f78;
  --accent-strong: #925661;
  --line: rgba(103, 73, 66, 0.14);
  --shadow: 0 20px 55px rgba(88, 54, 50, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(181, 111, 120, 0.16), transparent 28%),
    linear-gradient(180deg, #fff8f5, var(--bg));
  font-family: "Inter", system-ui, sans-serif;
}

.admin-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.admin-hero,
.dashboard-top,
.form-head {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.admin-hero {
  margin-bottom: 22px;
}

.login-hero {
  align-items: flex-start;
}

.admin-hero h1,
.dashboard-top h2,
.form-head h2,
.login-card h2 {
  margin: 0;
  line-height: 1.05;
}

.admin-hero h1 {
  font-size: clamp(2rem, 5vw, 4rem);
}

.admin-hero p:not(.eyebrow) {
  max-width: 620px;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.back-link,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  color: inherit;
  background: #fff;
  box-shadow: 0 10px 26px rgba(88, 54, 50, 0.09);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, #9f604d, #c7788a);
}

.btn.success {
  color: #fff;
  background: linear-gradient(135deg, #188252, #35b871);
  box-shadow: 0 14px 30px rgba(24, 130, 82, 0.2);
}

.btn.ghost {
  border: 1px solid var(--line);
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.74);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel {
  display: grid;
  place-items: center;
  min-height: 56vh;
}

.login-card,
.product-form,
.list-card,
.editor-card {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.login-card {
  width: min(430px, 100%);
}

.login-note {
  margin: -8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.dashboard {
  display: grid;
  gap: 22px;
}

.is-hidden {
  display: none;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.field-block {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  font: inherit;
}

textarea {
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.tag-field {
  grid-column: span 2;
}

.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 48px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.9);
}

.tag-option {
  position: relative;
}

.tag-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tag-option span {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.76);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.tag-option input:checked + span {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #9f604d, #c7788a);
}

.list-tools {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.editor-section-head p:not(.eyebrow) {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--muted);
}

.editor-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
}

.editor-tab {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.editor-tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, #9f604d, #c7788a);
  box-shadow: 0 10px 24px rgba(159, 96, 77, 0.18);
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 14px;
  align-items: stretch;
}

.file-drop {
  justify-content: center;
  min-height: 150px;
  border: 1px dashed rgba(146, 86, 97, 0.34);
  border-radius: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.56);
}

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

.image-preview {
  display: grid;
  place-items: center;
  min-height: 150px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--muted);
  background: #fff;
  font-weight: 800;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-field {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.58);
}

.gallery-field > div:first-child {
  display: grid;
  gap: 4px;
}

.gallery-field small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.gallery-file-drop {
  min-height: 112px;
}

.gallery-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}

.gallery-preview p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.gallery-thumb {
  position: relative;
  min-height: 120px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.gallery-thumb img {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: contain;
  padding: 8px;
}

.gallery-thumb button {
  position: absolute;
  top: 7px;
  right: 7px;
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 7px 10px;
  color: #fff;
  background: rgba(135, 55, 62, 0.9);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row span {
  display: grid;
  gap: 3px;
}

.check-row small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.form-status {
  min-height: 20px;
  margin: 0;
  color: var(--accent-strong);
  font-weight: 700;
}

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

.editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.product-row {
  display: grid;
  position: relative;
  grid-template-columns: 1fr;
  grid-template-rows: 180px 1fr auto;
  gap: 12px;
  align-items: stretch;
  min-height: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
}

.product-row.is-draggable {
  cursor: grab;
}

.product-row.is-dragging {
  opacity: 0.55;
}

.product-row.drag-over {
  border-color: rgba(53, 184, 113, 0.72);
  background: rgba(232, 250, 241, 0.9);
}

.drag-handle {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.78);
  font-weight: 900;
  line-height: 1;
  touch-action: none;
  user-select: none;
}

.product-row:not(.is-draggable) .drag-handle {
  opacity: 0.35;
}

.product-row img {
  width: 100%;
  height: 180px;
  border-radius: 12px;
  object-fit: contain;
  padding: 10px;
  background: #fff;
}

.product-photo-count {
  position: absolute;
  top: 144px;
  right: 20px;
  border-radius: 999px;
  padding: 6px 10px;
  color: #fff;
  background: rgba(31, 29, 32, 0.78);
  font-size: 0.72rem;
  font-weight: 900;
}

.product-row h3,
.product-row p {
  margin: 0;
}

.product-row p {
  color: var(--muted);
}

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

.add-product-card {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 280px;
  border: 1px dashed rgba(146, 86, 97, 0.38);
  border-radius: 16px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.54);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.add-product-card span {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #188252, #35b871);
  font-size: 2rem;
  line-height: 1;
}

.empty-state {
  align-self: center;
  color: var(--muted);
  font-weight: 700;
}

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

@media (max-width: 760px) {
  .admin-shell {
    width: min(100% - 24px, 560px);
    padding-top: 22px;
  }

  .admin-hero,
  .dashboard-top,
  .form-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid,
  .list-tools,
  .editor-tabs,
  .upload-grid,
  .product-row {
    grid-template-columns: 1fr;
  }

  .drag-handle {
    width: calc(100% - 24px);
  }

  .tag-field {
    grid-column: auto;
  }

  .image-preview {
    min-height: 220px;
  }

  .row-actions {
    width: 100%;
  }

  .row-actions .btn,
  .header-actions .btn {
    flex: 1;
  }
}
