:root {
  --bg: #ffffff;
  --text: #000000;
  --muted: #737373;
  --soft: #f6f3ef;
  --card: rgba(255, 255, 255, 0.92);
  --line: rgba(0, 0, 0, 0.08);
  --accent: #b87943;
  --accent-soft: rgba(184, 121, 67, 0.12);
  --danger: #b42318;
  --success: #267146;
  --warning: #b76b00;
  --radius: 8px;
  --dock-height: 70px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

#wave-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 1;
}

#app {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.82);
  overflow: hidden;
}

#pages {
  position: relative;
  height: 100%;
  overflow: hidden;
}

.page {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 calc(var(--dock-height) + var(--safe-bottom) + 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  -webkit-overflow-scrolling: touch;
}

.page.active {
  opacity: 1;
  pointer-events: auto;
}

.page::-webkit-scrollbar,
#chat-messages::-webkit-scrollbar,
.booking-shell::-webkit-scrollbar {
  width: 0;
}

.hero {
  min-height: min(390px, 58dvh);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px 22px 26px;
  text-align: center;
}

.hero-logo {
  width: min(180px, 46vw);
  height: auto;
  display: block;
  mix-blend-mode: multiply;
}

.hero-copy {
  display: grid;
  gap: 8px;
  max-width: 340px;
}

.hero h1,
.page-head h2,
.section-head h2,
.step-title,
.booking-info-body h2,
.booking-success h2 {
  margin: 0;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: 0;
}

.hero h1 {
  font-size: 28px;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.hero-action,
.btn-primary,
.btn-secondary,
.btn-danger {
  min-height: 44px;
  border-radius: 999px;
  border: 0;
  padding: 0 18px;
  font-weight: 750;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.hero-action,
.btn-primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 10px 26px rgba(184, 121, 67, 0.22);
}

.btn-primary {
  width: 100%;
}

.btn-primary.compact,
.btn-secondary.compact {
  width: auto;
  min-height: 40px;
  padding: 0 16px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.18);
}

.btn-danger.filled {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.hero-action:active,
.btn-primary:active,
.btn-secondary:active,
.btn-danger:active,
.service-card:active,
.dock-item:active {
  transform: scale(0.98);
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled {
  opacity: 0.42;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.section-head,
.page-head {
  padding: 20px 18px 12px;
}

.page-head h2,
.section-head h2 {
  font-size: 24px;
}

.section-subhead {
  padding: 12px 18px 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 14px 10px;
}

.service-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.045);
}

.service-card-img {
  width: 100%;
  aspect-ratio: 1.28 / 1;
  object-fit: cover;
  display: block;
  background: var(--soft);
}

.service-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.service-card-main {
  display: grid;
  gap: 6px;
}

.service-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.16;
  font-weight: 750;
}

.service-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.service-card-foot {
  display: grid;
  gap: 3px;
}

.service-price {
  font-size: 14px;
  font-weight: 800;
}

.service-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.content-card,
.state-card,
.booking-card,
.summary-card {
  margin: 0 14px 10px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.045);
}

.state-card {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}

.state-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.assistant-page {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  --assistant-composer-height: 74px;
}

.assistant-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.link-action {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  padding: 8px 0;
}

.assistant-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 0 14px 14px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.045);
}

#chat-messages {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 14px calc(var(--assistant-composer-height) + 14px);
  overscroll-behavior: contain;
}

.chat-bubble {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.42;
  word-break: break-word;
}

.chat-bubble.model {
  align-self: flex-start;
  background: var(--soft);
  border-bottom-left-radius: 3px;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #ffffff;
  border-bottom-right-radius: 3px;
}

.chat-message-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.chat-typing {
  color: var(--muted);
  font-size: 12px;
  padding: 4px 2px;
}

.chat-service-card {
  width: min(292px, 100%);
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.chat-service-media {
  width: 92px;
  aspect-ratio: 1.2 / 1;
  object-fit: cover;
  border-radius: 6px;
}

.chat-service-body {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.chat-service-body strong {
  font-size: 13px;
  line-height: 1.2;
}

.chat-service-body small {
  color: var(--muted);
  font-size: 12px;
}

.assistant-composer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 8px;
  padding: 10px 10px calc(10px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
}

.assistant-composer input,
.form-input {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
}

.assistant-composer input {
  flex: 1;
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 16px;
}

.assistant-composer input:focus,
.form-input:focus {
  border-color: rgba(184, 121, 67, 0.42);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--accent);
  color: #ffffff;
}

body.assistant-input-mode #dock {
  transform: translate(-50%, 110%);
  opacity: 0;
  pointer-events: none;
}

body.assistant-input-mode .assistant-page {
  padding-bottom: 0;
}

.booking-card {
  cursor: pointer;
}

.booking-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.booking-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.booking-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.booking-detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.detail-row,
.summary-row,
.summary-total {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
  line-height: 1.35;
}

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

.detail-row strong,
.summary-row strong,
.summary-total strong {
  text-align: right;
}

.booking-comment {
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-badge.pending { background: rgba(183, 107, 0, 0.1); color: var(--warning); }
.status-badge.confirmed { background: rgba(38, 113, 70, 0.1); color: var(--success); }
.status-badge.in_progress { background: var(--accent-soft); color: var(--accent); }
.status-badge.completed { background: rgba(0, 0, 0, 0.05); color: var(--muted); }
.status-badge.cancelled { background: rgba(180, 35, 24, 0.09); color: var(--danger); }

.profile-head {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
}

.profile-head strong {
  font-size: 18px;
  line-height: 1.15;
}

.profile-head span,
.contact-block span {
  color: var(--muted);
  font-size: 12px;
}

.field-block {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.form-input {
  min-height: 44px;
  padding: 10px 12px;
  font-size: 16px;
}

.textarea-input {
  min-height: 150px;
  resize: none;
  line-height: 1.45;
}

.contact-card {
  display: grid;
  gap: 14px;
}

.contact-block {
  display: grid;
  gap: 6px;
}

.contact-block strong {
  font-size: 16px;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.contact-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.contact-actions.two > * {
  flex: 1;
}

.as-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

#dock {
  position: fixed;
  left: 50%;
  bottom: 10px;
  z-index: 100;
  width: min(calc(100% - 20px), 500px);
  height: calc(var(--dock-height) + var(--safe-bottom));
  transform: translateX(-50%);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.dock-inner {
  height: var(--dock-height);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  pointer-events: auto;
}

.dock-item {
  min-width: 0;
  height: 58px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.dock-item svg {
  width: 20px;
  height: 20px;
}

.dock-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

#booking-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  --booking-viewport-height: 100dvh;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(100%);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#booking-overlay.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.booking-shell {
  width: min(100%, 520px);
  height: var(--booking-viewport-height);
  min-height: var(--booking-viewport-height);
  margin: 0 auto;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.94);
}

.booking-step-shell {
  min-height: var(--booking-viewport-height);
  display: flex;
  flex-direction: column;
}

.booking-topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 12px 18px 8px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.booking-back {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  padding: 10px 0;
}

.booking-step {
  flex: 1;
  padding: 8px 14px calc(24px + var(--safe-bottom));
}

.booking-step-animated {
  animation: fadeIn 0.16s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.step-title {
  font-size: 25px;
  margin: 4px 4px 8px;
}

.step-subtitle {
  margin: 0 4px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.booking-info-card {
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.045);
}

.booking-info-img {
  width: 100%;
  aspect-ratio: 1.65 / 1;
  object-fit: cover;
  display: block;
  background: var(--soft);
}

.booking-info-body {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.booking-info-body h2 {
  font-size: 24px;
}

.booking-info-body p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.booking-info-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.booking-info-meta span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.calendar,
.summary-card,
.terms-box,
.time-info,
.fixed-slot-btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.045);
}

.calendar {
  padding: 12px;
}

.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  text-transform: capitalize;
}

.cal-nav {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  color: var(--text);
  font-size: 22px;
}

.cal-weekdays,
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
}

.cal-weekdays {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.cal-days {
  gap: 3px;
}

.cal-day {
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-weight: 650;
}

.cal-day.today {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.cal-day.selected {
  background: var(--accent);
  color: #ffffff;
}

.cal-day.disabled {
  opacity: 0.26;
}

.cal-day.empty {
  pointer-events: none;
}

.fixed-slots-list {
  display: grid;
  gap: 8px;
}

.fixed-slot-btn {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  color: var(--text);
}

.fixed-slot-btn span {
  font-size: 16px;
  font-weight: 800;
}

.fixed-slot-btn small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.fixed-slot-btn.selected {
  background: var(--accent);
  color: #ffffff;
}

.fixed-slot-btn.selected small {
  color: rgba(255, 255, 255, 0.8);
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}

.slot {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
  font-size: 12px;
}

.slot.start,
.slot.end {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.slot.in-range {
  background: var(--accent-soft);
  border-color: rgba(184, 121, 67, 0.24);
}

.slot.taken,
.slot.past,
.fixed-slot-btn:disabled {
  opacity: 0.34;
}

.time-info {
  min-height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  margin-bottom: 10px;
  font-size: 13px;
}

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

.summary-card {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
}

.summary-total {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 16px;
  font-weight: 850;
}

.terms-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.terms-box input {
  margin-top: 2px;
  accent-color: var(--accent);
}

.booking-success {
  min-height: calc(var(--booking-viewport-height) - 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 20px 6px calc(34px + var(--safe-bottom));
}

.success-mark {
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.booking-success h2 {
  font-size: 25px;
}

.booking-success p {
  max-width: 300px;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

#dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

#dialog-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.confirm-card {
  width: min(340px, 100%);
  padding: 20px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.2);
}

.confirm-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.15;
}

.confirm-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.dialog-actions {
  display: flex;
  gap: 8px;
}

.dialog-actions > * {
  flex: 1;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-height) + var(--safe-bottom) + 24px);
  z-index: 500;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--text);
  color: #ffffff;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-50%) translateY(14px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  overflow: hidden;
  text-overflow: ellipsis;
}

#toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

body.booking-open #toast {
  bottom: calc(var(--safe-bottom) + 24px);
}

@media (max-width: 360px) {
  .services-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 25px;
  }
}

@media (min-width: 700px) {
  body {
    background: #faf8f5;
  }

  #app {
    box-shadow: 0 0 0 1px var(--line);
  }
}
