/* ==========================================================================
   AGENDO · App de reservas (cliente)
   ========================================================================== */

.app { min-height: 100dvh; display: flex; flex-direction: column; }
.view { flex: 1; outline: none; padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
.page { width: min(640px, 100%); margin: 0 auto; padding: 8px var(--gutter) 24px; }
.h1 { font-size: var(--step-4); font-weight: 900; margin: 8px 0 6px; }
.h2 { font-size: var(--step-2); font-weight: 800; }
.accent { color: var(--accent-text); }
.fine { font-size: 0.82rem; color: var(--text-2); text-align: center; }
.group-title { font-size: 1.05rem; font-weight: 800; margin: 26px 0 10px; letter-spacing: -0.01em; }
.section-head { margin: 28px 0 12px; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  min-height: 60px; padding: calc(8px + env(safe-area-inset-top)) var(--gutter) 8px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.topbar__logo img { height: 26px; width: auto; }
.topbar__title { flex: 1; font-weight: 700; font-family: var(--font-display); font-size: 1.1rem; }
.topbar__back { margin-left: -10px; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-auto-dark] .logo-light { display: none; }
  :root:not([data-theme="light"])[data-auto-dark] .logo-dark { display: block; }
}
.topbar--over { position: absolute; inset: 0 0 auto; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; color: var(--brand-ink, #F4EFE6); }
.topbar--over .icon-btn { background: rgb(23 20 15 / 0.22); color: #fff; }
.topbar--over .demo-badge { background: rgb(255 255 255 / 0.85); color: #6b4500; }

/* ---------- Barra inferior flotante ---------- */
.tabbar {
  position: fixed; z-index: 30; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 4px; padding: 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--tinta) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px -12px rgb(23 20 15 / 0.45), 0 0 0 1px rgb(255 255 255 / 0.06) inset;
}
.tabbar[hidden] { display: none; }
.tabbar__item {
  display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px; border-radius: 999px;
  color: #A39B8E; text-decoration: none; font-weight: 650; font-size: 0.88rem; white-space: nowrap;
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2);
}
.tabbar__item span { display: none; }
.tabbar__item[aria-current="page"] { background: var(--papel); color: var(--tinta); }
.tabbar__item[aria-current="page"] span { display: inline; }
@media (min-width: 420px) { .tabbar__item span { display: inline; } }

/* ---------- Inicio ---------- */
.hello { padding-top: 12px; }
.hello__title { font-size: clamp(2.1rem, 8.5vw, 3.2rem); font-weight: 900; margin: 8px 0 20px; }
.hello__title em, .done__title em { font-family: var(--font-accent); font-style: italic; font-weight: 500; color: var(--accent-text); letter-spacing: -0.03em; }
.search {
  display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 20px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
  box-shadow: var(--shadow-1); transition: box-shadow var(--dur-2), border-color var(--dur-2);
}
.search:focus-within { border-color: var(--mandarina); box-shadow: 0 0 0 4px rgb(255 90 31 / 0.16); }
.search__input { flex: 1; border: 0; background: none; outline: none; font-size: 1rem; color: var(--text); min-width: 0; }
.cats { display: flex; gap: 8px; overflow-x: auto; margin: 20px calc(var(--gutter) * -1) 0; padding: 2px var(--gutter) 6px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.push-optin {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto 28px; align-items: center; gap: 12px;
  margin: 14px var(--gutter) 4px; padding: 14px; border-radius: 20px; color: var(--papel);
  background: var(--tinta); box-shadow: var(--shadow-2);
}
.push-optin__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 15px; background: var(--mandarina); color: var(--tinta); }
.push-optin__copy strong { display: block; font-family: var(--font-display); font-size: 1rem; }
.push-optin__copy p { margin: 3px 0 0; color: #D8D0C4; font-size: .82rem; line-height: 1.35; }
.push-optin__action { white-space: nowrap; }
.push-optin__dismiss { align-self: start; border: 0; padding: 0; color: #D8D0C4; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.push-test-card { display: grid; justify-items: start; gap: 12px; }
.push-test-card p { margin: 0; }
:root[data-theme="dark"] .push-optin { background: var(--tinta-3); }
@media (max-width: 460px) {
  .push-optin { grid-template-columns: 40px minmax(0, 1fr) 26px; gap: 10px; }
  .push-optin__icon { width: 40px; height: 40px; }
  .push-optin__action { grid-column: 2; justify-self: start; margin-top: 2px; }
  .push-optin__dismiss { grid-column: 3; grid-row: 1; }
}

.next-card {
  display: flex; align-items: center; gap: 14px; margin-top: 20px; padding: 18px 18px 18px 16px; border-radius: var(--r-lg);
  background: var(--tinta); color: var(--papel); text-decoration: none; box-shadow: var(--shadow-2);
  transition: transform var(--dur-2) var(--ease-out);
}
:root[data-theme="dark"] .next-card { background: var(--tinta-3); }
.next-card:active { transform: scale(0.98); }
.next-card__slot { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--mandarina); color: var(--tinta); flex: none; }
.next-card__when { display: block; font-family: var(--font-display); font-size: 1.2rem; }
.next-card__what { display: block; color: #CFC6B8; font-size: 0.9rem; }

.biz-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.stack, .bk-list { min-width: 0; }
.biz-card {
  display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 22px; text-decoration: none;
  background: var(--surface-2); border: 1px solid var(--line);
  transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2), border-color var(--dur-2);
}
.biz-card:hover { box-shadow: var(--shadow-2); border-color: transparent; }
.biz-card:active { transform: scale(0.985); }
.biz-card__name { display: block; font-family: var(--font-display); font-size: 1.12rem; letter-spacing: -0.01em; }
.biz-card__tag { display: block; color: var(--text-2); font-size: 0.9rem; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.biz-card__meta { display: flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 0.8rem; font-weight: 600; color: var(--text-2); }

.mono {
  display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; flex: none; object-fit: cover;
  background: var(--b, var(--tinta)); color: var(--bi, var(--papel)); font: 900 1.25rem/1 var(--font-display); letter-spacing: -0.02em;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.06);
}
.mono--xl { width: 84px; height: 84px; border-radius: 26px; font-size: 1.8rem; box-shadow: 0 10px 30px -10px rgb(0 0 0 / 0.45), inset 0 0 0 2px rgb(255 255 255 / 0.18); }

.owner-cta {
  display: flex; align-items: center; gap: 14px; margin-top: 36px; padding: 18px; border-radius: var(--r-lg); text-decoration: none;
  border: 1.5px dashed var(--line-strong); color: var(--text); font-size: 0.95rem; line-height: 1.35;
  transition: background-color var(--dur-2);
}
.owner-cta:hover { background: var(--surface); }
.owner-cta > span:first-child { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--melocoton); color: var(--teja); flex: none; }

/* ---------- Ficha del negocio ---------- */
.biz-hero {
  position: relative; overflow: hidden; color: var(--brand-ink); background: var(--brand);
  border-radius: 0 0 34px 34px; padding: calc(76px + env(safe-area-inset-top)) var(--gutter) 30px;
}
.biz-hero::before {
  /* motivo de marca: el reloj con un cuarto de hora */
  content: ""; position: absolute; right: -90px; top: -60px; width: 340px; height: 340px; border-radius: 50%;
  border: 54px solid currentColor; opacity: 0.08;
  background: conic-gradient(currentColor 0 25%, transparent 0) content-box; padding: 40px;
}
.biz-hero[style*="--cover"]::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(0 0 0 / 0.25), rgb(0 0 0 / 0.55)), var(--cover) center/cover; z-index: 0; }
.biz-hero[style*="--cover"] { color: #fff; }
.biz-hero__inner { position: relative; z-index: 1; width: min(640px, 100%); margin: 0 auto; }
.biz-hero .mono--xl { background: var(--brand-ink); color: var(--brand); }
.biz-hero__name { font-size: clamp(2.2rem, 9vw, 3.4rem); font-weight: 900; margin: 18px 0 6px; }
.biz-hero__tag { font-size: 1.05rem; opacity: 0.86; }
.biz-hero__meta { margin-top: 14px; }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 99px; background: rgb(0 0 0 / 0.16); font-size: 0.85rem; font-weight: 650; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: 0.6; }
.status.is-open i { background: #7CF0A9; opacity: 1; box-shadow: 0 0 0 4px rgb(124 240 169 / 0.25); animation: pulse 2s var(--ease-out) infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgb(124 240 169 / 0.08); } }

.page--biz { padding-top: 18px; padding-bottom: 120px; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; }
.quick__btn {
  display: grid; justify-items: center; gap: 6px; padding: 12px 6px; border-radius: 18px; text-decoration: none;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 0.78rem; font-weight: 650;
  transition: transform var(--dur-1) var(--ease-out), background-color var(--dur-2);
}
.quick__btn:active { transform: scale(0.95); }
.quick__btn .ico { color: var(--accent-text); }
.tabs { display: flex; width: 100%; margin: 22px 0 4px; }
.tabs button { flex: 1; min-height: 40px; }

.svc-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.svc {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 16px 16px 16px 18px; border-radius: 20px;
  text-decoration: none; background: var(--surface-2); border: 1px solid var(--line);
  transition: border-color var(--dur-2), box-shadow var(--dur-2), transform var(--dur-1) var(--ease-out);
}
.svc:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.svc:active { transform: scale(0.985); }
.svc.is-on { border-color: var(--mandarina); box-shadow: 0 0 0 3px rgb(255 90 31 / 0.15); }
.svc__name { display: block; font-size: 1.02rem; font-weight: 700; letter-spacing: -0.005em; }
.svc__desc { display: block; color: var(--text-2); font-size: 0.88rem; line-height: 1.4; margin-top: 2px; }
.svc__meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 0.86rem; color: var(--text-2); font-weight: 550; }
.svc__meta b { opacity: 0.5; }
.svc__price { color: var(--text); font-weight: 700; }
.svc__cta { flex: none; }

.team { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 18px; }
.team__card { display: grid; justify-items: center; gap: 4px; padding: 20px 12px 16px; border-radius: 22px; text-align: center; text-decoration: none; background: var(--surface-2); border: 1px solid var(--line); }
.team__card .avatar { margin-bottom: 8px; }
.team__card .btn { margin-top: 10px; }

.info__desc { margin-top: 20px; font-size: 1.02rem; }
.hours { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.hours th { text-align: left; font-weight: 550; color: var(--text-2); padding: 9px 0; border-bottom: 1px solid var(--line); }
.hours td { text-align: right; padding: 9px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.hours .is-today th, .hours .is-today td { color: var(--accent-text); font-weight: 750; }

.sticky-cta {
  position: fixed; z-index: 25; left: 0; right: 0; bottom: 0; padding: 18px var(--gutter) calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 40%);
}
.sticky-cta .btn { width: min(600px, 100%); margin: 0 auto; display: flex; }

/* ---------- Flujo de reserva ---------- */
.flow-head { padding-top: 4px; }
.flow-progress { display: flex; gap: 6px; margin-bottom: 18px; }
.flow-progress i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; position: relative; }
.flow-progress i.on::after { content: ""; position: absolute; inset: 0; background: var(--mandarina); animation: grow var(--dur-3) var(--ease-out) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.flow-title { font-size: var(--step-3); font-weight: 900; margin: 6px 0 4px; }
.flow-step { font-size: 0.86rem; font-weight: 600; margin-bottom: 16px; }
.pick-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.pick { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; background: var(--sunken); font-size: 0.84rem; font-weight: 650; }
.pick:not([disabled]):hover { background: var(--line); }
.pick[disabled] { cursor: default; }

.who { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.who__card { display: grid; justify-items: center; gap: 4px; padding: 22px 12px; border-radius: 22px; background: var(--surface-2); border: 1px solid var(--line); text-align: center; transition: border-color var(--dur-2), transform var(--dur-1) var(--ease-out); }
.who__card:hover { border-color: var(--line-strong); }
.who__card:active { transform: scale(0.97); }
.who__card .avatar, .who__any { margin-bottom: 8px; }
.who__any { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--melocoton); color: var(--teja); }

.days {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1); padding: 4px var(--gutter) 10px;
}
.days::-webkit-scrollbar { display: none; }
.day {
  flex: none; scroll-snap-align: center; display: grid; justify-items: center; gap: 1px; width: 62px; padding: 10px 0 9px;
  border-radius: 18px; background: var(--surface-2); border: 1px solid var(--line);
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2), transform var(--dur-1) var(--ease-out);
}
.day:active { transform: scale(0.95); }
.day__wd { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); }
.day__n { font-family: var(--font-display); font-weight: 900; font-size: 1.45rem; line-height: 1.1; }
.day__m { font-size: 0.72rem; color: var(--text-2); }
.day.is-on { background: var(--text); color: var(--bg); border-color: var(--text); }
.day.is-on span { color: inherit; opacity: 0.85; }
.day[disabled] { opacity: 0.38; background: transparent; border-style: dashed; cursor: not-allowed; }

.slots { min-height: 200px; margin-top: 10px; }
.slot-group { display: flex; align-items: baseline; gap: 8px; font-size: 0.95rem; font-weight: 800; margin: 16px 0 10px; }
.slot-group .muted { font-family: var(--font-ui); font-weight: 550; font-size: 0.8rem; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 8px; }
.slot {
  height: 48px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line);
  font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.98rem;
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2), transform var(--dur-1) var(--ease-out), color var(--dur-2);
}
.slot:hover { border-color: var(--mandarina); }
.slot:active { transform: scale(0.94); }
.slot.is-on { background: var(--mandarina); border-color: var(--mandarina); color: var(--tinta); }
.empty--slots { padding: 28px 10px; }

.recap { margin-bottom: 20px; }
.recap__when { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; line-height: 1.15; margin: 6px 0 14px; }
.recap__when .accent { font-size: 2.2rem; font-weight: 900; }
.recap__list { display: grid; gap: 0; }
.recap__list div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 0.95rem; }
.recap__list dt { color: var(--text-2); }
.recap__list dd { font-weight: 650; text-align: right; }

/* ---------- Reserva hecha ---------- */
.done { text-align: center; padding-top: 24px; }
.done__mark { width: 128px; height: 128px; margin: 10px auto 18px; }
.done__mark svg { width: 100%; height: 100%; overflow: visible; }
.done__ring { fill: none; stroke: var(--text); stroke-width: 14; stroke-dasharray: 315; stroke-dashoffset: 315; animation: draw 700ms var(--ease-out) forwards; transform: rotate(-90deg); transform-origin: center; }
.done__wedge { fill: var(--mandarina); transform-origin: 60px 60px; transform: scale(0); animation: pop 520ms var(--ease-spring) 520ms forwards, wedge-out 380ms var(--ease-out) 1300ms forwards; }
.done__check { fill: none; stroke: var(--salvia); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 80; stroke-dashoffset: 80; animation: draw 420ms var(--ease-out) 1450ms forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { to { transform: scale(1); } }
@keyframes wedge-out { to { transform: scale(0); opacity: 0; } }
.done__title { font-size: var(--step-4); font-weight: 900; }
.done__sub { color: var(--text-2); margin: 6px 0 24px; font-size: 1.05rem; }
.done .recap { text-align: left; }
.done__actions { display: grid; gap: 10px; }

/* ---------- Mis citas ---------- */
.bk-list { margin-top: 10px; }
.bk {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 12px; border-radius: 22px; text-decoration: none;
  background: var(--surface-2); border: 1px solid var(--line); transition: box-shadow var(--dur-2);
}
.bk:hover { box-shadow: var(--shadow-1); }
.bk strong { display: block; font-size: 1rem; }
.bk .muted { display: block; font-size: 0.86rem; margin: 2px 0 6px; }
.bk__date { display: grid; justify-items: center; width: 64px; padding: 8px 0; border-radius: 16px; background: var(--brand); color: #fff; flex: none; line-height: 1.1; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.bk__date b { font: 900 1.6rem/1.05 var(--font-display); letter-spacing: -0.02em; }
.bk--past { opacity: 0.72; }
.bk--past .bk__date { background: var(--sunken); color: var(--text-2); }

.ticket { border-radius: var(--r-xl); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); box-shadow: var(--shadow-2); margin-top: 8px; }
.ticket__top { position: relative; padding: 22px 22px 26px; background: var(--brand); color: var(--brand-ink); }
.ticket__biz { margin-top: 10px; font-weight: 700; opacity: 0.85; }
.ticket__top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -9px; height: 18px; background: radial-gradient(circle at 9px 9px, var(--surface-2) 6px, transparent 6.5px) 0 0 / 18px 18px repeat-x; }
.ticket__when { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; }
.ticket__time { font-family: var(--font-display); font-weight: 900; font-size: 3rem; line-height: 1; letter-spacing: -0.03em; }
.ticket__time span { font-size: 1.2rem; opacity: 0.75; font-weight: 700; letter-spacing: 0; }
.ticket__body { padding: 22px; }
.ticket__body .recap__list { margin-top: 12px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.detail-actions .btn { flex: 1 1 140px; }
.cancel-link { width: 100%; margin-top: 14px; color: var(--granada); }

/* Transiciones de vista */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: 180ms var(--ease-out) both vt-out; }
  ::view-transition-new(root) { animation: 320ms var(--ease-out) both vt-in; }
  :root[data-nav="back"]::view-transition-new(root) { animation-name: vt-in-back; }
}
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateX(14px); } }
@keyframes vt-in-back { from { opacity: 0; transform: translateX(-14px); } }

@media (min-width: 720px) {
  .who { grid-template-columns: repeat(3, 1fr); }
  .done__actions { grid-template-columns: 1fr 1fr; }
}
