:root {
  --bg: #f4efe1;
  --panel: rgba(255, 251, 241, 0.95);
  --panel-strong: #fff8ea;
  --text: #2f2a21;
  --muted: #6b6556;
  --line: #d8cfb8;
  --accent: #2f4f3e;
  --accent-strong: #8e5a3c;
  --accent-soft: #e7dcc2;
  --shadow: 0 18px 40px rgba(64, 47, 18, 0.1);
  --radius: 0px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(143, 106, 63, 0.22) 0%, transparent 30%),
    radial-gradient(circle at bottom right, rgba(47, 79, 62, 0.16) 0%, transparent 25%),
    linear-gradient(180deg, #efe8d3 0%, var(--bg) 100%);
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: "Fraunces", serif; line-height: 1.05; }
a { color: var(--accent); }
button, input, select, textarea {
  font: inherit;
}
button, .quick-link, .ghost-button {
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
}
button, .btn-procedural {
  background: var(--accent);
  color: #fff;
  padding: 0.9rem 1.1rem;
}
button:hover, .btn-procedural:hover { filter: brightness(1.05); }
.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  padding: 0.65rem 0.9rem;
}
input, select, textarea {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.7);
  color: var(--text);
}
textarea { resize: vertical; }

.shell {
  max-width: 940px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}
.shell-home, .shell-wide { max-width: 1180px; }
.shell-auth { max-width: 540px; min-height: 100vh; display: grid; place-items: center; }

.site-header, .public-header, .panel-card, .admin-panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.96) 0%, rgba(246, 239, 222, 0.96) 100%);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.site-header, .public-header, .panel-card, .admin-panel, .auth-card {
  padding: 1.2rem;
}
.site-header-top, .inline-header, .inline-controls, .hero-actions, .cart-total-row, .builder-actions, .preset-row, .site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}
.site-header-top {
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.85rem;
}
.site-header-top-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.brand-crest {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #fff4d8, #d9c699);
  font-family: "Fraunces", serif;
  font-weight: 700;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(47,79,62,0.08);
}
.site-title {
  font-weight: 800;
  text-decoration: none;
  color: var(--text);
}
.site-header-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.site-header-nav a, .back-link {
  text-decoration: none;
  color: var(--muted);
}
.hero-grid, .dashboard-strip, .admin-split {
  display: grid;
  gap: 1.1rem;
}
.hero-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  align-items: center;
  padding-top: 1.15rem;
}
.hero-copy { display: grid; gap: 1rem; }
.hero-copy h1 { font-size: clamp(2.4rem, 5vw, 4.5rem); }
.hero-visual { display: grid; gap: 1rem; }
.carton-illustration {
  min-height: 270px;
  border-radius: 28px;
  border: 1px solid rgba(143, 106, 63, 0.18);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.45), rgba(255,255,255,0.1)),
    linear-gradient(145deg, #c89a66, #a66d3a);
  padding: 1.3rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.egg-shape, .slot-egg {
  width: 100%;
  aspect-ratio: 0.78;
  border-radius: 48% 48% 45% 45% / 58% 58% 42% 42%;
  box-shadow: inset 0 -10px 16px rgba(0,0,0,0.1), 0 8px 18px rgba(0,0,0,0.12);
}
.egg-brown { background: linear-gradient(180deg, #a36f4e, #7a4a30); }
.egg-cream { background: linear-gradient(180deg, #f5e8c5, #e3cf9b); }
.egg-green { background: linear-gradient(180deg, #b7c9b2, #8ea395); }
.egg-ivory { background: linear-gradient(180deg, #f4efdf, #e4dbc4); }
.egg-sage { background: linear-gradient(180deg, #d8dfd0, #bac3b3); }

.eyebrow {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.muted { color: var(--muted); }
.quick-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.05rem;
  text-decoration: none;
  background: rgba(255,255,255,0.74);
  border: 1px solid var(--line);
  color: var(--text);
}

.dashboard-strip {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  margin-top: 1.2rem;
  align-items: start;
}
.cart-sidebar { position: sticky; top: 1rem; }
.metrics, .inventory-bars, .store-grid, .grid-form, .stack {
  display: grid;
  gap: 0.85rem;
}
.metrics {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
.metric {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.64);
  border-radius: 18px;
  padding: 0.95rem;
  display: grid;
  gap: 0.35rem;
}
.metric strong { font-size: 0.9rem; }
.metric span { font-weight: 800; font-size: 1.1rem; }
.inventory-bar {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255,255,255,0.55);
}
.inventory-bar span {
  display: block;
  height: 12px;
  background: linear-gradient(90deg, #6e8e7a, #b68458);
}
.inventory-bar label {
  display: flex;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  font-size: 0.92rem;
}

.builder-section {
  margin-top: 1.2rem;
}
.preset-row {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin: 1rem 0;
}
.preset-row button {
  background: rgba(255,255,255,0.78);
  color: var(--text);
  border-color: var(--line);
}
.builder-toolbar { margin-bottom: 1rem; }
.carton-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.8rem;
}
.carton-slot {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.8), rgba(242,229,202,0.9));
  border-radius: 22px;
  padding: 0.6rem;
  display: grid;
  gap: 0.45rem;
  text-align: center;
}
.carton-slot.active {
  outline: 2px solid rgba(47,79,62,0.24);
}
.slot-egg {
  margin: 0 auto;
  width: 64px;
}
.slot-label {
  font-size: 0.78rem;
  color: var(--muted);
}
.slot-caption {
  font-size: 0.72rem;
  min-height: 2.1em;
}
.slot-editor {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.8rem;
}
.slot-editor-card, .editor-card, .detail-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.95rem;
  background: rgba(255,255,255,0.62);
}
.slot-editor-card img, .hen-avatar, .breed-avatar {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 14px;
}
.store-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.product-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,0.62);
  padding: 1rem;
  display: grid;
  gap: 0.65rem;
}
.product-card-image {
  min-height: 140px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(47,79,62,0.18), rgba(182,132,88,0.28));
  overflow: hidden;
}
.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cart-item {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  display: grid;
  gap: 0.3rem;
}
.cart-item:first-child {
  border-top: 0;
  padding-top: 0;
}
.cart-item button {
  background: transparent;
  color: var(--accent);
  border: 0;
  padding: 0;
  text-align: left;
}
.cart-total-row {
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
  margin-top: 0.5rem;
}
.grid-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-form .full-width {
  grid-column: 1 / -1;
}
.compact-form {
  margin-top: 0.6rem;
}
.builder-actions {
  margin-top: 1rem;
  flex-wrap: wrap;
}
.accent-card {
  background: linear-gradient(145deg, rgba(47,79,62,0.9), rgba(116,82,44,0.9));
  color: #fff;
}
.accent-card .muted, .accent-card span { color: rgba(255,255,255,0.78); }

.masthead {
  margin-bottom: 1rem;
}
.admin-tabs {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.admin-tab {
  background: rgba(255,255,255,0.62);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 0.75rem 1rem;
}
.admin-tab.is-active {
  background: var(--accent);
  color: #fff;
}
.admin-panel {
  display: none;
}
.admin-panel.is-active {
  display: grid;
}
.admin-split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.table-wrap {
  display: grid;
  gap: 0.75rem;
}
.order-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,0.65);
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}
.order-card pre, .json-preview {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  padding: 0.85rem;
  border-radius: 14px;
  background: rgba(0,0,0,0.04);
  overflow: auto;
}
.site-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  color: var(--muted);
  justify-content: flex-start;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .hero-grid, .dashboard-strip, .admin-split { grid-template-columns: 1fr; }
  .cart-sidebar { position: static; }
  .carton-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .shell { padding: 0.9rem 0.8rem 2.2rem; }
  .grid-form, .metrics, .slot-editor { grid-template-columns: 1fr; }
  .carton-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-header-top, .inline-header, .inline-controls, .hero-actions, .builder-actions, .cart-total-row {
    flex-direction: column;
    align-items: stretch;
  }
}
