/* Componentes compartilhados: painel lateral, formulários, listas de escolha */

/* ---------- Cabeçalho da página com ações ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head-text { min-width: 0; }
.page-actions { display: flex; gap: 8px; }

/* ---------- Botões extras ---------- */
.btn--lg { height: 48px; font-size: 15.5px; border-radius: 12px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.icon-only {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}
.icon-only:hover { background: var(--hover); color: var(--ink); }
.icon-only .ico { width: 17px; height: 17px; }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--brand-strong);
}
.link-btn .ico { width: 15px; height: 15px; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

.toast { display: flex; align-items: center; gap: 14px; z-index: 90; width: max-content; max-width: calc(100vw - 32px); }
.toast.is-show { pointer-events: auto; }
.toast-action {
  font-size: 14px; font-weight: 700; color: #C9C2FF;
  padding: 4px 2px; white-space: nowrap;
}
.toast-action:hover { color: #fff; }

/* ---------- Janela (no centro no computador, folha no celular) ---------- */
body.has-drawer { overflow: hidden; }
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(17, 19, 24, .34);
  backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .2s ease;
}
.drawer-backdrop.is-open { opacity: 1; }
.drawer {
  position: fixed; top: 50%; left: 50%; z-index: 80;
  width: min(520px, calc(100vw - 48px));
  max-height: min(820px, calc(100vh - 64px));
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 24px 64px -12px rgba(17, 19, 24, .32), 0 0 0 1px rgba(17, 19, 24, .04);
  opacity: 0;
  transform: translate(-50%, -48%) scale(.98);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .18s ease;
  outline: none;
}
.drawer.is-open { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.drawer--tall { height: min(720px, calc(100vh - 64px)); }
.drawer-handle { display: none; }
.drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 14px;
}
.drawer-back {
  display: grid; place-items: center; flex: none;
  width: 34px; height: 34px; margin-left: -6px; border-radius: var(--radius);
  color: var(--ink-2);
}
.drawer-back:hover { background: var(--hover); }
.drawer-back[hidden] { display: none; }
.drawer-back .ico { width: 20px; height: 20px; }
.drawer-titles { flex: 1; min-width: 0; }
.drawer-kicker { display: block; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-title { margin: 1px 0 0; font-size: 20px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
.drawer-progress { height: 3px; margin: 0 20px; border-radius: 99px; background: #EDEEF2; overflow: hidden; flex: none; }
.drawer-progress[hidden] { display: none; }
.drawer-progress i { display: block; height: 100%; background: var(--brand); border-radius: inherit; transition: width .25s ease; }
.drawer-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 20px 22px;
  display: flex; flex-direction: column; gap: 14px;
}
.drawer-foot {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  border-radius: 0 0 20px 20px;
}
.drawer-foot[hidden] { display: none; }

/* ---------- Menu flutuante ---------- */
.menu {
  position: fixed; z-index: 95; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 40px -10px rgba(17, 19, 24, .28);
  animation: menu-in .12s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu-title { padding: 8px 10px 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 38px; padding: 0 10px; border-radius: 9px;
  font-size: 14px; font-weight: 500; text-align: left; color: var(--ink);
}
.menu-item .ico { width: 17px; height: 17px; color: var(--ink-2); }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item--danger, .menu-item--danger .ico { color: #B42318; }
.menu-item--danger:hover { background: #FEF3F2; }
.menu-sep { height: 1px; margin: 5px 4px; background: var(--line); }

/* ---------- Seletor de opções (Dia | Semana, abas) ---------- */
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: #EEEFF2; }
.seg button {
  height: 32px; padding: 0 16px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--ink-2);
}
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(17,19,24,.1); }

/* ---------- Formulários ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.field > span em { font-style: normal; font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input {
  width: 100%; height: 46px; padding: 0 14px;
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 12px;
  transition: border-color .12s ease, box-shadow .12s ease;
  -webkit-appearance: none; appearance: none;
}
textarea.input { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.45; }
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239A9A93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
.input::placeholder { color: #AEB2BA; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hint { margin: 0; font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.hint .ico { width: 15px; height: 15px; }
.hint--ok { color: #15803D; }
.notice {
  margin: 0; padding: 10px 12px; border-radius: var(--radius);
  font-size: 13.5px; color: #8A4B08;
  background: #FFF6E8; border: 1px solid #F8E0BA;
}
.empty-note { margin: 4px 0; font-size: 14px; color: var(--ink-3); }
.list-label { margin: 6px 0 -4px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }

.search { position: relative; display: block; }
.search > .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.input--search { padding-left: 42px; }

/* Interruptor */
.toggle-row { display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 500; }
.switch {
  position: relative; width: 46px; height: 28px; border-radius: 99px; flex: none;
  background: #D7DAE0; transition: background .15s ease;
}
.switch i {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s ease;
}
.switch[aria-checked="true"] { background: var(--brand); }
.switch[aria-checked="true"] i { transform: translateX(18px); }

/* Fichas de escolha (motivo, profissional) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 99px;
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line-strong);
}
.pchip i { width: 8px; height: 8px; border-radius: 50%; }
.pchip:hover { background: var(--hover); }
.pchip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Listas de escolha (cliente, serviço, profissional) ---------- */
.pick-list { display: flex; flex-direction: column; gap: 8px; }
.pick {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 60px; padding: 10px 14px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  transition: border-color .12s ease, background .12s ease;
}
.pick:hover { border-color: var(--line-strong); background: #FAFBFC; }
.pick:active { background: var(--hover); }
.pick.is-selected { border-color: var(--brand); background: var(--brand-soft); }
.pick-main { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.pick-main strong { font-size: 15.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-main span { font-size: 13.5px; color: var(--ink-3); }
.pick-price { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pick-chev { width: 16px; height: 16px; color: var(--ink-3); }
.pick-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: #F0F1F4; color: var(--ink-2); font-size: 13px; font-weight: 600;
}
.pick-ico {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-strong);
}
.pick-ico .ico { width: 18px; height: 18px; }
.pick--new { border-style: dashed; border-color: var(--brand-line); }
.pick--new strong { color: var(--brand-strong); }

/* ---------- Dias e horários ---------- */
.daychips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -20px; padding: 2px 20px 4px;
  scroll-snap-type: x proximity; scroll-padding-inline: 20px;
}
.daychips::-webkit-scrollbar { display: none; }
.daychip {
  flex: none; width: 64px; padding: 8px 0 9px; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
}
.daychip span { font-size: 12px; color: var(--ink-3); text-transform: capitalize; }
.daychip strong { font-size: 19px; font-weight: 600; line-height: 1.2; }
.daychip em { font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.daychip:hover { border-color: var(--line-strong); }
.daychip.is-selected { background: var(--brand); border-color: var(--brand); color: #fff; }
.daychip.is-selected span, .daychip.is-selected em { color: rgba(255,255,255,.8); }
.daychip[disabled] { opacity: .45; cursor: default; }

.slot-area { display: flex; flex-direction: column; gap: 10px; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.slot {
  height: 46px; border-radius: 12px;
  font-size: 15.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--surface); border: 1px solid var(--line-strong);
  transition: border-color .12s ease, background .12s ease;
}
.slot:hover { border-color: var(--brand); color: var(--brand-strong); }
.slot.is-selected { background: var(--brand); border-color: var(--brand); color: #fff; }
.custom-wrap { padding-top: 4px; border-top: 1px dashed var(--line-strong); display: flex; flex-direction: column; gap: 8px; }
.custom-wrap .link-btn { margin-top: 10px; align-self: flex-start; }
.custom-time { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; }
.custom-time .field { flex: 1; }
.custom-time .btn { height: 46px; }

/* ---------- Resumo e detalhes ---------- */
.summary {
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  background: var(--surface);
}
.sum-when { padding: 14px 16px; background: var(--brand-soft); border-bottom: 1px solid var(--brand-line); }
.sum-when strong { display: block; font-size: 18px; font-weight: 600; letter-spacing: -.01em; color: var(--brand-strong); }
.sum-when span { font-size: 13.5px; color: var(--ink-2); }
.sum-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 54px; padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.sum-row:last-child { border-bottom: 0; }
.sum-label { width: 76px; flex: none; font-size: 13px; color: var(--ink-3); }
.sum-value { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; line-height: 1.35; }
.sum-value strong { font-size: 15px; font-weight: 600; }
.sum-value em { font-style: normal; font-size: 13px; color: var(--ink-3); }
.inline-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; align-self: flex-start;
  font-size: 13.5px; font-weight: 600; color: var(--ink);
}
.inline-link .ico { width: 16px; height: 16px; }
.inline-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.appt-status { display: flex; }
.stepper { display: inline-flex; flex: none; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.stepper button {
  min-width: 48px; height: 38px; padding: 0 10px;
  font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink);
  background: var(--surface);
}
.stepper button + button { border-left: 1px solid var(--line-strong); }
.stepper button:hover { background: var(--hover); }
.stepper button:active { background: var(--brand-soft); color: var(--brand-strong); }
.stepper button[disabled] { color: var(--ink-3); opacity: .5; pointer-events: none; }
.notice--inline { margin: -1px 0 0; border-radius: 0; border-width: 1px 0 0; }
.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.action {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; border-radius: 12px;
  font-size: 14.5px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line-strong);
}
.action:hover { background: var(--hover); }
.action .ico { width: 18px; height: 18px; color: var(--ink-2); }
.action--danger { color: #B42318; border-color: transparent; background: none; }
.action--danger .ico { color: #B42318; }
.action--danger:hover { background: #FEF3F2; }

.pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pay {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  height: 104px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line-strong);
  font-size: 15px;
}
.pay .ico { width: 26px; height: 26px; color: var(--brand); }
.pay strong { font-weight: 600; }
.pay:hover { border-color: var(--brand); background: var(--brand-soft); }

.msg-preview {
  padding: 14px 16px; border-radius: 14px 14px 14px 4px;
  background: #EFFAF2; border: 1px solid #D5EEDC;
  font-size: 14.5px; line-height: 1.5; color: var(--ink);
}

/* ---------- Celular: folha que sobe de baixo ---------- */
@media (max-width: 820px) {
  .drawer {
    top: auto; bottom: 0; left: 0; width: 100%;
    max-height: 94dvh;
    border-radius: 20px 20px 0 0;
    opacity: 1;
    transform: translateY(100%);
    transition: transform .26s cubic-bezier(.2, .8, .2, 1);
  }
  .drawer.is-open { transform: translateY(0); }
  .drawer--tall { height: 94dvh; }
  .drawer-handle { display: block; width: 36px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: 8px auto 0; flex: none; }
  .drawer-head { padding: 10px 16px 12px; }
  .drawer-progress { margin: 0 16px; }
  .drawer-body { padding: 16px 16px 24px; }
  .drawer-foot { padding: 12px 16px calc(12px + var(--safe-b)); border-radius: 0; }
  .daychips { margin: 0 -16px; padding: 2px 16px 4px; scroll-padding-inline: 16px; }
  .drawer-title { font-size: 19px; }
}
