:root {
  --bg: #f3e7dc;
  --paper: #fffaf5;
  --panel: rgba(255, 250, 245, 0.88);
  --ink: #201612;
  --muted: #6d5a4f;
  --line: #dccab9;
  --accent: #b63c1d;
  --accent-soft: #ffe3d2;
  --green: #0f5b4d;
  --shadow: 0 18px 50px rgba(79, 49, 34, 0.14);
  --radius: 24px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 209, 180, 0.8), transparent 25%),
    radial-gradient(circle at top right, rgba(183, 217, 197, 0.55), transparent 30%),
    linear-gradient(180deg, #f8ede5 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}
a { color: var(--green); }

.page-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px;
}

.hero,
.panel,
.stat-card,
.login-panel {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.45);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: 32px;
  padding: 28px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.hero h1,
.panel h2,
.login-panel h1 {
  font-family: Georgia, "Times New Roman", serif;
  margin: 8px 0 0;
  line-height: 1.05;
}

.hero h1 { font-size: clamp(2rem, 4vw, 4rem); max-width: 12ch; }
.panel h2 { font-size: 1.6rem; }

.hero p,
.login-panel p,
.meta,
.panel-subtitle,
.eyebrow {
  color: var(--muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  font-weight: 700;
}

.hero-actions,
.toolbar,
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toolbar {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}

.button,
.chip {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
}

.button.primary { background: var(--accent); color: white; }
.button.secondary { background: var(--green); color: white; }
.button.ghost, .chip { background: var(--accent-soft); color: var(--ink); }
.button.danger { background: #83281b; color: white; }
.button:disabled,
.chip:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

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

.stat-card {
  border-radius: 24px;
  padding: 18px 20px;
}

.stat-card span {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  font-size: 2.2rem;
  margin-top: 10px;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.9fr);
  gap: 18px;
}

.layout-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  border-radius: 30px;
  padding: 22px;
}

.panel-wide { grid-column: 1 / -1; }

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

.builder-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.88fr) minmax(400px, 1.12fr);
  gap: 16px;
}

.preview-shell {
  background: #f8f2ec;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 14px;
  overflow-x: auto;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.preview-head > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-toggle {
  justify-content: flex-end;
}

.preview-mode-btn.is-active {
  background: var(--green);
  color: white;
}

.preview-stage {
  width: 100%;
  margin: 0 auto;
  transition: max-width 0.2s ease;
}

.preview-stage.preview-desktop {
  width: 760px;
  min-width: 760px;
  max-width: 760px;
}

.preview-stage.preview-mobile {
  width: 390px;
  min-width: 390px;
  max-width: 390px;
}

#preview-frame {
  width: 100%;
  min-height: 920px;
  border: 0;
  border-radius: 18px;
  background: white;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.92rem;
}

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

textarea { resize: vertical; }

.grid-two,
.grid-three,
.settings-grid {
  display: grid;
  gap: 12px;
}

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

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

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.product-card,
.media-card,
.block-card,
.table-row,
.notice {
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.product-card {
  overflow: hidden;
}

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

.product-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  background: #f0e6dd;
}

.media-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
  background: #f0e6dd;
}

.product-card .body,
.block-card,
.notice,
.table-row {
  padding: 14px;
}

.notice.is-error {
  color: #7d2517;
  border-color: rgba(182, 60, 29, 0.35);
  background: rgba(255, 232, 224, 0.92);
}

.product-card h3,
.block-card h3 {
  margin: 0;
  font-size: 1rem;
}

.price {
  color: var(--accent);
  font-weight: 800;
}

.block-card {
  display: grid;
  gap: 10px;
}

.block-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.compact { gap: 8px; }

.table-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.table-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr auto;
  gap: 12px;
  align-items: center;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  border-radius: 34px;
  max-width: 560px;
  padding: 34px;
}

.alert.error {
  padding: 12px 14px;
  border-radius: 14px;
  background: #ffe0dd;
  color: #8c1f14;
  margin: 16px 0;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--ink);
  color: white;
  padding: 14px 16px;
  border-radius: 16px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .layout-grid,
  .builder-grid,
  .settings-grid,
  .grid-two,
  .grid-three,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero,
  .panel-head {
    flex-direction: column;
  }

  #preview-frame {
    min-height: 640px;
  }
}
