/* ============================================================================
   AgendaZap — Design System v2 (FASE 1)
   Camada de tokens + estados + componentes base.
   Mantém TODOS os nomes de classe/variáveis antigos para compatibilidade.
   Fontes: system stack (a CSP bloqueia fontes externas) com rigor tipográfico.
   ========================================================================== */

:root {
  /* ---- Cores: superfícies (dark) ---- */
  --bg: #0a0a0f;
  --bg-card: #111118;
  --bg-input: #1a1a24;
  --bg-elevated: #16161f;
  --bg-hover: rgba(255, 255, 255, 0.03);

  /* ---- Cores: bordas ---- */
  --border: #2a2a38;
  --border-light: #1e1e2a;
  --border-strong: #353548;

  /* ---- Cores: texto ---- */
  --text: #f0f0f5;
  --text-muted: #8b8ba3;
  --text-dim: #5a5a6e;

  /* ---- Cor de marca (roxo/azul) ---- */
  --accent: #5b6af8;
  --accent-hover: #4a58e8;
  --accent-active: #3d4ad6;
  --accent-soft: #7c88ff;
  --accent-glow: rgba(91, 106, 248, 0.15);
  --accent-ring: rgba(91, 106, 248, 0.35);

  /* ---- Status ---- */
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.10);
  --green-border: rgba(34, 197, 94, 0.30);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.10);
  --red-border: rgba(239, 68, 68, 0.30);
  --yellow: #f59e0b;
  --yellow-bg: rgba(245, 158, 11, 0.10);
  --yellow-border: rgba(245, 158, 11, 0.30);

  /* ---- Tipografia ---- */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --font-display: var(--font-sans);

  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.8125rem;  /* 13px */
  --text-base: 0.875rem; /* 14px */
  --text-md: 0.9375rem;  /* 15px */
  --text-lg: 1.0625rem;  /* 17px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 1.75rem;   /* 28px */
  --text-4xl: 2.25rem;   /* 36px */

  --leading-tight: 1.2;
  --leading-snug: 1.4;
  --leading-normal: 1.6;

  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.06em;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* ---- Escala de espaçamento (grid 4px) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* ---- Raios ---- */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* ---- Elevação ---- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
  --shadow-accent: 0 4px 24px rgba(91, 106, 248, 0.25);

  /* ---- Movimento ---- */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 150ms;
  --dur: 200ms;
  --dur-slow: 250ms;

  /* ---- Z-index ---- */
  --z-sidebar: 100;
  --z-overlay: 900;
  --z-modal: 1000;
  --z-toast: 1100;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Transicoes suaves entre paginas (sensacao de app nativo). Progressive
   enhancement: navegadores sem suporte simplesmente navegam normal. */
@view-transition { navigation: auto; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: var(--leading-normal);
  min-height: 100vh;
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--accent-soft); }

/* ---- Foco acessível: anel visível só na navegação por teclado ---- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* ============================================================================
   Layout
   ========================================================================== */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: var(--z-sidebar);
}

.sidebar-logo {
  padding: var(--space-6) var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.sidebar-logo span {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  color: var(--text);
  letter-spacing: var(--tracking-tight);
}

.sidebar-nav { flex: 1; padding: var(--space-4) var(--space-3); display: flex; flex-direction: column; gap: var(--space-1); }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover { background: var(--bg-input); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); border-color: rgba(91, 106, 248, 0.3); }
.nav-item .nav-icon { width: 18px; text-align: center; }

.sidebar-bottom {
  padding: var(--space-4) var(--space-3);
  border-top: 1px solid var(--border);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: var(--text-sm); font-weight: var(--weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-plan { font-size: var(--text-xs); color: var(--text-muted); }

.main-content {
  margin-left: 240px;
  flex: 1;
  padding: var(--space-8);
  max-width: calc(100vw - 240px);
}

/* ============================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
}

.card-sm { padding: var(--space-4); }

.card-hover { transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.card-hover:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-4);
}

/* Linha de lista (ex.: agendamento com avatar) — reutilizável */
.list { display: flex; flex-direction: column; gap: var(--space-3); }
.list-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.list-row:hover { background: var(--bg-elevated); border-color: var(--border-light); }
.list-row .row-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: var(--weight-bold);
  flex-shrink: 0;
}
.list-row .row-main { flex: 1; min-width: 0; }
.list-row .row-title { font-size: var(--text-base); font-weight: var(--weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .row-sub { font-size: var(--text-xs); color: var(--text-muted); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stat-label { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.stat-value { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); }
.stat-icon { font-size: var(--text-xl); margin-bottom: var(--space-1); }

/* ============================================================================
   Botões
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  min-height: 40px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); color: white; box-shadow: var(--shadow-accent); }
.btn-primary:active { background: var(--accent-active); }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: white; }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-input); color: var(--text); }

.btn-sm { padding: 6px 14px; min-height: 32px; font-size: var(--text-sm); }
.btn-lg { padding: 14px 28px; min-height: 48px; font-size: var(--text-md); }
.btn-full { width: 100%; }

/* Estado de carregando: <button class="btn is-loading"> mostra spinner e oculta o texto */
.btn.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: white;
  animation: spin 0.6s linear infinite;
}
.btn-secondary.is-loading::after, .btn-ghost.is-loading::after { color: var(--accent); }

/* ============================================================================
   Formulários
   ========================================================================== */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); min-width: 0; }

label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-muted); }

/* Campos de texto/select/textarea — exclui checkbox e radio (que devem
   manter o tamanho/alinhamento nativos). */
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-height: 40px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  width: 100%;
  /* Permite encolher dentro de grid/flex (evita date/time estourar a borda no mobile) */
  min-width: 0;
  max-width: 100%;
}

input::placeholder, textarea::placeholder { color: var(--text-dim); }

/* Checkbox/radio: alinhamento e cor de marca consistentes */
input[type="checkbox"], input[type="radio"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
  vertical-align: middle;
}

input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input:disabled, select:disabled, textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input.is-invalid, select.is-invalid, textarea.is-invalid,
input[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--red);
}
input.is-invalid:focus, textarea.is-invalid:focus,
input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--red-bg); }

.field-error { font-size: var(--text-xs); color: var(--red); }
.field-hint { font-size: var(--text-xs); color: var(--text-dim); }

textarea { resize: vertical; min-height: 80px; line-height: var(--leading-snug); }

/* ============================================================================
   Badges / Status
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-accent { background: var(--accent-glow); color: var(--accent); }
.badge-muted { background: var(--bg-input); color: var(--text-muted); }

/* Ponto de status (usado junto do texto) */
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.green { background: var(--green); }
.status-dot.red { background: var(--red); }
.status-dot.yellow { background: var(--yellow); }

/* ============================================================================
   Tabela
   ========================================================================== */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
th { text-align: left; padding: 12px 16px; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-muted); text-transform: uppercase; letter-spacing: var(--tracking-wide); border-bottom: 1px solid var(--border); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--dur-fast) var(--ease); }
tr:hover td { background: var(--bg-hover); }

/* ============================================================================
   Cabeçalho de página
   ========================================================================== */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); flex-wrap: wrap; }
.page-title { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); }
.page-subtitle { font-size: var(--text-base); color: var(--text-muted); margin-top: 2px; }

/* ============================================================================
   Alertas
   ========================================================================== */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: var(--text-base); margin-bottom: var(--space-4); border: 1px solid transparent; }
.alert-error { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.alert-success { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.alert-info { background: var(--accent-glow); color: var(--accent); border-color: rgba(91, 106, 248, 0.3); }
.alert-warning { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow-border); }

/* ============================================================================
   Caixa de link (copiar)
   ========================================================================== */
.link-box {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.link-box input { background: none; border: none; padding: 0; min-height: 0; flex: 1; }
.link-box input:focus { box-shadow: none; }

/* ============================================================================
   Linha de dia da semana / horários
   ========================================================================== */
.day-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.day-toggle { display: flex; align-items: center; gap: var(--space-2); width: 120px; }
.day-times { display: flex; align-items: center; gap: var(--space-2); flex: 1; }
.day-times input { width: 120px; }

/* ============================================================================
   Toggle switch
   ========================================================================== */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: background var(--dur) var(--ease);
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--dur) var(--ease);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider:before { transform: translateX(18px); }
.toggle input:focus-visible + .toggle-slider { box-shadow: 0 0 0 3px var(--accent-ring); }
.toggle input:disabled + .toggle-slider { opacity: 0.5; cursor: not-allowed; }

/* ============================================================================
   QR Code
   ========================================================================== */
.qr-container { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); padding: var(--space-8); }
.qr-image {
  width: 200px; height: 200px;
  background: white;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-2);
}
.qr-image img { width: 100%; height: 100%; object-fit: contain; }

/* ============================================================================
   Modal / Dialog
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 10, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: var(--z-modal);
  animation: fade-in var(--dur) var(--ease);
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  animation: modal-in var(--dur-slow) var(--ease-out);
}
.modal-header { padding: var(--space-6) var(--space-6) var(--space-4); }
.modal-title { font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); }
.modal-body { padding: 0 var(--space-6); color: var(--text-muted); font-size: var(--text-base); }
.modal-footer { padding: var(--space-5) var(--space-6) var(--space-6); display: flex; gap: var(--space-3); justify-content: flex-end; flex-wrap: wrap; }
.modal[hidden], .modal-overlay[hidden] { display: none; }

/* ============================================================================
   Skeletons / Spinner / Empty
   ========================================================================== */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

.skeleton {
  display: block;
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-elevated) 37%, var(--bg-input) 63%);
  background-size: 400% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.4s ease infinite;
}
.skeleton-text { height: 12px; margin: 6px 0; }
.skeleton-title { height: 20px; width: 50%; margin: 8px 0; }
.skeleton-card { height: 96px; }
.skeleton-line-60 { width: 60%; }
.skeleton-line-80 { width: 80%; }

.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: var(--space-4); opacity: 0.6; }
.empty-state .empty-title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--text); margin-bottom: var(--space-2); }
.empty-state .empty-desc { font-size: var(--text-base); max-width: 360px; margin: 0 auto var(--space-5); }

/* ============================================================================
   Utilitários
   ========================================================================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.text-sm { font-size: var(--text-sm); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ============================================================================
   Scrollbar
   ========================================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ============================================================================
   Páginas de autenticação
   ========================================================================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  padding: var(--space-4);
}

.auth-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(91, 106, 248, 0.08) 0%, transparent 70%);
  top: -100px; right: -100px;
  pointer-events: none;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-10);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.auth-logo .logo-icon {
  width: 40px; height: 40px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

.auth-logo span { font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); }

/* ============================================================================
   Página pública de agendamento
   ========================================================================== */
.booking-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-10) var(--space-4);
}

.booking-header { text-align: center; margin-bottom: var(--space-8); }

.booking-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: white;
  margin: 0 auto var(--space-4);
}

/* Avatares com foto: a imagem preenche o circulo */
.booking-avatar, .user-avatar { overflow: hidden; }
.booking-avatar img, .user-avatar img, .avatar-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.avatar-preview {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  overflow: hidden;
  flex-shrink: 0;
}

.booking-name { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); }
.booking-bio { font-size: var(--text-base); color: var(--text-muted); margin-top: var(--space-1); }

.booking-container {
  width: 100%;
  max-width: 800px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

/* ---- Calendário ---- */
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.calendar-title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--space-1); }
.calendar-day-header { text-align: center; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-muted); padding: var(--space-1) 0; }

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  border: 1px solid transparent;
}

.calendar-day.available:hover { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }
.calendar-day.selected { background: var(--accent); color: white; font-weight: var(--weight-semibold); }
.calendar-day.unavailable { color: var(--text-dim); cursor: not-allowed; }
.calendar-day.past { color: var(--text-dim); cursor: not-allowed; }
.calendar-day.empty { cursor: default; }
.calendar-day.today { border-color: var(--border); }

/* ---- Horários ---- */
.slots-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); margin-top: var(--space-4); }

.slot-btn {
  padding: 10px;
  min-height: 44px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  text-align: center;
}

.slot-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.slot-btn.selected { background: var(--accent); border-color: var(--accent); color: white; font-weight: var(--weight-semibold); }

/* ============================================================================
   Planos
   ========================================================================== */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-5); }

.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-8);
  position: relative;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.plan-card:hover { transform: translateY(-2px); }
.plan-card.featured { border-color: var(--accent); }
.plan-card.featured::before {
  content: 'Mais Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
}

.plan-name { font-family: var(--font-display); font-size: var(--text-xl); font-weight: var(--weight-bold); margin-bottom: var(--space-2); }
.plan-price { font-family: var(--font-display); font-size: var(--text-4xl); font-weight: 800; margin-bottom: var(--space-5); letter-spacing: var(--tracking-tight); }
.plan-price span { font-size: var(--text-base); font-weight: var(--weight-normal); color: var(--text-muted); }

.plan-features { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: var(--space-6); }
.plan-features li { font-size: var(--text-base); display: flex; align-items: center; gap: var(--space-2); }
.plan-features li::before { content: '✓'; color: var(--green); font-weight: var(--weight-bold); }

/* ============================================================================
   Animações
   ========================================================================== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ============================================================================
   Shell mobile: topbar + drawer
   ========================================================================== */
/* Topbar só aparece no mobile (escondida no desktop) */
.admin-topbar { display: none; }
.sidebar-overlay { display: none; }
.bottom-tabs { display: none; }

@media (max-width: 768px) {
  /* app-layout e flex-row no desktop; no mobile precisa empilhar para a
     topbar ocupar a largura toda acima do conteudo (sidebar/overlay sao
     position:fixed e ficam fora do fluxo). */
  .app-layout { flex-direction: column; }
  .admin-topbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    position: sticky;
    top: 0;
    width: 100%;
    z-index: var(--z-sidebar);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: var(--space-3) var(--space-4);
  }
  .topbar-toggle {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
  }
  .topbar-toggle:active { transform: scale(0.96); }
  .topbar-logo { display: flex; align-items: center; gap: var(--space-2); font-family: var(--font-display); font-weight: var(--weight-bold); font-size: var(--text-md); }
  .topbar-logo .logo-icon { width: 28px; height: 28px; background: var(--accent); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 15px; }

  /* Sidebar vira drawer off-canvas */
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--dur-slow) var(--ease-out);
    width: 280px;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 10, 0.6);
    backdrop-filter: blur(2px);
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dur) var(--ease), visibility var(--dur) var(--ease);
  }
  .sidebar-overlay.open { opacity: 1; visibility: visible; }
  .sidebar { z-index: var(--z-modal); }

  .main-content { margin-left: 0; padding: var(--space-4); max-width: 100%; }
  .booking-container { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* Tabela vira cards empilhados (rotulos via data-label) */
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-3);
  }
  .table-stack td {
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-2) 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .table-stack tr td:first-child { padding-top: 0; }
  .table-stack tr td:last-child { border-bottom: none; padding-bottom: 0; }
  .table-stack td::before {
    content: attr(data-label);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
  }
  .table-stack tr:hover td { background: transparent; }

  /* Conforto de toque no mobile (alvos >= 44px) */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .nav-item { padding: 12px; }
  .page-header { gap: var(--space-3); }

  /* O hamburguer cede lugar à barra de abas inferior */
  .topbar-toggle { display: none; }

  /* Barra de abas inferior (estilo app nativo) */
  .bottom-tabs {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: var(--z-sidebar);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
  }
  .bottom-tabs .tab {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    min-height: 58px;
    padding: 7px 2px;
    background: none; border: 0;
    color: var(--text-dim);
    font-family: var(--font-sans);
    font-size: 10.5px; font-weight: var(--weight-semibold);
    text-decoration: none;
    position: relative;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    /* Remove o atraso de ~300ms do toque e responde na hora */
    touch-action: manipulation;
    transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  }
  .bottom-tabs .tab .tab-ico { font-size: 21px; line-height: 1; }
  .bottom-tabs .tab:active { background: var(--bg-hover); }
  .bottom-tabs .tab.active { color: var(--accent-soft); }
  .bottom-tabs .tab::before {
    content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 0; height: 3px; border-radius: 0 0 4px 4px; background: var(--accent);
    transition: width var(--dur) var(--ease);
  }
  .bottom-tabs .tab.active::before { width: 30px; }
  .bottom-tabs .tab-dot {
    position: absolute; top: 8px; left: calc(50% + 9px);
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--red); border: 1.5px solid var(--bg-card);
  }

  /* Conteúdo não fica atrás da barra fixa */
  .main-content { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
}

/* ============================================================================
   Acessibilidade: respeita "reduzir movimento"
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  /* Desliga o crossfade das transicoes de pagina para quem pede menos animacao */
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
