/* Components from web/js/core/ui.js and web/js/core/slots.js. */

/* ================================================================ buttons */
.btn {
  --btn-h: 44px;
  --btn-px: 20px;
  --btn-fs: 15px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--btn-h);
  padding: 0 var(--btn-px);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--btn-fs);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}
.btn:active:not(:disabled):not(.is-loading) { transform: scale(.975); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-sm { --btn-h: 36px; --btn-px: 14px; --btn-fs: 14px; gap: 6px; }
.btn-lg { --btn-h: 54px; --btn-px: 28px; --btn-fs: 16px; gap: 10px; }
.btn-block { display: flex; width: 100%; }
.btn-icon-only { padding: 0; width: var(--btn-h); }
.btn-label { overflow: hidden; text-overflow: ellipsis; }

.btn-primary {
  background: var(--purple);
  color: var(--cream-light);
  box-shadow: var(--shadow-inset), 0 1px 2px rgba(22, 0, 85, .18), 0 6px 16px -6px rgba(37, 0, 142, .45);
}
.btn-primary:hover { background: var(--purple-hover); color: var(--cream-light); }
.btn-secondary { background: var(--purple-tint); color: var(--purple); }
.btn-secondary:hover { background: var(--purple-soft); color: var(--purple); }
.btn-ghost { background: transparent; color: var(--purple); }
.btn-ghost:hover { background: rgba(37, 0, 142, .06); color: var(--purple); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--purple); color: var(--purple); }
.btn-danger {
  background: var(--danger-strong);
  color: #fff;
  box-shadow: var(--shadow-inset), 0 6px 16px -8px rgba(217, 26, 60, .6);
}
.btn-danger:hover { background: var(--danger-ink); color: #fff; }
.btn-whatsapp {
  background: var(--whatsapp);
  color: var(--whatsapp-ink);
  box-shadow: var(--shadow-inset), 0 6px 16px -8px rgba(18, 140, 74, .6);
}
.btn-whatsapp:hover { background: var(--whatsapp-hover); color: var(--whatsapp-ink); }

.btn-spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  opacity: 0;
  pointer-events: none;
}
.btn.is-loading { cursor: progress; }
.btn.is-loading:disabled { opacity: 1; }
.btn.is-loading > :not(.btn-spinner) { visibility: hidden; }
.btn.is-loading .btn-spinner { opacity: 1; animation: spin .7s linear infinite; }

/* ================================================================ icon buttons */
.icon-btn {
  --ib: 44px;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--ib);
  height: var(--ib);
  border-radius: 50%;
  color: var(--ink);
  text-decoration: none;
  transition: background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}
.icon-btn:active { transform: scale(.94); }
.icon-btn-sm { --ib: 36px; }
.icon-btn-lg { --ib: 52px; }
.icon-btn-ghost:hover { background: rgba(22, 0, 85, .06); }
.icon-btn-secondary { background: var(--purple-tint); color: var(--purple); }
.icon-btn-secondary:hover { background: var(--purple-soft); }
.icon-btn-primary { background: var(--purple); color: var(--cream-light); }
.icon-btn-primary:hover { background: var(--purple-hover); }
.icon-btn-outline { background: var(--surface); border: 1px solid var(--line-strong); }
.icon-btn-danger { background: var(--danger-strong); color: #fff; }
.icon-btn-badge {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--danger-strong);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  box-shadow: 0 0 0 2px var(--surface);
}

/* ================================================================ cards */
.card {
  display: block;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  color: inherit;
  text-decoration: none;
}
.card-pad-none { padding: 0; overflow: hidden; }
.card-pad-sm { padding: var(--s-3) var(--s-4); }
.card-pad-md { padding: var(--s-5); }
.card-pad-lg { padding: var(--s-8); border-radius: var(--radius-lg); }
.card-soft { background: var(--purple-light); border-color: transparent; box-shadow: none; }
.card-cream { background: var(--surface-2); border-color: var(--line-soft); box-shadow: none; }
.card-outline { background: transparent; border-color: var(--line-strong); box-shadow: none; }
.card-dark { background: var(--purple-dark); color: var(--on-dark); border-color: transparent; box-shadow: var(--shadow-2); }
.card-dark h1, .card-dark h2, .card-dark h3, .card-dark h4 { color: var(--on-dark); }
.card-dark .muted { color: var(--on-dark-2); }
.card-gradient { background: var(--grad-soft); border-color: transparent; box-shadow: none; }
.card.is-elevated { box-shadow: var(--shadow-2); }
.card.is-interactive { cursor: pointer; transition: box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease); }
.card.is-interactive:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); border-color: var(--line); }
.card.is-interactive:active { transform: translateY(0); }

/* ================================================================ chips & badges */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  transition: background-color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}
.chip svg { color: var(--purple); }
.chip:hover:not(:disabled) { border-color: var(--purple); background: var(--purple-light); }
.chip:active:not(:disabled) { transform: scale(.97); }
.chip.is-selected { background: var(--purple); border-color: var(--purple); color: var(--cream-light); }
.chip.is-selected svg { color: var(--lavender); }
.chip:disabled { opacity: .45; }
.chip-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--purple-tint);
  color: var(--purple);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.chip.is-selected .chip-count { background: rgba(255, 255, 255, .18); color: var(--cream-light); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-neutral { background: var(--sand); color: var(--ink-2); }
.badge-purple { background: var(--purple-tint); color: var(--purple); }
.badge-green { background: var(--success-tint); color: var(--success-ink); }
.badge-red { background: var(--danger-tint); color: var(--danger-ink); }
.badge-amber { background: var(--warning-tint); color: var(--warning-ink); }
.badge-blue { background: var(--info-tint); color: var(--info-ink); }
.badge-dark { background: var(--purple-dark); color: var(--on-dark); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green .badge-dot { background: var(--green); }
.badge-red .badge-dot { background: var(--red); }
.badge-amber .badge-dot { background: var(--amber); }
.badge-blue .badge-dot { background: var(--blue); }

/* ================================================================ avatar */
.avatar {
  --av: var(--violet);
  --av-size: 40px;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--av-size);
  height: var(--av-size);
  border-radius: 50%;
  overflow: hidden;
  background: color-mix(in srgb, var(--av) 20%, #fff);
  color: color-mix(in srgb, var(--av) 58%, var(--purple-dark));
  font-size: calc(var(--av-size) * .38);
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-ring { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--av); }

/* ================================================================ banner */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
}
.banner-icon { display: grid; place-items: center; flex: none; margin-top: 1px; }
.banner-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.banner-title { font-weight: 600; }
.banner-text { color: inherit; opacity: .9; }
.banner-action { flex: none; align-self: center; }
.banner .icon-btn { margin: -8px -8px -8px 0; color: inherit; }
.banner-info { background: var(--purple-light); color: var(--purple-dark); }
.banner-info .banner-icon { color: var(--purple); }
.banner-neutral { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.banner-success { background: var(--success-tint); color: #004D36; }
.banner-success .banner-icon { color: var(--success-ink); }
.banner-warning { background: var(--warning-tint); color: #5C3700; }
.banner-warning .banner-icon { color: var(--warning-ink); }
.banner-danger { background: var(--danger-tint); color: #8A0A21; }
.banner-danger .banner-icon { color: var(--danger-ink); }

/* ================================================================ form fields */
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
.field-label { font-size: 14px; font-weight: 600; color: var(--ink); display: flex; align-items: baseline; gap: 8px; }
.field-optional { font-weight: 400; font-size: 13px; color: var(--ink-muted); }
.field-hint { font-size: 13px; color: var(--ink-2); }
.field-error { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--danger-ink); }
.field-error[hidden] { display: none; }

.input, .select, .phone-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease);
}
.input, .select { padding: 0 14px; }
.input::placeholder, .phone-num::placeholder { color: var(--ink-muted); opacity: 1; }
.input:hover, .select:hover, .phone-input:hover { border-color: rgba(22, 0, 85, .28); }
.input:focus, .select:focus, .phone-input:focus-within {
  outline: none;
  border-color: var(--purple);
  box-shadow: var(--ring);
}
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--ink-muted); cursor: not-allowed; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .field.has-error .phone-input, .field.has-error .input {
  border-color: var(--red);
  box-shadow: var(--ring-danger);
}
.textarea { padding: 12px 14px; min-height: 96px; line-height: 1.5; resize: vertical; }
.select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23160055' stroke-opacity='.6' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
.input-wrap { position: relative; display: block; }
.input-wrap .input { padding-left: 42px; }
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-muted); pointer-events: none; }

/* ================================================================ toggle */
.toggle { display: inline-flex; align-items: flex-start; gap: 12px; cursor: pointer; min-height: var(--touch); padding: 10px 0; }
.toggle.is-disabled { opacity: .5; cursor: not-allowed; }
.toggle-input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.toggle-track {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: rgba(22, 0, 85, .18);
  transition: background-color var(--dur-2) var(--ease);
}
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(22, 0, 85, .25);
  transition: transform var(--dur-2) var(--ease-out);
}
.toggle-input:checked + .toggle-track { background: var(--purple); }
.toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle-input:focus-visible + .toggle-track { outline: var(--focus); outline-offset: 2px; }
.toggle-text { display: grid; gap: 2px; padding-top: 2px; }
.toggle-label { font-weight: 500; line-height: 1.3; }
.toggle-hint { font-size: 13px; color: var(--ink-2); }

/* ================================================================ segmented & tabs */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: rgba(22, 0, 85, .06);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.segmented-item:hover { color: var(--ink); }
.segmented-item.is-selected { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(22, 0, 85, .08), 0 2px 6px rgba(22, 0, 85, .06); }
.segmented-item:focus-visible { outline-offset: 0; }
.segmented-sm { padding: 3px; }
.segmented-sm .segmented-item { min-height: 30px; padding: 0 12px; font-size: 13px; }
.segmented-item-count { font-size: 12px; color: var(--ink-muted); }

.lang-toggle .segmented-item { min-width: 40px; padding: 0 10px; letter-spacing: .02em; }
.lang-toggle-dark { background: rgba(255, 255, 255, .08); }
.lang-toggle-dark .segmented-item { color: var(--on-dark-2); }
.lang-toggle-dark .segmented-item.is-selected { background: var(--on-dark); color: var(--purple-dark); }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: color var(--dur-2) var(--ease);
}
.tab::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--purple);
  transform: scaleX(0);
  transition: transform var(--dur-2) var(--ease-out);
}
.tab:hover { color: var(--ink); }
.tab.is-selected { color: var(--purple); }
.tab.is-selected::after { transform: scaleX(1); }
.tab-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--purple-tint);
  color: var(--purple);
  font-size: 12px;
  line-height: 20px;
  text-align: center;
}

/* ================================================================ loading states */
.spinner {
  --spinner-size: 20px;
  display: inline-block;
  width: var(--spinner-size);
  height: var(--spinner-size);
  border-radius: 50%;
  border: 2.5px solid var(--purple-soft);
  border-top-color: var(--purple);
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  display: block;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(22, 0, 85, .06) 0%, rgba(22, 0, 85, .11) 40%, rgba(22, 0, 85, .06) 80%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-circle { border-radius: 50%; }
.skeleton-lines { display: grid; gap: 10px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.loader { min-width: 0; }

/* ================================================================ empty & error */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: var(--s-10) var(--s-6);
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--purple-light);
  color: var(--purple);
  box-shadow: 0 0 0 8px rgba(247, 240, 253, .55);
}
.empty-title { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 600; letter-spacing: var(--track-tight); }
.empty-text { max-width: 38ch; color: var(--ink-2); font-size: 14px; }
.empty-action { margin-top: 12px; }
.empty-compact { padding: var(--s-6) var(--s-4); }
.empty-compact .empty-icon { width: 48px; height: 48px; box-shadow: none; margin-bottom: 4px; }

.error-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid rgba(255, 57, 86, .22);
  box-shadow: var(--shadow-1);
}
.error-box-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--danger-tint);
  color: var(--danger-ink);
}
.error-box-body { flex: 1 1 180px; min-width: 0; }
.error-box > .btn { margin-left: auto; }
.error-box-title { font-weight: 600; }
.error-box-text { font-size: 14px; color: var(--ink-2); }

/* ================================================================ stat */
.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--s-5);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.stat-top { display: flex; align-items: center; gap: 8px; }
.stat-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--purple-light);
  color: var(--purple);
}
.stat-label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 32px);
  font-weight: 500;
  letter-spacing: var(--track-display);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.stat-hint { font-size: 13px; color: var(--ink-2); }
.stat-green .stat-icon { background: var(--success-tint); color: var(--success-ink); }
.stat-red .stat-icon { background: var(--danger-tint); color: var(--danger-ink); }
.stat-amber .stat-icon { background: var(--warning-tint); color: var(--warning-ink); }

/* ================================================================ section */
.section { display: grid; gap: var(--s-4); min-width: 0; }
.section + .section { margin-top: var(--s-8); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.section-titles { display: grid; gap: 4px; min-width: 0; }
.section-title { font-size: var(--fs-lg); letter-spacing: var(--track-tight); }
.section-sub { color: var(--ink-2); font-size: 14px; }
.section-action { display: flex; gap: 8px; align-items: center; }
.section-body { min-width: 0; }

/* ================================================================ countdown */
.countdown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: .01em;
}
.countdown.is-warn { color: var(--danger-ink); }
.countdown.is-done { color: var(--ink-muted); }

/* ================================================================ sheet / modal */
.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 0, 85, .36);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity var(--dur-3) var(--ease);
}
.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100dvh - 40px);
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-3);
  transform: translateY(100%);
  transition: transform var(--dur-3) var(--ease-out);
  outline: none;
  padding-bottom: var(--safe-bottom);
}
.sheet.is-dragging { transition: none; }
.sheet-layer.is-open .sheet-backdrop { opacity: 1; }
.sheet-layer.is-open .sheet { transform: translateY(0); }
.sheet-layer.is-closing .sheet { transform: translateY(100%); transition-duration: var(--dur-2); transition-timing-function: var(--ease); }
.sheet-head { flex: none; touch-action: none; padding: 8px 12px 0 24px; }
.sheet-grip { width: 40px; height: 5px; margin: 0 auto 6px; border-radius: 3px; background: rgba(22, 0, 85, .16); }
.sheet-header { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.sheet-title { flex: 1; min-width: 0; font-size: var(--fs-lg); letter-spacing: var(--track-tight); line-height: 1.25; padding: 6px 0; }
.sheet-head.no-title .sheet-header { justify-content: flex-end; min-height: 40px; }
.sheet-head.no-title .sheet-title { display: none; }
.sheet-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 8px 24px 24px; }
.sheet-footer {
  flex: none;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap-reverse;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
}
@media (max-width: 719px) {
  .sheet-footer .btn { flex: 1 1 140px; }
}
@media (min-width: 720px) {
  .sheet-layer { align-items: center; padding: 32px; }
  .sheet {
    max-width: 560px;
    max-height: min(820px, calc(100dvh - 64px));
    border-radius: var(--radius-lg);
    padding-bottom: 0;
    transform: translateY(12px) scale(.97);
    opacity: 0;
    transition: transform var(--dur-3) var(--ease-out), opacity var(--dur-2) var(--ease);
  }
  .sheet-layer.is-open .sheet { transform: none; opacity: 1; }
  .sheet-layer.is-closing .sheet { transform: translateY(8px) scale(.98); opacity: 0; }
  .sheet-sm { max-width: 420px; }
  .sheet-lg { max-width: 760px; }
  .sheet-xl { max-width: 1040px; }
  .sheet-grip { display: none; }
  .sheet-head { padding: 16px 16px 0 28px; }
  .sheet-body { padding: 8px 28px 28px; }
  .sheet-footer { padding: 16px 28px 20px; }
}
.sheet-confirm .sheet-body { padding-bottom: 8px; }
.confirm-text { color: var(--ink-2); }
.sheet-confirm .sheet-footer { border-top: 0; }

/* ================================================================ toast */
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom) + var(--toast-offset, 0px));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(calc(100vw - 32px), 460px);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  min-height: 48px;
  padding: 10px 10px 10px 18px;
  border-radius: var(--radius-md);
  background: var(--purple-dark);
  color: var(--on-dark);
  font-size: 14.5px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(22, 0, 85, .28);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(12px) scale(.98);
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-3) var(--ease-out);
}
.toast.is-in { opacity: 1; transform: none; }
.toast.is-out { opacity: 0; transform: translateY(6px); }
.toast-icon { display: grid; place-items: center; flex: none; }
.toast-msg { flex: 1; min-width: 0; padding-right: 8px; }
.toast-success .toast-icon { color: #5BE3B4; }
.toast-danger .toast-icon { color: #FF8A9C; }
.toast-warning .toast-icon { color: #FFC857; }
.toast-info .toast-icon { color: var(--lavender); }
.toast-action {
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  color: var(--lavender);
  font-weight: 600;
}
.toast-action:hover { background: rgba(255, 255, 255, .08); }

/* ================================================================ menu */
.menu { position: relative; display: inline-flex; }
.menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  z-index: var(--z-menu);
  min-width: 220px;
  max-width: min(320px, calc(100vw - 24px));
  padding: 6px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-3);
  animation: menu-in var(--dur-2) var(--ease-out);
  transform-origin: top right;
}
.menu-end { right: 0; }
.menu-start { left: 0; transform-origin: top left; }
.menu-pop.menu-up { top: auto; bottom: calc(100% + 6px); transform-origin: bottom right; }
@keyframes menu-in { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
}
.menu-item svg { color: var(--ink-2); }
.menu-item:hover, .menu-item:focus-visible { background: var(--purple-light); outline: none; color: var(--ink); }
.menu-item:disabled { opacity: .45; }
.menu-item.is-danger, .menu-item.is-danger svg { color: var(--danger-ink); }
.menu-item.is-danger:hover { background: var(--danger-tint); }
.menu-label { flex: 1; min-width: 0; }
.menu-check { color: var(--purple) !important; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.menu-header { display: grid; gap: 1px; padding: 8px 12px 6px; }
.menu-header strong { font-size: 14.5px; }
.menu-header span { font-size: 13px; color: var(--ink-2); }

/* ================================================================ phone input */
.phone-input { display: flex; align-items: stretch; overflow: hidden; }
.phone-cc {
  position: relative;
  display: flex;
  align-items: center;
  flex: none;
  padding: 0 10px 0 14px;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
}
.phone-cc-label { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; color: var(--ink); }
.phone-cc-label svg { color: var(--ink-muted); }
.phone-flag { flex: none; border-radius: 3px; box-shadow: 0 0 0 1px rgba(22, 0, 85, .12); }
.phone-cc-select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.phone-num {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0 14px;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}
.phone-num:focus { outline: none; }
.phone-input.is-disabled { opacity: .6; }

/* ================================================================ otp */
.otp { display: flex; gap: 8px; justify-content: center; min-width: 0; }
.otp-box {
  flex: 1 1 0;
  width: 0;
  min-width: 36px;
  max-width: 52px;
  height: 58px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  text-align: center;
  font-variant-numeric: tabular-nums;
  caret-color: var(--purple);
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease);
}
.otp:has(> .otp-box:nth-child(6):last-child) .otp-box:nth-child(3) { margin-right: 8px; }
.otp-box:focus { outline: none; border-color: var(--purple); box-shadow: var(--ring); }
.otp-box.is-filled { border-color: rgba(37, 0, 142, .35); background: var(--purple-light); }
.otp.is-error .otp-box { border-color: var(--red); box-shadow: var(--ring-danger); background: var(--surface); }
.otp.is-error { animation: shake .4s var(--ease); }
@keyframes shake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

/* ================================================================ slots: Smart Three */
/* SmartThree measures itself (ResizeObserver) and adds .is-wide at ≥ 600px: three columns. */
.smart-three { min-width: 0; }
.st-list { display: grid; gap: 12px; }
.st-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "reason" "when" "doc";
  gap: 10px;
  width: 100%;
  padding: 16px 18px;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1), 0 0 0 1px var(--line-soft);
  text-align: left;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease);
}
.st-card:hover { box-shadow: var(--shadow-2); border-color: var(--lavender); transform: translateY(-1px); }
.st-card:active { transform: scale(.99); }
.st-card[aria-pressed="true"] { border-color: var(--purple); background: #FCFAFF; box-shadow: 0 0 0 3px rgba(37, 0, 142, .10), var(--shadow-1); }
.st-reason {
  grid-area: reason;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--purple-tint);
  color: var(--purple);
  font-size: 12.5px;
  font-weight: 600;
}
.st-soonest .st-reason { background: var(--purple); color: var(--cream-light); }
.st-when { grid-area: when; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; min-width: 0; }
.st-time {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.st-time .ampm, .time-pill .ampm { font-size: .55em; letter-spacing: 0; margin-left: .18em; font-weight: 500; color: var(--ink-2); }
.st-day { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.st-doc { grid-area: doc; display: flex; align-items: center; gap: 8px; min-width: 0; padding-right: 32px; }
.st-doc-name { font-size: 13px; font-weight: 500; color: var(--ink); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-check {
  position: absolute;
  right: 16px;
  bottom: 18px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  opacity: 0;
  transform: scale(.6);
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-out);
}
.st-card[aria-pressed="true"] .st-check { opacity: 1; transform: none; }
.smart-three.is-wide .st-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.smart-three.is-wide .st-card { align-content: start; gap: 14px; padding: 18px; }
.smart-three.is-wide .st-when { display: grid; gap: 2px; }
.smart-three.is-wide .st-doc { width: 100%; padding: 12px 0 0; border-top: 1px solid var(--line-soft); }
.smart-three.is-wide .st-check { top: 14px; bottom: auto; right: 14px; }
.smart-three.is-wide .st-time { font-size: 38px; }

/* ================================================================ slots: time pills */
.time-pills { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.time-pill {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  min-height: 44px;
  padding: 12px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  transition: background-color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}
.time-pill:hover { border-color: var(--purple); background: var(--purple-light); }
.time-pill:active { transform: scale(.96); }
.time-pill[aria-pressed="true"] { background: var(--purple); border-color: var(--purple); color: var(--cream-light); }
.time-pill[aria-pressed="true"] .ampm { color: var(--lavender); }
.time-pill-more { border-style: dashed; color: var(--purple); font-weight: 600; }
.slots-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  color: var(--ink-2);
  font-size: 14px;
}
.slots-empty-inline { padding: 10px 14px; }

/* ================================================================ slots: date strip */
.date-strip { position: relative; display: flex; align-items: center; gap: 4px; min-width: 0; }
.ds-scroller {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 4px 4px 16px;
  margin-bottom: -10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}
.ds-scroller::-webkit-scrollbar { display: none; }
.ds-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
  gap: 1px;
  width: 62px;
  padding: 9px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  scroll-snap-align: center;
  transition: background-color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}
.ds-day:hover:not(:disabled) { border-color: var(--purple); background: var(--purple-light); }
.ds-day:active:not(:disabled) { transform: scale(.96); }
.ds-wd { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: capitalize; }
.ds-num { font-family: var(--font-display); font-size: 22px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ds-mon { font-size: 11px; color: var(--ink-muted); text-transform: lowercase; }
.ds-dot { width: 6px; height: 6px; margin-top: 3px; border-radius: 50%; background: var(--green); }
.ds-dot-none { background: transparent; }
.ds-count { margin-top: 2px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--success-tint); color: var(--success-ink); font-size: 11px; font-weight: 700; line-height: 16px; }
.ds-day.is-today .ds-wd { color: var(--purple); }
.ds-day[aria-pressed="true"] { background: var(--purple); border-color: var(--purple); color: var(--cream-light); box-shadow: 0 8px 18px -8px rgba(37, 0, 142, .55); }
.ds-day[aria-pressed="true"] .ds-wd, .ds-day[aria-pressed="true"] .ds-mon { color: rgba(251, 249, 247, .78); }
.ds-day[aria-pressed="true"] .ds-dot:not(.ds-dot-none) { background: #5BE3B4; }
.ds-day:disabled { opacity: .42; cursor: not-allowed; border-style: dashed; background: transparent; }
.ds-nav {
  display: none;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  transition: opacity var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease);
}
.ds-nav:hover:not(:disabled) { background: var(--purple-light); border-color: var(--purple); }
.ds-nav:disabled { opacity: .3; }
@media (hover: hover) and (min-width: 720px) { .ds-nav { display: grid; } }

/* ================================================================ slots: doctor row */
.doctor-row { display: grid; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.doctor-row:last-child { border-bottom: 0; }
.dr-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dr-info { flex: 1; min-width: 0; }
.dr-name { font-weight: 600; font-size: 15.5px; line-height: 1.3; }
.dr-spec { font-size: 13px; color: var(--ink-2); }
.dr-count { flex: none; font-size: 12.5px; font-weight: 600; color: var(--success-ink); background: var(--success-tint); padding: 3px 9px; border-radius: var(--radius-pill); }
