/* ============================================================
   FrontHome - Design System & Modern Medical UI CSS
   ============================================================ */

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

:root {
  /* Color Palette - Medical Teal & Emerald Modern (Botões e Ações Preservados) */
  --primary-50: #f0fdfa;
  --primary-100: #ccfbf1;
  --primary-200: #99f6e4;
  --primary-500: #14b8a6;
  --primary-600: #0d9488;
  --primary-700: #0f766e;
  --primary-800: #115e59;
  --primary-900: #134e4a;

  --accent-500: #3b82f6;
  --accent-600: #2563eb;
  --emerald-500: #10b981;
  --amber-500: #f59e0b;
  --rose-500: #f43f5e;
  --indigo-500: #6366f1;

  /* Navy Blue Palette Tokens */
  --navy-50: #eff6ff;
  --navy-100: #dbeafe;
  --navy-200: #bfdbfe;
  --navy-300: #93c5fd;
  --navy-400: #60a5fa;
  --navy-500: #3b82f6;
  --navy-600: #2563eb;
  --navy-700: #1d4ed8;
  --navy-800: #1e40af;
  --navy-900: #1e3a8a;
  --navy-950: #0f172a;

  /* Typography & Patient Accent Tokens (Default Dark) */
  --patient-name-color: #60a5fa;
  --text-navy-accent: #60a5fa;

  /* Neutral Dark / Light tokens */
  --bg-main: #0b1120;
  --bg-sidebar: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --bg-input: #1e293b;
  
  --border-subtle: rgba(148, 163, 184, 0.12);
  --border-focus: #3b82f6;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 20px rgba(30, 58, 138, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', var(--font-main);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================= Light Theme Overrides ================= */
[data-theme="light"] {
  --bg-main: #f1f5f9;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #ffffff;
  
  --border-subtle: #e2e8f0;
  --border-focus: #1e3a8a;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  --patient-name-color: #1e3a8a;
  --text-navy-accent: #1e3a8a;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 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.04);
  --shadow-glow: 0 0 15px rgba(30, 58, 138, 0.15);
}

[data-theme="light"] .brand-info h1 {
  color: #1e3a8a;
  background: none;
  -webkit-text-fill-color: initial;
}

/* Menus modo claro: Mudança de foco Azul Marinho - Preto */
[data-theme="light"] .nav-item {
  color: #475569;
}

[data-theme="light"] .nav-item:hover {
  background: #dbeafe;
  color: #000000 !important;
  border-color: #93c5fd;
}

[data-theme="light"] .nav-item:hover svg {
  color: #000000 !important;
  stroke: #000000 !important;
}

[data-theme="light"] .nav-item.active {
  color: #000000 !important;
  background: #bfdbfe;
  border-color: #1e3a8a;
  box-shadow: inset 4px 0 0 #1e3a8a;
  font-weight: 700;
}

[data-theme="light"] .nav-item.active svg {
  color: #000000 !important;
  stroke: #000000 !important;
}

[data-theme="light"] .sidebar-footer,
[data-theme="light"] .user-auth-pill {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .card {
  background-color: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

[data-theme="light"] .topbar {
  background-color: #ffffff;
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
  color: #94a3b8 !important;
}

[data-theme="light"] .table th {
  background-color: #f8fafc;
  color: #475569;
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .table td {
  border-bottom-color: #f1f5f9;
  color: #1e293b;
}

[data-theme="light"] .table tr:hover td {
  background-color: #f8fafc;
}

[data-theme="light"] .modal-content {
  background-color: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .modal-header {
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .modal-footer {
  border-top-color: #e2e8f0;
  background-color: #f8fafc;
}

[data-theme="light"] .symptom-item {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .symptom-item:hover {
  background: #f8fafc;
}

[data-theme="light"] .ranking-item {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .chapter-item {
  color: #475569;
}

[data-theme="light"] .chapter-item:hover {
  background: #dbeafe;
  color: #000000 !important;
}

[data-theme="light"] .chapter-item.active {
  background: #bfdbfe;
  color: #000000 !important;
  border-color: #1e3a8a;
  font-weight: 700;
}

[data-theme="light"] .subnav-tab {
  background: #ffffff;
  color: #64748b;
  border-color: #e2e8f0;
}

[data-theme="light"] .subnav-tab:hover,
[data-theme="light"] .subnav-btn:hover {
  background: #dbeafe;
  color: #000000 !important;
}

[data-theme="light"] .subnav-tab.active,
[data-theme="light"] .subnav-btn.active {
  background: #bfdbfe;
  color: #000000 !important;
  border-color: #1e3a8a;
  box-shadow: inset 0 -2px 0 #1e3a8a;
  font-weight: 700;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Search Bar & Strict SVG Icon Constraints */
svg {
  flex-shrink: 0;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  min-height: 42px;
}

.search-bar svg,
.search-icon,
svg.search-icon {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  stroke: var(--text-muted);
  flex-shrink: 0;
  display: inline-block;
}

.search-bar input {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  box-shadow: none !important;
  width: 100%;
  color: var(--text-main);
  outline: none;
}

[data-theme="light"] .prontuario-info-card,
[data-theme="light"] .modal-info-card {
  background-color: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  color: #1e293b !important;
}

[data-theme="light"] .accordion-section {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .accordion-header {
  background: #f8fafc !important;
  color: #1e293b !important;
}

[data-theme="light"] .accordion-header:hover {
  background: #f1f5f9 !important;
}

/* Accordion Component Styles */
.accordion-section {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--bg-card);
  transition: var(--transition-fast);
}

.accordion-header {
  padding: 12px 16px;
  background: var(--bg-input);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  user-select: none;
  transition: var(--transition-fast);
}

.accordion-header:hover {
  background: rgba(30, 58, 138, 0.15);
  color: var(--text-navy-accent);
}

.accordion-icon {
  font-size: 12px;
  transition: transform 0.25s ease;
}

.accordion-content {
  padding: 16px;
  display: none;
  border-top: 1px solid var(--border-subtle);
}

.accordion-section.active .accordion-content {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

.accordion-section.active .accordion-header {
  color: var(--text-navy-accent);
}

.accordion-section.active .accordion-icon {
  transform: rotate(180deg);
}

/* App Container */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar Navigation */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 24px 16px;
  gap: 24px;
  z-index: 50;
  transition: var(--transition-normal);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary-500), var(--emerald-500));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  box-shadow: var(--shadow-glow);
}

.brand-info h1 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #ffffff;
  background: none;
  -webkit-text-fill-color: initial;
}

.brand-info p {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

/* Menus modo escuro: Mudança de foco Azul Marinho - Branco */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  color: #ffffff !important;
  background: #1e3a8a;
  border-color: #2563eb;
}

.nav-item:hover svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

.nav-item.active {
  color: #ffffff !important;
  background: #1e3a8a;
  border-color: #3b82f6;
  box-shadow: inset 4px 0 0 #60a5fa;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  transition: var(--transition-fast);
}

.nav-item.active svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

.sidebar-footer {
  padding: 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 12px;
}

.doctor-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.doctor-avatar {
  width: 36px;
  height: 36px;
  background: var(--navy-800);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-200);
  font-weight: 700;
  font-size: 14px;
}

.doctor-details h4 {
  font-size: 13px;
  color: var(--text-main);
  font-weight: 600;
}

.doctor-details p {
  font-size: 11px;
  color: var(--text-navy-accent);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  height: 70px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Mobile Hamburger Button (3 risquinhos) */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  padding: 0;
  transition: var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.mobile-menu-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary-500);
  color: var(--primary-400);
}

.mobile-menu-btn:active {
  transform: scale(0.95);
}

.mobile-menu-btn svg {
  display: block;
}

/* Sidebar Close Button on Mobile */
.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  margin-left: auto;
}

[data-theme="light"] .sidebar-close-btn {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
  color: var(--text-main);
}

.sidebar-close-btn:hover {
  background: #f43f5e;
  color: #fff;
  border-color: #f43f5e;
}

/* Sidebar Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.page-title h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.page-title span {
  font-size: 13px;
  color: var(--text-muted);
}

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

/* Content Container */
.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  background: radial-gradient(circle at 10% 20%, rgba(20, 184, 166, 0.04) 0%, transparent 60%);
}

/* Tab View Panels */
.tab-panel {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-panel.active {
  display: block;
}

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

/* Cards & Grid Layouts */
.grid-cards-3,
.grid-cards-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: var(--transition-normal);
}

.card:hover {
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: var(--shadow-lg);
}

.kpi-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.kpi-icon.teal { background: rgba(20, 184, 166, 0.15); color: var(--primary-500); }
.kpi-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-500); }
.kpi-icon.amber { background: rgba(245, 158, 11, 0.15); color: var(--amber-500); }
.kpi-icon.emerald { background: rgba(16, 185, 129, 0.15); color: var(--emerald-500); }

.kpi-data h3 {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-heading);
}

.kpi-data p {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
  font-family: var(--font-main);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
  color: #fff;
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-500), var(--emerald-500));
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose-500);
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: var(--rose-500);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 18px;
}

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

.form-control {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 14px;
  transition: var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2);
}

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

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* Search Box */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

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

.search-box svg {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

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

.table th {
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border-subtle);
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.badge-teal { background: rgba(20, 184, 166, 0.15); color: var(--primary-500); }
.badge-blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-500); }
.badge-emerald { background: rgba(16, 185, 129, 0.15); color: var(--emerald-500); }
.badge-amber { background: rgba(245, 158, 11, 0.15); color: var(--amber-500); }
.badge-rose { background: rgba(244, 63, 94, 0.15); color: var(--rose-500); }

/* REPERTORY ENGINE DEDICATED STYLES */
.repertorio-layout {
  display: grid;
  grid-template-columns: 320px 1fr 420px;
  gap: 20px;
  height: calc(100vh - 160px);
}

.panel-col {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.5);
}

.panel-header h3 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chapter-btn {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition-fast);
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
  width: 100%;
}

.chapter-btn:hover {
  background: #1e3a8a;
  color: #ffffff !important;
}

.chapter-btn.active {
  background: #1e3a8a;
  color: #ffffff !important;
  border-color: #3b82f6;
}

.symptom-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  transition: var(--transition-fast);
}

.symptom-item:hover {
  border-color: var(--navy-500);
  background: rgba(30, 58, 138, 0.1);
}

.symptom-text h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.symptom-text span {
  font-size: 12px;
  color: var(--text-muted);
}

/* Basket (Cesta de Sintomas) */
.basket-item {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 8px;
}

.basket-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.basket-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.basket-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.grade-selector {
  display: flex;
  gap: 4px;
}

.grade-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.grade-btn.active {
  background: var(--navy-700);
  color: #fff;
  border-color: var(--navy-500);
}

.director-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--amber-500);
  font-weight: 600;
  cursor: pointer;
}

/* Ranking Matrix Results */
.ranking-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
  transition: var(--transition-fast);
}

.ranking-card:hover {
  border-color: var(--navy-500);
  box-shadow: var(--shadow-md);
}

.ranking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ranking-rank {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-navy-accent);
  font-family: var(--font-heading);
}

.ranking-remedy-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.ranking-score-badge {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-950));
  border: 1px solid var(--navy-500);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}

.score-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}

.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--navy-500), var(--navy-400));
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modal Popup */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-box {
  transform: translateY(0);
}

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

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Sub Navigation Tabs (Configurações & Sections) */
.subnav-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
  padding-bottom: 4px;
}

.subnav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.subnav-btn:hover {
  color: #ffffff !important;
  background: #1e3a8a;
}

.subnav-btn.active {
  color: #ffffff !important;
  background: #1e3a8a;
  border-color: #3b82f6;
  box-shadow: inset 0 -2px 0 #60a5fa;
}

/* User Permissions Checkbox Grid */
.menu-permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 8px;
  background: rgba(15, 23, 42, 0.5);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.menu-permission-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.menu-permission-item:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: rgba(20, 184, 166, 0.3);
}

.menu-permission-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-500);
  cursor: pointer;
}

.menu-permission-item span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
}

/* Backup & Migration Modern Cards */
.backup-hero {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.15), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(20, 184, 166, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.backup-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.backup-stat-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.backup-stat-card .stat-val {
  font-size: 24px;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--primary-200);
}

.backup-stat-card .stat-lbl {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.file-drop-area {
  border: 2px dashed rgba(20, 184, 166, 0.4);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  background: rgba(15, 23, 42, 0.4);
  cursor: pointer;
  transition: var(--transition-fast);
}

.file-drop-area:hover, .file-drop-area.dragover {
  border-color: var(--primary-500);
  background: rgba(20, 184, 166, 0.08);
}

/* User Account Profile Pill in Sidebar */
.user-auth-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-top: 12px;
}

.user-auth-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.btn-logout {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.3);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-logout:hover {
  background: #f43f5e;
  color: #fff;
}

/* Print Sheet for Prescriptions */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .sidebar, .topbar, .btn, .no-print {
    display: none !important;
  }
  .main-wrapper, .content-body {
    padding: 0 !important;
    background: #fff !important;
    overflow: visible !important;
  }
  .prescription-sheet {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    color: #000 !important;
  }
}

/* Responsive Media Queries */
@media (max-width: 1100px) {
  .repertorio-layout {
    grid-template-columns: 260px 1fr;
  }
  .repertorio-layout .ranking-col {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: block;
  }

  .sidebar-close-btn {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    left: -320px;
    top: 0;
    bottom: 0;
    width: 290px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    z-index: 1050;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.6);
    overflow-y: auto;
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .topbar {
    padding: 10px 16px;
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .topbar-left {
    flex: 1;
    min-width: 180px;
  }

  .page-title h2 {
    font-size: 18px;
  }

  .page-title span {
    font-size: 12px;
    display: block;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: wrap;
  }

  .content-body {
    padding: 16px;
  }

  .grid-cards-3 {
    grid-template-columns: 1fr;
  }

  .repertorio-layout {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Interactive Atendimento Cards & Prontuário Timeline
   ============================================================ */
.atendimento-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.atendimento-item-card:hover {
  border-color: var(--primary-500);
  box-shadow: 0 4px 16px rgba(20, 184, 166, 0.12);
  transform: translateY(-2px);
}

.atendimento-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
  cursor: pointer;
}

.atendimento-notes-box {
  background: rgba(15, 23, 42, 0.35);
  border-left: 3px solid var(--navy-500);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 8px;
}

[data-theme="light"] .atendimento-notes-box {
  background: #f8fafc;
  border-left-color: var(--navy-800);
  color: #1e293b;
}

.atendimento-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* ============================================================
   Pagination Styles
   ============================================================ */
.pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  flex-wrap: wrap;
  gap: 12px;
}

.page-num-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.page-num-btn:hover:not(:disabled):not(.active) {
  border-color: var(--navy-500);
  color: var(--text-navy-accent);
  background: rgba(30, 58, 138, 0.15);
}

.page-num-btn.active {
  background: var(--navy-700);
  border-color: var(--navy-500);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.35);
}

.page-num-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 13px;
  user-select: none;
}

/* ============================================================
   Patient Name & Medical Typography (Navy Blue System)
   ============================================================ */
.patient-name,
.text-patient,
.text-navy {
  color: var(--patient-name-color) !important;
  font-weight: 700;
}

.patient-link {
  color: var(--patient-name-color) !important;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition-fast);
}

.patient-link:hover {
  text-decoration: underline;
  opacity: 0.85;
}

.text-navy-accent {
  color: var(--text-navy-accent) !important;
}

/* ============================================================
   Preserved Buttons (Verde Esmeralda / Teal Modern)
   "+ Novo Paciente", "Cadastrar Paciente", "Prontuário"
   ============================================================ */
.btn-primary,
.btn-novo-paciente,
.btn-cadastrar-paciente,
.btn-prontuario {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500)) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.35) !important;
}

.btn-primary:hover,
.btn-novo-paciente:hover,
.btn-cadastrar-paciente:hover,
.btn-prontuario:hover {
  background: linear-gradient(135deg, var(--primary-500), var(--emerald-500)) !important;
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.5) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}


