/* Identidade alinhada a avantgardeam.com.br: gradiente azul, Cinzel nos títulos,
   Open Sans no texto, Work Sans em caixa alta nos botões. */
:root {
  --navy: #273d53;
  --steel: #49729a;
  --blue: #2990cb;
  --blue-deep: #175a82;
  --link: #4174a5;
  --ink: #1f2a36;
  --ink-2: #545454;
  --ink-3: #7a8591;
  --line: #e1e6eb;
  --surface: #ffffff;
  --page: #f6f8fa;
  --tint: #eef5fa;
  --good: #1f7a54;
  --good-bg: #e8f4ee;
  --warn: #9a6410;
  --warn-bg: #fbf2e0;
  --series-acc: #2990cb;
  --series-ret: #235c9e;
  --series-gain: #b07f22;
  --gradient: linear-gradient(90deg, #49729a 0%, #273d53 100%);
  --radius: 6px;
  --shadow: 0 1px 2px rgba(39, 61, 83, .06), 0 8px 24px rgba(39, 61, 83, .06);
  --font-body: "Open Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Cinzel", Georgia, serif;
  --font-ui: "Work Sans", "Open Sans", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-body); font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--page); }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Cabeçalho da marca (oculto em ?embed=1) */
.brand { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand img { display: block; height: 62px; width: auto; margin: -10px 0 -10px -6px; }
.brand-link { font-family: var(--font-ui); font-size: 13px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--link); text-decoration: none; }
.brand-link:hover { color: var(--blue-deep); }
.embed [data-chrome] { display: none; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 28px; border: 1px solid transparent; border-radius: 3px; font-family: var(--font-ui); font-size: 14px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; cursor: pointer; transition: background .15s, color .15s, border-color .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-deep); }
.btn-light { background: #fff; color: var(--navy); }
.btn-light:hover { background: var(--tint); }
.btn-ghost { background: transparent; color: var(--link); padding: 0 12px; }
.btn-ghost:hover { color: var(--blue-deep); }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .6); }
.btn-outline-light:hover { background: rgba(255, 255, 255, .12); }
.link { padding: 0; border: 0; background: none; color: var(--link); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link:hover { color: var(--blue-deep); }

/* Abertura */
.hero { background: var(--gradient); color: #fff; }
.hero-inner { max-width: 880px; margin: 0 auto; padding: clamp(56px, 10vw, 112px) 24px; }
.eyebrow { font-family: var(--font-ui); font-size: 13px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; opacity: .8; margin-bottom: 16px; }
.hero h1 { font-size: clamp(32px, 5.4vw, 56px); font-weight: 700; line-height: 1.1; letter-spacing: -1px; text-wrap: balance; }
.hero-lead { max-width: 600px; margin: 24px 0 36px; font-size: clamp(17px, 2vw, 20px); font-weight: 300; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 36px 0 0; padding: 0; list-style: none; font-size: 14px; opacity: .85; }
.hero-facts li::before { content: "✓"; margin-right: 8px; }

/* Perguntas guiadas */
.wizard-inner { max-width: 640px; margin: 0 auto; padding: 40px 24px 72px; }
.steps { margin-bottom: 40px; }
.steps-label { font-family: var(--font-ui); font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.steps-track { height: 3px; margin-top: 10px; background: var(--line); border-radius: 2px; overflow: hidden; }
.steps-fill { height: 100%; width: 25%; background: var(--blue); transition: width .35s ease; }
.step { margin: 0; padding: 0; border: 0; min-width: 0; animation: rise .35s ease both; }
.step legend { padding: 0; font-family: var(--font-display); font-size: clamp(26px, 4vw, 34px); line-height: 1.25; color: var(--blue); }
.step-hint { margin: 12px 0 36px; color: var(--ink-2); font-weight: 300; font-size: 17px; }
.field { margin-bottom: 36px; }
.field > label { display: block; margin-bottom: 10px; font-weight: 600; font-size: 17px; }
.optional { margin-left: 6px; font-size: 12px; font-weight: 400; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
.field-note { margin-top: 10px; font-size: 14px; color: var(--ink-3); }
.big-input { display: flex; align-items: baseline; gap: 10px; padding: 6px 0 8px; border-bottom: 2px solid var(--line); transition: border-color .15s; }
.big-input:focus-within { border-color: var(--blue); }
.big-input input { flex: 1; min-width: 0; padding: 0; border: 0; outline: 0; background: none; font-size: clamp(30px, 6vw, 42px); font-weight: 300; font-variant-numeric: tabular-nums; color: var(--navy); }
.big-input span { color: var(--ink-3); font-size: 18px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 14px; color: var(--ink-2); cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.chip:hover { border-color: var(--blue); color: var(--blue-deep); }
.chip[aria-pressed="true"] { border-color: var(--blue); background: var(--tint); color: var(--blue-deep); }
.options { display: grid; gap: 12px; margin-bottom: 32px; }
.option { position: relative; display: block; cursor: pointer; }
.option input { position: absolute; opacity: 0; }
.option-body { display: block; padding: 18px 20px 18px 52px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .15s, box-shadow .15s, background .15s; }
.option-body::before { content: ""; position: absolute; left: 20px; top: 22px; width: 18px; height: 18px; border: 2px solid var(--ink-3); border-radius: 50%; background: #fff; transition: border-color .15s, border-width .15s; }
.option-body strong { display: block; font-size: 17px; font-weight: 600; }
.option-body span { display: block; margin-top: 2px; font-size: 15px; color: var(--ink-2); }
.option:hover .option-body { border-color: var(--blue); }
.option input:checked + .option-body { border-color: var(--blue); background: var(--tint); box-shadow: 0 0 0 1px var(--blue); }
.option input:checked + .option-body::before { border-color: var(--blue); border-width: 6px; }
.option input:focus-visible + .option-body { outline: 2px solid var(--blue); outline-offset: 2px; }
.wizard-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }

/* Controles deslizantes */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; margin: 10px 0 0; background: none; cursor: pointer; --fill: 50%; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--blue) var(--fill), var(--line) var(--fill)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--blue); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border: 2px solid #fff; border-radius: 50%; background: var(--blue); box-shadow: 0 1px 4px rgba(39, 61, 83, .35); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 2px solid #fff; border-radius: 50%; background: var(--blue); box-shadow: 0 1px 4px rgba(39, 61, 83, .35); }

/* Resultado */
.results { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 28px; max-width: 1240px; margin: 0 auto; padding: 28px 24px 64px; align-items: start; animation: rise .4s ease both; }
.card { padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.content { display: grid; gap: 20px; min-width: 0; }
.content.loading .verdict, .content.loading .kpis { opacity: .6; transition: opacity .2s .15s; }
.card h3 { font-family: var(--font-display); font-size: 22px; font-weight: 400; line-height: 1.3; color: var(--blue); }
.card-lead { margin-top: 6px; color: var(--ink-2); font-size: 15px; max-width: 68ch; }

.panel { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-toggle { display: none; }
.panel-body { padding: 24px; }
.panel-title { font-family: var(--font-display); font-size: 20px; font-weight: 400; color: var(--blue); }
.panel-hint { margin: 4px 0 18px; font-size: 13px; color: var(--ink-3); }
.ctl { margin-bottom: 18px; }
.ctl label { font-size: 14px; color: var(--ink-2); }
.ctl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mini { display: flex; align-items: baseline; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff; transition: border-color .15s; }
.mini:focus-within { border-color: var(--blue); }
.mini input { width: 92px; padding: 0; border: 0; outline: 0; background: none; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--navy); }
.mini span { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.ctl select { display: block; width: 100%; margin-top: 6px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font-weight: 600; color: var(--navy); }
.premises { margin: 22px 0 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.premises-title { font-family: var(--font-display); font-size: 16px; font-weight: 400; color: var(--blue); }
.premises > .link { display: block; }
.premises .mini input { width: 52px; }

.alert { padding: 14px 18px; border: 1px solid #e7c98f; border-radius: var(--radius); background: var(--warn-bg); color: #6b4508; }

.verdict { display: flex; align-items: center; gap: 32px; padding: 32px; }
.ring { position: relative; flex: none; width: 148px; height: 148px; }
.ring svg { width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 9; }
.ring-track { stroke: var(--line); }
.ring-fill { stroke: var(--blue); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset .6s ease, stroke .3s; }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; }
.ring-label strong { font-size: 34px; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums; color: var(--navy); }
.ring-label span { font-size: 13px; color: var(--ink-3); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-family: var(--font-ui); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.status.good { background: var(--good-bg); color: var(--good); }
.status.warn { background: var(--warn-bg); color: var(--warn); }
.verdict h2 { margin: 10px 0 8px; font-size: clamp(24px, 3vw, 32px); font-weight: 700; line-height: 1.2; letter-spacing: -.5px; color: var(--navy); text-wrap: balance; }
.verdict p { color: var(--ink-2); font-size: 17px; font-weight: 300; max-width: 60ch; }
.verdict p b { font-weight: 600; color: var(--ink); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 20px; }
.kpi { display: flex; flex-direction: column; padding: 22px 24px; }
.kpi-label { font-size: 14px; color: var(--ink-2); }
.kpi strong { margin: 4px 0 2px; font-size: clamp(22px, 2.1vw, 26px); font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; color: var(--navy); white-space: nowrap; }
.kpi-note { font-size: 13px; color: var(--ink-3); }

/* Gráfico */
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 18px 0 4px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.sw-acc { background: var(--series-acc); }
.sw-ret { background: var(--series-ret); }
.sw-goal { width: 9px; height: 9px; border-radius: 0; background: var(--ink); transform: rotate(45deg); }
.chart { position: relative; height: 340px; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart text { font-family: var(--font-body); font-size: 12px; fill: var(--ink-3); }
.chart .note { fill: var(--ink-2); font-weight: 600; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.tip { position: absolute; top: 0; left: 0; padding: 8px 12px; border-radius: 4px; background: var(--navy); color: #fff; font-size: 13px; line-height: 1.4; white-space: nowrap; pointer-events: none; box-shadow: 0 4px 14px rgba(39, 61, 83, .25); }
.tip b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.table-view { margin-top: 12px; font-size: 14px; }
.table-view summary { color: var(--link); cursor: pointer; }
.table-scroll { max-height: 300px; margin-top: 10px; overflow: auto; border: 1px solid var(--line); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 14px; text-align: right; border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; background: var(--page); font-weight: 600; color: var(--ink-2); }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }

/* Caminhos */
.paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); gap: 14px; margin-top: 20px; }
.path { display: flex; flex-direction: column; gap: 4px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--page); }
.path-label { font-size: 14px; color: var(--ink-2); }
.path strong { font-size: 20px; line-height: 1.3; font-weight: 700; letter-spacing: -.3px; color: var(--navy); font-variant-numeric: tabular-nums; }
.path-note { flex: 1; font-size: 13px; color: var(--ink-3); }
.path .btn { align-self: flex-start; min-height: 38px; margin-top: 12px; padding: 0 14px; font-size: 12px; white-space: nowrap; background: #fff; border-color: var(--blue); color: var(--blue-deep); }
.path .btn:hover { background: var(--blue); color: #fff; }

/* Composição */
.stack { display: flex; gap: 2px; height: 28px; margin-top: 20px; }
.stack i { display: block; min-width: 3px; border-radius: 3px; transition: flex-basis .4s ease; }
.stack-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 20px; margin: 16px 0 0; padding: 0; list-style: none; }
.stack-legend li { display: grid; grid-template-columns: 12px 1fr; column-gap: 10px; align-items: center; font-size: 14px; color: var(--ink-2); }
.stack-legend i { width: 12px; height: 12px; border-radius: 3px; }
.stack-legend b { grid-column: 2; font-size: 17px; color: var(--navy); font-variant-numeric: tabular-nums; }
.stack-legend small { margin-left: 6px; font-size: 13px; font-weight: 400; color: var(--ink-3); }

/* Cenários */
.stress { display: grid; gap: 14px; margin-top: 20px; }
.stress-row { display: grid; grid-template-columns: minmax(150px, 230px) minmax(0, 1fr) 56px; gap: 14px; align-items: center; }
.stress-name { font-size: 14px; line-height: 1.3; color: var(--ink); }
.stress-name small { display: block; font-size: 12px; color: var(--ink-3); }
.stress-track { position: relative; height: 14px; }
.stress-bar { height: 100%; border-radius: 0 4px 4px 0; background: var(--series-ret); transition: width .5s ease; }
.stress-row.base .stress-bar { background: var(--series-acc); }
.stress-ref { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 1px dashed var(--ink-2); }
.stress-value { font-size: 14px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; color: var(--navy); }
.stress-foot { font-size: 12px; color: var(--ink-3); }
.skeleton { height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--line), var(--page), var(--line)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }

/* Chamada final */
.cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; padding: 36px; border-radius: var(--radius); background: var(--gradient); color: #fff; }
.cta > div:first-child { flex: 1 1 320px; }
.cta h3 { font-family: var(--font-display); font-size: 24px; font-weight: 400; }
.cta p { margin-top: 8px; font-weight: 300; opacity: .92; max-width: 56ch; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.disclaimer { font-size: 12px; line-height: 1.6; color: var(--ink-3); }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 10; display: flex; gap: 16px; align-items: center; padding: 12px 20px; border-radius: 4px; background: var(--navy); color: #fff; font-size: 14px; transform: translateX(-50%); box-shadow: 0 8px 28px rgba(39, 61, 83, .35); animation: rise .25s ease both; }
.toast .link { color: #9fd4f3; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast { animation-name: toast-in; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1040px) {
  .results { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px 16px 48px; }
  .panel { position: sticky; top: 0; z-index: 5; max-height: none; overflow: visible; }
  .panel-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 18px; border: 0; background: none; font-family: var(--font-ui); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--blue-deep); cursor: pointer; }
  .chev { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; }
  .panel.open .chev { transform: rotate(-135deg); }
  .panel-body { display: none; max-height: 70vh; overflow-y: auto; padding: 4px 18px 18px; border-top: 1px solid var(--line); }
  .panel.open .panel-body { display: block; }
  .panel-title, .panel-title + .panel-hint { display: none; }
  .mini input { width: 110px; }
}
@media (max-width: 640px) {
  .brand { padding: 8px 16px; }
  .brand img { height: 50px; }
  .card { padding: 20px; }
  .verdict { flex-direction: column; align-items: flex-start; gap: 18px; padding: 22px 20px; }
  .ring { width: 116px; height: 116px; }
  .ring-label strong { font-size: 27px; }
  .kpis { grid-template-columns: 1fr; gap: 12px; }
  .kpi { flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between; column-gap: 12px; padding: 16px 20px; }
  .kpi-note { flex-basis: 100%; }
  .chart { height: 280px; }
  .stress-row { grid-template-columns: minmax(0, 1fr) 52px; row-gap: 6px; }
  .stress-name { grid-column: 1 / -1; }
  .cta { padding: 26px 20px; }
  .cta-actions, .cta-actions .btn { width: 100%; }
  .wizard-inner { padding: 28px 20px 56px; }
  .wizard-nav .btn-primary { flex: 1; margin-left: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
