:root {
  --bg: #111318;
  --panel: #181b22;
  --panel-2: #20242d;
  --text: #ffffff;
  --muted: rgba(255,255,255,.64);
  --soft: rgba(255,255,255,.1);
  --line: rgba(255,255,255,.12);
  --accent: #1f5bff;
  --accent-2: #5d85ff;
  --danger: #ff4d63;
  --success: #35d07f;
  --warning: #ffb340;
  --radius: 18px;
  --dock-h: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(31,91,255,.18), transparent 32%),
    var(--bg);
  font-family: Manrope, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

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

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

#app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: rgba(17,19,24,.98);
}

#pages {
  position: relative;
  flex: 1;
  overflow: hidden;
}

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

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

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

.page-content {
  padding: calc(18px + var(--safe-top)) 16px 0;
}

.page-heading {
  margin: 0 0 14px;
  font-size: 26px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.loading {
  display: grid;
  place-items: center;
  padding: 36px 0;
}

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

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

.hero {
  position: relative;
  min-height: min(72vh, 620px);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  isolation: isolate;
}

#wave-grid,
.hero-media,
.hero-shade {
  position: absolute;
  inset: 0;
}

#wave-grid {
  z-index: 3;
  opacity: .9;
  pointer-events: none;
}

.hero-media {
  z-index: 1;
}

.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: .78;
}

.hero-shade {
  z-index: 2;
  background: linear-gradient(180deg, rgba(17,19,24,.18) 0%, rgba(17,19,24,.45) 45%, rgba(17,19,24,.98) 100%);
}

.hero-content {
  position: relative;
  z-index: 4;
  width: 100%;
  padding: calc(28px + var(--safe-top)) 18px 26px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.hero-logo {
  width: 116px;
  height: 116px;
  object-fit: cover;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 18px 50px rgba(0,0,0,.38);
}

.hero-meta {
  max-width: 280px;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
  color: rgba(255,255,255,.84);
}

.hero-action,
.btn-primary,
.btn-secondary,
.btn-danger,
.text-btn,
.icon-btn {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hero-action,
.btn-primary {
  min-height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(31,91,255,.32);
}

.btn-secondary {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-weight: 800;
}

.btn-secondary.small {
  min-height: 34px;
  padding: 0 13px;
  font-size: 13px;
}

.btn-danger {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 999px;
  background: rgba(255,77,99,.16);
  color: #ff8595;
  font-weight: 800;
}

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

.text-btn {
  min-height: 34px;
  padding: 0;
  background: none;
  color: var(--muted);
  font-weight: 800;
}

.icon-btn {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.service-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease;
}

.service-card:active {
  transform: scale(.985);
  border-color: rgba(31,91,255,.45);
}

.service-media {
  aspect-ratio: 16 / 9;
  background: #0d0f13;
}

.service-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.service-body {
  min-height: 96px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.service-body h2 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: 0;
}

.service-category {
  display: inline-flex;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(31,91,255,.14);
  color: #a9bdff;
  font-size: 12px;
  font-weight: 800;
}

.service-price {
  flex: 0 0 auto;
  max-width: 118px;
  text-align: right;
  color: #fff;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 800;
}

.assistant-page {
  overflow: hidden;
}

.assistant-content {
  height: calc(100vh - var(--dock-h) - var(--safe-bottom));
  height: calc(100dvh - var(--dock-h) - var(--safe-bottom));
  display: flex;
  flex-direction: column;
}

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

.assistant-shell {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24,27,34,.86);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble {
  width: fit-content;
  max-width: min(88%, 390px);
  padding: 11px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
}

.chat-bubble.model {
  align-self: flex-start;
  background: rgba(255,255,255,.09);
  color: rgba(255,255,255,.9);
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}

.chat-typing {
  align-self: flex-start;
  color: var(--muted);
  padding: 8px 4px;
}

.assistant-composer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.assistant-composer input {
  min-width: 0;
  flex: 1;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  padding: 0 14px;
  background: rgba(255,255,255,.08);
  color: #fff;
}

.assistant-composer input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: rgba(255,255,255,.38);
}

.chat-service-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  max-width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.07);
}

.chat-service-card img {
  width: 86px;
  height: 86px;
  border-radius: 12px;
  object-fit: cover;
}

.chat-service-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

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

.chat-service-body span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.info-card,
.summary-card,
.state-card,
.history-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24,27,34,.92);
}

.info-card,
.summary-card,
.state-card {
  padding: 16px;
}

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

.state-card.compact {
  min-height: 130px;
}

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

.info-row,
.summary-row,
.detail-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.info-row:first-child,
.summary-row:first-child,
.detail-row:first-child {
  padding-top: 0;
}

.info-row:last-child,
.summary-row:last-child,
.detail-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.info-row span,
.summary-row span,
.detail-row span {
  color: var(--muted);
  font-size: 13px;
}

.info-row strong,
.summary-row strong,
.detail-row strong {
  max-width: 62%;
  text-align: right;
  font-size: 14px;
  line-height: 1.35;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.action-card {
  width: 100%;
  min-height: 70px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.action-card span {
  color: var(--muted);
  font-size: 13px;
}

.action-card strong {
  color: #fff;
  font-size: 15px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.field:last-child {
  margin-bottom: 0;
}

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

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: rgba(255,255,255,.08);
  color: #fff;
  padding: 12px;
}

.field input,
.field select {
  height: 46px;
}

.field textarea {
  resize: vertical;
  min-height: 128px;
}

.profile-id {
  margin-bottom: 14px;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  margin-bottom: 12px;
}

.filter-row::-webkit-scrollbar { display: none; }

.filter-chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.filter-chip.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.history-card {
  padding: 14px;
  margin-bottom: 10px;
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.history-card h2 {
  margin: 9px 0 8px;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 800;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-meta span {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.76);
}

.status-badge.pending { background: rgba(255,179,64,.14); color: #ffd08a; }
.status-badge.confirmed,
.status-badge.completed { background: rgba(53,208,127,.14); color: #8df0ba; }
.status-badge.in_progress { background: rgba(31,91,255,.2); color: #b8c8ff; }
.status-badge.cancelled { background: rgba(255,77,99,.14); color: #ff9aa7; }

.card-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-row.stack-row {
  flex-direction: column;
  gap: 5px;
}

.detail-row.stack-row strong {
  max-width: none;
  text-align: left;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

#dock {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 12px calc(10px + var(--safe-bottom));
  pointer-events: none;
}

.dock-inner {
  max-width: 520px;
  min-height: var(--dock-h);
  margin: 0 auto;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 24px;
  background: rgba(24,27,34,.9);
  box-shadow: 0 18px 48px rgba(0,0,0,.38);
  backdrop-filter: blur(18px);
  pointer-events: auto;
}

.dock-item {
  min-width: 0;
  height: 54px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: rgba(255,255,255,.54);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
}

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

.dock-item.active {
  background: rgba(31,91,255,.18);
  color: #fff;
}

#booking-overlay {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: none;
  background: var(--bg);
}

#booking-overlay.active {
  display: block;
}

.booking-shell {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: calc(12px + var(--safe-top)) 16px calc(22px + var(--safe-bottom));
}

.booking-topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-start;
  padding: 2px 0 12px;
  background: var(--bg);
}

.booking-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.booking-title {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
  font-weight: 800;
}

.booking-subtitle {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.booking-info-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
}

.booking-info-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.booking-info-body {
  padding: 16px;
}

.booking-info-body h1 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
}

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

.booking-price {
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.calendar {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--panel);
}

.cal-header {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.cal-header strong {
  text-align: center;
  font-size: 15px;
}

.cal-nav {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.07);
  font-size: 22px;
}

.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-weekdays {
  margin-bottom: 6px;
}

.cal-weekdays span {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.cal-day,
.cal-empty {
  aspect-ratio: 1;
}

.cal-day {
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255,255,255,.07);
  font-weight: 800;
}

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

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

.pick-grid,
.time-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pick-card,
.time-slot {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.07);
}

.pick-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 11px 12px;
}

.pick-card strong {
  font-size: 15px;
}

.pick-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pick-card:disabled,
.time-slot:disabled {
  opacity: .35;
}

.time-slot {
  font-weight: 800;
}

.time-slot.start,
.time-slot.end,
.time-slot.in-range {
  background: rgba(31,91,255,.22);
  border-color: rgba(31,91,255,.7);
}

.time-slot.taken {
  background: rgba(255,255,255,.04);
}

.selection-summary {
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.07);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.selection-summary strong {
  color: #fff;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
  margin-top: 3px;
  border-top: 1px solid var(--line);
}

.summary-total span {
  color: var(--muted);
  font-weight: 800;
}

.summary-total strong {
  font-size: 18px;
}

.terms-box {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.8);
  font-size: 13px;
  line-height: 1.45;
}

.terms-box input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.booking-success {
  min-height: calc(100dvh - 120px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.success-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: var(--accent);
  font-family: "Russo One", Manrope, sans-serif;
  font-size: 26px;
  box-shadow: 0 16px 42px rgba(31,91,255,.32);
}

.booking-success h1 {
  margin: 0;
  font-size: 25px;
}

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

#dialog-overlay {
  position: absolute;
  z-index: 60;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(16px + var(--safe-bottom));
  background: rgba(0,0,0,.62);
}

#dialog-overlay.active {
  display: flex;
}

.dialog-card {
  width: min(100%, 420px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 20px 58px rgba(0,0,0,.46);
}

.dialog-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

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

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#toast {
  position: absolute;
  z-index: 80;
  left: 50%;
  bottom: calc(var(--dock-h) + var(--safe-bottom) + 20px);
  max-width: min(420px, calc(100% - 32px));
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  padding: 11px 14px;
  border-radius: 999px;
  background: #fff;
  color: #111318;
  font-size: 13px;
  font-weight: 800;
  transition: opacity .18s ease, transform .18s ease;
}

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

@media (min-width: 480px) {
  .services-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .service-body {
    min-height: 116px;
    flex-direction: column;
  }

  .service-price {
    max-width: none;
    text-align: left;
  }

  .hero {
    border-radius: 0 0 28px 28px;
  }
}
