/* ==========================================================================
   APPLE HUMAN INTERFACE GUIDELINES (HIG) - USABILITY & CONTROL SUITE
   Ecossistema Clínico Dr. Yoshimi Watanabe (5 Projetos)
   - Agente Especialista em Usabilidade (Design, Tipografia, Feedback Tátil)
   - Agente Especialista em Controle (Spotlight ⌘K, Dynamic Island, Acessibilidade)
   ========================================================================== */

/* SF Pro Typography & Tabular Figures */
:root {
  --apple-font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --apple-font-mono: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --apple-blue: #0071e3;
  --apple-blue-hover: #0077ed;
  --apple-green: #34c759;
  --apple-amber: #ff9f0a;
  --apple-red: #ff3b30;
  --apple-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.apple-tabular-nums,
.tabular-nums,
.stat-value,
.stat-number,
.kpi-value,
.badge-count,
.clock-digits,
.vital-val,
.bed-number {
  font-feature-settings: "tnum" 1, "cv02" 1, "cv03" 1, "cv04" 1 !important;
  font-variant-numeric: tabular-nums !important;
  letter-spacing: -0.015em;
}

/* ==========================================================================
   1. MICROINTERAÇÕES TÁTEIS & FOCUS RINGS (APPLE HIG)
   ========================================================================== */
button:active,
.btn:active,
.stat-card:active,
.nav-item:active,
.apple-spotlight-trigger:active,
.apple-eco-pill:active {
  transform: scale(0.975) !important;
  transition: transform 0.08s var(--apple-ease);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 3.5px rgba(0, 113, 227, 0.25) !important;
  border-color: var(--apple-blue) !important;
}

/* ==========================================================================
   2. GATILHO NATIVO DO SPOTLIGHT NO CABEÇALHO (APPLE SPOTLIGHT TRIGGER)
   ========================================================================== */
.apple-spotlight-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  color: inherit;
  font-family: var(--apple-font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--apple-ease);
  user-select: none;
}

.apple-spotlight-trigger:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(0, 113, 227, 0.45);
  box-shadow: 0 2px 12px rgba(0, 113, 227, 0.15);
}

/* Versão Clara para Cabeçalhos Claros (Passômetro, Plantão, Prontuário) */
.light-mode .apple-spotlight-trigger,
.app-header .apple-spotlight-trigger,
.top-header .apple-spotlight-trigger,
.top-navbar .apple-spotlight-trigger {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: #515154;
}

.light-mode .apple-spotlight-trigger:hover,
.app-header .apple-spotlight-trigger:hover,
.top-header .apple-spotlight-trigger:hover,
.top-navbar .apple-spotlight-trigger:hover {
  background: rgba(0, 0, 0, 0.07);
  border-color: rgba(0, 113, 227, 0.35);
  color: #1d1d1f;
}

.spotlight-trigger-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spotlight-trigger-kbd,
.spotlight-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  font-size: 11px;
  font-family: var(--apple-font-mono);
  font-weight: 600;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.light-mode .spotlight-trigger-kbd,
.light-mode .spotlight-kbd,
.app-header .spotlight-kbd,
.top-header .spotlight-kbd,
.top-navbar .spotlight-kbd {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.1);
  color: #48484a;
}

/* ==========================================================================
   3. APPLE DYNAMIC ISLAND / TOAST NOTIFICATION CAPSULES
   ========================================================================== */
#apple-toast-container,
.apple-toast-container {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 480px;
}

.apple-toast {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 9999px;
  background: rgba(24, 24, 28, 0.94);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.15);
  color: #f5f5f7;
  font-family: var(--apple-font-sans);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  animation: appleToastIn 0.35s var(--apple-ease) forwards;
  transition: all 0.25s var(--apple-ease);
  cursor: pointer;
  user-select: none;
}

.apple-toast:hover {
  transform: scale(1.02);
}

.apple-toast.toast-closing {
  animation: appleToastOut 0.25s var(--apple-ease) forwards;
}

.toast-icon-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.apple-toast.success .toast-icon-circle {
  background: rgba(52, 199, 89, 0.2);
  color: var(--apple-green);
  border: 1px solid rgba(52, 199, 89, 0.4);
}
.apple-toast.warning .toast-icon-circle {
  background: rgba(255, 159, 10, 0.2);
  color: var(--apple-amber);
  border: 1px solid rgba(255, 159, 10, 0.4);
}
.apple-toast.error .toast-icon-circle {
  background: rgba(255, 59, 48, 0.2);
  color: var(--apple-red);
  border: 1px solid rgba(255, 59, 48, 0.4);
}
.apple-toast.info .toast-icon-circle {
  background: rgba(0, 113, 227, 0.2);
  color: var(--apple-blue);
  border: 1px solid rgba(0, 113, 227, 0.4);
}

@keyframes appleToastIn {
  0% { opacity: 0; transform: translateY(-24px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes appleToastOut {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-20px) scale(0.9); }
}

/* ==========================================================================
   4. APPLE SPOTLIGHT COMMAND PALETTE (macOS Style)
   ========================================================================== */
.apple-spotlight-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 11vh;
  animation: appleFadeIn 0.2s var(--apple-ease);
}

.apple-spotlight-palette {
  width: 92%;
  max-width: 640px;
  background: rgba(28, 28, 32, 0.94);
  backdrop-filter: blur(36px) saturate(200%);
  -webkit-backdrop-filter: blur(36px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: applePaletteScale 0.22s var(--apple-ease);
}

.spotlight-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.spotlight-glass-icon {
  color: #86868b;
  flex-shrink: 0;
}

.spotlight-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--apple-font-sans);
  font-size: 16px;
  font-weight: 400;
  outline: none;
}

.spotlight-input-row input::placeholder {
  color: #86868b;
}

.spotlight-esc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
  font-size: 10px;
  font-family: var(--apple-font-mono);
  font-weight: 600;
  color: #86868b;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.spotlight-results {
  max-height: 52vh;
  overflow-y: auto;
  padding: 8px 10px;
}

.spotlight-group-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #86868b;
  padding: 8px 12px 4px;
}

.spotlight-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.12s var(--apple-ease);
  color: #f5f5f7;
}

.spotlight-item:hover,
.spotlight-item.selected {
  background: rgba(0, 113, 227, 0.88);
  color: #ffffff;
}

.spotlight-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spotlight-item-icon {
  font-size: 18px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spotlight-item-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.spotlight-item-desc {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 1px;
}

.spotlight-item:hover .spotlight-item-desc,
.spotlight-item.selected .spotlight-item-desc {
  color: rgba(255, 255, 255, 0.9);
}

.spotlight-item-badge {
  font-size: 10.5px;
  font-family: var(--apple-font-mono);
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.spotlight-item:hover .spotlight-item-badge,
.spotlight-item.selected .spotlight-item-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.spotlight-footer {
  padding: 10px 18px;
  background: rgba(20, 20, 24, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #86868b;
}

.spotlight-shortcuts-hint {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spotlight-shortcuts-hint kbd {
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-family: var(--apple-font-mono);
}

.spotlight-tag {
  font-weight: 500;
}

@keyframes appleFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes applePaletteScale {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ==========================================================================
   5. OCULTAÇÃO DO WIDGET ANTIGO (SEGUINDO A DIRETRIZ DE NÃO APRESENTAR O WIDGET)
   ========================================================================== */
#appleEcosystemBar,
.apple-ecosystem-bar {
  display: none !important;
}

/* ==========================================================================
   6. PROTEÇÃO DE IMPRESSÃO (ESPAÇAMENTO DE BORDAS 1 CM)
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 1cm;
  }
  .apple-spotlight-overlay,
  #apple-toast-container,
  .apple-toast-container,
  .no-print {
    display: none !important;
  }
}


/* ==========================================================
   APPLE HIG LOGIN GATE MODAL (ECOSSISTEMA INTEGRADO)
   ========================================================== */
.pep-login-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 15% 20%, rgba(0, 113, 227, 0.08), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(124, 58, 237, 0.06), transparent 45%),
    linear-gradient(135deg, rgba(248, 250, 252, 0.94) 0%, rgba(241, 245, 249, 0.96) 55%, rgba(226, 232, 240, 0.98) 100%);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  overflow-y: auto;
  animation: fadeIn 0.25s ease;
}

[data-theme="dark"] .pep-login-gate-overlay,
html.dark .pep-login-gate-overlay {
  background:
    radial-gradient(circle at 15% 20%, rgba(0, 113, 227, 0.24), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(124, 58, 237, 0.22), transparent 45%),
    linear-gradient(135deg, rgba(6, 11, 25, 0.92) 0%, rgba(15, 23, 42, 0.94) 55%, rgba(9, 14, 28, 0.96) 100%);
}

.pep-login-gate-overlay.hidden {
  display: none !important;
}

.pep-login-gate-card {
  width: 100%;
  max-width: 1040px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: #ffffff;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .pep-login-gate-card,
html.dark .pep-login-gate-card {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.pep-login-gate-left {
  padding: 32px 30px;
  background: linear-gradient(155deg, #f8fafc 0%, #f1f5f9 60%, #e2e8f0 100%);
  color: #0f172a;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid rgba(226, 232, 240, 0.9);
}

.pep-login-gate-left .pep-login-title {
  color: #0f172a;
}
.pep-login-gate-left .pep-login-subtitle {
  color: #475569;
}
.pep-login-gate-left .pep-compliance-pill {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
}
.pep-login-gate-left .pep-scope-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #334155;
}
.pep-login-gate-left .pep-scope-text strong {
  color: #0f172a;
}
.pep-login-gate-left .pep-scope-text span {
  color: #475569;
}

[data-theme="dark"] .pep-login-gate-left,
html.dark .pep-login-gate-left {
  background: linear-gradient(155deg, #0f172a 0%, #1e293b 60%, #0f172a 100%);
  color: #f8fafc;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .pep-login-gate-left .pep-login-title,
html.dark .pep-login-gate-left .pep-login-title {
  color: #ffffff;
}
[data-theme="dark"] .pep-login-gate-left .pep-login-subtitle,
html.dark .pep-login-gate-left .pep-login-subtitle {
  color: #94a3b8;
}
[data-theme="dark"] .pep-login-gate-left .pep-compliance-pill,
html.dark .pep-login-gate-left .pep-compliance-pill {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: inherit;
}
[data-theme="dark"] .pep-login-gate-left .pep-scope-item,
html.dark .pep-login-gate-left .pep-scope-item {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.09);
  color: inherit;
}
[data-theme="dark"] .pep-login-gate-left .pep-scope-text strong,
html.dark .pep-login-gate-left .pep-scope-text strong {
  color: #f8fafc;
}
[data-theme="dark"] .pep-login-gate-left .pep-scope-text span,
html.dark .pep-login-gate-left .pep-scope-text span {
  color: #94a3b8;
}

.pep-login-brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.pep-login-brand-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0071e3 0%, #38bdf8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 8px 20px rgba(0, 113, 227, 0.35);
  flex-shrink: 0;
}

.pep-login-eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #38bdf8;
  margin-bottom: 3px;
}

.pep-login-title {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.pep-login-subtitle {
  margin: 4px 0 0 0;
  font-size: 12.5px;
  color: #94a3b8;
}

.pep-login-compliance-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.pep-compliance-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.pep-login-scope-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pep-login-scope-header {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #cbd5e1;
  margin-bottom: 2px;
}

.pep-scope-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.18s ease;
}

.pep-scope-item:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateX(2px);
}

.pep-scope-badge {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.pep-scope-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
  line-height: 1.38;
  color: #cbd5e1;
}

.pep-scope-text strong {
  color: #ffffff;
  font-size: 12.5px;
}

.pep-scope-text code {
  background: rgba(15, 23, 42, 0.7);
  color: #38bdf8;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}

.pep-login-left-footer {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: #94a3b8;
}

.pep-portal-back-link {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 600;
}

.pep-portal-back-link:hover {
  text-decoration: underline;
}

.pep-login-gate-right {
  padding: 30px 30px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pep-login-right-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.pep-login-step-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0071e3;
  background: rgba(0, 113, 227, 0.1);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.pep-login-right-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}

.pep-login-right-header p {
  margin: 3px 0 0 0;
  font-size: 12.5px;
  color: #64748b;
}

.pep-login-error-banner {
  padding: 10px 14px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.pep-input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pep-input-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  pointer-events: none;
}

.pep-input-icon-wrap input {
  width: 100%;
  padding-left: 36px !important;
  padding-right: 38px !important;
  height: 42px;
  border-radius: 10px;
  font-size: 13.5px;
}

.pep-pwd-toggle-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 4px 6px;
  border-radius: 6px;
  opacity: 0.7;
}

.pep-pwd-toggle-btn:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.05);
}

.pep-login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 12px 0;
}

.pep-login-divider::before,
.pep-login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.pep-login-divider span {
  font-size: 10.5px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.05em;
}

.pep-quick-users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 245px;
  overflow-y: auto;
  padding-right: 2px;
  margin-bottom: 12px;
}

.pep-cred-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 11px;
  border: 1px solid #e2e8f0;
  transition: all 0.16s ease;
}

.pep-cred-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.pep-cred-card.inactive {
  opacity: 0.55;
}

.pep-cred-card-main {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.pep-cred-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.pep-cred-info {
  min-width: 0;
  flex: 1;
}

.pep-cred-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pep-cred-name-row strong {
  font-size: 12.5px;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pep-cred-role-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.7);
}

.pep-cred-login-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #475569;
  margin-top: 2px;
}

.pep-cred-login-row code {
  background: rgba(255, 255, 255, 0.85);
  padding: 0 5px;
  border-radius: 4px;
  font-weight: 700;
  color: #0f172a;
}

.pep-cred-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pep-cred-actions .btn-sm {
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
}

.pep-login-info-note {
  padding: 9px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 11.5px;
  color: #475569;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.35;
}

.btn-logout-session {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 4px;
  transition: all 0.15s ease;
}

.btn-logout-session:hover {
  background: #dc2626;
  color: #ffffff;
}

/* Regras Estritas de Habilitação por Perfil (Matriz de Permissões RBAC) */
.nav-item.nav-restricted {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
}

.nav-item.nav-restricted::after {
  content: "🔒" !important;
  position: absolute;
  right: 14px;
  font-size: 11px;
  opacity: 0.85;
}

/* Secretaria: Visualização restrita em Bulário, Exames e Equipe da Secretaria */
body.role-secretaria #panel-medications button[onclick*="openNewMedication"],
body.role-secretaria #panel-medications button[onclick*="editMedication"],
body.role-secretaria #panel-medications button[onclick*="deleteMedication"],
body.role-secretaria #panel-exams button[onclick*="openNewExam"],
body.role-secretaria #panel-exams button[onclick*="deleteExam"],
body.role-secretaria #panel-secretaries button[onclick*="openNewSecretary"],
body.role-secretaria #panel-secretaries button[onclick*="editSecretary"],
body.role-secretaria #panel-secretaries button[onclick*="deleteSecretary"] {
  display: none !important;
}

/* Médico: Visualização em Dados Fiscais da Clínica e Cadastro Geral de Médicos */
body.role-medico #panel-clinic button[type="submit"],
body.role-medico #panel-doctors button[onclick*="openNewDoctor"],
body.role-medico #panel-doctors button[onclick*="deleteDoctor"] {
  display: none !important;
}

/* Administrativo: Consulta em Bulário e Exames, bloqueio estrito de atos médicos */
body.role-administrativo #panel-medications button[onclick*="openNewMedication"],
body.role-administrativo #panel-medications button[onclick*="editMedication"],
body.role-administrativo #panel-medications button[onclick*="deleteMedication"],
body.role-administrativo #panel-exams button[onclick*="openNewExam"],
body.role-administrativo #panel-exams button[onclick*="deleteExam"] {
  display: none !important;
}

@media (max-width: 900px) {
  .pep-login-gate-card {
    grid-template-columns: 1fr;
    max-width: 540px;
  }
  .pep-login-gate-left {
    padding: 22px;
  }
  .pep-login-gate-right {
    padding: 22px;
  }
}

/* Sub-abas do Prontuário como links reais */
a.subtab-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* ==========================================================
   NEFROAI - ESTILOS DO COPILOTO CLÍNICO & ACOMPANHAMENTO LONGITUDINAL
   ========================================================== */

.badge-ai-status {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 9999px;
  transition: all 0.2s ease;
}

.badge-ai-status:hover {
  transform: scale(1.04);
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
}

.nefro-copilot-box {
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s var(--ease-spring);
}

.copilot-status-normal {
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.9), rgba(240, 253, 250, 0.95));
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.copilot-status-warning {
  background: linear-gradient(135deg, rgba(254, 252, 232, 0.9), rgba(255, 251, 235, 0.95));
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.copilot-status-critical {
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.95), rgba(255, 241, 242, 0.98));
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.nefro-copilot-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.nefro-alerts-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.nefro-alert-item {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.nefro-alert-item.critical {
  border-left: 5px solid #ef4444;
}

.nefro-alert-item.warning {
  border-left: 5px solid #f59e0b;
}

/* Gráficos Longitudinais */
.nefro-chart-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

.nefro-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.nefro-chart-tabs {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-md);
}

.nefro-chart-tab-btn {
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.nefro-chart-tab-btn:hover {
  color: #0f172a;
}

.nefro-chart-tab-btn.active {
  background: #ffffff;
  color: #0071e3;
  box-shadow: var(--shadow-sm);
}

.nefro-chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

/* Linha do Tempo Longitudinal */
.nefro-timeline-wrapper {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.nefro-timeline-wrapper::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 19px;
  width: 2px;
  background: #e2e8f0;
}

.nefro-timeline-entry {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  position: relative;
  margin-bottom: 18px;
}

.nefro-timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0071e3;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 2px #93c5fd;
  margin-top: 12px;
  z-index: 1;
  flex-shrink: 0;
}

.nefro-timeline-content {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  flex-grow: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: all 0.2s ease;
}

.nefro-timeline-content:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(0, 113, 227, 0.3);
}

.nefro-timeline-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.nefro-timeline-filter-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 9999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nefro-timeline-filter-btn.active,
.nefro-timeline-filter-btn:hover {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}


/* ==========================================================
   ESTILOS DO MÓDULO AGENDA DA SECRETARIA & RECEPÇÃO (APPLE HIG)
   ========================================================== */

.sec-cockpit-header {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sec-doctor-nav-bar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 14px 2px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.sec-doctor-card-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 240px;
  flex-shrink: 0;
  text-align: left;
}

.sec-doctor-card-tab:hover {
  border-color: #0071e3;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.08);
}

.sec-doctor-card-tab.active {
  background: #eff6ff;
  border-color: #0071e3;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.14);
}

.sec-doctor-tab-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: #e2e8f0;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sec-doctor-tab-info {
  flex: 1;
  min-width: 0;
}

.sec-doctor-tab-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sec-doctor-tab-spec {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sec-doctor-tab-chips {
  display: flex;
  gap: 5px;
  margin-top: 4px;
}

.sec-doctor-mini-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 9999px;
  background: #f1f5f9;
  color: #475569;
}

.sec-doctor-card-tab.active .sec-doctor-mini-chip {
  background: #dbeafe;
  color: #1e40af;
}

/* KPIs de Recepção */
.sec-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.sec-kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease;
}

.sec-kpi-card:hover {
  transform: translateY(-1px);
}

.sec-kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.sec-kpi-icon.blue { background: #eff6ff; color: #0071e3; }
.sec-kpi-icon.indigo { background: #e0e7ff; color: #4338ca; }
.sec-kpi-icon.amber { background: #fef3c7; color: #d97706; }
.sec-kpi-icon.purple { background: #f3e8ff; color: #7e22ce; }
.sec-kpi-icon.emerald { background: #d1fae5; color: #059669; }

.sec-kpi-info {
  display: flex;
  flex-direction: column;
}

.sec-kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.3px;
}

.sec-kpi-val {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

/* Sub-navegação interna da Secretaria */
.sec-subnav-pills {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 20px;
  width: fit-content;
  flex-wrap: wrap;
}

.sec-subnav-btn {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sec-subnav-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Grade de Horários / Timeline de Slots */
.sec-slots-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.sec-slot-card {
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sec-slot-card.free {
  border-left: 4px solid #10b981;
  background: #f0fdf4;
}

.sec-slot-card.busy {
  border-left: 4px solid #0071e3;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.sec-slot-card.waiting {
  border-left: 4px solid #f59e0b;
  background: #fffbeb;
  animation: pulse-border 2s infinite;
}

.sec-slot-card.active-care {
  border-left: 4px solid #8b5cf6;
  background: #faf5ff;
}

.sec-slot-card.break {
  border-left: 4px solid #94a3b8;
  background: #f8fafc;
  opacity: 0.85;
}

.sec-slot-time-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.sec-slot-time {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

/* Badges de Status da Recepção */
.sec-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.sec-status-agendado { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.sec-status-confirmado { background: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; }
.sec-status-aguardando { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.sec-status-ematendimento { background: #f3e8ff; color: #7e22ce; border: 1px solid #e9d5ff; }
.sec-status-concluido { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.sec-status-cancelado { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Tag de Tempo de Espera */
.sec-waiting-timer {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  padding: 2px 7px;
  border-radius: 4px;
}

/* Card de Conciliação Ativa no PEP */
.pep-appointment-active-card {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1.5px solid #3b82f6;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.12);
}

/* ==========================================================
   APPLE HIG - BADGE PARA ITENS DE NAVEGAÇÃO DA SIDEBAR
   ========================================================== */
.nav-badge-apple {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(0, 113, 227, 0.1);
  color: #0071e3;
  border: 1px solid rgba(0, 113, 227, 0.22);
  letter-spacing: -0.01em;
  transition: all 0.15s cubic-bezier(0.22, 1, 0.36, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.nav-item:hover .nav-badge-apple {
  background: rgba(0, 113, 227, 0.18);
  border-color: rgba(0, 113, 227, 0.4);
}

.nav-item.active .nav-badge-apple {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.45);
}


/* ==========================================================
   APPLE HIG - BOTÕES SEPARADOS DE AÇÕES CLÍNICAS DO PEP
   Opções: 1. Anamnese, 2. Retornos/Evolução, 3. Exames de Resultados,
           4. Receita Médica, 5. Atestados, 6. Relatórios & Laudos,
           7. NefroAI & Longitudinal
   ========================================================== */

.clinical-pep-button-bar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
  padding: 2px 0 6px 0;
  width: 100%;
  box-sizing: border-box;
}

.pep-tab-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: #ffffff;
  border: 1.5px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  text-decoration: none;
  color: #1d1d1f;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.pep-tab-btn:hover {
  background: #f8fafc;
  border-color: rgba(0, 113, 227, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 113, 227, 0.1);
  color: #0071e3;
}

.pep-tab-btn:active {
  transform: scale(0.975);
}

.pep-tab-btn.active {
  background: #0071e3 !important;
  color: #ffffff !important;
  border-color: #0071e3 !important;
  box-shadow: 0 6px 18px rgba(0, 113, 227, 0.35) !important;
}

.pep-btn-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #475569;
  font-family: var(--apple-font-mono, monospace);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.pep-tab-btn:hover .pep-btn-num {
  background: rgba(0, 113, 227, 0.12);
  color: #0071e3;
}

.pep-tab-btn.active .pep-btn-num {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}

.pep-btn-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(0, 113, 227, 0.08);
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pep-tab-btn:hover .pep-btn-icon {
  background: rgba(0, 113, 227, 0.15);
  transform: scale(1.06);
}

.pep-tab-btn.active .pep-btn-icon {
  background: rgba(255, 255, 255, 0.22);
}

.pep-btn-content {
  display: flex;
  flex-direction: column;
  text-align: left;
  min-width: 0;
  overflow: hidden;
}

.pep-btn-title {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pep-btn-desc {
  font-size: 10.5px;
  color: #64748b;
  font-weight: 500;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
}

.pep-tab-btn:hover .pep-btn-desc {
  color: #475569;
}

.pep-tab-btn.active .pep-btn-desc {
  color: rgba(255, 255, 255, 0.88) !important;
}


/* ==========================================================================
   UNIFIED THEME SYSTEM (APPLE HIG LIGHT & DARK ECOSYSTEM)
   Dr. Yoshimi Watanabe — Design Limpo, Suave, Profissional & Confortável
   ========================================================================== */

:root,
[data-theme="light"],
html.light,
body.light {
  --y-bg-base: #f8fafc;
  --y-bg-alt: #f1f5f9;
  --y-bg-surface: #ffffff;
  --y-bg-surface-elevated: #ffffff;
  --y-bg-subtle: #f8fafc;
  --y-border-subtle: rgba(226, 232, 240, 0.95);
  --y-border-strong: #cbd5e1;
  --y-text-primary: #0f172a;
  --y-text-secondary: #475569;
  --y-text-muted: #64748b;
  --y-primary-accent: #0071e3;
  --y-primary-hover: #0077ed;
  --y-accent-soft: rgba(0, 113, 227, 0.08);
  --y-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 10px 25px -5px rgba(0, 0, 0, 0.04);
  --y-card-shadow-hover: 0 12px 30px -8px rgba(0, 113, 227, 0.14), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --y-nav-glass: rgba(255, 255, 255, 0.88);
  color-scheme: light;
}

[data-theme="dark"],
html.dark,
body.dark {
  --y-bg-base: #090d16;
  --y-bg-alt: #0d1424;
  --y-bg-surface: #111827;
  --y-bg-surface-elevated: #162032;
  --y-bg-subtle: #1e293b;
  --y-border-subtle: rgba(255, 255, 255, 0.1);
  --y-border-strong: rgba(255, 255, 255, 0.18);
  --y-text-primary: #f8fafc;
  --y-text-secondary: #cbd5e1;
  --y-text-muted: #94a3b8;
  --y-primary-accent: #38bdf8;
  --y-primary-hover: #0ea5e9;
  --y-accent-soft: rgba(56, 189, 248, 0.12);
  --y-card-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  --y-card-shadow-hover: 0 14px 36px rgba(56, 189, 248, 0.22);
  --y-nav-glass: rgba(13, 20, 36, 0.88);
  color-scheme: dark;
}

/* Transições fluidas ao alternar temas */
body,
header,
nav,
aside,
main,
section,
.apple-glass-card,
.apple-nav-pill,
.card,
.stat-card {
  transition: background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   BOTAO DE ALTERNANCIA DE TEMA (APPLE CAPSULE TOGGLE)
   ========================================================================== */
.yoshimi-theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-family: var(--apple-font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: 1px solid var(--y-border-subtle);
  background: var(--y-nav-glass);
  color: var(--y-text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  user-select: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.yoshimi-theme-toggle-btn:hover {
  background: var(--y-bg-surface);
  border-color: var(--y-primary-accent);
  color: var(--y-primary-accent);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.15);
  transform: translateY(-1px);
}

.yoshimi-theme-toggle-btn:active {
  transform: scale(0.96) !important;
}

.theme-toggle-icon {
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  transition: transform 0.3s ease;
}

.yoshimi-theme-toggle-btn:hover .theme-toggle-icon {
  transform: rotate(20deg) scale(1.15);
}

.theme-toggle-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Ajustes de componentes Apple quando no tema escuro/claro */
[data-theme="light"] .apple-spotlight-btn,
html.light .apple-spotlight-btn {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: #475569;
}

[data-theme="light"] .apple-spotlight-btn:hover,
html.light .apple-spotlight-btn:hover {
  background: rgba(0, 0, 0, 0.07);
  border-color: rgba(0, 113, 227, 0.35);
  color: #0071e3;
}

[data-theme="light"] .apple-spotlight-btn .spotlight-kbd,
html.light .apple-spotlight-btn .spotlight-kbd {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.1);
  color: #64748b;
}


/* Suporte Suave e Claro aos Estados Bloqueados dos Apps */
html.pep-locked, body.pep-locked,
html.dash-locked, body.dash-locked,
html.passometro-locked, body.passometro-locked,
html.plantao-locked, body.plantao-locked {
  background-color: #f8fafc !important;
}

[data-theme="dark"].pep-locked, [data-theme="dark"] body.pep-locked,
html.dark.pep-locked, html.dark body.pep-locked,
html.dark.dash-locked, html.dark body.dash-locked,
html.dark.passometro-locked, html.dark body.passometro-locked,
html.dark.plantao-locked, html.dark body.plantao-locked {
  background-color: #090e1c !important;
}

/* Item Fechar Sistema no Menu Lateral */
.nav-item.nav-item-exit {
  color: #ef4444 !important;
  font-weight: 700 !important;
  border-radius: 8px;
  transition: all 0.18s ease;
  margin-top: 4px;
}
.nav-item.nav-item-exit:hover {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #dc2626 !important;
  transform: translateX(3px);
}
.nav-item.nav-item-exit .nav-icon {
  stroke: #ef4444 !important;
}
.nav-item.nav-item-exit:hover .nav-icon {
  stroke: #dc2626 !important;
}
