:root {
  --bg: #f5f2ec;
  --card: #ffffff;
  --text: #171717;
  --muted: #6b6258;
  --line: #e6ded2;
  --gold: #b89657;
  --gold-dark: #81612f;
  --danger: #9e2f2f;
  --shadow: 0 18px 50px rgba(20, 15, 8, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #fff8ea, var(--bg) 35%, #eee7dc);
  color: var(--text);
}

.app {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 8px;
}

h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(34px, 5vw, 64px); line-height: .95; margin-bottom: 14px; }
h2 { font-size: 24px; margin-bottom: 0; }
.sub { color: var(--muted); max-width: 720px; line-height: 1.55; }

.panel, .stats > div, .card, .modal-card {
  background: rgba(255,255,255,.86);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.import-panel {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  padding: 18px;
  margin-bottom: 18px;
}

.input-wrap label, .edit-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 14px 15px;
  font: inherit;
  outline: none;
  background: #fff;
}

input:focus, textarea:focus { border-color: var(--gold); }

button {
  border: 0;
  border-radius: 15px;
  padding: 14px 18px;
  font-weight: 800;
  cursor: pointer;
  background: #15120d;
  color: white;
  transition: transform .15s ease, opacity .15s ease;
}

button:hover { transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.danger { color: var(--danger); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0 26px;
}

.stats > div { padding: 18px; }
.stats strong { display: block; font-size: 30px; }
.stats span { color: var(--muted); font-size: 13px; }

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

.section-head input { max-width: 380px; }

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

.card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: #ddd;
}

.card-body { padding: 17px; }
.card h3 { margin: 0 0 8px; font-size: 19px; line-height: 1.2; }
.meta { color: var(--muted); font-size: 13px; display: grid; gap: 5px; margin: 12px 0; }
.badges { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.badge { background: #f2eadb; color: #5b4421; padding: 7px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 14px; }
.actions .full { grid-column: 1 / -1; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  border: 1px dashed var(--line);
  border-radius: 24px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0,0,0,.58);
  display: grid;
  place-items: center;
  padding: 20px;
}

.hidden { display: none !important; }

.modal-card {
  width: min(1080px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  position: relative;
}

.modal-card.small { width: min(620px, 100%); }

.close {
  position: sticky;
  top: 0;
  float: right;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  font-size: 24px;
}

.detail-hero {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 22px;
  align-items: start;
}

.detail-hero img {
  width: 100%;
  border-radius: 20px;
  aspect-ratio: 16/10;
  object-fit: cover;
}

.detail-text p { color: var(--muted); line-height: 1.6; }

.gallery {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.gallery img {
  width: 100%;
  height: 145px;
  border-radius: 14px;
  object-fit: cover;
}

.edit-form { display: grid; gap: 12px; margin-top: 18px; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #15120d;
  color: white;
  padding: 14px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 50;
}

@media (max-width: 900px) {
  .topbar, .section-head { flex-direction: column; align-items: stretch; }
  .import-panel { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .detail-hero { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
}
