
  :root {
    --bg:       #0a0a0f;
    --bg2:      #111118;
    --bg3:      #18181f;
    --bg4:      #1f1f2a;
    --border:   rgba(139,92,246,0.15);
    --border2:  rgba(139,92,246,0.3);
    --purple:   #8b5cf6;
    --purple2:  #a78bfa;
    --purple3:  #6d28d9;
    --purple4:  #4c1d95;
    --text:     #f0eeff;
    --text2:    #b4a8d8;
    --text3:    #6b5f8a;
    --success:  #34d399;
    --error:    #f87171;
    --warning:  #fbbf24;
    --mono:     'DM Mono', monospace;
    --sans:     'Plus Jakarta Sans', sans-serif;
    --display:  'Syne', sans-serif;
    --glow:     0 0 40px rgba(139,92,246,0.12);
    --glow2:    0 0 80px rgba(139,92,246,0.08);
    --sidebar-bg: rgba(17,17,24,0.8);
    --table-header-bg: #201a33; /* opaco de propósito — cabeçalho sticky não pode ser translúcido, senão a linha por baixo aparece junto ao rolar */
  }

  /* Tema claro: branco de verdade (tipo Apple), roxo só como cor de destaque
     nos botões/links/bordas ativas — não um cinza/lavanda espalhado por tudo. */
  body.tema-claro {
    --bg:       #faf8ff;
    --bg2:      #ffffff;
    --bg3:      #f3eefc;
    --bg4:      #e7d9fa;
    --border:   rgba(124,58,237,0.14);
    --border2:  rgba(124,58,237,0.32);
    --purple:   #7c3aed;
    --purple2:  #8b5cf6;
    --purple3:  #6d28d9;
    --purple4:  #f3ecfd;
    --text:     #1d1d1f;
    --text2:    #515154;
    --text3:    #86868b;
    --success:  #16a34a;
    --error:    #dc2626;
    --warning:  #ca8a04;
    --glow:     0 0 40px rgba(124,58,237,0.14);
    --glow2:    0 0 80px rgba(124,58,237,0.10);
    --sidebar-bg: rgba(250,248,255,0.75);
    --table-header-bg: #ece3fa; /* opaco — mesmo motivo do tema escuro */
  }

  /* Os brilhos decorativos de fundo (as bolhas roxas desfocadas) ficam mais
     visíveis no tema claro, senão somem contra o fundo quase branco. */
  body.tema-claro .ambient-1 { background: rgba(124,58,237,0.10); }
  body.tema-claro .ambient-2 { background: rgba(139,92,246,0.08); }

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
  }

  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
  }

  body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
      linear-gradient(rgba(139,92,246,0.04) 1px, transparent 1px),
      linear-gradient(90deg, rgba(139,92,246,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
  }

  .ambient { position: fixed; border-radius: 50%; filter: blur(120px); pointer-events: none; z-index: 0; }
  .ambient-1 { width: 600px; height: 600px; background: rgba(109,40,217,0.08); top: -200px; right: -200px; }
  .ambient-2 { width: 400px; height: 400px; background: rgba(139,92,246,0.06); bottom: 0; left: -100px; }

  .layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
  }

  .sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 0;
  }

  .sidebar-logo { padding: 28px 24px 20px; border-bottom: 1px solid var(--border); }
  .logo-mark { display: flex; align-items: center; gap: 12px; text-decoration: none; }
  .logo-icon { width: 38px; height: 38px; background: linear-gradient(135deg, var(--purple3), var(--purple)); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 16px; color: white; box-shadow: 0 0 20px rgba(139,92,246,0.3); flex-shrink: 0; }
  .logo-img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; box-shadow: 0 0 20px rgba(139,92,246,0.3); flex-shrink: 0; border: 1px solid rgba(139,92,246,0.18); }
  .vl-signature { font-size: 10px; color: var(--purple2); font-family: var(--mono); letter-spacing: 0.12em; text-transform: uppercase; margin-top: 4px; opacity: .85; }
  .brand-footer { margin-top: 28px; padding: 18px 22px; background: var(--sidebar-bg); border: 1px solid var(--border); border-radius: 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--text3); font-family: var(--mono); font-size: 11px; }
  .brand-footer-left { display: flex; align-items: center; gap: 10px; }
  .brand-footer img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; border: 1px solid rgba(139,92,246,0.18); }
  .brand-footer strong { color: var(--purple2); font-weight: 500; }

  .logo-text { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--text); letter-spacing: 0.02em; }
  .logo-sub { font-size: 10px; color: var(--text3); font-family: var(--mono); letter-spacing: 0.1em; text-transform: uppercase; margin-top: 1px; }

  .sidebar-section { padding: 20px 16px 8px; }
  .sidebar-label { font-size: 9px; font-family: var(--mono); letter-spacing: 0.15em; text-transform: uppercase; color: var(--text3); padding: 0 8px; margin-bottom: 6px; }

  .sidebar-section-header { display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding: 0 8px; margin-bottom: 6px; user-select: none; border-radius: 6px; }
  .sidebar-section-header:hover { background: rgba(139,92,246,0.06); }
  .sidebar-section-header:hover .sidebar-label { color: var(--text2); }
  .sidebar-section-chevron { width: 13px; height: 13px; color: var(--text3); flex-shrink: 0; transition: transform 0.2s ease; }
  .sidebar-section.collapsed .sidebar-section-chevron { transform: rotate(-90deg); }
  .sidebar-section-body { overflow: hidden; max-height: 1200px; transition: max-height 0.25s ease, opacity 0.2s ease; opacity: 1; }
  .sidebar-section.collapsed .sidebar-section-body { max-height: 0; opacity: 0; }

  .nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; transition: all 0.15s ease; color: var(--text2); font-size: 13px; font-weight: 400; border: 1px solid transparent; margin-bottom: 2px; user-select: none; }
  .nav-item:hover { background: rgba(139,92,246,0.08); color: var(--text); border-color: var(--border); }
  .nav-item.active { background: rgba(139,92,246,0.15); color: var(--purple2); border-color: rgba(139,92,246,0.25); }
  .nav-icon { width: 18px; height: 18px; opacity: 0.7; flex-shrink: 0; }
  .nav-item.active .nav-icon { opacity: 1; }
  .nav-badge { margin-left: auto; font-size: 9px; font-family: var(--mono); background: rgba(139,92,246,0.2); color: var(--purple2); padding: 2px 6px; border-radius: 4px; border: 1px solid rgba(139,92,246,0.2); }

  .sidebar-status { margin-top: auto; padding: 16px; border-top: 1px solid var(--border); }
  .status-card { background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
  .status-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2); margin-bottom: 6px; }
  .status-row:last-child { margin-bottom: 0; }
  .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
  .dot-green { background: var(--success); box-shadow: 0 0 6px rgba(52,211,153,0.5); }
  .dot-gray  { background: var(--text3); }
  .dot-yellow { background: var(--warning); box-shadow: 0 0 6px rgba(251,191,36,0.5); }
  .status-val { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text3); }

  .main { display: flex; flex-direction: column; }

  .header { background: var(--sidebar-bg); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); padding: 16px 32px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 10; }
  .header-title { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--text); flex: 1; }
  .header-sub { font-size: 11px; color: var(--text3); font-family: var(--mono); margin-top: 1px; }

  .btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 8px; font-size: 12px; font-weight: 500; font-family: var(--sans); cursor: pointer; transition: all 0.15s ease; border: 1px solid var(--border2); background: rgba(139,92,246,0.1); color: var(--purple2); }
  .btn:hover { background: rgba(139,92,246,0.2); border-color: var(--purple); box-shadow: 0 0 20px rgba(139,92,246,0.15); }
  .btn:active { transform: scale(0.97); }
  .btn-primary { background: linear-gradient(135deg, var(--purple3), var(--purple)); border-color: var(--purple); color: white; box-shadow: 0 4px 20px rgba(139,92,246,0.25); }
  .btn-primary:hover { background: linear-gradient(135deg, #5b21b6, var(--purple3)); box-shadow: 0 4px 30px rgba(139,92,246,0.4); }
  .btn-sm { padding: 6px 12px; font-size: 11px; }
  .btn-ghost { background: transparent; border-color: var(--border); color: var(--text2); }
  .btn-danger { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.35); color: #f87171; }
  .mc-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
    background: var(--bg2); border: 1px solid var(--border2); border-radius: 8px;
    padding: 8px; min-width: 220px; max-height: 260px; overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  }
  .mc-dropdown label { display: flex; align-items: center; gap: 8px; padding: 4px 6px; font-size: 12px; cursor: pointer; border-radius: 4px; }
  .mc-dropdown label:hover { background: var(--bg3); }
  .mc-dropdown .mc-dropdown-acoes { display: flex; gap: 6px; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
  .btn-ghost:hover { background: var(--bg3); border-color: var(--border2); color: var(--text); box-shadow: none; }
  .btn:disabled { opacity: 0.5; cursor: not-allowed; }

  .content { padding: 32px; flex: 1; min-width: 0; }

  .panel { display: none; animation: fadeUp 0.25s ease; }
  .panel.active { display: block; }
  @keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

  .card { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }

  /* Scroll reforçado (horizontal + vertical) pra tabelas largas — não
     depende do comportamento padrão do navegador, e a barra fica sempre
     visível (não só "no hover"), pra nunca parecer que a tabela "sumiu"
     em resoluções/zooms menores. */
  .tabela-scroll-both {
    overflow-x: scroll !important;
    overflow-y: scroll !important;
    scrollbar-width: auto; /* Firefox */
  }
  .tabela-scroll-both::-webkit-scrollbar { width: 12px; height: 12px; }
  .tabela-scroll-both::-webkit-scrollbar-track { background: var(--bg3); }
  .tabela-scroll-both::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 6px; }
  .tabela-scroll-both::-webkit-scrollbar-thumb:hover { background: var(--purple2); }
  .tabela-scroll-both::-webkit-scrollbar-corner { background: var(--bg3); }

  /* Célula de texto longo com rolagem própria (ex: "O Que Foi Despontuado")
     — precisa de barra visível também, senão parece que o texto corta sem
     terminar (achado numa conversa: usuário achava que tava "incompleto"). */
  .celula-scroll-interno {
    scrollbar-width: thin;
    scrollbar-color: var(--border2) transparent;
  }
  .celula-scroll-interno::-webkit-scrollbar { width: 6px; }
  .celula-scroll-interno::-webkit-scrollbar-track { background: transparent; }
  .celula-scroll-interno::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
  .celula-scroll-interno::-webkit-scrollbar-thumb:hover { background: var(--purple2); }
  .card-head { padding: 18px 22px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
  .card-icon { width: 32px; height: 32px; background: rgba(139,92,246,0.12); border: 1px solid rgba(139,92,246,0.2); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--purple2); flex-shrink: 0; }
  .card-title { font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--text); }
  .card-desc { font-size: 11px; color: var(--text3); margin-top: 1px; }
  .card-body { padding: 22px; }

  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
  .form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
  .form-full { grid-column: 1 / -1; }
  .field { display: flex; flex-direction: column; gap: 6px; }

  label { font-size: 11px; font-family: var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text3); }

  input[type="text"], input[type="date"], input[type="time"], input[type="number"], input[type="email"], input[type="password"], select, textarea {
    background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-family: var(--mono); font-size: 13px; padding: 10px 14px; outline: none; transition: border-color 0.15s, box-shadow 0.15s; width: 100%; color-scheme: dark;
  }
  input[type="text"]:focus, input[type="date"]:focus, input[type="time"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="password"]:focus, select:focus, textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(139,92,246,0.12); }
  input::placeholder { color: var(--text3); }
  select { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 7L11 1' stroke='%236b5f8a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
  select option { background: var(--bg3); }
  textarea { resize: vertical; min-height: 80px; }

  .toggle-group { display: flex; gap: 8px; }
  .toggle-btn { flex: 1; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg3); color: var(--text2); font-size: 12px; font-family: var(--sans); cursor: pointer; transition: all 0.15s; text-align: center; }
  .toggle-btn.selected { background: rgba(139,92,246,0.15); border-color: rgba(139,92,246,0.3); color: var(--purple2); }

  .result-box { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; font-family: var(--mono); font-size: 12px; color: var(--text2); padding: 18px; min-height: 120px; max-height: 500px; overflow-y: auto; line-height: 1.7; display: none; white-space: pre-wrap; word-break: break-all; }
  .result-box.visible { display: block; animation: fadeUp 0.2s ease; }
  .result-success { border-color: rgba(52,211,153,0.3); }
  .result-error   { border-color: rgba(248,113,113,0.3); }
  .result-box::-webkit-scrollbar { width: 4px; }
  .result-box::-webkit-scrollbar-track { background: transparent; }
  .result-box::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

  .loading-wrap { display: none; align-items: center; gap: 12px; color: var(--text3); font-family: var(--mono); font-size: 12px; padding: 16px 0 0; }
  .loading-wrap.visible { display: flex; }
  .spinner { width: 16px; height: 16px; border: 2px solid var(--border2); border-top-color: var(--purple); border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }
  @keyframes spin { to { transform: rotate(360deg); } }

  .stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
  .stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; position: relative; overflow: hidden; }
  .stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--purple3), var(--purple)); opacity: 0.6; }
  .stat-card-icon { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
  .stat-label { font-size: 10px; font-family: var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text3); margin-bottom: 8px; }
  .stat-val { font-family: var(--display); font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
  .stat-sub { font-size: 11px; color: var(--text3); margin-top: 4px; }

