:root {
  --bg: #faf7f5;
  --surface: #ffffff;
  --text: #2b2320;
  --text-muted: #8a7f79;
  --accent: #c4707a;
  --accent-dark: #a85560;
  --accent-soft: #f6e6e8;
  --border: #ede6e3;
  --success: #4c8c68;
  --danger: #c0463f;
  --gold: #b8860b;
  --silver: #8c8c96;
  --bronze: #a56a3a;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(43, 35, 32, 0.06);
  --shadow-lift: 0 8px 24px rgba(43, 35, 32, 0.12);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 78px;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding: 20px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px;
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: 0.2px; }
.brand-sub { font-size: 11px; color: var(--text-muted); margin-top: -2px; }
.topbar-actions { display: flex; gap: 10px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; color: var(--text);
}

/* ---------- page container ---------- */
.page { padding: 12px 20px 24px; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none; } }

h1.page-title { font-size: 22px; margin: 6px 0 4px; font-weight: 700; }
p.page-subtitle { color: var(--text-muted); font-size: 13.5px; margin: 0 0 18px; }

/* ---------- hero ---------- */
.hero {
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  padding: 22px 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; right: -30px; top: -30px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
}
.hero h2 { margin: 0 0 6px; font-size: 19px; font-weight: 700; }
.hero p { margin: 0 0 14px; font-size: 13px; opacity: 0.92; }
.hero-btn {
  background: #fff; color: var(--accent-dark);
  border: none; border-radius: 999px; padding: 10px 18px;
  font-weight: 600; font-size: 13px; cursor: pointer;
}

/* ---------- category chips ---------- */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; -ms-overflow-style: none; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.service-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; transition: transform .15s ease; }
.service-card:active { transform: scale(0.98); }
.service-card .info { flex: 1; min-width: 0; }
.service-card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.service-card .desc { font-size: 12.5px; color: var(--text-muted); margin: 0 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.service-card .meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 10px; align-items: center; }
.price-tag { font-weight: 700; font-size: 14.5px; color: var(--accent-dark); white-space: nowrap; }
.duration-badge { background: var(--accent-soft); color: var(--accent-dark); border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 600; }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); font-weight: 600; margin: 22px 0 10px; }

/* ---------- staff ---------- */
.staff-grid { display: flex; flex-direction: column; gap: 10px; }
.staff-card { display: flex; align-items: center; gap: 12px; padding: 12px; border: 2px solid var(--border); border-radius: var(--radius-md); cursor: pointer; background: var(--surface); }
.staff-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.staff-card .name { font-weight: 600; font-size: 14.5px; }
.staff-card .title { font-size: 12px; color: var(--text-muted); }
.staff-meta { font-size: 11.5px; color: var(--accent-dark); font-weight: 600; margin-top: 2px; }

/* ---------- date/time picker ---------- */
.date-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; }
.date-pill {
  flex: 0 0 auto; width: 56px; padding: 10px 0; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); text-align: center; cursor: pointer;
}
.date-pill.active { background: var(--text); color: #fff; border-color: var(--text); }
.date-pill .dow { font-size: 10.5px; opacity: .75; display:block; }
.date-pill .dnum { font-size: 16px; font-weight: 700; display:block; margin-top: 2px; }

.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot-btn {
  padding: 10px 4px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; text-align: center;
}
.slot-btn.selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.empty-state { text-align: center; color: var(--text-muted); font-size: 13.5px; padding: 30px 10px; }

/* ---------- stylist profile (booking step 3) ---------- */
.stylist-hero {
  position: relative;
  height: 260px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 14px;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent)) center/cover no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #fff;
}
.stylist-hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,14,12,0) 38%, rgba(20,14,12,0.72) 100%);
  pointer-events: none;
}
.stylist-hero-noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.stylist-hero-initials { font-size: 62px; font-weight: 800; color: rgba(255,255,255,0.55); letter-spacing: 1px; }
.stylist-fav-btn {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.92); border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: var(--text-muted); cursor: pointer;
}
.stylist-fav-btn.active { color: var(--danger); }
.stylist-rating-badge {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  background: rgba(255,255,255,0.92); color: var(--text);
  border-radius: 999px; padding: 6px 12px;
  font-size: 12px; font-weight: 700;
}
.stylist-hero-info { position: relative; z-index: 1; padding: 16px; }
.stylist-hero-name { font-size: 20px; font-weight: 700; line-height: 1.2; }
.stylist-hero-title { font-size: 12.5px; opacity: 0.92; margin-top: 3px; }

.stylist-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.stylist-details-btn {
  flex: 1; height: 44px; border: none; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-dark);
  font-weight: 600; font-size: 13px; cursor: pointer;
}
.stylist-icon-btn {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 16px; cursor: pointer;
}
.stylist-bio {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px 14px; font-size: 13px; color: var(--text-muted); line-height: 1.55;
  margin-bottom: 12px;
}

.stylist-stats {
  display: flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 4px; margin-bottom: 20px;
}
.stylist-stats .stat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; border-right: 1px solid var(--border); }
.stylist-stats .stat:last-child { border-right: none; }
.stylist-stats .stat-icon { font-size: 15px; }
.stylist-stats .stat-val { font-weight: 700; font-size: 14.5px; }
.stylist-stats .stat-label { font-size: 10px; color: var(--text-muted); text-align: center; }

.booking-sheet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.booking-sheet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.month-nav { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.month-nav button {
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg); cursor: pointer; font-size: 13px; line-height: 1; color: var(--text);
}

.time-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; -ms-overflow-style: none; scrollbar-width: none; }
.time-scroll::-webkit-scrollbar { display: none; }
.time-pill {
  flex: 0 0 auto; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); font-size: 13px; font-weight: 600; cursor: pointer;
}
.time-pill.selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-sticky { position: sticky; bottom: 8px; }

/* ---------- forms ---------- */
label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); display: block; margin: 14px 0 6px; }
input, textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); font-size: 14.5px; color: var(--text);
  font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
.btn-primary {
  width: 100%; padding: 14px; border-radius: var(--radius-sm); border: none;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 14.5px;
  cursor: pointer; margin-top: 18px;
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  width: 100%; padding: 13px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer;
}
.link-btn { background: none; border: none; color: var(--accent-dark); font-weight: 600; font-size: 13.5px; cursor: pointer; padding: 4px; }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 10px; }
.success-msg { color: var(--success); font-size: 13px; margin-top: 10px; }

/* ---------- summary box ---------- */
.summary-box { background: var(--surface); border-radius: var(--radius-md); border: 1px solid var(--border); padding: 16px; }
.summary-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 6px 0; }
.summary-row.total { font-weight: 700; font-size: 15px; border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 12px; }
.summary-row .muted { color: var(--text-muted); }

/* ---------- appointment / booking list ---------- */
.appt-card { border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); padding: 14px 16px; margin-bottom: 10px; }
.appt-top { display: flex; justify-content: space-between; align-items: flex-start; }
.appt-service { font-weight: 600; font-size: 14.5px; }
.appt-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.status-badge { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-transform: capitalize; }
.status-confirmed { background: #e6f2ec; color: var(--success); }
.status-completed { background: #eee7fb; color: #6b4fbb; }
.status-cancelled { background: #fbeceb; color: var(--danger); }

/* ---------- loyalty ---------- */
.loyalty-card {
  border-radius: var(--radius-lg); padding: 22px; color: #fff; margin-bottom: 18px;
  background: linear-gradient(135deg, #d8a13a, #a8721f);
  position: relative; overflow: hidden;
}
.loyalty-card.tier-Silver { background: linear-gradient(135deg, #9ea3ab, #6b6f76); }
.loyalty-card.tier-Bronze { background: linear-gradient(135deg, #c98a58, #8a5a34); }
.loyalty-points { font-size: 34px; font-weight: 800; }
.loyalty-tier-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.85; margin-bottom: 4px; }
.loyalty-progress { height: 6px; border-radius: 999px; background: rgba(255,255,255,0.3); margin-top: 14px; overflow: hidden; }
.loyalty-progress-fill { height: 100%; background: #fff; border-radius: 999px; }
.promo-card { display: flex; justify-content: space-between; align-items: center; border: 1px dashed var(--accent); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 10px; background: var(--accent-soft); }
.promo-code { font-weight: 700; letter-spacing: 0.5px; color: var(--accent-dark); }
.promo-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---------- bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; padding: 10px 6px calc(10px + env(safe-area-inset-bottom));
  z-index: 30;
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-muted); font-size: 10.5px; cursor: pointer; background:none; border:none; font-family: inherit; }
.nav-item.active { color: var(--accent-dark); }
.nav-icon { font-size: 20px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-size: 13.5px; z-index: 100; box-shadow: var(--shadow-lift); max-width: 90%; text-align: center;
}

/* ---------- misc ---------- */
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-msg { text-align: center; color: var(--text-muted); padding: 40px 20px; font-size: 13.5px; }
.profile-header { display: flex; flex-direction: column; align-items: center; padding: 18px 0 6px; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; margin-bottom: 10px; }
.profile-name { font-weight: 700; font-size: 17px; }
.profile-contact { font-size: 12.5px; color: var(--text-muted); }
.list-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 14px; cursor: pointer; }
.list-row:last-child { border-bottom: none; }
.list-row .chev { color: var(--text-muted); }

@media (min-width: 481px) and (max-width: 899px) {
  body { background: #ece6e2; }
  #app { box-shadow: 0 0 40px rgba(0,0,0,0.08); min-height: 100vh; }
}

/* ---------- desktop layout: sidebar nav instead of bottom nav ---------- */
@media (min-width: 900px) {
  body { background: #ece6e2; }
  #app {
    max-width: 1120px; min-height: 100vh; padding-bottom: 0; padding-left: 240px;
    box-shadow: 0 0 40px rgba(0,0,0,0.08);
  }
  .bottom-nav {
    left: 0; transform: none; top: 0; bottom: 0; width: 240px; max-width: 240px; height: 100vh;
    flex-direction: column; justify-content: flex-start; align-items: stretch;
    padding: 32px 16px 20px; gap: 4px; border-top: none; border-right: 1px solid var(--border);
  }
  .bottom-nav::before {
    content: "Seoul Hair Salon"; display: block; font-weight: 700; font-size: 14px;
    padding: 0 14px 24px; color: var(--text);
  }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; }
  .nav-item.active { background: var(--accent-soft); }
  .nav-icon { font-size: 18px; }
  .topbar { padding: 32px 44px 8px; }
  .page { padding: 12px 44px 48px; max-width: 860px; }
  h1.page-title { font-size: 26px; }
  #svcList, #homeServices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
  #svcList .service-card, #homeServices .service-card { margin-bottom: 0; }
  .staff-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hero { padding: 30px; }
  .chip-row { overflow: visible; flex-wrap: wrap; }
}
