:root,
[data-palette="warm"] {
  --canvas: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgb(0 0 0 / 8%);
  --card: #fff;
  --field: #f5f5f7;
  --accent: #1d1d1f;
  --accent-ink: #fff;
  --link: #0066cc;
  --shadow: 0 10px 30px rgb(0 0 0 / 6%);
}

[data-palette="berry"] {
  --canvas: #f6f5f6;
  --accent: #7c1e36;
}

[data-palette="cocoa"] {
  --canvas: #f6f5f4;
  --accent: #3f2a22;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font: 17px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); }

img { max-width: 100%; display: block; }

.draft-note {
  margin: 0;
  padding: 0.45rem 1.25rem;
  background: #1d1d1f;
  color: #f5f5f7;
  font-size: 0.82rem;
  text-align: center;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgb(255 255 255 / 72%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.top-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.25rem;
  max-width: 1060px;
  margin: 0 auto;
  padding: max(0.7rem, env(safe-area-inset-top)) 1.25rem 0.7rem;
}

.brand {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-decoration: none;
  white-space: nowrap;
}

nav {
  display: flex;
  flex: 1;
  gap: 0.15rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

nav::-webkit-scrollbar { display: none; }

nav a {
  flex: 0 0 auto;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.88rem;
  text-decoration: none;
}

nav a:hover,
nav a[aria-current="page"] { background: rgb(0 0 0 / 6%); }

.logout { margin: 0; }

main {
  max-width: 1060px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

.hero { max-width: 40rem; margin-bottom: 2.5rem; }

h1, h2, h3 { font-weight: 600; letter-spacing: -0.03em; }

h1 {
  margin: 0.35rem 0 0.75rem;
  font-size: clamp(2.5rem, 7vw, 3.5rem);
  line-height: 1.05;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead { margin: 0 0 0.75rem; font-size: 1.25rem; line-height: 1.4; }

.contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0;
  color: var(--muted);
}

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

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 100%;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}

.card img,
.placeholder,
.product-media img,
.product-media .placeholder,
.sheet img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #e8e8ed;
}

.placeholder {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 3rem;
  font-weight: 600;
}

.card-body { padding: 1rem 1.1rem 1.2rem; }

.card h2 { margin: 0; font-size: 1.25rem; }

.card p,
.muted { margin: 0.2rem 0; color: var(--muted); }

.price {
  margin-top: 0.45rem !important;
  color: var(--ink) !important;
  font-weight: 600;
}

.pack-formula { white-space: normal; }

.pack-admin { border: 0; margin: 0.6rem 0; padding: 0; }
.pack-admin .choice { margin-right: 0.8rem; }

.product {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(18rem, 0.95fr);
  gap: 2rem;
  align-items: start;
}

.product-media img,
.product-media .placeholder { border-radius: 22px; }

.pre-line { white-space: pre-line; }

.photo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.photo-pick {
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #e8e8ed;
}

.product-media .photo-pick img {
  width: 64px;
  height: 64px;
  aspect-ratio: auto;
  border-radius: 0;
}

.product-copy h1 { font-size: clamp(2.2rem, 5vw, 3rem); }

.sheet {
  width: min(100%, 34rem);
  margin-inline: auto;
  padding: 1.6rem 1.4rem 1.8rem;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.sheet h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 0.55rem 0;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: var(--field);
}

.row div,
.row a + span { min-width: 0; }

.row div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.75rem;
  align-items: baseline;
}

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

.row form { margin: 0; }

.row .switch { margin: 0; flex: none; }

.row.is-off { opacity: 0.55; }

label {
  display: block;
  margin: 0.95rem 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

input, textarea, select, button { font: inherit; color: var(--ink); }

input, textarea, select {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 0.35rem;
  padding: 0.75rem 0.85rem;
  border: 0;
  border-radius: 12px;
  background: var(--field);
  font-size: 17px;
}

input[type="radio"],
input[type="checkbox"] {
  width: 1.15rem;
  min-height: 1.15rem;
  padding: 0;
}

.switch {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0.2rem 0 0.4rem;
}

.switch input[type="checkbox"] {
  appearance: none;
  width: 3.05rem;
  min-height: 1.8rem;
  margin: 0;
  border-radius: 999px;
  background: #d2d2d7;
  position: relative;
  cursor: pointer;
}

.switch input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.switch input[type="checkbox"]:checked {
  background: #1d1d1f;
}

.switch input[type="checkbox"]:checked::after {
  transform: translateX(1.25rem);
}

textarea { min-height: 7rem; resize: vertical; }

input:focus, textarea:focus, select:focus {
  outline: 2px solid #0071e3;
  background: #fff;
}

.choice input, .qty input {
  width: auto;
  margin-top: 0;
}

.qty, .choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.qty input { width: 5.5rem; text-align: center; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 0.6rem;
  padding: 0.55rem 1.15rem;
  border: 0;
  border-radius: 980px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

button.text {
  min-height: 36px;
  padding: 0.35rem 0.7rem;
  background: transparent;
  color: var(--link);
}

.flash {
  margin: 0 0 1rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.choices { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; }

.choices a { text-decoration: none; }

.choices a[aria-current="page"] { font-weight: 600; }

.pack-picker { margin-top: 1rem; }

.pack-label {
  margin: 0.75rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.pack-options { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.5rem 0.75rem; margin: 0; }

.pack-option { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }

.pack-chosen {
  min-height: 1.1rem;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.1;
}

.pack-option input[type="number"] {
  width: 3.4rem;
  margin: 0;
  text-align: center;
}

.pack-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 44px;
  min-width: 44px;
  margin: 0;
  padding: 0.5rem 1.1rem;
  border-radius: 980px;
  background: var(--field);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

.pack-pill input[type="radio"] {
  appearance: none;
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.pack-pill:has(input:checked),
.pack-pill.is-filled {
  background: var(--accent);
  color: var(--accent-ink);
}

.pack-pill:has(input:focus-visible) { outline: 2px solid #0071e3; }

.pack-count {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 12px;
  background: var(--field);
}

.pack-count button {
  min-height: 44px;
  min-width: 44px;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 600;
}

.pack-count input {
  width: 4.5rem;
  margin: 0;
  border: 0;
  background: transparent;
  text-align: center;
}

.pack-total { margin: 0.5rem 0 0; }

.qty[data-line], .pack-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 0.95rem 0;
}

.line-copy { flex: 1; min-width: 0; }

.line-copy .pack-options { margin-top: 0.5rem; }

.packs-choice { display: flex; align-items: center; gap: 0.75rem; margin: 0.5rem 0 0; }

.packs-choice input { width: 6rem; margin-top: 0; text-align: center; }

.line-name {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
}

.line-name span {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.line-total {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.line-parts {
  display: grid;
  grid-template-columns: 5.5rem 12.5rem;
  align-items: center;
  column-gap: 0.5rem;
  flex: none;
}

.line-parts .line-total { text-align: left; }

.line-parts input {
  width: 5.5rem;
  min-width: 5.5rem;
  max-width: 5.5rem;
}

.grand-total {
  margin: 1.25rem 0 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-weight: 600;
}

.trap { position: absolute; left: -10000px; height: 0; overflow: hidden; }

ul { margin: 0.5rem 0 1rem; padding-left: 1.15rem; }

.foot {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 1.25rem max(2rem, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.82rem;
}

.foot p { margin: 0.2rem 0; }

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .card { transition: transform 0.25s ease; }
  .card:hover { transform: translateY(-3px); }
}

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product { grid-template-columns: 1fr; gap: 1.25rem; }
}

@media (max-width: 700px) {
  .top-inner { flex-wrap: wrap; padding-inline: 1rem; }
  nav { order: 3; flex-basis: 100%; margin-inline: -0.25rem; }
  main { padding: 1.75rem 1rem 2.5rem; }
  .grid { grid-template-columns: 1fr; gap: 1rem; }
  .sheet { padding: 1.25rem 1rem 1.4rem; }
  .qty, .choice { align-items: flex-start; }
  .qty[data-line], .pack-line { flex-direction: column; align-items: stretch; }
  .line-parts { width: 100%; grid-template-columns: 5.5rem minmax(0, 1fr); }
  .row { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}
