/* ═══════════════════════════════════════════════════════════
   NeuroAvalia — Design System v1.0
   Tokens, base components, utilities
   ═══════════════════════════════════════════════════════════ */

/* ── Custom Properties ── */
:root {
  /* Brand */
  --clr-primary:       #6366f1;
  --clr-primary-dark:  #4f46e5;
  --clr-primary-light: #e0e7ff;
  --clr-primary-xs:    #f0f0ff;

  /* Sidebar */
  --sidebar-bg:          #0f172a;
  --sidebar-width:       260px;
  --sidebar-text:        rgba(255,255,255,0.60);
  --sidebar-text-hover:  rgba(255,255,255,0.90);
  --sidebar-text-active: #ffffff;
  --sidebar-item-hover:  rgba(255,255,255,0.055);
  --sidebar-item-active: rgba(99,102,241,0.18);
  --sidebar-border:      rgba(255,255,255,0.07);

  /* Content */
  --bg:       #f1f5f9;
  --surface:  #ffffff;
  --border:   #e2e8f0;
  --border-2: #cbd5e1;

  /* Default light fallback — evita flash escuro antes de qualquer classe de tema */
  --bg-fundo:        #F1F5F9;
  --texto-principal: #0F172A;

  /* Text */
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;

  /* Status */
  --clr-success:    #10b981;
  --clr-success-bg: #f0fdf4;
  --clr-success-bd: #a7f3d0;
  --clr-warn:       #f59e0b;
  --clr-warn-bg:    #fffbeb;
  --clr-warn-bd:    #fcd34d;
  --clr-danger:     #ef4444;
  --clr-danger-bg:  #fef2f2;
  --clr-danger-bd:  #fca5a5;
  --clr-neutral-bg: #f8fafc;
  --clr-neutral-bd: #cbd5e1;

  /* Border radius */
  --r-xs: 4px;
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Shadows */
  --sh-xs: 0 1px 2px rgba(0,0,0,.06);
  --sh-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --sh:    0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --sh-lg: 0 12px 40px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.07);
  --sh-xl: 0 24px 64px rgba(0,0,0,.16), 0 8px 24px rgba(0,0,0,.08);

  /* Botão Voltar — altere aqui para mudar em todo o projeto */
  --btn-voltar-bg:           rgba(239,68,68,0.15);
  --btn-voltar-bg-hover:     rgba(239,68,68,0.30);
  --btn-voltar-border:       rgba(239,68,68,0.50);
  --btn-voltar-border-hover: rgba(239,68,68,0.80);
  --btn-voltar-color:        #fca5a5;
  --btn-voltar-color-hover:  #ffffff;

  /* Font */
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Transitions */
  --t-fast: 120ms ease;
  --t:      180ms ease;
  --t-slow: 280ms ease;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background-color: #F1F5F9 !important;
  color: #0F172A !important;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: none !important;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-1);
  letter-spacing: -0.02em;
}

/* ── Links ── */
a { color: var(--clr-primary); text-decoration: none; }
a:hover { color: var(--clr-primary-dark); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ════════════════════════════════════
   BUTTONS
   ════════════════════════════════════ */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast), opacity var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}
.ds-btn:active { transform: translateY(1px); }
.ds-btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.ds-btn-primary {
  background: var(--clr-primary);
  color: #fff;
  box-shadow: 0 1px 4px rgba(99,102,241,.35);
}
.ds-btn-primary:hover {
  background: var(--clr-primary-dark);
  box-shadow: 0 4px 12px rgba(99,102,241,.35);
}

.ds-btn-secondary {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.ds-btn-secondary:hover {
  background: var(--bg);
  color: var(--text-1);
  border-color: var(--border-2);
}

.ds-btn-danger {
  background: var(--clr-danger);
  color: #fff;
}
.ds-btn-danger:hover { background: #dc2626; box-shadow: 0 4px 12px rgba(239,68,68,.3); }

/* ── Botão Voltar — cor controlada pelas variáveis --btn-voltar-* em :root ── */
.btn-voltar {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 7px 16px !important;
  border-radius: var(--r-sm, 6px) !important;
  border: 1px solid var(--btn-voltar-border) !important;
  background: var(--btn-voltar-bg) !important;
  color: var(--btn-voltar-color) !important;
  font-family: var(--font, 'Inter', sans-serif) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  text-decoration: none !important;
  transition: background var(--t-fast, 120ms ease), border-color var(--t-fast, 120ms ease), color var(--t-fast, 120ms ease) !important;
}
.btn-voltar:hover {
  background: var(--btn-voltar-bg-hover) !important;
  border-color: var(--btn-voltar-border-hover) !important;
  color: var(--btn-voltar-color-hover) !important;
}
.btn-voltar:active { transform: translateY(1px); }

.ds-btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid transparent;
}
.ds-btn-ghost:hover { background: var(--bg); color: var(--text-1); border-color: var(--border); }

.ds-btn-sm { padding: 6px 12px; font-size: 12px; }
.ds-btn-lg { padding: 12px 24px; font-size: 14px; }

/* ════════════════════════════════════
   CARDS
   ════════════════════════════════════ */
.ds-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  padding: 24px;
}

.ds-card-header {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ════════════════════════════════════
   FORMS
   ════════════════════════════════════ */
.ds-form-group { margin-bottom: 16px; }

.ds-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.ds-form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-1);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  outline: none;
}
.ds-form-input:hover { border-color: var(--border-2); }
.ds-form-input:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
  background: #fff;
}
.ds-form-input::placeholder { color: var(--text-3); }

select.ds-form-input { cursor: pointer; }

/* ════════════════════════════════════
   BADGES / STATUS
   ════════════════════════════════════ */
.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.ds-badge-primary { background: var(--clr-primary-light); color: var(--clr-primary-dark); }
.ds-badge-success { background: var(--clr-success-bg); color: #065f46; border: 1px solid var(--clr-success-bd); }
.ds-badge-warn    { background: var(--clr-warn-bg);    color: #78350f; border: 1px solid var(--clr-warn-bd); }
.ds-badge-danger  { background: var(--clr-danger-bg);  color: #991b1b; border: 1px solid var(--clr-danger-bd); }
.ds-badge-neutral { background: var(--clr-neutral-bg); color: var(--text-3); border: 1px solid var(--clr-neutral-bd); }

/* Status badges (used in heatmap/tables) */
.st-green  { background: var(--clr-success-bg); color: #065f46; padding: 4px 12px; border-radius: 8px; font-weight: 700; font-size: 12px; }
.st-yellow { background: var(--clr-warn-bg);    color: #78350f; padding: 4px 12px; border-radius: 8px; font-weight: 700; font-size: 12px; }
.st-red    { background: var(--clr-danger-bg);  color: #991b1b; padding: 4px 12px; border-radius: 8px; font-weight: 700; font-size: 12px; }
.st-gray   { background: var(--clr-neutral-bg); color: var(--text-3); padding: 4px 12px; border-radius: 8px; font-weight: 700; font-size: 12px; }

/* ════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes shimmer {
  from { background-position: -400px 0; }
  to   { background-position: 400px 0; }
}

.ds-anim-fade-up  { animation: fadeUp  0.35s ease both; }
.ds-anim-fade-in  { animation: fadeIn  0.25s ease both; }

/* Staggered children */
.ds-anim-fade-up > *:nth-child(1) { animation-delay: 0.0s; }
.ds-anim-fade-up > *:nth-child(2) { animation-delay: 0.05s; }
.ds-anim-fade-up > *:nth-child(3) { animation-delay: 0.10s; }
.ds-anim-fade-up > *:nth-child(4) { animation-delay: 0.15s; }
.ds-anim-fade-up > *:nth-child(5) { animation-delay: 0.20s; }

/* ════════════════════════════════════
   UTILITY CLASSES
   ════════════════════════════════════ */
.ds-text-1 { color: var(--text-1); }
.ds-text-2 { color: var(--text-2); }
.ds-text-3 { color: var(--text-3); }
.ds-text-primary { color: var(--clr-primary); }
.ds-text-success { color: var(--clr-success); }
.ds-text-warn    { color: var(--clr-warn); }
.ds-text-danger  { color: var(--clr-danger); }

.ds-surface { background: var(--surface); }
.ds-bg      { background: var(--bg); }

.ds-border  { border: 1px solid var(--border); }
.ds-rounded { border-radius: var(--r); }
.ds-shadow  { box-shadow: var(--sh); }

.ds-flex    { display: flex; }
.ds-flex-center { display: flex; align-items: center; justify-content: center; }
.ds-flex-between { display: flex; align-items: center; justify-content: space-between; }
.ds-gap-2  { gap: 8px; }
.ds-gap-3  { gap: 12px; }
.ds-gap-4  { gap: 16px; }

.ds-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ════════════════════════════════════
   DIVIDER
   ════════════════════════════════════ */
.ds-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ════════════════════════════════════
   AVATAR
   ════════════════════════════════════ */
.ds-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--clr-primary-light);
  color: var(--clr-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.ds-avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.ds-avatar-lg { width: 48px; height: 48px; font-size: 16px; }

/* ════════════════════════════════════
   TABLE
   ════════════════════════════════════ */
.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ds-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.ds-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.ds-table tr:last-child td { border-bottom: none; }
.ds-table tr:hover td { background: var(--bg); }

/* ════════════════════════════════════
   ALERT / CROSS-ALERT
   ════════════════════════════════════ */
.ds-alert {
  padding: 14px 16px;
  border-radius: var(--r);
  border-left: 4px solid;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 10px;
}
.ds-alert strong { display: block; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.ds-alert-red    { background: var(--clr-danger-bg);  border-color: var(--clr-danger);  color: #991b1b; }
.ds-alert-yellow { background: var(--clr-warn-bg);    border-color: var(--clr-warn);    color: #78350f; }
.ds-alert-blue   { background: #dbeafe;                border-color: #3b82f6;            color: #1e40af; }
.ds-alert-green  { background: var(--clr-success-bg); border-color: var(--clr-success); color: #065f46; }

/* ════════════════════════════════════
   INPUT GROUP (icon inside)
   ════════════════════════════════════ */
.ds-input-group { position: relative; }
.ds-input-group .ds-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 15px;
  pointer-events: none;
}
.ds-input-group .ds-form-input { padding-left: 38px; }

.theme-futurista {
  --ft-bg: #0B0E14;
  --ft-surface: rgba(255, 255, 255, 0.03);
  --ft-border: rgba(0, 229, 255, 0.15);
  --ft-text: #FFFFFF;
  --ft-muted: #8899A6;
  --ft-accent: #04525b;
  --ft-accent-2: #1e3a5f;
  --clr-primary: var(--ft-accent);
  --clr-primary-dark: #00B8CC;
  --clr-primary-light: rgba(0, 229, 255, 0.18);
  --clr-primary-xs: rgba(0, 229, 255, 0.06);
  --sidebar-bg: var(--ft-bg);
  --sidebar-text: rgba(255,255,255,0.65);
  --sidebar-text-hover: rgba(255,255,255,0.90);
  --sidebar-text-active: #ffffff;
  --sidebar-item-hover: rgba(255,255,255,0.055);
  --sidebar-item-active: rgba(0, 229, 255, 0.12);
  --sidebar-border: rgba(255,255,255,0.07);
  --bg: var(--ft-bg);
  --surface: var(--ft-surface);
  --border: var(--ft-border);
  --border-2: rgba(255, 255, 255, 0.18);
  --text-1: var(--ft-text);
  --text-2: rgba(136, 153, 166, 0.95);
  --text-3: rgba(255,255,255,0.45);
  background: var(--ft-bg);
  color: var(--ft-text);
  color-scheme: dark;
}

.theme-futurista a { color: var(--ft-accent); }
.theme-futurista a:hover { color: #78F2FF; }

.theme-futurista .ds-layout { display: flex; min-height: 100vh; }

.theme-futurista .ds-sidebar {
  width: 260px;
  background: rgba(13, 17, 23, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: rgba(255,255,255,0.65);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  border-right: 1px solid rgba(0, 229, 255, 0.1);
}

.theme-futurista .ds-sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 15px 28px;
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.06) 0%, transparent 100%);
  border-bottom: 1px solid rgba(0, 229, 255, 0.1);
  text-align: center;
}

.theme-futurista .ds-sidebar-logo {
  width: 190px;
  height: auto;
  filter: drop-shadow(0 0 14px rgba(0, 229, 255, 0.5))
          drop-shadow(0 0 32px rgba(0, 229, 255, 0.25))
          drop-shadow(0 0 60px rgba(0, 229, 255, 0.12));
  image-rendering: -webkit-optimize-contrast;
  margin-bottom: 15px;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.theme-futurista .ds-sidebar-logo:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 0 18px rgba(0, 229, 255, 0.7))
          drop-shadow(0 0 40px rgba(0, 229, 255, 0.35));
}

.theme-futurista .ds-sidebar-title {
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin: 0;
  text-shadow: 0 0 20px rgba(0, 229, 255, 0.25), 0 0 40px rgba(0, 229, 255, 0.1);
}

.theme-futurista .ds-sidebar-crp {
  color: var(--ft-accent);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2px;
  opacity: 0.8;
  margin-top: 5px;
}

.theme-futurista .ds-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 12px 10px;
}

.theme-futurista .ds-nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px 8px 24px;
  background: transparent;
  border-radius: 6px;
  color: rgba(255,255,255,0.60);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font, sans-serif);
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease;
  cursor: pointer;
  position: relative;
  border: none;
  width: 100%;
  text-align: left;
}

.theme-futurista .ds-nav-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 60%;
  background: #04525b;
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px rgba(0,229,255,0.6);
  transition: transform 180ms ease;
}

.theme-futurista .ds-nav-btn:hover {
  background: rgba(0, 229, 255, 0.07);
  color: #FFFFFF;
}

.theme-futurista .ds-nav-btn.active {
  background: rgba(0, 229, 255, 0.05);
  color: #FFFFFF;
  font-weight: 600;
}

.theme-futurista .ds-nav-btn.active::before { transform: translateY(-50%) scaleY(1); }

.theme-futurista .ds-sidebar-footer {
  margin-top: auto;
  padding: 12px 10px;
  border-top: 1px solid rgba(0, 229, 255, 0.08);
}

.theme-futurista .ds-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #8899A6;
  border: 1px solid rgba(0, 229, 255, 0.12);
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font, sans-serif);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
  text-align: center;
  justify-content: center;
}

.theme-futurista .ds-back-link:hover {
  transform: translateY(-2px);
  border-color: var(--ft-accent);
  color: #FFFFFF;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 0 18px rgba(0, 229, 255, 0.22);
}

.theme-futurista .ds-main {
  flex: 1;
  margin-left: 0;
  padding: 20px 44px;
  min-height: 100vh;
  background: var(--ft-bg);
  color: #E0E0E0;
}

.theme-futurista .ds-test-header { margin: 0 0 18px 0; }

.theme-futurista .ds-test-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--texto-principal, #FFFFFF);
  letter-spacing: -0.02em;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.18);
}

.theme-futurista .ds-test-subtitle {
  margin: 6px 0 0 0;
  font-size: 13px;
  color: rgba(136, 153, 166, 0.95);
  line-height: 1.5;
}

.theme-futurista .ds-sidebar-nav { display: none; }

.theme-futurista .ds-main .ds-sidebar-title,
.theme-futurista .ds-main .ds-sidebar-crp {
  display: none !important;
}

.theme-futurista .ds-main .ds-tabs { display: none; }
.theme-futurista .test-container > .ds-tabs { display: flex; width: 100%; }

.theme-futurista .ds-main h1,
.theme-futurista .ds-main h2,
.theme-futurista .ds-main h3,
.theme-futurista .ds-main h4,
.theme-futurista .ds-main h5,
.theme-futurista .ds-main h6 {
  color: #FFFFFF;
}

.theme-futurista .ds-main p,
.theme-futurista .ds-main label,
.theme-futurista .ds-main span {
  color: #E0E0E0;
}

.theme-futurista .test-container {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 20px;
  padding: 40px;
  margin-top: 20px;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
}

.theme-futurista .test-container input:not([type="radio"]):not([type="checkbox"]):not([type="range"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
.theme-futurista .test-container select,
.theme-futurista .test-container textarea {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #FFFFFF !important;
  border: 1px solid #333 !important;
  padding: 10px !important;
  border-radius: 8px !important;
  width: 100%;
  outline: none;
}

.theme-futurista .test-container input:focus,
.theme-futurista .test-container select:focus,
.theme-futurista .test-container textarea:focus {
  border-color: var(--ft-accent) !important;
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.18) !important;
}

.theme-futurista .test-container input::placeholder,
.theme-futurista .test-container textarea::placeholder {
  color: rgba(224, 224, 224, 0.70) !important;
}

.theme-futurista .test-container small { color: rgba(224, 224, 224, 0.70) !important; }

.theme-futurista .ds-glass-card {
  background: var(--ft-surface) !important;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--ft-border) !important;
  border-radius: 20px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
}

.theme-futurista .ds-glass-container {
  padding: 40px !important;
  max-width: 1100px;
  margin: 0 auto;
}

.theme-futurista .ds-tabs {
  display: flex;
  gap: 22px;
  align-items: center;
  margin: 0 0 24px 0;
  padding: 0 0 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.theme-futurista .ds-tab {
  appearance: none;
  background: transparent;
  border: none;
  color: rgba(136, 153, 166, 0.95);
  font-family: var(--font, sans-serif);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 10px 0;
  cursor: pointer;
  position: relative;
  text-transform: uppercase;
  transition: color 160ms ease;
}

.theme-futurista .ds-tab:hover { color: #FFFFFF; }

.theme-futurista .ds-tab::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -14px;
  height: 2px;
  background: var(--ft-accent);
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.55);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 160ms ease;
  border-radius: 99px;
}

.theme-futurista .ds-tab.active {
  color: #FFFFFF;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.18);
}
.theme-futurista .ds-tab.active::after { transform: scaleX(1); }

.theme-futurista .ds-glass-card table {
  width: 100%;
  border-collapse: collapse;
}
.theme-futurista .ds-glass-card th,
.theme-futurista .ds-glass-card td {
  border-color: rgba(255, 255, 255, 0.10) !important;
  color: rgba(255, 255, 255, 0.90);
}
.theme-futurista .ds-glass-card th {
  background: rgba(0, 229, 255, 0.08) !important;
  color: #FFFFFF !important;
}
.theme-futurista .ds-glass-card td { background: rgba(0, 0, 0, 0.10) !important; }

.theme-futurista .ds-glass-card input,
.theme-futurista .ds-glass-card select,
.theme-futurista .ds-glass-card textarea {
  width: 100%;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.24);
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.16);
  border-radius: 12px;
  font-family: var(--font, sans-serif);
  font-size: 14px;
  color: #FFFFFF;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.theme-futurista .ds-glass-card input::placeholder,
.theme-futurista .ds-glass-card textarea::placeholder {
  color: rgba(255,255,255,0.45);
}

.theme-futurista .ds-glass-card input:focus,
.theme-futurista .ds-glass-card select:focus,
.theme-futurista .ds-glass-card textarea:focus {
  border-bottom-color: var(--ft-accent);
  box-shadow: 0 10px 30px rgba(0, 229, 255, 0.12);
  background: rgba(0, 0, 0, 0.34);
}

.theme-futurista .ds-btn-primary-futurista {
  background: linear-gradient(90deg, var(--ft-accent-2), var(--ft-accent));
  color: #FFFFFF;
  border: none;
  font-weight: 800;
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.35), 0 12px 36px rgba(0,0,0,0.45);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.theme-futurista .ds-btn-primary-futurista:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.45), 0 18px 46px rgba(0,0,0,0.55);
  filter: saturate(1.05);
}

.theme-futurista .ds-btn-primary-futurista:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

@media (max-width: 900px) {
  .theme-futurista .ds-main { padding: 16px 18px; }
  .theme-futurista .ds-glass-container { padding: 26px; }
  .theme-futurista .ds-tabs { gap: 14px; }
  .theme-futurista .ds-tab { font-size: 12px; letter-spacing: 0.03em; }
}

/* ── Variáveis de Tema Dual (Claro / Escuro) ── */

/* Valores padrão do futurista (modo escuro) */
.theme-futurista {
  --bg-fundo:           #0B0E14;
  --bg-card:            rgba(26, 31, 46, 0.88);
  --bg-input:           rgba(255,255,255,0.06);
  --texto-principal:    #E2E8F0;
  --texto-secundario:   #94A3B8;
  --bordas:             rgba(255,255,255,0.10);
  --theme-bg:           #0B0E14;
  --theme-surface:      rgba(255,255,255,0.04);
  --theme-text:         #E2E8F0;
  --theme-text-muted:   #94A3B8;
  --theme-border:       rgba(255,255,255,0.08);
}

/* Valores do modo claro — aplicados quando html.light-mode está ativo */
html.light-mode .theme-futurista,
html.light-mode body.theme-futurista,
html.light-mode {
  --bg-fundo:           #F1F5F9;
  --bg-card:            #FFFFFF;
  --bg-input:           #FFFFFF;
  --texto-principal:    #0F172A;
  --texto-secundario:   #475569;
  --bordas:             #E2E8F0;
  --theme-bg:           #F1F5F9;
  --theme-surface:      #FFFFFF;
  --theme-text:         #0F172A;
  --theme-text-muted:   #475569;
  --theme-border:       #E2E8F0;
  color-scheme: light;
}

/* Modo claro: blindagem explícita — vence qualquer body{} em inline <style> */
html.light-mode body {
  background-color: #F1F5F9 !important;
  color: #0F172A !important;
}

/* Modo escuro: EXCEÇÃO — só aplica quando dark-mode está explicitamente ativo */
html.dark-mode body {
  background-color: #0B0E14 !important;
  color: #FFFFFF !important;
}

/* ── Contraste Modo Claro: blindagem de texto em itens de teste ──
   Sem isso, regras inline dos módulos (ex: .w3-item-cell {color:#fff!important})
   tornam textos invisíveis no fundo branco. Especificidade (0,1,1)+(0,1,2) vence
   qualquer seletor simples com !important em inline <style>. */
html.light-mode h1,
html.light-mode h2,
html.light-mode h3,
html.light-mode h4 { color: #0F172A !important; }

html.light-mode .w3-item-cell { color: #1e293b !important; background: #ffffff !important; border-color: #e5e7eb !important; }
html.light-mode .w3-item-cell .item-prompt { color: #6b7280 !important; }
html.light-mode .w3-item-cell .item-label { color: #6b7280 !important; }
html.light-mode .w3-item-cell label { color: #374151 !important; }

html.light-mode .w3-hint-row { color: #374151 !important; border-bottom-color: #e5e7eb !important; }
html.light-mode .w3-hint-card { color: #1e293b !important; background: #f8fafc !important; border-color: #e5e7eb !important; }
html.light-mode .w3-hint-card .hint-item-label { color: #1d4ed8 !important; }
html.light-mode .w3-hint-card .hint-criteria { color: #374151 !important; }

html.light-mode .w3-trial-toggle { color: #374151 !important; background: #f1f5f9 !important; border-color: #cbd5e1 !important; }
html.light-mode .w3-alert-warn { color: #92400e !important; background: #fffbeb !important; border-color: #fcd34d !important; }
html.light-mode .w3-status-name { color: #0F172A !important; }
html.light-mode .w3-status-age,
html.light-mode .w3-status-count { color: #64748b !important; }

/* ═══════════════════════════════════════════════════════════
   NUCLEAR — última linha de defesa contra texto branco em modo claro
   Adicionado ao FINAL do arquivo para garantir source-order máximo.
   Cobre qualquer módulo que tenha .w3-item-cell sem html.dark-mode scope.
   NÃO usa display:block para preservar layouts flex.
   ═══════════════════════════════════════════════════════════ */
html.light-mode .w3-item-cell { background-color: #ffffff !important; color: #1e293b !important; border-color: #e5e7eb !important; }
html.light-mode .w3-item-cell .item-prompt { color: #374151 !important; opacity: 1 !important; visibility: visible !important; }
html.light-mode .w3-item-cell .item-label { color: #6b7280 !important; opacity: 1 !important; visibility: visible !important; }
html.light-mode .w3-item-cell label { color: #374151 !important; opacity: 1 !important; visibility: visible !important; }
html.light-mode h1, html.light-mode h2, html.light-mode h3, html.light-mode h4 { color: #0F172A !important; }

/* ── PATCH DE VISIBILIDADE GLOBAL v6.1 ──────────────────────────────────────
   Garante contraste em modo claro para:
   1. Card do paciente na sidebar (atendimento-context / ctx-patient-*)
   2. Varredura global de containers claro
   3. Labels de formulário
   4. Exceção para botões/badges (manter texto branco)
   ─────────────────────────────────────────────────────────────────────────── */

/* 1. Card do paciente na sidebar */
html.light-mode .atendimento-context {
  background: #f1f5f9 !important;
  border-left-color: #6366f1 !important;
  border: 1px solid #e2e8f0 !important;
  border-left-width: 3px !important;
}
html.light-mode .ctx-patient-name {
  color: #0f172a !important;
  opacity: 1 !important;
}
html.light-mode .ctx-patient-meta {
  color: #475569 !important;
  opacity: 1 !important;
}
html.light-mode .ctx-back-btn {
  background: rgba(0,0,0,0.04) !important;
  border-color: #e2e8f0 !important;
  color: #374151 !important;
}
html.light-mode .ctx-back-btn:hover {
  background: rgba(0,0,0,0.08) !important;
  color: #0f172a !important;
}

/* 2. Varredura global de containers em modo claro */
html.light-mode .card,
html.light-mode .modal-content {
  color: #1e293b !important;
}

/* 3. Labels de formulário em modo claro */
html.light-mode label {
  color: #334155 !important;
}

/* 4. Exceção: botões e badges mantêm texto branco independente do tema */
.btn-primary, .btn-success, .badge {
  color: #ffffff !important;
}

/* ── LOW-DATA MODE v8.1 — Economia de Dados e Performance ───────────────────
   Ativado por theme.js quando isMobile ou conexão lenta (saveData/2G/3G).
   html.low-data-mode é adicionado antes do primeiro paint.
   ─────────────────────────────────────────────────────────────────────────── */
html.low-data-mode * {
  box-shadow:  none !important;
  text-shadow: none !important;
}
html.low-data-mode *,
html.low-data-mode *::before,
html.low-data-mode *::after {
  transition:  none !important;
  animation:   none !important;
}
/* Backgrounds: remove gradientes, mantém cor sólida editorial */
html.low-data-mode .resume-banner,
html.low-data-mode .anamnese-card,
html.low-data-mode .atendimento-context {
  background-image: none !important;
  background: #ffffff !important;
  border: 1.5px solid #e2e8f0 !important;
}
/* Cards genéricos: fundo sólido */
html.low-data-mode .card,
html.low-data-mode .view-card {
  background: #f8fafc !important;
  background-image: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
/* Fonte do sistema — mais rápida, sem download de web font */
html.low-data-mode body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

/* ── BREAKPOINT MOBILE v8.0 — Mobile-First ─────────────────────────────────
   Regras globais para telas ≤ 768px. Cada módulo com sidebar fixa herda
   o colapso via .sidebar e o ajuste de .main-content aqui.
   ─────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar: colapsa para faixa horizontal no topo */
  .sidebar {
    width: 100% !important;
    height: auto !important;
    position: relative !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    padding: 12px 16px !important;
    gap: 8px !important;
    overflow: visible !important;
  }
  /* Conteúdo principal: remove margin-left da sidebar fixa */
  .main-content,
  [class*="main-content"] {
    margin-left: 0 !important;
    padding: 16px !important;
  }
  /* Cards: largura total */
  .card, .view-card {
    max-width: 100% !important;
    border-radius: 10px !important;
    padding: 20px !important;
  }
  /* Inputs/selects/textareas: font-size ≥ 16px evita zoom automático no iOS */
  input, select, textarea {
    font-size: 16px !important;
  }
  /* Grids de 2+ colunas: empilhar */
  .form-grid,
  [class*="form-grid"] {
    grid-template-columns: 1fr !important;
  }
  /* Tabelas: scroll horizontal */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Contraste da sidebar em light-mode permanece válido no mobile */
  html.light-mode .ctx-patient-name { color: #0f172a !important; }
  html.light-mode .ctx-patient-meta { color: #475569 !important; }
}

/* ===== DNA PERICIAL 1.0 — TOKENS DE UNIFICAÇÃO ===== */
:root {
  --bg-clinical: #F1F5F9;
  --white-pure: #FFFFFF;
  --text-main: #1E293B;
  --border-radius-pericial: 32px;
  --shadow-soft: 0 20px 40px rgba(0,0,0,0.06);
}

.ds-test-container {
  max-width: 1000px; margin: 40px auto; padding: 50px;
  background: var(--white-pure);
  border-radius: var(--border-radius-pericial);
  box-shadow: var(--shadow-soft);
  border: none !important;
}

.ds-btn-primary-pericial {
  background: linear-gradient(135deg, #1E40AF 0%, #04525b 100%) !important;
  color: #FFFFFF !important;
  font-weight: 800;
  border-radius: 14px;
  padding: 16px 36px;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(0,229,255,0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ds-btn-primary-pericial:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(0,229,255,0.35);
}

/* ===================================================================
   SOFT-DEPTH PERICIAL v5.8 — CLASSE UNIVERSAL body.clinical-unified
   Aplique class="clinical-unified" ao <body> de cada módulo.
   NÃO toca módulos que não recebam essa classe.
   =================================================================== */

body.clinical-unified {
  background-color: #F1F5F9 !important;
  color: #1E293B !important;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Containers principais ── */
body.clinical-unified .test-container,
body.clinical-unified .ds-card,
body.clinical-unified .clinical-card {
  background: #FFFFFF !important;
  border: none !important;
  border-radius: 32px !important;
  box-shadow: 0 20px 40px rgba(0,0,0,0.05) !important;
}

/* ── Tabs pill ── */
body.clinical-unified .ds-tabs {
  background: #F8FAFC !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 16px !important;
  padding: 8px !important;
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px !important;
  justify-content: center;
}
body.clinical-unified .ds-tab {
  flex: 1 1 auto;
  min-width: 100px;
  background: transparent;
  border: none;
  color: #64748B;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  padding: 12px 16px;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s;
  white-space: nowrap;
}
body.clinical-unified .ds-tab.active {
  background: #FFFFFF !important;
  color: #1E40AF !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
  transform: translateY(-1px);
}

/* ── Botão primário ── */
body.clinical-unified .ds-btn-primary,
body.clinical-unified .ds-btn-primary-futurista,
body.clinical-unified .btn-primary,
body.clinical-unified .ds-btn-primary-pericial {
  background: linear-gradient(135deg, #1E40AF 0%, #04525b 100%) !important;
  color: #FFFFFF !important;
  font-weight: 800 !important;
  border: none !important;
  border-radius: 14px !important;
  box-shadow: 0 8px 20px rgba(0,229,255,0.2) !important;
  cursor: pointer;
}
body.clinical-unified .ds-btn-primary:hover,
body.clinical-unified .ds-btn-primary-futurista:hover,
body.clinical-unified .btn-primary:hover,
body.clinical-unified .ds-btn-primary-pericial:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0,229,255,0.35) !important;
}

/* ── Inputs ── */
body.clinical-unified input[type=text],
body.clinical-unified input[type=number],
body.clinical-unified input[type=date],
body.clinical-unified select,
body.clinical-unified textarea {
  background: #F8FAFC !important;
  border: 1.5px solid #E2E8F0 !important;
  border-radius: 12px !important;
  padding: 12px 16px !important;
  color: #1E293B !important;
  font-family: inherit;
}
body.clinical-unified input[type=text]:focus,
body.clinical-unified input[type=number]:focus,
body.clinical-unified input[type=date]:focus,
body.clinical-unified select:focus,
body.clinical-unified textarea:focus {
  border-color: #1E40AF !important;
  box-shadow: 0 0 0 3px rgba(30,64,175,0.1) !important;
  outline: none !important;
}

/* ── Headings ── */
body.clinical-unified h1,
body.clinical-unified h2,
body.clinical-unified h3 {
  color: #1E293B !important;
}

/* ── Labels e texto auxiliar ── */
body.clinical-unified label {
  color: #1E293B;
}
body.clinical-unified .text-muted,
body.clinical-unified small {
  color: #64748B;
}

/* ═══════════════════════════════════════════════════════════
   THEME-PERICIAL-V1 — Isolamento de Escopo por Módulo
   Aplique class="theme-pericial-v1" em containers específicos
   para garantir que outras páginas sem essa classe NÃO sejam afetadas.
   ═══════════════════════════════════════════════════════════ */

.theme-pericial-v1 .test-container,
.theme-pericial-v1 .w3-card,
.theme-pericial-v1 .ds-card {
  border-radius: 32px !important;
  box-shadow: 0 20px 40px rgba(0,0,0,0.05) !important;
  background: #FFFFFF !important;
}

.theme-pericial-v1 .ds-btn-primary,
.theme-pericial-v1 .w3-btn-primary,
.theme-pericial-v1 .btn-primary {
  background: linear-gradient(135deg, #1E40AF 0%, #04525b 100%) !important;
  color: #FFFFFF !important;
  border: none !important;
  border-radius: 14px !important;
  font-weight: 800 !important;
  box-shadow: 0 8px 20px rgba(0,229,255,0.2) !important;
}

/* Score buttons grid — 3 colunas fixas, sem "pulo" de layout */
.theme-pericial-v1 .score-tiles-group {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 6px !important;
  max-width: 180px !important;
}

/* Botão de pontuação oculto (item sem aquele score) */
.theme-pericial-v1 .score-tile.hidden-score {
  visibility: hidden !important;
  pointer-events: none !important;
}
