/* =====================================================
   APP.CSS — Páginas de aplicação (auth, perfil, forms)
   Depende dos tokens definidos em main.css
   ===================================================== */

/* ============================================
   AUTH LAYOUT — split screen
   ============================================ */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth__aside {
  position: relative;
  padding: var(--space-2xl) var(--space-xl);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 30% 20%, rgba(168, 133, 154, 0.28), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(196, 168, 138, 0.18), transparent 60%),
    linear-gradient(160deg, var(--color-bg-soft) 0%, var(--color-bg) 100%);
  border-right: 1px solid var(--color-line);
}
.auth__aside-brand {
  display: flex; align-items: center; gap: 0.7rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  position: relative; z-index: 2;
}
.auth__aside-brand img { width: 44px; height: 44px; }
.auth__aside-brand .italic { font-style: italic; color: var(--color-mauve-light); }

.auth__aside-content { position: relative; z-index: 2; }
.auth__aside-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.6rem, 2.6vw, 2.4rem);
  line-height: 1.3;
  color: var(--color-paper);
  max-width: 18ch;
}
.auth__aside-sub {
  margin-top: var(--space-md);
  color: var(--color-text-dim);
  font-size: 0.95rem;
  max-width: 34ch;
}
.auth__aside-art {
  position: absolute;
  right: -60px; bottom: -60px;
  width: 360px; height: 360px;
  opacity: 0.5;
  z-index: 1;
}

.auth__main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
}
.auth__card {
  width: 100%;
  max-width: 420px;
}
.auth__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
  transition: color 0.3s var(--ease-out-soft);
}
.auth__back:hover { color: var(--color-mauve-light); }

.auth__title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  color: var(--color-paper);
  line-height: 1.1;
}
.auth__title .italic { font-style: italic; color: var(--color-mauve-light); }
.auth__subtitle {
  color: var(--color-text-dim);
  font-size: 0.95rem;
  margin-top: 0.5rem;
  margin-bottom: var(--space-lg);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.field { margin-bottom: var(--space-md); }
.field__label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-dim);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}
.field__label .req { color: var(--color-mauve-light); }

.field__input,
.field__select {
  width: 100%;
  padding: 0.85rem 1rem;
  background: rgba(227, 217, 198, 0.04);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-sm);
  color: var(--color-paper);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: all 0.3s var(--ease-out-soft);
}
.field__input::placeholder { color: var(--color-text-faint); }
.field__input:focus,
.field__select:focus {
  outline: none;
  border-color: var(--color-mauve);
  background: rgba(168, 133, 154, 0.08);
  box-shadow: 0 0 0 3px rgba(168, 133, 154, 0.12);
}
.field__input.is-invalid {
  border-color: #e08a8a;
  box-shadow: 0 0 0 3px rgba(224, 138, 138, 0.12);
}
.field__input.is-valid {
  border-color: #7CD992;
}
.field__select { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23a8859a' d='M1 1l5 5 5-5'/></svg>"); background-repeat: no-repeat; background-position: right 1rem center; }
.field__select option { background: var(--color-surface); color: var(--color-paper); }

.field__hint {
  font-size: 0.78rem;
  color: var(--color-text-faint);
  margin-top: 0.4rem;
}
.field__error {
  font-size: 0.78rem;
  color: #e08a8a;
  margin-top: 0.4rem;
  display: none;
}
.field__error.is-visible { display: block; }

.field-row {
  display: grid;
  gap: var(--space-sm);
}
.field-row--2 { grid-template-columns: 1fr 1fr; }
.field-row--3 { grid-template-columns: 2fr 1fr 1fr; }
.field-row--cep { grid-template-columns: 1fr 2fr; }

/* Password toggle */
.field__password-wrap { position: relative; }
.field__password-toggle {
  position: absolute;
  right: 0.75rem; top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  padding: 4px;
  display: flex;
}
.field__password-toggle:hover { color: var(--color-mauve-light); }
.field__password-toggle svg { width: 18px; height: 18px; }

/* Checkbox (LGPD) */
.field-check {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: var(--space-md);
  background: rgba(227, 217, 198, 0.03);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
}
.field-check input[type="checkbox"] {
  appearance: none;
  flex-shrink: 0;
  width: 20px; height: 20px;
  border: 1.5px solid var(--color-line-strong);
  border-radius: 4px;
  margin-top: 2px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s var(--ease-out-soft);
}
.field-check input[type="checkbox"]:checked {
  background: var(--color-mauve);
  border-color: var(--color-mauve);
}
.field-check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid var(--color-bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.field-check label {
  font-size: 0.85rem;
  color: var(--color-text-dim);
  line-height: 1.5;
  cursor: pointer;
}
.field-check a { color: var(--color-mauve-light); text-decoration: underline; }

/* Divider "ou" */
.auth__divider {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-lg) 0;
  color: var(--color-text-faint);
  font-size: 0.8rem;
}
.auth__divider::before,
.auth__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-line);
}

/* Google button */
.btn--google {
  width: 100%;
  background: var(--color-paper);
  color: #1b130e;
  gap: 0.7rem;
}
.btn--google:hover {
  background: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 28px -8px rgba(0,0,0,0.3);
}
.btn--google svg { width: 18px; height: 18px; }

.btn--full { width: 100%; }
.btn--loading { opacity: 0.7; pointer-events: none; position: relative; }
.btn--loading::after {
  content: '';
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth__footer-text {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
.auth__footer-text a { color: var(--color-mauve-light); font-weight: 500; }
.auth__footer-text a:hover { text-decoration: underline; }

.auth__forgot {
  font-size: 0.82rem;
  color: var(--color-mauve-light);
  display: inline-block;
  margin-top: 0.5rem;
}
.auth__forgot:hover { text-decoration: underline; }

/* ============================================
   ALERT BOX
   ============================================ */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: var(--space-md);
  display: none;
  line-height: 1.5;
}
.alert.is-visible { display: block; }
.alert--error { background: rgba(224, 138, 138, 0.12); border: 1px solid rgba(224, 138, 138, 0.3); color: #f0b0b0; }
.alert--success { background: rgba(124, 217, 146, 0.12); border: 1px solid rgba(124, 217, 146, 0.3); color: #a0e0b0; }
.alert--info { background: rgba(168, 133, 154, 0.12); border: 1px solid rgba(168, 133, 154, 0.3); color: var(--color-mauve-light); }

/* ============================================
   COMPLETAR CADASTRO — form longo
   ============================================ */
.form-page {
  min-height: 100vh;
  padding: var(--space-xl) var(--space-md) var(--space-2xl);
}
.form-page__inner {
  max-width: 720px;
  margin: 0 auto;
}
.form-page__head { margin-bottom: var(--space-xl); text-align: center; }
.form-page__head .eyebrow { display: block; margin-bottom: var(--space-sm); }
.form-page__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 400;
  color: var(--color-paper);
  line-height: 1.1;
}
.form-page__title .italic { font-style: italic; color: var(--color-mauve-light); }
.form-page__subtitle {
  color: var(--color-text-dim);
  margin-top: var(--space-sm);
  max-width: 52ch;
  margin-left: auto; margin-right: auto;
}

.form-section {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}
.form-section__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--color-paper);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.form-section__title .num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(168, 133, 154, 0.18);
  color: var(--color-mauve-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}
.form-section__desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
  padding-left: 2.2rem;
}

/* ============================================
   PERFIL
   ============================================ */
.profile-page {
  min-height: 100vh;
  padding-top: calc(var(--header-h) + var(--space-xl));
  padding-bottom: var(--space-2xl);
}
.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-mauve), var(--color-mauve-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--color-bg);
  flex-shrink: 0;
}
.profile-header__info h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--color-paper);
  line-height: 1.1;
}
.profile-header__info p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-top: 2px;
}
.profile-header__actions { margin-left: auto; display: flex; gap: 0.6rem; flex-wrap: wrap; }

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: var(--space-lg);
  align-items: start;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}
.card__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--color-paper);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card__title .edit-link {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-mauve-light);
  font-weight: 400;
}
.card__title .edit-link:hover { text-decoration: underline; }

.data-list { display: grid; gap: var(--space-sm); }
.data-item {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-line);
}
.data-item:last-child { border-bottom: none; padding-bottom: 0; }
.data-item__label { font-size: 0.85rem; color: var(--color-text-muted); }
.data-item__value { font-size: 0.9rem; color: var(--color-paper); text-align: right; font-weight: 400; }

/* Appointment cards (placeholder Fase 4) */
.appt-empty {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  color: var(--color-text-muted);
}
.appt-empty svg { width: 48px; height: 48px; color: var(--color-mauve-light); margin: 0 auto var(--space-md); opacity: 0.6; }
.appt-empty p { margin-bottom: var(--space-md); }

/* ============================================
   TOAST
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 500;
  background: var(--color-surface-2);
  color: var(--color-paper);
  border: 1px solid var(--color-line-strong);
  box-shadow: 0 12px 32px -8px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s var(--ease-out-soft);
  max-width: 90vw;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast--success { border-color: rgba(124, 217, 146, 0.4); }
.toast--error { border-color: rgba(224, 138, 138, 0.4); }

/* ============================================
   LOADING OVERLAY
   ============================================ */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: opacity 0.5s var(--ease-out-soft);
}
.page-loader.is-hidden { opacity: 0; pointer-events: none; }
.page-loader__spinner {
  width: 40px; height: 40px;
  border: 2px solid var(--color-line);
  border-top-color: var(--color-mauve);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ============================================
   SIMPLE HEADER (páginas internas)
   ============================================ */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 100;
  background: rgba(26, 20, 22, 0.8);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--color-line);
}
.app-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header__brand {
  display: flex; align-items: center; gap: 0.7rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
}
.app-header__brand img { width: 38px; height: 38px; }
.app-header__brand .italic { font-style: italic; color: var(--color-mauve-light); }
.app-header__actions { display: flex; gap: 0.6rem; align-items: center; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
  .profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .field-row--2,
  .field-row--3,
  .field-row--cep { grid-template-columns: 1fr; }
  .profile-header__actions { margin-left: 0; width: 100%; }
  .profile-header__actions .btn { flex: 1; }
}

/* ============================================
   AGENDAMENTO
   ============================================ */
.booking-page {
  min-height: 100vh;
  padding-top: calc(var(--header-h) + var(--space-xl));
  padding-bottom: var(--space-2xl);
}
.booking-head { text-align: center; margin-bottom: var(--space-xl); }
.booking-head .eyebrow { display: block; margin-bottom: var(--space-sm); }
.booking-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 400;
  color: var(--color-paper);
  line-height: 1.1;
}
.booking-head h1 .italic { font-style: italic; color: var(--color-mauve-light); }
.booking-head p { color: var(--color-text-dim); margin-top: var(--space-sm); max-width: 50ch; margin-left:auto; margin-right:auto; }

.booking-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--space-lg);
  align-items: start;
  max-width: 980px;
  margin: 0 auto;
}

.booking-col__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--color-paper);
  margin-bottom: var(--space-md);
  display: flex; align-items: center; gap: 0.5rem;
}
.booking-col__title .step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(168,133,154,0.18); color: var(--color-mauve-light);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-body); font-size: 0.75rem; font-weight: 600;
}

/* Lista de dias */
.day-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 540px;
  overflow-y: auto;
  padding-right: 4px;
}
.day-list::-webkit-scrollbar { width: 6px; }
.day-list::-webkit-scrollbar-thumb { background: var(--color-line-strong); border-radius: 3px; }

.day-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s var(--ease-out-soft);
  text-align: left;
  width: 100%;
}
.day-card:hover { border-color: var(--color-mauve-light); transform: translateX(3px); }
.day-card.is-active {
  border-color: var(--color-mauve);
  background: rgba(168,133,154,0.1);
}
.day-card__date {
  display: flex; flex-direction: column; align-items: center;
  min-width: 48px;
}
.day-card__daynum {
  font-family: var(--font-display);
  font-size: 1.6rem; font-weight: 400; color: var(--color-paper); line-height: 1;
}
.day-card__month { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-text-muted); margin-top: 2px; }
.day-card__info { flex: 1; }
.day-card__dow { font-size: 0.95rem; color: var(--color-paper); font-weight: 500; }
.day-card__count { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 2px; }
.day-card__arrow { color: var(--color-mauve-light); opacity: 0; transition: opacity 0.3s; }
.day-card.is-active .day-card__arrow { opacity: 1; }

/* Grade de horários */
.slots-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  min-height: 400px;
}
.slots-panel__empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 360px; text-align: center; color: var(--color-text-muted);
}
.slots-panel__empty svg { width: 48px; height: 48px; color: var(--color-mauve-light); opacity: 0.5; margin-bottom: var(--space-md); }

.slots-panel__selected-day {
  font-family: var(--font-display);
  font-size: 1.3rem; font-weight: 400; color: var(--color-paper);
  margin-bottom: var(--space-md); text-transform: capitalize;
}
.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 0.6rem;
}
.slot-btn {
  padding: 0.8rem 0.5rem;
  background: rgba(227,217,198,0.04);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-sm);
  color: var(--color-paper);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s var(--ease-out-soft);
}
.slot-btn:hover { border-color: var(--color-mauve-light); background: rgba(168,133,154,0.08); transform: translateY(-2px); }
.slot-btn.is-selected { background: var(--color-mauve); color: var(--color-bg); border-color: var(--color-mauve); }

/* Resumo de confirmação */
.booking-summary {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-line);
  display: none;
}
.booking-summary.is-visible { display: block; animation: fadeUp 0.4s var(--ease-out-soft); }
.booking-summary__row {
  display: flex; justify-content: space-between; padding: 0.5rem 0;
  font-size: 0.95rem;
}
.booking-summary__row .label { color: var(--color-text-muted); }
.booking-summary__row .value { color: var(--color-paper); font-weight: 500; }

/* Modal de sucesso */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 7, 8, 0.8);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: var(--space-md);
  opacity: 0; pointer-events: none; transition: opacity 0.4s var(--ease-out-soft);
}
.modal-overlay.is-visible { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 440px; width: 100%;
  text-align: center;
  transform: scale(0.94); transition: transform 0.4s var(--ease-out-soft);
}
.modal-overlay.is-visible .modal { transform: scale(1); }
.modal__icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(124,217,146,0.15);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--space-md);
}
.modal__icon svg { width: 32px; height: 32px; color: #7CD992; }
.modal__title { font-family: var(--font-display); font-size: 1.6rem; color: var(--color-paper); margin-bottom: var(--space-sm); }
.modal__text { color: var(--color-text-dim); margin-bottom: var(--space-lg); line-height: 1.6; }
.modal__actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }

/* Consultas no perfil */
.appt-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.appt-card {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-md);
  background: rgba(227,217,198,0.03);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
}
.appt-card__date {
  display: flex; flex-direction: column; align-items: center;
  min-width: 54px; padding-right: var(--space-md);
  border-right: 1px solid var(--color-line);
}
.appt-card__daynum { font-family: var(--font-display); font-size: 1.7rem; color: var(--color-paper); line-height: 1; }
.appt-card__month { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted); }
.appt-card__info { flex: 1; }
.appt-card__time { font-size: 1rem; color: var(--color-paper); font-weight: 500; }
.appt-card__meta { font-size: 0.82rem; color: var(--color-text-muted); margin-top: 2px; }
.appt-card__status {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0.3rem 0.7rem; border-radius: var(--radius-pill); font-weight: 600;
}
.status--scheduled { background: rgba(168,133,154,0.18); color: var(--color-mauve-light); }
.status--cancelled { background: rgba(224,138,138,0.15); color: #e0a0a0; }
.status--attended { background: rgba(124,217,146,0.15); color: #9ad8a8; }
.status--no_show { background: rgba(200,180,140,0.15); color: var(--color-sand); }
.appt-card__cancel {
  font-size: 0.8rem; color: #e08a8a; padding: 0.4rem 0.6rem; border-radius: var(--radius-sm);
  transition: background 0.3s;
}
.appt-card__cancel:hover { background: rgba(224,138,138,0.12); }

.appt-section-label {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--color-text-muted); margin: var(--space-lg) 0 var(--space-sm);
}
.appt-section-label:first-child { margin-top: 0; }

@media (max-width: 860px) {
  .booking-grid { grid-template-columns: 1fr; }
  .day-list { flex-direction: row; overflow-x: auto; max-height: none; padding-bottom: 8px; }
  .day-card { min-width: 200px; }
}

/* =====================================================
   CALENDAR — usado em /agendar e /dashboard
   ===================================================== */
.cal {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
}
.cal::before {
  content: '';
  position: absolute; top: -100px; right: -100px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(168,133,154,0.12), transparent 70%);
  pointer-events: none;
}

.cal__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  position: relative; z-index: 2;
}
.cal__nav-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-paper);
  text-transform: capitalize;
  letter-spacing: -0.01em;
}
.cal__nav-btns { display: flex; gap: 0.4rem; }
.cal__nav-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--color-line-strong);
  color: var(--color-text-dim);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.3s var(--ease-out-soft);
}
.cal__nav-btn:hover:not(:disabled) {
  border-color: var(--color-mauve-light);
  color: var(--color-mauve-light);
  background: rgba(168,133,154,0.06);
}
.cal__nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.cal__nav-btn svg { width: 16px; height: 16px; }

.cal__dows {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 0.5rem;
}
.cal__dow {
  font-size: 0.7rem;
  text-align: center;
  color: var(--color-text-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.4rem 0;
  font-weight: 600;
}

.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  position: relative; z-index: 2;
}
.cal__day {
  aspect-ratio: 1;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-faint);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 400;
  border-radius: var(--radius-md);
  cursor: default;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--ease-out-soft);
  opacity: 0;
  transform: translateY(8px);
  animation: cellIn 0.4s var(--ease-out-soft) forwards;
}
@keyframes cellIn { to { opacity: 1; transform: translateY(0); } }

.cal__day--empty { animation: none; opacity: 0; pointer-events: none; }
.cal__day--past  { color: var(--color-text-faint); opacity: 0.4; }
.cal__day--today {
  color: var(--color-paper);
  font-weight: 600;
}
.cal__day--today::before {
  content: '';
  position: absolute; inset: 2px;
  border: 1px dashed var(--color-line-strong);
  border-radius: var(--radius-md);
}

/* Dia com horários disponíveis (visível pro paciente) */
.cal__day--available {
  color: var(--color-paper);
  cursor: pointer;
  background: rgba(168, 133, 154, 0.06);
  border-color: rgba(168, 133, 154, 0.18);
}
.cal__day--available:hover {
  background: rgba(168, 133, 154, 0.18);
  border-color: var(--color-mauve);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px -8px rgba(168, 133, 154, 0.4);
}
.cal__day--available .cal__day-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--color-mauve-light);
  margin-top: 3px;
}

/* Dia editável (modo admin) — só mostra estado por contagem */
.cal__day--editable {
  cursor: pointer;
  color: var(--color-text-dim);
}
.cal__day--editable:hover {
  background: rgba(227,217,198,0.04);
  border-color: var(--color-line-strong);
  color: var(--color-paper);
}
.cal__day--open {                          /* tem horário aberto */
  color: var(--color-paper);
  background: rgba(168, 133, 154, 0.1);
  border-color: rgba(168, 133, 154, 0.3);
}
.cal__day--open:hover { background: rgba(168, 133, 154, 0.22); border-color: var(--color-mauve); }
.cal__day-badge {
  font-size: 0.6rem;
  color: var(--color-mauve-light);
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.cal__day--has-bookings {
  background: linear-gradient(180deg, rgba(196,168,138,0.14) 0%, rgba(168,133,154,0.1) 100%);
  border-color: rgba(196,168,138,0.35);
}
.cal__day--has-bookings .cal__day-badge { color: var(--color-sand); }

.cal__day--selected {
  background: var(--color-mauve) !important;
  color: var(--color-bg) !important;
  border-color: var(--color-mauve) !important;
  box-shadow: 0 8px 24px -8px rgba(168, 133, 154, 0.55);
}
.cal__day--selected .cal__day-dot { background: var(--color-bg); }
.cal__day--selected .cal__day-badge { color: var(--color-bg); opacity: 0.7; }

/* =====================================================
   AGENDAR — versão redesenhada
   ===================================================== */
.booking-grid-v2 {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: var(--space-lg);
  max-width: 1000px;
  margin: 0 auto;
  align-items: start;
}

.times-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  min-height: 420px;
  position: relative;
  overflow: hidden;
}
.times-panel::before {
  content: '';
  position: absolute; bottom: -120px; left: -100px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(196,168,138,0.08), transparent 70%);
  pointer-events: none;
}

.times-panel__empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 380px; text-align: center;
}
.times-panel__empty svg { width: 56px; height: 56px; color: var(--color-mauve-light); opacity: 0.4; margin-bottom: var(--space-md); }
.times-panel__empty-title {
  font-family: var(--font-display);
  font-size: 1.3rem; font-style: italic; color: var(--color-text-dim);
  margin-bottom: 0.3rem;
}
.times-panel__empty-sub { color: var(--color-text-muted); font-size: 0.9rem; }

.selected-day-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.4rem 1rem;
  background: rgba(168,133,154,0.12);
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-md);
  position: relative; z-index: 2;
}
.selected-day-pill .day { font-family: var(--font-display); font-style: italic; color: var(--color-mauve-light); }
.selected-day-pill .full {
  font-family: var(--font-display);
  font-size: 1.4rem; color: var(--color-paper); font-weight: 400;
}

.times-grid-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.6rem;
  position: relative; z-index: 2;
}
.time-pill {
  padding: 0.95rem 0.5rem;
  background: rgba(227, 217, 198, 0.04);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-md);
  color: var(--color-paper);
  font-family: var(--font-body);
  font-size: 0.96rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--ease-out-soft);
  position: relative;
  opacity: 0;
  transform: translateY(10px);
  animation: cellIn 0.4s var(--ease-out-soft) forwards;
}
.time-pill:hover {
  background: rgba(168,133,154,0.12);
  border-color: var(--color-mauve-light);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -10px rgba(168,133,154,0.5);
}
.time-pill.is-selected {
  background: var(--color-mauve);
  color: var(--color-bg);
  border-color: var(--color-mauve);
  transform: translateY(-2px);
}

.summary-card {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: rgba(227,217,198,0.03);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  position: relative; z-index: 2;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.4s var(--ease-out-soft), transform 0.4s var(--ease-out-soft);
  pointer-events: none;
}
.summary-card.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.summary-card__title {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-mauve-light);
  margin-bottom: 0.6rem;
  font-weight: 600;
}
.summary-card__rows { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: var(--space-md); }
.summary-card__rows .row { display: flex; justify-content: space-between; font-size: 0.92rem; }
.summary-card__rows .label { color: var(--color-text-muted); }
.summary-card__rows .value { color: var(--color-paper); font-weight: 500; }

/* =====================================================
   DASHBOARD AGENDA — gestão da agenda
   ===================================================== */
.dash-page {
  min-height: 100vh;
  padding-top: calc(var(--header-h) + var(--space-xl));
  padding-bottom: var(--space-2xl);
}
.dash-head {
  display: flex; align-items: end; justify-content: space-between;
  flex-wrap: wrap; gap: var(--space-md);
  margin-bottom: var(--space-xl);
}
.dash-head__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 400;
  color: var(--color-paper);
  line-height: 1.05;
}
.dash-head__title .italic { font-style: italic; color: var(--color-mauve-light); }
.dash-head__sub {
  color: var(--color-text-dim); margin-top: 0.3rem; font-size: 0.95rem;
}

.dash-tabs {
  display: flex; gap: 0.4rem;
  border-bottom: 1px solid var(--color-line);
  margin-bottom: var(--space-lg);
}
.dash-tab {
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  color: var(--color-text-muted);
  font-weight: 500;
  cursor: pointer;
  position: relative;
  background: transparent;
  border: none;
  transition: color 0.3s var(--ease-out-soft);
}
.dash-tab:hover { color: var(--color-paper); }
.dash-tab.is-active { color: var(--color-paper); }
.dash-tab.is-active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px; background: var(--color-mauve);
}

.dash-content > .tab-pane { display: none; }
.dash-content > .tab-pane.is-active { display: block; }

.dash-agenda-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-lg);
  align-items: start;
}
.dash-help-card {
  background: rgba(168,133,154,0.06);
  border: 1px solid rgba(168,133,154,0.2);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  display: flex; gap: 0.7rem; align-items: flex-start;
}
.dash-help-card svg { width: 20px; height: 20px; color: var(--color-mauve-light); flex-shrink: 0; margin-top: 1px; }
.dash-help-card p { font-size: 0.88rem; color: var(--color-text-dim); line-height: 1.55; }
.dash-help-card strong { color: var(--color-paper); font-weight: 500; }

/* Editor de horários do dia (painel da direita no dashboard) */
.day-editor {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  min-height: 480px;
  position: sticky; top: calc(var(--header-h) + var(--space-md));
}
.day-editor__empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 380px; text-align: center;
}
.day-editor__empty svg { width: 56px; height: 56px; opacity: 0.4; margin-bottom: var(--space-md); color: var(--color-mauve-light); }

.day-editor__head { margin-bottom: var(--space-md); }
.day-editor__title {
  font-family: var(--font-display); font-size: 1.4rem; font-weight: 400; color: var(--color-paper);
}
.day-editor__sub { color: var(--color-text-muted); font-size: 0.88rem; margin-top: 2px; }

.day-editor__section-label {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: var(--space-md) 0 0.6rem;
  font-weight: 600;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  background: rgba(168,133,154,0.15);
  border: 1px solid rgba(168,133,154,0.3);
  color: var(--color-paper);
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.25s var(--ease-out-soft);
  position: relative;
}
.chip--booked {
  background: rgba(196,168,138,0.15);
  border-color: rgba(196,168,138,0.35);
}
.chip__badge {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-sand);
  margin-left: 0.2rem;
}
.chip__remove {
  width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--color-mauve-light);
  cursor: pointer;
  transition: all 0.2s;
}
.chip__remove:hover { background: rgba(224,138,138,0.2); color: #f0b0b0; }
.chip__remove svg { width: 11px; height: 11px; }

.time-input-row {
  display: flex; gap: 0.5rem; align-items: stretch;
  margin-top: 0.6rem;
}
.time-input-row input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  background: rgba(227,217,198,0.04);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-sm);
  color: var(--color-paper);
  font-family: var(--font-body);
  font-size: 0.92rem;
}
.time-input-row input:focus { outline: none; border-color: var(--color-mauve); box-shadow: 0 0 0 3px rgba(168,133,154,0.12); }

.quick-presets {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin-top: 0.5rem;
}
.preset-btn {
  font-size: 0.78rem;
  padding: 0.4rem 0.7rem;
  background: transparent;
  border: 1px dashed var(--color-line-strong);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.preset-btn:hover { border-color: var(--color-mauve-light); color: var(--color-mauve-light); }

.day-editor__patients {
  margin-top: var(--space-md);
}
.day-editor__patient {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  background: rgba(227,217,198,0.03);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
}
.day-editor__patient .time { font-family: var(--font-display); color: var(--color-mauve-light); font-weight: 500; min-width: 44px; }
.day-editor__patient .name { color: var(--color-paper); flex: 1; }

.day-editor__actions {
  display: flex; gap: 0.5rem;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-line);
}

/* Toast position adjustment when dashboard is open */

@media (max-width: 920px) {
  .booking-grid-v2 { grid-template-columns: 1fr; }
  .dash-agenda-grid { grid-template-columns: 1fr; }
  .day-editor { position: static; }
}

@media (max-width: 540px) {
  .cal { padding: var(--space-md); }
  .cal__day { font-size: 0.82rem; }
}
