/* ==========================================================================
   SISTEMA DE GESTÃO DO SERVIÇO-ESCOLA DE PSICOLOGIA - DESIGN SYSTEM CSS
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Cores Principais - Modo Claro */
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f1f5f9;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-sidebar: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active-bg: rgba(59, 130, 246, 0.15);
  --sidebar-active-text: #60a5fa;

  /* Texto */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --text-inverse: #ffffff;

  /* Cores de Destaque */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;

  --accent-teal: #0d9488;
  --accent-teal-light: #f0fdfa;

  --success: #10b981;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #065f46;

  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;

  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #991b1b;

  --info: #8b5cf6;
  --info-light: #f5f3ff;
  --info-border: #ddd6fe;
  --info-text: #5b21b6;

  /* Bordas e Sombras */
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  /* Dimensões */
  --sidebar-width: 270px;
  --topbar-height: 70px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Modo Escuro */
[data-theme="dark"] {
  --bg-body: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-subtle: #1f2937;
  --bg-card: #131b2e;
  --bg-input: #1a2236;
  --bg-sidebar: #090d16;
  --sidebar-text: #9ca3af;
  --sidebar-hover: rgba(255, 255, 255, 0.05);
  --sidebar-active-bg: rgba(59, 130, 246, 0.2);
  --sidebar-active-text: #93c5fd;

  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;
  --text-inverse: #ffffff;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-border: rgba(59, 130, 246, 0.3);

  --border-color: #1f293d;
  --border-subtle: #162033;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);

  --success-light: rgba(16, 185, 129, 0.15);
  --success-border: rgba(16, 185, 129, 0.3);
  --success-text: #34d399;

  --warning-light: rgba(245, 158, 11, 0.15);
  --warning-border: rgba(245, 158, 11, 0.3);
  --warning-text: #fbbf24;

  --danger-light: rgba(239, 68, 68, 0.15);
  --danger-border: rgba(239, 68, 68, 0.3);
  --danger-text: #f87171;

  --info-light: rgba(139, 92, 246, 0.15);
  --info-border: rgba(139, 92, 246, 0.3);
  --info-text: #a78bfa;
}

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

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 0.9375rem;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Layout Principal */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform var(--transition-normal);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  flex-shrink: 0;
}

.brand-info {
  overflow: hidden;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: #64748b;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-group-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  padding: 0 0.625rem 0.5rem;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.6875rem 0.875rem;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
  transform: translateX(2px);
}

.nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-snippet {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #6366f1, #3b82f6);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.user-meta {
  overflow: hidden;
}

.user-meta-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta-role {
  font-size: 0.6875rem;
  color: #64748b;
  text-transform: capitalize;
}

/* Área Principal */
.app-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100vw - var(--sidebar-width));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-normal);
  overflow-x: hidden;
}

/* Topbar */
.app-topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
  background-color: rgba(255, 255, 255, 0.85);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

[data-theme="dark"] .app-topbar {
  background-color: rgba(17, 24, 39, 0.85);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.page-breadcrumb {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-main);
  border-color: var(--text-subtle);
}

/* Conteúdo da Página */
.app-content {
  flex: 1;
  padding: 1.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  overflow: hidden;
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

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

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* KPIs / Stat Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary);
}

.kpi-card.kpi-success::before { background: var(--success); }
.kpi-card.kpi-warning::before { background: var(--warning); }
.kpi-card.kpi-danger::before { background: var(--danger); }
.kpi-card.kpi-info::before { background: var(--info); }
.kpi-card.kpi-teal::before { background: var(--accent-teal); }

.kpi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.kpi-label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary);
  flex-shrink: 0;
}

.kpi-icon.kpi-success { background: var(--success-light); color: var(--success); }
.kpi-icon.kpi-warning { background: var(--warning-light); color: var(--warning); }
.kpi-icon.kpi-danger { background: var(--danger-light); color: var(--danger); }
.kpi-icon.kpi-info { background: var(--info-light); color: var(--info); }

.kpi-value {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.kpi-footer {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-surface-subtle);
  border-color: var(--text-subtle);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}
.btn-success:hover { background: #059669; }

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}
.btn-danger:hover { background: #dc2626; }

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

/* Formulários e Inputs */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-7 { grid-column: span 7; }
.col-6 { grid-column: span 6; }
.col-5 { grid-column: span 5; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }
.col-2 { grid-column: span 2; }
.col-1 { grid-column: span 1; }

@media (max-width: 900px) {
  .col-8, .col-7, .col-6, .col-5, .col-4, .col-3, .col-2, .col-1 {
    grid-column: span 12;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-label .required {
  color: var(--danger);
  margin-left: 0.2rem;
}

.form-control, .form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-family: inherit;
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder {
  color: var(--text-subtle);
}

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

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Barra de Filtros e Busca */
.toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.search-input-wrapper {
  position: relative;
  min-width: 160px;
  flex: 1;
  max-width: 340px;
}

.search-input-wrapper svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-input-wrapper .form-control {
  padding-left: 2.25rem;
}

/* Tabelas Modernas */
.table-responsive {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-sizing: border-box;
  display: block;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.table th {
  background: var(--bg-surface-subtle);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.table tbody tr {
  transition: background-color var(--transition-fast);
}

.table tbody tr:hover {
  background-color: var(--bg-surface-subtle);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  line-height: 1.2;
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
}

.badge-primary { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-border); }
.badge-success { background: var(--success-light); color: var(--success-text); border: 1px solid var(--success-border); }
.badge-warning { background: var(--warning-light); color: var(--warning-text); border: 1px solid var(--warning-border); }
.badge-danger { background: var(--danger-light); color: var(--danger-text); border: 1px solid var(--danger-border); }
.badge-info { background: var(--info-light); color: var(--info-text); border: 1px solid var(--info-border); }
.badge-secondary { background: var(--bg-surface-subtle); color: var(--text-muted); border: 1px solid var(--border-color); }

/* Abas (Tabs) */
.tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-btn:hover {
  color: var(--text-main);
}

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

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

/* Agenda / Grade Semanal */
.schedule-grid {
  display: grid;
  grid-template-columns: 80px repeat(4, 1fr);
  gap: 1px;
  background: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.schedule-header {
  background: var(--bg-surface-subtle);
  padding: 0.75rem;
  font-weight: 700;
  font-size: 0.8125rem;
  text-align: center;
  color: var(--text-main);
}

.schedule-time-slot {
  background: var(--bg-card);
  padding: 0.75rem 0.5rem;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-subtle);
}

.schedule-cell {
  background: var(--bg-card);
  padding: 0.5rem;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.event-card {
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  border-left: 4px solid var(--primary);
  background: var(--primary-light);
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  text-decoration: none;
  display: block;
}

.event-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* 4 Cores Oficiais PsicoALFA */
.event-card.status-confirmada {
  border-left-color: #10b981;
  background: #ecfdf5;
}
[data-theme="dark"] .event-card.status-confirmada {
  background: rgba(16, 185, 129, 0.15);
  border-left-color: #34d399;
}

.event-card.status-pendente {
  border-left-color: #f59e0b;
  background: #fffbeb;
}
[data-theme="dark"] .event-card.status-pendente {
  background: rgba(245, 158, 11, 0.15);
  border-left-color: #fbbf24;
}

.event-card.status-cancelada {
  border-left-color: #ef4444;
  background: #fef2f2;
}
[data-theme="dark"] .event-card.status-cancelada {
  background: rgba(239, 68, 68, 0.15);
  border-left-color: #f87171;
}

.event-card.status-concluida {
  border-left-color: #3b82f6;
  background: #eff6ff;
}
[data-theme="dark"] .event-card.status-concluida {
  background: rgba(59, 130, 246, 0.15);
  border-left-color: #60a5fa;
}

.event-card.event-conflict {
  border-left-color: #dc2626 !important;
  background: #fef2f2 !important;
  border: 1px solid #f87171;
  animation: pulseConflict 2s infinite;
}

@keyframes pulseConflict {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15); }
}

.event-title {
  font-weight: 700;
  margin-bottom: 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.event-subtitle {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.badge-pref-sala4 {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
[data-theme="dark"] .badge-pref-sala4 {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.4);
}

/* Modais */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.95);
  transition: all var(--transition-normal);
}

.modal-overlay.active .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Alertas & Toasts */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
}

.alert-success { background: var(--success-light); border-color: var(--success-border); color: var(--success-text); }
.alert-danger { background: var(--danger-light); border-color: var(--danger-border); color: var(--danger-text); }
.alert-warning { background: var(--warning-light); border-color: var(--warning-border); color: var(--warning-text); }
.alert-info { background: var(--info-light); border-color: var(--info-border); color: var(--info-text); }

/* Estilo para Impressão (Prontuários e Recibos) */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt;
  }

  .app-sidebar, .app-topbar, .toolbar, .btn, .no-print {
    display: none !important;
  }

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

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

  .card {
    border: none !important;
    box-shadow: none !important;
  }

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

.print-only {
  display: none;
}

/* Responsividade Mobile e Tablets */
@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  }

  .app-main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  #mobileSidebarToggle {
    display: flex !important;
  }

  .app-content {
    padding: 1rem !important;
  }

  .app-topbar {
    padding: 0 1rem !important;
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 0.75rem !important;
  }
}

@media (max-width: 640px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input-wrapper {
    max-width: 100%;
    width: 100%;
  }

  .form-select {
    max-width: 100% !important;
    width: 100% !important;
  }
}
