@font-face {
  font-family: "Mabeo Vintage";
  src: url("fonts/MabeoVintageDemo-Regular.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
}

:root {
  --color-bg: #faf8f5;
  --color-surface: #ffffff;
  --color-text: #2c1810;
  --color-text-muted: #6b5b50;
  --color-accent: #5c3d2e;
  --color-accent-hover: #7a5240;
  --color-accent-light: #f0e6de;
  --color-border: #e0d5cc;
  --color-success: #2d7a4f;
  --color-danger: #b5342b;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(44, 24, 16, 0.08);
  --shadow-lg: 0 4px 20px rgba(44, 24, 16, 0.12);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-title: "Mabeo Vintage", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ─── Site Title ─────────────────────────────────────────────── */

.site-title {
  font-family: var(--font-title);
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: normal;
  color: var(--color-accent);
  text-align: center;
  padding: 20px 24px 12px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  background: var(--color-bg);
}

/* ─── About client (Marziale Tech) ──────────────────────────── */

.about-client-line {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 0;
  font-size: 14px;
  color: var(--color-text-muted);
  padding: 20px 0 24px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.about-client-line img {
  height: 18px;
  width: auto;
  vertical-align: middle;
}

.about-client-line .about-client-angel {
  height: 40px;
  margin-left: -10px;
  margin-right: -10px;
}

.about-client-line .about-client-link {
  font-style: italic;
  font-weight: 700;
  text-decoration: none;
  color: var(--color-accent);
}

.about-client-line .about-client-link:hover {
  color: var(--color-accent-hover);
}

.about-client-line.about-client-line-inline {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* ─── Page Shell ─────────────────────────────────────────────── */

.page-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 8px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* ─── Account Panel ──────────────────────────────────────────── */

.account-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0;
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.account-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 8px;
}

.account-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.email-row {
  display: flex;
  gap: 8px;
  max-width: 420px;
}

.email-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 15px;
  outline: none;
  font-family: var(--font);
}

.email-row input:focus {
  border-color: var(--color-accent);
}

.account-status {
  margin-bottom: 12px;
}

.account-status p {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.account-status strong {
  color: var(--color-text);
}

.modify-hint {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 12px;
  font-style: italic;
}

/* ─── Subscription Card ──────────────────────────────────────── */

.sub-card {
  border: 1px solid var(--color-border);
  border-radius: 0;
  padding: 16px;
  background: var(--color-bg);
}

.sub-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.sub-cadence {
  font-weight: 700;
  font-size: 15px;
}

.sub-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.sub-badge.active { background: #dcfce7; color: var(--color-success); }
.sub-badge.past_due { background: #fef3c7; color: #92400e; }
.sub-badge.canceled { background: #fee2e2; color: var(--color-danger); }
.sub-badge.trialing { background: #dbeafe; color: #1e40af; }

.sub-items-list {
  list-style: none;
  margin-bottom: 12px;
}

.sub-items-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--color-accent-light);
}

.sub-items-list li:last-child { border-bottom: none; }

.sub-item-name {
  font-weight: 600;
  font-size: 13px;
}

.sub-item-detail {
  font-size: 13px;
  color: var(--color-text-muted);
  white-space: nowrap;
  margin-left: 12px;
}

.sub-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
  font-size: 13px;
}

.sub-total {
  font-weight: 700;
  color: var(--color-accent);
}

.sub-next {
  color: var(--color-text-muted);
}

.sub-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

/* ─── Menu Section ───────────────────────────────────────────── */

.menu-section {
  margin-bottom: 100px;
}

.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.menu-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-accent);
}

/* ─── Cadence Toggle ─────────────────────────────────────────── */

.cadence-toggle {
  display: flex;
  background: var(--color-surface);
  border-radius: 0;
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.cadence-toggle.locked {
  opacity: 0.5;
  pointer-events: none;
}

.cadence-btn {
  padding: 6px 18px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all 0.2s;
}

.cadence-btn.active {
  background: var(--color-accent);
  color: #fff;
}

/* ─── Category + Grid ────────────────────────────────────────── */

.category-section {
  margin-bottom: 14px;
}

.category-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 4px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--color-accent-light);
}

.flavor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

/* ─── Flavor Tile ────────────────────────────────────────────── */

.flavor-tile {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 0;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
}

.flavor-tile:hover { border-color: var(--color-accent); }

.flavor-tile.has-items {
  border-color: var(--color-accent);
  box-shadow: var(--shadow);
}

.flavor-tile.expanded {
  grid-column: 1 / -1;
  border-color: var(--color-accent);
  box-shadow: var(--shadow);
  cursor: default;
}

.tile-header {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 62px;
  position: relative;
  cursor: pointer;
}

.tile-header:hover { background: var(--color-accent-light); }

.tile-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.tile-from {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 3px;
}

.tile-badge {
  position: absolute;
  top: -1px;
  right: 8px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 0;
  background: var(--color-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-body { padding: 0 14px 14px; }

.selector-row { margin-bottom: 14px; }

.pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  padding: 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text);
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.pill:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.pill.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.pill-price {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.8;
}

.add-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--color-accent-light);
}

.add-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-accent);
}

.add-cadence {
  font-size: 13px;
  font-weight: 400;
  color: var(--color-text-muted);
}

.add-btn {
  padding: 10px 24px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.add-btn:hover { background: var(--color-accent-hover); }

.qty-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qty-btn {
  width: 34px;
  height: 34px;
  border-radius: 0;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: var(--color-text);
}

.qty-btn:hover { background: var(--color-accent-light); border-color: var(--color-accent); }
.qty-btn:disabled { opacity: 0.3; cursor: default; }

.qty-value {
  font-size: 17px;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
}

/* ─── Checkout Bar ───────────────────────────────────────────── */

.checkout-bar {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 16px rgba(44, 24, 16, 0.1);
  padding: 12px 24px;
  z-index: 100;
  flex-shrink: 0;
  position: relative;
}

.checkout-bar.hidden { display: none; }

.cart-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.cart-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--color-accent-light);
  border-radius: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent);
}

.cart-chip-qty {
  background: var(--color-accent);
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

.cart-chip-remove {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.cart-chip-remove:hover { color: var(--color-danger); }

.checkout-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-total {
  font-size: 13px;
  color: var(--color-text-muted);
}

.cart-total strong {
  color: var(--color-text);
  font-size: 18px;
}

.empty-cart-msg {
  font-size: 13px;
  color: var(--color-text-muted);
  font-style: italic;
}

.shipping-note {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-left: 4px;
}

.checkout-btn {
  background: var(--color-accent);
  color: #fff;
  border: none;
  padding: 10px 32px;
  border-radius: 0;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.checkout-btn:hover { background: var(--color-accent-hover); }
.checkout-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.save-success {
  background: #dcfce7;
  color: var(--color-success);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Buttons ────────────────────────────────────────────────── */

.btn-primary {
  padding: 10px 20px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--color-accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  padding: 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-link {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover { color: var(--color-accent); }

/* ─── Utility ────────────────────────────────────────────────── */

.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
  font-size: 16px;
}

.loading-small {
  color: var(--color-text-muted);
  font-size: 14px;
  padding: 8px 0;
}

.error-msg {
  background: #fef2f2;
  color: var(--color-danger);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 14px;
}

/* ─── Responsive ─────────────────────────────────────────────── */

@media (max-width: 480px) {
  .scroll-area { padding: 14px 12px 8px; }
  .flavor-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .tile-name { font-size: 13px; }
  .checkout-bar { padding: 10px 14px; }
  .menu-header h2 { font-size: 18px; }
  .account-panel { padding: 16px; }
  .sub-card-footer { flex-direction: column; gap: 4px; align-items: flex-start; }
  .email-row { max-width: 100%; }
}

@media (min-width: 768px) {
  .flavor-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .flavor-grid { grid-template-columns: repeat(4, 1fr); }
}
