@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f6f0e7;
  --surface: #fbf7f0;
  --surface-strong: #f1e4d9;
  --ink: #201b14;
  --ink-soft: #443d33;
  --muted: #766d61;
  --border: #e4daca;
  --border-strong: #cfc3b0;
  --primary: #201b14;
  --primary-hover: #2b241c;
  --success: #2f6d46;
  --danger: #9d2f24;
  --warning: #8f5545;
  --shadow: 0 18px 44px rgba(63, 52, 43, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 Onest, system-ui, -apple-system, Segoe UI, sans-serif;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  width: min(1200px, calc(100% - 32px));
  margin: 18px auto 0;
  padding: 10px 12px 10px 18px;
  background: rgba(245, 233, 223, .82);
  border: 1px solid rgba(101, 59, 46, .15);
  border-radius: 999px;
  box-shadow: 0 20px 50px rgba(63, 52, 43, .16);
  backdrop-filter: blur(18px) saturate(150%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #43261e;
}

header h1,
header p { margin: 0; }

header h1 {
  font-size: 1.15rem;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0;
}

header p {
  color: var(--muted);
  font-size: .86rem;
}

main {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(228, 218, 202, .95);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.auth-single {
  max-width: 480px;
  margin: 58px auto;
}

.auth-card { width: 100%; }

.auth-switch {
  text-align: center;
  margin: 4px 0 0;
  color: var(--muted);
}

.link-button {
  display: inline;
  background: none;
  color: var(--warning);
  padding: 0;
  border-radius: 0;
  text-decoration: underline;
  font: inherit;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr);
  gap: 22px;
}

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

label {
  display: grid;
  gap: 6px;
  font-weight: 650;
  color: var(--ink-soft);
}

input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fffaf4;
  color: var(--ink);
  font: inherit;
}

input:focus {
  outline: 2px solid rgba(143, 85, 69, .22);
  border-color: #8f5545;
}

button {
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  padding: 11px 16px;
  font-weight: 750;
  cursor: pointer;
  transition: background-color .18s ease, transform .18s ease, opacity .18s ease;
}

button:hover { background: var(--primary-hover); }
button:active { transform: scale(.98); }
button:disabled,
input:disabled { opacity: .55; cursor: not-allowed; }

.ghost {
  background: transparent;
  border: 1px solid rgba(67, 38, 30, .22);
  color: #43261e;
}

.ghost:hover { background: rgba(143, 85, 69, .1); }
.hidden { display: none !important; }

.welcome,
.section-title,
.product-head,
.buyer,
.friend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.welcome { margin-bottom: 20px; }

.welcome h2,
.welcome p,
.card h2 { margin-top: 0; }

.welcome h2,
.card h2 {
  font-size: 1.35rem;
  letter-spacing: 0;
}

.total { text-align: right; }
.total span { display: block; color: var(--muted); }
.total strong { font-size: 1.45rem; }

.products {
  display: grid;
  gap: 16px;
}

.peptide-group {
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: #fffaf4;
}

.peptide-group h3 {
  margin: 0;
  padding: 13px 16px;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--border);
  font-size: 1.06rem;
  font-weight: 800;
  color: var(--ink);
}

.product {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.dose-row {
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid #f1eade;
  background: rgba(255, 255, 255, .72);
}

.dose-row:nth-child(odd) { background: rgba(32, 27, 20, .025); }
.dose-row:last-child { border-bottom: 0; }

.out-of-stock {
  background: #f1eade;
  color: #8a8174;
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr 110px 130px;
  gap: 12px;
  align-items: center;
}

.product-name strong { display: block; }

.stock-badge {
  display: inline-block;
  margin-left: 8px;
  border: 1px solid rgba(157, 47, 36, .22);
  border-radius: 999px;
  background: rgba(157, 47, 36, .08);
  color: var(--danger);
  padding: 2px 8px;
  font-size: .72rem;
  font-weight: 750;
}

.muted,
.product-name span { color: var(--muted); }

.qty { text-align: center; }

.subtotal {
  text-align: right;
  font-weight: 800;
}

.group-item {
  border-top: 1px solid var(--border);
  padding: 16px 0;
}

.group-item:first-child { border-top: 0; }

.progress {
  height: 9px;
  background: #e4daca;
  border-radius: 999px;
  overflow: hidden;
  margin: 9px 0;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.complete { color: var(--success); font-weight: 750; }
.missing { color: var(--warning); font-weight: 750; }

.buyer,
.friend { padding: 7px 0; }

.buyer + .buyer,
.friend + .friend { border-top: 1px dashed var(--border); }

.settings-panel { margin-bottom: 18px; }

.settings-form {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: end;
}

.catalog-note {
  color: var(--muted);
  font-size: .9rem;
}

.price-lines {
  font-size: .85rem;
  color: var(--muted);
}

.friends-card { margin-top: 22px; }

.friends {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.friend {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 250, 244, .72);
  padding: 12px;
}

.notice {
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 18px;
}

.notice.ok {
  background: #e7f0df;
  color: #2f6d46;
}

.notice.error {
  background: #f6e4df;
  color: var(--danger);
}

@media (max-width: 820px) {
  header {
    align-items: center;
    width: calc(100% - 24px);
  }

  .layout { grid-template-columns: 1fr; }
  .settings-form { grid-template-columns: 1fr 1fr; }
  .product-grid { grid-template-columns: 1fr 90px; }
  .subtotal { grid-column: 1 / -1; text-align: left; }
  .welcome { align-items: flex-start; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .section-title button { width: 100%; }
}
