/* RTI Hub — design system (claro/escuro). Para a glória de Deus. */
:root {
  --font: 'Syne', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --brand: #F65621;
  --brand-2: #F7970F;
  --blue: #1A8EBE;
  --green: #2E9E5B;
  --red: #D93636;
  --yellow: #C98A00;
  --purple: #7C5CE6;
  --bg: #F6F7FB;
  --bg-grad: radial-gradient(1200px 500px at 85% -10%, rgba(246,86,33,.10), transparent 60%);
  --surface: #FFFFFF;
  --surface-2: #F0F2F8;
  --border: #E1E5F0;
  --text: #161B33;
  --muted: #5B6486;
  --shadow: 0 1px 2px rgba(20,25,60,.06), 0 8px 24px rgba(20,25,60,.06);
  --radius: 14px;
  --tint-brand: rgba(246,86,33,.10);
  --tint-green: rgba(46,158,91,.12);
  --tint-red: rgba(217,54,54,.10);
  --tint-yellow: rgba(201,138,0,.12);
  --tint-blue: rgba(26,142,190,.12);
  --tint-purple: rgba(124,92,230,.12);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --green: #35C47A; --red: #FF6B6B; --yellow: #F5B93A; --purple: #A58BFF; --blue: #4FB6E6;
  --bg: #080B12;
  --bg-grad: radial-gradient(1200px 500px at 85% -10%, rgba(246,86,33,.16), transparent 60%);
  --surface: #10151D;
  --surface-2: #151B24;
  --border: #232B38;
  --text: #E8ECF4;
  --muted: #8C97B2;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --tint-brand: rgba(246,86,33,.16);
  --tint-green: rgba(53,196,122,.14);
  --tint-red: rgba(255,107,107,.13);
  --tint-yellow: rgba(245,185,58,.14);
  --tint-blue: rgba(79,182,230,.14);
  --tint-purple: rgba(165,139,255,.15);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --green: #35C47A; --red: #FF6B6B; --yellow: #F5B93A; --purple: #A58BFF; --blue: #4FB6E6;
    --bg: #080B12;
    --bg-grad: radial-gradient(1200px 500px at 85% -10%, rgba(246,86,33,.16), transparent 60%);
    --surface: #10151D; --surface-2: #151B24; --border: #232B38;
    --text: #E8ECF4; --muted: #8C97B2;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    --tint-brand: rgba(246,86,33,.16); --tint-green: rgba(53,196,122,.14); --tint-red: rgba(255,107,107,.13);
    --tint-yellow: rgba(245,185,58,.14); --tint-blue: rgba(79,182,230,.14); --tint-purple: rgba(165,139,255,.15);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.65;
  color: var(--text); background: var(--bg); background-image: var(--bg-grad); background-repeat: no-repeat;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
code, kbd { font-family: var(--mono); font-size: .86em; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; }
kbd { border-bottom-width: 2px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: grid; place-items: center; color: #fff; font-size: 15px; box-shadow: 0 4px 12px rgba(246,86,33,.35); }
.brand small { display: block; font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); line-height: 1; margin-top: 2px; }
.crumb { color: var(--muted); font-size: 13px; margin-left: 4px; }
.crumb b { color: var(--text); font-weight: 700; }
.spacer { flex: 1; }
.search { position: relative; width: min(340px, 36vw); }
.search input {
  width: 100%; padding: 9px 12px 9px 34px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px;
}
.search::before { content: "⌕"; position: absolute; left: 11px; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 17px; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; display: none;
}
.search-results.open { display: block; }
.search-results a { display: block; padding: 10px 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.sel { background: var(--tint-brand); text-decoration: none; }
.search-results small { display: block; color: var(--muted); font-size: 12px; }
.search-results .none { padding: 12px 14px; color: var(--muted); }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); width: 38px; height: 38px;
  border-radius: 10px; cursor: pointer; font-size: 16px; display: grid; place-items: center;
}
.icon-btn:hover { border-color: var(--brand); }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
}
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border: 0; box-shadow: 0 6px 18px rgba(246,86,33,.3); }
.btn-primary:hover { filter: brightness(1.05); }

/* ---------- layout ---------- */
.shell { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 20px 56px; }
.shell.with-toc { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 36px; align-items: start; }
.toc { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; font-size: 14px; }
.toc h4 { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.toc a { display: block; padding: 6px 10px; border-left: 2px solid var(--border); color: var(--muted); }
.toc a:hover { color: var(--text); text-decoration: none; border-color: var(--brand); }
.toc a.active { color: var(--brand); border-color: var(--brand); font-weight: 700; background: var(--tint-brand); }
.content > section { margin-bottom: 44px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--brand); margin-bottom: 8px; }
.page-title { font-size: clamp(26px, 4vw, 38px); font-weight: 800; margin-bottom: 10px; }
.lead { color: var(--muted); font-size: 17px; max-width: 70ch; margin-bottom: 26px; }
.content h2 { font-size: 24px; font-weight: 800; margin-top: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.content h3 { font-size: 17px; font-weight: 700; margin-top: 22px; }
.content p, .content li { max-width: 78ch; }
.content ul, .content ol { padding-left: 22px; }
.content li { margin-bottom: 4px; }

/* ---------- components ---------- */
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card h3, .card h4 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
a.card { display: block; color: var(--text); transition: transform .15s, border-color .15s; }
a.card:hover { transform: translateY(-2px); border-color: var(--brand); text-decoration: none; }
.card .ico { font-size: 24px; margin-bottom: 8px; }
.card .meta { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; background: var(--tint-brand); color: var(--brand); }
.badge.green { background: var(--tint-green); color: var(--green); }
.badge.red { background: var(--tint-red); color: var(--red); }
.badge.yellow { background: var(--tint-yellow); color: var(--yellow); }
.badge.blue { background: var(--tint-blue); color: var(--blue); }
.badge.purple { background: var(--tint-purple); color: var(--purple); }

.callout { border-radius: 12px; padding: 14px 16px; margin: 16px 0; border: 1px solid var(--border); border-left-width: 4px; background: var(--surface); }
.callout strong:first-child { display: block; margin-bottom: 4px; }
.callout.tip { border-left-color: var(--green); background: var(--tint-green); }
.callout.warn { border-left-color: var(--yellow); background: var(--tint-yellow); }
.callout.danger { border-left-color: var(--red); background: var(--tint-red); }
.callout.info { border-left-color: var(--blue); background: var(--tint-blue); }

.steps { list-style: none; padding: 0 !important; counter-reset: s; }
.steps > li { counter-increment: s; position: relative; padding: 14px 16px 14px 56px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; max-width: none; }
.steps > li::before {
  content: counter(s); position: absolute; left: 14px; top: 13px; width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center;
}
table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 8px; }
details summary { cursor: pointer; font-weight: 700; }
details[open] summary { margin-bottom: 8px; }
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin: 16px 0; }
.flow .node { flex: 1 1 150px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.flow .node b { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin-bottom: 4px; }
.flow .arrow { align-self: center; color: var(--muted); font-size: 20px; }
.area-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 26px; }
.pill { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 700; font-size: 13px; cursor: pointer; }
.pill.on, .pill:hover { border-color: var(--brand); background: var(--tint-brand); color: var(--brand); text-decoration: none; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--border); padding: 22px 20px 28px; text-align: center; color: var(--muted); font-size: 13px; }
.foot .verse { max-width: 70ch; margin: 0 auto 6px; font-style: italic; color: var(--text); }
.foot .verse small { display: block; font-style: normal; color: var(--muted); margin-top: 2px; }
.foot .sign { font-weight: 700; color: var(--brand); }

/* ---------- login ---------- */
.login-wrap { flex: 1; display: grid; place-items: center; padding: 28px 20px; }
.login-card { width: min(440px, 100%); }
.login-card .hero { text-align: center; margin-bottom: 22px; }
.login-card .hero .brand-mark { width: 54px; height: 54px; font-size: 26px; margin: 0 auto 14px; border-radius: 16px; }
label { display: block; font-weight: 700; font-size: 13px; margin: 14px 0 6px; }
select, input[type=password], input[type=text] {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit;
}
.err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 8px; }

@media (max-width: 860px) {
  .shell.with-toc { grid-template-columns: minmax(0, 1fr); }
  .content table, .section table { display: block; overflow-x: auto; }
  code { overflow-wrap: anywhere; }
  .toc { position: static; max-height: none; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
  .toc h4 { display: none; }
  .toc a { border-left: 0; border-bottom: 2px solid var(--border); white-space: nowrap; }
  .search { width: auto; flex: 1; min-width: 0; }
  .spacer { display: none; }
  .brand small { display: none; }
  .crumb { display: none; }
}
@media print { .topbar, .toc, .foot .sign, .pager { display: none; } body { background: #fff; color: #000; } }
