/* ==========================================================================
   Plataforma do Futuro Franqueado — design system

   Tema escuro sofisticado, texto claro e acentos em azul-claro.
   NÃO reintroduzir paleta dourada ou laranja: a decisão de contraste e
   legibilidade foi tomada e validada.

   Todas as cores de texto foram conferidas contra o fundo em que aparecem e
   ficam acima de 7:1 para corpo de texto e 4.5:1 para texto secundário.
   ========================================================================== */

:root {
    /* Superfícies */
    --bg: #070c16;
    --bg-elevated: #0b1220;
    --surface: #0e1626;
    --surface-2: #141f33;
    --surface-3: #1b2942;

    /* Bordas e divisores */
    --border: #243449;
    --border-strong: #33486a;

    /* Texto */
    --text: #e9eef7;
    --text-secondary: #b9c6d9;
    --text-muted: #8d9db6;
    --text-inverse: #04121f;

    /* Acentos */
    --accent: #7dd3fc;
    --accent-strong: #38bdf8;
    --accent-dim: rgba(125, 211, 252, 0.14);
    --accent-line: rgba(125, 211, 252, 0.32);

    /* Estados */
    --success: #6ee7b7;
    --success-dim: rgba(110, 231, 183, 0.14);
    --danger: #fda4af;
    --danger-dim: rgba(253, 164, 175, 0.14);

    /* Formas */
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.8);

    /* Tipografia */
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

    /*
     * Movimento
     *
     * Uma curva só para tudo. Saída desacelerada, sem overshoot: o produto é
     * sóbrio e um "quique" contradiria o tom. As durações são três, e mais que
     * isso vira ruído.
     */
    --ease: cubic-bezier(0.2, 0, 0, 1);
    --dur-fast: 140ms;   /* realimentação de controle */
    --dur: 220ms;        /* troca de estado */
    --dur-slow: 520ms;   /* revelação de conteúdo e preenchimento de medidor */

    /* Espaçamento de página */
    --container: 1140px;
    --gutter: clamp(1rem, 4vw, 2.5rem);
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4 {
    margin: 0 0 0.5em;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 650;
}

h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

a:hover {
    color: var(--accent-strong);
    border-bottom-color: var(--accent-line);
}

img, svg { max-width: 100%; height: auto; display: block; }

ul, ol { margin: 0 0 1rem; padding-left: 1.25rem; }
li { margin-bottom: 0.4rem; }

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--surface-2);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
}

/* Foco de teclado sempre visível. */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Remove o anel apenas para o mouse, preservando o do teclado. */
:focus:not(:focus-visible) { outline: none; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 200;
    background: var(--accent);
    color: var(--text-inverse);
    padding: 0.75rem 1.25rem;
    border-radius: 0 0 var(--radius) 0;
    font-weight: 600;
}

.skip-link:focus {
    left: 0;
}

.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;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding-inline: var(--gutter);
}

.container--narrow { max-width: 780px; }
.container--wide { max-width: 1360px; }

main { flex: 1 0 auto; }

section { padding-block: clamp(3rem, 7vw, 5.5rem); }
section.section--tight { padding-block: clamp(2rem, 4vw, 3rem); }

.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 2rem; }

.grid {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 640px) {
    .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
    .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 0.9rem; }
.text-xs { font-size: 0.8rem; }

.lead {
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 62ch;
}

.eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

/* --------------------------------------------------------------------------
   Cabeçalho e navegação
   -------------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(7, 12, 22, 0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 68px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--text);
    border: 0;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.brand:hover { color: var(--text); }

.brand__mark {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
}

.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong { font-size: 0.98rem; }
.brand__text span { font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.06em; }

.nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/*
 * O seletor exclui .btn de propósito.
 *
 * Um botão dentro da navegação continua sendo um botão. Sem o :not(.btn),
 * ".nav a" (especificidade 0,1,1) vence ".btn--primary" (0,1,0) e pinta o
 * texto do botão com a cor de link — o que derrubava o contraste do CTA do
 * cabeçalho para cerca de 1.5:1. O :hover fazia o mesmo com o fundo.
 */
.nav a:not(.btn) {
    color: var(--text-secondary);
    border: 0;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.94rem;
    font-weight: 500;
}

.nav a:not(.btn):hover,
.nav a:not(.btn)[aria-current="page"] {
    color: var(--text);
    background: var(--surface-2);
}

.nav-toggle {
    display: none;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

@media (max-width: 820px) {
    .nav-toggle { display: inline-flex; }

    /*
     * Só o menu que TEM botão de abrir vira painel suspenso.
     *
     * Sem o modificador, esta regra alcançava também a navegação do visitante
     * sem sessão — que é um único botão e não tem .nav-toggle. O resultado era
     * um painel flutuante permanente, sobrepondo o topo do hero, porque nada
     * nunca definia o atributo hidden nele.
     */
    .nav--collapsible {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
        padding: 0.75rem var(--gutter) 1.25rem;
        background: var(--bg-elevated);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
    }

    .nav--collapsible[hidden] { display: none; }
    .nav--collapsible a { padding: 0.7rem 0.75rem; }
}

/*
 * Abaixo de 480px o nome da marca já ocupa duas linhas. O subtítulo vira ruído
 * e rouba altura do cabeçalho, que é sticky — some, mas continua no acessível.
 */
@media (max-width: 480px) {
    .brand__text span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .brand__mark { width: 30px; height: 30px; }
}

.site-footer {
    border-top: 1px solid var(--border);
    padding-block: 2.5rem;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.site-footer a { color: var(--text-secondary); }

/* --------------------------------------------------------------------------
   Botões
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.35rem;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    font-size: 0.96rem;
    line-height: 1.2;
    cursor: pointer;
    text-align: center;
    /* O rótulo do botão não quebra no meio: em telas estreitas isso deixava
       "Começar agora" em duas linhas dentro da pílula. */
    white-space: nowrap;
    transition: transform var(--dur-fast) var(--ease),
        background-color var(--dur-fast) var(--ease),
        border-color var(--dur-fast) var(--ease),
        color var(--dur-fast) var(--ease);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn:not(:disabled):active { transform: translateY(1px); }

.btn--primary {
    background: var(--accent);
    color: var(--text-inverse);
}

.btn--primary:hover:not(:disabled) {
    background: var(--accent-strong);
    color: var(--text-inverse);
    border-color: transparent;
}

.btn--secondary {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border-strong);
}

.btn--secondary:hover:not(:disabled) {
    background: var(--surface-3);
    color: var(--text);
    border-color: var(--accent-line);
}

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn--ghost:hover:not(:disabled) {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface);
}

.btn--danger {
    background: transparent;
    color: var(--danger);
    border-color: rgba(253, 164, 175, 0.4);
}

.btn--danger:hover:not(:disabled) {
    background: var(--danger-dim);
    color: var(--danger);
}

.btn--lg { padding: 0.95rem 1.9rem; font-size: 1.05rem; }
.btn--sm { padding: 0.45rem 0.9rem; font-size: 0.86rem; }
.btn--block { width: 100%; }

/* --------------------------------------------------------------------------
   Cartões
   -------------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(1.25rem, 3vw, 1.75rem);
}

.card--elevated { box-shadow: var(--shadow); background: var(--bg-elevated); }
.card--accent { border-color: var(--accent-line); background: var(--surface-2); }
.card--flush { padding: 0; overflow: hidden; }

.card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.card__title { margin: 0; font-size: 1.1rem; }

/* --------------------------------------------------------------------------
   Selos e etiquetas
   -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.7rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    background: var(--surface-2);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.badge--accent {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent-line);
}

.badge--success {
    background: var(--success-dim);
    color: var(--success);
    border-color: rgba(110, 231, 183, 0.32);
}

.badge--danger {
    background: var(--danger-dim);
    color: var(--danger);
    border-color: rgba(253, 164, 175, 0.32);
}

/* --------------------------------------------------------------------------
   Formulários
   -------------------------------------------------------------------------- */

.field { margin-bottom: 1.15rem; }

.field label,
.label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.field__hint {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    font: inherit;
    font-size: 0.98rem;
    color: var(--text);
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

textarea { resize: vertical; min-height: 96px; line-height: 1.55; }

input::placeholder,
textarea::placeholder { color: var(--text-muted); opacity: 1; }

input:hover:not(:disabled),
select:hover:not(:disabled),
textarea:hover:not(:disabled) { border-color: var(--accent-line); }

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
    border-color: var(--danger);
}

input[aria-invalid="true"]:focus,
textarea[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px var(--danger-dim);
}

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 51%, calc(100% - 13px) 51%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2.25rem;
}

.field__error {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: var(--danger);
    font-weight: 500;
}

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    cursor: pointer;
}

.checkbox input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 0.2rem;
    accent-color: var(--accent-strong);
    cursor: pointer;
}

/* --------------------------------------------------------------------------
   Alertas
   -------------------------------------------------------------------------- */

.alert {
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    padding: 0.9rem 1.1rem;
    font-size: 0.93rem;
    color: var(--text-secondary);
}

.alert strong { color: var(--text); }
.alert--info { border-left-color: var(--accent); }
.alert--success { border-left-color: var(--success); }
.alert--error { border-left-color: var(--danger); }

/* --------------------------------------------------------------------------
   Hero da landing
   -------------------------------------------------------------------------- */

.hero {
    position: relative;
    padding-block: clamp(3.5rem, 9vw, 7rem);
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: -40% 30% 40% -20%;
    background: radial-gradient(circle at 30% 40%, rgba(56, 189, 248, 0.16), transparent 62%);
    pointer-events: none;
}

.hero::after {
    content: "";
    position: absolute;
    inset: 20% -25% -50% 40%;
    background: radial-gradient(circle at 60% 50%, rgba(125, 211, 252, 0.1), transparent 60%);
    pointer-events: none;
}

.hero__inner { position: relative; z-index: 1; max-width: 46rem; }
.hero h1 { margin-bottom: 1.25rem; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .row { margin-top: 2rem; }

.hero__meta {
    margin-top: 2.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2.5rem;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.hero__meta div strong {
    display: block;
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   Etapas da jornada
   -------------------------------------------------------------------------- */

.steps { counter-reset: step; }

.step {
    position: relative;
    padding-left: 3.25rem;
    counter-increment: step;
}

.step::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2.25rem;
    height: 2.25rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-dim);
    border: 1px solid var(--accent-line);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.95rem;
}

.step h3 { font-size: 1.05rem; margin-bottom: 0.35rem; }
.step p { color: var(--text-secondary); font-size: 0.94rem; margin: 0; }

/* --------------------------------------------------------------------------
   Segmentos
   -------------------------------------------------------------------------- */

.segment-grid {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

.segment-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease),
        transform var(--dur) var(--ease);
}

.segment-tile:hover {
    border-color: var(--accent-line);
    background: var(--surface-2);
}

.segment-tile h3 {
    font-size: 1rem;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.segment-tile h3 span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.segment-tile p {
    font-size: 0.87rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.55;
}

/* --------------------------------------------------------------------------
   Chat
   -------------------------------------------------------------------------- */

.chat-layout {
    display: grid;
    gap: 1.5rem;
    padding-block: 2rem 3rem;
}

@media (min-width: 980px) {
    .chat-layout {
        grid-template-columns: 260px minmax(0, 1fr);
        align-items: start;
    }
}

.chat-progress {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

@media (min-width: 980px) {
    .chat-progress { position: sticky; top: 88px; }
}

.chat-progress h2 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.progress-bar {
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.progress-bar__fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--accent-strong), var(--accent));
    border-radius: inherit;
}

.dimension-list { list-style: none; margin: 0; padding: 0; }

.dimension-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0;
}

.dimension-list li::before {
    content: "";
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1.5px solid var(--border-strong);
    background: transparent;
}

.dimension-list li[data-status="atual"] {
    color: var(--text);
    font-weight: 600;
}

.dimension-list li[data-status="atual"]::before {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.dimension-list li[data-status="completa"] { color: var(--text-secondary); }

.dimension-list li[data-status="completa"]::before {
    border-color: var(--success);
    background: var(--success);
}

.chat-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: min(70vh, 620px);
}

.chat-log {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: clamp(1rem, 3vw, 1.75rem);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.bubble {
    max-width: min(88%, 46rem);
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius);
    font-size: 0.97rem;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    animation: bubble-in var(--dur) var(--ease) both;
}

.bubble--assistant {
    align-self: flex-start;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.bubble--user {
    align-self: flex-end;
    background: var(--accent-dim);
    border: 1px solid var(--accent-line);
    color: var(--text);
    border-bottom-right-radius: 4px;
}

.bubble--notice {
    align-self: center;
    background: transparent;
    border: 1px dashed var(--border-strong);
    color: var(--text-muted);
    font-size: 0.86rem;
    text-align: center;
}

@keyframes bubble-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.typing {
    align-self: flex-start;
    display: inline-flex;
    gap: 5px;
    padding: 0.95rem 1.1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-bottom-left-radius: 4px;
}

.typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    animation: typing 1.1s infinite ease-in-out;
}

.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

.chat-composer {
    border-top: 1px solid var(--border);
    padding: clamp(0.85rem, 2vw, 1.25rem);
    background: var(--surface);
}

.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.quick-replies:empty { display: none; }

.chip {
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
        background-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.chip:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.chip:disabled { opacity: 0.5; cursor: not-allowed; }

/*
 * Chip selecionado na múltipla escolha.
 *
 * O estado não é sinalizado só pela cor: o marcador de verificação à esquerda
 * mantém a distinção legível para quem não percebe a diferença cromática.
 */
.chip[aria-pressed="true"] {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.chip[aria-pressed="true"]::before {
    content: "✓";
    margin-right: 0.4rem;
    font-weight: 700;
}

.quick-confirm {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    padding: 0.65rem 0.9rem;
    border: 1px dashed var(--accent-line);
    border-radius: var(--radius-sm);
    background: var(--accent-dim);
}

.quick-confirm__hint {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.composer-row {
    display: flex;
    gap: 0.65rem;
    align-items: flex-end;
}

.composer-row textarea {
    flex: 1 1 auto;
    min-height: 48px;
    max-height: 160px;
    resize: none;
    line-height: 1.5;
}

.composer-row .btn { flex: 0 0 auto; }

.chat-handoff {
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    padding: 1.1rem clamp(0.85rem, 2vw, 1.25rem);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
}

.chat-handoff p { margin: 0; font-size: 0.92rem; color: var(--text-secondary); }

/* --------------------------------------------------------------------------
   Síntese
   -------------------------------------------------------------------------- */

.synthesis-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 1.1rem 1.25rem;
}

.synthesis-item__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    font-weight: 650;
    margin-bottom: 0.4rem;
}

.synthesis-item p { margin: 0; color: var(--text-secondary); }

.confidence {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.confidence__track {
    flex: 1 1 auto;
    height: 5px;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    overflow: hidden;
    min-width: 80px;
}

.confidence__fill {
    height: 100%;
    width: 100%;
    background: var(--accent);
    border-radius: inherit;
}

/* --------------------------------------------------------------------------
   Universo Acionável
   -------------------------------------------------------------------------- */

.match-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.match-card--top {
    border-color: var(--accent-line);
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
}

.match-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
}

.match-card__rank {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-dim);
    border: 1px solid var(--accent-line);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.match-card h3 { margin: 0; font-size: 1.08rem; }

.score {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.score__label {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.score__track {
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    overflow: hidden;
}

.score__fill {
    height: 100%;
    width: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

.reason-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.45rem;
}

.reason-list li {
    position: relative;
    padding-left: 1.2rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.55;
}

.reason-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.attention-note {
    font-size: 0.86rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    margin: 0;
}

.path-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.path-card__horizon {
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.path-card ol {
    margin: 0;
    padding-left: 1.2rem;
    display: grid;
    gap: 0.45rem;
}

.path-card ol li { font-size: 0.9rem; color: var(--text-secondary); margin: 0; }

.course-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.course-card h3 { font-size: 1rem; margin: 0; }
.course-card p { font-size: 0.89rem; color: var(--text-muted); margin: 0; }

.fav-btn {
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    flex: 0 0 auto;
    transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
        background-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.fav-btn:hover { border-color: var(--accent); color: var(--accent); }

.fav-btn[aria-pressed="true"] {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.fav-btn svg { width: 16px; height: 16px; }

.invite-box {
    background: linear-gradient(135deg, var(--surface-2), var(--surface));
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-lg);
    padding: clamp(1.35rem, 3vw, 2rem);
}

.invite-link {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.invite-link input {
    flex: 1 1 240px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.disclaimer {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 1.15rem 1.35rem;
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Painel administrativo
   -------------------------------------------------------------------------- */

.stat-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
}

.stat__label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat__value {
    font-size: 1.9rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.stat__hint { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.35rem; }

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

th {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    font-weight: 650;
    white-space: nowrap;
    background: var(--surface-2);
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }

.filters {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
    align-items: end;
}

.filters .field { margin: 0; }

.bar-chart { display: grid; gap: 0.7rem; }

.bar-chart__row {
    display: grid;
    grid-template-columns: minmax(90px, 1.2fr) minmax(0, 3fr) auto;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.87rem;
}

.bar-chart__label { color: var(--text-secondary); }

.bar-chart__track {
    height: 8px;
    background: var(--surface-3);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.bar-chart__fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--accent-strong), var(--accent));
    border-radius: inherit;
}

.bar-chart__value {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 2.5rem;
    text-align: right;
}

.pagination {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 1.25rem;
}

.pagination a,
.pagination span {
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.87rem;
}

.pagination a:hover { border-color: var(--accent-line); color: var(--accent); }

.pagination [aria-current="page"] {
    background: var(--accent-dim);
    border-color: var(--accent-line);
    color: var(--accent);
    font-weight: 600;
}

.transcript {
    display: grid;
    gap: 0.75rem;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.4rem;
}

.transcript__item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    background: var(--surface);
    font-size: 0.9rem;
}

.transcript__item[data-role="user"] {
    border-color: var(--accent-line);
    background: var(--surface-2);
}

.transcript__item[data-off-scope="1"] { border-left: 3px solid var(--danger); }

.transcript__meta {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Revelação de conteúdo
   --------------------------------------------------------------------------

   REGRA: o estado oculto vive sob .js-motion, classe que o JavaScript coloca
   na raiz apenas quando há IntersectionObserver E o usuário não pediu movimento
   reduzido. Sem JavaScript, com erro de script ou com movimento reduzido, nada
   fica escondido — a animação é acréscimo, nunca condição para o conteúdo
   existir.
   -------------------------------------------------------------------------- */

.js-motion [data-reveal] {
    opacity: 0;
    transform: translateY(14px);
    transition:
        opacity var(--dur-slow) var(--ease) var(--reveal-delay, 0ms),
        transform var(--dur-slow) var(--ease) var(--reveal-delay, 0ms);
}

.js-motion [data-reveal].is-revealed {
    opacity: 1;
    transform: none;
}

/* --------------------------------------------------------------------------
   Elevação no ponteiro
   --------------------------------------------------------------------------

   Só onde o cartão é um alvo de leitura ou de ação. Deslocamento de 2px: o
   suficiente para responder ao ponteiro sem deslocar a linha de base do texto.
   Desativado no toque, onde :hover fica preso após o toque.
   -------------------------------------------------------------------------- */

@media (hover: hover) and (pointer: fine) {
    .match-card,
    .path-card,
    .course-card {
        transition:
            border-color var(--dur) var(--ease),
            background-color var(--dur) var(--ease),
            transform var(--dur) var(--ease);
    }

    .segment-tile:hover,
    .match-card:hover,
    .path-card:hover,
    .course-card:hover {
        transform: translateY(-2px);
    }
}

/* --------------------------------------------------------------------------
   Medidores
   --------------------------------------------------------------------------

   Barra de progresso, aderência de segmento, confiança da leitura e os
   gráficos do painel compartilham o mesmo preenchimento.

   O valor entra por --fill (0 a 1) e é aplicado com scaleX, não com width:
   escala roda no compositor, enquanto largura recalcula layout a cada quadro.
   Sem JavaScript o medidor já aparece cheio no valor certo — a animação é
   acréscimo, nunca condição para o dado aparecer.
   -------------------------------------------------------------------------- */

.progress-bar__fill,
.score__fill,
.confidence__fill,
.bar-chart__fill {
    transform: scaleX(var(--fill, 1));
    transform-origin: left center;
    transition: transform var(--dur-slow) var(--ease);
    will-change: transform;
}

/* --------------------------------------------------------------------------
   Identificação da versão
   -------------------------------------------------------------------------- */

/* Rodapé público: discreto, separado do aviso de direitos por um ponto médio. */
.version-tag {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.version-tag::before {
    content: "·";
    margin-inline: 0.4rem;
    color: var(--border-strong);
}

.version-tag a {
    color: var(--text-muted);
    border-bottom-color: var(--border-strong);
}

.version-tag a:hover { color: var(--accent); }

/* Painel: linha completa, quebrando em telas estreitas. */
.version-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
    align-items: baseline;
}

.version-detail strong {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    margin-right: 0.3rem;
}

.version-detail code {
    background: var(--surface-2);
    font-size: 0.95em;
}

/* --------------------------------------------------------------------------
   Utilidades
   -------------------------------------------------------------------------- */

.is-hidden { display: none !important; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%) translateY(1rem);
    background: var(--surface-3);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    padding: 0.7rem 1.35rem;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
    z-index: 300;
    max-width: calc(100vw - 2rem);
    text-align: center;
}

.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--accent-line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Preferências do usuário e impressão
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /*
     * Segunda barreira: se a preferência mudar depois do carregamento, o
     * conteúdo aparece na hora em vez de ficar preso no estado oculto.
     */
    .js-motion [data-reveal] {
        opacity: 1 !important;
        transform: none !important;
    }
}

@media print {
    .site-header,
    .site-footer,
    .chat-composer,
    .invite-box,
    .btn,
    .fav-btn { display: none !important; }

    body { background: #fff; color: #111; }

    .card,
    .match-card,
    .path-card,
    .course-card,
    .synthesis-item {
        border-color: #ccc;
        background: #fff;
        break-inside: avoid;
    }

    .text-muted,
    .text-secondary,
    .attention-note { color: #444; }
}
