:root {
  color-scheme: light;
  --paper: #f6f7f4;
  --ink: #192f32;
  --muted: #536665;
  --line: #d6dfd9;
  --green: #0b6859;
  font: 100%/1.5 "Inter", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
body, h1, h2, h3, p, dl, dd { margin: 0; }
.container { width: min(1080px, calc(100% - 3rem)); margin-inline: auto; }
.masthead { background: white; border-bottom: 1px solid var(--line); }
.bar, .brand, .page-head, .panel-head, .switch, .plot-foot, .chart-tools, .interval-switch { display: flex; align-items: center; }
.bar, .page-head, .panel-head { justify-content: space-between; gap: 1rem; }
.bar { min-height: 72px; }
.brand { gap: .62rem; font-weight: 750; font-size: 1.35rem; letter-spacing: -.06em; }
.mark { display: inline-block; height: 1.2rem; width: 1.8rem; transform: skew(-18deg); background: repeating-linear-gradient(90deg, var(--green) 0 6px, transparent 6px 10px); }
.meta, .plot-foot, dt { color: var(--muted); font-size: .86rem; }
button, input { font: inherit; }
button, .switch a { cursor: pointer; }
:focus-visible { outline: 3px solid #007b68; outline-offset: 3px; }
.quiet, .switch a { min-height: 44px; padding: .6rem .9rem; color: var(--ink); border-radius: .4rem; }
.switch a { display: inline-flex; align-items: center; }
.quiet { border: 1px solid var(--line); background: white; min-height: 44px; }
.quiet:hover, .switch a:hover { background: #e5efea; }
.eyebrow { color: var(--green); font: 650 .72rem/1.5 "IBM Plex Mono", Consolas, monospace; text-transform: uppercase; letter-spacing: .13em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); line-height: 1.08; letter-spacing: -.065em; }
h2, h3 { line-height: 1.25; letter-spacing: -.035em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.12rem; }
.accent { color: #21997b; }
.page-head { margin: 3.2rem 0 2rem; align-items: end; flex-wrap: wrap; }
.page-head h1 { margin-top: .5rem; }
.switch { gap: .2rem; padding: .22rem; border: 1px solid var(--line); border-radius: .6rem; background: #e9eeea; }
.switch a { font-size: .9rem; font-weight: 600; text-decoration: none; }
.switch [aria-current] { background: white; color: var(--green); box-shadow: 0 1px 4px #192f321a; }
.panel, .login-layout, .notice { background: white; border: 1px solid var(--line); border-radius: .85rem; }
.panel-head, .operations { padding: 1.45rem 1.6rem; }
.panel-head h2 { margin-top: .2rem; }
.tag { color: #52605d; background: #e9eeea; border-radius: 2rem; padding: .32rem .75rem; font-size: .8rem; white-space: nowrap; }
.tag-ok { color: #07594c; background: #dcefe7; }
.tag-warning { color: #7a4c16; background: #f7e8cc; }
.chart-tools { min-height: 56px; justify-content: space-between; gap: 1rem; padding: .6rem 1.6rem; border-top: 1px solid var(--line); }
.interval-switch { gap: .25rem; }
.interval-switch button { min-height: 44px; padding: .45rem .8rem; border: 1px solid transparent; border-radius: .4rem; background: transparent; color: var(--ink); font-weight: 600; }
.interval-switch button:hover { background: #eef3ef; }
.interval-switch button[aria-pressed="true"] { border-color: #bdcec6; background: white; color: var(--green); box-shadow: 0 1px 4px #192f3217; }
.chart-hint { color: var(--muted); font-size: .8rem; }
.history-status { color: var(--muted); font: 600 .72rem/1.4 "IBM Plex Mono", Consolas, monospace; }
.risk-legend { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .76rem; }
.risk-legend i { width: .65rem; height: .65rem; margin-left: .25rem; border-radius: 2px; }
.risk-legend .low { background: #18856f55; }
.risk-legend .moderate { background: #cd972f55; }
.risk-legend .high { background: #c45a5255; }
.chart-shell { position: relative; min-height: clamp(360px, 53vh, 560px); border-block: 1px solid var(--line); background: #fbfcfa; overflow: hidden; }
#price-chart { position: absolute; inset: 0; }
#price-chart:focus-visible { outline-offset: -4px; }
.risk-overlay { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }
.chart-message { position: absolute; z-index: 3; inset: 0; display: grid; place-items: center; padding: 1rem; color: var(--muted); background: #fbfcfa; text-align: center; }
.chart-message[hidden] { display: none; }
.chart-tooltip { position: absolute; z-index: 4; top: .75rem; left: .75rem; display: grid; grid-template-columns: repeat(4, auto); gap: .35rem 1rem; max-width: calc(100% - 1.5rem); padding: .65rem .75rem; border: 1px solid #c8d5cf; border-radius: .5rem; background: #fffffff2; box-shadow: 0 3px 12px #192f321a; pointer-events: none; }
.chart-tooltip[hidden] { display: none; }
.chart-tooltip div { min-width: 5.5rem; }
.chart-tooltip dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }
.chart-tooltip dd { margin-top: .05rem; font: 600 .78rem/1.3 "IBM Plex Mono", Consolas, monospace; }
.plot-empty { min-height: clamp(230px, 32vh, 360px); padding: 1.4rem; display: grid; place-items: center; text-align: center; border-block: 1px solid var(--line); background: radial-gradient(#cbd9d1 .75px, transparent .9px) 0 0 / 14px 14px, #f8faf7; }
.plot-empty div { padding: 1rem; background: #f8faf7; }
.plot-empty p, .notice p { margin-top: .4rem; color: var(--muted); }
.plot-foot { flex-wrap: wrap; gap: .45rem 2rem; padding: .9rem 1.6rem; }
.plot-foot b { margin-left: .3rem; color: var(--ink); font-weight: 600; }
.plot-foot a { margin-left: auto; color: var(--green); }
.operations { margin: 1.15rem 0 3rem; }
.operations dl { margin-top: 1rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; }
.operations small { display: block; margin-top: .35rem; color: var(--muted); line-height: 1.35; }
.risk-detail { margin-top: 1.15rem; }
.risk-detail > dl { padding: 1rem 1.6rem 1.35rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.risk-detail > dl div { padding-left: .7rem; border-left: 3px solid var(--line); }
.risk-detail dd { margin-top: .2rem; font: 600 .92rem/1.3 "IBM Plex Mono", Consolas, monospace; }
.risk-detail small, .risk-detail > p { color: var(--muted); }
.risk-detail > p { padding: 0 1.6rem 1.35rem; font-size: .82rem; }
.risk-score { align-self: center; padding: .5rem .7rem; border-radius: .45rem; font-size: .85rem; }
.risk-baixo { color: #116b59; background: #dcefe9; }
.risk-moderado { color: #765215; background: #f5ead2; }
.risk-alto { color: #8a342d; background: #f6dfdc; }
.historical-risk { margin-top: 1.15rem; }
.historical-time { padding: .8rem 1.6rem 0; color: var(--muted); font: 600 .78rem/1.4 "IBM Plex Mono", Consolas, monospace; }
.historical-factors { padding: 1rem 1.6rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.historical-factors div { padding-left: .7rem; border-left: 3px solid var(--line); }
.historical-factors dd { font: 650 .92rem/1.3 "IBM Plex Mono", Consolas, monospace; }
.historical-factors small { display: block; margin-top: .2rem; color: var(--muted); }
.historical-factors small span { display: block; margin-top: .2rem; line-height: 1.35; }
.historical-note { padding: 0 1.6rem 1.35rem; color: var(--muted); font-size: .82rem; }
.validation { margin-top: 1.15rem; overflow: hidden; }
.validation-state { padding: .45rem .65rem; border-radius: .4rem; color: #765215; background: #f5ead2; font-size: .78rem; font-weight: 700; }
.validation-summary { padding: 1rem 1.6rem; }
.validation-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.validation-metrics div { padding-left: .7rem; border-left: 3px solid var(--line); }
.validation-metrics dd { font: 650 .95rem/1.3 "IBM Plex Mono", Consolas, monospace; }
.validation-note { margin-top: 1rem; padding: .8rem 1rem; border-radius: .5rem; background: #f5f7f4; }
.validation-note p { margin-top: .25rem; color: var(--muted); font-size: .82rem; }
.equity-section { padding: .25rem 1.6rem 1.2rem; }
.equity-head, .trade-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.equity-head p, .trade-head p { margin-top: .2rem; color: var(--muted); font-size: .82rem; }
.equity-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .45rem; color: var(--muted); font-size: .76rem; }
.equity-legend i { width: 1.2rem; height: 3px; margin-left: .35rem; border-radius: 2px; }
.equity-legend .strategy { background: #0b6859; }
.equity-legend .hold { background: #1f4650; }
.equity-legend .ema { background: #b27918; }
.equity-chart-shell { position: relative; height: 300px; margin-top: .8rem; border: 1px solid var(--line); border-radius: .55rem; background: #fbfcfa; overflow: hidden; }
#backtest-chart { position: absolute; inset: 0; }
.equity-tooltip { position: absolute; z-index: 3; top: .65rem; left: .65rem; padding: .5rem .65rem; border: 1px solid #c8d5cf; border-radius: .4rem; background: #fffffff2; pointer-events: none; font-size: .76rem; }
.equity-tooltip[hidden] { display: none; }
.equity-tooltip > span { display: grid; margin-top: .15rem; }
.equity-tooltip > span span::before { content: ""; display: inline-block; width: .55rem; height: .55rem; margin-right: .35rem; border-radius: 50%; background: var(--series-color); }
.validation-table-wrap { overflow-x: auto; border-block: 1px solid var(--line); }
.validation-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.validation-table caption { padding: .75rem 1.6rem; text-align: left; color: var(--muted); font-weight: 650; }
.validation-table th, .validation-table td { padding: .65rem 1rem; text-align: right; border-top: 1px solid #e7ece8; white-space: nowrap; }
.validation-table th:first-child, .validation-table td:first-child, .validation-table th:nth-child(2), .validation-table td:nth-child(2) { text-align: left; }
.trade-head { padding: 1.2rem 1.6rem .8rem; }
.export-link { display: inline-flex; align-items: center; min-height: 44px; padding: .55rem .8rem; border: 1px solid #a8bdb4; border-radius: .4rem; color: var(--green); font-size: .82rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.export-link:hover { background: #eaf2ed; }
.trades-table th:nth-child(n), .trades-table td:nth-child(n) { text-align: left; }
.trades-table td:last-child, .trades-table th:last-child { text-align: right; }
.positive { color: #0b6859; }
.negative { color: #a33d35; }
.diagnostics-head { padding: 1.2rem 1.6rem .8rem; }
.diagnostics-head h3 { margin-top: .15rem; }
.diagnostics-head p, .diagnostics-method { color: var(--muted); font-size: .82rem; }
.diagnostics-head p { max-width: 760px; margin-top: .35rem; }
.diagnostics-table th:first-child, .diagnostics-table td:first-child { text-align: left; }
.diagnostics-method { padding: .75rem 1.6rem; background: #f5f7f4; }
.validation-warning { padding: 1rem 1.6rem; color: #6d4d19; background: #fff9ed; font-size: .82rem; }
.research-candidate { margin-top: 1.15rem; overflow: hidden; }
.research-summary { padding: 1rem 1.6rem 1.2rem; }
.research-summary > p:first-child { margin-bottom: 1rem; color: var(--muted); font-size: .86rem; }
.research-delta { margin-top: 1rem; padding: .75rem 1rem; border-radius: .5rem; background: #f5f7f4; font-size: .84rem; font-weight: 650; }
.research-weights { max-width: 680px; }
.research-weights th:first-child, .research-weights td:first-child { text-align: left; }
.prospective { margin-top: 1.15rem; overflow: hidden; }
.prospective-summary { padding: 1rem 1.6rem 1.2rem; }
.prospective-summary > p:first-child { margin-bottom: 1rem; color: var(--muted); font-size: .86rem; }
.prospective-empty { margin-top: 1rem; padding: .75rem 1rem; border-radius: .5rem; background: #eef4f0; color: var(--green); font-weight: 650; }
dd { margin-top: .25rem; font-weight: 600; }
time { font-variant-numeric: tabular-nums; }
.login-layout { display: grid; grid-template-columns: 1fr 1fr; margin: clamp(2rem, 9vh, 6rem) auto; max-width: 910px; overflow: hidden; }
.identity { position: relative; isolation: isolate; overflow: hidden; min-height: 380px; background: #123c3b; color: #f8fff9; padding: 2.6rem; }
.identity .eyebrow { color: #a6d8c6; }
.identity p { margin-top: 1rem; font-size: clamp(3.2rem, 6vw, 5rem); font-weight: 680; line-height: .98; letter-spacing: -.07em; }
.identity .accent { color: #75cfad; }
.orbit { position: absolute; z-index: -1; width: 145%; aspect-ratio: 1; right: -82%; bottom: -58%; border-radius: 50%; background: repeating-radial-gradient(circle closest-side, transparent 0 17%, #74b8a34d 17.2% 17.5%, transparent 17.7% 19%); }
.login-form { align-self: center; padding: clamp(1.6rem, 4vw, 3rem); }
.login-form h1 { font-size: 2rem; margin-bottom: 1.6rem; }
.login-form label { display: block; font-size: .9rem; font-weight: 600; margin: .9rem 0 .3rem; }
.login-form input:not([type=hidden]) { width: 100%; min-height: 46px; padding: .6rem; border: 1px solid #9aaea5; border-radius: .4rem; background: white; color: var(--ink); }
.primary { display: flex; justify-content: space-between; width: 100%; padding: .75rem 1rem; margin-top: 1.5rem; border: 0; border-radius: .4rem; background: var(--green); color: white; font-weight: 600; }
.primary:hover { background: #0c5248; }
.error { padding: .65rem; color: #882d2b; background: #fff1ec; border-radius: .4rem; }
.notice { margin: 3rem auto; max-width: 660px; padding: 2rem; }
.notice h1 { font-size: 2rem; }
.notice a { display: inline-block; margin-top: 1rem; color: var(--green); }
@media (max-width: 640px) {
  .container { width: calc(100% - 2rem); }
  .bar { min-height: 62px; }
  .page-head { margin: 2rem 0 1.2rem; }
  .panel-head, .operations, .plot-foot { padding: 1rem; }
  .operations dl, .risk-detail > dl, .historical-factors, .login-layout { grid-template-columns: 1fr; }
  .validation-metrics { grid-template-columns: repeat(2, 1fr); }
  .equity-section { padding-inline: 1rem; }
  .equity-head, .trade-head { align-items: flex-start; flex-direction: column; }
  .equity-chart-shell { height: 260px; }
  .trade-head { padding-inline: 1rem; }
  .diagnostics-head, .diagnostics-method { padding-inline: 1rem; }
  .research-summary { padding-inline: 1rem; }
  .prospective-summary { padding-inline: 1rem; }
  .chart-tools { align-items: flex-start; flex-direction: column; padding: .65rem 1rem; }
  .chart-hint { display: none; }
  .chart-shell { min-height: 420px; }
  .chart-tooltip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-tooltip div { min-width: 0; }
  .plot-foot a { margin-left: 0; width: 100%; }
  .login-layout { margin: 1.5rem auto; }
  .identity { min-height: auto; padding: 1.3rem 1.6rem; }
  .identity p { margin-top: .45rem; font-size: 2.3rem; }
  .identity br { display: none; }
  .orbit { width: 85%; bottom: -145%; right: -25%; }
}
