/* Agendamento online — página pública med27 */

.ao-page {
  --ao-accent: var(--login-accent, var(--med27-primary, #043c39));
  --ao-accent-strong: var(--login-accent-strong, var(--med27-primary-800, #07514c));
  --ao-accent-soft: var(--login-accent-soft, var(--med27-accent-100, #e8f7f3));
  --ao-surface: var(--med27-surface, #ffffff);
  --ao-muted: var(--med27-text-muted, #7c908b);
  --ao-border: var(--med27-gray-200, #e1e8e6);
  --ao-text: var(--med27-text-primary, #122521);
  --ao-radius: 12px;
  --ao-radius-lg: 12px;
  --ao-shadow:
    0 1px 2px rgba(18, 37, 33, 0.03),
    0 4px 12px rgba(18, 37, 33, 0.04);
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--med27-font, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  color: var(--ao-text);
  background: var(--med27-background, #f8faf9);
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

.ao-page *,
.ao-page *::before,
.ao-page *::after {
  box-sizing: border-box;
}

.ao-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--med27-background, #f8faf9);
}

.ao-bg::before,
.ao-bg::after {
  display: none;
}

.ao-bg::before {
  top: 2rem;
  right: 4%;
}

.ao-bg::after {
  bottom: 3rem;
  left: 3%;
}

.ao-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem) clamp(0.75rem, 2vw, 1.25rem) 2.5rem;
}

/* Header — faixa compacta, marca + texto */
.ao-header {
  margin-bottom: 1.5rem;
}

.ao-header__bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--ao-surface);
  border: 1px solid var(--ao-border);
  border-radius: var(--ao-radius);
  box-shadow: var(--ao-shadow);
}

.ao-header__mark {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding-right: 1.25rem;
  border-right: 1px solid var(--ao-border);
}

.ao-header__mark img {
  display: block;
  max-height: 52px;
  width: auto;
  max-width: min(200px, 38vw);
  object-fit: contain;
}

.ao-header__copy {
  text-align: left;
  min-width: 0;
}

.ao-header__eyebrow {
  display: block;
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ao-text);
}

.ao-header__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem 0;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.75rem;
  color: #94a3b8;
}

.ao-header__meta li {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.ao-header__meta li:not(:last-child)::after {
  content: '·';
  margin: 0 0.5rem;
  color: #cbd5e1;
  font-weight: 700;
  pointer-events: none;
}

.ao-header__meta i {
  font-size: 0.8rem;
  color: color-mix(in srgb, var(--ao-accent) 55%, #94a3b8);
}

@media (max-width: 520px) {
  .ao-header__bar {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
  }

  .ao-header__mark {
    padding-right: 0;
    padding-bottom: 0.85rem;
    border-right: none;
    border-bottom: 1px solid var(--ao-border);
    width: 100%;
    justify-content: center;
  }

  .ao-header__mark img {
    max-height: 44px;
  }

  .ao-header__copy {
    text-align: center;
  }
}

.ao-header__bar:not(:has(.ao-header__mark)) {
  justify-content: center;
}

.ao-header__bar:not(:has(.ao-header__mark)) .ao-header__copy {
  text-align: center;
}

/* Tabs */
.ao-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem;
  background: var(--ao-surface);
  border: 1px solid var(--ao-border);
  border-radius: 999px;
  max-width: 420px;
  margin: 0 auto 1.5rem;
  box-shadow: var(--ao-shadow);
}

.ao-tabs__btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ao-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.ao-tabs__btn:hover {
  color: var(--ao-text);
}

.ao-tabs__btn.is-active {
  background: var(--ao-accent-soft);
  color: var(--ao-accent-strong);
  box-shadow: none;
}

/* Panels */
.ao-panel {
  display: none;
  animation: aoFadeIn 0.35s ease;
}

.ao-panel.is-active {
  display: block;
}

@keyframes aoFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ao-card {
  background: var(--ao-surface);
  border: 1px solid var(--ao-border);
  border-radius: var(--ao-radius);
  box-shadow: var(--ao-shadow);
  padding: clamp(1.25rem, 3vw, 2rem);
}

.ao-card__title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
}

.ao-card__title i {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.65rem;
  background: var(--ao-accent-soft);
  color: var(--ao-accent-strong);
  font-size: 1.1rem;
}

.ao-card__sub {
  color: var(--ao-muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

/* Consult panel */
.ao-consult-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.ao-consult-form .ao-field {
  flex: 1 1 200px;
}

.ao-consult-form__submit,
.ao-consult-form__reset {
  flex: 0 0 auto;
  min-width: 140px;
  text-decoration: none;
}

.ao-results {
  margin-top: 1.25rem;
  border-radius: var(--ao-radius);
  overflow: hidden;
  border: 1px solid var(--ao-border);
}

.ao-results table {
  margin: 0;
  font-size: 0.875rem;
}

.ao-results thead th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ao-muted);
  border-bottom: 1px solid var(--ao-border);
  white-space: nowrap;
}

.ao-results .btn-pdf {
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.8125rem;
}

/* Progress steps */
.ao-progress {
  display: flex;
  justify-content: space-between;
  gap: 0.25rem;
  margin-bottom: 1.75rem;
  position: relative;
}

.ao-progress::before {
  content: '';
  position: absolute;
  top: 1.1rem;
  left: 12%;
  right: 12%;
  height: 2px;
  background: var(--ao-border);
  z-index: 0;
}

.ao-progress__line {
  position: absolute;
  top: 1.1rem;
  left: 12%;
  height: 2px;
  background: var(--ao-accent);
  z-index: 0;
  width: 0%;
  transition: width 0.4s ease;
}

.ao-step {
  flex: 1;
  text-align: center;
  position: relative;
  z-index: 1;
  min-width: 0;
}

.ao-step__dot {
  width: 2.25rem;
  height: 2.25rem;
  margin: 0 auto 0.4rem;
  border-radius: 50%;
  background: var(--ao-surface);
  border: 2px solid var(--ao-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ao-muted);
  transition: all 0.25s ease;
}

.ao-step.is-active .ao-step__dot,
.ao-step.is-done .ao-step__dot {
  border-color: var(--ao-accent);
  background: var(--ao-accent);
  color: #fff;
  box-shadow: none;
}

.ao-step.is-done .ao-step__dot {
  background: var(--ao-accent-strong);
}

.ao-step__label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ao-muted);
  line-height: 1.2;
  padding: 0 0.15rem;
}

@media (min-width: 480px) {
  .ao-step__label {
    font-size: 0.78rem;
  }
}

.ao-step.is-active .ao-step__label {
  color: var(--ao-accent-strong);
}

/* Step panes */
.ao-step-pane {
  display: none;
  animation: aoFadeIn 0.3s ease;
}

.ao-step-pane.is-active {
  display: block;
}

.ao-step-heading {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--ao-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ao-step-heading i {
  color: var(--ao-accent);
}

/* Fields */
.ao-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.ao-grid > .ao-field {
  min-width: 0;
}

@media (min-width: 576px) {
  .ao-grid--2,
  .ao-grid--ident {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ao-field--nome,
  .ao-field--full {
    grid-column: 1 / -1;
  }

  .ao-grid--addr {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: start;
  }

  .ao-grid--addr .ao-field--cep {
    grid-column: span 6;
  }

  .ao-grid--addr .ao-field--logradouro {
    grid-column: span 8;
  }

  .ao-grid--addr .ao-field--numero {
    grid-column: span 4;
  }

  .ao-grid--addr .ao-field--complemento,
  .ao-grid--addr .ao-field--bairro {
    grid-column: span 6;
  }

  .ao-grid--addr .ao-field--uf {
    grid-column: span 4;
  }

  .ao-grid--addr .ao-field--cidade {
    grid-column: span 8;
  }
}

@media (min-width: 768px) {
  .ao-grid--addr .ao-field--cep {
    grid-column: span 4;
  }

  .ao-grid--addr .ao-field--logradouro {
    grid-column: span 9;
  }

  .ao-grid--addr .ao-field--numero {
    grid-column: span 3;
  }

  .ao-grid--addr .ao-field--uf {
    grid-column: span 3;
  }

  .ao-grid--addr .ao-field--cidade {
    grid-column: span 9;
  }
}

.ao-optional {
  font-weight: 500;
  color: #94a3b8;
}

.ao-step-heading--sub {
  margin-top: 1.35rem;
  font-size: 0.95rem;
}

.ao-tip + .ao-step-heading--sub {
  margin-top: 0.15rem;
}

.ao-cep-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.ao-cep-row .form-control {
  flex: 1;
  min-width: 0;
}

.ao-btn--cep {
  flex: 0 0 auto;
  min-width: 48px;
  min-height: 48px;
  padding: 0.7rem 0.95rem;
  background: var(--ao-accent-soft);
  color: var(--ao-accent-strong);
  border: 1.5px solid color-mix(in srgb, var(--ao-accent) 28%, var(--ao-border));
  border-radius: 0.75rem;
}

.ao-btn--cep:hover {
  background: var(--ao-accent);
  color: #fff;
  border-color: transparent;
}

.ao-btn--cep:disabled {
  opacity: 0.65;
  cursor: wait;
}

.ao-cidade-combo {
  position: relative;
}

.ao-cidade-sugestoes {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 0.3rem 0;
  list-style: none;
  max-height: 16rem;
  overflow-y: auto;
  background: #fff;
  border: 1.5px solid var(--ao-border);
  border-radius: 0.75rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.ao-cidade-sugestoes[hidden] {
  display: none;
}

.ao-cidade-sugestoes li {
  padding: 0.6rem 0.95rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.3;
}

.ao-cidade-sugestoes li.is-active,
.ao-cidade-sugestoes li:hover {
  background: var(--ao-accent-soft);
  color: var(--ao-accent-strong);
}

.ao-cidade-sugestoes__empty {
  cursor: default;
  color: var(--ao-muted);
}

.ao-cidade-sugestoes__empty:hover {
  background: transparent;
  color: var(--ao-muted);
}

.ao-field--cidade.is-loading #cidade {
  opacity: 0.72;
}

.ao-field--cidade .ao-field__hint:empty {
  display: none;
}

.ao-field--cidade .ao-field__hint.is-error {
  color: #b91c1c;
}

.ao-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ao-field label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
}

.ao-field-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

.ao-avail-count {
  font-size: 0.6875rem;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.ao-avail-count:empty {
  display: none;
}

.ao-field .form-control,
.ao-field .form-select {
  border: 1.5px solid var(--ao-border);
  border-radius: 0.75rem;
  padding: 0.7rem 0.95rem;
  font-size: 1rem;
  min-height: 48px;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

.ao-field .form-control:disabled,
.ao-field .form-select:disabled {
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}

.ao-field .form-control:focus,
.ao-field .form-select:focus {
  border-color: var(--med27-primary-500, #169486);
  box-shadow: var(--med27-focus-ring, 0 0 0 3px rgba(22, 148, 134, 0.10));
  outline: none;
}

.ao-field__hint {
  font-size: 0.75rem;
  color: var(--ao-muted);
}

.ao-field--icon {
  position: relative;
}

.ao-field--icon > i {
  position: absolute;
  left: 0.9rem;
  top: 2.35rem;
  color: var(--ao-muted);
  pointer-events: none;
  font-size: 1rem;
}

.ao-field--icon .form-control,
.ao-field--icon .form-select {
  padding-left: 2.5rem;
}

.ao-tip {
  display: flex;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: var(--ao-radius);
  background: var(--ao-accent-soft);
  border: 1px solid var(--ao-border);
  font-size: 0.8125rem;
  color: var(--ao-accent-strong);
  margin-bottom: 1rem;
}

.ao-tip i {
  flex-shrink: 0;
  font-size: 1.1rem;
  margin-top: 0.1rem;
}

/* Date & time grids */
.datas-grid,
.horarios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.data-btn,
.horario-btn {
  background: var(--med27-surface-soft, #f2f6f5);
  border: 1.5px solid var(--ao-border);
  border-radius: var(--ao-radius);
  padding: 0.75rem 0.5rem;
  min-height: 48px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  font-weight: 600;
  color: var(--ao-text);
  font-size: 0.875rem;
  line-height: 1.3;
}

.data-btn small,
.horario-btn small {
  display: block;
  font-weight: 500;
  color: var(--ao-muted);
  font-size: 0.7rem;
  margin-top: 0.15rem;
}

.data-btn:hover,
.horario-btn:hover {
  border-color: var(--ao-accent);
  background: var(--ao-accent-soft);
}

.data-btn.selected,
.horario-btn.selected {
  background: var(--ao-accent);
  border-color: var(--ao-accent);
  color: #fff;
  box-shadow: none;
}

.data-btn.selected small {
  color: rgba(255, 255, 255, 0.85);
}

.ao-slot-empty {
  padding: 1.25rem;
  text-align: center;
  color: var(--ao-muted);
  font-size: 0.9rem;
  background: var(--med27-surface-soft, #f2f6f5);
  border-radius: var(--ao-radius);
  border: 1px dashed var(--ao-border);
}

.ao-slot-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  color: var(--ao-muted);
  font-size: 0.9rem;
}

/* Summary */
.ao-summary {
  background: var(--ao-accent-soft);
  border: 1px solid var(--ao-border);
  border-radius: var(--ao-radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.ao-summary dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
  font-size: 0.875rem;
}

.ao-summary dt {
  color: var(--ao-muted);
  font-weight: 500;
}

.ao-summary dd {
  margin: 0;
  font-weight: 600;
  color: var(--ao-text);
}

/* Nav buttons */
.ao-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ao-border);
}

.ao-btn {
  border: none;
  border-radius: var(--ao-radius);
  padding: 0.85rem 1.5rem;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.ao-btn--ghost {
  background: transparent;
  color: var(--ao-muted);
  border: 1.5px solid var(--ao-border);
}

.ao-btn--ghost:hover {
  background: var(--med27-surface-soft, #f2f6f5);
  color: var(--ao-text);
}

.ao-btn--primary {
  flex: 1;
  min-width: 160px;
  background: var(--ao-accent);
  color: #fff;
  box-shadow: none;
}

.ao-btn--primary:hover {
  background: var(--ao-accent-strong);
}

.ao-btn--primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.ao-loading-overlay {
  display: none;
  text-align: center;
  padding: 0.5rem 0 1rem;
}

.ao-loading-overlay.is-visible {
  display: block;
}

.ao-loading-overlay .spinner-border {
  width: 2rem;
  height: 2rem;
  border-color: var(--ao-accent);
  border-right-color: transparent;
}

/* Alerts */
.ao-page .alert {
  border: none;
  border-radius: 0.75rem;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
}

/* Footer */
.ao-footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.8125rem;
  color: var(--ao-muted);
  line-height: 1.5;
}

.ao-footer strong {
  color: #475569;
}

.ao-footer a {
  color: inherit;
  text-decoration: none;
}

.ao-footer a:hover,
.ao-footer a:hover strong {
  color: #043c39;
}

/* Profissional select highlight */
#profissional_id option {
  padding: 0.25rem;
}

@media (max-width: 575px) {
  .ao-progress__line,
  .ao-progress::before {
    display: none;
  }

  .ao-step__label {
    display: none;
  }

  .ao-step.is-active .ao-step__label {
    display: block;
  }

  .ao-actions {
    flex-direction: column-reverse;
  }

  .ao-btn--ghost {
    width: 100%;
  }
}

.ao-theme-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 30;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--ao-border);
  border-radius: 10px;
  background: #fff;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] .ao-page {
  --ao-surface: #122521;
  --ao-muted: #98aaa6;
  --ao-border: rgba(201, 238, 230, 0.14);
  --ao-text: #f3fbf9;
  background: #022f2d;
  color: var(--ao-text);
}

html[data-theme="dark"] .ao-header__bar,
html[data-theme="dark"] .ao-tabs,
html[data-theme="dark"] .ao-panel,
html[data-theme="dark"] .ao-card {
  background: rgba(17, 24, 39, 0.92);
  border-color: var(--ao-border);
}

html[data-theme="dark"] .ao-footer strong {
  color: #cbd5e1;
}

html[data-theme="dark"] .ao-footer a:hover,
html[data-theme="dark"] .ao-footer a:hover strong {
  color: #55c5ae;
}

html[data-theme="dark"] .ao-theme-btn {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.22);
  color: #fbbf24;
}
