:root {
  --cream: var(--cream-base);
  --paper: var(--surface-container-lowest);
  --ink: var(--cacao-deep);
  --muted: var(--on-surface-variant);
  --line: rgba(66, 50, 46, 0.16);
  --cocoa: var(--cacao-deep);
  --wine: var(--primary);
  --gold: var(--caramel-gold);
  --green: var(--success);
  --danger: var(--error);
  --shadow: var(--heritage-shadow-soft);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-hero {
  min-height: 360px;
  color: #fff8ed;
  padding: 24px clamp(18px, 4vw, 48px) 44px;
  background:
    linear-gradient(90deg, rgba(31, 14, 9, 0.92), rgba(31, 14, 9, 0.42)),
    url("https://images.unsplash.com/photo-1541167760496-1628856ab772?auto=format&fit=crop&w=1800&q=85");
  background-position: center;
  background-size: cover;
}

.nav,
.brand,
.nav-session,
.menu-heading,
.toolbar,
.checkout-title,
.cart-row {
  display: flex;
  align-items: center;
}

.nav {
  justify-content: space-between;
  gap: 18px;
}

.brand {
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: var(--gold);
  color: var(--cocoa);
  font-size: 26px;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #e9dac4;
}

.nav-session {
  gap: 12px;
}

.hero-copy {
  max-width: 760px;
  margin-top: 76px;
}

.hero-copy span {
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 12px 0 0;
  font-size: 66px;
  line-height: 0.98;
}

.hero-copy p {
  max-width: 560px;
  margin: 18px 0 0;
  color: #efdfcb;
  font-size: 19px;
  line-height: 1.45;
}

.delivery-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.delivery-hero-actions a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 248, 237, 0.36);
  background: rgba(255, 248, 237, 0.12);
  color: #fff8ed;
  font-weight: 800;
  padding: 0 18px;
}

.delivery-hero-actions a:first-child {
  border-color: transparent;
  background: var(--gold);
  color: var(--cocoa);
}

.orders-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr) 370px;
  align-items: start;
  gap: 20px;
  padding: 24px;
}

.side-column,
.checkout-column,
.menu-column {
  display: grid;
  gap: 16px;
}

.side-column,
.checkout-column {
  position: sticky;
  top: 16px;
}

.panel,
.checkout-panel,
.notice,
.product-card,
.order-card,
.cart-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel,
.checkout-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

h2,
h3,
p {
  margin: 0;
}

h2 {
  font-size: 22px;
}

p,
label,
.muted {
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
}

form {
  display: grid;
  gap: 12px;
}

.delivery-steps ol {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 20px;
}

.delivery-steps li {
  color: var(--muted);
}

.delivery-steps li strong,
.delivery-steps li span {
  display: block;
}

.delivery-steps li strong {
  color: var(--ink);
}

.compact-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.compact-heading h2 {
  font-size: 18px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  padding: 9px 10px;
}

textarea {
  resize: vertical;
}

.primary-button,
.ghost-button,
.small-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--primary);
  color: #fffaf2;
}

.ghost-button,
.small-button {
  border-color: var(--line);
  background: var(--secondary-container);
  color: var(--ink);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #efe5d7;
  padding: 5px;
}

.auth-tab {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-tab.active {
  background: var(--paper);
  color: var(--wine);
  box-shadow: 0 8px 18px rgba(41, 25, 16, 0.08);
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
}

.menu-heading,
.checkout-title,
.cart-row {
  justify-content: space-between;
  gap: 14px;
}

.toolbar {
  gap: 10px;
}

.toolbar select {
  min-width: 210px;
}

.notice {
  border-left: 4px solid var(--green);
  padding: 13px 14px;
}

.notice.error {
  border-left-color: var(--danger);
}

.notice.success {
  border-left-color: var(--green);
}

.hidden {
  display: none;
}

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

.promise-grid article {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 14px;
}

.promise-grid strong {
  color: var(--wine);
}

.promise-grid span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

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

.product-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.product-card strong {
  font-size: 18px;
}

.product-price {
  font-size: 22px;
  font-weight: 900;
}

.cart-list,
.orders-list {
  display: grid;
  gap: 10px;
}

.button-row,
.quantity-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button-row {
  justify-content: space-between;
}

.quantity-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.quantity-actions span {
  color: var(--ink);
  font-weight: 800;
  min-width: 22px;
  text-align: center;
}

.cart-item,
.order-card {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.totals {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.totals div {
  display: flex;
  justify-content: space-between;
}

.grand-total {
  font-size: 18px;
}

.checkout-note,
.selection-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--muted);
  line-height: 1.35;
  padding: 10px 11px;
}

.checkout-button {
  width: 100%;
}

details {
  display: grid;
  gap: 12px;
}

summary {
  cursor: pointer;
  color: var(--wine);
  font-weight: 800;
}

details form {
  margin-top: 12px;
}

.status {
  display: inline-flex;
  width: fit-content;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  background: #eadfce;
  color: var(--muted);
  padding: 0 9px;
  font-size: 12px;
}

.status.delivered,
.status.paid {
  background: rgba(43, 114, 95, 0.13);
  color: var(--green);
}

.status.cancelled,
.status.failed {
  background: rgba(164, 54, 54, 0.13);
  color: var(--danger);
}

.last-order-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
}

.payment-instructions {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
}

.payment-instructions p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.pix-copy-box {
  display: grid;
  gap: 8px;
}

.mp-payment-box {
  display: grid;
  justify-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
  padding: 12px;
}

.mp-payment-box img {
  width: min(220px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
}

.mp-payment-box .ghost-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pix-copy-box span {
  color: var(--wine);
  font-size: 13px;
  font-weight: 800;
}

.pix-copy-box textarea {
  min-height: 96px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.payment-instructions.hidden,
.pix-copy-box.hidden,
.mp-payment-box.hidden,
.mp-payment-box img.hidden,
.mp-payment-box .ghost-button.hidden {
  display: none;
}

.order-progress {
  display: grid;
  gap: 8px;
}

.progress-step {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.progress-step span {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #d8c9b8;
}

.progress-step.active {
  color: var(--ink);
}

.progress-step.active span {
  background: var(--green);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(33, 22, 16, 0.58);
  padding: 18px;
}

.modal-backdrop.hidden {
  display: none;
}

.confirm-modal {
  width: min(520px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 20px;
}

.confirm-list {
  display: grid;
  gap: 10px;
}

.confirm-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
}

.confirm-list span {
  color: var(--muted);
}

.floating-access-button {
  position: fixed;
  right: clamp(16px, 3vw, 34px);
  bottom: clamp(16px, 3vw, 30px);
  z-index: 12;
  display: grid;
  gap: 2px;
  width: min(220px, calc(100vw - 32px));
  min-height: 58px;
  justify-content: center;
  border: 1px solid rgba(255, 250, 242, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--wine), #5f201b);
  box-shadow: 0 18px 42px rgba(43, 23, 16, 0.24);
  color: #fffaf2;
  padding: 10px 18px;
  text-align: center;
}

.floating-access-button.hidden {
  display: none;
}

.floating-access-button span {
  color: rgba(255, 250, 242, 0.72);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.floating-access-button strong {
  font-size: 16px;
  line-height: 1.15;
}

.floating-access-button:focus-visible {
  outline: 3px solid rgba(197, 150, 79, 0.72);
  outline-offset: 3px;
}

@media (max-width: 1220px) {
  .orders-layout {
    grid-template-columns: 310px minmax(0, 1fr);
  }

  .checkout-column {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 820px) {
  .orders-layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .side-column {
    position: static;
  }

  .menu-heading,
  .nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .promise-grid {
    grid-template-columns: 1fr;
  }
}

/* Delivery-focused layout */
.delivery-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  align-items: start;
  gap: 22px;
  padding: 28px;
}

.delivery-layout .menu-column {
  display: grid;
  gap: 18px;
}

.delivery-layout .checkout-column {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 16px;
}

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

.delivery-status div {
  border: 1px solid rgba(139, 48, 41, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, #fffaf2, #f2e3d0);
  box-shadow: var(--shadow);
  padding: 16px;
}

.delivery-status span,
.delivery-status strong {
  display: block;
}

.delivery-status span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.delivery-status strong {
  margin-top: 7px;
  color: var(--cocoa);
  font-size: 20px;
}

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

.delivery-strip div {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 14px;
}

.delivery-strip strong {
  color: var(--wine);
}

.delivery-strip span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.section-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.delivery-layout .menu-heading {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.delivery-layout .menu-heading h2 {
  font-size: 46px;
  line-height: 1.02;
}

.delivery-layout .product-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.delivery-layout .product-card {
  align-content: start;
  gap: 14px;
  min-height: 245px;
  padding: 18px;
}

.delivery-layout .product-card.has-image {
  overflow: hidden;
  padding: 0;
}

.product-media {
  position: relative;
  overflow: hidden;
  margin: 0;
  min-height: 168px;
  background: linear-gradient(135deg, var(--secondary-container), var(--tertiary-container));
}

.product-media img {
  display: block;
  width: 100%;
  height: 188px;
  object-fit: cover;
}

.product-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 46%, rgba(45, 31, 27, 0.22));
  pointer-events: none;
}

.product-media-fallback {
  display: grid;
  place-items: center;
  height: 148px;
  color: var(--primary);
  font-size: 52px;
  font-weight: 800;
}

.delivery-layout .product-card.has-image > :not(.product-media) {
  margin-left: 18px;
  margin-right: 18px;
}

.delivery-layout .product-card.has-image .muted {
  margin-top: 18px;
}

.delivery-layout .product-card.has-image .primary-button {
  margin-bottom: 18px;
}

.delivery-layout .product-card strong {
  font-size: 21px;
}

.delivery-layout .product-price {
  align-self: end;
  font-size: 24px;
}

.checkout-main {
  border-color: rgba(139, 48, 41, 0.35);
  background:
    linear-gradient(180deg, rgba(197, 150, 79, 0.14), rgba(255, 250, 242, 0)),
    var(--paper);
}

.checkout-button {
  min-height: 52px;
  font-size: 17px;
}

.compact-orders h2 {
  font-size: 18px;
}

@media (max-width: 1220px) {
  .delivery-layout {
    grid-template-columns: 1fr;
  }

  .delivery-layout .checkout-column {
    position: static;
  }
}

@media (max-width: 820px) {
  .delivery-layout {
    padding: 16px;
  }

  .delivery-strip {
    grid-template-columns: 1fr;
  }

  .delivery-status {
    grid-template-columns: 1fr;
  }
}

/* Focused checkout flow */
.compact-hero {
  min-height: 300px;
  padding-bottom: 34px;
}

.compact-hero .hero-copy {
  margin-top: 48px;
}

.compact-hero .hero-copy h1 {
  max-width: 860px;
  font-size: 64px;
}

.menu-stage {
  border: 1px solid rgba(139, 48, 41, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(197, 150, 79, 0.14), rgba(255, 250, 242, 0)),
    var(--paper);
  box-shadow: var(--shadow);
  padding: 20px;
}

.checkout-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: var(--shadow);
  padding: 10px;
}

.flow-step {
  display: grid;
  gap: 6px;
  justify-items: center;
  min-width: 0;
  border-radius: 8px;
  color: var(--muted);
  padding: 8px 6px;
  text-align: center;
}

.flow-step span,
.step-index {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #eadfce;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.flow-step strong {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.flow-step.active {
  background: rgba(139, 48, 41, 0.08);
  color: var(--wine);
}

.flow-step.active span,
.step-panel.active .step-index {
  background: var(--wine);
  color: #fffaf2;
}

.flow-step.complete span,
.step-panel.complete .step-index {
  background: var(--green);
  color: #fffaf2;
}

.flow-step.locked {
  opacity: 0.62;
}

.step-panel {
  position: relative;
  border-left: 4px solid #d8c9b8;
}

.step-panel.active {
  border-left-color: var(--wine);
  box-shadow: 0 22px 56px rgba(139, 48, 41, 0.14);
}

.step-panel.complete {
  border-left-color: var(--green);
}

.step-panel.locked {
  opacity: 0.82;
}

.step-panel.locked > :not(.step-heading) {
  display: none;
}

.step-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-heading h2 {
  margin: 0;
  font-size: 20px;
}

.step-heading p {
  margin-top: 3px;
  font-size: 13px;
}

.step-actions {
  display: flex;
  justify-content: flex-end;
}

.step-actions .ghost-button {
  min-width: 132px;
}

.delivery-layout .cart-list {
  max-height: 360px;
  overflow: auto;
  padding-right: 2px;
}

.delivery-layout .session-panel .primary-button {
  width: 100%;
}

.delivery-layout details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 11px 12px;
}

.delivery-layout details[open] {
  background: var(--paper);
}

@media (max-width: 1220px) {
  .checkout-progress {
    position: sticky;
    top: 0;
    z-index: 5;
  }
}

@media (max-width: 560px) {
  .compact-hero .hero-copy {
    margin-top: 38px;
  }

  .hero-copy h1,
  .compact-hero .hero-copy h1 {
    font-size: 40px;
  }

  .delivery-layout .menu-heading h2 {
    font-size: 34px;
  }

  .checkout-progress {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .menu-stage {
    padding: 16px;
  }

  .step-heading {
    align-items: flex-start;
  }

  .floating-access-button {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}
