:root {
  --ink: #0b0c10;
  --canvas: #ececec;
  --muted: #5f5f64; /* 5.3:1 di atas --canvas (lolos AA untuk teks kecil) */
  --accent: #ff5a36;
  /* Kartu & tumpukan mengecil di layar pendek supaya bar bawah tetap terlihat */
  --card-h: clamp(190px, 30dvh, 256px);
  --peek: clamp(26px, 4dvh, 36px);
  /* Skala tipografi: batas bawah px karena style.css menurunkan root ke 14px di layar <=374px */
  --fs-xs: max(11px, 0.6875rem);
  --fs-sm: max(12.5px, 0.8125rem);
  --fs-md: max(14px, 0.9375rem);
  --fs-lg: max(16px, 1.125rem);
  --fs-xl: max(19px, 1.375rem);
  /* Radius: kecil (chip, slot, input), sedang (panel), besar (kartu) */
  --r-sm: 12px;
  --r-md: 20px;
  --r-lg: 26px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

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

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  min-height: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 20px 0;
}

/* ── Header: judul dua nada + penanda langkah ── */
.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
}

.app-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5.5vw, 1.85rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  outline: none;
}

.app-title .tone-muted {
  display: block;
  color: #717176;
  font-weight: 500;
}

.step-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #ffffff;
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.step-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Filter per langkah ── */
.sub-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.sub-controls:empty { display: none; }

.chip {
  min-height: 34px;
  max-width: 100%;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: #e0e0e2;
  color: var(--ink);
  font: 500 var(--fs-sm)/1.3 var(--font-body);
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
}

.chip:hover:not(.is-active) { background: #d2d2d5; }
.chip:active { transform: scale(0.97); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chip.is-active { background: var(--ink); color: #ffffff; }

.sub-controls.is-services {
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.chip.service-chip {
  position: relative;
  flex: 1 0 auto;
  min-height: 44px;
  padding: 8px 6px;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.service-chip::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: calc(50% - 9px);
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0;
  transform: scaleX(0.4);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.chip.service-chip:hover:not(.is-active) { background: transparent; color: var(--ink); }
.chip.service-chip.is-active { background: transparent; color: var(--ink); font-weight: 600; }
.service-chip.is-active::after { opacity: 1; transform: none; }
.service-chip:focus-visible { outline-offset: -2px; }

/* ── Tumpukan kartu ── */
.stack {
  position: relative;
  height: 350px;
  height: clamp(230px, calc(100dvh - 400px), 350px);
  min-height: 0;
  margin: 10px -4px 0;
  overflow: hidden;
  perspective: 1100px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

.stack:focus-visible .stack-card.is-active {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.stack-card {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 8px;
  height: var(--card-h);
  margin-top: 0;
  padding: 20px 22px;
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  cursor: pointer;
  background: var(--card-bg, #e7e3dc);
  transform-origin: 50% 50%;
  transition: transform 0.55s var(--ease-out), opacity 0.35s ease;
  will-change: transform;
}

.stack-card.is-active {
  cursor: default;
}

.stack.is-stylists {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  justify-content: flex-start;
  height: auto;
  min-height: auto;
  margin-top: 14px;
  overflow: visible;
  perspective: none;
  touch-action: pan-y;
}

.stack-card.stylist-card {
  position: relative;
  flex: none;
  left: 4px;
  right: auto;
  top: auto;
  width: calc(100% - 8px);
  height: 104px;
  margin-top: -32px;
  padding: 14px 16px 36px;
  border-radius: var(--r-lg);
  justify-content: flex-start;
  gap: 3px;
  cursor: pointer;
}

.stylist-card:first-child { margin-top: 0; }
/* Kartu terakhir tidak ditumpuk kartu lain, jadi tidak perlu ruang bawah ekstra */
.stylist-card:last-child { height: auto; padding-bottom: 16px; }

.stylist-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  font: 500 var(--fs-lg) var(--font-display);
}

.stylist-card .card-name { flex: 1; min-width: 0; font-size: var(--fs-lg); }
.stylist-card .card-tag { font-size: var(--fs-xs); text-transform: none; letter-spacing: 0; }
.stylist-card .card-bottom { margin-left: 44px; }
.stylist-card .card-meta { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }

.card-top,
.card-bottom {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-bottom { align-items: flex-end; }

.card-name {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-name .light { font-weight: 300; }

.card-tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
}

.card-amount {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card-amount .unit {
  font-size: var(--fs-xl);
  font-weight: 400;
  margin-right: 4px;
  vertical-align: 0.85em;
}

.card-amount .big { font-size: clamp(2.85rem, 13vw, 3.5rem); }
.card-amount .tail { font-size: var(--fs-lg); margin-left: 2px; opacity: 0.75; }

.card-meta {
  flex: none;
  font-size: var(--fs-md);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

/* Komposisi bentuk oranye: hanya tampil penuh di kartu aktif */
.card-shapes {
  position: absolute;
  inset: 54px 20px 70px;
  z-index: 1;
  /* Kartu pendek (HP pendek): bentuk dipotong rapi di area atas, tidak menimpa harga */
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.4s ease, transform 0.55s var(--ease-out);
}

.stack-card.is-active .card-shapes { opacity: 1; transform: none; }

.card-shapes span {
  position: absolute;
  background: var(--accent);
}

/* Pola A: cincin tebal + bilah diagonal (siluet silet cukur) + titik */
.shapes-a span:nth-child(1) { right: 6%; top: 0; width: 40%; aspect-ratio: 1; border-radius: 50%; background: transparent; border: 18px solid var(--accent); }
.shapes-a span:nth-child(2) { left: 4%; top: 38%; width: 58%; height: 22%; border-radius: 999px; transform: rotate(-24deg); }
.shapes-a span:nth-child(3) { left: 10%; top: 2%; width: 13%; aspect-ratio: 1; border-radius: 50%; }

/* Pola B: tiga lingkaran menurun */
.shapes-b span { width: 30%; aspect-ratio: 1; border-radius: 50%; }
.shapes-b span:nth-child(1) { left: 2%; top: 0; }
.shapes-b span:nth-child(2) { left: 34%; top: 14%; opacity: 0.85; }
.shapes-b span:nth-child(3) { left: 66%; top: 28%; opacity: 0.7; }

/* Pola C: setengah lingkaran atas besar + bilah */
.shapes-c span:nth-child(1) { left: 0; top: 0; width: 58%; aspect-ratio: 2 / 1; border-radius: 999px 999px 0 0; }
.shapes-c span:nth-child(2) { right: 4%; top: 0; width: 14%; height: 100%; border-radius: 999px; }
.shapes-c span:nth-child(3) { right: 22%; top: 30%; width: 14%; height: 70%; border-radius: 999px; }

/* Pola D: seperempat lingkaran berhadapan */
.shapes-d span { width: 34%; aspect-ratio: 1; }
.shapes-d span:nth-child(1) { left: 0; top: 0; border-radius: 0 0 100% 0; }
.shapes-d span:nth-child(2) { left: 34%; top: 0; border-radius: 0 0 0 100%; }
.shapes-d span:nth-child(3) { right: 0; top: 10%; width: 26%; border-radius: 50%; }

.card-check {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  font-size: var(--fs-sm);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.25s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stack-card.is-selected .card-check { opacity: 1; transform: none; }
.stack-card.is-selected .card-tag { visibility: hidden; }

/* Stylist: centang menggantikan avatar, jam shift tetap terlihat */
.stylist-card .card-check { right: auto; left: 16px; }
.stylist-card.is-selected .stylist-avatar { visibility: hidden; }
.stack-card.stylist-card.is-selected .card-tag { visibility: visible; }

.stack-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: var(--fs-md);
  text-align: center;
}

/* ── Ringkasan (langkah 4) ── */
.summary {
  flex: 1;
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  overflow-y: auto;
}

.app.is-summary .summary { display: flex; }
.app.is-summary .stack,
.app.is-summary .stack-hint { display: none; }

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: #ffffff;
}

.summary-row span:first-child { color: var(--muted); font-size: var(--fs-sm); }
.summary-row strong { min-width: 0; overflow-wrap: anywhere; font-family: var(--font-display); font-size: var(--fs-md); font-weight: 500; text-align: right; }

.summary-total {
  margin-top: 6px;
  padding: 18px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: #ffffff;
}

.summary-total small { display: block; color: rgba(255, 255, 255, 0.6); font-size: var(--fs-sm); margin-bottom: 4px; }
.summary-total .card-amount .big { font-size: 2.8rem; }

.summary-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.summary-note { color: var(--muted); font-size: var(--fs-sm); text-align: center; }

.stack-hint {
  margin: 4px 0 6px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* ── Bar bawah: kembali · pilih · lanjut ── */
.bottom-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 10px 0 max(18px, env(safe-area-inset-bottom));
}

.round-btn {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1.5px dashed rgba(11, 12, 16, 0.22);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: var(--fs-lg);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.round-btn:hover { background: rgba(255, 255, 255, 0.6); }
.round-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.round-btn:disabled { opacity: 0.3; cursor: default; }
.round-btn.is-next { justify-self: end; }
.round-btn.is-ready { border-style: solid; border-color: var(--ink); background: var(--ink); color: #ffffff; }

.pick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 600 var(--fs-sm) var(--font-body);
  cursor: pointer;
}

.pick-btn .dot {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  font-size: var(--fs-md);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}

.pick-btn.is-picked .dot { background: var(--accent); color: var(--ink); transform: rotate(45deg); }
.pick-btn:focus-visible .dot { outline: 2px solid var(--accent); outline-offset: 3px; }
.pick-btn:disabled { opacity: 0.3; cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .stack-card,
  .card-shapes,
  .card-check,
  .chip,
  .service-chip::after,
  .round-btn,
  .pick-btn .dot { transition: none; }
}
