/* ============================================================
   PsiGestão — Estilos Globais
   Paleta: Verde-água/Teal | Fonte: Nunito
   ============================================================ */

/* --- Variáveis CSS --- */
:root {
  --primary:        #2A9D8F;
  --primary-dark:   #1F7A6D;
  --primary-light:  #4ECDC4;
  --primary-pale:   #E8F7F5;
  --secondary:      #264653;
  --accent:         #52B788;
  --accent-light:   #D8F3DC;

  --bg:             #F2FAF9;
  --bg-sidebar:     #1C3A35;
  --bg-sidebar-hover: #274E47;
  --bg-card:        #FFFFFF;

  --text:           #1A2E2B;
  --text-muted:     #5F8480;
  --text-sidebar:   #C8E6E2;
  --text-sidebar-active: #FFFFFF;

  --border:         #D4ECEA;
  --border-strong:  #A8D5D0;

  --success:        #52B788;
  --success-bg:     #D8F3DC;
  --warning:        #E9C46A;
  --warning-bg:     #FFF3CD;
  --danger:         #E76F51;
  --danger-bg:      #FDECEA;
  --info:           #4ECDC4;
  --info-bg:        #E0F8F7;

  --shadow-sm:      0 1px 3px rgba(42,157,143,.10);
  --shadow-md:      0 4px 16px rgba(42,157,143,.13);
  --shadow-lg:      0 8px 32px rgba(42,157,143,.18);

  --radius:         10px;
  --radius-lg:      16px;
  --radius-sm:      6px;

  --sidebar-w:      260px;
  --topbar-h:       64px;

  --font:           'Nunito', system-ui, sans-serif;
  --transition:     0.2s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

button { font-family: var(--font); cursor: pointer; }

input, select, textarea {
  font-family: var(--font);
  font-size: 14px;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

/* ============================================================
   LAYOUT — Tela de Login
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-pale);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px;
}

.login-logo h1 {
  font-size: 22px;
  color: var(--primary-dark);
  font-weight: 800;
}

.login-logo p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   LAYOUT — SPA Shell (autenticado)
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  transition: transform var(--transition);
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand .brand-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 8px;
}

.sidebar-brand h2 {
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.sidebar-brand p {
  color: var(--text-sidebar);
  font-size: 12px;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-section-label {
  color: rgba(200,230,226,.45);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-sidebar);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary-light);
  border-radius: 0 2px 2px 0;
}

.nav-item .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-info .user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info .user-role {
  color: var(--text-sidebar);
  font-size: 11px;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-sidebar);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition);
  flex-shrink: 0;
}
.btn-logout:hover { color: var(--danger); }

/* --- Main Content --- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

.topbar-title {
  flex: 1;
}

.topbar-title h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.topbar-title p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}

.page-content {
  padding: 28px;
  flex: 1;
}

/* ============================================================
   COMPONENTES — Botões
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  font-family: var(--font);
  line-height: 1.4;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover:not(:disabled) { filter: brightness(.92); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { filter: brightness(.92); }

.btn-warning {
  background: var(--warning);
  color: var(--text);
  border-color: var(--warning);
}
.btn-warning:hover:not(:disabled) { filter: brightness(.92); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover:not(:disabled) {
  background: var(--primary-pale);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 13px 28px;
  font-size: 16px;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

.btn-full { width: 100%; }

/* ============================================================
   COMPONENTES — Cards
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 22px; }

.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* --- Stat Cards (Dashboard) --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: box-shadow var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.teal    { background: var(--primary-pale); }
.stat-icon.green   { background: var(--accent-light); }
.stat-icon.warning { background: var(--warning-bg);  }
.stat-icon.danger  { background: var(--danger-bg);   }
.stat-icon.info    { background: var(--info-bg);     }

.stat-info { flex: 1; min-width: 0; }
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
.stat-value.money::before { content: ''; }
.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ============================================================
   COMPONENTES — Formulários
   ============================================================ */
.form-group {
  margin-bottom: 18px;
}

.form-row {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(42,157,143,.15);
}

.form-control::placeholder { color: #a0b8b5; }

.form-control.error { border-color: var(--danger); }

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  font-weight: 500;
}

textarea.form-control {
  resize: vertical;
  min-height: 90px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M5 6 0 0h10z' fill='%235F8480'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Toggle Switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 24px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ============================================================
   COMPONENTES — Tabelas
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  background: var(--primary-pale);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--primary-pale); }

.table-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ============================================================
   COMPONENTES — Badges / Status
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: #1a7a40; }
.badge-warning { background: var(--warning-bg); color: #7a5a0a; }
.badge-danger  { background: var(--danger-bg);  color: #9b2d1f; }
.badge-info    { background: var(--info-bg);    color: #186b67; }
.badge-muted   { background: var(--bg);         color: var(--text-muted); border: 1px solid var(--border); }
.badge-primary { background: var(--primary-pale); color: var(--primary-dark); }

/* Status de agendamento */
.status-agendado   { background: var(--info-bg);    color: #186b67; }
.status-confirmado { background: var(--success-bg); color: #1a7a40; }
.status-realizado  { background: var(--primary-pale); color: var(--primary-dark); }
.status-cancelado  { background: var(--danger-bg);  color: #9b2d1f; }

/* ============================================================
   COMPONENTES — Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,46,43,.55);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modal-in .2s ease;
}

.modal-box.modal-lg { max-width: 860px; }
.modal-box.modal-sm { max-width: 420px; }

@keyframes modal-in {
  from { transform: translateY(-16px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.modal-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 17px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--danger); }

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================
   COMPONENTES — Toast Notifications
   ============================================================ */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 14px 18px;
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
  animation: toast-in .3s ease;
  border-left: 4px solid;
}

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.toast.hide {
  animation: toast-out .3s ease forwards;
}

@keyframes toast-out {
  to { transform: translateX(100%); opacity: 0; }
}

.toast-success { border-color: var(--success); }
.toast-error   { border-color: var(--danger);  }
.toast-warning { border-color: var(--warning); }
.toast-info    { border-color: var(--info);    }

.toast-icon { font-size: 20px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 700; font-size: 14px; }
.toast-message { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   COMPONENTES — Filtros e Buscas
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.search-box .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

.search-box input {
  padding-left: 34px;
}

/* ============================================================
   COMPONENTES — Empty State
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: .6;
}

.empty-state h3 {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  max-width: 340px;
  margin: 0 auto 20px;
}

/* ============================================================
   MÓDULO — Dashboard
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}

.alert-list { list-style: none; }
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.alert-item:last-child { border-bottom: none; }
.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.alert-dot.warning { background: var(--warning); }
.alert-dot.danger  { background: var(--danger);  }
.alert-dot.info    { background: var(--info);    }

/* ============================================================
   MÓDULO — Agenda / Calendário
   ============================================================ */
.agenda-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.agenda-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
}

.agenda-nav-btn {
  background: none;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text);
  border-radius: 4px;
  transition: background var(--transition);
}
.agenda-nav-btn:hover { background: var(--primary-pale); }

.agenda-period-label {
  font-weight: 700;
  font-size: 14px;
  min-width: 200px;
  text-align: center;
}

.view-toggle {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-toggle button {
  border: none;
  background: none;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}

.view-toggle button.active {
  background: var(--primary);
  color: #fff;
}

/* Calendar Week */
.calendar-week-wrapper {
  overflow-x: auto;
}

.calendar-week {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  min-width: 700px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.cal-header { background: var(--primary-pale); }

.cal-header-cell {
  padding: 10px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  border-left: 1px solid var(--border);
}

.cal-header-cell .day-name { color: var(--text-muted); text-transform: uppercase; font-size: 10px; }
.cal-header-cell .day-num  { font-size: 16px; color: var(--text); margin-top: 2px; }
.cal-header-cell.today .day-num {
  background: var(--primary);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px auto 0;
}

.cal-time-col {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
}

.cal-time-slot {
  height: 56px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 4px 8px 0 0;
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.cal-day-col {
  border-left: 1px solid var(--border);
  position: relative;
  min-height: 600px;
}

.cal-slot {
  height: 56px;
  border-bottom: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
}

.cal-slot:hover { background: var(--primary-pale); }

.cal-appointment {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  z-index: 2;
  transition: filter var(--transition);
  border-left: 3px solid;
}

.cal-appointment:hover { filter: brightness(.9); }
.cal-appointment .apt-patient { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-appointment .apt-time    { font-weight: 400; opacity: .8; font-size: 10px; }

/* Calendar Month */
.calendar-month {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.month-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--primary-pale);
  border-bottom: 1px solid var(--border);
}

.month-header-cell {
  padding: 10px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.month-cell {
  min-height: 90px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px;
  cursor: pointer;
  transition: background var(--transition);
}

.month-cell:nth-child(7n) { border-right: none; }
.month-cell:hover { background: var(--primary-pale); }
.month-cell.other-month { background: var(--bg); }
.month-cell.today { background: var(--primary-pale); }

.month-cell-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.month-cell.today .month-cell-num {
  background: var(--primary);
  color: #fff;
}

.month-event {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   MÓDULO — Prontuário
   ============================================================ */
.prontuario-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  align-items: start;
}

.prontuario-patient-list { position: sticky; top: 90px; }

.patient-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  font-size: 13.5px;
}

.patient-list-item:hover { background: var(--primary-pale); }
.patient-list-item.active { background: var(--primary-pale); color: var(--primary-dark); font-weight: 600; }

.patient-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Evolução */
.evolucao-list { display: flex; flex-direction: column; gap: 14px; }

.evolucao-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  padding: 14px 16px;
}

.evolucao-item .evo-date {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.evolucao-item .evo-text {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ============================================================
   MÓDULO — Financeiro
   ============================================================ */
.fin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 22px;
}

.fin-tab {
  background: none;
  border: none;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}

.fin-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.fin-tab:hover:not(.active) { color: var(--text); }

.balance-banner {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  border-radius: var(--radius);
  padding: 22px 28px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.balance-item { text-align: center; }
.balance-label { font-size: 12px; opacity: .8; margin-bottom: 4px; }
.balance-value { font-size: 22px; font-weight: 800; }
.balance-divider { width: 1px; background: rgba(255,255,255,.25); height: 40px; }

/* ============================================================
   UTILITÁRIOS
   ============================================================ */
.hidden { display: none !important; }
.flex   { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px;  }
.mt-2 { margin-top: 8px;  }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm   { font-size: 13px; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger);  }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }

.section-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.section-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--primary-pale);
  color: var(--primary-dark);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .btn-menu-toggle {
    display: block;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
  }

  .sidebar-overlay.show { display: block; }

  .dashboard-grid { grid-template-columns: 1fr; }
  .form-row.cols-3 { grid-template-columns: 1fr 1fr; }
  .prontuario-layout { grid-template-columns: 1fr; }
  .page-content { padding: 18px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 540px) {
  .form-row.cols-2,
  .form-row.cols-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .balance-banner { flex-direction: column; text-align: center; }
  .balance-divider { display: none; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: none; }
  .login-card { padding: 32px 22px; }
}

/* ============================================================
   IMPRESSÃO / PDF
   ============================================================ */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  .sidebar,
  .topbar,
  .btn,
  .filter-bar,
  .table-actions,
  .modal-close,
  #toast-container { display: none !important; }

  .main-content { margin-left: 0 !important; }

  .page-content { padding: 0 !important; }

  body, .app-shell { background: #fff !important; }

  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }

  .print-header {
    display: block !important;
    text-align: center;
    padding: 20px;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 20px;
  }

  .print-header h1 { font-size: 18px; color: var(--primary-dark); }
  .print-header p  { font-size: 12px; color: var(--text-muted); }

  table thead th { background: #e8f7f5 !important; }
  tbody tr:hover td { background: transparent !important; }

  .no-print { display: none !important; }
  .print-only { display: block !important; }
}

.print-header { display: none; }
.print-only   { display: none; }

/* ============================================================
   SCROLLBAR customizada
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

/* ============================================================
   Disponibilidade (seletor de horários)
   ============================================================ */
.availability-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.avail-day {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 12px;
  font-weight: 600;
}

.avail-day.selected {
  background: var(--primary-pale);
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* Cores dos profissionais no calendário */
.prof-color-0 { background: #e3f4f2; color: #1a6b62; border-color: #2A9D8F; }
.prof-color-1 { background: #fde8e2; color: #7a2e1a; border-color: #E76F51; }
.prof-color-2 { background: #fef9e6; color: #6b4e0a; border-color: #E9C46A; }
.prof-color-3 { background: #e2f0e8; color: #1a5c30; border-color: #52B788; }
.prof-color-4 { background: #e6e0f5; color: #3a1a7a; border-color: #6C63AC; }
.prof-color-5 { background: #fce4ee; color: #7a1a3a; border-color: #E879A0; }
