/* ============================================================
   FisioFlow — Estilos
   ============================================================ */
:root {
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563EB;
  --primary-hover: #1d4ed8;
  --primary-soft: rgba(37, 99, 235, 0.1);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.06), 0 4px 16px -4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px -4px rgba(0, 0, 0, 0.08), 0 8px 24px -8px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --radius-lg: 16px;
}

[data-theme="dark"] {
  --bg: #0a0f1c;
  --bg-soft: #0f172a;
  --card: #131c2f;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #1e293b;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-soft: rgba(59, 130, 246, 0.15);
  --success-soft: rgba(34, 197, 94, 0.18);
  --warning-soft: rgba(245, 158, 11, 0.18);
  --danger-soft: rgba(239, 68, 68, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'rlig' 1, 'calt' 1;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }

/* ============== Layout ============== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; min-width: 240px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 0 24px; height: 64px;
  border-bottom: 1px solid var(--border);
}
.logo {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  font-weight: 700;
}
.logo-img {
  width: 32px; height: 32px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-soft);
}
.logo-text { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.sidebar-nav { flex: 1; padding: 16px 12px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all 0.15s;
}
.sidebar-nav a:hover { background: var(--bg-soft); color: var(--text); }
.sidebar-nav a.active { background: var(--primary-soft); color: var(--primary); }
.sidebar-nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { padding: 16px 24px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-bottom: 0; }

/* ============== Header ============== */
.header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
[data-theme="dark"] .header { background: rgba(10, 15, 28, 0.85); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px;
  padding: 0 20px;
}
.header-title h1 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.header-title p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.mobile-logo { display: none; }

/* ============== Conteúdo ============== */
.content { padding: 24px 20px; flex: 1; }
.content-narrow { max-width: 800px; }

/* ============== Botões ============== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: white; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-icon { width: 40px; padding: 0; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ============== Cards ============== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-padded { padding: 20px; }

/* Stat cards do dashboard */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  transition: box-shadow 0.2s;
}
.stat:hover { box-shadow: var(--shadow-md); }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; }
.stat-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.default { background: var(--primary-soft); color: var(--primary); }
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.danger  { background: var(--danger-soft);  color: var(--danger); }

/* ============== Formulários ============== */
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.input, .textarea, .select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input-search {
  padding-left: 36px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.3-4.3'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

/* ============== Tela de login ============== */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg) 60%, var(--primary-soft) 100%);
}
.login-box { width: 100%; max-width: 420px; }
.login-header { text-align: center; margin-bottom: 32px; }
.login-header .logo { width: 48px; height: 48px; margin: 0 auto 12px; font-size: 18px; box-shadow: var(--shadow-md); border-radius: 14px; }
.login-header h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.login-header p { color: var(--text-muted); margin-top: 4px; font-size: 14px; }
.login-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-md); }
.tabs { display: flex; background: var(--bg-soft); border-radius: 10px; padding: 4px; margin-bottom: 20px; gap: 4px; }
.tab { flex: 1; padding: 8px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text-muted); transition: all 0.15s; }
.tab.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }

/* ============== Lista de itens (paciente / agendamento) ============== */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.15s;
}
.list-item:hover { border-color: rgba(37, 99, 235, 0.3); box-shadow: var(--shadow-sm); }
.avatar {
  width: 40px; height: 40px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.avatar-lg { width: 60px; height: 60px; font-size: 18px; }
.list-item-main { flex: 1; min-width: 0; }
.list-item-title { font-weight: 500; }
.list-item-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; gap: 14px; flex-wrap: wrap; }
.list-item-subtitle span { display: inline-flex; align-items: center; gap: 4px; }

.hora-bloco {
  text-align: center; min-width: 56px;
}
.hora-bloco .h-inicio { font-weight: 600; font-size: 15px; }
.hora-bloco .h-fim { font-size: 10px; color: var(--text-muted); }

/* Card de agendamento no dashboard "Hoje" — 2 linhas, mobile-friendly */
.agendamento-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: all 0.15s;
}
.agendamento-card:hover { border-color: rgba(37, 99, 235, 0.3); box-shadow: var(--shadow-sm); }
.agendamento-topo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.agendamento-acoes {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.agendamento-acoes select { flex: 1; }

/* Badges de status */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid;
}
.status-pendente   { background: var(--warning-soft); color: var(--warning); border-color: rgba(245, 158, 11, 0.25); }
.status-confirmado { background: var(--success-soft); color: var(--success); border-color: rgba(34, 197, 94, 0.25); }
.status-cancelado, .status-faltou { background: var(--danger-soft); color: var(--danger); border-color: rgba(239, 68, 68, 0.25); }
.status-concluido  { background: var(--primary-soft); color: var(--primary); border-color: rgba(37, 99, 235, 0.25); }

/* ============== Estado vazio ============== */
.empty {
  padding: 60px 20px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.empty-icon {
  width: 48px; height: 48px;
  background: var(--bg-soft);
  color: var(--text-muted);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.empty-icon svg { width: 24px; height: 24px; }
.empty h3 { font-weight: 600; margin-bottom: 6px; }
.empty p { color: var(--text-muted); margin-bottom: 16px; font-size: 14px; max-width: 320px; margin-left: auto; margin-right: auto; }

/* ============== Modal ============== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.25s;
}
.modal-header { padding: 22px 24px 12px; }
.modal-header h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.modal-header p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.modal-body { padding: 16px 24px; }
.modal-footer {
  padding: 16px 24px 22px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border-top: 1px solid var(--border);
}
.modal-footer .footer-right { display: flex; gap: 8px; margin-left: auto; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ============== Toast ============== */
.toast-area { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.25s;
  min-width: 240px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ============== Agenda ============== */
.agenda-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.agenda-nav { display: flex; align-items: center; gap: 6px; }
.agenda-title { font-size: 15px; font-weight: 600; }
.agenda-grid {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
}
.agenda-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.agenda-table th, .agenda-table td { border: 1px solid var(--border); padding: 0; vertical-align: top; }
.agenda-table th {
  background: var(--bg-soft);
  font-size: 11px; font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 8px;
  text-align: center;
}
.agenda-table th.hoje { color: var(--primary); }
.agenda-table .hora-col { width: 56px; text-align: center; }
.agenda-table .hora-col td { font-size: 11px; color: var(--text-muted); padding: 4px; }
.agenda-table .slot { min-height: 40px; height: auto; position: relative; cursor: pointer; }
.agenda-table .slot:hover { background: var(--primary-soft); }

/* ============== Lista do dia (estilo Google) ============== */
.lista-dia-google {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 720px;
  margin: 0 auto;
}
.dia-grupo {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 14px;
  align-items: start;
}
.dia-grupo-hora {
  text-align: right;
  padding-top: 4px;
  font-size: 16px;
}
.dia-grupo-hora strong {
  font-weight: 700;
  color: var(--text);
}
.dia-grupo-contador {
  display: block;
  font-size: 11px;
  color: var(--primary);
  margin-top: 2px;
  font-weight: 500;
}
.dia-grupo-itens {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dia-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.dia-item:hover {
  transform: translateX(2px);
  box-shadow: var(--shadow-sm);
}
.dia-item.cancelado {
  opacity: 0.5;
  background: var(--bg-soft);
}
.dia-item-nome {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}
.dia-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.dia-item-obs {
  font-size: 11px;
  color: #f59e0b;
  margin-top: 4px;
  background: rgba(245, 158, 11, 0.06);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Badge de contagem no número do dia (mês) */
.cal-celula-numero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.cal-celula-badge {
  font-size: 9px;
  background: var(--primary);
  color: white;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .dia-grupo {
    grid-template-columns: 55px 1fr;
    gap: 10px;
  }
  .dia-grupo-hora { font-size: 14px; }
}
.evento {
  background: var(--primary);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 0.15s;
  min-width: 0;
}
.evento:hover { opacity: 0.85; }
.evento-list {
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 3px;
}
/* No celular vira lista vertical (1 coluna) */
@media (max-width: 768px) {
  .evento-list {
    grid-template-columns: 1fr;
  }
  .evento {
    white-space: normal;
    font-size: 12px;
    padding: 6px 8px;
  }
}

/* ============== Tabela financeiro ============== */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 12px 0; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.table td.right { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:last-child td { border-bottom: 0; }

/* ============== Bottom Nav (mobile) ============== */
.bottom-nav { display: none; }

/* ============== Detalhes do paciente ============== */
.paciente-header {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.paciente-info h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.paciente-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; font-size: 13px; color: var(--text-muted); }
.paciente-meta span { display: inline-flex; align-items: center; gap: 5px; }
.paciente-obs { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.evolucao-item { padding: 12px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; }
.evolucao-item .data { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.evolucao-item .texto { font-size: 13px; white-space: pre-wrap; }
.lista-mini { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.row-mini { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.row-mini .data-h { font-size: 12px; font-weight: 500; }
.row-mini .obs { font-size: 11px; color: var(--text-muted); }

/* ============== Settings ============== */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 360px; }
.theme-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  transition: all 0.15s;
}
.theme-btn:hover { border-color: rgba(37, 99, 235, 0.3); }
.theme-btn.active { border-color: var(--primary); background: var(--primary-soft); }
.theme-btn svg { width: 20px; height: 20px; }
.theme-btn span { font-size: 12px; font-weight: 500; }

/* ============== Section ============== */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-header h2 { font-size: 15px; font-weight: 600; }
.section-header .count { font-size: 12px; color: var(--text-muted); }

/* ============== Helpers ============== */
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.flex { display: flex; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }

/* ============== Modos da Agenda ============== */
.modo-btn {
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
  cursor: pointer;
  background: transparent;
  border: none;
  display: inline-flex;
  align-items: center;
}
.modo-btn:hover { color: var(--text); }
.modo-btn.active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Dropdown de seleção de modo */
.modo-dropdown { position: relative; display: inline-block; }
.modo-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 4px;
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.modo-dropdown-menu a,
.modo-dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.modo-dropdown-menu a:hover,
.modo-dropdown-menu button:hover {
  background: var(--bg-soft);
}
.modo-dropdown-menu a.active,
.modo-dropdown-menu button.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 500;
}

/* ============== Calendário mensal ============== */
.calendario {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.calendario-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.cal-dia-semana {
  padding: 10px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}
.calendario-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(110px, auto);
}
.cal-celula {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 110px;
  overflow: hidden;
}
.cal-celula:hover { background: var(--bg-soft); }
.cal-celula:nth-child(7n) { border-right: 0; }
.cal-celula.fora-mes { background: var(--bg-soft); color: var(--text-muted); opacity: 0.6; }
.cal-celula.cal-hoje { background: var(--primary-soft); }
.cal-celula.cal-hoje:hover { background: var(--primary-soft); }
.cal-celula-numero {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  padding: 2px 4px;
}
.cal-celula.cal-hoje .cal-celula-numero {
  color: var(--primary);
  font-weight: 700;
}
.cal-eventos {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.cal-evento {
  background: var(--primary);
  color: white;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: opacity 0.15s;
}
.cal-evento:hover { opacity: 0.85; }
.cal-evento-hora { font-weight: 600; flex-shrink: 0; }
.cal-evento-nome { overflow: hidden; text-overflow: ellipsis; }
.cal-mais {
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 6px;
  font-weight: 500;
  cursor: pointer;
}
.cal-mais:hover { color: var(--primary); }

/* ============== Cards de dia (15/30 dias) ============== */
.dia-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.dia-card.dia-hoje {
  border-color: var(--primary);
  background: linear-gradient(to bottom, var(--primary-soft) 0%, var(--card) 30%);
}
.dia-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.dia-card-data { font-size: 16px; font-weight: 600; }
.dia-card-semana { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.dia-vazio { padding: 12px 16px; font-size: 12px; color: var(--text-muted); }
.dia-eventos { padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.evento-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
  cursor: pointer;
  transition: all 0.15s;
}
.evento-card:hover { background: var(--accent); transform: translateX(2px); }
.evento-hora { font-weight: 600; font-size: 13px; min-width: 44px; }
.evento-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.evento-nome { font-size: 13px; font-weight: 500; }

/* ============== Responsivo ============== */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .mobile-logo { display: flex; align-items: center; gap: 8px; }
  .mobile-logo .logo { width: 32px; height: 32px; }
  .main { padding-bottom: 70px; }
  .bottom-nav {
    display: flex; align-items: center; justify-content: space-around;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    height: 64px;
    background: rgba(255, 255, 255, 0.92);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  [data-theme="dark"] .bottom-nav { background: rgba(10, 15, 28, 0.92); }
  .bottom-nav a {
    flex: 1; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 10px; font-weight: 500;
    color: var(--text-muted);
  }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav svg { width: 20px; height: 20px; }
  .header-actions .btn-text-hide { display: none; }
  .content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .agenda-grid { font-size: 12px; }
  .agenda-table th { padding: 8px 4px; font-size: 10px; }
  .header-title h1 { font-size: 16px; }
  .stat-value { font-size: 22px; }
  .agenda-toolbar { gap: 8px; }
  .agenda-table { min-width: 560px; }

  /* Card de agendamento no dashboard — mobile */
  .agendamento-topo {
    flex-wrap: wrap;
  }
  .agendamento-topo .hora-bloco { min-width: 50px; }
  .agendamento-topo .list-item-main {
    flex: 1 1 100%;
    order: 4;
    margin-top: 4px;
  }
  .agendamento-topo .status-badge {
    margin-left: auto;
  }
  .agendamento-topo .list-item-title {
    font-size: 14px;
    line-height: 1.3;
    word-break: break-word;
  }
  .agendamento-acoes .btn span { display: none; }
  .agendamento-acoes .btn { padding: 0 10px; min-width: 36px; }

  /* Calendário mensal — mobile */
  .calendario-grid {
    grid-auto-rows: minmax(72px, auto);
  }
  .cal-celula {
    min-height: 72px;
    padding: 3px;
    gap: 2px;
  }
  .cal-celula-numero { font-size: 11px; padding: 1px 3px; }
  .cal-evento {
    padding: 1px 4px;
    font-size: 9px;
  }
  .cal-evento-hora { display: none; }
  .cal-dia-semana { font-size: 9px; padding: 6px 2px; }
  .cal-mais { font-size: 9px; padding: 1px 4px; }
}

/* ============== Autocomplete de pacientes ============== */
.ac-wrapper {
  position: relative;
}
.ac-lista {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
}
.ac-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover,
.ac-item.focado {
  background: var(--primary-soft);
  color: var(--primary);
}
.ac-item-vazio {
  padding: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
