:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --line: #d1d5db;
  --text: #111827;
  --muted: #4b5563;
  --primary: #4c1d95;
  --primary-2: #7c3aed;
  --danger: #b91c1c;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1rem;
  color: #fff;
  background: linear-gradient(130deg, var(--primary), var(--primary-2));
}
.brand { margin: 0; font-size: .75rem; opacity: .85; }
h1 { margin: .2rem 0 0; font-size: 1.1rem; }
.tabs {
  position: sticky;
  top: 63px;
  z-index: 15;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: .5rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding: .55rem .75rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.tabs a {
  text-decoration: none;
  color: var(--primary);
  background: #ede9fe;
  font-weight: 600;
  padding: .5rem .8rem;
  border-radius: 999px;
  white-space: nowrap;
  font-size: .88rem;
  scroll-snap-align: start;
}
main {
  display: grid;
  gap: .75rem;
  padding: .75rem;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .95rem;
}
.hero { background: linear-gradient(180deg, #faf5ff, #ffffff); }
.section-heading p { margin-top: 0; color: var(--muted); }
.chips { display: flex; gap: .45rem; flex-wrap: wrap; }
.chips span {
  background: #ede9fe;
  color: var(--primary);
  font-size: .8rem;
  border-radius: 999px;
  padding: .35rem .65rem;
}
.grid { display: grid; gap: .7rem; }
.plan {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .8rem;
}
.plan h3 { margin: 0; }
.plan .price { color: var(--primary); font-weight: 700; margin: .3rem 0; }
.badge {
  display: inline-block;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: #ddd6fe;
  color: #312e81;
  font-size: .75rem;
}
.month-box {
  border: 1px dashed #a78bfa;
  border-radius: 12px;
  padding: .8rem;
  background: #faf5ff;
}
.stack { display: grid; gap: .65rem; }
label { display: grid; gap: .3rem; font-weight: 600; font-size: .92rem; }
input, select, textarea, button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  padding: .72rem;
  min-height: 44px;
}
textarea { min-height: 92px; }
button {
  border: none;
  color: #fff;
  font-weight: 700;
  background: var(--primary-2);
}
button.secondary { background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .4); }
.inline {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: .5rem;
}
.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: .45rem;
  margin-top: .8rem;
}
.actions button:last-child { background: var(--danger); }
pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: .8rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.admin-grid {
  display: grid;
  gap: .9rem;
}
#segments { margin: 0; padding-left: 1.2rem; }
.small { color: var(--muted); font-size: .84rem; }
footer {
  text-align: center;
  color: var(--muted);
  font-size: .86rem;
  padding: .9rem;
}
#wineCollectionList { margin: .4rem 0 .9rem; padding-left: 1.2rem; }
#wineCollectionList li { margin-bottom: .3rem; }
#pairingBtn { margin-top: .5rem; width: 100%; }

@media (min-width: 600px) {
  .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #pairingBtn { width: auto; }
}

@media (min-width: 860px) {
  h1 { font-size: 1.25rem; }
  main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #home, #membership, #legal { grid-column: span 2; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
