:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #12202e;
  --ink-2: #4b5b6b;
  --muted: #8a97a5;
  --line: #e6eaef;
  --side: #0d1d2b;
  --side-2: #142a3c;
  --hero: #0f2233;
  --accent: #1f9e86;
  --accent-2: #36c2a4;
  --accent-soft: #e3f5f1;
  --gold: #d9a21b;
  --neg: #d0583f;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 32, 46, .04), 0 6px 24px rgba(16, 32, 46, .06);
  --ease: cubic-bezier(.22, 1, .36, 1);
  /* superfícies e estados (trocam no tema escuro) */
  --input: #ffffff;
  --field: #fbfcfd;
  --locked: #f1f4f6;
  --row-hover: #f7fafb;
  --row-foot: #f4f8f9;
  --track: #eef2f5;
  --switch: #d5dde4;
  --line-strong: #c9d5df;
  --scroll: #c3ccd5;
  --neg-soft: #fbebe7;
  --accent-ink: #145f51;
  --warn: #a06d00;
  --warn-soft: #fff1d6;
  --warn-bg: #fff7e0;
  --warn-line: #f2dd9b;
  --warn-ink: #7a5b00;
  --checker-a: #f4f6f8;
  --checker-b: #ffffff;
  --shadow-hover: 0 12px 30px rgba(16, 32, 46, .1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a141d;
  --card: #111f2b;
  --ink: #e4ecf2;
  --ink-2: #a7b7c5;
  --muted: #71869a;
  --line: #20354a;
  --accent: #2fb597;
  --accent-2: #45d0b0;
  --accent-soft: rgba(54, 194, 164, .14);
  --neg: #ec7a63;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
  --shadow-hover: 0 12px 30px rgba(0, 0, 0, .4);
  --input: #0d1a25;
  --field: #0d1a25;
  --locked: #16283a;
  --row-hover: #152737;
  --row-foot: #152737;
  --track: #1a2d3e;
  --switch: #2c4357;
  --line-strong: #2d465c;
  --scroll: #2c4458;
  --neg-soft: rgba(236, 122, 99, .15);
  --accent-ink: #9fe3d2;
  --warn: #f0b84a;
  --warn-soft: rgba(240, 184, 74, .15);
  --warn-bg: rgba(240, 184, 74, .1);
  --warn-line: rgba(240, 184, 74, .3);
  --warn-ink: #f3cf85;
  --checker-a: #16283a;
  --checker-b: #111f2b;
  color-scheme: dark;
}
/* transição suave só no momento da troca de tema */
.theme-anim, .theme-anim * { transition: background-color .35s ease, border-color .35s ease, color .35s ease !important; }
.theme-btn .ic-moon { display: none; }
:root[data-theme="dark"] .theme-btn .ic-sun { display: none; }
:root[data-theme="dark"] .theme-btn .ic-moon { display: block; }
.theme-btn:hover svg { animation: spin .8s var(--ease); }
:root[data-theme="dark"] .hero, :root[data-theme="dark"] .reco { box-shadow: inset 0 0 0 1px var(--line); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }

/* barra de rolagem fina e discreta */
@supports (-moz-appearance: none) {
  * { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
  .sidebar, .rv-text pre { scrollbar-color: #2c4659 transparent; }
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scroll); border-radius: 10px;
  border: 3px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--accent); }
::-webkit-scrollbar-corner { background: transparent; }
.sidebar ::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb,
.rv-text pre::-webkit-scrollbar-thumb { background-color: #2c4659; }

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ================= LOADER ================= */
#loader {
  position: fixed; inset: 0; z-index: 1000; background: #000; overflow: hidden;
  transition: opacity 1s ease, visibility 1s;
}
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.loader-content {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; pointer-events: none;
}
.loader-logo {
  width: min(520px, 78vw); filter: drop-shadow(0 0 30px rgba(95, 230, 160, .25));
  opacity: 0; transform: translateY(14px) scale(.96);
  animation: logoIn 1.4s .5s var(--ease) forwards, logoGlow 3.2s 2s ease-in-out infinite;
}
.loader-sub {
  color: #cfeee0; letter-spacing: .32em; text-transform: uppercase; font-size: 12px; font-weight: 500;
  opacity: 0; animation: fadeIn 1s 1.1s forwards;
}
.loader-bar {
  width: min(280px, 60vw); height: 3px; border-radius: 3px; background: rgba(174, 246, 207, .15);
  overflow: hidden; opacity: 0; animation: fadeIn .8s 1.2s forwards;
}
.loader-bar span {
  display: block; height: 100%; width: 0; border-radius: 3px;
  background: linear-gradient(90deg, #5fe6a0, #eafff2);
  box-shadow: 0 0 12px #5fe6a0; transition: width .25s linear;
}
.loader-status { color: rgba(234, 255, 242, .6); font-size: 12px; letter-spacing: .08em; opacity: 0; animation: fadeIn .8s 1.3s forwards; }
.loader-hint {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  color: rgba(234, 255, 242, .4); font-size: 11px; letter-spacing: .25em; text-transform: uppercase;
}
#loader.leaving .loader-content { animation: diveOut 1.1s var(--ease) forwards; }
#loader.leaving .loader-hint { opacity: 0; }
#loader.gone { opacity: 0; visibility: hidden; }

@keyframes logoIn { to { opacity: 1; transform: none; } }
@keyframes logoGlow {
  0%, 100% { filter: drop-shadow(0 0 24px rgba(95, 230, 160, .2)); }
  50% { filter: drop-shadow(0 0 42px rgba(217, 162, 27, .45)); }
}
@keyframes fadeIn { to { opacity: 1; } }
@keyframes diveOut { to { opacity: 0; transform: scale(1.6); filter: blur(6px); } }

/* ================= LAYOUT ================= */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex-shrink: 0; background: linear-gradient(180deg, var(--side), #0a1722);
  color: #c9d6e2; display: flex; flex-direction: column; padding: 22px 14px;
  position: sticky; top: 0; height: 100vh; z-index: 50;
  transition: transform .45s var(--ease);
}
.brand { padding: 4px 10px 26px; }
.brand img { width: 170px; display: block; }
.brand-sub { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: #6f8aa0; margin-top: 4px; padding-left: 4px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; border-radius: 12px;
  background: transparent; color: inherit; text-align: left; font-size: 14.5px; font-weight: 500;
  position: relative; transition: background .25s, color .25s, transform .25s var(--ease);
}
.nav-item:hover { background: rgba(255, 255, 255, .05); color: #fff; transform: translateX(3px); }
.nav-item.active { background: var(--side-2); color: #fff; }
.nav-item.active::before {
  content: ''; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent-2);
}
.nav-item.active svg { color: var(--accent-2); }
.badge {
  margin-left: auto; font-style: normal; font-size: 11px; background: rgba(54, 194, 164, .18);
  color: var(--accent-2); padding: 2px 8px; border-radius: 99px;
}
.sidebar-foot {
  display: flex; align-items: center; gap: 10px; padding: 12px 10px; margin: 0 -4px; border: 0; border-top: 1px solid rgba(255, 255, 255, .06);
  background: transparent; color: inherit; text-align: left; border-radius: 12px; transition: background .25s, transform .25s var(--ease);
}
.sidebar-foot:hover { background: rgba(255, 255, 255, .05); }
.sidebar-foot:hover .avatar { box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(217, 162, 27, .45); }
.sidebar-foot .pf-text { flex: 1; min-width: 0; }
.sidebar-foot strong { display: block; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot small { display: block; font-size: 12px; color: #7f97ab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-edit { width: 16px; height: 16px; color: #6f8aa0; opacity: 0; transform: translateX(-4px); transition: all .25s var(--ease); flex-shrink: 0; }
.sidebar-foot:hover .pf-edit { opacity: 1; transform: none; color: var(--gold); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: #1c3447; overflow: hidden; display: grid; place-items: center; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(217, 162, 27, .35); transition: box-shadow .3s;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar img.crown { width: 74%; height: 74%; object-fit: contain; }
.avatar.swap img { animation: avatarIn .55s var(--ease); }
@keyframes avatarIn { from { transform: scale(.4) rotate(-20deg); opacity: 0; } }

.main { flex: 1; min-width: 0; padding: 26px 32px 40px; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.crumbs { color: var(--ink-2); font-size: 13.5px; margin-top: 4px; }
.crumbs span { margin: 0 6px; color: var(--muted); }
.crumbs b { font-weight: 600; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink-2); display: grid; place-items: center; transition: all .2s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.icon-btn svg { width: 19px; height: 19px; }
.menu-btn { display: none; border: 0; background: none; color: var(--ink); padding: 4px; }

/* ================= VIEWS ================= */
.view { display: none; }
.view.active { display: block; animation: viewIn .55s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.stagger > * { opacity: 0; animation: fadeUp .6s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ================= CARDS ================= */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px; margin-bottom: 18px;
}
.card h3 { margin: 0 0 14px; font-size: 16px; font-weight: 650; }
.card h3 small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); font-size: 13px; margin: -6px 0 14px; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 12px;
  text-align: center; transition: transform .3s var(--ease), box-shadow .3s;
}
.kpi:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.kpi-icon {
  width: 42px; height: 42px; margin: 0 auto 10px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.kpi.neg .kpi-icon { background: var(--neg-soft); color: var(--neg); }
.kpi-label { font-size: 13px; color: var(--ink-2); font-weight: 500; min-height: 34px; display: flex; align-items: center; justify-content: center; }
.kpi-value { font-size: 17px; font-weight: 700; margin-top: 6px; white-space: nowrap; }
.kpi.neg .kpi-value { color: var(--neg); }
.kpi-note { font-size: 10.5px; color: var(--muted); margin-top: 3px; min-height: 13px; }

.hero {
  background: radial-gradient(120% 140% at 100% 0%, #17405a 0%, var(--hero) 55%);
  color: #fff; border-radius: var(--radius); padding: 24px 28px; margin-bottom: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .06) 50%, transparent 70%);
  transform: translateX(-100%); animation: shine 4s 1s ease-in-out infinite;
}
@keyframes shine { 0% { transform: translateX(-100%); } 40%, 100% { transform: translateX(100%); } }
.hero-label { font-size: 19px; font-weight: 600; }
.hero-value { font-size: 44px; font-weight: 800; color: var(--accent-2); letter-spacing: -.02em; margin: 4px 0; }
.hero-value.bump { animation: bump .5s var(--ease); }
@keyframes bump { 40% { transform: scale(1.04); text-shadow: 0 0 24px rgba(54, 194, 164, .6); } }
.hero-sub { color: #aac0d1; font-size: 13.5px; }
.hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; position: relative; z-index: 1; }
.hero-chip { font-size: 12px; padding: 4px 12px; border-radius: 99px; background: rgba(217, 162, 27, .16); color: #f2c75b; }
.hero.compact .hero-value { font-size: 36px; }

/* ================= BUTTONS ================= */
.btn {
  border: 1px solid transparent; border-radius: 12px; padding: 11px 18px; font-size: 14px; font-weight: 600;
  transition: all .25s var(--ease); display: inline-flex; align-items: center; gap: 8px; justify-content: center;
}
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(31, 158, 134, .3); }
.btn.primary:hover { background: #188a74; transform: translateY(-2px); }
.btn.ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.link { background: none; color: var(--accent); padding: 8px; }
.btn.link:hover { text-decoration: underline; }
.btn.danger { color: var(--neg); }
.btn.outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn.outline-light:hover { background: rgba(255, 255, 255, .08); border-color: #fff; }
.btn.outline-light span { transition: transform .25s var(--ease); }
.btn.outline-light:hover span { transform: translateX(4px); }

/* ================= DONUT ================= */
.grid-2 { display: grid; grid-template-columns: 1fr 1.15fr; gap: 18px; }
.grid-2 .card { margin-bottom: 18px; }
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut { position: relative; width: 200px; height: 200px; flex-shrink: 0; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); stroke-linecap: butt; }
.donut .track { stroke: var(--track); }
.donut circle.seg { transition: stroke-dasharray 1.1s var(--ease), stroke-dashoffset 1.1s var(--ease), stroke-width .2s; cursor: pointer; }
.donut circle.seg:hover { stroke-width: 18; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center strong { font-size: 16px; }
.donut-center span { font-size: 12px; color: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 190px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 0; color: var(--ink-2); }
.legend li b { margin-left: auto; color: var(--ink); font-weight: 600; }
.legend li.neg b { color: var(--neg); }
.legend i { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ================= TABLES ================= */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12.5px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
.table .r { text-align: right; white-space: nowrap; }
.table td.neg { color: var(--neg); }
.table tbody tr { transition: background .2s; }
.table tbody tr:hover { background: var(--row-hover); }
.table tfoot td { font-weight: 700; background: var(--row-foot); border-bottom: 0; }
.table td small { display: block; color: var(--muted); font-size: 11.5px; }
.table-scroll { overflow-x: auto; overflow-y: hidden; }

.manual-actions { margin-bottom: 18px; }
.overview-actions, .manual-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ================= EMPTY ================= */
.empty { text-align: center; padding: 70px 20px; max-width: 520px; margin: 30px auto; }
.empty-art {
  width: 86px; height: 86px; margin: 0 auto 18px; border-radius: 26px; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; animation: float 3.5s ease-in-out infinite;
}
.empty-art svg { width: 40px; height: 40px; }
@keyframes float { 50% { transform: translateY(-8px); } }
.empty h2 { margin: 0 0 8px; }
.empty p { color: var(--ink-2); margin: 0 0 22px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ================= IMPORT ================= */
.grid-import { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 260px; border: 2px dashed var(--line-strong); border-radius: 20px; background: var(--card);
  cursor: pointer; text-align: center; padding: 30px; transition: all .3s var(--ease); position: relative; overflow: hidden;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.015); }
.dropzone.over .dz-icon { animation: hop .6s ease-in-out infinite; }
.dropzone span { color: var(--muted); font-size: 13px; }
.dropzone strong { font-size: 16px; }
.dz-icon { width: 64px; height: 64px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 8px; }
.dz-icon svg { width: 30px; height: 30px; }
@keyframes hop { 50% { transform: translateY(-8px); } }

.file-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.file-item {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px;
  display: flex; align-items: center; gap: 14px; animation: fadeUp .5s var(--ease);
}
.file-item .fi-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.file-item.err .fi-icon { background: var(--neg-soft); color: var(--neg); }
.file-item .fi-body { flex: 1; min-width: 0; }
.file-item strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item small { color: var(--muted); font-size: 12.5px; }
.file-item .fi-total { font-weight: 700; color: var(--accent); white-space: nowrap; }

/* ================= SETTINGS ================= */
.settings select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--input);
  font: inherit; font-size: 14px; color: var(--ink); margin-bottom: 12px;
}
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 13.5px; cursor: pointer; transition: all .2s; user-select: none;
}
.toggle:hover { border-color: var(--accent); }
.toggle input { display: none; }
.toggle .sw { width: 30px; height: 18px; border-radius: 99px; background: var(--switch); position: relative; transition: background .25s; flex-shrink: 0; }
.toggle .sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .3s var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.toggle input:checked + .sw { background: var(--accent); }
.toggle input:checked + .sw::after { transform: translateX(12px); }
.toggle.wide { grid-column: 1 / -1; }
.settings-note { font-size: 11.5px; color: var(--muted); margin-top: 10px; line-height: 1.45; }

/* ================= MANUAL ================= */
.grid-manual { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }
.manual-result { position: sticky; top: 20px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field label small { font-weight: 400; color: var(--muted); }
.money { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--field); transition: all .2s; }
.money:focus-within { border-color: var(--accent); background: var(--input); box-shadow: 0 0 0 4px rgba(31, 158, 134, .12); }
.money i { font-style: normal; font-size: 12.5px; color: var(--muted); padding-left: 12px; }
.money.neg i { color: var(--neg); }
.money input { border: 0; outline: 0; background: transparent; padding: 10px 12px 10px 8px; font: inherit; font-size: 14.5px; width: 100%; text-align: right; color: var(--ink); }
.sep { grid-column: 1 / -1; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 16px 0 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.form .sep { margin: 6px 0 0; }

.breakdown { list-style: none; margin: 0; padding: 0; }
.breakdown li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; font-size: 13.5px; border-bottom: 1px dashed var(--line); animation: fadeUp .35s var(--ease); }
.breakdown li span { color: var(--ink-2); }
.breakdown li b.neg { color: var(--neg); }
.breakdown li.total { border-bottom: 0; font-weight: 700; font-size: 15px; padding-top: 12px; }
.breakdown li.total span { color: var(--ink); }

/* keypad */
.keypad { background: #0f2233; border-radius: 14px; padding: 12px; }
.kp-display { text-align: right; color: #fff; padding: 6px 8px 12px; min-height: 58px; }
.kp-display small { display: block; color: #7f97ab; font-size: 12px; min-height: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kp-display strong { font-size: 26px; font-weight: 700; word-break: break-all; }
.kp-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.kp-keys button {
  border: 0; border-radius: 10px; padding: 12px 0; background: #1a3347; color: #e4eef5; font-size: 16px; font-weight: 600;
  transition: transform .12s, background .2s;
}
.kp-keys button:hover { background: #22425b; }
.kp-keys button:active { transform: scale(.94); }
.kp-keys button.op { background: #17405a; color: var(--accent-2); }
.kp-keys button.eq { background: var(--accent); color: #fff; }
.kp-keys button.fn { color: #f2c75b; }
.kp-keys button.use { grid-column: span 2; font-size: 12.5px; background: rgba(217, 162, 27, .16); color: #f2c75b; }

/* ================= HISTORY ================= */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px;
  transition: all .25s var(--ease); cursor: pointer;
}
.history-item:hover { border-color: var(--accent); transform: translateX(4px); }
.history-item .hi-body { flex: 1; min-width: 0; }
.history-item strong { display: block; font-size: 14px; }
.history-item small { color: var(--muted); font-size: 12.5px; }
.history-item .hi-total { font-weight: 700; color: var(--accent); white-space: nowrap; }
.history-item .hi-del { border: 0; background: none; color: var(--muted); padding: 6px; border-radius: 8px; }
.history-item .hi-del:hover { color: var(--neg); background: var(--neg-soft); }
.history-empty { color: var(--muted); text-align: center; padding: 30px; }

/* ================= MODAL / TOAST ================= */
.modal { position: fixed; inset: 0; z-index: 500; background: rgba(8, 20, 30, .5); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fadeIn .25s forwards; opacity: 0; }
.modal[hidden] { display: none; }
.modal-box { background: var(--card); border-radius: 20px; width: min(760px, 100%); max-height: 86vh; overflow: auto; padding: 22px 24px; animation: pop .4s var(--ease); }
@keyframes pop { from { transform: scale(.94) translateY(10px); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-head h3 { margin: 0; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 16px; }
.meta-grid div { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.meta-grid small { display: block; color: var(--muted); font-size: 11.5px; }
.meta-grid b { font-size: 13.5px; word-break: break-all; }
.formula { font-size: 13px; background: var(--accent-soft); color: var(--accent-ink); padding: 12px 14px; border-radius: 10px; margin-top: 14px; line-height: 1.5; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 600; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--hero); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2); border-left: 3px solid var(--accent-2);
  animation: toastIn .4s var(--ease);
}
.toast.err { border-left-color: var(--neg); }
.toast.out { animation: toastOut .35s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ================= RESPONSIVE ================= */
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1080px) {
  .grid-2, .grid-import, .grid-manual { grid-template-columns: 1fr; }
  .manual-result { position: static; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .sidebar.open { transform: none; }
  .menu-btn { display: block; }
  .main { padding: 18px 16px 30px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-value { font-size: 34px; }
  .form, .toggles { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 19px; }
  .donut { margin: 0 auto; }
}

@media print {
  .sidebar, .topbar-actions, .overview-actions, #loader, .menu-btn { display: none !important; }
  .main { padding: 0; }
  .card, .kpi { box-shadow: none; border: 1px solid var(--line); }
  .hero { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ================= v2: downloads, toolbar, comparativo, premissas ================= */
.dl-btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 12px; padding: 9px 16px 9px 12px;
  color: #fff; font-weight: 600; font-size: 13.5px; position: relative; overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .25s, filter .2s;
}
.dl-btn svg { width: 22px; height: 22px; }
.dl-btn.pdf { background: linear-gradient(135deg, #e5483a, #c62828); box-shadow: 0 6px 16px rgba(198, 40, 40, .3); }
.dl-btn.xls { background: linear-gradient(135deg, #21a366, #107c41); box-shadow: 0 6px 16px rgba(16, 124, 65, .3); }
.dl-btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.dl-btn:hover svg { animation: hop .6s ease-in-out; }
.dl-btn:active { transform: scale(.96); }
.dl-btn::after {
  content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.28) 50%, transparent 65%);
  transform: translateX(-100%); transition: transform .7s var(--ease);
}
.dl-btn:hover::after { transform: translateX(100%); }
.dl-btn.busy { pointer-events: none; opacity: .75; }
.dl-btn.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.chip { font-size: 12.5px; padding: 7px 12px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: var(--ink-2); }
.chip-select { display: inline-flex; align-items: center; gap: 8px; background: var(--hero); color: #fff; border-radius: 99px; padding: 4px 6px 4px 14px; font-size: 12.5px; }
.chip-select select { border: 0; border-radius: 99px; padding: 5px 10px; font: inherit; font-weight: 600; background: #1d3a50; color: #fff; cursor: pointer; }
.hero-ratio { text-align: right; }
.hero-ratio strong { display: block; font-size: 26px; color: #f2c75b; }
.hero-ratio span { font-size: 12px; color: #aac0d1; }

.select, .settings select, .settings input.pinput {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--input);
  font: inherit; font-size: 14px; color: var(--ink);
}
.field.full { grid-column: 1 / -1; }
.money input:disabled { color: var(--muted); }
.money.locked { background: var(--locked); }
.dz-note { font-size: 11.5px !important; max-width: 380px; margin-top: 6px; }

.params { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.params .pf { display: flex; flex-direction: column; gap: 5px; }
.params .pf.full { grid-column: 1 / -1; }
.params label.pl { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.params .pf small { font-size: 11px; color: var(--muted); line-height: 1.35; }

.head-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.cmp-table th, .cmp-table td { min-width: 150px; }
.cmp-table th:first-child, .cmp-table td:first-child { min-width: 210px; }
.cmp-table thead th { font-size: 13px; color: var(--ink); text-align: right; vertical-align: bottom; }
.cmp-table thead th:first-child { text-align: left; }
.cmp-table td.sec { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding-top: 16px; }
.cmp-table .money { max-width: 170px; margin-left: auto; }
.cmp-table .money input { padding: 7px 10px 7px 6px; font-size: 13.5px; }
.cmp-table tr.res td { font-weight: 700; font-size: 15px; }
.cmp-table td.win, .cmp-table th.win { background: rgba(31, 158, 134, .08); }
.cmp-table th.win { color: var(--accent); }
.win-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700;
  background: linear-gradient(135deg, #f6d36b, #d9a21b); color: #3b2a00; box-shadow: 0 4px 14px rgba(217, 162, 27, .35);
  animation: pop .5s var(--ease), glowGold 2.4s 0.5s ease-in-out infinite;
}
.win-badge img { height: 13px; }
@keyframes glowGold { 50% { box-shadow: 0 4px 22px rgba(217, 162, 27, .7); } }

.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: center; font-size: 13px; }
.bar-row > span { color: var(--ink-2); }
.bar-track { background: var(--track); border-radius: 8px; height: 30px; position: relative; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 8px; background: linear-gradient(90deg, #3f5a73, #7d9bb8); width: 0;
  transition: width 1s var(--ease); display: flex; align-items: center; justify-content: flex-end; padding-right: 10px;
  color: #fff; font-weight: 700; font-size: 12.5px; white-space: nowrap;
}
.bar-row.win .bar-fill { background: linear-gradient(90deg, #1f9e86, #36c2a4); }
.bar-row.win > span { color: var(--accent); font-weight: 700; }

.rules { margin: 0; padding-left: 0; list-style: none; counter-reset: r; }
.rules li {
  counter-increment: r; position: relative; padding: 10px 0 10px 40px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2);
  border-bottom: 1px dashed var(--line); animation: fadeUp .5s var(--ease) both;
}
.rules li::before {
  content: counter(r); position: absolute; left: 0; top: 9px; width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12.5px; display: grid; place-items: center;
}
.rules li b { color: var(--ink); }

@media (max-width: 820px) {
  .dl-btn span { display: none; }
  .dl-btn { padding: 9px; }
  .params { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr; gap: 4px; }
}
.sec-row { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding-top: 14px !important; background: transparent !important; }
.breakdown li.sub { border-bottom: 0; border-top: 1px solid var(--line); font-weight: 600; }
.breakdown li.sub span { color: var(--ink); }
.cmp-table tr.strong td { font-weight: 700; }
.cmp-table tr.res td:not(:first-child) { color: var(--ink); }
.cmp-table tr.res td.win { color: var(--accent); }

/* ================= perfil ================= */
.profile-box { width: min(460px, 100%); }
.pf-photo { display: flex; align-items: center; gap: 18px; margin: 6px 0 18px; }
.pf-photo-pick {
  position: relative; width: 104px; height: 104px; border-radius: 50%; overflow: hidden; cursor: pointer; flex-shrink: 0;
  background: var(--hero); box-shadow: 0 0 0 3px var(--gold), 0 10px 28px rgba(217, 162, 27, .25); display: grid; place-items: center;
}
.pf-photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.pf-photo-pick img.crown { width: 72%; height: 72%; object-fit: contain; }
.pf-photo-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 20, 30, .55); color: #fff;
  opacity: 0; transition: opacity .25s;
}
.pf-photo-pick:hover .pf-photo-overlay { opacity: 1; }
.pf-photo-pick.drop { box-shadow: 0 0 0 3px var(--accent), 0 0 0 8px rgba(31, 158, 134, .2); }
.pf-photo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.pf-photo-actions small { color: var(--muted); font-size: 11.5px; }
.pf-photo-actions .btn.link { padding: 4px 0; font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ================= orçamento: leitura e revisão ================= */
.dz-types { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; max-width: 420px; }
.dz-types b { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.file-item.active { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.file-item.reading .fi-icon svg { animation: spin 1s linear infinite; }
.fi-bar { height: 4px; border-radius: 4px; background: var(--line); margin-top: 7px; overflow: hidden; }
.fi-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 4px; transition: width .3s; }
.file-item small a { color: var(--accent); font-weight: 600; }

#review { margin-top: 18px; animation: fadeUp .5s var(--ease); }
.review-card h3 small { display: block; margin-top: 2px; }
.rv-notes { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; display: grid; gap: 4px; }
.rv-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.rv-grid .rv-wide { grid-column: span 2; }
.rv-grid .field label { display: flex; align-items: center; gap: 6px; }
.money input.l { text-align: left; padding-left: 12px; }
.det { font-style: normal; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 99px; letter-spacing: .02em; }
.det.ok { background: var(--accent-soft); color: var(--accent); }
.det.chk { background: var(--warn-soft); color: var(--warn); }
.hint { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.rv-items td { padding: 5px 4px; vertical-align: top; }
.rv-items td small { display: block; padding-left: 8px; }
.rv-items th:nth-child(2), .rv-items td:nth-child(2) { width: 110px; }
.rv-items th:nth-child(4), .rv-items td:nth-child(4), .rv-items th:nth-child(5), .rv-items td:nth-child(5) { width: 140px; }
.cell { width: 100%; border: 1px solid transparent; border-radius: 8px; padding: 7px 8px; font: inherit; font-size: 13.5px; background: transparent; color: var(--ink); transition: all .2s; }
.cell:hover { border-color: var(--line); background: var(--field); }
.cell:focus { outline: 0; border-color: var(--accent); background: var(--input); box-shadow: 0 0 0 3px rgba(31, 158, 134, .12); }
.cell.r { text-align: right; }
.cell.b { font-weight: 700; }
.rv-summary { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; margin-top: 18px; padding: 14px 18px; border-radius: 12px; background: var(--bg); }
.rv-summary small { display: block; font-size: 11.5px; color: var(--muted); }
.rv-summary b { font-size: 17px; }
.rv-check { flex: 1; min-width: 220px; font-size: 13px; text-align: right; }
.rv-ok { color: var(--accent); font-weight: 600; }
.rv-warn { color: var(--warn); font-weight: 600; }
.rv-text { margin-top: 14px; font-size: 13px; }
.rv-text summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.rv-text pre { max-height: 280px; overflow: auto; background: #0f2233; color: #cfe3ef; padding: 12px 14px; border-radius: 10px; font-size: 12px; white-space: pre-wrap; }
@media (max-width: 980px) { .rv-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .rv-grid { grid-template-columns: 1fr; } .rv-grid .rv-wide { grid-column: auto; } }
.rv-items tr.chk td { background: var(--warn-bg); }
.rv-items tr.chk td:first-child { box-shadow: inset 3px 0 0 #e0a800; }

/* ================= vários orçamentos ================= */
.btn.sm { padding: 8px 13px; font-size: 13px; }
.files-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding: 10px 12px 10px 16px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); font-size: 13.5px; font-weight: 600; animation: fadeUp .4s var(--ease); }
.files-bar > div { display: flex; gap: 8px; }
.fi-status { font-style: normal; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; margin-left: 6px; vertical-align: 1px; }
.fi-status.todo { background: var(--warn-soft); color: var(--warn); }
.fi-status.done { background: var(--accent-soft); color: var(--accent); }
.fi-cmp { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); cursor: pointer; white-space: nowrap; user-select: none; }
.fi-cmp input { accent-color: var(--accent); }

.seg { display: inline-flex; background: var(--card); border-radius: 12px; padding: 4px; box-shadow: var(--shadow); margin-bottom: 16px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 9px 16px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); transition: all .25s var(--ease); }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--hero); color: #fff; }
.seg em { font-style: normal; font-size: 11px; background: rgba(54, 194, 164, .2); color: var(--accent); padding: 1px 7px; border-radius: 99px; margin-left: 4px; }
.seg button.active em { color: var(--accent-2); }
#cmp-quotes, #cmp-sim { animation: fadeUp .45s var(--ease); }

.q-table thead th { vertical-align: top; }
.q-head strong { display: block; font-size: 13.5px; color: var(--ink); white-space: normal; line-height: 1.3; }
.q-head small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; margin-top: 2px; white-space: normal; }
.q-head select { margin-top: 6px; width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; font: inherit; font-size: 12px; background: var(--input); color: var(--ink); }
.q-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.q-actions button { border: 0; background: var(--bg); color: var(--ink-2); font-size: 11.5px; font-weight: 600; padding: 5px 9px; border-radius: 7px; transition: all .2s; }
.q-actions button:hover { background: var(--accent-soft); color: var(--accent); }

.save { display: block; font-size: 11px; color: var(--accent); font-weight: 600; margin-top: 4px; }
.win-badge img { height: 14px; }

/* ================= modelo de pedido ================= */
.import-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.tpl-card {
  display: flex; align-items: center; gap: 12px; text-align: left; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow);
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s; font: inherit; cursor: pointer;
}
.tpl-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-hover); }
.tpl-card b { display: block; font-size: 13.5px; }
.tpl-card small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.tpl-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; color: #fff; background: linear-gradient(135deg, #21a366, #107c41); }
.tpl-ic.alt { background: linear-gradient(135deg, #36c2a4, #1f9e86); }
.tpl-card:hover .tpl-ic svg { animation: hop .6s ease-in-out; }
.rv-obs { margin-top: 12px; font-size: 13px; background: var(--bg); border-radius: 10px; padding: 10px 14px; color: var(--ink-2); }
@media (max-width: 680px) { .import-actions { grid-template-columns: 1fr; } }

/* ================= recomendação ================= */
.reco {
  display: flex; gap: 18px; align-items: center; margin-bottom: 18px; padding: 22px 26px; border-radius: var(--radius); color: #fff;
  background: radial-gradient(120% 160% at 100% 0%, #17405a 0%, var(--hero) 60%); position: relative; overflow: hidden;
  animation: fadeUp .5s var(--ease);
}
.reco::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.06) 50%, transparent 70%); transform: translateX(-100%); animation: shine 4s 1s ease-in-out infinite; }
.reco-ic { width: 64px; height: 64px; border-radius: 18px; background: rgba(217,162,27,.15); display: grid; place-items: center; flex-shrink: 0; box-shadow: 0 0 0 2px rgba(217,162,27,.4); animation: glowGold 2.4s ease-in-out infinite; }
.reco-ic img { width: 44px; }
.reco-body small { color: #f2c75b; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: 11px; }
.reco-body h2 { margin: 4px 0 6px; font-size: 22px; }
.reco-body h2 span { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: rgba(54,194,164,.18); color: var(--accent-2); vertical-align: 4px; margin-left: 6px; }
.reco-body p { margin: 0; color: #cfe0ea; font-size: 14px; line-height: 1.5; }
.reco-body p b { color: #fff; }
.reco-why { margin-top: 6px !important; color: #aac0d1 !important; font-size: 13px !important; }
.q-items th small, .q-items td small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.q-items td.win { background: rgba(31,158,134,.08); }
.q-items td.win b { color: var(--accent); }
.muted-cell { color: var(--muted); }

/* ================= perfil: empresa e logo ================= */
.profile-box { width: min(560px, 100%); }
.pf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.pf-grid .pf-full { grid-column: 1 / -1; }
.profile-box .sep { margin: 18px 0 10px; }
#pf-cnpj-status { font-weight: 600; }
#pf-cnpj-status.ok { color: var(--accent); }
#pf-cnpj-status.err { color: var(--neg); }
.pf-logo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pf-logo-pick {
  flex: 1; min-width: 220px; height: 92px; border: 2px dashed var(--line-strong); border-radius: 12px; display: grid; place-items: center;
  cursor: pointer; background: repeating-conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%) 0 0 / 16px 16px; text-align: center;
  color: var(--muted); font-size: 12.5px; transition: border-color .2s, transform .2s;
}
.pf-logo-pick:hover, .pf-logo-pick.drop { border-color: var(--accent); }
.pf-logo-pick small { font-size: 11px; }
.pf-logo-pick img { max-width: 92%; max-height: 74px; object-fit: contain; animation: avatarIn .5s var(--ease); }
@media (max-width: 560px) { .pf-grid { grid-template-columns: 1fr; } }

/* ================= "?" explicativo ================= */
.help {
  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; margin-left: 5px; vertical-align: 1px;
  font: 700 10.5px/1 'Inter', sans-serif; color: var(--accent); background: var(--accent-soft); cursor: help; user-select: none;
  transition: transform .2s var(--ease), background .2s, color .2s; flex-shrink: 0;
}
.help:hover, .help:focus-visible { background: var(--accent); color: #fff; transform: scale(1.15); outline: none; }
.hero .help, .reco .help, .chip-select .help { background: rgba(255, 255, 255, .14); color: #fff; }
.hero .help:hover, .reco .help:hover, .chip-select .help:hover { background: var(--gold); color: #1a1200; }
.kpi-label .help { margin-left: 4px; }
th .help { text-transform: none; }
.tip {
  position: fixed; z-index: 900; background: var(--hero); color: #e8f1f6; font-size: 12.5px; line-height: 1.45; font-weight: 500;
  padding: 10px 13px; border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .25); pointer-events: none;
  opacity: 0; transform: translateY(4px) scale(.98); transition: opacity .18s, transform .22s var(--ease);
}
.tip.on { opacity: 1; transform: none; }
.tip::after { content: ''; position: absolute; left: var(--ax, 50%); bottom: -6px; width: 12px; height: 12px; background: var(--hero); transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.tip.below::after { bottom: auto; top: -6px; }

/* ================= IA ================= */
.ia-status { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 99px; text-transform: uppercase; letter-spacing: .06em; }
.ia-status.on { background: var(--accent-soft); color: var(--accent); }
.ia-status.off { background: var(--warn-soft); color: var(--warn); }
.ia-card .toggle.wide { display: flex; }

/* ================= tema escuro: ajustes pontuais ================= */
:root[data-theme="dark"] .seg button.active { background: var(--accent); }
:root[data-theme="dark"] .seg button.active em { background: rgba(255, 255, 255, .18); color: #fff; }
:root[data-theme="dark"] .keypad { box-shadow: inset 0 0 0 1px var(--line); }
:root[data-theme="dark"] .toast, :root[data-theme="dark"] .tip { box-shadow: 0 12px 30px rgba(0, 0, 0, .5), inset 0 0 0 1px var(--line); }
:root[data-theme="dark"] .btn.primary:hover { background: #28a084; }
:root[data-theme="dark"] .modal { background: rgba(0, 0, 0, .6); }

/* ================= DIFAL, prazo e histórico de preços ================= */
.params .psep { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--line); flex-direction: row; align-items: center; }
.table td.up, .ph.up { color: var(--neg); }
.table td.down, .ph.down { color: var(--accent); }
.ph { display: block; font-size: 11px; font-weight: 600; white-space: nowrap; color: var(--muted); }
.ph.eq { color: var(--muted); }
.rv-items td.ph-cell { vertical-align: middle; min-width: 120px; }
.price-search { margin-bottom: 14px; }
.price-search i { font-size: 13px; }
.prices-list { display: flex; flex-direction: column; gap: 10px; }
.pr-group { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; transition: border-color .25s; }
.pr-group[open] { border-color: var(--accent); }
.pr-group summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 16px; align-items: center; padding: 12px 16px; }
.pr-group summary::-webkit-details-marker { display: none; }
.pr-group summary:hover { background: var(--row-hover); }
.pr-group summary strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-group summary small, .pr-stat small { display: block; color: var(--muted); font-size: 11.5px; }
.pr-stat { text-align: right; font-size: 13.5px; white-space: nowrap; }
.pr-stat b { font-size: 14px; }
.pr-group .table { margin: 0; }
.pr-group .table td, .pr-group .table th { padding-left: 16px; padding-right: 16px; }
.pr-group .table tr.best td { background: rgba(31, 158, 134, .08); }
@media (max-width: 720px) { .pr-group summary { grid-template-columns: 1fr 1fr; } }
.back-btn { flex-shrink: 0; }
.back-btn svg { width: 20px; height: 20px; stroke-width: 2.2; }
.back-btn:hover svg { transform: translateX(-2px); transition: transform .2s var(--ease); }
