
  :root {
    /* Paleta Positivo Tecnologia (sem vermelho: apenas verde + navy + neutros) */
    --sidebar-bg:      #0F172A;
    --sidebar-bg-2:    #1E293B;
    --sidebar-border:  #1E293B;
    --sidebar-text:    #E5E7EB;
    --sidebar-muted:   #6B7280;
    --sidebar-section: #6B7280;   /* cabecalhos de secao em cinza mudo, tipo o ref */
    --accent:          #10B981;   /* verde primario Positivo */
    --accent-dark:     #059669;
    --accent-soft:     #D1FAE5;
    --accent-soft-2:   #ECFDF5;
    --content-bg:      #F9FAFB;
    --card-bg:         #FFFFFF;
    --card-border:     #E5E7EB;
    --card-shadow:     0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --text:            #111827;
    --text-2:          #374151;
    --muted:           #6B7280;
    --err:             #DC2626;
    --err-soft:        #FEE2E2;
    --warn:            #F59E0B;
    --warn-soft:       #FEF3C7;
    --border:          #E5E7EB;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; height: 100%; }
  body { font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
         background: var(--content-bg); color: var(--text); font-size: 14px;
         display: flex; min-height: 100vh; }

  /* ================================================================
     Sidebar (esquerda, tema escuro - referencia Android.Tools)
     ================================================================ */
  .sidebar { width: 260px; flex-shrink: 0; background: var(--sidebar-bg);
             color: var(--sidebar-text); display: flex; flex-direction: column;
             border-right: 1px solid var(--sidebar-border); position: sticky; top: 0;
             align-self: flex-start; height: 100vh; overflow-y: auto; }
  .sidebar-brand { padding: 20px 18px 18px; border-bottom: 1px solid var(--sidebar-border);
                   display: flex; align-items: center; gap: 12px; }
  .sidebar-logo-mark { width: 40px; height: 40px; border-radius: 10px;
                       background: var(--accent); display: flex; align-items: center;
                       justify-content: center; color: white; font-weight: 800;
                       font-size: 20px; flex-shrink: 0; letter-spacing: -0.5px;
                       box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35); }
  .sidebar-logo-txt { display: flex; flex-direction: column; min-width: 0; }
  .sidebar-logo-title { font-weight: 700; font-size: 15px; line-height: 1.1;
                        color: white; letter-spacing: -0.1px; }
  .sidebar-logo-sub { font-size: 10.5px; color: var(--sidebar-muted); margin-top: 4px;
                      text-transform: uppercase; letter-spacing: 0.8px; font-weight: 500; }
  .sidebar-nav { padding: 8px 10px; flex: 1; }
  .sidebar-section { color: var(--sidebar-section); font-size: 10.5px; font-weight: 600;
                     letter-spacing: 1.2px; text-transform: uppercase;
                     padding: 18px 12px 6px; }
  .sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px;
                   color: var(--sidebar-text); text-decoration: none;
                   border-radius: 8px; font-size: 13.5px; margin: 1px 0;
                   transition: background 0.12s, color 0.12s; cursor: pointer;
                   font-weight: 500; }
  .sidebar-nav a:hover { background: var(--sidebar-bg-2); }
  .sidebar-nav a.active { background: rgba(16, 185, 129, 0.13);
                          color: #6EE7B7; font-weight: 600;
                          box-shadow: inset 3px 0 0 var(--accent); }
  .sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor;
                       opacity: 0.9; }
  .sidebar-nav a.active svg { opacity: 1; }
  /* Bloco de perfil no rodape */
  .sidebar-user { border-top: 1px solid var(--sidebar-border); padding: 14px 16px;
                  display: flex; align-items: center; gap: 12px; }
  .sidebar-user-avatar { width: 38px; height: 38px; border-radius: 50%;
                         background: var(--accent); color: white; font-weight: 700;
                         display: flex; align-items: center; justify-content: center;
                         font-size: 13px; letter-spacing: 0.5px; flex-shrink: 0; }
  .sidebar-user-info { flex: 1; min-width: 0; }
  .sidebar-user-name { font-size: 13px; font-weight: 600; color: white;
                       white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar-user-role { font-size: 11px; color: var(--sidebar-muted); margin-top: 2px;
                       white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* ================================================================
     Conteudo principal (tema claro)
     ================================================================ */
  .content { flex: 1; min-width: 0; }
  .content-header { padding: 22px 32px 16px; background: white;
                    border-bottom: 1px solid var(--border); display: flex;
                    align-items: center; justify-content: space-between; gap: 20px; }
  .content-header-title h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700;
                             color: var(--text); }
  .content-header-title p { margin: 0; font-size: 13px; color: var(--muted); }
  .header-badges { display: flex; gap: 8px; align-items: center; }
  .status-dot { display: inline-flex; align-items: center; gap: 8px;
                font-size: 13px; color: var(--text-2); }
  .status-dot::before { content: ""; width: 10px; height: 10px; border-radius: 50%;
                        background: var(--muted); }
  .status-dot.ok::before   { background: var(--accent); box-shadow: 0 0 0 3px rgba(16,185,129,0.18); }
  .status-dot.err::before  { background: var(--err);    box-shadow: 0 0 0 3px rgba(220,38,38,0.15); }
  .status-dot.warn::before { background: var(--warn);   box-shadow: 0 0 0 3px rgba(245,158,11,0.18); }

  main.dashboard { padding: 24px 32px 40px; max-width: 1400px; }

  /* Cards padrao */
  .card { background: var(--card-bg); border: 1px solid var(--card-border);
          border-radius: 10px; padding: 20px; box-shadow: var(--card-shadow); }
  .card h2 { margin: 0 0 14px; font-size: 11px; text-transform: uppercase;
             color: var(--muted); letter-spacing: 1px; font-weight: 700; }
  .grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 24px; }
  .stat { font-size: 32px; font-weight: 700; margin: 4px 0; line-height: 1; }
  .stat.ok  { color: var(--accent); }
  .stat.err { color: var(--err); }
  .row { display: flex; gap: 8px; align-items: baseline; margin: 8px 0; font-size: 13px; }
  .row .label { color: var(--muted); min-width: 110px; flex-shrink: 0; }
  .row .val { font-family: "Consolas", "Menlo", monospace; word-break: break-all;
              color: var(--text-2); font-size: 12.5px; }
  .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

  /* Botoes */
  button { background: white; color: var(--text-2); border: 1px solid var(--border);
           padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 13px;
           font-weight: 500; transition: all 0.15s; font-family: inherit; }
  button:hover { background: var(--content-bg); border-color: #D1D5DB; }
  button.primary { background: var(--accent); border-color: var(--accent); color: white; }
  button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
  button.danger { background: var(--err); border-color: var(--err); color: white; }
  button.danger:hover { background: #B91C1C; border-color: #B91C1C; }
  button:disabled { opacity: 0.5; cursor: not-allowed; }

  /* Tabela de eventos */
  table { width: 100%; border-collapse: collapse; font-size: 13px; }
  th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
  th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 10.5px;
       letter-spacing: 0.8px; background: var(--content-bg); }
  tbody tr:hover { background: var(--content-bg); }
  td.status { font-weight: 600; font-size: 11px; }
  td.status.pass { color: var(--accent); }
  td.status.fail { color: var(--err); }
  .empty { text-align: center; color: var(--muted); padding: 32px; font-size: 13px; }

  /* Log */
  .log { background: #0F172A; border: 1px solid #1E293B; border-radius: 8px;
         padding: 14px 16px; font-family: "Consolas", "Menlo", monospace; font-size: 12px;
         white-space: pre-wrap; max-height: 340px; overflow-y: auto; color: #CBD5E1; }
  .log .line-error { color: #FCA5A5; }
  .log .line-warn  { color: #FCD34D; }
  .log .line-info  { color: #94A3B8; }

  .section-title { font-size: 11px; text-transform: uppercase; color: var(--muted);
                   letter-spacing: 1px; font-weight: 700; margin: 28px 0 12px;
                   display: flex; align-items: center; gap: 8px; }

  /* Toast */
  .toast { position: fixed; bottom: 20px; right: 20px; background: var(--text);
           border: 1px solid var(--text); color: white; padding: 12px 16px;
           border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); display: none;
           font-size: 13px; font-weight: 500; }
  .toast.visible { display: block; }

  .live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
              background: var(--accent); animation: pulse 1.5s infinite; }
  @keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

  /* ================================================================
     Card de login no topo (light theme, cor conforme estado)
     ================================================================ */
  .login-card { display: flex; gap: 20px; align-items: center;
                border: 1px solid var(--card-border); border-radius: 10px;
                padding: 20px 24px; margin-bottom: 24px; background: var(--card-bg);
                box-shadow: var(--card-shadow); transition: all 0.2s;
                border-left-width: 5px; }
  .login-card.state-ok       { border-left-color: var(--accent);
                               background: linear-gradient(90deg, var(--accent-soft-2), var(--card-bg) 40%); }
  .login-card.state-error    { border-left-color: var(--err);
                               background: linear-gradient(90deg, var(--err-soft), var(--card-bg) 40%);
                               animation: shakeOnce 0.5s ease-out; }
  .login-card.state-loading  { border-left-color: var(--warn);
                               background: linear-gradient(90deg, var(--warn-soft), var(--card-bg) 40%); }
  .login-card.state-idle     { border-left-color: #94A3B8; }
  .login-icon { flex-shrink: 0; width: 56px; height: 56px; border-radius: 50%;
                display: flex; align-items: center; justify-content: center;
                font-size: 28px; font-weight: 700; }
  .state-ok      .login-icon { background: var(--accent-soft); color: var(--accent-dark); }
  .state-error   .login-icon { background: var(--err-soft);    color: var(--err); }
  .state-loading .login-icon { background: var(--warn-soft);   color: var(--warn); }
  .state-idle    .login-icon { background: var(--content-bg);  color: var(--muted); }
  .login-body { flex: 1; min-width: 0; }
  .login-title { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
  .state-ok      .login-title { color: var(--accent-dark); }
  .state-error   .login-title { color: var(--err); }
  .state-loading .login-title { color: #B45309; }
  .state-idle    .login-title { color: var(--text); }
  .login-subtitle { color: var(--muted); font-size: 13px; margin: 0 0 8px; line-height: 1.5; }
  .login-detail { font-size: 12px; color: var(--text-2); font-family: "Consolas", monospace;
                  word-break: break-word; background: var(--content-bg);
                  padding: 6px 10px; border-radius: 4px; display: inline-block; }
  .login-detail:empty { display: none; }
  .login-actions { flex-shrink: 0; display: flex; gap: 8px; }
  .login-actions button { padding: 10px 18px; font-size: 14px; font-weight: 600; }
  @keyframes shakeOnce {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
  }
  .spinner {
    width: 24px; height: 24px; border: 3px solid rgba(245,158,11,0.25);
    border-top-color: var(--warn); border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* Roteamento client-side: paginas ficam ocultas ate serem ativadas */
  .page { display: none; }
  .page.active { display: block; }

  /* -----------------------------------------------------------------
     Sidebar colapsável
     ----------------------------------------------------------------- */
  .sidebar-toggle { position: absolute; top: 16px; right: -14px;
                    width: 28px; height: 28px; border-radius: 50%;
                    background: var(--accent); color: white; border: none;
                    display: flex; align-items: center; justify-content: center;
                    cursor: pointer; z-index: 10; font-size: 16px; line-height: 1;
                    box-shadow: 0 2px 6px rgba(0,0,0,0.3); padding: 0; }
  .sidebar-toggle:hover { background: var(--accent-dark); }
  .sidebar { position: sticky; transition: width 0.2s ease; }
  .sidebar.collapsed { width: 68px; }
  .sidebar.collapsed .sidebar-logo-txt,
  .sidebar.collapsed .sidebar-section,
  .sidebar.collapsed .sidebar-nav a span:not(.nav-icon-wrap),
  .sidebar.collapsed .sidebar-user-info,
  .sidebar.collapsed .service-active-txt {
    display: none;
  }
  .sidebar.collapsed .sidebar-brand { justify-content: center; padding: 20px 8px; }
  .sidebar.collapsed .sidebar-nav a { justify-content: center; padding: 10px; }
  .sidebar.collapsed .sidebar-user { justify-content: center; padding: 14px 8px; }
  .sidebar.collapsed .service-active { justify-content: center; padding: 12px 8px; }

  /* Serviço ativo (rodape da sidebar) */
  .service-active { display: flex; align-items: center; gap: 8px;
                    padding: 12px 18px; font-size: 12px; color: var(--sidebar-muted);
                    border-top: 1px solid var(--sidebar-border); }
  .service-active-dot { width: 8px; height: 8px; border-radius: 50%;
                        background: var(--accent); flex-shrink: 0;
                        box-shadow: 0 0 0 3px rgba(16,185,129,0.25);
                        animation: pulse 2s infinite; }

  /* -----------------------------------------------------------------
     Header direito estilo Positivo: chip + empresa + refresh + timestamp
     ----------------------------------------------------------------- */
  .header-chip { padding: 4px 12px; border-radius: 999px; font-size: 10.5px;
                 font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
                 border: 1.5px solid var(--accent); color: var(--accent-dark);
                 background: white; }
  .header-company { font-size: 13px; font-weight: 700; color: var(--text-2);
                    letter-spacing: 0.3px; }
  .header-refresh { background: white; border: 1px solid var(--border);
                    border-radius: 6px; width: 34px; height: 34px; padding: 0;
                    display: flex; align-items: center; justify-content: center; }
  .header-refresh:hover { background: var(--content-bg); }
  .header-refresh.spinning svg { animation: spin 0.8s linear infinite; }
  .header-updated { font-size: 12px; color: var(--muted); }
  .header-divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }

  /* -----------------------------------------------------------------
     Stat cards em linha (row de contadores grandes)
     ----------------------------------------------------------------- */
  .stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
               margin-bottom: 24px; }
  .stat-card { background: var(--card-bg); border: 1px solid var(--card-border);
               border-radius: 10px; padding: 22px 20px; box-shadow: var(--card-shadow);
               text-align: center; }
  .stat-card .stat-num { font-size: 42px; font-weight: 700; line-height: 1.1;
                         margin-bottom: 4px; }
  .stat-card .stat-label { font-size: 11px; text-transform: uppercase;
                           letter-spacing: 1px; color: var(--muted); font-weight: 600; }
  .stat-card.blue   .stat-num { color: #2563EB; }
  .stat-card.orange .stat-num { color: #EA580C; }
  .stat-card.green  .stat-num { color: var(--accent); }
  .stat-card.red    .stat-num { color: var(--err); }

  /* -----------------------------------------------------------------
     Status-cards grandes (Autenticação + CSR Upload Lite) - topo do Painel
     ----------------------------------------------------------------- */
  .status-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
                margin-bottom: 24px; }
  .status-big { display: flex; align-items: center; gap: 16px;
                background: var(--card-bg); border: 1px solid var(--card-border);
                border-radius: 10px; padding: 18px 22px; box-shadow: var(--card-shadow);
                border-left-width: 4px; min-height: 78px; }
  .status-big.state-ok      { border-left-color: var(--accent); }
  .status-big.state-error   { border-left-color: var(--err); }
  .status-big.state-loading { border-left-color: var(--warn); }
  .status-big.state-idle    { border-left-color: #94A3B8; }
  .status-big-icon { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
                     display: flex; align-items: center; justify-content: center;
                     font-size: 22px; font-weight: 700; background: #F1F5F9; color: #94A3B8; }
  .status-big.state-ok      .status-big-icon { background: rgba(16,185,129,0.15);
                                                color: var(--accent-dark); }
  .status-big.state-error   .status-big-icon { background: rgba(220,38,38,0.12);
                                                color: var(--err); }
  .status-big.state-loading .status-big-icon { background: rgba(245,158,11,0.15);
                                                color: #B45309;
                                                animation: pulse 1.5s infinite; }
  .status-big-body { flex: 1; min-width: 0; }
  .status-big-label { font-size: 20px; font-weight: 700; line-height: 1.15; color: var(--text); }
  .status-big.state-ok      .status-big-label { color: var(--accent-dark); }
  .status-big.state-error   .status-big-label { color: var(--err); }
  .status-big.state-loading .status-big-label { color: #B45309; }
  .status-big-hint { font-size: 12px; color: var(--muted); margin-top: 4px;
                     text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }

  /* -----------------------------------------------------------------
     Métricas históricas: coluna de totais + painel de projetos
     ----------------------------------------------------------------- */
  .metrics-row { display: grid; grid-template-columns: 260px 1fr; gap: 16px;
                 margin-bottom: 24px; }
  .totals-col { display: flex; flex-direction: column; gap: 16px; }
  .total-card { background: var(--card-bg); border: 1px solid var(--card-border);
                border-radius: 10px; padding: 22px 20px; box-shadow: var(--card-shadow);
                text-align: center; border-left-width: 4px; flex: 1;
                display: flex; flex-direction: column; justify-content: center; }
  .total-card.total-pass { border-left-color: var(--accent); }
  .total-card.total-fail { border-left-color: var(--err); }
  .total-card .total-label { font-size: 11px; text-transform: uppercase;
                             letter-spacing: 1px; color: var(--muted); font-weight: 700;
                             margin-bottom: 6px; }
  .total-card .total-num { font-size: 56px; font-weight: 700; line-height: 1;
                           margin: 4px 0 8px; }
  .total-card.total-pass .total-num { color: var(--accent); }
  .total-card.total-fail .total-num { color: var(--err); }
  .total-card .total-sub { font-size: 11px; color: var(--muted); }

  .project-panel { background: var(--card-bg); border: 1px solid var(--card-border);
                   border-radius: 10px; padding: 20px; box-shadow: var(--card-shadow);
                   display: flex; flex-direction: column; }
  .project-panel-header h2 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase;
                              color: var(--muted); letter-spacing: 1px; font-weight: 700; }
  .project-panel-header .chart-sub { font-size: 11px; color: var(--muted); margin-bottom: 14px; }

  /* Mini-cards por projeto (linha superior) */
  .project-chips { display: grid; gap: 10px;
                   grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
                   margin-bottom: 18px; }
  .project-chip { background: #F8FAFC; border: 1px solid var(--border);
                  border-radius: 8px; padding: 10px 12px; text-align: center;
                  border-top: 3px solid var(--accent); }
  .project-chip.has-fail { border-top-color: var(--err); }
  .project-chip-name { font-size: 11px; font-weight: 700; color: var(--text-2);
                       letter-spacing: 0.5px; margin-bottom: 4px;
                       white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .project-chip-num  { font-size: 24px; font-weight: 700; color: var(--text);
                       line-height: 1.1; }
  .project-chip-split { font-size: 10px; color: var(--muted); margin-top: 2px; }
  .project-chip-split .split-pass { color: var(--accent); font-weight: 600; }
  .project-chip-split .split-fail { color: var(--err); font-weight: 600; }

  /* Gráfico de barras verticais */
  .project-chart { min-height: 200px; }
  .chart-sub { font-size: 11px; color: var(--muted); margin-bottom: 14px; }
  .chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2);
                  margin-top: 10px; }
  .chart-legend .swatch { display: inline-block; width: 12px; height: 12px;
                          border-radius: 2px; margin-right: 6px; vertical-align: middle; }
  .chart-empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }
  .chart-svg { display: block; width: 100%; height: auto; }
  .chart-svg .axis  { stroke: var(--border); stroke-width: 1; }
  .chart-svg .grid  { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 3; }
  .chart-svg .tick  { fill: var(--muted); font-size: 10px; font-family: -apple-system, "Segoe UI", sans-serif; }
  .chart-svg .value { fill: var(--text-2); font-size: 10px; font-family: -apple-system, sans-serif;
                      font-weight: 600; }
  .chart-svg .bar-pass { fill: var(--accent); }
  .chart-svg .bar-fail { fill: var(--err); }

  @media (max-width: 1100px) {
    .metrics-row { grid-template-columns: 1fr; }
    .totals-col { flex-direction: row; }
    .status-row { grid-template-columns: 1fr; }
  }

  /* -----------------------------------------------------------------
     Widget flutuante de log
     ----------------------------------------------------------------- */
  .floating-log { position: fixed; bottom: 24px; right: 24px; z-index: 100;
                  width: 460px; max-width: calc(100vw - 48px); background: #0F172A;
                  border: 1px solid #1E293B; border-radius: 10px; overflow: hidden;
                  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
                  display: none; flex-direction: column; }
  .floating-log.open { display: flex; }
  .floating-log-header { display: flex; align-items: center; justify-content: space-between;
                         gap: 12px; padding: 12px 14px; background: #1E293B;
                         border-bottom: 1px solid #334155; }
  .floating-log-title { color: white; font-size: 13px; font-weight: 600; }
  .floating-log-actions { display: flex; align-items: center; gap: 10px; }
  .floating-log-actions button { background: transparent; color: var(--sidebar-muted);
                                 border: none; padding: 4px 6px; font-size: 12px;
                                 cursor: pointer; border-radius: 4px; }
  .floating-log-actions button:hover { background: rgba(255,255,255,0.08); color: white; }
  .floating-log-body { padding: 12px 14px; font-family: "Consolas", "Menlo", monospace;
                       font-size: 11.5px; white-space: pre-wrap; height: 280px;
                       overflow-y: auto; color: #CBD5E1; line-height: 1.55; }
  .floating-log-body .line-error { color: #FCA5A5; }
  .floating-log-body .line-warn  { color: #FCD34D; }
  .floating-log-body .line-info  { color: #94A3B8; }

  /* Botao flutuante que reabre o log quando fechado */
  .log-fab { position: fixed; bottom: 24px; right: 24px; z-index: 100;
             width: 52px; height: 52px; border-radius: 50%;
             background: #0F172A; color: white; border: 1px solid #334155;
             display: flex; align-items: center; justify-content: center;
             cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,0.3); padding: 0; }
  .log-fab:hover { background: #1E293B; }
  .log-fab.hidden { display: none; }

  /* Cor por resultado na tabela de eventos */
  td.status.renamed { color: #2563EB; }

  /* Responsivo simples: em telas estreitas empilha a sidebar por cima */
  @media (max-width: 1100px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
  }
  @media (max-width: 900px) {
    body { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; }
    .sidebar-toggle { display: none; }
    .grid { grid-template-columns: 1fr; }
    .content-header, main.dashboard { padding-left: 20px; padding-right: 20px; }
    .login-card { flex-wrap: wrap; }
    .floating-log { width: calc(100vw - 32px); right: 16px; bottom: 16px; }
  }

  /* v2.6 UX: sidebar sem overflow, recolhimento slim e dashboard mais compacto */
  html, body { overflow-x: hidden; }
  .sidebar { overflow: visible; width: 238px; transition: width .28s cubic-bezier(.4,0,.2,1); }
  .sidebar-nav { overflow-x: hidden; }
  .sidebar-toggle { top: 50%; right: -12px; transform: translateY(-50%); width: 24px; height: 48px;
                    border-radius: 0 9px 9px 0; box-shadow: 2px 0 8px rgba(15,23,42,.16);
                    transition: width .18s ease, background .18s ease, transform .28s ease; }
  .sidebar-toggle:hover { width: 29px; }
  .sidebar.collapsed { width: 72px; }
  .sidebar-logo-txt, .sidebar-section, .sidebar-nav a span, .sidebar-user-info, .service-active-txt {
    transition: opacity .16s ease, transform .22s ease;
  }
  .sidebar.collapsed .sidebar-logo-txt, .sidebar.collapsed .sidebar-section,
  .sidebar.collapsed .sidebar-nav a span, .sidebar.collapsed .sidebar-user-info,
  .sidebar.collapsed .service-active-txt { opacity:0; transform:translateX(-8px); pointer-events:none; }
  .sidebar.collapsed .sidebar-nav a { position:relative; }
  .sidebar.collapsed .sidebar-nav a:hover::after { content:attr(data-tip); position:absolute; left:58px; top:50%;
      transform:translateY(-50%); background:#111827; color:white; padding:7px 10px; border-radius:6px;
      white-space:nowrap; font-size:12px; z-index:30; box-shadow:0 5px 18px rgba(0,0,0,.2); }
  .stats-row { gap: 12px; margin-bottom: 16px; }
  .stat-card { min-height: 92px !important; padding: 14px 18px !important; }
  .stat-num { font-size: 34px !important; }
  .metrics-row { grid-template-columns: 220px 1fr; gap: 14px; }
  .total-card { min-height: 150px !important; padding: 18px !important; }
  .project-panel { min-height: 500px; }
  .project-chart { min-height: 330px; }
  .history-toolbar { display:flex; gap:10px; margin-bottom:14px; flex-wrap:wrap; }
  .stage-filters .history-toolbar { align-items:flex-end; }
  .history-toolbar input, .history-toolbar select { padding:9px 11px; border:1px solid var(--border); border-radius:7px; background:white; }

  .stage-badge { display:inline-flex; min-width:54px; justify-content:center; padding:4px 8px; border-radius:999px; font-size:10px; font-weight:800; letter-spacing:.4px; }
  .stage-badge.pass { color:#047857; background:#D1FAE5; }
  .stage-badge.fail { color:#B91C1C; background:#FEE2E2; }
  .stage-badge.pending { color:#64748B; background:#F1F5F9; }

  /* v2.9: gráfico compacto e histórico por etapas */
  .project-panel { min-height: 300px !important; }
  .project-chart { min-height: 180px !important; }
  .chart-svg { max-height: 330px; }
  .history-filters { align-items:center; }
  .history-filters input[type="search"] { min-width:220px; }
  .history-filters select { min-width:150px; }
  .date-filter { display:flex; align-items:center; gap:6px; color:var(--muted); font-size:12px; }
  .date-filter input { width:142px; }
  .history-spacer { flex:1; }
  .history-count { font-size:12px; color:var(--muted); margin:-4px 0 10px; }
  @media (max-width: 1200px) { .history-spacer { display:none; } }

  .header-shutdown { background:#fff; border:1px solid #fecaca; color:#dc2626; width:38px; height:38px;
                     border-radius:8px; display:grid; place-items:center; cursor:pointer; transition:.18s ease; }
  .header-shutdown:hover { background:#fef2f2; border-color:#ef4444; }
  .shutdown-overlay { display:none; position:fixed; inset:0; background:rgba(15,23,42,.48); z-index:1000; place-items:center; }
  .shutdown-overlay.open { display:grid; }
  .shutdown-modal { width:min(460px,calc(100vw - 36px)); background:white; border-radius:14px; padding:24px; box-shadow:0 24px 70px rgba(0,0,0,.25); }
  .shutdown-modal h3 { margin:0 0 8px; }
  .shutdown-modal p { color:var(--muted); line-height:1.5; }
  .shutdown-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }
  .danger { background:#dc2626 !important; color:white !important; border-color:#dc2626 !important; }

  /* v2.6: dashboard responsivo e melhor aproveitamento vertical */
  main.dashboard { max-width:none; width:100%; padding:18px 28px 28px; }
  .content-header { padding:18px 28px 14px; }
  .status-row { gap:12px; margin-bottom:14px; }
  .status-big { min-height:68px; padding:13px 18px; }
  .status-big-icon { width:40px; height:40px; font-size:20px; }
  .status-big-label { font-size:18px; }
  .stats-row { gap:12px; margin-bottom:14px; }
  .stat-card { min-height:78px !important; padding:11px 16px !important; }
  .stat-card .stat-num { font-size:30px !important; }
  .metrics-row { grid-template-columns:154px minmax(0,1fr); gap:12px; margin-bottom:14px; align-items:stretch; }
  .totals-col { gap:12px; }
  .total-card { min-height:102px !important; padding:12px 10px !important; }
  .total-card .total-num { font-size:38px; margin:2px 0 5px; }
  .total-card .total-label { font-size:10px; margin-bottom:3px; }
  .total-card .total-sub { font-size:9.5px; line-height:1.25; }
  .project-panel { min-height:clamp(360px,52vh,620px); padding:16px 18px; }
  .project-chart { min-height:clamp(250px,37vh,480px); }
  .project-chips { margin-bottom:10px; }
  .shutdown-screen { display:none; position:fixed; inset:0; z-index:2000; background:#f8fafc; align-items:center; justify-content:center; text-align:center; padding:32px; }
  .shutdown-screen.show { display:flex; }
  .shutdown-screen-card { width:min(520px,92vw); }
  .shutdown-power { width:112px; height:112px; margin:0 auto 24px; border-radius:50%; display:grid; place-items:center; background:#fee2e2; color:#dc2626; font-size:56px; border:1px solid #fecaca; box-shadow:0 12px 35px rgba(220,38,38,.12); }
  .shutdown-screen h1 { margin:0 0 10px; font-size:28px; }
  .shutdown-screen p { margin:0; color:var(--muted); line-height:1.6; font-size:14px; }
  .shutdown-screen .off-label { margin-top:20px; display:inline-flex; gap:8px; align-items:center; padding:8px 14px; border-radius:999px; background:#e5e7eb; color:#475569; font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.6px; }
  @media (max-height:800px) and (min-width:901px) {
    .content-header { padding-top:12px; padding-bottom:10px; }
    main.dashboard { padding-top:12px; padding-bottom:16px; }
    .status-big { min-height:58px; padding:9px 15px; }
    .status-big-icon { width:34px; height:34px; }
    .status-big-label { font-size:16px; }
    .status-big-hint { font-size:10px; }
    .stat-card { min-height:66px !important; padding:8px 12px !important; }
    .stat-card .stat-num { font-size:26px !important; }
    .metrics-row { grid-template-columns:145px minmax(0,1fr); }
    .total-card { min-height:86px !important; padding:9px !important; }
    .total-card .total-num { font-size:32px; }
    .project-panel { min-height:390px; }
    .project-chart { min-height:270px; }
  }
  @media (max-width:1200px) and (min-width:901px) {
    .sidebar { width:210px; }
    .metrics-row { grid-template-columns:140px minmax(0,1fr); }
    main.dashboard,.content-header { padding-left:18px; padding-right:18px; }
  }
  @media (max-width:900px) {
    .metrics-row { grid-template-columns:1fr; }
    .totals-col { display:grid; grid-template-columns:1fr 1fr; }
    .project-panel { min-height:420px; }
  }


/* Adaptation of the original CSR Lite stylesheet to authenticated portal routes. */
body{display:block}#workspace{display:flex;min-height:100vh;width:100%}[hidden]{display:none!important}.sidebar{flex-shrink:0}.content{min-width:0}.sidebar.collapsed .sidebar-logo-txt,.sidebar.collapsed .sidebar-section,.sidebar.collapsed .sidebar-nav a span,.sidebar.collapsed .sidebar-user-info,.sidebar.collapsed .service-active-txt{display:none}.sidebar.collapsed .sidebar-user{padding:14px 16px}.sidebar-toggle{z-index:5}.sidebar-user-avatar{background:#475569}
.content-header{min-height:80px}.content-header h1{font-size:22px}.header-refresh{font-size:22px}.header-updated{white-space:nowrap}
.project-panel{min-height:300px!important;display:flex;flex-direction:column}.project-chart{min-height:180px!important;flex:1;display:flex;align-items:center;justify-content:center}.project-chart svg{width:100%;height:220px}.chart-legend{margin-top:10px}.swatch-pass{background:var(--accent)}.swatch-fail{background:var(--err)}
.history-table-wrap{border:1px solid var(--border);border-radius:10px;overflow:auto;background:#fff;box-shadow:var(--card-shadow)}.history-table-wrap table{min-width:1100px}.history-table-wrap th{white-space:nowrap;font-weight:500}.history-table-wrap td{font-size:12px;height:43px}.history-table-wrap td:nth-child(4){overflow-wrap:anywhere;max-width:440px}.history-table-wrap td:last-child{min-width:160px;max-width:330px}.history-table-wrap tr:last-child td{border-bottom:0}.history-table-wrap td:nth-child(1){white-space:nowrap}
.stage-filters{font-size:12px;color:var(--muted);margin:0 0 14px}.stage-filters summary{cursor:pointer}.stage-filters .history-toolbar{margin-top:10px}.pagination{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-top:14px;font-size:11px;color:var(--muted)}.pagination>div{display:flex;gap:12px;align-items:center}.pagination button{padding:6px 10px;font-size:11px}
.admin-tabs{display:flex;gap:6px;margin:0 0 18px;border-bottom:1px solid var(--border);padding-bottom:10px}.admin-tabs a{padding:7px 12px;text-decoration:none;color:var(--muted);font-size:12px;border-radius:6px}.admin-tabs a.active{background:var(--accent-soft);color:var(--accent-dark)}.first-title{margin-top:0}.auth-settings{margin-bottom:18px}.auth-description{line-height:1.7;color:var(--muted);font-size:13px;margin:0 0 18px}.settings-grid,.admin-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.settings-grid{margin-bottom:20px}label{display:flex;flex-direction:column;gap:8px;font-size:13px}input,select{font:inherit;padding:10px;border:1px solid #d4dce6;border-radius:6px;min-width:0;width:100%;color:var(--text);background:white}input[readonly]{background:#f8fafc;color:#52657a}.date-filter{flex-direction:row}.history-toolbar>input{width:220px}.history-toolbar>select{width:auto}.history-toolbar button{white-space:nowrap}
.auth-settings .login-card{margin:18px 0 24px;padding:20px;min-height:98px}.auth-settings .login-card h3{margin:0 0 6px;font-size:18px}.auth-settings .login-card p{margin:0;font-size:13px;color:var(--muted);line-height:1.6}.auth-settings .login-icon{width:64px;height:56px;border-radius:50%;background:#f8fafc;display:grid;place-items:center;font-size:26px;color:#64748b;flex-shrink:0}
.button{display:inline-flex;align-items:center;text-decoration:none;background:white;color:var(--text-2);border:1px solid var(--border);padding:8px 14px;border-radius:6px;font-size:13px}.button.primary{background:var(--accent);border-color:var(--accent);color:white}.help{color:var(--muted);font-size:12px;line-height:1.6}.section-heading{display:flex;justify-content:space-between;align-items:start;gap:12px}.section-heading p{font-size:12px;color:var(--muted)}.upload-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:18px}.filebox{border:1px dashed #cbd5e1;border-radius:8px;padding:24px;gap:10px;margin-bottom:16px}.filebox span{font-size:12px;color:var(--muted)}.filebox input{border:0;padding:8px 0}.folder{font-size:13px;color:var(--muted)}.simba-controls{display:flex;align-items:center;gap:14px;margin:24px 0}.simba-controls>span{font-size:12px;color:var(--muted)}#simba-timer{font-size:28px;color:#52657a;padding:12px;background:#f1f5f9;border-radius:8px}.tag{color:var(--muted);font-size:10px}.info-row{display:flex;gap:12px;align-items:center}.info-row p{color:var(--muted);font-size:12px}.user-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-bottom:4px}.user-grid button{align-self:end}.table-scroll{overflow:auto}.card+.card{margin-top:18px}.table-scroll td button{margin-right:8px}.floating-history{position:fixed;bottom:24px;right:24px;width:52px;height:52px;border-radius:50%;display:grid;place-items:center;background:#0f172a;color:white;box-shadow:0 5px 14px #0f172a44;z-index:8}.floating-history svg{width:23px;height:23px}
#toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#0f172a;color:#fff;padding:14px 20px;border-radius:8px;z-index:100;max-width:90vw;font-size:13px}
@media(max-width:900px){.sidebar{width:200px}.admin-grid,.upload-grid{grid-template-columns:1fr}.user-grid{grid-template-columns:1fr 1fr}.content-header{gap:10px}.header-updated{display:none}.settings-grid{grid-template-columns:1fr}.metrics-row{grid-template-columns:130px minmax(0,1fr)}}
@media(max-width:650px){#workspace{display:block}.sidebar,.sidebar.collapsed{width:100%;height:auto;position:relative}.sidebar-brand{padding:14px 18px}.sidebar-nav{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.sidebar-section,.sidebar-user,.service-active,.sidebar-toggle{display:none}.sidebar-nav a{padding:9px 12px}.content-header{padding:16px;min-height:74px}.content-header-title h1{font-size:20px}.content-header-title p{font-size:12px}.header-chip{display:none}main.dashboard{padding:16px}.stats-row{grid-template-columns:1fr 1fr}.status-row{grid-template-columns:1fr}.metrics-row{grid-template-columns:1fr}.totals-col{display:grid;grid-template-columns:1fr 1fr}.user-grid{grid-template-columns:1fr}.pagination{align-items:start;flex-direction:column}.history-toolbar>input{width:100%}.history-toolbar>select{flex:1}.history-spacer{display:none}.row .label{min-width:92px}.floating-history{bottom:15px;right:15px}.simba-controls{flex-wrap:wrap}.header-badges{gap:5px}}
/* Login follows the light portal panels, with a compact centered form. */
.login-screen{display:flex;align-items:center;justify-content:center;min-height:100vh;padding:40px 20px;background:#f3f7fa;font-family:Segoe UI,Arial,sans-serif}
.login-shell{width:100%;max-width:440px}
.login-brand{display:flex;align-items:center;justify-content:center;gap:12px;margin-bottom:26px;color:#16334b}
.login-brand .brandmark{width:44px;height:44px;background:#599e94;border-radius:12px}
.login-brand strong{display:block;font-size:23px;letter-spacing:-.5px}.login-brand span:not(.brandmark){display:block;font-size:12px;color:#718299;margin-top:3px}
.login-card{width:100%;padding:34px;background:#fff;border:1px solid #dfe7ee;border-radius:16px;box-shadow:0 8px 32px #18384e08}
.login-card h1{font-size:26px;letter-spacing:-.4px;margin-bottom:8px;color:#19324e}.login-description{font-size:14px;margin-bottom:18px}
.login-environment{font-size:12px;background:#f2f7f7;border-radius:7px;padding:9px 12px;margin-bottom:22px;color:#496c68}
.login-card label{font-size:14px;gap:8px;margin-top:18px;margin-bottom:8px;font-weight:600}
.login-card input{height:48px;font-size:14px;border-radius:8px}.login-card input:focus{outline-color:#99c6bd}
.password-field{position:relative}.password-field input{padding-right:80px}.password-toggle{position:absolute;right:6px;top:6px;height:36px;padding:0 10px;background:transparent;color:#476d67;border:0;font-size:12px}
.login-submit{width:100%;height:48px;background:#599e94;font-size:14px;margin-top:25px;border-radius:8px}.login-submit:hover{background:#488b82}
.login-error{background:#fff1f1;border:1px solid #f0c7cc;color:#9c2939;padding:12px;border-radius:8px;font-size:13px;line-height:1.5}
.login-help{margin-top:20px;font-size:13px;color:#5a7489}.login-help summary{cursor:pointer;text-align:center}.login-help p{margin:12px 0 0;font-size:12px}
.login-footer{text-align:center;font-size:11px;color:#8394a4;margin:22px 0 0}
@media(max-width:480px){.login-screen{padding:25px 16px}.login-card{padding:26px 22px}.login-brand{margin-bottom:20px}}

.login-screen{background:var(--content-bg)}.login-screen .login-card{display:block;margin:0;border-left-width:1px}.login-brand .brandmark{width:44px;height:44px;display:grid;place-items:center;color:white;font-size:24px;font-weight:800;background:var(--accent);border-radius:10px}.login-submit{background:var(--accent);color:white;border:0;font-weight:600}.login-submit:hover{background:var(--accent-dark)}.password-toggle{background:transparent;border:0}.login-card input{width:100%}.login-brand span:not(.brandmark){text-transform:uppercase;font-size:10px;letter-spacing:.7px}

.admin-grid>.card+.card,.upload-grid>.card+.card{margin-top:0}

.online-folders{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin:20px 0}.online-folders button{text-align:left;padding:20px;font-size:18px;border:1px solid var(--border);background:white;color:var(--text)}.online-folders button.selected{border:2px solid var(--accent);background:#ecfdf5}.online-folders b{float:right}.online-folders small{display:block;font-size:12px;font-weight:400;margin-top:10px;color:var(--muted)}#online-filter label{min-width:220px}#online-filter{align-items:end}#online-rows td:last-child{white-space:nowrap}@media(max-width:650px){.online-folders{grid-template-columns:1fr}}

.header-shutdown{width:auto!important;min-width:76px;white-space:nowrap;padding:8px 12px!important}
.operation-tabs{display:flex;gap:6px;flex-wrap:wrap;border-bottom:1px solid var(--border);margin:0 0 20px;padding-bottom:8px}.operation-tabs button{background:transparent;border:0;color:var(--muted);padding:12px 18px}.operation-tabs button[aria-selected="true"]{color:#008577;background:#e4f8f5;box-shadow:inset 0 -3px #00bfa5}.operation-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:24px 0 12px}.operation-heading h2{font-size:14px;margin:0}.operation-heading span{color:var(--muted);font-size:12px}.scan-summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin:20px 0}.scan-summary div{display:flex;flex-direction:column;gap:6px;min-width:0}.scan-summary span{font-size:12px;color:var(--muted)}.scan-summary b{font-size:13px;overflow-wrap:anywhere}.consult-form{display:flex;align-items:end;gap:14px;flex-wrap:wrap}.consult-form label{min-width:240px}.stage-badge.neutral{background:#edf0f4;color:#64748b}.operation-heading+.help{margin-bottom:12px}#selected-files{overflow-wrap:anywhere}.scan-settings{margin-top:20px}@media(max-width:650px){.scan-summary{grid-template-columns:1fr}.operation-heading{align-items:flex-start;flex-direction:column}.consult-form label{min-width:0;width:100%}.operation-tabs button{padding:12px}.scan-settings .user-grid{grid-template-columns:1fr}}

/* Dashboard 2.5: overview and registered projects, matching the supplied model. */
.overview-panel,.registered-panel{background:#fff;border:1px solid var(--border);border-radius:9px;box-shadow:var(--card-shadow);padding:24px;margin-top:18px}
.overview-panel h2,.registered-panel h2{margin:0 0 20px;font-size:12px;font-weight:700;letter-spacing:.7px;text-transform:uppercase;color:#64748b}
.overview-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.overview-metric{display:flex;flex-direction:column;justify-content:center;gap:8px;min-height:82px;padding:14px 16px;background:#f6f7f9;border:1px solid #e2e8f0;border-radius:7px}
.overview-metric span{font-size:10px;letter-spacing:.4px;text-transform:uppercase;color:#718096;line-height:1.5}
.overview-metric strong{font-size:22px;line-height:1.2;color:#111827;font-variant-numeric:tabular-nums}
.overview-metric.registered{background:#e4f8f5;border-color:#99e7dc}.overview-metric.registered strong{color:#008577}
.overview-metric.failures{background:#fcf0f0;border-color:#f5bcbc}.overview-metric.failures strong{color:#dc2626}
.registered-panel{padding-bottom:16px}.registered-chart{overflow-x:auto;min-height:250px}.registered-chart svg{display:block;width:100%;height:auto;max-height:340px}.registered-chart .chart-empty{min-height:250px;display:grid;place-items:center;color:#718096;font-size:13px}
@media(max-width:1100px){.overview-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){.overview-panel,.registered-panel{padding:18px}.overview-grid{gap:10px}.overview-metric{padding:12px}.overview-metric strong{font-size:20px}}
@media(max-width:380px){.overview-grid{grid-template-columns:1fr}}

.registration-grid{grid-template-columns:1fr 1fr;gap:18px 20px}.form-wide{grid-column:1/-1}.form-note{background:#f8fafc;border-left:2px solid #d4dce6;padding:12px;font-size:12px;color:var(--muted)}.form-actions{display:flex;justify-content:flex-end;gap:10px;border-top:1px solid var(--border);padding-top:16px}.password-control{display:flex;position:relative}.password-control input{padding-right:75px}.password-control button{position:absolute;right:5px;top:5px;background:transparent;border:0;padding:7px;font-size:11px}.registration-grid small{font-size:11px;color:var(--muted)}@media(max-width:650px){.registration-grid{grid-template-columns:1fr}}

/* CSR Upload access layout, using the portal palette. */
.login-shell{max-width:370px}
.login-brand{gap:10px;margin-bottom:34px;color:var(--text)}
.login-brand .brandmark{width:60px;height:66px;flex-shrink:0;border-radius:10px;background:var(--accent);border:2px solid var(--accent-dark);font-size:38px}
.login-brand strong{font-size:30px;letter-spacing:-.6px;line-height:1.15}
.login-brand span:not(.brandmark){font-size:15px;font-weight:600;letter-spacing:0;text-transform:none;color:var(--accent-dark);margin-top:3px}
.login-screen .login-card{padding:30px 28px;border:1px solid var(--border);border-radius:14px;box-shadow:0 8px 28px #0f172a04}
.login-screen .login-card h1{font-size:22px;color:var(--text);margin:14px 0 20px;padding-bottom:12px;border-bottom:1px solid var(--border)}
.login-screen .login-card label{font-size:12px;margin-top:16px;color:var(--text)}
.login-screen .login-card input{height:41px;font-size:13px;background:var(--content-bg);border-color:var(--border)}
.login-screen .login-card input:focus{outline:2px solid var(--accent);outline-offset:1px}
.login-screen .password-toggle{top:3px;height:35px;color:var(--accent-dark);font-size:11px}
.login-screen .login-submit{height:41px;margin-top:20px;font-size:13px;background:var(--accent);color:white}
.login-screen .login-submit:hover{background:var(--accent-dark)}
.login-support{text-align:center;font-size:12px;font-weight:600;line-height:1.6;color:var(--accent-dark);margin:32px 0 0}
.sidebar-logo-sub{text-transform:none;letter-spacing:.2px;font-size:10px}
@media(max-width:400px){.login-screen{padding:24px 16px}.login-screen .login-card{padding:24px 22px}.login-brand strong{font-size:27px}}
