/* Treinamento Studio Legado — folha única, sem build. */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --text: #16202b;
  --muted: #56657a;
  --line: #dbe2ea;
  --primary: #1367d8;
  --primary-soft: #e6effd;
  --accent: #41a0dc;
  --green: #1d8a4e;
  --green-soft: #e3f4ea;
  --yellow: #a26b00;
  --yellow-soft: #fbf1db;
  --red: #c23a3a;
  --red-soft: #fbe6e6;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 4px 16px rgb(16 24 40 / 5%);
  --radius: 12px;
  --sidebar: 290px;
  --font-sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0d1218;
    --surface: #141b24;
    --surface-2: #1b2430;
    --text: #e6ebf1;
    --muted: #94a3b6;
    --line: #263241;
    --primary: #4d94f5;
    --primary-soft: #132640;
    --green: #4cc486;
    --green-soft: #12301f;
    --yellow: #e2b04a;
    --yellow-soft: #33280f;
    --red: #ef7373;
    --red-soft: #3a1717;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #0d1218;
  --surface: #141b24;
  --surface-2: #1b2430;
  --text: #e6ebf1;
  --muted: #94a3b6;
  --line: #263241;
  --primary: #4d94f5;
  --primary-soft: #132640;
  --green: #4cc486;
  --green-soft: #12301f;
  --yellow: #e2b04a;
  --yellow-soft: #33280f;
  --red: #ef7373;
  --red-soft: #3a1717;
  --shadow: none;
  color-scheme: dark;
}

/* ---------- idioma: só o bloco do idioma ativo aparece ---------- */
html[data-lang='pt'] [lang='en']:not(html),
html[data-lang='en'] [lang='pt']:not(html) {
  display: none !important;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-underline-offset: 2px; }
code, kbd { font-family: var(--font-mono); font-size: 0.88em; }
code { background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 5px; }
pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.55;
}
pre code { background: none; padding: 0; }

/* ---------- topo ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand .logo { height: 26px; width: auto; color: var(--text); flex: none; }
.brand strong { font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.brand span { color: var(--muted); font-size: 13px; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  background: var(--surface-2);
}
.seg button, .icon-btn, .menu-btn {
  font: 600 13px var(--font-sans);
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
}
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.icon-btn, .menu-btn { border: 1px solid var(--line); background: var(--surface); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }

.sidebar {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 18px 14px 40px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.sidebar h4 {
  margin: 18px 10px 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidebar h4:first-child { margin-top: 0; }
.sidebar a {
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.35;
}
.sidebar a .n { color: var(--muted); font-family: var(--font-mono); font-size: 12px; min-width: 20px; padding-top: 1px; }
.sidebar a:hover { background: var(--surface-2); }
.sidebar a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sidebar a.active .n { color: var(--primary); }
.track-ops { border-left: 3px solid var(--primary); padding-left: 7px; }
.track-sales { border-left: 3px solid var(--green); padding-left: 7px; }

main { padding: 36px 48px 80px; min-width: 0; }
.page { max-width: 880px; margin: 0 auto; scroll-margin-top: 80px; }
.page h2[id] { scroll-margin-top: 80px; }
.js .page { display: none; }
.js .page.current { display: block; }
.no-js-note { display: none; }

.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}
.eyebrow.sales { color: var(--green); }

h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; text-wrap: balance; }
h2 { font-size: 24px; line-height: 1.25; letter-spacing: -0.01em; margin: 44px 0 10px; text-wrap: balance; }
h3 { font-size: 18px; margin: 28px 0 8px; }
.lead { font-size: 18px; color: var(--muted); margin: 0 0 24px; }
p, li { text-wrap: pretty; }

/* ---------- componentes ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 18px 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; font-size: 16px; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }
a.card { text-decoration: none; color: inherit; transition: border-color 0.15s; }
a.card:hover { border-color: var(--primary); }
.card .tag { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--primary); }
.card.sales .tag { color: var(--green); }

.callout {
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  background: var(--surface);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 20px 0;
}
.callout.warn { border-left-color: var(--yellow); background: var(--yellow-soft); }
.callout.danger { border-left-color: var(--red); background: var(--red-soft); }
.callout.ok { border-left-color: var(--green); background: var(--green-soft); }
.callout > strong:first-child { display: block; margin-bottom: 2px; }
.callout p { margin: 4px 0; }

.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-size: 12.5px; letter-spacing: 0.03em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

figure { margin: 22px 0; }
figure img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  cursor: zoom-in;
  background: var(--surface-2);
}
figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }

.pill { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 1px 9px; border-radius: 999px; white-space: nowrap; }
.pill.g { background: var(--green-soft); color: var(--green); }
.pill.y { background: var(--yellow-soft); color: var(--yellow); }
.pill.r { background: var(--red-soft); color: var(--red); }
.pill.b { background: var(--primary-soft); color: var(--primary); }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 18px 0; }
.steps > li { position: relative; padding: 0 0 18px 46px; }
.steps > li::before {
  counter-increment: s;
  content: counter(s);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 14px var(--font-mono);
  background: var(--primary-soft);
  color: var(--primary);
}
.steps > li::after { content: ''; position: absolute; left: 14.5px; top: 34px; bottom: 4px; width: 1px; background: var(--line); }
.steps > li:last-child::after { display: none; }
.steps > li > strong:first-child { display: block; }

/* faixas do pipeline */
.lanes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 20px 0; }
.lane { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 13px; }
.lane b { display: block; font-size: 13.5px; margin-bottom: 4px; }
.lane span { color: var(--muted); }
.lane .i { font: 700 11px var(--font-mono); color: var(--primary); }

/* escada */
.ladder { display: grid; gap: 8px; margin: 18px 0; }
.rung { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.rung .bar { height: 8px; border-radius: 99px; background: var(--primary); }
.rung b { font-size: 15px; }
.rung small { display: block; color: var(--muted); font-size: 13px; }

/* cenários */
.scenario { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin: 16px 0; box-shadow: var(--shadow); }
.scenario h3 { margin-top: 0; }
.scenario dl { display: grid; grid-template-columns: 170px 1fr; gap: 6px 16px; margin: 12px 0 0; font-size: 14.5px; }
.scenario dt { color: var(--muted); font-weight: 600; }
.scenario dd { margin: 0; }
.scenario blockquote { margin: 12px 0 0; }

blockquote {
  margin: 16px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--green);
  background: var(--green-soft);
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; }
details summary { cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: '+'; display: inline-block; width: 18px; color: var(--primary); font-family: var(--font-mono); }
details[open] summary::before { content: '−'; }
details > div { padding: 0 16px 14px 34px; color: var(--text); }
details > div p:first-child { margin-top: 0; }

.checklist { list-style: none; padding: 0; }
.checklist li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.checklist input { margin-top: 5px; accent-color: var(--primary); width: 16px; height: 16px; flex: none; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.do-dont .card:first-child { border-top: 3px solid var(--green); }
.do-dont .card:last-child { border-top: 3px solid var(--red); }
.do-dont ul { margin: 6px 0 0; padding-left: 18px; font-size: 14.5px; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); }
.pager a { display: block; max-width: 48%; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-decoration: none; color: var(--text); font-weight: 600; font-size: 15px; }
.pager a small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.pager a.next { margin-left: auto; text-align: right; }
.pager a:hover { border-color: var(--primary); }

.lightbox { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / 82%); display: none; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox.open { display: grid; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

.foot { color: var(--muted); font-size: 13px; margin-top: 40px; }

/* ---------- responsivo ---------- */
@media (max-width: 1000px) {
  .lanes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .menu-btn { display: inline-block; }
  .brand span { display: none; }
  .sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    width: min(320px, 88vw);
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s;
    box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: none; }
  main { padding: 24px 16px 60px; }
  .two { grid-template-columns: 1fr; }
  .lanes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rung { grid-template-columns: 1fr; gap: 6px; }
  .scenario dl { grid-template-columns: 1fr; gap: 2px; }
  .scenario dd { margin-bottom: 8px; }
  .pager a { max-width: 100%; }
  .pager { flex-direction: column; }
}

@media print {
  .topbar, .sidebar, .pager { display: none !important; }
  .layout { display: block; }
  .js .page { display: block; page-break-after: always; }
}

/* galeria de telas */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 16px 0 8px; }
.gallery .shot { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.gallery .shot img { border-radius: 8px; box-shadow: none; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; }
.gallery .shot figcaption { font-size: 13.5px; color: var(--muted); }
.gallery .shot figcaption strong { display: block; color: var(--text); font-size: 14.5px; }
.gallery .shot figcaption a { white-space: nowrap; }

@media (max-width: 440px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .brand strong { display: none; }
}

/* submenu: uma entrada por aba de leitura */
.sidebar .sub { margin: 2px 0 6px 18px; padding-left: 8px; border-left: 1px dashed var(--line); }
.sidebar .sub a { font-size: 13px; padding: 4px 8px; }
.sidebar .sub a .n { font-size: 11px; min-width: 30px; }
.sidebar .sub[hidden] { display: none; }
.sidebar .has-sub { position: relative; }
.sidebar .sub-toggle {
  position: absolute; right: 4px; top: 4px;
  border: 0; background: transparent; color: var(--muted);
  font: 600 12px var(--font-mono); cursor: pointer; padding: 3px 6px; border-radius: 6px;
}
.sidebar .sub-toggle:hover { background: var(--surface-2); }

/* página de aba */
.tab-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 18px 0; }
.tab-meta div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.tab-meta b { display: block; font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.purpose { font-size: 19px; line-height: 1.5; border-left: 4px solid var(--primary); padding: 4px 0 4px 16px; margin: 18px 0; }
.tab-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin: 18px 0; }
.tab-index a.card h3 { margin-bottom: 4px; }
.tab-index a.card small { color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; }

/* trilhas novas na barra lateral */
:root { --purple: #7c4ddb; --purple-soft: #efe9fc; }
:root[data-theme='dark'] { --purple: #a98bf0; --purple-soft: #261c3d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { --purple: #a98bf0; --purple-soft: #261c3d; } }
.track-flow { border-left: 3px solid var(--accent); padding-left: 7px; }
.track-eng { border-left: 3px solid var(--purple); padding-left: 7px; }
.card.eng .tag { color: var(--purple); }

/* faixa do motor (F1) */
.pipeline { display: flex; flex-wrap: nowrap; align-items: stretch; gap: 4px; margin: 20px 0; overflow-x: auto; padding-bottom: 4px; }
.pipeline .pbox { flex: 1 0 92px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.pipeline .pbox b { display: block; font-size: 13.5px; }
.pipeline .pbox span { font-size: 12.5px; color: var(--muted); }
.pipeline .arrow { align-self: center; color: var(--muted); font-weight: 700; }

/* fichas de agente (F7–F10) */
.agents { display: grid; gap: 12px; margin: 16px 0; }
.agent { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 14px 18px; scroll-margin-top: 80px; }
.agent-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.agent-head b { font-size: 16px; }
.agent-head code { font-size: 12.5px; }
.agent > p { margin: 6px 0 8px; font-size: 15px; }
.agent dl { display: grid; grid-template-columns: 110px 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.agent dt { color: var(--muted); font-weight: 600; }
.agent dd { margin: 0; overflow-wrap: anywhere; }

/* casos de uso */
.scenario dd ul { margin: 0; padding-left: 18px; }
.scenario dd.limit { color: var(--yellow); }
.facts li { margin-bottom: 6px; }
.facts .src { color: var(--muted); font-size: 13px; }

@media (max-width: 860px) {
  .pipeline { flex-wrap: wrap; }
  .pipeline .pbox { flex: 1 1 40%; }
  .pipeline .arrow { display: none; }
  .agent dl { grid-template-columns: 1fr; gap: 0; }
  .agent dd { margin-bottom: 6px; }
}
