/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --medico: #0891b2;
  --medico-light: #cffafe;
  --paciente: #ef8d92;
  --paciente-light: #fde8e9;
  --success: #16a34a;
  --success-light: #dcfce7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow: 0 4px 16px rgba(0,0,0,.12);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.15);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: .2s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== LOGIN PAGE ===== */
.login-page { background: linear-gradient(135deg, #e0f2fe 0%, #f0fdf4 100%); }

.login-container {
  display: flex;
  min-height: 100vh;
}

.login-banner {
  flex: 1;
  background: linear-gradient(160deg, #1e40af 0%, #0891b2 50%, #0d9488 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}

.login-banner::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}

.login-banner::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}

.banner-content {
  position: relative;
  z-index: 1;
  color: white;
  text-align: center;
  max-width: 380px;
}

.banner-logo { font-size: 5rem; margin-bottom: 1rem; filter: drop-shadow(0 4px 8px rgba(0,0,0,.3)); }

.banner-content h1 {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: .5rem;
}

.banner-content > p {
  font-size: 1.1rem;
  opacity: .85;
  margin-bottom: 2.5rem;
}

.banner-features {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-bottom: 2rem;
  text-align: left;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .95rem;
  opacity: .9;
  background: rgba(255,255,255,.1);
  padding: .6rem 1rem;
  border-radius: var(--radius-sm);
}

.banner-badges { display: flex; gap: .75rem; justify-content: center; }

.badge {
  padding: .4rem 1rem;
  border-radius: 50px;
  font-size: .85rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

.badge-medico { background: rgba(8, 145, 178, .4); border: 1px solid rgba(255,255,255,.3); color: white; }
.badge-paciente { background: rgba(239, 141, 146, .4); border: 1px solid rgba(255,255,255,.3); color: white; }
.badge-atendente { background: rgba(217, 119, 6, .4); border: 1px solid rgba(255,255,255,.3); color: white; }

/* Form area */
.login-form-area {
  flex: 0 0 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--white);
}

.login-card { width: 100%; max-width: 400px; }

.login-header { margin-bottom: 2rem; }
.login-header h2 { font-size: 1.8rem; font-weight: 700; color: var(--gray-900); }
.login-header p { color: var(--gray-500); margin-top: .3rem; }

/* Alert */
.alert {
  padding: .9rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: .9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #86efac; }
.hidden { display: none !important; }

/* Form */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: .4rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
select,
textarea {
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.input-password { position: relative; }
.input-password input { padding-right: 3rem; }
.toggle-password {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
}

.btn-login {
  width: 100%;
  padding: .875rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: .5rem;
}
.btn-login:hover { opacity: .92; transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }
.btn-login:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Hints */
.login-hints {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-100);
}
.login-hints > p { font-size: .85rem; color: var(--gray-500); margin-bottom: .75rem; }

.hint-cards { display: flex; gap: .75rem; }

.hint-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: .8rem;
}
.hint-card:hover { background: var(--primary-light); border-color: var(--primary); }
.hint-card span { font-size: 1.5rem; }
.hint-card strong { display: block; font-size: .8rem; color: var(--gray-800); }
.hint-card small { color: var(--gray-500); font-size: .72rem; }

/* ===== DASHBOARD ===== */
.dashboard-page { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-medico { background: linear-gradient(180deg, #0c4a6e 0%, #0891b2 100%); }
.sidebar-paciente { background: #f2f2f2; border-right: 1px solid #e0e0e0; }
.sidebar-paciente .sidebar-logo { background: #f2f2f2; border-bottom-color: #e0e0e0; }
.sidebar-paciente .sidebar-user { background: rgba(0,0,0,.04); }
.sidebar-paciente .user-nome { color: #333; }
.sidebar-paciente .nav-item { color: #5a7080; }
.sidebar-paciente .nav-item:hover { color: #333; background: rgba(0,0,0,.05); }
.sidebar-paciente .nav-item.active { color: #c96870; background: #fde8e9; border-left-color: #ef8d92; }
.sidebar-paciente .sidebar-footer { border-top-color: #e0e0e0; }
.sidebar-paciente .btn-logout { background: transparent; color: #6b7280; border-color: #d0d0d0; }
.sidebar-paciente .btn-logout:hover { background: rgba(220,38,38,.06); color: #dc2626; border-color: rgba(220,38,38,.2); }
.sidebar-atendente { background: linear-gradient(180deg, #78350f 0%, #d97706 100%); }

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: white;
}
.sidebar-logo img { max-width: 140px; height: auto; display: block; }
.sidebar-logo span:first-child { font-size: 1.8rem; }
.sidebar-logo strong { font-size: 1.15rem; font-weight: 700; }
.sidebar-logo small { display: block; font-size: .72rem; opacity: .7; }

.sidebar-user {
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  background: rgba(255,255,255,.08);
  margin: 1rem;
  border-radius: var(--radius-sm);
  color: white;
}
.user-avatar { font-size: 2rem; }
.user-nome { font-size: .85rem; font-weight: 600; }
.user-role-badge {
  display: inline-block;
  font-size: .68rem;
  padding: .15rem .5rem;
  border-radius: 50px;
  font-weight: 600;
  margin-top: .2rem;
}
.role-medico { background: rgba(8, 145, 178, .5); color: #cffafe; }
.role-paciente { background: rgba(239, 141, 146, .5); color: #fde8e9; }
.role-atendente { background: rgba(217, 119, 6, .5); color: #fef3c7; }

.sidebar-nav { flex: 1; padding: .5rem 0; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  color: rgba(255,255,255,.75);
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  font-size: .9rem;
  user-select: none;
}
.nav-item:hover { color: white; background: rgba(255,255,255,.1); }
.nav-item.active { color: white; background: rgba(255,255,255,.15); border-left-color: #ef8d92; }
.nav-item .nav-icon { font-size: 1.1rem; width: 1.5rem; text-align: center; }

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

.btn-logout {
  width: 100%;
  padding: .65rem 1rem;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.8);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  transition: all var(--transition);
}
.btn-logout:hover { background: rgba(255,0,0,.25); color: #fca5a5; border-color: rgba(255,0,0,.3); }

/* Main content */
.main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title h2 { font-size: 1.25rem; font-weight: 700; color: var(--gray-800); }
.topbar-title p { font-size: .8rem; color: var(--gray-400); }

.topbar-right { display: flex; align-items: center; gap: .75rem; }
.topbar-avatar { font-size: 1.5rem; }
.topbar-user { font-size: .85rem; }
.topbar-user strong { display: block; color: var(--gray-800); }
.topbar-user small { color: var(--gray-400); }

.content-area {
  padding: 1.5rem;
  flex: 1;
}

/* Sections */
.section { display: none; }
.section.active { display: block; }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon-blue { background: var(--primary-light); }
.stat-icon-cyan { background: var(--medico-light); }
.stat-icon-purple { background: var(--paciente-light); }
.stat-icon-green { background: var(--success-light); }
.stat-icon-yellow { background: var(--warning-light); }

.stat-info { flex: 1; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--gray-500); margin-top: .25rem; }

/* Cards */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 1rem; font-weight: 600; color: var(--gray-800); }

.card-body { padding: 1.25rem; }

/* Table */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
thead th {
  background: var(--gray-50);
  padding: .75rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--gray-200);
}
tbody td {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .65rem;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 600;
}
.status-agendada { background: var(--primary-light); color: var(--primary-dark); }
.status-realizada { background: var(--success-light); color: var(--success); }
.status-cancelada { background: var(--danger-light); color: var(--danger); }

/* Lists */
.list-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--transition);
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--gray-50); }

.list-avatar { font-size: 2rem; flex-shrink: 0; }
.list-info { flex: 1; }
.list-name { font-weight: 600; color: var(--gray-800); font-size: .9rem; }
.list-detail { color: var(--gray-500); font-size: .8rem; margin-top: .15rem; }
.list-meta { font-size: .75rem; color: var(--gray-400); text-align: right; }

/* Prontuário card */
.prontuario-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  margin-bottom: .875rem;
}
.prontuario-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--gray-200);
}
.prontuario-date { font-size: .8rem; color: var(--gray-400); }
.prontuario-medico { font-size: .85rem; font-weight: 600; color: var(--gray-700); }
.prontuario-field { margin-bottom: .5rem; }
.prontuario-field label { font-size: .75rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; }
.prontuario-field p { font-size: .875rem; color: var(--gray-800); margin-top: .15rem; }

/* Grid 2 col */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

/* Button */
.btn {
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-400);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: .75rem; }
.empty-state p { font-size: .9rem; }

/* Welcome banner */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary), #0891b2);
  color: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  overflow: hidden;
  position: relative;
}
.welcome-banner::after {
  content: '';
  position: absolute;
  right: -30px;
  top: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.welcome-text h2 { font-size: 1.3rem; font-weight: 700; }
.welcome-text p { opacity: .85; font-size: .875rem; margin-top: .25rem; }
.welcome-emoji { font-size: 3rem; z-index: 1; }

/* Loading spinner */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--gray-400);
  gap: .75rem;
  font-size: .9rem;
}
.loading .spin {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* Medico cards grid */
.medicos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.medico-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  transition: all var(--transition);
}
.medico-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.medico-card .m-avatar { font-size: 3rem; margin-bottom: .5rem; }
.medico-card .m-nome { font-weight: 700; font-size: .95rem; color: var(--gray-800); }
.medico-card .m-especialidade { color: var(--medico); font-size: .8rem; font-weight: 500; margin-top: .2rem; }
.medico-card .m-crm { color: var(--gray-400); font-size: .75rem; margin-top: .4rem; }

/* ===== EXAMES - Paciente Upload ===== */
.consulta-exame-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.consulta-exame-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
}

.consulta-exame-info {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.consulta-exame-info strong { font-size: .95rem; color: var(--gray-800); }

.consulta-exame-date {
  text-align: right;
}
.consulta-exame-date strong { font-size: .9rem; color: var(--primary-dark); }

.exames-lista {
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
}

.exames-vazio {
  text-align: center;
  color: var(--gray-400);
  font-size: .85rem;
  padding: .75rem 0;
}

.exame-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .5rem;
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--transition);
}
.exame-item:last-child { border-bottom: none; }
.exame-item:hover { background: var(--gray-50); }

.exame-icon { font-size: 1.5rem; flex-shrink: 0; }
.exame-icon-lg { font-size: 2rem; flex-shrink: 0; }

.exame-info { flex: 1; min-width: 0; }
.exame-nome { font-weight: 600; font-size: .85rem; color: var(--gray-800); }
.exame-detalhe { font-size: .78rem; color: var(--gray-500); margin-top: .1rem; }

.exame-form {
  padding: 1rem 1.25rem;
  background: var(--primary-light);
  border-top: 2px solid var(--primary);
}

.exame-form-title {
  font-weight: 600;
  font-size: .875rem;
  color: var(--primary-dark);
  margin-bottom: .75rem;
}

.exame-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem .75rem;
}

.exame-alert {
  margin-top: .75rem;
  padding: .65rem .9rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
}
.exame-alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #fca5a5; }
.exame-alert-success { background: var(--success-light); color: var(--success); border: 1px solid #86efac; }

.exame-count-badge {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  padding: .15rem .5rem;
  border-radius: 50px;
  font-size: .72rem;
  font-weight: 600;
  background: var(--medico-light);
  color: var(--medico);
}

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger-light);
  font-size: .8rem;
  padding: .3rem .5rem;
}
.btn-danger-outline:hover { background: var(--danger-light); }

.btn-outline {
  background: white;
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
}
.btn-outline:hover { background: var(--gray-100); border-color: var(--gray-400); }

/* ===== EXAMES - Médico View ===== */
.exames-medico-lista {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.exame-item-medico {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.exame-item-medico:hover { box-shadow: var(--shadow-sm); border-color: var(--gray-300); }

/* ===== AGENDA POR DIA ===== */
.agenda-dia-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--primary);
}
.agenda-dia-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); }
.agenda-dia-count {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: .3rem .8rem;
  border-radius: 50px;
  font-size: .8rem;
  font-weight: 600;
}

.agenda-timeline {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.agenda-item {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.agenda-item:hover { box-shadow: var(--shadow-sm); }

.agenda-hora {
  background: var(--medico);
  color: white;
  padding: .5rem 1rem;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .02em;
}

.agenda-card-content {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
}

.agenda-paciente-info {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.agenda-exames {
  padding: .5rem 1.25rem 1rem;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

/* ===== MÉDICO - Consulta expandível ===== */
.consulta-medico-item {
  border-bottom: 1px solid var(--gray-100);
}
.consulta-medico-item:last-child { border-bottom: none; }

.consulta-medico-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: background var(--transition);
  flex-wrap: wrap;
  gap: .5rem;
}
.consulta-medico-header:hover { background: var(--gray-50); }

.consulta-medico-info {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.toggle-arrow {
  color: var(--gray-400);
  font-size: .75rem;
  transition: transform var(--transition);
}

.consulta-medico-exames {
  padding: .75rem 1.25rem 1rem;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
}

/* ===== MÉDICO - Filtros ===== */
.filtros-medico {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.filtro-busca {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: .1rem .75rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.filtro-busca:focus-within {
  border-color: var(--medico);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, .15);
  background: white;
}
.filtro-busca-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.filtro-busca-input {
  border: none;
  background: transparent;
  font-size: .9rem;
  padding: .55rem 0;
  width: 100%;
  color: var(--gray-800);
  outline: none;
}
.filtro-busca-input::placeholder {
  color: var(--gray-400);
}
.filtro-botoes {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

/* ===== CONSULTA CARD - Atendente/Geral ===== */
.consulta-card-item {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.consulta-card-item:hover { box-shadow: var(--shadow-sm); }

.consulta-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
  flex-wrap: wrap;
  gap: .5rem;
}

.consulta-card-info {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.consulta-card-info strong { font-size: .95rem; color: var(--gray-800); }

.consulta-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .35rem;
}
.consulta-card-meta strong { font-size: .9rem; color: var(--primary-dark); }

.consulta-card-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
}

.consulta-card-exames {
  padding: .75rem 1.25rem 1rem;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
}

.exames-compact-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.exame-compact-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  transition: background var(--transition);
}
.exame-compact-card:hover { background: var(--gray-50); }

.exame-compact-tag {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: .7rem;
  font-weight: 600;
  padding: .2rem .5rem;
  border-radius: var(--radius-sm);
  margin-bottom: .25rem;
}

.exame-compact-content {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
}

.exame-data {
  font-size: .72rem;
  color: var(--gray-400);
  margin-top: .15rem;
}

/* ===== HINT CARDS - 3 colunas ===== */
.hint-cards { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ===== FILE INPUT ===== */
.file-input {
  width: 100%;
  padding: .5rem .75rem;
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  font-size: .85rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.file-input:hover { border-color: var(--primary); background: var(--primary-light); }
.file-input:focus { outline: none; border-color: var(--primary); background: white; }
.file-input::file-selector-button {
  background: var(--primary);
  color: white;
  border: none;
  padding: .35rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  cursor: pointer;
  margin-right: .5rem;
  font-weight: 600;
}
.file-input::file-selector-button:hover { background: var(--primary-dark); }

/* ===== EXAME ACTION BUTTONS ===== */
.exame-item { display: flex; align-items: center; gap: .75rem; }
.exame-item .btn { text-decoration: none; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

/* ===== MOBILE TOPBAR & SIDEBAR TOGGLE ===== */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: .75rem;
  background: #f2f2f2;
  border-bottom: 1px solid #e0e0e0;
  padding: .65rem 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.mobile-topbar img { height: 32px; width: auto; }
.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: .25rem;
  flex-shrink: 0;
}
.sidebar-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gray-600);
  border-radius: 2px;
  transition: all .2s;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
body.sidebar-open .sidebar { transform: translateX(0); z-index: 100; }
body.sidebar-open .sidebar-overlay { display: block; }

/* Responsive */
@media (max-width: 768px) {
  .login-banner { display: none; }
  .login-form-area { flex: 1; }
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .main-content { margin-left: 0; }
  .mobile-topbar { display: flex; }
  .grid-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .exame-form-grid { grid-template-columns: 1fr; }
  .agenda-card-content { flex-direction: column; align-items: flex-start; }
  .consulta-exame-header { flex-direction: column; gap: .5rem; }
}
