:root {
  --bg: #0a0d0c;
  --surface: #131918;
  --surface2: #18211f;
  --line: rgba(0, 196, 140, 0.16);
  --line2: rgba(0, 196, 140, 0.34);
  --emerald: #00c48c;
  --emerald2: #00e6a5;
  --text: #edf5f2;
  --muted: #8ea39b;
  --amber: #f59e0b;
  --red: #f43f5e;
  --blue: #38bdf8;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: radial-gradient(900px 480px at 85% -12%, rgba(0, 196, 140, 0.14), transparent 62%), var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  min-height: 100vh;
}
.mono { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
body.privacy-mode .secret-val { filter: blur(8px); user-select: none; transition: filter .15s; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line2); border-radius: 20px; padding: 30px; box-shadow: 0 28px 80px rgba(0,0,0,.6); }

/* App Shell */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: #070a09; border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 10px; border-bottom: 1px solid var(--line); }
.brand-ico { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--emerald), #059669); display: flex; align-items: center; justify-content: center; font-weight: 800; color: #03150f; font-size: 17px; }
.group-lbl { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; color: #567067; padding: 8px 10px 2px; }
.nav-btn { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; text-align: left; }
.nav-btn:hover { background: rgba(0,196,140,.08); color: #fff; }
.nav-btn.active { background: rgba(0,196,140,.16); border-color: rgba(0,196,140,.38); color: #fff; box-shadow: inset 3px 0 0 var(--emerald); }

/* Topbar */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); background: rgba(10, 13, 12, .88); border-bottom: 1px solid var(--line); padding: 12px 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.goal-wrap { min-width: 210px; max-width: 280px; flex: 1; }
.goal-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.bar-track { height: 7px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #059669, var(--emerald2)); transition: width .25s; }
.bar-fill.danger { background: linear-gradient(90deg, #e11d48, #fb7185); }

.btn { background: var(--surface2); border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 8px 12px; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-family: inherit; }
.btn:hover { border-color: var(--emerald); }
.btn.primary { background: linear-gradient(135deg, var(--emerald), var(--emerald2)); color: #03150f; border: none; font-weight: 700; }
.btn.sm { padding: 5px 9px; font-size: 11.5px; }
.btn.danger { background: rgba(244,63,94,.12); border-color: rgba(244,63,94,.32); color: #fda4af; }

.content { padding: 20px 22px 48px; max-width: 1460px; width: 100%; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 16px 18px; margin-bottom: 14px; }
.card-h { font-size: 14.5px; font-weight: 800; margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.k-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.k-val { font-size: 23px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.k-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.ok { color: var(--emerald2); }
.bad { color: var(--red); }
.warn { color: var(--amber); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pills { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 10px; background: #070a09; border: 1px solid var(--line); }
.pill { background: transparent; border: none; color: var(--muted); padding: 6px 11px; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; }
.pill.active { background: var(--emerald); color: #03150f; font-weight: 700; }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.ok { background: rgba(0,196,140,.16); color: #34d399; border: 1px solid rgba(0,196,140,.32); }
.badge.warn { background: rgba(245,158,11,.15); color: #fbbf24; border: 1px solid rgba(245,158,11,.32); }
.badge.bad { background: rgba(244,63,94,.15); color: #fb7185; border: 1px solid rgba(244,63,94,.32); }
.badge.blue { background: rgba(56,189,248,.14); color: #7dd3fc; border: 1px solid rgba(56,189,248,.3); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #0c100f; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; padding: 9px 11px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #101715; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 11px; border-bottom: 1px solid rgba(255,255,255,.05); white-space: nowrap; }
tr:hover td { background: rgba(0,196,140,.05); }
.r { text-align: right; font-variant-numeric: tabular-nums; }

input, select, textarea { width: 100%; background: #070b0a; border: 1px solid var(--line2); border-radius: 9px; color: var(--text); padding: 9px 11px; font-size: 12.5px; font-family: inherit; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--emerald2); }
label { display: block; font-size: 11px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.code { background: #050807; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: #6ee7b7; word-break: break-all; white-space: pre-wrap; }

/* Modais (Módulos em 2 colunas + Ver Evento + Replay) */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 60; padding: 18px; }
.modal-bg.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--line2); border-radius: 18px; padding: 22px; width: 100%; max-width: 720px; max-height: 88vh; overflow-y: auto; box-shadow: 0 30px 90px rgba(0,0,0,.7); }
.mod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mod-item { padding: 11px 13px; border-radius: 11px; background: #0c1110; border: 1px solid var(--line); cursor: pointer; text-align: left; color: var(--text); }
.mod-item:hover { border-color: var(--emerald); background: rgba(0,196,140,.1); }

/* Curva VTurb SVG */
.vsl-chart-box { position: relative; background: #070b0a; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.vsl-tooltip { position: absolute; pointer-events: none; background: #131918; border: 1px solid var(--emerald); border-radius: 9px; padding: 6px 10px; font-size: 12px; display: none; box-shadow: 0 10px 26px rgba(0,0,0,.6); }

.toast { position: fixed; right: 18px; bottom: 18px; background: #131918; border: 1px solid var(--emerald); color: #d1fae5; padding: 10px 15px; border-radius: 10px; font-size: 12.5px; font-weight: 700; display: none; z-index: 90; }

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .grid2, .grid3, .mod-grid { grid-template-columns: 1fr; }
}
