/* Megavale Docs · estilos publicos (sem build) */
:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --text: #2c3e50;
    --muted: #5a6a7b;
    --border: #e1e8f0;
    --blue: #4ea8f4;
    --blue-strong: #2f8fdf;
    --navy: #273444;
    --brand: #273544;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .12);
    --shadow-hover: 0 2px 4px rgba(15, 23, 42, .08), 0 18px 40px -16px rgba(15, 23, 42, .28);
    --notice-bg: #fffbeb; --notice-border: #fde68a; --notice-text: #92400e;
    color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #161e29; --surface: #1f2937; --text: #e6ecf3; --muted: #9aa8b8; --border: #2e3a4a;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-hover: 0 18px 40px -16px rgba(0,0,0,.7);
    --notice-bg: #2a2110; --notice-border: #5a4513; --notice-text: #fcd34d;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root[data-theme="auto"] {
        --bg: #161e29; --surface: #1f2937; --text: #e6ecf3; --muted: #9aa8b8; --border: #2e3a4a;
        --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-hover: 0 18px 40px -16px rgba(0,0,0,.7);
        --notice-bg: #2a2110; --notice-border: #5a4513; --notice-text: #fcd34d;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-size: .9rem; margin: 0; }

/* Topbar */
.topbar {
    position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 0 clamp(16px, 4vw, 40px); height: 64px;
    background: rgba(39, 52, 68, .96); backdrop-filter: blur(12px); color: #e2e8f0;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 26px; width: auto; display: block; }
.brand-tag {
    font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #fff;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.link-quiet { font-size: .9rem; color: #cbd5e1; padding: 8px 10px; border-radius: 8px; }
.link-quiet:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.icon-btn {
    display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .14); background: transparent; color: #e2e8f0;
}
.icon-btn:hover { background: rgba(255, 255, 255, .08); }

/* Hero */
.hero {
    position: relative; overflow: hidden; color: #fff; text-align: center;
    padding: clamp(48px, 9vw, 96px) 20px clamp(64px, 10vw, 112px);
    background:
        radial-gradient(60% 90% at 12% 0%, rgba(78, 168, 244, .42), transparent 60%),
        radial-gradient(50% 70% at 92% 25%, rgba(52, 152, 219, .30), transparent 60%),
        linear-gradient(180deg, #273444, #1d2735);
}
.hero::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
    background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px); background-size: 22px 22px;
    mask-image: linear-gradient(180deg, #000, transparent 85%);
}
.hero-inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; }
.eyebrow {
    display: inline-block; margin: 0 0 18px; padding: 6px 14px; border-radius: 999px; font-size: .8rem; font-weight: 600;
    letter-spacing: .04em; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16);
}
.hero h1 { margin: 0 0 16px; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.12; font-weight: 800; letter-spacing: -.025em; }
.lead { margin: 0 auto 32px; max-width: 600px; color: #cbd5e1; font-size: clamp(1rem, 2vw, 1.15rem); }

/* Conteudo */
.container { max-width: 1120px; margin: -40px auto 0; padding: 0 clamp(16px, 4vw, 32px) 64px; position: relative; z-index: 2; }
.tabs { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 32px; }
.tab {
    display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: .92rem;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
}
.tab span { font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.tab:hover { transform: translateY(-1px); border-color: var(--accent); }
.product { margin-top: 36px; scroll-margin-top: 88px; }
.product-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.product-head h2 { margin: 0; font-size: 1.5rem; letter-spacing: -.01em; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent); flex: none; }
.notice {
    display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; margin-bottom: 18px; border-radius: 12px; font-size: .92rem;
    background: var(--notice-bg); border: 1px solid var(--notice-border); color: var(--notice-text);
}
.notice svg { flex: none; margin-top: 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card {
    display: flex; flex-direction: column; justify-content: space-between; gap: 22px; padding: 18px 20px; min-height: 124px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    border-top: 3px solid var(--accent); transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--accent); }
.card-top, .card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ver { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.badge { font-size: .7rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; color: #fff; background: var(--accent); white-space: nowrap; }
.open { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--accent); }
.open svg { transition: transform .18s; }
.card:hover .open svg { transform: translateX(3px); }
.empty { text-align: center; color: var(--muted); padding: 24px; }
.footer {
    display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; max-width: 1120px; margin: 0 auto;
    padding: 24px clamp(16px, 4vw, 32px) 40px; border-top: 1px solid var(--border); color: var(--muted); font-size: .88rem;
}
.footer a:hover { color: var(--text); }

/* Visualizador */
.topbar-viewer .viewer-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.crumb-sep { color: #475569; }
.crumb { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb .dot { width: 10px; height: 10px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.select select {
    height: 38px; padding: 0 34px 0 12px; border-radius: 10px; font: inherit; font-size: .9rem; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    color: #fff; appearance: none;
}
.select option { color: #273444; }
.btn {
    display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; font-size: .9rem; font-weight: 600;
    background: var(--accent); color: #fff; transition: filter .15s;
}
.btn:hover { filter: brightness(1.12); }
.notice.notice-bar { margin: 0; border-radius: 0; border-width: 0 0 1px 0; padding: 10px clamp(16px, 4vw, 40px); }
body.viewer { background: #fff; }
#redoc { min-height: calc(100vh - 64px); }
.loading { padding: 80px 20px; text-align: center; color: var(--muted); }
body.viewer .menu-content { top: 64px !important; height: calc(100vh - 64px) !important; }

@media (max-width: 720px) {
    .hide-sm, .link-quiet, .crumb-sep, .crumb { display: none; }
    .topbar { height: 58px; }
    .container { margin-top: -28px; }
}


/* Botao de tema com menu */
.theme-menu { position: relative; }
.theme-menu .icon-btn { width: auto; padding: 0 12px; gap: 8px; display: inline-flex; align-items: center; font: inherit; font-size: .88rem; }
.theme-pop {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 180px; padding: 6px; z-index: 60;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 18px 40px -12px rgba(15, 23, 42, .35);
}
.theme-pop button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; cursor: pointer;
    background: transparent; color: inherit; font: inherit; font-size: .92rem; text-align: left;
}
.theme-pop button:hover { background: color-mix(in srgb, var(--blue) 12%, transparent); }
.theme-pop button .check { margin-left: auto; color: var(--blue-strong); visibility: hidden; }
.theme-pop button[aria-pressed="true"] .check { visibility: visible; }

/* Seletor de idioma: usa o menu do tema (.theme-menu / .theme-pop); aqui só o que difere */
.theme-menu.lang-menu .icon-btn { width: auto; padding: 0 12px; gap: 8px; display: inline-flex; align-items: center; justify-content: center; font: inherit; font-size: .8rem; font-weight: 700; letter-spacing: .04em; }
.lang-code { font-size: .75rem; font-weight: 700; letter-spacing: .04em; }
.theme-pop a {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; cursor: pointer;
    background: transparent; color: inherit; font: inherit; font-size: .92rem; text-align: left;
}
.theme-pop a:hover, .theme-pop a:focus-visible { background: color-mix(in srgb, var(--blue) 12%, transparent); outline: none; }
.theme-pop a .lang-code { min-width: 22px; opacity: .7; }
.theme-pop a .check { margin-left: auto; color: var(--blue-strong); visibility: hidden; }
.theme-pop a[aria-checked="true"] .check { visibility: visible; }
@media (max-width: 480px) {
    .topbar-actions { gap: 8px; }
}

/* Espacamentos */
.container { padding-top: 8px; }
.tabs { margin-bottom: 40px; }
.product { margin-top: 48px; }
.product:first-of-type { margin-top: 0; }
.product-head { margin-bottom: 20px; }
.notice { margin-bottom: 24px; }
.grid { gap: 20px; }
.footer { margin-top: 24px; padding-top: 28px; padding-bottom: 48px; }
.hero-inner, .footer, .container { width: 100%; }
@media (max-width: 720px) {
    .grid { grid-template-columns: 1fr 1fr; gap: 14px; }
    .product { margin-top: 36px; }
}
@media (max-width: 480px) {
    .grid { grid-template-columns: 1fr; }
}

/* O texto so para leitores de ecra nao pode escapar do seu contentor */
.select { position: relative; display: inline-block; }

/* Correcoes: sem separadores o conteudo nao pode ficar a cavalo do hero; titulo equilibrado */
.container { margin-top: 0; padding-top: 48px; }
.tabs { margin-top: -80px; margin-bottom: 40px; position: relative; z-index: 2; }
.hero { padding-bottom: clamp(88px, 12vw, 136px); }
.hero-inner { max-width: 860px; }
.hero h1 { text-wrap: balance; }
.lead { text-wrap: pretty; }
@media (max-width: 720px) {
    .container { padding-top: 32px; }
    .tabs { margin-top: -64px; }
}

/* Visualizador em ecras pequenos: o seletor nao pode sobrepor o logotipo */
.topbar-viewer .viewer-left { flex: none; }
.topbar-viewer .topbar-actions { min-width: 0; }
.select select { max-width: 100%; text-overflow: ellipsis; }
@media (max-width: 720px) {
    .topbar-viewer .brand-tag { display: none; }
    .topbar-viewer .select select { max-width: 52vw; }
}

/* Botao de tema so com icone (mostra o modo ativo) */
.theme-menu .icon-btn { width: 38px; height: 38px; padding: 0; gap: 0; justify-content: center; }
.theme-menu .ic { display: none; }
html[data-theme="light"] .theme-menu .ic-light,
html[data-theme="dark"] .theme-menu .ic-dark,
html[data-theme="auto"] .theme-menu .ic-auto { display: block; }

/* O scroll suave do html estraga a navegacao interna do Redoc */
html:has(body.viewer) { scroll-behavior: auto; }

/* Arquivo de versoes */
.archive { margin-top: 36px; padding-top: 24px; border-top: 1px dashed var(--border); }
.archive-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 18px; }
.archive-head h3 { margin: 0; font-size: 1.05rem; color: var(--muted); letter-spacing: -.005em; }
.archive-notice { font-size: .85rem; font-weight: 600; color: #e0524d; }
.card-archived { border-top-color: var(--border); background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
.card-archived .ver { color: var(--muted); }
.card-archived .open { color: var(--muted); }
.card-archived:hover { border-color: var(--accent); }
.badge-muted { background: color-mix(in srgb, var(--muted) 22%, transparent); color: var(--muted); }

/* Paginas de erro */
.error-page { max-width: 560px; margin: 0 auto; padding: clamp(64px, 14vh, 140px) 24px; text-align: center; }
.error-code {
    margin: 0; font-size: clamp(5rem, 18vw, 8rem); font-weight: 800; line-height: 1; letter-spacing: -.04em;
    background: linear-gradient(135deg, var(--blue), var(--navy)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
:root[data-theme="dark"] .error-code { background: linear-gradient(135deg, var(--blue), #cbd5e1); -webkit-background-clip: text; background-clip: text; }
.error-page h1 { margin: 12px 0 8px; font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -.015em; }
.error-actions { margin-top: 28px; display: flex; justify-content: center; }
.error-actions .btn { background: var(--blue-strong); }

/* ---- Contraste do texto sobre as cores da marca ---- */
.badge, .btn { background: color-mix(in srgb, var(--accent, var(--blue)) 78%, #000); color: #fff; }
.error-actions .btn { background: #1f6fb5; }
.btn-ghost { background: rgba(255, 255, 255, .1); }
.open { color: color-mix(in srgb, var(--accent) 80%, var(--text)); }
.badge-muted { color: var(--text); background: color-mix(in srgb, var(--muted) 22%, transparent); }
.tab span { color: color-mix(in srgb, var(--accent) 75%, var(--text)); }

/* Rodape sempre em baixo: com pouco conteudo cola ao fundo do ecra; com muito, vem depois do conteudo */
body:not(.viewer) { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body:not(.viewer) > .footer { margin-top: auto; }
.nf, .error-page, .container { width: 100%; }
/* o rodape separa-se do conteudo com um espaco minimo */
.footer { margin-top: 48px; }
body:not(.viewer) > .footer { margin-top: auto; }
body.viewer .footer { margin-top: 0; background: var(--bg); }
