/* Tema escuro por padrão (data-theme="light" troca para o claro).
   Paleta: preto (base) · creme #F5EE9E · laranja #E55812 · coral #F15946 · verde #034732 */
:root {
  --bg: #0a0a0b;
  --panel: #141416;
  --panel-2: #1c1c1f;
  --ink: #f7f4e4;
  --ink-2: #d2d3d6;
  --muted: #8d8f96;
  --line: #27272b;
  --line-2: #1d1d20;
  --rail: #0b0b0c;
  --rail-ink: #9a9ca3;
  --rail-hi: #1c1c1f;
  --rail-line: #1d1d20;
  --rail-foot: #141416;
  --nav-on: #f5ee9e;
  --nav-on-ink: #0b0b0c;
  --accent: #f5ee9e;
  --accent-ink: #0b0b0c;
  --accent-text: #f5ee9e;
  --accent-soft: rgba(245, 238, 158, .12);
  --accent-glow: rgba(245, 238, 158, .22);
  --bar: rgba(245, 238, 158, .12);
  --hot: #e55812;
  --bad: #f15946;
  --bad-soft: rgba(241, 89, 70, .16);
  --warn: #ffc83d;
  --warn-soft: rgba(255, 200, 61, .15);
  --warn-fill: #ffc83d;
  --flow-1: rgba(245, 238, 158, .16);
  --flow-2: rgba(229, 88, 18, .22);
  --good: #4cc395;
  --good-soft: rgba(76, 195, 149, .14);
  --pill: #f7f4e4;
  --pill-ink: #0b0b0c;
  --mbar: #2e2e33;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset;
  --thermal: linear-gradient(90deg, #2b4bd8, #21c3d6 30%, #3fd36b 52%, #ffd23f 74%, #ff3b2f);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --r-s: 10px;
  --r-m: 14px;
  --r-l: 22px;
  --font-ui: "Archivo", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Archivo", "Inter", system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f2e8; --panel: #ffffff; --panel-2: #f9f7ee; --ink: #0b0b0c; --ink-2: #3a3c40; --muted: #6a6d73;
  --line: #e3dfcd; --line-2: #ece9dc; --rail: #0b0b0c; --rail-ink: #9a9ca3; --rail-hi: #1c1c1f; --rail-line: #0b0b0c; --rail-foot: #141416;
  --nav-on: #f5ee9e; --nav-on-ink: #0b0b0c;
  --accent: #0b0b0c; --accent-ink: #f5ee9e; --accent-text: #a8410b; --accent-soft: rgba(17, 18, 20, .07); --accent-glow: rgba(17, 18, 20, .18); --bar: rgba(17, 18, 20, .08);
  --hot: #e55812; --bad: #d4402e; --bad-soft: #fde7e3; --warn: #9a6f00; --warn-soft: #fdf3d6; --warn-fill: #e8b322; --flow-1: rgba(17, 18, 20, .06); --flow-2: rgba(229, 88, 18, .14); --good: #034732; --good-soft: #e1efe8;
  --pill: #0b0b0c; --pill-ink: #f7f4e4; --mbar: #d9d5c3; --shadow: 0 1px 2px rgba(17,18,20,.05); color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, td.n, .kpi-v { font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em; margin: 0; }
h1 { font-size: 34px; line-height: 1.1; font-weight: 500; letter-spacing: -.035em; }
h2 { font-size: 16px; line-height: 1.3; }
h3 { font-size: 14px; font-weight: 600; letter-spacing: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; transition: grid-template-columns .35s var(--ease); }
.rail { overflow: hidden; background: var(--rail); color: var(--rail-ink); padding: 20px 14px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--rail-line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: #f7f4e4; font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -.03em; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 9px; background: var(--nav-on); position: relative; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 6px 18px var(--accent-glow); }
.brand-mark::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: radial-gradient(circle, #ff3b2f 0, #ffd23f 35%, #0b0b0c 36%); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .lbl-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #5f6168; padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; white-space: nowrap; border-radius: 999px; color: var(--rail-ink); text-decoration: none; font-weight: 500; transition: background .15s, color .15s, padding .35s var(--ease); }
.nav a:hover { background: var(--rail-hi); color: #f7f4e4; text-decoration: none; }
.nav a.on { background: var(--nav-on); color: var(--nav-on-ink); box-shadow: 0 6px 20px rgba(245, 238, 158, .18); }
.nav a.on svg { color: var(--nav-on-ink); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .95; }
.nav .sep { height: 0; margin: 4px 6px; }
.rail-foot { margin-top: auto; padding: 12px; font-size: 12.5px; display: flex; gap: 6px; background: var(--rail-foot); border: 1px solid var(--rail-hi); border-radius: 16px; }
.rail-foot button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--rail-hi); border: 0; color: var(--rail-ink); padding: 7px 8px; cursor: pointer; border-radius: 999px; transition: background .15s, color .15s; }
.rail-foot button svg { width: 16px; height: 16px; }
.rail-foot button:hover { color: #f7f4e4; background: #27272b; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); padding: 14px 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-2); }
.topbar .grow { flex: 1; }
.content { padding: 28px 32px 72px; max-width: 1520px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 8px 0 0; color: var(--muted); max-width: 70ch; }

/* ---------------------------------------------------------------- controles */
.sel, .inp { height: 38px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 0 14px; min-width: 0; }
.sel { padding-right: 34px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a93a0' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; cursor: pointer; font-weight: 500; }
.sel option { background: var(--panel); color: var(--ink); }
.inp { border-radius: var(--r-s); }
.inp:focus, .sel:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.inp { height: auto; padding: 10px 12px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 500; white-space: nowrap; transition: background .15s, color .15s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--pill); color: var(--pill-ink); }
.btn { height: 38px; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 500; text-decoration: none; color: var(--ink); white-space: nowrap; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--hot); border-color: var(--hot); color: #0b0b0c; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel); }
.btn.sm { height: 32px; padding: 0 13px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; color: var(--ink-2); }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; color: var(--ink-2); font-weight: 500; transition: background .15s; }
.chip:hover { border-color: var(--muted); }
.chip.on { background: var(--pill); border-color: var(--pill); color: var(--pill-ink); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 500; color: var(--ink-2); }
.field .hint { color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------------------------------- painéis */
.panel { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-l); padding: 22px 24px; min-width: 0; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi { position: relative; padding: 20px 22px 22px; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-l); min-height: 128px; display: flex; flex-direction: column; justify-content: space-between; gap: 14px; overflow: hidden; }
.kpi::after { content: ""; position: absolute; right: 14px; top: 14px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a93a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 7l-10 10M8 7h9v9'/%3E%3C/svg%3E") center no-repeat; }
.kpi:first-child { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.kpi:first-child .kpi-l { color: color-mix(in srgb, var(--accent-ink) 72%, transparent); }
.kpi:first-child::after { border-color: color-mix(in srgb, var(--accent-ink) 22%, transparent); background-color: color-mix(in srgb, var(--accent-ink) 8%, transparent); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23061423' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 7l-10 10M8 7h9v9'/%3E%3C/svg%3E"); }
.kpi:first-child .delta.up, .kpi:first-child .delta.down, .kpi:first-child .delta.flat { color: var(--accent-ink); background: color-mix(in srgb, var(--accent-ink) 12%, transparent); }
.kpi-l { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; padding-right: 36px; }
.kpi-v { font-family: var(--font-display); font-size: 40px; font-weight: 500; letter-spacing: -.045em; line-height: 1; display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.delta { font-size: 12px; font-weight: 600; letter-spacing: 0; padding: 3px 8px; border-radius: 999px; }
.delta.up { color: var(--good); background: var(--good-soft); } .delta.down { color: var(--bad); background: var(--bad-soft); } .delta.flat { color: var(--muted); background: var(--line-2); }
.kpi.lv-bad .kpi-v { color: var(--bad); }

/* ---------------------------------------------------------------- tabelas */
.tbl-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.n, .tbl td.n { text-align: right; }
.tbl th.sort { cursor: pointer; }
.tbl th.sort:hover { color: var(--ink); }
.tbl th.on { color: var(--accent); }
:root[data-theme="light"] .tbl th.on { color: var(--ink); }
.tbl td { padding: 12px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--panel-2); }
.tbl tr.click:hover td:first-child { border-radius: 12px 0 0 12px; }
.tbl tr.click:hover td:last-child { border-radius: 0 12px 12px 0; }
.tbl .lbl { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.bar-cell { position: relative; }
.bar-cell .b { position: absolute; left: 0; top: 8px; bottom: 8px; background: var(--bar); border-radius: 6px; z-index: 0; transition: width .6s var(--ease); }
.bar-cell span { position: relative; z-index: 1; }
.heatcell { display: inline-block; min-width: 50px; text-align: right; padding: 2px 8px; border-radius: 999px; font-weight: 500; }

.list { display: flex; flex-direction: column; gap: 4px; }
.li { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; position: relative; border-radius: 10px; }
.li .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: relative; z-index: 1; }
.li .v { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; position: relative; z-index: 1; display: flex; gap: 8px; align-items: center; }
.li .b { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bar); border-radius: 10px; z-index: 0; transition: width .6s var(--ease); }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.neutral { background: var(--line-2); color: var(--muted); }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 6px; font-size: 20px; }
.loading { padding: 48px; text-align: center; color: var(--muted); }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { background: var(--bad-soft); color: var(--bad); padding: 11px 16px; border-radius: var(--r-m); }
.note { background: var(--warn-soft); color: var(--warn); padding: 11px 16px; border-radius: var(--r-m); }

/* ---------------------------------------------------------------- gráfico */
.chart { width: 100%; height: 240px; display: block; }
.chart .grid-l { stroke: var(--line-2); stroke-dasharray: 2 4; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .ln { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart .ln3 { fill: none; stroke: var(--good); stroke-width: 2; stroke-linejoin: round; }
.chart .ln2 { fill: none; stroke: var(--bad); stroke-width: 1.5; stroke-dasharray: 3 4; }
.chart .area { fill: var(--accent); opacity: .1; }
.chart .hov { stroke: var(--muted); stroke-dasharray: 2 3; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 7px; background: var(--accent); }
.legend i.l2 { background: var(--bad); }
.legend i.l3 { background: var(--good); }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(520px 380px at 80% 12%, rgba(245, 238, 158, .08), transparent 70%),
  radial-gradient(640px 460px at 8% 92%, rgba(229, 88, 18, .10), transparent 70%), var(--bg); }
.login form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 28px; padding: 32px; }
.login .btn.primary { height: 44px; justify-content: center; }
.login .brand { color: var(--ink); padding: 0 0 8px; font-size: 28px; }
.login p { margin: 0 0 6px; color: var(--muted); }

/* ---------------------------------------------------------------- heatmap */
.hm-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.hm-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.stage-wrap { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-l); padding: 16px; position: relative; }
.stage-info { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 10px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.stage { position: relative; margin: 0 auto; overflow: hidden; border-radius: 12px; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.stage-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; }
.stage-frame { position: absolute; inset: 0; }
.stage-frame .replayer-wrapper { position: absolute !important; left: 0 !important; top: 0 !important; transform: none !important; margin: 0 !important; float: none !important; }
.stage-frame iframe { border: 0; display: block; pointer-events: none; background: #fff; }
.stage-frame .replayer-mouse, .stage-frame .replayer-mouse-tail { display: none !important; }
.stage-blank { position: absolute; left: 0; top: 0; right: 0; background-image: linear-gradient(var(--line-2) 1px, transparent 1px), linear-gradient(90deg, var(--line-2) 1px, transparent 1px); background-size: 40px 40px; background-color: #fbfbfc; }
.stage-dim { position: absolute; inset: 0; background: rgba(20, 22, 31, .32); pointer-events: none; transition: opacity .2s; }
.stage-layer { position: absolute; left: 0; top: 0; will-change: transform; }
.stage-layer canvas { position: absolute; left: 0; top: 0; }
.stage-hit { position: absolute; inset: 0; cursor: default; }
.zone { position: absolute; border-radius: 3px; outline: 1px solid rgba(255,255,255,.65); transition: outline-color .15s; }
.zone:hover, .zone.hl { outline: 2px solid #fff; z-index: 5; box-shadow: 0 0 0 4px rgba(0,0,0,.35); }
.zone b { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(20, 22, 31, .86); color: #fff; font: 600 calc(12px * var(--inv, 1))/1 var(--font-ui); padding: calc(4px * var(--inv, 1)) calc(7px * var(--inv, 1)); border-radius: 999px; white-space: nowrap; pointer-events: none; font-variant-numeric: tabular-nums; }
.scroll-mark { position: absolute; left: 0; right: 0; border-top: 2px dashed rgba(20, 22, 31, .75); pointer-events: none; }
.scroll-mark { border-top-width: calc(2px * var(--inv, 1)); }
.scroll-mark span { position: absolute; right: 10px; top: calc(-13px * var(--inv, 1)); background: rgba(20, 22, 31, .88); color: #fff; font: 600 calc(12px * var(--inv, 1))/1 var(--font-ui); padding: calc(6px * var(--inv, 1)) calc(9px * var(--inv, 1)); border-radius: 999px; }
.scroll-mark.fold { border-top-color: #fff; border-top-style: solid; }
.scroll-mark.fold span { left: 10px; right: auto; background: #fff; color: #1c2030; }
.minimap { position: absolute; right: -10px; top: 0; width: 6px; border-radius: 3px; background: var(--line); }
.minimap i { position: absolute; left: 0; right: 0; background: var(--ink); border-radius: 3px; opacity: .55; }
.scale { height: 8px; border-radius: 4px; background: var(--thermal); }
.scale-l { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 4px; }
.hm-side .panel + .panel { margin-top: 12px; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.stat-row .v { font-family: var(--font-display); font-weight: 700; font-size: 21px; }
.stat-row .l { color: var(--muted); font-size: 12.5px; }
.zone-list .li { cursor: pointer; }
.zone-list .li:hover .k { color: var(--accent); }

.tip { position: fixed; z-index: 100; pointer-events: none; background: #f7f4e4; color: #0b0b0c; padding: 10px 13px; border-radius: 12px; font-size: 12.5px; line-height: 1.45; max-width: 300px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.tip b { font-weight: 600; }
.tip .tr { display: flex; justify-content: space-between; gap: 18px; }
.tip .tr span:last-child { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- sessões / replay */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.sess-row td { vertical-align: top; }
.path-crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; color: var(--ink-2); max-width: 520px; }
.path-crumbs span { background: var(--panel-2); border: 1px solid var(--line); padding: 1px 9px; border-radius: 999px; font-size: 12.5px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.path-crumbs em { color: var(--muted); font-style: normal; font-size: 11px; }
.dev-ico { width: 16px; height: 16px; vertical-align: -3px; color: var(--muted); }

.replay-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.player-box { background: #070708; border: 1px solid var(--line-2); border-radius: var(--r-l); padding: 12px; min-height: 420px; display: flex; align-items: center; justify-content: center; color: #aab0c2; }
.player-box .rr-player { box-shadow: none; background: transparent; border-radius: 8px; }
.player-box .rr-controller { background: #141416 !important; border-radius: 0 0 8px 8px; }
.player-box .rr-timeline__time, .player-box .rr-controller__btns button { color: #e8eaf0 !important; }
.player-box .rr-controller__btns button svg { fill: #e8eaf0; }
.player-box .rr-controller__btns button.active { background: var(--accent) !important; color: var(--accent-ink) !important; }
.player-box .rr-progress { background: #27272b !important; }
.player-box .rr-progress__step { background: var(--accent) !important; }
.player-box .rr-progress__handler { background: #f7f4e4 !important; }
.timeline { max-height: 70vh; overflow-y: auto; margin: 0 -8px; padding: 0 8px; }
.tl-item { display: grid; grid-template-columns: 46px 18px 1fr; gap: 8px; align-items: start; padding: 8px 8px; border-radius: 12px; cursor: pointer; }
.tl-item:hover { background: var(--panel-2); }
.tl-item.now { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.tl-item .t { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.tl-item .d { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--muted); }
.tl-item .d.pv { background: var(--accent); width: 12px; height: 12px; margin-top: 4px; border-radius: 3px; }
.tl-item .d.rage { background: var(--bad); }
.tl-item .d.dead { background: var(--warn); }
.tl-item .d.goal { background: var(--good); width: 12px; height: 12px; margin-top: 4px; }
.tl-item .d.error { background: var(--bad); border-radius: 2px; transform: rotate(45deg); }
.tl-item .x { min-width: 0; }
.tl-item .x div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-item.pv-item { margin-top: 6px; }
.tl-item.pv-item .x div:first-child { font-weight: 600; }
.meta-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.meta-grid dt { color: var(--muted); }
.meta-grid dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- jornada / funil */
.sankey { width: 100%; display: block; }
.sankey .node rect { rx: 3; }
.sankey .node text { font-size: 12px; font-weight: 500; fill: var(--ink); paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
.sankey .node .cnt { fill: var(--muted); font-size: 11px; }
.sankey .link { fill: none; stroke-opacity: .28; transition: stroke-opacity .15s; }
.sankey .link:hover { stroke-opacity: .5; }
.sankey .step-h { fill: var(--muted); font-size: 12px; }
.funnel { display: flex; flex-direction: column; gap: 6px; }
.f-step { display: grid; grid-template-columns: 220px 1fr 150px; gap: 16px; align-items: center; }
.f-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-name small { display: block; font-weight: 400; color: var(--muted); }
.f-bar { height: 44px; background: var(--panel-2); border-radius: 12px; position: relative; overflow: hidden; }
.f-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 12px; }
.f-bar span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-weight: 600; color: var(--accent-ink); }
.f-drop { display: grid; grid-template-columns: 220px 1fr 150px; gap: 16px; color: var(--muted); font-size: 12.5px; padding: 2px 0 6px; }
.f-drop div:nth-child(2) { padding-left: 12px; border-left: 2px dotted var(--line); }
.step-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.step-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--pill); color: var(--pill-ink); border-radius: 999px; padding: 4px 6px 4px 12px; font-weight: 500; max-width: 280px; }
.step-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 4px; font-size: 16px; line-height: 1; }
.arrow { color: var(--muted); }

/* ---------------------------------------------------------------- configurações */
.snippet { position: relative; background: #070708; border: 1px solid var(--line); color: #e6e9f0; border-radius: var(--r-m); padding: 14px 16px; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all; }
.snippet .btn { position: absolute; right: 10px; top: 10px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.site-pick { display: flex; flex-direction: column; gap: 4px; }
.site-pick button { text-align: left; border: 1px solid transparent; background: none; padding: 11px 14px; border-radius: 14px; cursor: pointer; }
.site-pick button.on { background: var(--panel-2); border-color: var(--accent); }
.site-pick button small { display: block; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--accent-ink); padding: 10px 18px; border-radius: 999px; z-index: 200; font-weight: 500; box-shadow: 0 6px 24px rgba(0,0,0,.2); }

/* ---------------------------------------------------------------- responsivo */
@media (max-width: 1180px) {
  .hm-layout, .replay-layout { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* ---------------------------------------------------------------- celular (app) */
.appbar, .tabbar, .sheet-bg, .kpi-ico, .only-m { display: none; }
@media (max-width: 860px) {
  body { font-size: 14px; }
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .only-d { display: none; }
  .only-m { display: block; }

  /* barra do topo */
  .appbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 31; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); }
  .appbar .brand { padding: 0; font-size: 18px; color: var(--ink); }
  .appbar .brand span:last-child { display: none; }
  .appbar-t { flex: 1; font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
  .ico-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; color: var(--ink); }
  .ico-btn svg { width: 18px; height: 18px; }

  /* filtros: uma linha que rola na horizontal */
  .topbar { top: calc(60px + env(safe-area-inset-top)); padding: 4px 16px 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; border-bottom: 0; background: var(--bg); backdrop-filter: none; gap: 8px; }
  .topbar::-webkit-scrollbar { display: none; }
  .topbar > * { flex: none; }
  .topbar .grow, #sync { display: none; }
  .topbar .sel { height: 36px; max-width: 170px; }
  .topbar .seg button { padding: 5px 12px; }
  .topbar .toggle { font-size: 13px; }
  #sync-b { width: 36px; height: 36px; padding: 0; justify-content: center; border: 1px solid var(--line); background: var(--panel); order: -1; }
  #sync-b span { display: none; }

  .content { padding: 4px 16px calc(112px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 16px; align-items: stretch; flex-direction: column; }
  .page-head h1 { display: none; }
  .page-head p { margin: 0; font-size: 13.5px; }
  .page-head > .btn, .page-head > div:last-child > .btn { width: 100%; justify-content: center; }
  .g2, .g3, .form-grid { grid-template-columns: 1fr; }
  .grid { gap: 12px; }
  .panel { padding: 18px 16px; border-radius: 22px; }
  .tbl-wrap { margin: 0 -16px; padding: 0 16px; }

  /* indicadores: cards 2x2 com ícone e variação no topo */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
  .kpi { min-height: 0; padding: 14px 14px 16px; gap: 6px; border-radius: 20px; justify-content: flex-start; }
  .kpi::after { display: none; }
  .kpi-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; background: var(--panel-2); color: var(--accent); margin-bottom: 10px; }
  :root[data-theme="light"] .kpi-ico { color: var(--accent-text); }
  .kpi-ico svg { width: 17px; height: 17px; }
  .kpi:first-child .kpi-ico { background: color-mix(in srgb, var(--accent-ink) 12%, transparent); color: var(--accent-ink); }
  .kpi-l { font-size: 12.5px; padding-right: 0; line-height: 1.3; }
  .kpi-v { font-size: 28px; letter-spacing: -.04em; }
  .kpi-v .delta { position: absolute; top: 14px; right: 12px; font-size: 11px; padding: 3px 7px; }

  /* gráfico em colunas */
  .mbars { display: flex; align-items: stretch; gap: 8px; height: 220px; padding-top: 8px; }
  .mbar { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); }
  .mbar-v { font-size: 11px; font-weight: 600; visibility: hidden; white-space: nowrap; color: var(--ink); }
  .mbar-t { flex: 1; width: 100%; max-width: 34px; border-radius: 999px; background: var(--panel-2); position: relative; overflow: hidden; }
  .mbar-t i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 999px; background: var(--mbar); transition: background .15s, height .6s var(--ease); }
    .mbar-t b { position: absolute; left: 30%; right: 30%; bottom: 6px; border-radius: 999px; background: var(--good); min-height: 4px; }
  .mbar-l { font-size: 11px; white-space: nowrap; }
  .mbar.on .mbar-t i { background: var(--accent); }
  .mbar.on .mbar-v { visibility: visible; }
  .mbar.on .mbar-l { color: var(--ink); font-weight: 600; }
  .panel-head { flex-wrap: wrap; }
  .legend { gap: 10px; font-size: 12px; }

  /* sessões viram cards */
  .sess-tbl, .sess-tbl tbody { display: block; }
  .sess-tbl thead { display: none; }
  .sess-tbl tr.sess-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 14px; margin-bottom: 10px; background: var(--panel-2); border-radius: 18px; }
  .sess-tbl tr.sess-row td { display: block; padding: 0; border: 0; background: none !important; border-radius: 0 !important; }
  .sess-tbl td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .sess-tbl td:nth-child(2) { grid-column: 2; grid-row: 1; text-align: right; font-weight: 600; font-size: 15px; }
  .sess-tbl td:nth-child(3) { grid-column: 1 / -1; }
  .sess-tbl td:nth-child(4) { grid-column: 1; align-self: center; color: var(--muted); }
  .sess-tbl td:nth-child(4)::before { content: "Origem: "; }
  .sess-tbl td:nth-child(5) { grid-column: 1 / -1; grid-row: 4; }
  .sess-tbl td:nth-child(5):empty { display: none; }
  .sess-tbl td:nth-child(6) { grid-column: 2; grid-row: 3; text-align: right; }
  .sess-tbl .path-crumbs span { max-width: 140px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filters > * { flex: none; }

  /* mapa de calor / replay / jornada */
  .hm-tools { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 2px; scrollbar-width: none; }
  .hm-tools::-webkit-scrollbar { display: none; }
  .hm-tools > * { flex: none; }
  .stage-wrap { padding: 10px; border-radius: 20px; }
  .player-box { min-height: 260px; padding: 8px; }
  .f-step, .f-drop { grid-template-columns: 1fr; gap: 4px; }
  .f-drop div:first-child, .f-drop div:last-child { display: none; }

  /* barra de navegação flutuante */
  .tabbar { display: flex; position: fixed; z-index: 40; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); padding: 6px; gap: 4px; background: #0b0b0c; border: 1px solid #27272b; border-radius: 999px; box-shadow: 0 12px 32px rgba(0,0,0,.5); }
  :root[data-theme="light"] .tabbar { background: #0b0b0c; border-color: #0b0b0c; box-shadow: 0 12px 32px rgba(0,0,0,.2); }
  .tabbar a, .tabbar button { flex: 1; min-width: 0; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 999px; color: #9a9ca3; font-size: 10.5px; font-weight: 500; background: none; border: 0; cursor: pointer; text-decoration: none; transition: flex .2s, background .2s, color .2s; }
  .tabbar svg { width: 20px; height: 20px; }
  .tabbar a.on, .tabbar button.on { flex: 1.7; flex-direction: row; gap: 7px; background: var(--nav-on); color: var(--nav-on-ink); font-size: 13px; font-weight: 600; }
  .tabbar a:hover { text-decoration: none; }

  /* folha "Mais" */
  .sheet-bg { display: flex; position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.5); align-items: flex-end; }
  .sheet-bg[hidden] { display: none !important; }
  .sheet { width: 100%; background: var(--panel); border-radius: 28px 28px 0 0; padding: 10px 12px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 4px; animation: up .22s ease-out; }
  .sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 10px; }
  .sheet a, .sheet button { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; color: var(--ink); background: none; border: 0; font-size: 15px; font-weight: 500; text-align: left; cursor: pointer; text-decoration: none; }
  .sheet a:hover, .sheet button:hover { background: var(--panel-2); text-decoration: none; }
  .sheet a.on { background: var(--accent-soft); }
  .sheet svg { width: 20px; height: 20px; color: var(--muted); }
  #s-out { color: var(--bad); } #s-out svg { color: var(--bad); }
  @keyframes up { from { transform: translateY(40px); opacity: 0; } }

  .tip { display: none; }
  .panel:has(> .tbl-wrap > .sess-tbl) { background: none; border: 0; padding: 0; box-shadow: none; }
  .panel:has(> .tbl-wrap > .sess-tbl) .tbl-wrap { margin: 0; padding: 0; }
  .sess-tbl tr.sess-row { background: var(--panel); border: 1px solid var(--line-2); }
  #jr-start, #fn-add { width: 100% !important; flex: 1 1 100%; }
  #sk-box > div { margin: 0 -16px; padding: 0 16px; }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* ajustes finos */
.tbl .btn.primary { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.tbl tr.click:hover .btn.primary { background: var(--accent); color: var(--accent-ink); }
:root[data-theme="light"] .tbl .btn.primary { color: var(--accent-text); }
.player-box .switch input[type="checkbox"]:checked + label:before { background: var(--accent) !important; }
.player-box .switch label:after { background: #f7f4e4 !important; }
.snippet { padding-right: 120px; }

/* card de KPI clicável + página de detalhe */
a.kpi { color: inherit; text-decoration: none; cursor: pointer; transform: perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: border-color .3s, transform .45s var(--ease-out), box-shadow .3s; }
a.kpi:hover { border-color: color-mix(in srgb, var(--accent) 38%, transparent); transform: perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-3px); box-shadow: 0 14px 34px var(--accent-soft); }
a.kpi:hover::after { border-color: var(--accent); }
a.kpi:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kpi-hero { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.kpi-hero .kpi-v { font-size: 44px; line-height: 1; }
.kpi-trend { display: flex; align-items: flex-end; gap: 4px; height: 160px; }
.kpi-trend .kt { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.kpi-trend .kt i { display: block; width: 100%; max-width: 28px; background: var(--accent); border-radius: 4px 4px 0 0; transition: height .6s var(--ease), background .3s; }
.kpi-trend .kt span { font-size: 10px; color: var(--muted, #8b8e93); margin-top: 4px; white-space: nowrap; }
.kpi-trend .kt:nth-child(odd) span { visibility: hidden; }
.kpi-act { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.panel p { margin: 0; line-height: 1.5; }

/* ---------------------------------------------------------------- tema: sol / lua */
.th-ico { display: inline-grid; width: 18px; height: 18px; flex: none; }
.th-ico svg { grid-area: 1 / 1; width: 100%; height: 100%; transition: transform .4s var(--ease), opacity .25s; }
:root:not([data-theme="light"]) .th-moon { opacity: 0; transform: rotate(-90deg) scale(.4); }
:root[data-theme="light"] .th-sun { opacity: 0; transform: rotate(90deg) scale(.4); }
.th-to-dark { display: none; }
:root[data-theme="light"] .th-to-dark { display: inline; }
:root[data-theme="light"] .th-to-light { display: none; }
.rail-foot .th-ico { width: 16px; height: 16px; }
.sheet .th-ico { width: 20px; height: 20px; color: var(--muted); }

/* ---------------------------------------------------------------- abertura (splash) */
#splash { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: var(--bg); transition: opacity .45s ease, visibility .45s; }
#splash.out { opacity: 0; visibility: hidden; }
.splash-in { display: flex; flex-direction: column; align-items: center; gap: 16px; animation: rise .6s var(--ease) both; }
#splash .brand-mark { width: 56px; height: 56px; border-radius: 18px; box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 14px 40px var(--accent-glow); }
#splash .brand-mark::after { inset: 14px; }
.splash-name { font: 600 22px/1 var(--font-display); letter-spacing: -.03em; color: var(--ink); }
.splash-bar { width: 120px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; position: relative; }
.splash-bar::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; border-radius: 3px; background: var(--accent); animation: load 1.1s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ---------------------------------------------------------------- entrada: fade-in + slide up */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
#view > * { animation: rise .55s var(--ease) backwards; }
#view > *:nth-child(2) { animation-delay: .06s; }
#view > *:nth-child(3) { animation-delay: .12s; }
#view > *:nth-child(4) { animation-delay: .18s; }
#view > *:nth-child(5) { animation-delay: .24s; }
#view > *:nth-child(n+6) { animation-delay: .3s; }
#view > .kpis { animation: none; }
.kpis > .kpi { animation: rise .55s var(--ease) backwards; }
.kpis > .kpi:nth-child(2) { animation-delay: .04s; } .kpis > .kpi:nth-child(3) { animation-delay: .08s; }
.kpis > .kpi:nth-child(4) { animation-delay: .12s; } .kpis > .kpi:nth-child(5) { animation-delay: .16s; }
.kpis > .kpi:nth-child(6) { animation-delay: .2s; } .kpis > .kpi:nth-child(7) { animation-delay: .24s; }
.kpis > .kpi:nth-child(8) { animation-delay: .28s; } .kpis > .kpi:nth-child(9) { animation-delay: .32s; }
.kpis > .kpi:nth-child(10) { animation-delay: .36s; }
.login form { animation: rise .6s var(--ease) both; }

/* ---------------------------------------------------------------- pré-carregamento (skeleton) */
#view > .sk-wrap { animation-duration: .3s; }
.sk-wrap { display: flex; flex-direction: column; gap: 14px; }
.sk-wrap .kpis { margin: 0; }
.sk-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.sk { display: block; border-radius: var(--r-l); background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 40%, var(--panel) 80%); background-size: 200% 100%; border: 1px solid var(--line-2); animation: shimmer 1.4s linear infinite; }
.sk-t { width: 240px; max-width: 70%; height: 34px; border-radius: 10px; }
.sk-p { width: 420px; max-width: 90%; height: 14px; border-radius: 8px; }
.sk-kpi { height: 128px; }
.sk-panel { height: 300px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (max-width: 860px) {
  .sk-t { display: none; }
  .sk-kpi { height: 104px; border-radius: 20px; }
  .sk-panel { height: 220px; }
}


/* tema claro: o card principal é marinho, então a seta fica creme */
:root[data-theme="light"] .kpi:first-child::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23f5ee9e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 7l-10 10M8 7h9v9'/%3E%3C/svg%3E"); }
:root[data-theme="light"] .login .brand-mark, :root[data-theme="light"] #splash .brand-mark { background: var(--accent); }

/* ---------------------------------------------------------------- hover: "explosãozinha" de luz que nasce onde o mouse entra */
@property --mx { syntax: '<length>'; inherits: true; initial-value: 0px; }
@property --my { syntax: '<length>'; inherits: true; initial-value: 0px; }
:is(.nav a, .btn, a.kpi, .chip, .seg button, .tabbar a, .tabbar button, .sheet a, .sheet button, .rail-foot button, .ico-btn, .rail-tg, .site-pick button) { position: relative; isolation: isolate; overflow: hidden; }
:is(.nav a, .btn, a.kpi, .chip, .seg button, .tabbar a, .tabbar button, .sheet a, .sheet button, .rail-foot button, .ico-btn, .rail-tg, .site-pick button)::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(190px circle at var(--mx) var(--my), var(--bloom-core) 0, var(--bloom-mid) 32%, transparent 68%);
  mix-blend-mode: var(--bloom-blend); opacity: 0; transform: scale(.55); transform-origin: var(--mx) var(--my);
  transition: opacity .9s var(--ease-out), transform 1.1s var(--ease-out), --mx .6s var(--ease-out), --my .6s var(--ease-out); }
:is(.nav a, .btn, a.kpi, .chip, .seg button, .tabbar a, .tabbar button, .sheet a, .sheet button, .rail-foot button, .ico-btn, .rail-tg, .site-pick button).fx-j::before { transition: opacity .9s var(--ease-out), transform 1.1s var(--ease-out); }
:is(.nav a, .btn, a.kpi, .chip, .seg button, .tabbar a, .tabbar button, .sheet a, .sheet button, .rail-foot button, .ico-btn, .rail-tg, .site-pick button):hover::before { opacity: 1; transform: none; }
:is(.nav a, .btn, a.kpi, .chip, .seg button, .tabbar a, .tabbar button, .sheet a, .sheet button, .rail-foot button, .ico-btn, .rail-tg, .site-pick button).burst::before { opacity: 1; transform-origin: var(--x, 50%) var(--y, 50%);
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), var(--bloom-core) 0, var(--bloom-mid) 35%, transparent 70%);
  animation: burst .9s var(--ease-out) forwards; }
@keyframes burst { from { opacity: 1; transform: scale(.25); } to { opacity: 0; transform: scale(2.4); } }
.spark { position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; will-change: transform, opacity; }
.ring { position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; border: 1px solid var(--ring); box-shadow: 0 0 14px var(--ring-glow), inset 0 0 10px var(--ring-glow); will-change: transform, opacity; }
:root { --bloom-core: rgba(245, 238, 158, .20); --bloom-mid: rgba(255, 255, 255, .07); --bloom-blend: screen; --ring: rgba(245, 238, 158, .55); --ring-glow: rgba(245, 238, 158, .14); }
:root[data-theme="light"] { --bloom-core: rgba(255, 255, 255, .95); --bloom-mid: rgba(17, 18, 20, .05); --bloom-blend: normal; --ring: rgba(17, 18, 20, .28); --ring-glow: rgba(17, 18, 20, .06); }

/* ---------------------------------------------------------------- ícones preenchidos com microanimação */
svg[data-i] { transform-origin: 50% 50%; }
svg[data-i="heatmap"] { transform-origin: 50% 90%; }
:is(.nav a, .btn, a.kpi, .chip, .seg button, .tabbar a, .tabbar button, .sheet a, .sheet button, .rail-foot button, .ico-btn, .rail-tg, .site-pick button):hover svg[data-i], .nav a.on svg[data-i], .tabbar a.on svg[data-i] { animation: ico-pop .55s var(--ease); }
:is(.nav a, .btn, a.kpi, .chip, .seg button, .tabbar a, .tabbar button, .sheet a, .sheet button, .rail-foot button, .ico-btn, .rail-tg, .site-pick button):hover svg[data-i="settings"] { animation: ico-turn .7s var(--ease); }
:is(.nav a, .btn, a.kpi, .chip, .seg button, .tabbar a, .tabbar button, .sheet a, .sheet button, .rail-foot button, .ico-btn, .rail-tg, .site-pick button):hover svg[data-i="refresh"] { animation: ico-spin .7s var(--ease); }
:is(.nav a, .btn, a.kpi, .chip, .seg button, .tabbar a, .tabbar button, .sheet a, .sheet button, .rail-foot button, .ico-btn, .rail-tg, .site-pick button):hover svg[data-i="heatmap"] { animation: ico-flick .8s ease-in-out; }
:is(.nav a, .btn, a.kpi, .chip, .seg button, .tabbar a, .tabbar button, .sheet a, .sheet button, .rail-foot button, .ico-btn, .rail-tg, .site-pick button):hover svg[data-i="zap"], :is(.nav a, .btn, a.kpi, .chip, .seg button, .tabbar a, .tabbar button, .sheet a, .sheet button, .rail-foot button, .ico-btn, .rail-tg, .site-pick button):hover svg[data-i="bug"] { animation: ico-shake .5s ease-in-out; }
:is(.nav a, .btn, a.kpi, .chip, .seg button, .tabbar a, .tabbar button, .sheet a, .sheet button, .rail-foot button, .ico-btn, .rail-tg, .site-pick button):hover svg[data-i="eye"] { animation: ico-blink .6s ease-in-out; }
:is(.nav a, .btn, a.kpi, .chip, .seg button, .tabbar a, .tabbar button, .sheet a, .sheet button, .rail-foot button, .ico-btn, .rail-tg, .site-pick button):hover svg[data-i="journey"], :is(.nav a, .btn, a.kpi, .chip, .seg button, .tabbar a, .tabbar button, .sheet a, .sheet button, .rail-foot button, .ico-btn, .rail-tg, .site-pick button):hover svg[data-i="target"] { animation: ico-nudge .55s var(--ease); }
@keyframes ico-pop { 35% { transform: translateY(-2px) scale(1.16) rotate(-6deg); } 65% { transform: scale(.96) rotate(3deg); } }
@keyframes ico-turn { to { transform: rotate(120deg); } }
@keyframes ico-spin { to { transform: rotate(360deg); } }
@keyframes ico-flick { 25% { transform: scaleY(1.14) skewX(-5deg); } 50% { transform: scaleY(.92) skewX(4deg); } 75% { transform: scaleY(1.06) skewX(-2deg); } }
@keyframes ico-shake { 20% { transform: rotate(-14deg); } 40% { transform: rotate(11deg); } 60% { transform: rotate(-7deg); } 80% { transform: rotate(4deg); } }
@keyframes ico-blink { 45% { transform: scaleY(.15); } }
@keyframes ico-nudge { 40% { transform: translate(2px, -2px) scale(1.08); } }

/* ---------------------------------------------------------------- menu lateral recolhível */
.rail-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 22px; }
.rail-top .brand { padding: 4px 6px; min-width: 0; }
.brand span:last-child { white-space: nowrap; transition: opacity .2s; }
.rail-tg { flex: none; width: 34px; height: 34px; border-radius: 11px; border: 0; background: transparent; color: var(--rail-ink); display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s; }
.rail-tg:hover { background: var(--rail-hi); color: #f7f4e4; }
.rail-tg svg { width: 19px; height: 19px; grid-area: 1 / 1; }
.rail-tg .tg-o, .collapsed .rail-tg .tg-c { display: none; }
.collapsed .rail-tg .tg-o { display: block; }
.nav a span, .lbl-sec span, .rail-foot button > span:not(.th-ico) { transition: opacity .2s; white-space: nowrap; }
.shell.collapsed { grid-template-columns: 78px 1fr; }
.collapsed .rail { padding: 20px 12px; }
.collapsed .rail-top { flex-direction: column; gap: 12px; }
.collapsed .brand span:last-child, .collapsed .nav a span, .collapsed .lbl-sec span { opacity: 0; }
.collapsed .brand span:last-child { display: none; }
.collapsed .nav a { padding: 10px 17px; }
.collapsed .lbl-sec { height: 1px; padding: 0; margin: 12px 10px; background: var(--rail-hi); overflow: hidden; }
.collapsed .rail-foot { flex-direction: column; padding: 8px; }
.collapsed .rail-foot button > span:not(.th-ico) { display: none; }
.collapsed .rail-foot button { padding: 9px 0; }

/* ---------------------------------------------------------------- níveis: verde bom / amarelo atenção / vermelho crítico */
.lv-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; margin-right: 2px; background: var(--muted); }
.lv-dot.good { background: var(--good); } .lv-dot.warn { background: var(--warn-fill); }
.lv-dot.bad { background: var(--bad); animation: lv-pulse 2s ease-out infinite; }
@keyframes lv-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
.lv-txt { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.lv-txt.good { color: var(--good); } .lv-txt.warn { color: var(--warn); } .lv-txt.bad { color: var(--bad); }
.kpi-hero.lv-bad .kpi-v { color: var(--bad); }
.kpi-trend .kt i.good { background: var(--good); } .kpi-trend .kt i.warn { background: var(--warn-fill); } .kpi-trend .kt i.bad { background: var(--bad); }
.legend i.lg-good { background: var(--good); } .legend i.lg-warn { background: var(--warn-fill); } .legend i.lg-bad { background: var(--bad); }

/* ---------------------------------------------------------------- troca de filtro ao vivo */
#view { transition: opacity .25s; }
body.busy #view { opacity: .78; }
#view.live > *, #view.live .kpis > .kpi { animation: none; }
.kv-up { animation: kv-up .55s var(--ease); }
.kv-down { animation: kv-down .55s var(--ease); }
@keyframes kv-up { from { transform: translateY(14px); opacity: .25; } }
@keyframes kv-down { from { transform: translateY(-14px); opacity: .25; } }
.chart path { transition: d .65s var(--ease); }
.chart .ln-in { animation: fadein .5s ease; }
@keyframes fadein { from { opacity: 0; } }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: linear-gradient(90deg, transparent, var(--accent), var(--hot), transparent) no-repeat; background-size: 40% 100%; }
body.busy .topbar::after { opacity: 1; animation: busy 1.1s linear infinite; }
@keyframes busy { from { background-position: -70% 0; } to { background-position: 170% 0; } }

/* ---------------------------------------------------------------- offcanvas do indicador */
html.oc-lock, html.oc-lock body { overflow: hidden; }
.oc-bg { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: flex-end; background: rgba(0, 0, 0, 0); transition: background .35s, backdrop-filter .35s; }
.oc-bg.open { background: rgba(0, 0, 0, .5); backdrop-filter: blur(4px); }
.oc { width: min(640px, 100vw); height: 100%; display: flex; flex-direction: column; background: var(--bg); border-left: 1px solid var(--line); box-shadow: -24px 0 60px rgba(0, 0, 0, .35); transform: translateX(100%); transition: transform .42s var(--ease); }
.oc-bg.open .oc { transform: none; }
.oc-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line-2); }
.oc-ht { display: flex; align-items: center; gap: 12px; min-width: 0; }
.oc-ht h2 { font-size: 20px; letter-spacing: -.02em; }
.oc-ico { flex: none; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.oc-ico svg { width: 20px; height: 20px; animation: ico-pop .6s var(--ease) .25s both; }
.oc .oc-x { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.oc .oc-x svg { width: 18px; height: 18px; }
.oc .oc-x:hover svg { animation: ico-turn .4s var(--ease); }
.oc-b { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 20px 22px 40px; }
.oc-b .g2, .oc-b .g3 { grid-template-columns: 1fr; }
.oc-b .kpi-hero { flex-direction: column; align-items: flex-start; gap: 8px; }
.oc-b > *, .oc-b > .grid > * { animation: rise .5s var(--ease) backwards; }
.oc-b > *:nth-child(2) { animation-delay: .06s; } .oc-b > *:nth-child(3) { animation-delay: .12s; }
.oc-b > *:nth-child(4) { animation-delay: .18s; } .oc-b > *:nth-child(n+5) { animation-delay: .24s; }

@media (max-width: 860px) {
  .shell, .shell.collapsed { grid-template-columns: 1fr; }
  .oc-bg { align-items: flex-end; }
  .oc { width: 100%; height: 92vh; border-left: 0; border-radius: 24px 24px 0 0; transform: translateY(100%); }
  .oc-h { padding: 16px 18px; }
  .oc-b { padding: 16px 16px calc(30px + env(safe-area-inset-bottom)); }
}


/* ---------------------------------------------------------------- tipografia (Archivo, com largura variável nos números) */
h1, .kpi-v, .oc-ht h2, .splash-name, .brand { font-stretch: 112%; }
.kpi-v { font-weight: 600; letter-spacing: -.03em; }
h1 { font-weight: 600; letter-spacing: -.03em; }
.lbl-sec, .tbl th { font-stretch: 118%; }

/* ---------------------------------------------------------------- fundo: azul com degradês fraquinhos (animados pelo Theatre.js) */
#scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; --glow: .4; --ai: 1; }
#scene .aurora { position: absolute; inset: -10%; opacity: var(--ai);
  background:
    radial-gradient(38% 34% at var(--ax, 16%) var(--ay, 8%), var(--au-1), transparent 70%),
    radial-gradient(34% 32% at var(--bx, 88%) var(--by, 92%), var(--au-2), transparent 70%),
    radial-gradient(30% 28% at var(--cx, 62%) var(--cy, 34%), var(--au-3), transparent 72%); filter: blur(10px); }
#scene .spot { position: absolute; left: 50%; top: -22%; width: 90vw; height: 70vh; transform: translateX(-50%); opacity: var(--glow);
  background: radial-gradient(50% 50% at 50% 30%, var(--au-spot), transparent 70%); }
:root { --au-1: rgba(255, 255, 255, .035); --au-2: rgba(229, 88, 18, .10); --au-3: rgba(245, 238, 158, .05); --au-spot: rgba(245, 238, 158, .09); }
:root[data-theme="light"] { --au-1: rgba(245, 238, 158, .55); --au-2: rgba(229, 88, 18, .07); --au-3: rgba(17, 18, 20, .04); --au-spot: rgba(255, 255, 255, .7); }
.shell, .login { position: relative; z-index: 1; }
.login { background: transparent; }
.main { background: transparent; }

/* ---------------------------------------------------------------- liquid glass (bem suave) */
:root { --glass: color-mix(in srgb, var(--panel) 58%, transparent); --glass-edge: rgba(255, 255, 255, .09); --glass-hi: rgba(255, 255, 255, .07); --glass-sh: 0 10px 30px rgba(0, 0, 0, .28); }
:root[data-theme="light"] { --glass: rgba(255, 255, 255, .6); --glass-edge: rgba(255, 255, 255, .85); --glass-hi: rgba(255, 255, 255, .7); --glass-sh: 0 10px 30px rgba(17, 18, 20, .08); }
.glass, .topbar, .oc, .tip, .toast, .login form, .seg, .topbar .sel, .rail-foot {
  background: linear-gradient(180deg, var(--glass-hi), transparent 42%), var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(165%); backdrop-filter: blur(18px) saturate(165%);
  box-shadow: inset 0 1px 0 var(--glass-edge), inset 0 0 0 1px color-mix(in srgb, var(--glass-edge) 45%, transparent), var(--glass-sh); }
.topbar { border-bottom-color: transparent; box-shadow: inset 0 -1px 0 var(--glass-edge); }
.topbar .sel, .seg { border-color: transparent; }
.rail-foot { background: linear-gradient(180deg, rgba(255,255,255,.06), transparent 50%), rgba(28, 28, 31, .55); border-color: transparent; }
.tip { color: var(--ink); }
:root:not([data-theme="light"]) .tip { background: linear-gradient(180deg, rgba(255,255,255,.1), transparent 50%), rgba(24, 24, 27, .8); }
.toast { color: var(--ink); }
.oc { background: linear-gradient(180deg, var(--glass-hi), transparent 30%), color-mix(in srgb, var(--bg) 80%, transparent); }
/* cards e painéis: leve transparência e brilho de borda (sem blur, para não pesar com o fundo animado) */
.panel, .kpi, .stage-wrap {
  background: linear-gradient(180deg, color-mix(in srgb, #fff 3.5%, transparent), transparent 40%), color-mix(in srgb, var(--panel) 86%, transparent);
  box-shadow: inset 0 1px 0 var(--glass-edge); }
:root[data-theme="light"] :is(.panel, .kpi, .stage-wrap) { background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.72)); box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(17,18,20,.04); }
.kpi:first-child, :root[data-theme="light"] .kpi:first-child { background: radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, #fff 22%, transparent), transparent 55%), var(--accent); box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
@media (max-width: 860px) {
  .tabbar { background: linear-gradient(180deg, rgba(255,255,255,.08), transparent 45%), rgba(16, 16, 18, .72) !important;
    -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
    border-color: rgba(255,255,255,.1) !important; box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 12px 32px rgba(0,0,0,.4) !important; }
  .sheet { background: linear-gradient(180deg, var(--glass-hi), transparent 30%), color-mix(in srgb, var(--panel) 82%, transparent);
    -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%); }
  .topbar { background: color-mix(in srgb, var(--bg) 70%, transparent); }
  .appbar { background: color-mix(in srgb, var(--bg) 70%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ================================================================ pós-lançamento (checklist SEO) */
.seo-score { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; margin-bottom: 14px; }
.seo-n { font-family: var(--font-display); line-height: 1; letter-spacing: -.045em; }
.seo-n b { font-size: 56px; font-weight: 500; }
.seo-n span { font-size: 24px; color: var(--muted); margin-left: 2px; }
.seo-bar { flex: 1; min-width: 220px; display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.seo-bar .seg { height: 12px; border-radius: 999px; background: var(--line-2); }
.seo-bar .seg.good { background: var(--good); } .seo-bar .seg.warn { background: var(--warn-fill); } .seo-bar .seg.bad { background: var(--bad); }
.seo-list { padding: 0; overflow: hidden; margin-bottom: 14px; }
.seo-item { display: flex; gap: 18px; padding: 20px 22px; border-top: 1px solid var(--line-2); }
.seo-item:first-child { border-top: 0; }
.seo-num { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -.04em; line-height: 1; min-width: 44px; color: var(--muted); }
.seo-item.good .seo-num { color: var(--good); } .seo-item.warn .seo-num { color: var(--warn); } .seo-item.bad .seo-num { color: var(--bad); }
.seo-body { flex: 1; min-width: 0; }
.seo-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seo-top h3 { margin: 0; font-size: 16px; font-weight: 600; }
.seo-body p { margin: 6px 0 0; color: var(--ink-2); max-width: 80ch; }
.seo-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.badge.todo { background: var(--line-2); color: var(--muted); }
.seo-act { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.seo-kw { display: flex; gap: 8px; align-items: center; }
.seo-kw .inp { width: 260px; max-width: 60vw; height: 32px; }
.seo-pages { margin-top: 12px; }
.seo-pages summary { cursor: pointer; color: var(--accent-text, var(--ink-2)); font-size: 13.5px; }
.seo-pages .tbl td { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seo-pages .tbl td:last-child { white-space: normal; }
.seo-link { margin-top: 10px; }
@media (max-width: 640px) { .seo-item { gap: 12px; padding: 16px; } .seo-num { font-size: 22px; min-width: 30px; } .seo-n b { font-size: 44px; } }
.seo-sp { flex-basis: 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seo-sp[hidden] { display: none; }
.seo-sp #seo-sp-msg { flex-basis: 100%; }
.seo-sp label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.seo-sp .inp { width: 72px; height: 32px; }
