:root {
    /* Tema claro — marca AprovIA sobre fundo claro */
    --color-primary: #2563ff;
    --color-primary-deep: #0d47ff;
    --color-primary-light: #e9efff;
    --color-success: #00b58a;
    --color-success-bg: #e2faf3;
    --color-text: #0b1220;
    --color-muted: #64748b;
    --color-bg: #f4f6fb;
    --color-surface: #ffffff;
    --color-border: #e4e8f1;
    --color-input-border: #d8deea;
    --color-danger: #e0284a;
    --color-danger-bg: #fde8ec;
    --color-locked-bg: #e4e8f1;
    --color-locked-text: #8a94a6;
    /* Azul fluorescente de destaque — badge, preco, "tempo limitado". */
    --color-accent: #17b6ff;
    --color-accent-deep: #0090e0;
    --color-accent-bg: #e3f6ff;
    --radius: 12px;
}

/* Tema escuro — fiel ao web kit AprovIA (fundo #0B1220, azul + verde) */
[data-theme="escuro"] {
    --color-primary: #2563ff;
    --color-primary-deep: #0d47ff;
    --color-primary-light: rgba(37, 99, 255, 0.16);
    --color-success: #00e6a7;
    --color-success-bg: rgba(0, 230, 167, 0.14);
    --color-text: #ffffff;
    --color-muted: #8a94a6;
    --color-bg: #0b1220;
    --color-surface: #111a2e;
    --color-border: #1e2740;
    --color-input-border: #263153;
    --color-danger: #ff5c77;
    --color-danger-bg: rgba(255, 92, 119, 0.14);
    --color-locked-bg: #1a2338;
    --color-locked-text: #8a94a6;
    --color-accent: #38bdf8;
    --color-accent-deep: #0ea5e9;
    --color-accent-bg: rgba(56, 189, 248, 0.18);
}

* { box-sizing: border-box; }

/* Rolagem suave pro link "Ir para minha fase" (#fase-atual, ver
   Views/app/home.php) — sem isso o navegador pula direto, sem transicao. */
html { scroll-behavior: smooth; }

/* Trava qualquer vazamento horizontal no celular (grids/textos que passam da
   largura da tela) — sem isso o conteudo e a barra inferior ficam cortados a
   direita. clip nao cria container de rolagem nem afeta position: fixed. */
html, body { overflow-x: clip; }

/* O atributo [hidden] tem que vencer qualquer `display` de classe (ex:
   .btn, .note-form) — sem isso, elementos com hidden continuam visiveis. */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: 'Poppins', 'Segoe UI', system-ui, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, h5, h6, .btn, .logo { font-weight: 600; }

/* ---- Seletor de tema (topbar) ---- */
.theme-switch { display: flex; gap: 4px; }
.theme-switch__btn {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: var(--color-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
    transition: opacity 0.15s, border-color 0.15s, background 0.15s, color 0.15s;
}
.theme-switch__btn svg { display: block; }
.theme-switch__btn:hover { opacity: 1; }
.theme-switch__btn.is-active {
    opacity: 1;
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
}

.topbar {
    position: relative;
    z-index: 2;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

/* Aviso de vencimento de assinatura (topo, abaixo do header) */
.subscription-banner {
    position: relative;
    z-index: 1;
    background: #fff4e5;
    border-bottom: 1px solid #fdba74;
}
.subscription-banner--venceu { background: var(--color-danger-bg); border-bottom-color: var(--color-danger); }
.subscription-banner__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 24px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #92400e;
    text-align: center;
}
.subscription-banner--venceu .subscription-banner__inner { color: var(--color-danger); }
.subscription-banner--info { background: var(--color-primary-light); border-bottom-color: var(--color-primary); }
.subscription-banner--info .subscription-banner__inner { color: var(--color-primary-deep); }
.subscription-banner__link {
    color: inherit;
    text-decoration: underline;
    font-weight: 700;
    white-space: nowrap;
}
.subscription-banner__form { display: inline-flex; margin: 0; }
.subscription-banner__link--btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--color-text);
    text-decoration: none;
}

.logo__icon {
    display: inline-flex;
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.logo span { color: var(--color-primary); }

.topbar nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar nav a {
    color: var(--color-muted);
    text-decoration: none;
    font-weight: 600;
}

.topbar__user { color: var(--color-text); font-weight: 600; font-size: 0.9rem; }
.topbar__logout { display: inline; }
.topbar__logout .link-btn { font-weight: 600; font-size: 0.9rem; color: var(--color-muted); }
.topbar__logout .link-btn:hover { color: var(--color-danger); }

/* Botao de login: separado dos links de navegacao, pra quem ja tem conta
   achar facil (nao e so mais um link de texto perdido no meio do menu). */
.topbar nav a.topbar__cta {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border-radius: 999px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 700;
    font-size: 0.85rem;
    border: 1px solid transparent;
    transition: border-color 0.15s;
}
.topbar nav a.topbar__cta:hover { border-color: var(--color-primary); }

@media (max-width: 640px) {
    .topbar__inner { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
    .topbar nav { flex-wrap: wrap; gap: 10px 14px; font-size: 0.85rem; }
}

/* Menu hamburguer do usuario logado: trocar/criar trilha, meu perfil, sair —
   tudo junto num so lugar em vez de botoes soltos na barra (ver
   layouts/start.php + assets/js/account-menu.js). */
.account-menu { position: relative; }
.account-menu__trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: border-color 0.15s;
}
.account-menu__trigger:hover,
.account-menu__trigger[aria-expanded="true"] { border-color: var(--color-primary); }
.account-menu__name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu__icon { color: var(--color-muted); flex-shrink: 0; }

.account-menu__panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
    padding: 8px;
    z-index: 20;
}
.account-menu__panel form { margin: 0; }
.account-menu__label {
    padding: 6px 10px 2px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
}
.account-menu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    border: none;
    background: none;
    color: var(--color-text);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.account-menu__item:hover { background: var(--color-primary-light); color: var(--color-primary); }
.account-menu__item--active { color: var(--color-primary); cursor: default; }
.account-menu__item--active:hover { background: none; }
.account-menu__item--danger { color: var(--color-danger); }
.account-menu__item--danger:hover { background: var(--color-danger-bg); color: var(--color-danger); }
.account-menu__divider { height: 1px; background: var(--color-border); margin: 6px 4px; }

@media (max-width: 640px) {
    .account-menu__name { max-width: 90px; }
    .account-menu__panel { right: -8px; min-width: 220px; }
}

.hero {
    padding: 64px 0;
    text-align: center;
}

.hero h1 {
    font-size: 2rem;
    max-width: 640px;
    margin: 0 auto 16px;
}

.hero p {
    color: var(--color-muted);
    margin-bottom: 32px;
}

.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 700;
}

.btn--primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-deep));
    color: #fff;
}

.btn--success {
    background: var(--color-success);
    color: #04231b;
}

.btn--block {
    display: block;
    width: 100%;
    border: 0;
    font-size: 1rem;
    cursor: pointer;
}

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

/* ---- Landing page (primeiro acesso, trafego de anuncio) ---- */
.landing {
    padding: 40px 0 64px;
    position: relative;
}

/* Manchas de cor suaves atras de TODA a pagina (azul + verde + azul
   fluorescente da marca), so decorativas — chamam atencao sem competir com
   o texto/CTA. Vaza de propósito pra fora do .container (largura = 100vw)
   pra cobrir a tela inteira na horizontal, e cobre do topo ao rodape na
   vertical (bottom:0) — o header fica sempre por cima, solido (ver
   .topbar, z-index:2). */
.landing::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 100vw;
    margin-left: -50vw;
    background:
        radial-gradient(circle at 12% 8%, rgba(37, 99, 255, 0.20), transparent 45%),
        radial-gradient(circle at 88% 6%, rgba(0, 181, 138, 0.18), transparent 45%),
        radial-gradient(circle at 78% 45%, rgba(23, 182, 255, 0.18), transparent 45%),
        radial-gradient(circle at 15% 60%, rgba(0, 181, 138, 0.14), transparent 45%),
        radial-gradient(circle at 55% 92%, rgba(37, 99, 255, 0.16), transparent 45%);
    filter: blur(30px);
    pointer-events: none;
    z-index: 0;
}

.landing__grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    align-items: center;
}

.landing__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-deep));
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    margin-bottom: 18px;
    box-shadow: 0 8px 20px rgba(23, 182, 255, 0.28);
}

.landing__objectives { margin-bottom: 28px; }
.landing__objectives-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-muted);
    margin: 0 0 10px;
}
.landing__objectives-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.landing__objective-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text);
}
.landing__objective-chip-icon { font-size: 0.95rem; line-height: 1; }

.landing__pitch h1 {
    font-size: clamp(1.7rem, 5vw, 2.4rem);
    line-height: 1.18;
    margin: 0 0 16px;
}

.landing__lead {
    font-size: 1.05rem;
    color: var(--color-muted);
    line-height: 1.6;
    margin: 0 0 32px;
}

.landing__benefits {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.landing__benefit {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.landing__benefit span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
    background: var(--color-primary-light);
}
.landing__benefit:nth-child(2) span { background: var(--color-success-bg); }
.landing__benefit:nth-child(3) span { background: var(--color-accent-bg); }

.landing__benefit strong { display: block; margin-bottom: 2px; }
.landing__benefit p { margin: 0; color: var(--color-muted); font-size: 0.9rem; }

.landing__card {
    order: -1;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 32px 28px;
    box-shadow: 0 20px 50px rgba(13, 20, 40, 0.08);
    text-align: center;
}

.landing__mascote {
    display: block;
    width: 92px;
    height: auto;
    margin: 0 auto 10px;
}

.landing__promo {
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent-bg));
    border: 1px solid var(--color-accent);
    border-radius: 16px;
    padding: 18px 20px;
    margin-bottom: 22px;
}

.landing__promo-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-deep));
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.landing__promo-price {
    margin: 0 0 4px;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
}

.landing__promo-old { text-decoration: line-through; color: var(--color-muted); font-size: 1rem; }
.landing__promo-new { font-size: 1.9rem; font-weight: 800; color: var(--color-accent-deep); }
.landing__promo-new small { font-size: 0.85rem; font-weight: 600; color: var(--color-muted); }

.landing__promo-note {
    margin: 0 0 12px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-accent-deep);
}

.landing__promo-free {
    margin: 0;
    font-size: 0.88rem;
    background: var(--color-success-bg);
    color: var(--color-success);
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 600;
}

.landing__login {
    margin: 16px 0 0;
    font-size: 0.9rem;
    color: var(--color-muted);
}
.landing__login a { color: var(--color-primary); font-weight: 700; text-decoration: none; }
.landing__login a:hover { text-decoration: underline; }

@media (min-width: 900px) {
    .landing__grid {
        grid-template-columns: 1.05fr 0.95fr;
        gap: 56px;
    }
    .landing__card { order: 0; }
}

/* ---- Landing de campanha (anuncio/trafego pago) — ver
   Views/marketing/promo.php + MarketingController. Pagina standalone (sem
   topbar/nav do app): coluna unica, centrada, foco total no video + CTA. */
.promo-header {
    position: relative;
    z-index: 2;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.promo-header__inner { display: flex; justify-content: center; padding: 16px 24px; }

.promo-hero__inner {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}
.promo-hero__inner .landing__badge { margin-left: auto; margin-right: auto; }
.promo-hero__inner h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); line-height: 1.18; margin: 0 0 16px; }
.promo-hero__inner .landing__lead { max-width: 560px; margin-left: auto; margin-right: auto; }

.promo-video { margin-bottom: 28px; }
.promo-video__frame {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    border: 0;
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent-bg));
}
.promo-video__frame--placeholder { border: 1px dashed var(--color-accent); }
.promo-video__play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-deep));
    color: #fff;
    font-size: 1.4rem;
    box-shadow: 0 8px 20px rgba(23, 182, 255, 0.28);
}
.promo-video__label { color: var(--color-muted); font-weight: 600; font-size: 0.9rem; }

.promo-trust {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 22px;
}
.promo-trust__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text);
    box-shadow: 0 4px 12px rgba(13, 20, 40, 0.05);
}
.promo-trust__item strong { color: var(--color-accent-deep); }

.promo-cta { max-width: 420px; margin: 0 auto 40px; }

.promo-benefits { text-align: left; margin-bottom: 40px; }

.promo-pricing { max-width: 420px; margin: 0 auto 28px; }

.promo-footer { text-align: center; }
.promo-footer .footer__inner { justify-content: center; gap: 16px; }

/* CTA fixo: barra full-width no mobile; pill flutuante no desktop (nao
   precisa de faixa inteira quando ja ha bastante espaco em volta). */
.promo-sticky-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    padding: 12px 16px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.16);
}
@media (min-width: 900px) {
    .promo-sticky-cta {
        left: auto;
        right: 28px;
        bottom: 28px;
        max-width: 300px;
        padding: 8px;
        border-radius: 999px;
        border: 1px solid var(--color-border);
        box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
    }
}
/* Evita sobrepor o aviso de cookies (tambem fixo no rodape) quando os dois
   aparecem ao mesmo tempo no mobile. */
.promo-page .cookie-consent { bottom: 60px; }
@media (min-width: 900px) {
    .promo-page .cookie-consent { bottom: 0; }
}

/* ---- Tela de entrada / muro de cadastro ---- */
.entry {
    display: flex;
    justify-content: center;
    padding: 48px 0;
}

.entry__card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 40px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.entry__mascote {
    display: block;
    width: 110px;
    height: auto;
    margin: 0 auto 12px;
}

.entry__card h1 { font-size: 1.6rem; margin: 0 0 12px; }
.entry__lead { color: var(--color-muted); margin-bottom: 24px; }

.entry__form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    margin-bottom: 20px;
}

.entry__form label { font-weight: 600; font-size: 0.9rem; }

.entry__form input,
.entry__form select {
    padding: 14px 16px;
    border: 2px solid var(--color-input-border);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
}

.entry__form input:focus,
.entry__form select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* ---- Formulario de cartao tokenizado (Secure Fields do Mercado Pago,
   ver Views/auth/subscribe_card_form.php) — cada .card-field vira um
   <iframe> deles por dentro, por isso a altura/padding fica no wrapper,
   nao num input nosso (o numero do cartao nunca chega no nosso DOM). ---- */
.card-field {
    height: 48px;
    padding: 6px 16px;
    border: 2px solid var(--color-input-border);
    border-radius: 12px;
    background: var(--color-surface);
    margin-bottom: 16px;
}
.card-field iframe { height: 100%; }
.card-form__row { display: flex; gap: 12px; }
.card-form__row .card-field { flex: 1; }

.card-form__auto-renew {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--color-primary-light);
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
}
.card-form__auto-renew input { width: 18px; height: 18px; flex-shrink: 0; }

.entry__skip {
    display: block;
    text-align: center;
    color: var(--color-muted);
    font-size: 0.9rem;
    text-decoration: underline;
    background: none;
    border: 0;
    cursor: pointer;
    width: 100%;
    padding: 8px;
}

.entry__note {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin: 0;
}

.payment-options { margin-top: 20px; }
.payment-options form { margin: 0; }
.payment-options__hint {
    font-size: 0.8rem;
    color: var(--color-muted);
    margin: 8px 0 0;
    text-align: center;
}
.payment-options__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--color-muted);
    font-size: 0.85rem;
}
.payment-options__divider::before,
.payment-options__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 16px;
    text-align: left;
}

.alert--error { background: var(--color-danger-bg); color: var(--color-danger); }
.alert--info { background: var(--color-primary-light); color: var(--color-primary); }

/* ---- Area de estudo ---- */
.app-home { padding: 40px 0; }

.app-home__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.app-home__header h1 { font-size: 1.6rem; margin: 0; }
.app-home__lead { color: var(--color-muted); margin: 8px 0 28px; }

.trilhas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.trilha-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 20px;
}

.trilha-card__step {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-primary);
    background: var(--color-primary-light);
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.trilha-card h3 { margin: 0 0 6px; font-size: 1.1rem; }
.trilha-card p { margin: 0; color: var(--color-muted); font-size: 0.9rem; }
.trilha-card--locked { opacity: 0.75; }

/* ---- Onboarding: stepper ---- */
.entry__card--wide { max-width: 560px; }

.stepper {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
}

.stepper__dot {
    width: 28px;
    height: 6px;
    border-radius: 999px;
    background: var(--color-input-border);
}

.stepper__dot.is-active { background: var(--color-primary); }
.stepper__dot.is-done { background: var(--color-primary); opacity: 0.5; }

.stepper__label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin: 0 0 16px;
}

/* ---- Onboarding: grid de modulos ---- */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.module-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 18px;
    border: 2px solid var(--color-input-border);
    border-radius: 14px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}

.module-card:hover { border-color: var(--color-primary); }

/* esconde o radio nativo, o card inteiro vira o seletor */
.module-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.module-card:has(input:checked) {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.module-card__icon { font-size: 1.6rem; }
.module-card__name { font-weight: 700; }
.module-card__tagline { font-size: 0.82rem; color: var(--color-muted); }

/* ---- Badge do modulo escolhido (area de estudo) ---- */
.module-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 12px;
}

/* Barra vertical de dificuldade, FLUTUANTE no canto esquerdo (ver
   Views/app/home.php + assets/js/difficulty-gauge.js) — 5 segmentos
   clicaveis, do azul (mais facil) ao vermelho (mais dificil), com um fogo
   indicando o nivel atual. So o fogo aparece por padrao; passar o mouse
   mostra o rotulo "Dificuldade" ao lado. */
.difficulty-float {
    position: fixed;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    display: flex;
    align-items: center;
}
.difficulty-float__tooltip {
    position: absolute;
    left: calc(100% + 8px);
    background: var(--color-text);
    color: var(--color-surface);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-4px);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.difficulty-float:hover .difficulty-float__tooltip { opacity: 1; transform: translateX(0); }
/* Botao que recolhe a barra no celular — escondido no desktop */
.difficulty-float__toggle { display: none; }

.difficulty-gauge__bar {
    position: relative;
    width: 26px;
    /* Altura responsiva e limitada — antes era fixa em 7cm e "passava" a barra
       de progresso, invadindo o conteudo abaixo. */
    height: min(240px, 42vh);
    flex-shrink: 0;
    border-radius: 15px;
    background: linear-gradient(to top, var(--color-primary) 0%, var(--color-success) 30%, #f0a34e 65%, var(--color-danger) 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: visible;
}
.difficulty-gauge__seg {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    position: relative;
    z-index: 2;
}
.difficulty-gauge__seg:not(:last-child) { border-bottom: 2px solid rgba(255, 255, 255, 0.55); }
.difficulty-gauge__seg:first-child { border-radius: 15px 15px 0 0; }
.difficulty-gauge__seg:last-child { border-radius: 0 0 15px 15px; }
.difficulty-gauge__seg:hover { background: rgba(255, 255, 255, 0.18); }
.difficulty-gauge__flame {
    position: absolute;
    left: 50%;
    transform: translate(-50%, 50%);
    font-size: 1.3rem;
    line-height: 1;
    pointer-events: none;
    transition: bottom 0.25s ease;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
    z-index: 3;
}

/* No celular a barra de dificuldade fica recolhida num botao (acima da barra
   de navegacao inferior), pra nao cobrir os titulos/descricoes das aulas na
   trilha. Toca no 🔥 pra abrir a barra completa; ajustar recolhe de novo. */
@media (max-width: 768px) {
    .difficulty-float {
        left: 12px;
        top: auto;
        bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 12px);
        transform: none;
        z-index: 45;
    }
    .difficulty-float__toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 46px;
        height: 46px;
        border-radius: 50%;
        border: 1px solid var(--color-border);
        background: var(--color-surface);
        box-shadow: 0 4px 16px rgba(15, 23, 42, 0.22);
        font-size: 1.3rem;
        line-height: 1;
        cursor: pointer;
    }
    .difficulty-float .difficulty-gauge__bar,
    .difficulty-float .difficulty-float__tooltip { display: none; }
    .difficulty-float.is-open .difficulty-gauge__bar {
        display: flex;
        position: absolute;
        left: 4px;
        bottom: calc(100% + 10px);
        height: min(300px, 52vh);
    }
}

.btn--rumo { margin-top: 12px; font-size: 0.85rem; padding: 8px 16px; }

/* Marcador visual da troca de rumo (uma unica vez por trilha, ver
   Views/app/home.php + GuestAccess::trocarRumo) */
.rumo-marker {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 28px;
}
.rumo-marker__line {
    flex: 1;
    height: 2px;
    background: repeating-linear-gradient(
        90deg, var(--color-primary) 0 8px, transparent 8px 14px
    );
}
.rumo-marker__label {
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-primary);
    background: var(--color-primary-light);
    padding: 6px 14px;
    border-radius: 999px;
    white-space: nowrap;
}

/* ---- Passo 3: niveis de conhecimento ---- */
.levels {
    border: 0;
    padding: 0;
    margin: 4px 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.levels legend {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
    padding: 0;
}

.level-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--color-input-border);
    border-radius: 12px;
    cursor: pointer;
}

.level-option:hover { border-color: var(--color-primary); }
.level-option:has(input:checked) {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.level-option span { display: flex; flex-direction: column; }
.level-option small { color: var(--color-muted); }

/* ---- Progresso ---- */
.progress { margin: 20px 0 8px; }
.progress__info { font-size: 0.9rem; color: var(--color-muted); margin-bottom: 8px; }
.progress__bar {
    height: 10px;
    background: var(--color-input-border);
    border-radius: 999px;
    overflow: hidden;
}
.progress__bar span {
    display: block;
    height: 100%;
    background: var(--color-primary);
    border-radius: 999px;
    transition: width 0.4s ease;
}

/* ---- Diagrama de fases (mapa de estudo) ---- */
.phase-path {
    position: relative;
    padding: 24px 0;
    max-width: 620px;
    margin: 0 auto;
}

/* Linha central que conecta as fases: azul ate a ultima fase LIBERADA
   (concluida ou a atual), cinza dali em diante (bloqueadas/pendentes) — ver
   --linha-azul calculado em Views/app/home.php. Corte nitido (sem
   degrade), pra ficar claro onde "ja liberado" termina. */
.phase-path::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background: linear-gradient(
        to bottom,
        var(--color-primary) 0%,
        var(--color-primary) var(--linha-azul, 0%),
        var(--color-input-border) var(--linha-azul, 0%),
        var(--color-input-border) 100%
    );
    transform: translateX(-50%);
}

/* Botao flutuante "Ir para minha fase" (ver Views/app/home.php) — pula
   direto pra fase atual (#fase-atual) quando a trilha ja tem muitas fases
   concluidas empilhadas acima e rolar ate ela seria chato. */
.jump-to-current {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 15;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 999px;
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(37, 99, 255, 0.35);
    transition: transform 0.15s;
}
.jump-to-current:hover { transform: translateY(-2px); }

.phase {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 28px;
}

.phase__node {
    grid-column: 2;
    z-index: 1;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    border: 4px solid var(--color-surface);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* info alternando de lado (zigue-zague) */
.phase:nth-child(odd) .phase__info { grid-column: 3; text-align: left; padding-left: 16px; }
.phase:nth-child(even) .phase__info { grid-column: 1; text-align: right; padding-right: 16px; }

.phase__info { display: flex; flex-direction: column; }
.phase__num { font-size: 0.75rem; font-weight: 700; color: var(--color-muted); text-transform: uppercase; }
.phase__title { font-weight: 700; }
.phase__subject { font-size: 0.82rem; color: var(--color-muted); }
.phase__description { font-size: 0.78rem; color: var(--color-muted); margin-top: 2px; line-height: 1.35; }

/* No celular o zigue-zague vira COLUNA UNICA: linha + no encostados a
   esquerda, texto sempre a direita e alinhado a esquerda. Cabe na largura
   da tela e nao corta mais os titulos/descricoes das fases. */
@media (max-width: 768px) {
    .phase-path { max-width: 100%; padding: 16px 0; }
    .phase-path::before { left: 23px; }
    .phase {
        grid-template-columns: 46px minmax(0, 1fr);
        align-items: start;
        gap: 14px;
        margin-bottom: 22px;
    }
    .phase__node {
        grid-column: 1;
        width: 46px;
        height: 46px;
        font-size: 1.15rem;
        border-width: 3px;
    }
    .phase:nth-child(odd) .phase__info,
    .phase:nth-child(even) .phase__info {
        grid-column: 2;
        text-align: left;
        padding: 0;
    }
    /* "Ir para minha fase" sobe pra nao ficar atras da barra inferior, e vai
       pra direita (a esquerda ja tem o botao de dificuldade). */
    .jump-to-current {
        left: auto;
        right: 14px;
        bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 12px);
    }
}

.phase--completed .phase__node { background: var(--color-primary); color: #fff; }
.phase--current .phase__node {
    background: var(--color-surface);
    color: var(--color-primary);
    border-color: var(--color-primary);
    animation: pulse 1.6s infinite;
}
.phase--locked .phase__node {
    background: var(--color-locked-bg);
    color: var(--color-locked-text);
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}
.phase--locked .phase__node:hover { border-color: var(--color-primary); color: var(--color-primary); }
.phase__locked-note { font-size: 0.78rem; color: var(--color-muted); margin-top: 2px; }

.phase--paywall .phase__node {
    background: #fff7ed;
    color: #b45309;
    border-color: #fdba74;
}
.phase--paywall .phase__node:hover { background: #ffedd5; }
.phase__paywall-note { font-size: 0.78rem; color: #b45309; font-weight: 600; margin-top: 2px; }

.phase--pending { opacity: 0.55; }
.phase--pending .phase__node {
    background: var(--color-locked-bg);
    color: var(--color-locked-text);
    cursor: default;
    border-style: dashed;
}
.phase__title--pending { color: var(--color-muted); font-weight: 500; font-style: italic; }

/* CTA para fazer o teste de progresso quando o modulo esta completo */
.module-cta {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--color-primary-light);
    border: 1px solid rgba(37, 99, 255, 0.25);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 28px;
}
.module-cta__icon { font-size: 1.8rem; }
.module-cta__text { display: flex; flex-direction: column; flex: 1; gap: 2px; }
.module-cta__text span { color: var(--color-muted); font-size: 0.9rem; }
.module-cta__text strong { font-size: 1.05rem; }

/* CTA do simulado: mais chamativo, pra dar vontade de clicar */
.module-cta--simulado {
    background: linear-gradient(120deg, var(--color-primary-light), var(--color-success-bg));
    border: 1px solid rgba(37, 99, 255, 0.3);
    box-shadow: 0 8px 24px rgba(37, 99, 255, 0.12);
}
.module-cta--simulado .module-cta__icon {
    font-size: 2.2rem;
    animation: bounce 1.8s ease-in-out infinite;
}
.btn--simulado {
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(37, 99, 255, 0.35);
}


/* ---- Pratique redacao (tema, escrita, resultado) ---- */
.redacao-hist__link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    color: inherit;
    text-decoration: none;
}
.redacao-hist__link:hover .history__title { text-decoration: underline; }
.redacao-hist__nota {
    font-weight: 700;
    color: var(--color-primary);
    white-space: nowrap;
}

.redacao-tema {
    background: var(--color-primary-light);
    border: 1px solid rgba(37, 99, 255, 0.25);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 8px;
}
.redacao-tema h2 { margin: 0 0 8px; font-size: 1rem; color: var(--color-primary); }
.redacao-tema p { margin: 0; line-height: 1.6; }

.redacao-tema__subtitulo {
    font-size: 0.95rem;
    color: var(--color-muted);
    margin: 20px 0 8px;
}

.redacao-apoio {
    margin: 0 0 12px;
    padding: 12px 16px;
    border-left: 3px solid var(--color-accent);
    background: var(--color-surface);
    border-radius: 0 10px 10px 0;
}
.redacao-apoio__num {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
    margin-bottom: 4px;
}
.redacao-apoio p { margin: 0; line-height: 1.55; font-size: 0.95rem; }

.redacao-textarea {
    width: 100%;
    min-height: 320px;
    padding: 16px;
    border: 2px solid var(--color-input-border);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.6;
    background: var(--color-surface);
    color: var(--color-text);
    resize: vertical;
}
.redacao-textarea:focus { outline: none; border-color: var(--color-primary); }

.redacao-contador {
    display: block;
    text-align: right;
    font-size: 0.82rem;
    color: var(--color-muted);
    margin-top: -6px;
}

.redacao-nota {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    margin: 8px 0 24px;
}
.redacao-nota__valor { font-size: 3rem; font-weight: 800; color: var(--color-primary); line-height: 1; }
.redacao-nota__max { font-size: 1.2rem; color: var(--color-muted); }

.redacao-criterio {
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--color-border);
}
.redacao-criterio__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    font-size: 0.95rem;
}
.redacao-criterio__bar {
    height: 8px;
    border-radius: 4px;
    background: var(--color-border);
    overflow: hidden;
    margin-bottom: 8px;
}
.redacao-criterio__bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: 4px;
}
.redacao-criterio__comentario {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-muted);
    line-height: 1.5;
}

.redacao-lista { margin-bottom: 18px; }
.redacao-lista h3 { font-size: 0.95rem; margin: 0 0 8px; }
.redacao-lista ul { margin: 0; padding-left: 20px; }
.redacao-lista li { font-size: 0.92rem; line-height: 1.6; margin-bottom: 4px; }
.redacao-lista--fortes h3 { color: var(--color-success); }
.redacao-lista--melhorar h3 { color: #d97706; }

.redacao-texto-enviado {
    margin: 20px 0;
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
}
.redacao-texto-enviado summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
}
.redacao-texto-enviado p {
    margin: 12px 0 0;
    line-height: 1.6;
    color: var(--color-muted);
    white-space: pre-line;
}

.redacao-acoes {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}
.redacao-acoes .btn { flex: 1; }

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 99, 255, 0.45); }
    70% { box-shadow: 0 0 0 12px rgba(37, 99, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 255, 0); }
}

/* ---- Historico ---- */
.history { margin-top: 32px; }
.history h2 { font-size: 1.2rem; }
.history__list { list-style: none; padding: 0; margin: 0; }
.history__list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
}
.history__check { color: var(--color-primary); font-weight: 700; }
.history__title { flex: 1; }
.history__date { color: var(--color-muted); font-size: 0.8rem; }

/* ---- Tela do card (fase aberta) ---- */
.card-view { max-width: 100%; margin: 0 auto; padding: 32px 0; }
.card-view__back { color: var(--color-muted); text-decoration: none; font-size: 0.9rem; }

/* Layout de duas colunas: anotações à esquerda, aula à direita */
.card-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
    margin-top: 20px;
}
.card-main { min-width: 0; }
.card-view__subject {
    display: inline-block;
    margin-top: 16px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-primary);
    background: var(--color-primary-light);
    padding: 4px 10px;
    border-radius: 999px;
}
.card-view h1 { margin: 12px 0 20px; }
.card-view__content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 24px;
    line-height: 1.7;
    font-size: 1rem;
    max-width: 760px;
}

/* Texto de cada passo (ver Card::renderStepText): paragrafos e listas com
   respiro entre si, em vez de um bloco denso — mesma regra no PC e no
   celular (so o padding/tamanho de fonte muda, ver breakpoint abaixo). */
.card-view__content p { margin: 0 0 16px; }
.card-view__content p:last-child { margin-bottom: 0; }
.card-view__content ul {
    margin: 0 0 16px;
    padding-left: 22px;
}
.card-view__content ul:last-child { margin-bottom: 0; }
.card-view__content li { margin-bottom: 8px; }
.card-view__content li:last-child { margin-bottom: 0; }
.card-view__content strong { color: var(--color-primary-deep); }

@media (max-width: 640px) {
    .card-view__content { padding: 18px; font-size: 0.96rem; }
}

/* ---- Step horizontal do conteudo da aula ---- */
.lesson-steps__tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
}

.lesson-steps__tab {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 8px 16px 8px 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-muted);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.lesson-steps__tab-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-input-border);
    color: var(--color-text);
    font-size: 0.75rem;
}

.lesson-steps__tab:hover { border-color: var(--color-primary); }

.lesson-steps__tab.is-active {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.lesson-steps__tab.is-active .lesson-steps__tab-num {
    background: var(--color-primary);
    color: #fff;
}

.lesson-steps__panel { animation: lesson-fade 0.2s ease; }

@keyframes lesson-fade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Diagrama SVG (gerado pela IA, sanitizado no servidor) dentro de um passo */
.lesson-steps__diagram {
    margin-top: 16px;
    padding: 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    display: flex;
    justify-content: center;
}
.lesson-steps__diagram svg {
    max-width: 100%;
    height: auto;
}

/* Pergunta de verificacao embutida na aula (reforco, nao vale nota) */
.lesson-question__enunciado { font-weight: 600; margin: 0 0 14px; }

.lesson-question__options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lesson-question__option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--color-text);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.lesson-question__option:hover:not(:disabled) { border-color: var(--color-primary); }
.lesson-question__option:disabled { cursor: default; }

.lesson-question__option.is-correct {
    border-color: var(--color-success);
    background: var(--color-success-bg);
    color: var(--color-success);
    font-weight: 600;
}
.lesson-question__option.is-wrong {
    border-color: var(--color-danger);
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.lesson-question__explanation {
    margin: 14px 0 0;
    padding: 12px 14px;
    background: var(--color-primary-light);
    border-radius: 10px;
    font-size: 0.9rem;
}

/* Mensagem de incentivo apos responder (antes da explicacao) */
.lesson-question__comfort {
    margin: 14px 0 0;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
}
.lesson-question__comfort--good {
    background: var(--color-success-bg);
    color: var(--color-success);
}
.lesson-question__comfort--bad {
    background: #fff4e5;
    color: #b45309;
}

/* Anel de progresso ao vivo (topo da aula): verde = acerto, laranja = erro
   nas perguntas de reforco embutidas — nao e o teste que vale nota. */
.lesson-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.lesson-progress-ring {
    position: relative;
    width: 56px;
    height: 56px;
    flex: 0 0 auto;
}
.lesson-progress-ring__fill {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--color-locked-bg);
    transition: background 0.25s ease;
}
.lesson-progress-ring__hole {
    position: absolute;
    inset: 7px;
    border-radius: 50%;
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.lesson-progress__caption {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-muted);
}

/* Botao "Fazer teste da fase" travado ate ver todos os passos da aula */
.btn--primary.is-locked {
    background: var(--color-locked-bg);
    color: var(--color-locked-text);
    cursor: not-allowed;
    pointer-events: none;
}

/* Anel de reforco no circulo da fase concluida, na trilha (mapa de estudo) */
.phase__node--ring { position: relative; }
.phase__node--ring::before {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: var(--color-surface);
}
.phase__node-check {
    position: relative;
    z-index: 1;
    color: var(--color-success);
}

.lesson-steps__nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.lesson-steps__progress {
    font-size: 0.85rem;
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
}

.lesson-steps__nav .btn--ghost:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.card-view__quiz { margin-top: 24px; }
.card-view__note { color: var(--color-muted); font-size: 0.9rem; }

/* Barra de acoes da aula: narracao, YouTube, aula extra — pilulas
   compactas numa linha (quebra no mobile), em vez de blocos largos. */
.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 24px 0;
}
.card-actions__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.card-actions__btn:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 14px rgba(37, 99, 255, 0.14);
    transform: translateY(-1px);
}
.card-actions__btn.is-active {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.card-actions__btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.card-actions__icon { font-size: 1rem; line-height: 1; }

/* ---- Barra de reprodução (narração/podcast em voz humana) ---- */
.audio-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin: -10px 0 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
}
.audio-player__time {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-muted);
    min-width: 34px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.audio-player__seek {
    flex: 1;
    height: 4px;
    accent-color: var(--color-primary);
    cursor: pointer;
}
.audio-player__skip {
    background: none;
    border: 0;
    padding: 4px 6px;
    color: var(--color-muted);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}
.audio-player__skip:hover { color: var(--color-primary); background: var(--color-primary-light); }

@media (max-width: 480px) {
    .audio-player { flex-wrap: wrap; padding: 10px 14px; }
    .audio-player__seek { order: 5; flex-basis: 100%; }
}

.card-view__done-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 12px 18px;
    border-radius: 12px;
    background: rgba(0, 230, 167, 0.12);
    border: 1px solid rgba(0, 230, 167, 0.35);
    color: var(--color-text);
    font-weight: 600;
}
.card-view__done-badge-score {
    font-weight: 400;
    color: var(--color-muted);
}


.btn--ghost {
    background: var(--color-surface);
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn--ghost.is-active {
    background: var(--color-primary);
    color: #fff;
}

/* Login com Google (ver auth/login.php e auth/register.php) */
.btn--google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--color-surface);
    color: var(--color-text);
    border: 2px solid var(--color-input-border);
}
.btn--google:hover { background: var(--color-primary-light); }

/* ---- Painel admin (ver AdminController) ---- */
.admin { padding-bottom: 40px; }
.admin__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}
.admin__header h1 { margin: 0; font-size: 1.4rem; }
.admin__nav { display: flex; gap: 6px; }
.admin__nav-link {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-muted);
    text-decoration: none;
}
.admin__nav-link:hover { background: var(--color-primary-light); }
.admin__nav-link.is-active { background: var(--color-primary); color: #fff; }

.admin__section-title { font-size: 1rem; margin: 28px 0 12px; }
.admin__empty { color: var(--color-muted); font-size: 0.92rem; }

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}
.admin-stat {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.admin-stat__label { font-size: 0.82rem; color: var(--color-muted); }
.admin-stat__value { font-size: 1.6rem; font-weight: 800; color: var(--color-primary); }
.admin-stat__hint { font-size: 0.78rem; color: var(--color-muted); }

.admin-search {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    max-width: 420px;
}
.admin-search input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--color-input-border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
}
.admin-search input:focus { outline: none; border-color: var(--color-primary); }
.admin-search .btn { padding: 10px 20px; }

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: 14px;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.admin-table th, .admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}
.admin-table th {
    background: var(--color-primary-light);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-muted);
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: var(--color-primary-light); }
.admin-table__hint { color: var(--color-muted); font-size: 0.82rem; }

.admin-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}
.admin-badge--success { background: var(--color-success-bg); color: var(--color-success); }
.admin-badge--warn { background: var(--color-danger-bg); color: var(--color-danger); }
.admin-badge--muted { background: var(--color-border); color: var(--color-muted); }
.admin-badge--btn { border: 0; cursor: pointer; font-family: inherit; }

.admin-coupon-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    align-items: end;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 28px;
}
.admin-coupon-form label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; }
.admin-coupon-form input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--color-input-border);
    border-radius: 10px;
    font-size: 0.92rem;
    font-family: inherit;
    background: var(--color-bg);
    color: var(--color-text);
}
.admin-coupon-form input:focus { outline: none; border-color: var(--color-primary); }
.admin-coupon-form .btn { white-space: nowrap; }

.coupon-toggle { margin-top: 16px; text-align: center; }
.coupon-toggle__btn {
    background: none;
    border: none;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px;
}
.coupon-form { margin-top: 12px; }
.coupon-form__input {
    padding: 12px 14px;
    border: 2px solid var(--color-input-border);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
    text-transform: uppercase;
}
.coupon-form__input:focus { outline: none; border-color: var(--color-primary); }

.entry__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 16px;
    color: var(--color-muted);
    font-size: 0.85rem;
}
.entry__divider::before,
.entry__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

/* ---- Ferramenta de notas ---- */
.card-view__hint { color: var(--color-muted); font-size: 0.85rem; margin: 8px 0 0; }
.card-view__content { user-select: text; }

/* botao flutuante que aparece ao selecionar texto */
.selection-toolbar {
    position: absolute;
    z-index: 50;
    display: flex;
    gap: 6px;
}
.selection-btn {
    background: var(--color-primary);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.selection-btn--meaning { background: var(--color-accent-deep); }

/* ---- Modal de significado (ver assets/js/notes.js + MeaningLookup) ---- */
.meaning-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.meaning-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 18, 32, 0.55);
}
.meaning-modal__card {
    position: relative;
    z-index: 1;
    background: var(--color-surface);
    border-radius: 16px;
    padding: 28px 24px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(13, 20, 40, 0.25);
}
.meaning-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: 0;
    font-size: 1.1rem;
    color: var(--color-muted);
    cursor: pointer;
    padding: 4px;
}
.meaning-modal__termo {
    font-weight: 700;
    color: var(--color-accent-deep);
    margin: 0 0 12px;
    padding-right: 24px;
}
.meaning-modal__loading { color: var(--color-muted); margin: 0; }
.meaning-modal__result p { margin: 0 0 12px; line-height: 1.6; }
.meaning-modal__exemplo {
    background: var(--color-primary-light);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
    color: var(--color-text);
}
.meaning-modal__card .alert { margin-top: 4px; }
.meaning-modal__card #meaning-modal-save { margin-top: 8px; }

/* formulario de nota */
.note-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 20px;
    margin-top: 16px;
    text-align: left;
}
.note-form h3 { margin: 0 0 4px; }
.note-form label { font-weight: 600; font-size: 0.85rem; }
.note-form textarea,
.note-form input[type="text"] {
    padding: 10px 12px;
    border: 2px solid var(--color-input-border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
}
.note-form textarea:focus,
.note-form input:focus { outline: none; border-color: var(--color-primary); }
.note-form__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* Form de nova nota dentro da coluna lateral: sem "card dentro de card" */
.card-notes .note-form {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    padding: 0 0 16px;
    margin: 0 0 16px;
}
.card-notes .note-form h3 { color: var(--color-primary); }

/* seletor de cores (marca-texto) */
.color-picker { display: flex; gap: 10px; margin: 4px 0; }
.color { cursor: pointer; }
.color input { position: absolute; opacity: 0; }
.color span {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid transparent;
}
.color--yellow span { background: #fdd835; }
.color--green span { background: #66bb6a; }
.color--pink span { background: #ec407a; }
.color--blue span { background: #42a5f5; }
.color input:checked + span { border-color: #1f2933; }

/* central de anotacoes */
.notes-page { padding: 32px 0; }
.notes-page__header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.notes-search { display: flex; gap: 8px; margin: 20px 0; flex-wrap: wrap; }
.notes-search input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 2px solid var(--color-input-border);
    border-radius: 10px;
    font-size: 0.95rem;
}
.notes-filter { color: var(--color-muted); font-size: 0.9rem; }
.notes-empty { color: var(--color-muted); padding: 32px 0; text-align: center; }

.new-note {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 24px;
}
.new-note summary { cursor: pointer; font-weight: 600; color: var(--color-primary); }
.new-note .note-form { border: 0; padding: 12px 0 0; margin: 0; }

.notes-group { margin-bottom: 28px; }
.notes-group__title {
    font-size: 1.1rem;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 6px;
}
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

/* card de uma nota */
.note-card {
    border-radius: 12px;
    padding: 16px;
    border-left: 6px solid #ccc;
}
.note-card--yellow { background: #fffde7; border-left-color: #fdd835; }
.note-card--green { background: #e8f5e9; border-left-color: #66bb6a; }
.note-card--pink { background: #fce4ec; border-left-color: #ec407a; }
.note-card--blue { background: #e3f2fd; border-left-color: #42a5f5; }

.note-card__highlight {
    margin: 0 0 10px;
    font-style: italic;
    border: 0;
    padding: 0;
}
.note-card__comment { margin: 0 0 10px; font-size: 0.92rem; }
.note-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag-chip {
    background: rgba(0, 0, 0, 0.06);
    color: #333;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    text-decoration: none;
}
.note-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--color-muted);
}
.note-card__actions { display: flex; align-items: center; gap: 10px; }
.note-card__actions a { color: var(--color-primary); text-decoration: none; }
.note-card__actions form { display: inline; }
.link-btn {
    background: none;
    border: 0;
    color: var(--color-danger);
    cursor: pointer;
    font-size: 0.78rem;
    padding: 0;
}

/* ---- Sidebar de anotações (coluna esquerda) ---- */
.card-notes {
    position: sticky;
    top: 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 16px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}
.card-notes__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}
.card-notes__head h2 { font-size: 1.05rem; margin: 0; }
.card-notes__close {
    display: none;
    background: none;
    border: 0;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-muted);
}
.card-notes__list { display: flex; flex-direction: column; gap: 12px; }
.card-notes__empty { color: var(--color-muted); font-size: 0.9rem; line-height: 1.5; margin: 0; }

.card-bibliography {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}
.card-bibliography h2 { font-size: 1.05rem; margin: 0 0 10px; }
.card-bibliography__list {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--color-muted);
    font-size: 0.88rem;
    line-height: 1.4;
}

/* Botao flutuante "Anotar" e fundo da gaveta: escondidos no desktop */
.notes-fab { display: none; }
.notes-overlay { display: none; }

@media (max-width: 480px) {
    .modules-grid { grid-template-columns: 1fr; }
}

/* No mobile as anotações viram uma gaveta lateral aberta pelo botao "Anotar" */
@media (max-width: 860px) {
    .card-layout { grid-template-columns: 1fr; }

    .card-notes {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(88vw, 340px);
        max-height: none;
        border: 0;
        border-radius: 0 16px 16px 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 60;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.25);
    }
    .card-notes.is-open { transform: translateX(0); }
    .card-notes__close { display: block; }

    .notes-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        border: 0;
        z-index: 55;
    }

    .notes-fab {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        position: fixed;
        left: 16px;
        bottom: 16px;
        z-index: 50;
        background: var(--color-primary);
        color: #fff;
        border: 0;
        border-radius: 999px;
        padding: 12px 18px;
        font-weight: 700;
        font-size: 0.95rem;
        cursor: pointer;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    }
    .notes-fab svg { display: block; }
}

.footer {
    padding: 24px 0;
    color: var(--color-muted);
    font-size: 0.85rem;
}
.footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.footer__inner p { margin: 0; }
.footer__inner a { color: var(--color-muted); text-decoration: underline; }
.footer__inner a:hover { color: var(--color-primary); }

/* ---- Aviso de cookies (LGPD) — ver layouts/end.php + assets/js/cookie-consent.js ---- */
.cookie-consent {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.16);
    padding: 16px 20px;
}
.cookie-consent__inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.cookie-consent__text {
    margin: 0;
    font-size: 0.86rem;
    color: var(--color-text);
    flex: 1;
    min-width: 240px;
}
.cookie-consent__text a { color: var(--color-primary); font-weight: 600; }
.cookie-consent__actions { flex-shrink: 0; }

@media (max-width: 640px) {
    .cookie-consent { padding: 14px 16px; }
    .cookie-consent__inner { flex-direction: column; align-items: stretch; text-align: center; }
    .cookie-consent__actions .btn { width: 100%; }
}

/* ---- Popup "adicionar a tela inicial" (so pra quem esta logado, 1x) ---- */
.a2hs-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.a2hs-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 18, 32, 0.55);
}
.a2hs-modal__card {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px 20px 0 0;
    padding: 28px 24px calc(24px + env(safe-area-inset-bottom, 0px));
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
}
.a2hs-modal__icon {
    display: block;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    margin: 0 auto 14px;
}
.a2hs-modal__card h2 { font-size: 1.15rem; margin: 0 0 10px; }
.a2hs-modal__card p { color: var(--color-muted); font-size: 0.9rem; margin: 0 0 20px; }
.a2hs-modal__actions { display: flex; gap: 10px; }
.a2hs-modal__actions .btn { flex: 1; padding: 12px 16px; }

@media (min-width: 640px) {
    .a2hs-modal { align-items: center; }
    .a2hs-modal__card { border-radius: 20px; }
}

/* ---- Modal de confirmacao generico (acoes irreversiveis/sensiveis —
   ver Views/partials/_rumo_modal.php + assets/js/rumo-trigger.js) ---- */
.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.confirm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 18, 32, 0.55);
}
.confirm-modal__card {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 28px 24px;
    margin: 0;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
}
.confirm-modal__icon { display: block; font-size: 2rem; margin: 0 auto 12px; }
.confirm-modal__card h2 { font-size: 1.15rem; margin: 0 0 14px; }
.confirm-modal__card p { color: var(--color-muted); font-size: 0.88rem; margin: 0 0 14px; text-align: left; line-height: 1.5; }
.confirm-modal__actions { display: flex; gap: 10px; margin-top: 6px; }
.confirm-modal__actions .btn { flex: 1; width: 100%; padding: 12px 16px; }

/* Variante horizontal de .levels (ver guest/perfil.php) — usada no modal de
   feedback de lote pra um sim/nao lado a lado, sem legenda/descricao. */
.levels--compact { flex-direction: row; }
.levels--compact .level-option { flex: 1; justify-content: center; padding: 12px; }

.confirm-modal__card textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--color-input-border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}
.confirm-modal__card textarea:focus { outline: none; border-color: var(--color-primary); }

/* ---- Ferramentas de debug (SOMENTE APP_DEBUG=true, nunca em producao) ----
   Recolhido por padrao num botao flutuante (FAB) pra nao atrapalhar o teste,
   principalmente no celular. O painel abre por cima do botao, ao clicar. */
.debug-dock {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
.debug-dock__toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #ff9800;
    background: #1a1023;
    color: #ff9800;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    opacity: 0.5;
    transition: opacity 0.15s;
}
.debug-dock__toggle:hover,
.debug-dock__toggle[aria-expanded="true"] { opacity: 1; }
.debug-dock__panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: min(78vw, 260px);
    padding: 10px;
    background: #1a1023;
    border: 1px solid #ff9800;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.debug-dock__label {
    color: #ff9800;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}
.debug-dock form { margin: 0; }
.debug-dock__btn {
    width: 100%;
    border: 1px solid #ff9800;
    background: transparent;
    color: #ffd699;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.8rem;
    cursor: pointer;
}
.debug-dock__btn:hover { background: rgba(255, 152, 0, 0.15); }
/* No celular, sobe acima da barra de navegacao inferior fixa */
@media (max-width: 768px) {
    .debug-dock { bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 12px); }
}

/* ---- Contador de dias para a prova ---- */
.exam-countdown {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    border: 1px solid rgba(47, 111, 78, 0.2);
    border-radius: 12px;
    padding: 10px 16px;
    margin: 14px 0;
    font-weight: 600;
}
.exam-countdown__icon { font-size: 1.1rem; }
.exam-countdown__alvo { color: var(--color-muted); font-weight: 500; }
.exam-countdown--soon { background: #fff4e5; color: #b45309; border-color: #fed7aa; }
.exam-countdown--past { background: #fdeceb; color: #b3261e; border-color: #f5c2c0; }
.exam-countdown--unknown { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.exam-countdown__action {
    background: none;
    border: 0;
    padding: 0;
    margin-left: 4px;
    color: var(--color-primary);
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
}

.data-prova-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: -6px 0 14px;
}
.data-prova-form label { font-size: 0.85rem; color: var(--color-muted); font-weight: 600; }

/* ---- Prontidao pra prestar (so modulo concurso, ver ReadinessCalculator) ---- */
.readiness { margin: 20px 0 8px; }
.readiness__info { font-size: 0.9rem; color: var(--color-muted); margin-bottom: 8px; }
.readiness__ready { color: var(--color-success); font-size: 0.95rem; }
.readiness__bar {
    height: 10px;
    background: var(--color-input-border);
    border-radius: 999px;
    overflow: hidden;
}
.readiness__bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: 999px;
    transition: width 0.6s ease;
}
.readiness__disclaimer {
    margin: 8px 0 0;
    font-size: 0.75rem;
    color: var(--color-muted);
    font-style: italic;
}

/* ---- Teste de nivelamento (quiz diagnostico) ---- */
.quiz { max-width: 720px; margin: 0 auto; padding: 32px 0; }
.quiz__head { text-align: center; margin-bottom: 24px; }
.quiz__form { display: flex; flex-direction: column; gap: 16px; }
.quiz__q {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 20px;
    margin: 0;
}
.quiz__legend {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-weight: 600;
    margin-bottom: 6px;
}
.quiz__num {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    font-size: 0.9rem;
}
.quiz__subject {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-primary);
    background: var(--color-primary-light);
    padding: 2px 8px;
    border-radius: 999px;
    margin-right: 6px;
}
.quiz__alt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 2px solid var(--color-input-border);
    border-radius: 10px;
    margin-top: 8px;
    cursor: pointer;
}
.quiz__alt:hover { border-color: var(--color-primary); }
.quiz__alt input { accent-color: var(--color-primary); }

/* Bonus opcional de treino de escrita no teste de fixacao, so nos modulos
   com redacao (ver CardController::tipoRedacaoFor + praticaEscrita()) —
   nunca conta pra aprovacao da fase, so feedback rapido da IA. */
.quiz__bonus {
    margin-top: 28px;
    padding: 20px;
    background: var(--color-accent-bg);
    border: 1px dashed rgba(23, 182, 255, 0.4);
    border-radius: 14px;
}
.quiz__bonus-title { margin: 0 0 4px; font-size: 1.05rem; }
.quiz__bonus-hint { margin: 0 0 14px; font-size: 0.85rem; color: var(--color-muted); }
.quiz__bonus-enunciado { margin: 0 0 12px; font-weight: 600; line-height: 1.5; }
.quiz__bonus-textarea {
    width: 100%;
    min-height: 130px;
    padding: 14px;
    border: 2px solid var(--color-input-border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.6;
    background: var(--color-surface);
    color: var(--color-text);
    resize: vertical;
    margin-bottom: 12px;
}
.quiz__bonus-textarea:focus { outline: none; border-color: var(--color-primary); }
.quiz__bonus-feedback {
    margin-top: 14px;
    padding: 14px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    font-size: 0.92rem;
    line-height: 1.55;
}

/* ---- Mensagem personalizada + revisao da prova diagnostica ---- */
.result-message {
    background: var(--color-primary-light);
    border: 1px solid rgba(37, 99, 255, 0.25);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 28px;
    line-height: 1.6;
    font-size: 1.02rem;
}

.result-message--success {
    background: var(--color-success-bg);
    border-color: rgba(0, 230, 167, 0.35);
    color: var(--color-success);
    font-weight: 600;
}
.result-message--retry {
    background: #fff4e5;
    border-color: #fed7aa;
    color: #b45309;
    font-weight: 600;
}

.result-choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz__review { margin-bottom: 24px; }
.quiz__review h2 { font-size: 1.1rem; margin-bottom: 12px; }

.quiz__alt--review { cursor: default; }
.quiz__alt--review:hover { border-color: var(--color-input-border); }
.quiz__alt--correta {
    border-color: #66bb6a;
    background: #e8f5e9;
    color: #1b5e20;
    font-weight: 600;
}
.quiz__alt--errada {
    border-color: #ec407a;
    background: #fce4ec;
    color: #880e4f;
    font-weight: 600;
}
.quiz__alt--naosei {
    border-color: #fdd835;
    background: #fffde7;
    color: #6b5b00;
}

/* ---- Tela de espera (frases iterativas enquanto a IA trabalha) ---- */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    min-height: 55vh;
    text-align: center;
    padding: 40px 20px;
}
.loading-screen__spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-primary-light);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: loading-screen-spin 0.9s linear infinite;
}
@keyframes loading-screen-spin {
    to { transform: rotate(360deg); }
}
.loading-screen__text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text);
    min-height: 1.4em;
    transition: opacity 0.15s ease;
}

/* ---- Dashboard de desempenho ---- */
.dashboard { padding: 32px 0; }
.dashboard__header { margin-bottom: 24px; }
.dashboard__lead { color: var(--color-muted); margin: 4px 0 0; }
.dashboard__section-title { font-size: 1.15rem; margin: 32px 0 4px; }
.dashboard__hint { color: var(--color-muted); font-size: 0.88rem; margin: 0 0 18px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stat-card__value { font-size: 1.8rem; font-weight: 700; }
.stat-card__label { font-size: 0.82rem; color: var(--color-muted); }

.stat-card--good .stat-card__value { color: var(--color-success); }
.stat-card--warn .stat-card__value { color: #b45309; }
.stat-card--bad .stat-card__value { color: var(--color-danger); }

.subject-list { display: flex; flex-direction: column; gap: 16px; }

.subject-row {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 16px 18px;
}
.subject-row__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.subject-row__name { font-weight: 700; }

.subject-row__bar {
    height: 8px;
    background: var(--color-input-border);
    border-radius: 999px;
    overflow: hidden;
}
.subject-row__fill { display: block; height: 100%; border-radius: 999px; }
.subject-row__fill--good { background: var(--color-success); }
.subject-row__fill--warn { background: #f0a34e; }
.subject-row__fill--bad { background: var(--color-danger); }

.subject-row__meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--color-muted);
    margin-top: 6px;
}

.badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.badge--good { background: var(--color-success-bg); color: var(--color-success); }
.badge--warn { background: #fff4e5; color: #b45309; }
.badge--bad { background: var(--color-danger-bg); color: var(--color-danger); }

.redacao-pending-list { display: flex; flex-direction: column; gap: 10px; }

.redacao-pending-row {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.redacao-pending-row__title { display: block; font-weight: 700; }
.redacao-pending-row__subject { display: block; font-size: 0.8rem; color: var(--color-muted); }
.redacao-pending-row__btn { font-size: 0.85rem; padding: 8px 16px; white-space: nowrap; }

/* Tela /conta: minhas trilhas + meu perfil (ver Views/account/index.php) */
.trilha-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.trilha-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 14px 18px;
}
.trilha-card--active { border-color: var(--color-primary); }
.trilha-card__icon { font-size: 1.3rem; }
.trilha-card__label { font-weight: 700; flex: 1; }
.trilha-card form { margin: 0; }
.trilha-list__nova { margin: 0 0 24px; }

.account-forms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.account-forms__card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 20px;
}
.account-forms__card .entry__form { margin-bottom: 0; }

/* ---- Pagamento e faturas (/conta) ---- */
.payment-status {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 16px;
}
.payment-status__row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.payment-status__card { margin: 12px 0 0; color: var(--color-muted); font-size: 0.9rem; }
.payment-status form { margin: 14px 0 0; }

.payment-history-wrap {
    overflow-x: auto;
    margin-bottom: 24px;
    border: 1px solid var(--color-border);
    border-radius: 14px;
}
.payment-history { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.payment-history th, .payment-history td {
    padding: 12px 16px;
    text-align: left;
    white-space: nowrap;
}
.payment-history thead { background: var(--color-bg); }
.payment-history th { font-size: 0.75rem; text-transform: uppercase; color: var(--color-muted); }
.payment-history tbody tr + tr { border-top: 1px solid var(--color-border); }

/* Paginas institucionais (ex: /politica-de-cookies — ver Views/legal/) */
.legal-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 12px 0 48px;
}
.legal-page h1 { font-size: 1.7rem; margin: 0 0 4px; }
.legal-page__updated { color: var(--color-muted); font-size: 0.85rem; margin: 0 0 28px; }
.legal-page h2 { font-size: 1.15rem; margin: 32px 0 10px; }
.legal-page p { line-height: 1.7; color: var(--color-text); }
.legal-page code {
    background: var(--color-primary-light);
    color: var(--color-primary);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.85em;
}

.legal-page__table-wrap { overflow-x: auto; margin: 16px 0; }
.legal-page__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.legal-page__table th,
.legal-page__table td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}
.legal-page__table th {
    color: var(--color-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ============================================================
   NAVEGACAO — item ativo + barra inferior fixa no mobile
   Padrao de apps (Duolingo/Instagram/Nubank): no desktop os
   destinos ficam na topbar; no celular viram uma tab bar fixa
   embaixo, com a topbar enxuta (logo + tema + conta).
   ============================================================ */

/* Destino ativo destacado na topbar (desktop) */
.topbar__links { display: flex; align-items: center; gap: 18px; }
.topbar__link.is-active { color: var(--color-primary); }

/* Barra inferior — escondida no desktop, vira flex no mobile */
.mobile-nav { display: none; }

@media (max-width: 768px) {
    /* Topbar enxuta: os links de texto viram a barra inferior */
    .topbar__links { display: none; }
    .topbar__inner { flex-wrap: nowrap; gap: 8px; }
    .topbar nav { flex-wrap: nowrap; gap: 8px; }

    /* Tab bar fixa no rodape, com respeito a area segura do iOS (notch) */
    .mobile-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 30;
        background: var(--color-surface);
        border-top: 1px solid var(--color-border);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.07);
    }
    .mobile-nav__tab {
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 56px;
        padding: 8px 4px 7px;
        color: var(--color-muted);
        text-decoration: none;
        font-size: 0.62rem;
        font-weight: 600;
        line-height: 1;
    }
    .mobile-nav__tab svg {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }
    .mobile-nav__tab span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-nav__tab.is-active { color: var(--color-primary); }
    .mobile-nav__tab.is-active svg { stroke-width: 2.4; }
    .mobile-nav__tab:active { background: var(--color-primary-light); }

    /* Conteudo nao fica escondido atras da barra fixa (so quando ela existe) */
    body:has(.mobile-nav) {
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    }

    /* O menu da conta vira um bottom sheet, ancorado acima da tab bar */
    .account-menu__panel {
        position: fixed;
        left: 8px;
        right: 8px;
        top: auto;
        bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 10px);
        min-width: 0;
        max-height: 68vh;
        overflow-y: auto;
        z-index: 40;
    }
}
