/* Jev Showcase — design system compartilhado (tema escuro premium, sem fontes externas) */
:root {
  --bg: #0a0a0f;
  --bg-elev: #13161f;
  --bg-elev-2: #191d29;
  --bg-card: rgba(255,255,255,.04);
  --bg-card-2: rgba(255,255,255,.065);
  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.14);
  --border-hover: rgba(167,139,250,.45);
  --text: #e8e8ec;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --purple: #a78bfa;
  --pink: #f472b6;
  --amber: #fbbf24;
  --orange: #fb923c;
  --cyan: #22d3ee;
  --blue: #60a5fa;
  --green: #34d399;
  --good: #10b981;
  --mid: #eab308;
  --low: #ef4444;
  --jev-grad: linear-gradient(135deg, #a78bfa 0%, #22d3ee 100%);
  --hot-grad: linear-gradient(135deg, #a78bfa 0%, #f472b6 100%);
  --radius: 16px;
  --radius-lg: 20px;
  --shadow: 0 10px 40px rgba(0,0,0,.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --topbar-h: 60px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse at top, #1a1030 0%, rgba(10,10,15,0) 55%),
    radial-gradient(ellipse at bottom right, #0c2030 0%, rgba(10,10,15,0) 60%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .35;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}
a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: clamp(26px, 4vw, 44px); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: clamp(20px, 2.4vw, 28px); font-weight: 800; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0 0 .8em; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.grad-text { background: linear-gradient(135deg, #fff 0%, #a78bfa 50%, #f472b6 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.jev-text { background: var(--jev-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
::selection { background: rgba(167,139,250,.35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Topbar ---------- */
.jev-topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: rgba(10,10,15,.72); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.jev-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.jev-logo {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 9px;
  font-weight: 900; font-size: 13px; letter-spacing: .12em; color: #0a0a0f; background: var(--jev-grad);
  box-shadow: 0 0 22px rgba(34,211,238,.25);
}
.jev-logo svg { width: 14px; height: 14px; }
.jev-apptitle { display: flex; flex-direction: column; min-width: 0; }
.jev-apptitle b { font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jev-apptitle span { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jev-topbar .spacer { flex: 1; }
.jev-metrics { display: flex; align-items: center; gap: 8px; }
.jev-metric {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 10px; border-radius: 999px;
  background: var(--bg-card); border: 1px solid var(--border); font-size: 12px; color: var(--text-muted); white-space: nowrap;
}
.jev-metric b { font-family: var(--mono); font-size: 13px; color: var(--text); font-weight: 700; }
.jev-metric.flash { animation: jevflash .6s ease; }
@keyframes jevflash { 0% { border-color: rgba(34,211,238,.9); box-shadow: 0 0 18px rgba(34,211,238,.45); } 100% { border-color: var(--border); box-shadow: none; } }
.lat-good b { color: var(--green); } .lat-mid b { color: var(--amber); } .lat-bad b { color: var(--low); }

/* ---------- Layout ---------- */
.jev-shell { width: 100%; max-width: 1440px; margin: 0 auto; padding: 22px 18px 40px; }
.jev-hero { margin: 8px 0 18px; }
.jev-hero p { color: var(--text-muted); font-size: clamp(15px, 1.5vw, 17px); max-width: 780px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 960px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Cards ---------- */
.jev-card {
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015));
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px;
  transition: border-color .2s ease;
}
.jev-card:hover { border-color: var(--border-strong); }
.jev-card > h3:first-child, .jev-card-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.jev-card.glow { border-color: rgba(167,139,250,.35); box-shadow: 0 0 0 1px rgba(167,139,250,.12), 0 20px 60px rgba(124,58,237,.12); }

/* ---------- Buttons / inputs ---------- */
.jev-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--border-strong); background: var(--bg-card-2); color: var(--text);
  font: 700 14px/1 var(--font); cursor: pointer; transition: transform .08s ease, border-color .2s, background .2s, box-shadow .2s; white-space: nowrap;
}
.jev-btn:hover { border-color: var(--border-hover); background: rgba(167,139,250,.08); }
.jev-btn:active { transform: translateY(1px); }
.jev-btn:disabled { opacity: .5; cursor: not-allowed; }
.jev-btn--primary { background: var(--hot-grad); color: #0a0a0f; border-color: transparent; box-shadow: 0 8px 26px rgba(167,139,250,.28); }
.jev-btn--primary:hover { background: var(--hot-grad); filter: brightness(1.08); border-color: transparent; }
.jev-btn--jev { background: var(--jev-grad); color: #0a0a0f; border-color: transparent; }
.jev-btn--ghost { background: transparent; }
.jev-btn--sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.jev-input, .jev-textarea, .jev-select {
  width: 100%; min-height: 44px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: rgba(0,0,0,.35); color: var(--text); font: 15px/1.45 var(--font); outline: none; transition: border-color .2s, box-shadow .2s;
}
.jev-textarea { min-height: 120px; resize: vertical; }
.jev-input:focus, .jev-textarea:focus, .jev-select:focus { border-color: rgba(167,139,250,.7); box-shadow: 0 0 0 4px rgba(167,139,250,.14); }
.jev-input::placeholder, .jev-textarea::placeholder { color: var(--text-dim); }
label.jev-label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 6px; }

.jev-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text); font: 600 13px/1.2 var(--font); cursor: pointer; text-align: left;
}
.jev-chip:hover { border-color: var(--border-hover); background: rgba(167,139,250,.08); }
.jev-chip.active { border-color: rgba(167,139,250,.8); background: rgba(167,139,250,.16); }

.jev-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font: 800 11px/1.6 var(--font); letter-spacing: .06em; text-transform: uppercase; border: 1px solid transparent; white-space: nowrap; }
.jev-badge.good { color: #6ee7b7; background: rgba(16,185,129,.14); border-color: rgba(16,185,129,.35); }
.jev-badge.mid { color: #fde68a; background: rgba(234,179,8,.14); border-color: rgba(234,179,8,.35); }
.jev-badge.low { color: #fca5a5; background: rgba(239,68,68,.14); border-color: rgba(239,68,68,.4); }
.jev-badge.info { color: #a5f3fc; background: rgba(34,211,238,.12); border-color: rgba(34,211,238,.35); }
.jev-badge.violet { color: #ddd6fe; background: rgba(167,139,250,.14); border-color: rgba(167,139,250,.4); }

/* ---------- KPI ---------- */
.jev-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.jev-kpi { padding: 14px 16px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border); }
.jev-kpi .k { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.jev-kpi .v { font: 800 26px/1.2 var(--mono); margin-top: 4px; font-variant-numeric: tabular-nums; }
.jev-kpi .s { font-size: 12px; color: var(--text-dim); }

/* ---------- Probability bars ---------- */
.jev-bars { display: flex; flex-direction: column; gap: 8px; }
.jev-bar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 52px; align-items: center; gap: 10px; font-size: 13px; }
.jev-bar .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); }
.jev-bar .trk { height: 10px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; position: relative; }
.jev-bar .fil { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; background: rgba(255,255,255,.22); transition: width .45s cubic-bezier(.2,.8,.2,1); }
.jev-bar .pct { text-align: right; font: 700 13px var(--mono); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.jev-bar.top .lbl { color: var(--text); font-weight: 700; }
.jev-bar.top .fil { background: var(--jev-grad); box-shadow: 0 0 14px rgba(34,211,238,.4); }
.jev-bar.top .pct { color: var(--text); }
.jev-bar.danger.top .fil { background: linear-gradient(135deg, #f87171, #f472b6); box-shadow: 0 0 14px rgba(248,113,113,.4); }
.jev-bar.safe.top .fil { background: linear-gradient(135deg, #34d399, #22d3ee); }

/* gauge */
.jev-gauge { position: relative; width: 100%; max-width: 260px; aspect-ratio: 2 / 1.15; margin: 0 auto; }
.jev-gauge svg { width: 100%; height: 100%; overflow: visible; }
.jev-gauge .gv { position: absolute; left: 0; right: 0; bottom: 4%; text-align: center; font: 900 clamp(28px, 4vw, 40px)/1 var(--mono); }
.jev-gauge .gl { position: absolute; left: 0; right: 0; bottom: -18px; text-align: center; font-size: 12px; color: var(--text-muted); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

/* score meter */
.jev-score { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.jev-score .seg { height: 10px; border-radius: 4px; background: rgba(255,255,255,.07); position: relative; overflow: hidden; }
.jev-score .seg i { position: absolute; inset: 0; background: var(--jev-grad); opacity: 0; transition: opacity .35s; }
.jev-score-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dim); margin-top: 6px; gap: 8px; }

/* ---------- Drawer (inspetor) ---------- */
.jev-drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .2s; }
.jev-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 91; background: #0e1018; border-left: 1px solid var(--border-strong); box-shadow: -30px 0 80px rgba(0,0,0,.5); transform: translateX(102%); transition: transform .25s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; }
.jev-drawer.open { transform: none; }
.jev-drawer.open + .jev-drawer-backdrop, .jev-drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.jev-drawer header { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.jev-drawer header h3 { margin: 0; font-size: 16px; }
.jev-drawer .body { padding: 14px 18px 30px; overflow: auto; flex: 1; }
.jev-drawer .explain { font-size: 13px; color: var(--text-muted); background: rgba(34,211,238,.06); border: 1px solid rgba(34,211,238,.2); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }
.jev-call { border: 1px solid var(--border); border-radius: 14px; margin-bottom: 12px; background: var(--bg-card); overflow: hidden; }
.jev-call .hd { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 10px 12px; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.jev-call .hd b { color: var(--text); font-family: var(--mono); }
.jev-call .tabs { display: flex; gap: 4px; padding: 8px 10px 0; }
.jev-call .tabs button { background: none; border: 1px solid transparent; color: var(--text-muted); font: 700 12px var(--font); padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.jev-call .tabs button.on { color: var(--text); border-color: var(--border-strong); background: rgba(255,255,255,.05); }
.jev-call pre { margin: 0; padding: 10px 12px 12px; max-height: 360px; overflow: auto; font: 12px/1.5 var(--mono); color: #cbd5e1; white-space: pre-wrap; word-break: break-word; }
.jev-call pre .k { color: #c4b5fd; } .jev-call pre .s { color: #86efac; } .jev-call pre .n { color: #fcd34d; } .jev-call pre .b { color: #f9a8d4; }

/* ---------- Toast ---------- */
.jev-toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(560px, calc(100vw - 24px)); }
.jev-toast { pointer-events: auto; padding: 12px 16px; border-radius: 12px; background: #151826; border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 14px; animation: jevtoast .25s ease; max-width: 100%; }
.jev-toast.err { border-color: rgba(239,68,68,.55); }
.jev-toast.ok { border-color: rgba(16,185,129,.55); }
@keyframes jevtoast { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Misc ---------- */
.jev-empty { padding: 28px; text-align: center; color: var(--text-dim); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.jev-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.15); border-top-color: var(--cyan); animation: jevspin .7s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes jevspin { to { transform: rotate(360deg); } }
.jev-pulse { animation: jevpulse 1.4s ease-in-out infinite; }
@keyframes jevpulse { 50% { opacity: .45; } }
.jev-footer { max-width: 1440px; margin: 0 auto; padding: 18px; color: var(--text-dim); font-size: 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; border-top: 1px solid var(--border); }
.jev-footer a { color: var(--text-muted); }
.jev-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.jev-table th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border-strong); position: sticky; top: 0; background: #10131c; }
.jev-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.kbd { font: 700 11px var(--mono); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border-strong); background: rgba(255,255,255,.05); }

@media (max-width: 760px) {
  :root { --topbar-h: 56px; }
  .jev-topbar { padding: 0 10px; gap: 8px; }
  .jev-metric.opt { display: none; }
  .jev-apptitle span { display: none; }
  .jev-shell { padding: 14px 12px 32px; }
  .jev-hide-mobile { display: none !important; }
}
@media (max-width: 480px) {
  .jev-metrics .jev-metric:not(.lat) { display: none; }
}
@media print {
  body::before, body::after, .jev-topbar, .jev-drawer, .jev-toasts { display: none !important; }
  body { background: #fff; color: #000; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
