/* ═══════════════════════════════════════════════════════════════════════════
   BETTER FOR BUTCHERY — FABRICATION INTERFACE
   v26 - Layout fix: 3-column proportions, profile bar, summary rail
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --blk: #26211e;
  --red: #ff3500;
  --wht: #ffffff;
  --ylw: #fff12d;
  --ppr: #fce9cd;
  --ppr2: #fff4e7;
  --gry: #5e5e5e;
  --bdr: rgba(38, 33, 30, 0.1);
  --green: #2d8a4e;
  --amber: #d4a017;
  --bg-main: #f8f4ef;
  --text-primary: var(--blk);
  --text-secondary: var(--gry);
  --text-muted: rgba(38, 33, 30, 0.5);
  --accent: var(--red);
  --sp-xs: 0.25rem;
  --sp-sm: 0.5rem;
  --sp-md: 1rem;
  --sp-lg: 1.5rem;
  --sp-xl: 2rem;
  --radius-sm: 4px;
  --radius-md: 6px;
  --shadow-sm: 0 1px 3px rgba(38, 33, 30, 0.06);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast: 150ms;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Work Sans', -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-main);
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ─────────────────────────────────────────────────────────────────────────────
   SITE NAV
   ───────────────────────────────────────────────────────────────────────────── */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--wht);
  border-bottom: 1px solid var(--bdr);
  height: 64px;
}
.nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo img { height: 36px; width: auto; }
.nav-links { display: flex; gap: 2.5rem; align-items: center; }
.nav-links a {
  font-family: 'Epilogue', sans-serif;
  font-weight: 900;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(38, 33, 30, 0.5);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--blk); }
.nav-links a.active { color: var(--red); }
.nav-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(38, 33, 30, 0.4);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-dot {
  width: 6px;
  height: 6px;
  background: #4caf50;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   PROFILE SUMMARY BAR
   ───────────────────────────────────────────────────────────────────────────── */
#profile-summary {
  display: none;
  background: var(--ppr);
  border-bottom: 1px solid var(--bdr);
  padding: 0.6rem 2rem;
  font-size: 0.8rem;
  color: var(--text-primary);
}
#profile-summary.visible {
  display: flex;
  align-items: center;
  gap: 1rem;
}
#profile-company {
  font-family: 'Epilogue', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
#profile-contact {
  color: var(--gry);
  font-size: 0.8rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   3-COLUMN LAYOUT — Desktop only (min-width: 1025px)
   ───────────────────────────────────────────────────────────────────────────── */
@media (min-width: 1025px) {
  .fabricator-layout {
    display: grid;
    grid-template-columns: 220px 1fr 280px;
    min-height: 100vh;
    padding-top: 64px;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   LEFT SIDEBAR — Desktop sticky rail (min-width: 1025px)
   ───────────────────────────────────────────────────────────────────────────── */
@media (min-width: 1025px) {
  .fabricator-left {
    position: sticky;
    top: 64px;
    align-self: start;
    max-height: calc(100vh - 64px);
    background: var(--wht);
    border-right: 1px solid var(--bdr);
    padding: var(--sp-lg);
    display: flex;
    flex-direction: column;
    gap: var(--sp-xl);
    overflow-y: auto;
  }
}
.sidebar-section { display: flex; flex-direction: column; gap: var(--sp-sm); }
.sidebar-label {
  font-weight: 700;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  padding-left: 2px;
}
.sidebar-footer {
  margin-top: auto;
  padding-top: var(--sp-lg);
  border-top: 1px solid var(--bdr);
}
.btn-reset {
  width: 100%;
  padding: 0.6rem;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-main);
  border-radius: var(--radius-md);
}
.btn-reset:hover { background: rgba(255, 53, 0, 0.08); color: var(--accent); }

/* Species Switch */
#species-switch { display: flex; flex-direction: column; gap: 0.5rem; }
.species-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-main);
  border: 2px solid transparent;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 180ms var(--ease-out);
}
.species-btn:hover { border-color: rgba(38, 33, 30, 0.15); }
.species-btn.active {
  background: var(--wht);
  border-color: var(--blk);
  box-shadow: 0 2px 8px rgba(38, 33, 30, 0.1);
  color: var(--blk);
}

/* Head count - inline within active species button */
.species-head {
  display: none;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
}
.species-btn.active .species-head { display: flex; }
.species-head-label {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(38, 33, 30, 0.35);
}
.species-head-btn {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-main);
  border: 1px solid rgba(38, 33, 30, 0.12);
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--blk);
  cursor: pointer;
  transition: background 80ms ease;
}
.species-head-btn:hover {
  background: var(--blk);
  color: var(--wht);
}
.species-head-val {
  min-width: 16px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--blk);
}

/* Tier Select */
#tier-switch { display: flex; flex-direction: column; gap: var(--sp-xs); }
.tier-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  background: var(--bg-main);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
}
.tier-btn:hover { border-color: rgba(38, 33, 30, 0.15); background: var(--wht); }
.tier-btn.active {
  background: var(--wht);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 53, 0, 0.1);
}
.tier-name {
  font-family: 'Epilogue', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-primary);
}
.tier-price { font-size: 0.65rem; font-weight: 600; color: var(--gry); }
.tier-btn.active .tier-price { color: var(--accent); }

/* Primal Navigation */
#primal-nav { display: flex; flex-direction: column; gap: 1px; }
.primal-btn {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.65rem;
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-out);
  background: none;
  border: none;
  text-align: left;
  width: 100%;
}
.primal-btn:hover { background: rgba(38, 33, 30, 0.04); color: var(--text-secondary); }
.primal-btn.active { background: rgba(38, 33, 30, 0.08); color: var(--text-primary); font-weight: 600; }

/* ─────────────────────────────────────────────────────────────────────────────
   CENTER COLUMN — Desktop split-pane (min-width: 1025px)
   ───────────────────────────────────────────────────────────────────────────── */
@media (min-width: 1025px) {
  .fabricator-center {
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    min-width: 0;
    height: calc(100vh - 64px);
    position: sticky;
    top: 64px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANIMAL DIAGRAM — Desktop: Fixed at top of center column
   ═══════════════════════════════════════════════════════════════════════════ */
#animal-diagram {
  background: linear-gradient(180deg, #f5f0ea 0%, #ebe5dc 100%);
  padding: 2.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 3px solid var(--blk);
  min-height: 270px;
}
@media (min-width: 1025px) {
  #animal-diagram {
    flex-shrink: 0;
  }
}
#animal-diagram svg {
  width: 100%;
  max-width: 500px;
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 16px rgba(38, 33, 30, 0.1));
}

/* ═══════════════════════════════════════════════════════════════════════════
   CUT SELECTION PANE — Desktop: Scrolling area below animal diagram
   ═══════════════════════════════════════════════════════════════════════════ */
#primal-content { 
  padding: 0;
  background: var(--bg-main);
}
@media (min-width: 1025px) {
  #primal-content {
    flex: 1;
    overflow-y: auto;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRIMAL VIEW — OLD Desktop Grouped Hierarchy
   ═══════════════════════════════════════════════════════════════════════════ */
.primal-view {
  padding: 0;
}

/* Main Primal Header — Top black bar */
.primal-view .content-header {
  background: var(--blk);
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
}
.primal-view .content-header h2 {
  font-family: 'Epilogue', sans-serif;
  font-weight: 900;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wht);
  margin: 0;
}
.primal-view .content-subtitle {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Primal Sections Container */
.primal-sections {
  padding: 1.25rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SUBPRIMAL SECTION — Grouped Module (OLD desktop style)
   Each subprimal is a distinct bordered container
   ═══════════════════════════════════════════════════════════════════════════ */
.subprimal-section {
  background: #ffffff;
  border: 1px solid rgba(38, 33, 30, 0.12);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(38, 33, 30, 0.04);
}

/* Subprimal Header — Black bar inside each module */
.subprimal-header {
  background: var(--blk);
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
.subprimal-header h3 {
  font-family: 'Epilogue', sans-serif;
  font-weight: 900;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wht);
  margin: 0;
}
.subprimal-code {
  font-size: 0.65rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Subprimal Cuts — Padded container for cards */
.subprimal-cuts {
  padding: 1.25rem;
  background: #ffffff;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LEGACY CONTENT HEADER (fallback)
   ═══════════════════════════════════════════════════════════════════════════ */
.content-header {
  background: var(--blk);
  padding: 1.1rem 1.75rem;
  margin-bottom: 0;
}
.content-header h2 {
  font-family: 'Epilogue', sans-serif;
  font-weight: 900;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wht);
  margin-bottom: 0;
}
.content-subtitle { 
  font-size: 0.78rem; 
  color: rgba(255, 255, 255, 0.5);
  margin-top: 0.3rem;
}

/* Back Button — For black header */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  margin-bottom: 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 150ms ease;
}
.back-btn:hover { 
  background: rgba(255, 255, 255, 0.2); 
  color: var(--wht); 
}

/* ═══════════════════════════════════════════════════════════════════════════
   LEGACY GRIDS (for subprimal selection view if needed)
   ═══════════════════════════════════════════════════════════════════════════ */
.cuts-grid,
.subprimal-grid {
  padding: 1.5rem 1.75rem;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted);
  min-height: 200px;
}
.empty-icon { font-size: 1.75rem; margin-bottom: 0.75rem; opacity: 0.35; }
.empty-text { font-size: 0.9rem; font-weight: 500; max-width: 240px; line-height: 1.5; }

/* Sub-Primal Grid — Premium Desktop Styling */
.subprimal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.85rem;
}
.subprimal-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 1.25rem;
  background: #ffffff;
  border: 2px solid rgba(38, 33, 30, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 180ms var(--ease-out);
  box-shadow: 
    0 1px 3px rgba(38, 33, 30, 0.06),
    0 4px 8px rgba(38, 33, 30, 0.04);
}
.subprimal-card:hover { 
  border-color: var(--blk); 
  background: #ffffff;
  box-shadow: 
    0 4px 8px rgba(38, 33, 30, 0.08),
    0 8px 24px rgba(38, 33, 30, 0.12);
  transform: translateY(-3px); 
}
.subprimal-name { font-weight: 700; font-size: 0.9rem; color: var(--blk); }
.subprimal-arrow { 
  color: var(--gry); 
  font-size: 1.1rem; 
  transition: transform 150ms ease, color 150ms ease; 
}
.subprimal-card:hover .subprimal-arrow { 
  transform: translateX(3px); 
  color: var(--blk); 
}

/* Cuts Grid — Premium Desktop Styling */
.cuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.85rem;
}
.cut-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.2rem;
  background: #ffffff;
  border: 2px solid rgba(38, 33, 30, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 180ms var(--ease-out);
  box-shadow: 
    0 1px 3px rgba(38, 33, 30, 0.06),
    0 4px 8px rgba(38, 33, 30, 0.04);
}
.cut-card:hover:not(.disabled):not(.selected):not(.tier-locked) {
  border-color: var(--blk);
  background: #ffffff;
  box-shadow: 
    0 4px 8px rgba(38, 33, 30, 0.08),
    0 8px 24px rgba(38, 33, 30, 0.12);
  transform: translateY(-3px);
}
.cut-card.selected {
  background: var(--blk);
  border-color: var(--blk);
  color: var(--wht);
  box-shadow: 
    0 4px 8px rgba(38, 33, 30, 0.15),
    0 12px 32px rgba(38, 33, 30, 0.25);
  transform: translateY(-2px);
}
.cut-card.selected::after {
  content: '✓';
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  width: 20px;
  height: 20px;
  background: var(--ylw);
  color: var(--blk);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cut-card.selected .cut-name { color: var(--wht); }
.cut-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(252, 233, 205, 0.6);
  border-color: transparent;
  box-shadow: none;
}
.cut-card.disabled:hover { transform: none; box-shadow: none; }

/* Tier-locked cards - upgrade prompt style */
.cut-card.tier-locked {
  opacity: 1;
  cursor: pointer;
  background: linear-gradient(145deg, #ffffff 0%, rgba(252, 233, 205, 0.4) 100%);
  border: 2px dashed rgba(38, 33, 30, 0.18);
}
.cut-card.tier-locked:hover { 
  border-color: var(--red); 
  border-style: solid;
  background: linear-gradient(145deg, #ffffff 0%, rgba(255, 53, 0, 0.06) 100%);
  box-shadow: 
    0 2px 6px rgba(255, 53, 0, 0.1),
    0 8px 20px rgba(255, 53, 0, 0.08);
  transform: translateY(-2px);
}
.cut-card.tier-locked .cut-name { color: var(--blk); font-weight: 600; }
.cut-tier-label { 
  display: block; 
  font-size: 0.6rem; 
  font-weight: 800; 
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--red); 
  margin-bottom: 0.25rem; 
}
.cut-upsell { 
  display: block; 
  font-size: 0.65rem; 
  color: var(--gry); 
  margin-top: 0.4rem;
  font-style: italic;
}

.cut-name { 
  font-weight: 700; 
  font-size: 0.88rem; 
  line-height: 1.35; 
  color: var(--blk); 
}
.cut-badge {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  background: rgba(255, 53, 0, 0.1);
  color: var(--accent);
  border-radius: 4px;
  width: fit-content;
}
.cut-card.selected .cut-badge { 
  background: var(--ylw); 
  color: var(--blk); 
}
.cut-reason { 
  font-size: 0.68rem; 
  color: var(--gry); 
  margin-top: 0.4rem; 
  line-height: 1.45;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RIGHT SIDEBAR — Desktop sticky rail (min-width: 1025px)
   ───────────────────────────────────────────────────────────────────────────── */
.fabricator-right {
  background: var(--blk);
  color: var(--wht);
  display: flex;
  flex-direction: column;
}
@media (min-width: 1025px) {
  .fabricator-right {
    position: sticky;
    top: 64px;
    align-self: start;
    max-height: calc(100vh - 64px);
  }
}
#summary-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.summary-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.summary-header h3 {
  font-family: 'Epilogue', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 0.25rem;
}
.summary-count { font-size: 0.75rem; color: rgba(255, 255, 255, 0.5); }
.summary-list { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; }
.summary-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
  color: rgba(255, 255, 255, 0.3);
}
.summary-empty-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.summary-species-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 0.5rem;
  margin-top: 0.75rem;
}
.summary-species-label:first-child { margin-top: 0; }
.summary-head-badge {
  font-size: 0.5rem;
  background: rgba(255,255,255,0.12);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  margin-left: 0.5rem;
  letter-spacing: 0.05em;
}
.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.summary-item:last-child { border-bottom: none; }
.summary-item-other { opacity: 0.7; }
.summary-cut { font-weight: 500; font-size: 0.8rem; line-height: 1.3; }
.summary-remove {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
}
.summary-remove:hover { background: rgba(255, 53, 0, 0.8); color: var(--wht); }

/* Summary Footer — always visible, never clipped */
.summary-footer {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}
.summary-tier { font-size: 0.75rem; color: rgba(255, 255, 255, 0.5); margin-bottom: 0.75rem; }
.btn-continue {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--accent);
  color: var(--wht);
  font-family: 'Epilogue', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.btn-continue:hover:not(:disabled) { background: #e63000; transform: translateY(-1px); }
.btn-continue:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ─────────────────────────────────────────────────────────────────────────────
   MODAL — Unified Container (Desktop-First)
   ───────────────────────────────────────────────────────────────────────────── */
#submit-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(38, 33, 30, 0.85);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow-y: auto;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
#submit-modal.active { display: flex; }

/* UNIFIED MODAL CARD — header, form, success all inside this single container */
.modal-content,
.modal {
  background: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 4rem);
  overflow: hidden;
  position: relative;
  box-shadow: 
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 8px 24px rgba(0, 0, 0, 0.15),
    0 32px 80px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}

/* Ensure all children share same solid background */
.modal-content > *,
.modal > * {
  background: #ffffff;
}

/* Close button */
#modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  background: var(--bg-main);
  border: 1px solid var(--bdr);
  border-radius: 50%;
  font-size: 1.1rem;
  color: var(--gry);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 150ms ease;
}
#modal-close:hover { 
  background: var(--ppr); 
  border-color: rgba(38, 33, 30, 0.15);
  color: var(--blk);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL HEADER — Sticky at top
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-header { 
  padding: 1.5rem 1.75rem 1.25rem; 
  border-bottom: 1px solid var(--bdr);
  background: #ffffff;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 5;
}
.modal-header h2 {
  font-family: 'Epilogue', sans-serif;
  font-weight: 900;
  font-size: 1.35rem;
  margin-bottom: 0.4rem;
  color: var(--blk);
  padding-right: 2.5rem; /* Space for close button */
}
.modal-header p { 
  color: var(--gry); 
  font-size: 0.88rem; 
  line-height: 1.5; 
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL FORM — Scrollable body with sticky footer
   ═══════════════════════════════════════════════════════════════════════════ */
#submit-form { 
  padding: 1.5rem 1.75rem;
  padding-bottom: 0;
  background: #ffffff;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.form-row { 
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: 1rem; 
}
.form-group { 
  margin-bottom: 1rem; 
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gry);
  margin-bottom: 0.45rem;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-family: 'Work Sans', sans-serif;
  font-size: 16px; /* Prevent iOS zoom */
  border: 1.5px solid rgba(38, 33, 30, 0.12);
  border-radius: 8px;
  background: #ffffff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { 
  outline: none; 
  border-color: var(--blk);
  box-shadow: 0 0 0 3px rgba(38, 33, 30, 0.06);
}
.form-group textarea { 
  resize: vertical; 
  min-height: 72px; 
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL SECTIONS — Tour-style grouped layout
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--bdr);
}
.modal-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.section-label {
  font-family: 'Epilogue', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--blk);
  margin-bottom: 1rem;
}

/* Order Summary Block */
.order-summary {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.summary-species-block {
  background: var(--ppr2);
  border: 1px solid rgba(38, 33, 30, 0.08);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}
.summary-species-title {
  font-family: 'Epilogue', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--blk);
  margin-bottom: 0.25rem;
}
.summary-species-meta {
  font-size: 0.8rem;
  color: var(--gry);
}

/* Head Confirm Controls */
.head-confirm {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--ppr2);
  border: 1px solid rgba(38, 33, 30, 0.08);
  border-radius: 8px;
  padding: 0.85rem 1.25rem;
}
.head-species-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--blk);
}
.head-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.head-btn-modal {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wht);
  border: 1.5px solid rgba(38, 33, 30, 0.15);
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--blk);
  cursor: pointer;
  transition: all 120ms ease;
}
.head-btn-modal:hover {
  background: var(--blk);
  border-color: var(--blk);
  color: var(--wht);
}
.head-value-modal {
  min-width: 32px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--blk);
}

/* Services Grid — Tour-style checkboxes */
.services-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.service-checkbox {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background: var(--wht);
  border: 1.5px solid rgba(38, 33, 30, 0.12);
  border-radius: 8px;
  cursor: pointer;
  transition: all 150ms ease;
}
.service-checkbox:has(input:checked) {
  border-color: var(--red);
  background: rgba(255, 53, 0, 0.03);
}
.service-checkbox input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.service-checkbox .service-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--blk);
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.service-checkbox .service-name::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 1.5px solid rgba(38, 33, 30, 0.2);
  border-radius: 4px;
  background: var(--wht);
  flex-shrink: 0;
  transition: all 120ms ease;
}
.service-checkbox:has(input:checked) .service-name::before {
  background: var(--red);
  border-color: var(--red);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
}
.service-checkbox .service-desc {
  font-size: 0.72rem;
  color: var(--gry);
  padding-left: 26px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORM ACTIONS — Sticky footer, always visible
   ═══════════════════════════════════════════════════════════════════════════ */
.form-actions {
  display: flex;
  gap: 0.85rem;
  padding: 1.25rem 1.75rem;
  margin: auto -1.75rem 0;
  border-top: 1px solid var(--bdr);
  background: #ffffff;
  position: sticky;
  bottom: 0;
  flex-shrink: 0;
}
#modal-back {
  flex: 1;
  padding: 0.9rem 1rem;
  background: transparent;
  border: 1.5px solid rgba(38, 33, 30, 0.15);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--gry);
  cursor: pointer;
  transition: all 150ms ease;
}
#modal-back:hover { 
  border-color: var(--blk); 
  color: var(--blk);
  background: var(--bg-main);
}
#modal-submit {
  flex: 1.3;
  padding: 0.9rem 1rem;
  background: var(--red);
  border: none;
  border-radius: 8px;
  font-family: 'Epilogue', sans-serif;
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wht);
  cursor: pointer;
  transition: all 150ms ease;
  box-shadow: 0 2px 8px rgba(255, 53, 0, 0.25);
}
#modal-submit:hover:not(:disabled) { 
  background: #e63000;
  box-shadow: 0 4px 12px rgba(255, 53, 0, 0.35);
  transform: translateY(-1px);
}
#modal-submit:disabled { 
  opacity: 0.6; 
  cursor: not-allowed; 
  transform: none; 
  box-shadow: none; 
}

/* Success State — INSIDE modal-content, unified solid background */
#modal-success {
  display: none;
  padding: 3.5rem 2.5rem;
  text-align: center;
  background: #ffffff;
  flex: 1;
}
#modal-success .success-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--green) 0%, #238b4a 100%);
  color: var(--wht);
  font-size: 2.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.75rem;
  box-shadow: 0 4px 16px rgba(45, 138, 78, 0.3);
}
#modal-success h3 { 
  font-family: 'Epilogue', sans-serif; 
  font-size: 1.6rem; 
  font-weight: 900;
  margin-bottom: 0.75rem;
  color: var(--blk);
}
#modal-success p { 
  color: var(--gry); 
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 360px;
  margin: 0 auto;
}
#confirm-email { font-weight: 600; color: var(--blk); }
#account-message {
  display: none;
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--ppr);
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--blk);
  border: 1px solid rgba(38, 33, 30, 0.08);
}
#modal-done {
  margin-top: 2rem;
  padding: 1rem 2.5rem;
  background: var(--blk);
  border: none;
  border-radius: 8px;
  font-family: 'Epilogue', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wht);
  cursor: pointer;
  transition: all 150ms ease;
  box-shadow: 0 2px 8px rgba(38, 33, 30, 0.2);
}
#modal-done:hover {
  background: #1a1815;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(38, 33, 30, 0.3);
}

/* ─────────────────────────────────────────────────────────────────────────────
   MOBILE ELEMENTS
   ───────────────────────────────────────────────────────────────────────────── */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.mobile-menu-btn span { display: block; width: 100%; height: 2px; background: var(--blk); border-radius: 1px; }
.mobile-cart-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--ppr);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}
.cart-count { font-family: 'Epilogue', sans-serif; font-weight: 700; font-size: 0.75rem; color: var(--blk); }
#mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(38, 33, 30, 0.5);
  z-index: 85;
}
#mobile-overlay.active { display: block; }
.sidebar-close {
  display: none;
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  background: var(--bg-main);
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  color: var(--gry);
  cursor: pointer;
  z-index: 10;
  align-items: center;
  justify-content: center;
}
.mobile-config-bar { display: none; }
#mobile-bottom-bar { display: none; }

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE — Desktop column widths
   ───────────────────────────────────────────────────────────────────────────── */
@media (min-width: 1025px) and (max-width: 1100px) {
  .fabricator-layout { grid-template-columns: 200px 1fr 260px; }
}

@media (max-width: 1024px) {
  .mobile-menu-btn, .mobile-cart-btn { display: flex; }
  #mobile-overlay.active { display: block; }
  .sidebar-close { display: flex; }
  #mobile-bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    background: var(--blk);
    gap: 0.75rem;
    z-index: 100;
  }
  .nav-links, .nav-badge { display: none; }
  
  /* ═══════════════════════════════════════════════════════════════════════════
     MOBILE LAYOUT — Natural document flow
     Desktop styles are now scoped to min-width:1025px, so these are clean defaults
     ═══════════════════════════════════════════════════════════════════════════ */
  
  /* Layout: single column, natural document flow */
  .fabricator-layout { 
    display: block;
    padding-top: 64px;
    padding-bottom: 80px; 
  }
  
  /* Center column: natural flow */
  .fabricator-center {
    display: block;
  }
  
  /* Primal content: natural flow */
  #primal-content {
    padding-bottom: 2rem;
  }
  
  /* Animal diagram: sticky selector on mobile (sits under 64px header) */
  #animal-diagram {
    position: sticky;
    top: 64px;
    z-index: 40; /* above primal-content, below modal (200) and bottom-bar (100) */
    background: linear-gradient(180deg, #f5f0ea 0%, #ebe5dc 100%); /* solid so it doesn't ghost when stuck */
    border-bottom-width: 2px;
    min-height: 170px;
    padding: 1rem 1rem;
  }
  /* Neutralize sticky while submit modal is open to prevent iOS stacking conflicts */
  body.modal-open #animal-diagram {
    position: static;
  }
  
  /* Left rail: hidden by default */
  .fabricator-left {
    display: none;
  }
  
  /* Left rail: fixed drawer when open */
  .fabricator-left.open {
    display: flex;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    padding-top: 4rem;
    z-index: 90;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    overflow-y: auto;
    background: var(--wht);
    border-right: 1px solid var(--bdr);
    padding-left: var(--sp-lg);
    padding-right: var(--sp-lg);
    flex-direction: column;
    gap: var(--sp-xl);
  }
  
  /* Right rail: hidden by default */
  .fabricator-right {
    display: none;
  }
  
  /* Right rail: fixed drawer when open */
  .fabricator-right.open {
    display: flex;
    position: fixed;
    right: 0;
    top: 64px;
    bottom: 0;
    width: 300px;
    max-width: 90vw;
    height: calc(100vh - 64px);
    z-index: 90;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  }
  
  #profile-summary { padding: 0.5rem 1rem; }
  
  /* ═══════════════════════════════════════════════════════════════════════════
     MOBILE GROUPED SECTIONS — Proper spacing
     ═══════════════════════════════════════════════════════════════════════════ */
  .primal-view {
    padding: 0;
  }
  .primal-view .content-header {
    padding: 0.85rem 1rem;
    display: block;
  }
  .primal-view .content-header h2 {
    font-size: 0.95rem;
  }
  .primal-view .content-subtitle {
    margin-top: 0.2rem;
  }
  .primal-sections {
    padding: 1rem;
    gap: 1rem;
  }
  .subprimal-section {
    border-radius: 6px;
  }
  .subprimal-header {
    padding: 0.65rem 1rem;
  }
  .subprimal-header h3 {
    font-size: 0.72rem;
  }
  .subprimal-cuts {
    padding: 1rem;
    gap: 0.7rem;
    grid-template-columns: 1fr 1fr;
  }
  
  /* Content header reset */
  .content-header {
    padding: 0.85rem 1rem;
  }
  .content-header h2 {
    font-size: 0.95rem;
    letter-spacing: 0.03em;
  }
  .back-btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.65rem;
  }
  
  /* Grid padding reset */
  .cuts-grid,
  .subprimal-grid {
    padding: 1rem;
  }
  
  /* Nav adjustments */
  .nav-inner { padding: 0 1rem; }
  .nav-logo img { height: 32px; }
  
  /* Mobile modal - bottom sheet style */
  #submit-modal {
    padding: 0;
    align-items: flex-end;
    overflow-y: hidden; /* only the form body scrolls on mobile, not the overlay */
  }
  #submit-form {
    -webkit-overflow-scrolling: touch;
  }
  .modal-content,
  .modal {
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 100%;
  }
  #modal-close {
    top: 0.85rem;
    right: 0.85rem;
    width: 28px;
    height: 28px;
    font-size: 0.95rem;
  }
  .modal-header { 
    padding: 1.25rem 1rem 1rem;
    position: sticky;
    top: 0;
    z-index: 5;
  }
  .modal-header h2 { 
    font-size: 1.15rem; 
    padding-right: 2rem;
  }
  .modal-header p { 
    font-size: 0.82rem; 
  }
  #submit-form { 
    padding: 1rem 1rem 0;
  }
  .form-group {
    margin-bottom: 0.85rem;
  }
  .form-group label {
    font-size: 0.68rem;
    margin-bottom: 0.4rem;
  }
  .form-group input,
  .form-group textarea,
  .form-group select {
    padding: 0.7rem 0.85rem;
    font-size: 16px; /* Prevent iOS zoom */
  }
  .form-group textarea {
    min-height: 64px;
  }
  .form-actions {
    margin: 0 -1rem;
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    gap: 0.75rem;
  }
  #modal-back, #modal-submit {
    padding: 0.85rem 1rem;
    font-size: 0.8rem;
  }
  #modal-success {
    padding: 2.5rem 1.5rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }
  #modal-success .success-icon {
    width: 60px;
    height: 60px;
    font-size: 1.75rem;
    margin-bottom: 1.25rem;
  }
  #modal-success h3 {
    font-size: 1.35rem;
  }
  #modal-success p {
    font-size: 0.88rem;
  }
  #modal-done {
    padding: 0.85rem 2rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 640px) {
  /* Single column cards on small screens */
  .cuts-grid, .subprimal-grid { 
    grid-template-columns: 1fr; 
    padding: 0.85rem;
  }
  .subprimal-cuts {
    grid-template-columns: 1fr;
    padding: 0.85rem;
    gap: 0.6rem;
  }
  
  /* Do NOT re-set position/height/overflow - inherit from 1024px */
  #animal-diagram { 
    padding: 1rem; 
    min-height: 160px; 
  }
  
  /* Primal view adjustments - spacing only */
  .primal-sections {
    padding: 0.75rem;
    gap: 0.85rem;
  }
  .primal-view .content-header {
    padding: 0.7rem 0.85rem;
  }
  .primal-view .content-header h2 {
    font-size: 0.85rem;
  }
  
  /* Content header adjustments - spacing only */
  .content-header {
    padding: 0.7rem 0.85rem;
  }
  .content-header h2 {
    font-size: 0.82rem;
    letter-spacing: 0.02em;
  }
  .content-subtitle {
    font-size: 0.65rem;
  }
  .back-btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.58rem;
    margin-bottom: 0.35rem;
  }
  
  /* Subprimal adjustments */
  .subprimal-header {
    padding: 0.55rem 0.85rem;
  }
  .subprimal-header h3 {
    font-size: 0.68rem;
  }
  
  /* Form adjustments */
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .form-actions { 
    flex-direction: column-reverse; 
    gap: 0.75rem;
  }
  #modal-back, #modal-submit {
    width: 100%;
    flex: none;
  }
  
  /* Modal adjustments */
  .modal-header h2 { font-size: 1.05rem; }
  .modal-header p { font-size: 0.78rem; }
  
  /* Form inputs */
  .form-group input,
  .form-group textarea,
  .form-group select {
    padding: 0.65rem 0.75rem;
    font-size: 16px; /* Prevent iOS zoom */
  }
  .form-group { margin-bottom: 0.7rem; }
  .form-group label { font-size: 0.65rem; }
}

/* Extra small screens */
@media (max-width: 375px) {
  .nav-inner { padding: 0 0.75rem; }
  .nav-logo img { height: 28px; }
  #submit-form { padding: 0.75rem 1rem; }
  .modal-header { padding: 1rem; }
  .form-actions { 
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }
}

/* Bottom Bar Buttons */
.bottom-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: var(--radius-md);
  color: var(--wht);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.bottom-btn-primary { background: var(--red); }
#bottom-count {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--ylw);
  color: var(--blk);
  font-family: 'Epilogue', sans-serif;
  font-weight: 700;
  font-size: 0.7rem;
  border-radius: 11px;
}
