/* o atributo hidden sempre vence regras de display (ex.: .panel { display: grid }) */
[hidden] { display: none !important; }
:root {
  --bg: #f5f7fa; --surface: #ffffff; --surface-2: #f0f3f7; --text: #18212f; --muted: #5d6b7e; --line: #e1e6ed;
  --brand: #1d4ed8; --brand-ink: #ffffff; --brand-soft: #e6edfc;
  --side: #0f1b2d; --side-text: #c6d0de; --side-active: #1d2c45; --side-ink: #ffffff;
  --ok: #157347; --ok-soft: #e3f4ea; --warn: #9a5b00; --warn-soft: #fdf1dc; --bad: #b42318; --bad-soft: #fde8e6;
  --info: #3b5bdb; --info-soft: #e7ecfd; --neutral-soft: #eceff3;
  --c1: #1d4ed8; --c2: #157347; --c3: #d97706; --c4: #b42318; --c5: #8796a8;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d131c; --surface: #141c27; --surface-2: #1a2431; --text: #e5eaf1; --muted: #93a1b4; --line: #263243;
    --brand: #5b8def; --brand-ink: #0b1220; --brand-soft: #1b2a45;
    --side: #0a1018; --side-text: #9fb0c6; --side-active: #182335; --side-ink: #ffffff;
    --ok: #4cc38a; --ok-soft: #12291f; --warn: #f0b354; --warn-soft: #2d2213; --bad: #f07a6e; --bad-soft: #2e1714;
    --info: #8aa4f5; --info-soft: #1a2340; --neutral-soft: #222c39;
    --c1: #5b8def; --c2: #4cc38a; --c3: #f0b354; --c4: #f07a6e; --c5: #6b7a8d;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
h3 { font-size: .9rem; margin: 0 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
code, .mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .85em; }
.boot { padding: 40px; color: var(--muted); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 20px 20px 16px; color: var(--side-ink); font-weight: 700; font-size: 1.05rem; display: flex; gap: 10px; align-items: center; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--brand); display: grid; place-items: center; color: #fff; font-size: .8rem; }
.brand small { display: block; font-weight: 400; color: var(--side-text); font-size: .72rem; }
.nav { display: flex; flex-direction: column; padding: 8px 10px; gap: 2px; overflow-y: auto; flex: 1; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; padding: 14px 10px 6px; opacity: .7; }
.nav a { color: var(--side-text); padding: 8px 10px; border-radius: 7px; display: flex; justify-content: space-between; align-items: center; }
.nav a:hover { background: var(--side-active); text-decoration: none; color: var(--side-ink); }
.nav a.active { background: var(--side-active); color: var(--side-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.nav .count { background: var(--warn); color: #1b1300; border-radius: 99px; font-size: .7rem; padding: 0 7px; font-weight: 700; }
.side-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: .8rem; }
.side-foot strong { color: var(--side-ink); display: block; }
.side-foot .row-links { display: flex; gap: 12px; margin-top: 6px; }
.side-foot a, .side-foot button { color: var(--side-text); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.side-foot a:hover, .side-foot button:hover { color: var(--side-ink); }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 28px 0; flex-wrap: wrap; }
.topbar .sub { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.content { padding: 20px 28px 40px; display: grid; gap: 20px; }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
}

/* ---------- componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.two { grid-template-columns: 1.6fr 1fr; }
.grid.halves { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .grid.two, .grid.halves { grid-template-columns: 1fr; } }
.kpi .label { color: var(--muted); font-size: .8rem; }
.kpi .value { font-size: 1.7rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .hint { color: var(--muted); font-size: .78rem; }
.kpi.attention .value { color: var(--warn); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 8px 14px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 10px; font-size: .82rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
label.field { display: grid; gap: 4px; font-size: .82rem; color: var(--muted); font-weight: 500; }
label.check { display: flex; gap: 8px; align-items: center; }
label.check input { width: auto; }
.form { display: grid; gap: 14px; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.filters label.field { min-width: 150px; }
.filters .grow { flex: 1; min-width: 220px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 36px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; color: var(--muted); font-size: .85rem; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--muted); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.tag { display: inline-block; padding: 1px 7px; margin: 2px 4px 2px 0; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); font-size: .75rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }

dl.props { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checks li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.checks li:last-child { border-bottom: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline .when { color: var(--muted); font-size: .78rem; }
.evidence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.evidence { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.evidence img { width: 100%; display: block; aspect-ratio: 4/3; object-fit: contain; background: #000; }
.evidence .cap { padding: 6px 10px; font-size: .78rem; color: var(--muted); display: flex; justify-content: space-between; }
.evidence .reveal { aspect-ratio: 4/3; display: grid; place-items: center; }
.meter { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; position: relative; margin-top: 6px; }
.meter .fill { height: 100%; background: var(--brand); }
.meter .mark { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--text); }
.callout { padding: 12px 14px; border-radius: 8px; background: var(--info-soft); color: var(--text); border: 1px solid var(--line); font-size: .88rem; }
.callout.warn { background: var(--warn-soft); }
.callout.bad { background: var(--bad-soft); }
.secret { display: flex; gap: 8px; align-items: center; }
.secret code { flex: 1; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; overflow-wrap: anywhere; }
pre.json { margin: 0; padding: 10px 12px; background: var(--surface-2); border-radius: 6px; font-size: .78rem; overflow-x: auto; max-height: 260px; }

/* ---------- gráficos ---------- */
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.s-APPROVED { fill: var(--c2); background: var(--c2); } .s-MANUAL_REVIEW { fill: var(--c3); background: var(--c3); }
.s-REJECTED { fill: var(--c4); background: var(--c4); } .s-EXPIRED { fill: var(--c5); background: var(--c5); }
.s-PENDING { fill: var(--c1); background: var(--c1); }
.hbar { display: grid; grid-template-columns: minmax(120px, 1.2fr) 2fr auto; gap: 10px; align-items: center; padding: 5px 0; font-size: .85rem; }
.hbar .track { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hbar .track span { display: block; height: 100%; background: var(--brand); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login .brand { color: var(--text); padding: 0 0 18px; }
.login .brand small { color: var(--muted); }

/* ---------- modal e toasts ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10,15,25,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 520px; box-shadow: 0 20px 50px rgba(0,0,0,.3); max-height: 90vh; overflow: auto; }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal header h2 { margin: 0; }
.modal .body { padding: 18px 20px; display: grid; gap: 14px; }
.modal footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--side); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 360px; font-size: .88rem; }
.toast.error { background: var(--bad); }
.toast.ok { background: var(--ok); }
.form-error { color: var(--bad); font-size: .85rem; min-height: 1.2em; }
.btn.google { background: #fff; color: #1f1f1f; border-color: #747775; font-weight: 500; gap: 10px; padding: 10px 14px; width: 100%; }
.btn.google:hover { background: #f8f9fa; }
@media (prefers-color-scheme: dark) { .btn.google { background: #131314; color: #e3e3e3; border-color: #8e918f; } .btn.google:hover { background: #1f1f20; } }
.login .form > .btn { width: 100%; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
fieldset.scopes { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; display: grid; gap: 6px; }
fieldset.scopes legend { font-size: .82rem; color: var(--muted); font-weight: 500; padding: 0 4px; }
label.check.scope { align-items: flex-start; }
label.check.scope input { margin-top: 3px; }
label.check.scope > span { display: grid; gap: 1px; }
.modal { max-width: 640px; }
/* ---------- testar recursos ---------- */
.lab-key { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: end; }
@media (max-width: 700px) { .lab-key { grid-template-columns: 1fr; } }
.lab-scopes { margin: 10px 0 4px; }
.lab-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1200px) { .lab-grid { grid-template-columns: 1fr; } }
.lab-out { position: sticky; top: 16px; display: grid; gap: 10px; }
.lab-out h2, .lab-out h3 { margin: 0; }
.lab-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 26px; }
.lab-json { max-height: 340px; min-height: 80px; white-space: pre-wrap; word-break: break-word; }
.lab-curl { max-height: 160px; }
.lab-curl-head { justify-content: space-between; }
.lab-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 220px; overflow: auto; }
.lab-hist .btn { width: 100%; justify-content: flex-start; font-weight: 400; font-size: .8rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); }
.tabs button.no-scope { opacity: .55; text-decoration: line-through; }
.lab-work { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; }
@media (max-width: 900px) { .lab-work { grid-template-columns: 1fr; } }
.lab-campanel { display: grid; gap: 8px; width: 260px; max-width: 100%; }
.lab-cam { width: 100%; }
.lab-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.lab-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .lab-two { grid-template-columns: 1fr; } }
.lab-picker { display: grid; gap: 6px; padding: 10px; border: 1px dashed var(--line); border-radius: 8px; }
.lab-picker input[type=file] { width: auto; max-width: 100%; padding: 4px; font-size: .8rem; }
.lab-thumb { max-height: 140px; max-width: 100%; border-radius: 6px; border: 1px solid var(--line); object-fit: contain; background: #000; }
.camera { position: relative; aspect-ratio: 3 / 4; background: #000; border-radius: 12px; overflow: hidden; }
.camera video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.camera .oval { position: absolute; inset: 12% 18%; border: 3px solid rgba(255,255,255,.8); border-radius: 50%; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.camera .instruction { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px; text-align: center; color: #fff; font-weight: 600;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); font-size: .9rem; }
/* ---------- 2FA ---------- */
input.otp { font-size: 1.4rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.mfa-setup { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
@media (max-width: 700px) { .mfa-setup { grid-template-columns: 1fr; } }
.qr { width: 200px; height: 200px; border-radius: 10px; background: #fff; padding: 6px; border: 1px solid var(--line); }
pre.recovery { font-size: 1rem; line-height: 1.8; columns: 2; text-align: center; }
details.policy { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
details.policy summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
details.policy[open] summary { margin-bottom: 10px; }
.bad-text { color: var(--bad); }

/* Guia de integração */
.guide { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.guide-nav { position: sticky; top: 16px; display: grid; gap: 2px; }
.guide-nav button { font: inherit; font-size: .88rem; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; }
.guide-nav button:hover { background: var(--surface-2); }
.guide-nav button[aria-current="true"] { background: var(--surface); box-shadow: var(--shadow); font-weight: 600; color: var(--brand); }
.guide-body { display: grid; gap: 12px; min-width: 0; scroll-margin-top: 16px; }
.guide-card { display: grid; gap: 12px; line-height: 1.55; }
.guide-card p, .guide-card ul, .guide-card ol { margin: 0; }
.guide-card h3 { margin-top: 6px; }
.guide-steps { padding-left: 22px; display: grid; gap: 6px; }
.guide-code { position: relative; }
.guide-code pre { margin: 0; padding: 12px 14px; padding-top: 30px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; font-size: .8rem; line-height: 1.5; }
.guide-code pre code { font-size: inherit; }
.guide-lang { position: absolute; left: 12px; top: 7px; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.guide-copy { position: absolute; right: 8px; top: 6px; }
.guide-langs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.guide-langs button { font: inherit; font-size: .8rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); cursor: pointer; }
.guide-langs button[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.guide-check { list-style: none; padding: 0; display: grid; gap: 6px; }
.guide-pager { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .guide { grid-template-columns: 1fr; }
  .guide-nav { position: static; display: flex; overflow-x: auto; gap: 4px; }
  .guide-nav button { white-space: nowrap; }
}
