/* =============================================================================
 * atrilha — folha de estilo de produção (CSS puro, sem Tailwind)
 *
 * Servida pelo Spring Boot em /css/app.css a partir de
 * src/main/resources/static/css/app.css.
 *
 * Origens dos tokens:
 *   - doc/UX/01-design-tokens.md §10 — os tokens saíram para tokens.css
 *     (Story 1.2); aqui resta só `color-scheme`.
 *   - doc/UX/02-componentes-base.md §9 — tokens de componente (botão, input, card)
 * ============================================================================= */

/* Os @font-face da marca vivem em css/fonts.css — arquivo único carregado por
   app.html, estudo.html e public.html (extraído daqui na US-117). */

:root {
    color-scheme: light;
}

@media (forced-colors: active) {
    /* `!important` NÃO é preguiça — é o que devolve a força que o
       desaninhamento tirou. Dentro do `:root` esta regra valia `& :focus-visible`,
       ou seja (0,2,0), porque `&` herda a especificidade do pai. Solta, vale
       (0,1,0) — e perde para `admin.css:250`, que é (0,1,1) e faz
       `outline: none`. Sob `forced-colors` o `box-shadow` que o admin põe no
       lugar é DESCARTADO, então o admin inteiro ficaria sem indicador de foco:
       exatamente o defeito "total" que `admin.css:153-158` descreve e que esta
       rede existe para impedir. */
    :focus-visible {
        outline: 2px solid Highlight !important;
        outline-offset: 2px !important;
    }

    /* `:focus-within` fica de fora do `:root` de propósito. Ele já casa toda a
       cadeia de ancestrais; incluir o elemento raiz desenha um contorno em
       volta do documento inteiro a cada foco, aninhando retângulos justamente
       para quem liga o alto contraste para conseguir ler. Aninhado, o `&` o
       excluía — aqui o `:not(:root)` faz o mesmo, explícito. */
    :focus-within:not(:root) {
        outline: 2px solid Highlight;
        outline-offset: 2px;
    }
}


/* =============================================================================
 * Reset / Base
 *
 * Reset mínimo: box-sizing border-box em tudo (garante que width/height
 * incluam padding+border, o que faz inputs e botões com width:100% alinharem
 * com seus contêineres em vez de extrapolar). Form controls (button, input,
 * select, textarea, a) herdam font/line-height para não desbalancearem com
 * o body — sem isso o <a> com line-height 1.5 fica mais alto que o <button>
 * (line-height normal ~1.2), gerando botões visualmente desiguais.
 * ============================================================================= */

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

button,
input,
select,
textarea {
    font: inherit;
    line-height: inherit;
    color: inherit;
}

body {
    background: var(--color-bg);
    color: var(--color-text-body);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.5;
    /* Remove os 8px de margin padrão do navegador: header, footer e seções
     * full-bleed encostam nas bordas da tela (100% de largura, sem folga). */
    margin: 0;
}

h1,
h2,
h3 {
    color: var(--color-text-display);
    font-family: var(--font-display);
    font-weight: var(--font-weight-semibold);
    line-height: 1.15;
    margin: 0;
}

h1 {
    font-size: var(--text-2xl);
}
h2 {
    font-size: var(--text-xl);
}
h3 {
    font-size: var(--text-lg);
    font-family: var(--font-sans);
}

a {
    text-decoration: none;
}

li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.overline {
    color: var(--color-text-muted);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--tracking-overline);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
}

a {
    color: var(--color-text-link);
}

/* =============================================================================
 * Marca (chore-ux-001 §3)
 * ============================================================================= */

.brand {
    align-items: center;
    display: inline-flex;
    gap: 9px;
    text-decoration: none;
}
/* O SVG já é o tile coral (rect rx) + os traços; o .brand-mark só dá o tamanho
   por contexto (base 28px; ver overrides em .public-header / .app-header). */
.brand-mark {
    width: 28px;
    height: 28px;
    display: inline-flex;
}
.brand-mark svg {
    width: 100%;
    height: 100%;
    display: block;
    /* Sombra coral suave sob o tile (hugs os cantos arredondados via drop-shadow). */
    filter: drop-shadow(var(--brand-mark-shadow));
}
.brand-mark rect {
    fill: var(--color-primary);
}
.brand-mark g {
    stroke: var(--color-on-primary);
}
.brand-wordmark {
    font-family: var(--font-brand);
    font-weight: var(--font-weight-bold);
    font-size: 17px;
    letter-spacing: -0.2px;
    color: #211c18; /* tom de marca do wordmark (fora da escala neutra) */
}

.back-link {
    margin-top: var(--space-8);
    text-align: center;
    font-size: var(--text-sm);
}
.back-link a {
    color: var(--color-text-muted);
}

/* =============================================================================
 * Botão (chore-ux-003 §1)
 * ============================================================================= */

.btn {
    align-items: center;
    border: 0;
    border-radius: var(--button-radius);
    cursor: pointer;
    display: inline-flex;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    justify-content: center;
    min-height: var(--button-min-height-md);
    padding: var(--space-3) var(--button-padding-x-md);
    text-decoration: none;
    transition: background-color var(--duration-fast) var(--ease-out-soft);
}
.btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}
/* `box-shadow` é propriedade única: a regra acima (0,2,0) vence `.btn-primary`
   (0,1,0) e APAGAVA o brilho coral do botão principal do app — ele achatava e
   perdia o realce interno no instante em que recebia foco. Somar as duas
   devolve a elevação sem tirar o anel. */
.btn-primary:focus-visible {
    box-shadow: var(--shadow-focus), var(--button-primary-shadow);
}
/* Botão primário (coral) — componente reutilizável do app. Herda layout/raio
   pílula da base .btn; aqui ficam as props da marca: altura fixa, largura cheia,
   fonte Hanken Grotesk 700, e a sombra de duas camadas (brilho coral + realce
   interno). Aplicado a todo elemento .btn-primary, então propaga para todas as
   telas que já usam a classe. */
.btn-primary {
    width: 100%;
    height: var(--button-primary-height);
    gap: var(--space-2);
    background: var(--button-primary-bg);
    color: var(--button-primary-text);
    border: none;
    font-family: var(--button-primary-font);
    font-weight: var(--font-weight-bold);
    font-size: 16.5px;
    letter-spacing: 0.1px;
    white-space: nowrap;
    box-shadow: var(--button-primary-shadow);
    transition:
        background-color var(--duration-fast) var(--ease-out-soft),
        transform var(--duration-fast) var(--ease-out-soft);
}
.btn-primary:hover {
    background: var(--button-primary-bg-hover);
}
.btn-primary:active {
    background: var(--button-primary-bg-active);
    transform: translateY(1px);
}
.btn-primary:disabled,
.btn-primary[aria-disabled="true"] {
    background: var(--button-primary-bg-disabled);
    color: var(--button-primary-text-disabled);
    box-shadow: none;
    cursor: default;
}
.btn-lg {
    font-size: var(--text-base);
    min-height: var(--space-12);
    padding-left: var(--button-padding-x-lg);
    padding-right: var(--button-padding-x-lg);
    width: 100%;
}
@media (min-width: 640px) {
    .btn-lg {
        width: auto;
        min-width: 240px;
    }
}

/* =============================================================================
 * Input (chore-ux-003 §2)
 * ============================================================================= */

.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}
.input-label {
    color: var(--color-text-body);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
}
.input-field {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--input-radius);
    color: var(--color-text-body);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    min-height: var(--input-min-height);
    padding: var(--space-3) var(--input-padding-x);
    transition: border-color var(--duration-fast) var(--ease-out-soft);
    width: 100%;
}
.input-field:focus {
    border-color: var(--input-border-focus);
    outline: none;
    box-shadow: var(--shadow-focus);
}
.input-field:hover:not([readonly]):not(:disabled) {
    border-color: var(--color-border-strong);
}
/* Padroniza visual do input[type="date"] em todos os browsers/mobile.
   -webkit-date-and-time-value mantém a fonte herdada do parent (resolve o
   visual "travado" com fonte/size nativos no iOS Safari).
   appearance: none remove estilização residual em alguns browsers. */
input[type="date"] {
    -webkit-date-and-time-value: match-parent;
    appearance: textfield;
}

.input-field--file {
    padding: var(--space-2) var(--input-padding-x);
}
.input-field[readonly] {
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    cursor: not-allowed;
}
.input-field[readonly]:focus {
    box-shadow: none;
    border-color: var(--color-border);
}
/* Campo desabilitado: MESMO tratamento do `[readonly]` logo acima.
   Não existia — e a falta só apareceu quando a Story 4.5 passou a desabilitar
   campos por falta de rede. Medido antes: o campo travado ficava com fundo
   branco e texto na mesma cor do livre, e a única diferença era o
   `cursor: not-allowed`, que em tela de TOQUE não existe. Numa história chamada
   "As telas do toque", o sinal de "travado" era invisível justamente no toque. */
.input-field:disabled {
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    cursor: not-allowed;
}
.input-group--error .input-field {
    border-color: var(--color-danger-700);
}
.input-helper {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    margin: 0;
}
.input-error {
    color: var(--color-danger-700);
    font-size: var(--text-xs);
    margin: 0;
}

/* Aviso de formulário travado por falta de rede (Story 4.5, `offline-forms.js`).
 *
 * `warning`, não `danger`: ficar sem rede não é erro de quem está usando o app,
 * e vermelho num formulário de Ajustes lê como "você fez algo errado". Mesma
 * família do cartão de retentativa do Hoje, pelo mesmo motivo.
 *
 * Contraste medido: `warning-700` sobre `warning-100` dá 5,04:1 — acima do piso
 * de 4,5:1 do SC 1.4.3. Sob `forced-colors` o preenchimento é descartado, então
 * a borda de 1px é o que resta e é o que mantém o bloco separado do formulário. */
.offline-lock__aviso {
    background: var(--color-warning-100);
    border: 1px solid var(--color-warning-500);
    border-radius: var(--radius-md);
    color: var(--color-warning-700);
    font-size: var(--text-sm);
    line-height: 1.45;
    margin: 0 0 var(--space-4);
    padding: var(--space-3) var(--space-4);
}

/* Campo travado pela falta de rede: o mesmo esmaecido de `:disabled` do resto
   do sistema, mais o cursor que diz "não é aqui". O seletor de atributo é o que
   distingue do `disabled` de outra origem — este some quando a rede volta. */
.offline-lock__aviso[hidden] {
    display: none;
}
[data-offline-travado] {
    cursor: not-allowed;
}

/* Checklist de requisitos de senha (feedback em tempo real — Alpine) */
.pw-rules {
    list-style: none;
    margin: var(--space-2) 0 0;
    padding: 0;
    display: grid;
    gap: var(--space-1);
}
.pw-rule {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin: 0;
}
.pw-rule__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 10px;
    line-height: 1;
}
.pw-rule--ok {
    color: var(--color-success-700);
}
.pw-rule--ok .pw-rule__icon {
    background: var(--color-success-500);
    color: #fff;
}
.pw-rule--ok .pw-rule__icon::before {
    content: "✓";
}
.pw-rule--bad {
    color: var(--color-danger-700);
}
.pw-rule--bad .pw-rule__icon {
    background: var(--color-danger-100);
    border: 1px solid var(--color-danger-500);
}
.pw-rule--bad .pw-rule__icon::before {
    content: "•";
    color: var(--color-danger-700);
}

/* Campo read-only com ícone posicionado à direita */
.readonly-wrap {
    position: relative;
}
.readonly-wrap .input-field {
    padding-right: var(--space-10);
}
.readonly-icon {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

/* =============================================================================
 * Card (chore-ux-003 §3)
 * ============================================================================= */

.card {
    background: var(--card-bg);
    border: 1px solid var(--color-divider);
    border-radius: var(--card-radius);
    display: block;
    padding: var(--card-padding);
}
/* Variante default da spec UX (chore-ux-003 §3.3): fundo de superfície,
 * borda divisória, sem sombra. Visualmente equivalente a `.card` base —
 * declarada explicitamente para honrar o contrato CSS<->spec<->markup
 * (card--${variant ?: 'flat'}, §3.8) e servir como ponto de extensão único
 * quando a variante divergir da base (ex.: borda atenuada em densidade alta).
 *
 * Nota: declaramos `display: block` (já herdado de `.card`) para impedir que
 * o minificador do Tailwind v4 descarte o seletor vazio durante o build.
 * Não redeclaramos background, border nem border-radius — o contrato da
 * spec §3.3 é exatamente herdar essas propriedades de `.card`. */
.card--flat {
    display: block;
}
.card--dense {
    padding: var(--card-padding-dense);
}
.card--interactive {
    color: inherit;
    text-decoration: none;
    transition:
        box-shadow var(--duration-base) var(--ease-out-soft),
        transform var(--duration-base) var(--ease-out-soft);
}
.card--interactive:hover {
    box-shadow: var(--card-shadow-raised-hover);
}
.card--interactive:focus-visible {
    box-shadow: var(--shadow-focus);
    outline: none;
}
/* Corte global de movimento do shell (Story 3.5). Não existia: o shell tinha só
   dois cortes pontuais, e as animações infinitas de `trilha.css` (medalha, pino)
   e `versiculos.css` (brilho) rodavam mesmo com a preferência ativa. O
   `animation-iteration-count` é o que de fato para — zerar só a duração num
   ciclo `infinite` vira tremor de alta frequência. */
@media (prefers-reduced-motion: reduce) {
    /* O spinner é EXCEÇÃO, e precisa ser explícita. Ele é o único sinal de
       progresso em quatro telas de Ajustes; com o corte global parava em 0° e a
       tela ficava parecendo travada. Giro contínuo e uniforme é movimento
       essencial — o que a preferência combate é paralaxe, deslize e salto. */
    .spinner {
        animation-duration: .7s !important;
        animation-iteration-count: infinite !important;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    .card--interactive {
        transition: none;
    }
}

/* =============================================================================
 * Telas específicas (US-002 — cadastro via Google, descontinuado)
 *
 * doc/UX/us-002-spec.md §§3–4
 * ============================================================================= */

/* ----- Botão secundário (usado no "Cadastrar com e-mail e senha") ----- */
.btn-secondary {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-display);
}
.btn-secondary:hover {
    background: var(--color-surface-muted);
}
.btn-secondary:active {
    background: var(--color-neutral-200);
}

/* ----- Botão fantasma (link visual, usado no "Cancelar") ----- */
.btn-ghost {
    background: transparent;
    color: var(--color-text-body);
}
.btn-ghost:hover {
    background: var(--color-surface-muted);
}

/* ----- Botão destrutivo (CTA de exclusão irreversível — US-068) ----- */
/* Paleta danger-100/danger-700 (nunca danger-500 de fundo) — 02-componentes-base §1.3. */
.btn-destructive {
    width: 100%;
    height: var(--button-primary-height);
    gap: var(--space-2);
    background: var(--color-danger-700);
    color: #ffffff;
    border: none;
    font-weight: var(--font-weight-bold);
    font-size: 16.5px;
    white-space: nowrap;
    transition:
        background-color var(--duration-fast) var(--ease-out-soft),
        transform var(--duration-fast) var(--ease-out-soft);
}
.btn-destructive:hover { filter: brightness(0.94); }
.btn-destructive:active { transform: translateY(1px); }
.btn-destructive:disabled,
.btn-destructive[aria-disabled="true"] {
    background: var(--color-neutral-200);
    color: var(--color-text-muted);
    cursor: default;
    filter: none;
}

.btn-md {
    font-size: var(--text-base);
    min-height: var(--button-min-height-md);
    padding-left: var(--button-padding-x-md);
    padding-right: var(--button-padding-x-md);
}

/* ----- Alertas (toast inline com ícone + texto) ----- */
.alert {
    align-items: flex-start;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    display: flex;
    font-size: var(--text-sm);
    gap: var(--space-3);
    line-height: 1.45;
    padding: var(--space-3) var(--space-4);
}
.alert svg {
    flex-shrink: 0;
    height: 18px;
    margin-top: 1px;
    width: 18px;
}
.alert p,
.alert span {
    margin: 0;
}
.alert p + p {
    margin-top: var(--space-2);
}
.alert--info {
    background: var(--color-info-100);
    border-color: var(--color-info-500);
    color: var(--color-info-700);
}
.alert--warning {
    background: var(--color-warning-100);
    border-color: var(--color-warning-500);
    color: var(--color-warning-700);
}
.alert--error {
    background: var(--color-danger-100);
    border-color: var(--color-danger-500);
    color: var(--color-danger-700);
}
.alert--success {
    background: var(--color-success-100);
    border-color: var(--color-success-500);
    color: var(--color-success-700);
}

/* ----- Toast flutuante (alerta sobreposto; não empurra o conteúdo) -----
 * Reaproveita .alert (layout ícone+texto + cores .alert--*) e só sobrepõe o
 * posicionamento: fixo no rodapé (padrão snackbar mobile), centralizado, com
 * sombra. A centralização usa left/right + margin auto (sem transform) para
 * liberar o transform às transições de entrada/saída do Alpine (.toast-off /
 * .toast-on). Fragment: layout/fragments/toast.html.
 */
.toast {
    position: fixed;
    bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
    left: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-toast);
    width: max-content;
    max-width: min(30rem, calc(100% - 2 * var(--space-4)));
    margin-inline: auto;
    align-items: center;
    box-shadow: var(--shadow-lg);
}
/* Nas telas com bottom-nav (.app-shell), sobe o toast para ficar acima do menu;
   nas públicas (.public-shell, sem nav) vale o bottom padrão acima. */
.app-shell .toast {
    /* Derivado do token do dock, não de `--space-11`: aquele número foi
       calibrado quando o dock tinha 56px, e com os 64px da Story 3.1 o toast
       pousava 8px DENTRO das abas. Ele tem z-index maior, então não sumia —
       cobria. Numa história chamada "o cromo do toque para de colidir", foi o
       único da família que ficou no número mágico. */
    bottom: calc(var(--app-bottom-nav-h) + var(--space-3) + env(safe-area-inset-bottom));
}
.toast__close {
    flex-shrink: 0;
    margin-left: var(--space-2);
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    /* Zera o chrome nativo do <button> (fundo/borda do user-agent): sem isso,
       com border-radius:full ele vira um círculo cinza ao redor do X, com o
       hover nativo do navegador. */
    background: none;
    border: 0;
    padding: 0;
    border-radius: var(--radius-full);
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--duration-fast) var(--ease-out-soft);
}
.toast__close:hover {
    opacity: 1;
}
.toast__close svg {
    width: 14px;
    height: 14px;
    margin: 0;
}
.toast-trans {
    transition:
        opacity var(--duration-base) var(--ease-out-soft),
        transform var(--duration-base) var(--ease-out-soft);
}
.toast-off {
    opacity: 0;
    transform: translateY(12px);
}
.toast-on {
    opacity: 1;
    transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
    .toast-off {
        transform: none;
    }
}

/* x-cloak: evita "flash of unstyled content" antes do Alpine inicializar. */
[x-cloak] {
    display: none !important;
}

/* ----- Tela 4 — cadastro concluído (placeholder) ----- */
.cadastro-concluido {
    text-align: center;
}
.cadastro-concluido__icon {
    color: var(--color-success-500);
    margin: var(--space-8) auto var(--space-4);
}
.cadastro-concluido__lead {
    color: var(--color-text-muted);
    margin: var(--space-3) 0 var(--space-8);
}
.cadastro-concluido__next {
    margin: var(--space-6) auto;
    text-align: left;
}
.cadastro-concluido__cta {
    margin-top: var(--space-6);
}

/* =============================================================================
 * Shell do app autenticado (layout/base.html) e fragments compartilhados
 * Substituem utilitários Tailwind que estavam inline nos templates.
 * ============================================================================= */

.app-shell {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--color-bg);
    color: var(--color-text-display);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* Permite seções full-bleed (ex.: faixa do mapa em /trilha) usarem 100vw sem
     * gerar barra de rolagem horizontal por causa da largura da scrollbar vertical. */
    overflow-x: hidden;
}
.app-main {
    flex: 1;
    margin: 0 auto;
    max-width: 60rem;
    padding: var(--space-6) var(--space-4);
    width: 100%;
}

.site-footer {
    border-top: 1px solid var(--color-divider);
    margin-top: var(--space-12);
}
.site-footer__inner {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin: 0 auto;
    max-width: 60rem;
    padding: var(--space-4);
}

/* Banner âmbar de verificação de e-mail (layout/fragments/email-verification-banner.html) */
.email-verify-banner {
    background: var(--color-warning-100);
    border-bottom: 1px solid var(--color-warning-500);
    color: var(--color-text-body);
    font-size: var(--text-sm);
    padding: var(--space-3) var(--space-4);
}
.email-verify-banner__row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: space-between;
    margin: 0 auto;
    max-width: 60rem;
}
.email-verify-banner__actions {
    align-items: center;
    display: flex;
    gap: var(--space-3);
}
.email-verify-banner__link {
    color: var(--color-warning-700);
    font-weight: var(--font-weight-medium);
    text-decoration: underline;
}
.email-verify-banner__link:hover {
    color: var(--color-neutral-900);
}
.email-verify-banner__close {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--color-warning-700);
    cursor: pointer;
    display: inline-flex;
    height: var(--space-11);
    justify-content: center;
    width: var(--space-11);
}

/* Modificador para botões com largura total (substitui w-full inline). */
.btn--block {
    width: 100%;
}

/* =============================================================================
 * Header público (back + marca) — usado em /comecar, /login e
 * /cadastro via fragmento
 * layout/fragments/public-header :: public-header.
 * Substitui .comecar__header/.login__header/.header e
 * .comecar__back/.login__back/.icon-button (consolidação chore-86 §fragments).
 * ============================================================================= */

/* Dois headers, mesma estrutura — marca centrada, voltar opcional flutuando à
   esquerda (absoluto, p/ a marca seguir centrada), divisor inferior, sticky.
   Diferem apenas no fundo: público = fundo da página; logado = branco. */
.public-header,
.app-header {
    align-items: center;
    border-bottom: 1px solid var(--color-divider);
    display: flex;
    justify-content: center;
    min-height: 56px;
    padding: var(--space-3) var(--space-4);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}
.public-header {
    background: var(--color-bg); /* igual à home — funde com o fundo da página */
}
.app-header {
    background: var(--color-surface); /* área logada — fundo branco */
}

/* Botão voltar — compartilhado pelos dois headers. */
.header-back {
    align-items: center;
    border-radius: var(--radius-md);
    color: var(--color-text-body);
    display: inline-grid;
    left: var(--space-3);
    min-height: var(--space-11);
    min-width: var(--space-11);
    place-items: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: background-color var(--duration-fast) var(--ease-out-soft);
}
.header-back:hover {
    background: var(--color-surface-muted);
}
.header-back svg {
    display: block;
    height: 20px;
    width: 20px;
}

/* Tamanho do logo nos headers (paridade com a home: tile de 32px). */
.public-header .brand,
.app-header .brand {
    font-size: var(--text-base);
}
.public-header .brand-mark,
.app-header .brand-mark {
    height: 32px;
    width: 32px;
}
.public-header .brand-mark svg,
.app-header .brand-mark svg {
    height: 100%;
    width: 100%;
}

/* =============================================================================
 * Código de vinculação — 6 dígitos (usado na tela /vincular)
 * ============================================================================= */

.codigo-grid {
    display: flex;
    gap: var(--space-2);
    justify-content: center;
    margin-bottom: var(--space-4);
}

.codigo-grid__digit {
    width: 3rem;
    height: var(--input-min-height);
    text-align: center;
    font-family: var(--font-mono, monospace);
    font-size: var(--text-2xl);
    /* medium, não semibold: `--font-mono` self-hospeda SÓ o peso 500
       (fonts.css:87-94), e pedir 600 faz o navegador sintetizar negrito,
       engordando o traço e alterando o avanço. Ressalva honesta: este bloco
       `.codigo-grid*` NÃO é renderizado por template nenhum hoje — a correção
       é preventiva, não um defeito visível. A primeira versão do registro o
       descreveu como "achado real numa grade de dígitos"; não é. */
    font-weight: var(--font-weight-medium);
    letter-spacing: 0.15em;
    /* Reutiliza tokens de .input-field */
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--input-radius);
    color: var(--color-text-body);
    transition: border-color var(--duration-fast) var(--ease-out-soft);
}

.codigo-grid__digit:focus {
    border-color: var(--input-border-focus);
    outline: none;
    box-shadow: var(--shadow-focus);
}

/* Responsivo: reduzir em telas pequenas */
@media (max-width: 360px) {
    .codigo-grid__digit {
        width: 2.5rem;
        font-size: var(--text-xl);
    }
}

/* =============================================================================
 * Perfil — edição (US-009-b)
 * ============================================================================= */

/* A tela de Perfil é uma SEÇÃO de Ajustes como as outras e usa a classe .main
 * junto com esta. Antes ela carregava padding e max-width próprios, e o efeito
 * era visível: o cabeçalho nascia 32px mais abaixo e 16px mais recuado que o de
 * Segurança, Geral ou Meus dados. No modo grande, onde a nav de seções fica ao
 * lado e trocar de seção é um clique, o h1 pulava — é a comparação mais fácil de
 * fazer naquela tela.
 *
 * Sobra só o respiro inferior, que não é decoração: a save-bar é sticky e sem
 * essa folga ela cobre o último campo. */
.profile-edit-page {
    padding-block-end: var(--space-12);
}

/* Avatar block */
.avatar-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
}

/* Wrapper que posiciona o badge da câmera sobre o avatar sem que o overflow do
   círculo o recorte (o badge é irmão do .avatar-circle, não filho). */
.avatar-photo {
    position: relative;
    width: 112px;
    height: 112px;
}

.avatar-circle {
    width: 112px;
    height: 112px;
    border-radius: var(--radius-full);
    background-color: var(--color-primary-100);
    display: grid;
    place-items: center;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.avatar-circle.has-photo {
    background-color: transparent;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-initial {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary-700);
    text-transform: uppercase;
}

.camera-badge {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background-color: var(--color-primary);
    color: var(--color-on-primary);
    border: 3px solid var(--color-surface);
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
    transition: background-color var(--duration-fast) var(--ease-out-soft);
}

.camera-badge:hover {
    background-color: var(--color-primary-hover);
}

.avatar-name {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-display);
    margin: 0;
}

.avatar-email {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    word-break: break-all;
    text-align: center;
    margin: 0;
}

.lock-icon {
    opacity: 0.5;
}

/* input-field.has-error — override para perfil */
.input-field.has-error {
    border-color: var(--color-danger-700);
}

/* Nav section (Segurança) */
.nav-section {
    margin-top: var(--space-8);
}

.nav-section-title {
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--tracking-overline);
    text-transform: uppercase;
    color: var(--color-text-muted);
    padding: 0 var(--space-2);
    margin-bottom: var(--space-2);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-sm);
    min-height: var(--space-12);
    color: inherit;
    text-decoration: none;
    transition: background-color var(--duration-fast) var(--ease-out-soft);
}

.nav-link:hover {
    background: var(--color-surface-muted);
}
/* Espaço entre cartões irmãos do mesmo grupo.
 *
 * Até a Story 1.2 do épico de Ajustes, TODA .nav-section tinha exatamente um
 * .nav-link — Conta→Segurança, Preferências→Notificações, Privacidade→Meus
 * dados — e a falta de espaçamento nunca apareceu. Com Perfil entrando no grupo
 * Conta, os dois cartões encostavam: as duas bordas de 1px formavam uma costura
 * de 2px e os cartões viravam um painel único com um risco no meio. No modo
 * escuro fica pior, porque os cantos arredondados internos somem.
 *
 * Regra de irmão adjacente em vez de flex+gap na .nav-section de propósito: o
 * .nav-section-title já tem margin-bottom calibrado, e trocar para gap somaria
 * dois espaçamentos. */
.nav-section .nav-link + .nav-link {
    margin-top: var(--space-3);
}


.nav-link-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--color-info-100);
    color: var(--color-info-700);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.nav-link-icon svg {
    width: 20px;
    height: 20px;
}

.nav-link-text {
    flex: 1;
    min-width: 0;
}

.nav-link-title {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-display);
    margin-bottom: 2px;
}

.nav-link-desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.nav-link-chevron {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.nav-link-chevron svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Save bar (sticky no rodapé quando dirty) */
.save-bar {
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    background: linear-gradient(
        180deg,
        rgba(247, 244, 241, 0) 0%,
        var(--color-bg) 40%
    );
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: spin 0.7s linear infinite;
}

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

/* Modal overlay (diálogos de confirmação) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(26, 22, 20, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: var(--space-4);
}

.modal {
    width: 100%;
    max-width: 24rem;
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.modal-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--color-warning-100);
    color: var(--color-warning-700);
    display: grid;
    place-items: center;
    margin: 0 auto var(--space-4);
}

.modal-icon svg {
    width: 28px;
    height: 28px;
}

.modal h2 {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-display);
    margin-bottom: var(--space-2);
}

.modal p {
    font-size: var(--text-sm);
    color: var(--color-text-body);
    line-height: 1.5;
    margin-bottom: var(--space-5);
}

/* ---------------------------------------------------------------------------
 * Padrões §8.2 da US-011 (section/action, btn-outline-danger, modal-check,
 * modal-title/text/actions). Aditivo; somente custom properties existentes.
 * ------------------------------------------------------------------------- */

/* Section (card de configurações) — spec §3.4 */
.section {
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: var(--space-5);
}

.section-title {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-overline);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-muted);
    padding: var(--space-3) var(--space-5) var(--space-1);
}

/* Action (item de ação) — spec §3.5 */
.action {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-5);
}

.action + .action {
    border-top: 1px solid var(--color-divider);
}

.action-header {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
}

.action-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--color-warning-100);
    color: var(--color-warning-700);
    flex-shrink: 0;
    display: grid;
    place-items: center;
}

.action-icon svg {
    width: 20px;
    height: 20px;
}

.action-title {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-display);
    margin-bottom: var(--space-1);
}

.action-desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    line-height: 1.45;
}

/* =============================================================================
 * Linha de ajustes (.section-row) — usada dentro do shell .section na tela
 * Segurança. Cada linha é um item clicável (tile + texto + chevron) empilhado
 * com divisória. Variante --danger pinta fundo/título/ícone/chevron em coral;
 * --static é a linha inerte ("Em breve").
 * ============================================================================= */
.section-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-4) var(--space-4);
    background: transparent;
    border: 0;
    text-align: left;
    font-family: var(--font-sans);
    color: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background-color var(--duration-fast) var(--ease-out-soft);
}
.section-row + .section-row {
    border-top: 1px solid var(--color-divider);
}
/* Anel INSET: `.section` tem `overflow: hidden` e nenhum padding, e a linha
   ocupa a largura inteira — qualquer anel outset (inclusive o contorno padrão
   do navegador) é recortado nos quatro lados. Sem isto, a linha de excluir
   conta em Ajustes › Segurança não mostrava foco NENHUM. */
.section-row:focus-visible {
    outline: none;
    box-shadow:
        inset 0 0 0 3px var(--color-bg),
        inset 0 0 0 6px var(--color-focus-ring);
}

.section-row:hover {
    background: var(--color-surface-muted);
}
.section-row--danger,
.section-row--danger:hover {
    background: var(--color-primary-tint);
}
.section-row--static {
    align-items: flex-start;
    cursor: default;
}
.section-row--static:hover {
    background: transparent;
}

.section-row-tile {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    display: grid;
    place-items: center;
}
.section-row-tile svg {
    width: 22px;
    height: 22px;
}
.section-row-tile--neutral {
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
}
.section-row-tile--danger {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.section-row-text {
    flex: 1;
    min-width: 0;
}
.section-row-title-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.section-row-title {
    display: block;
    font-size: var(--text-base);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-display);
}
.section-row-desc {
    display: block;
    font-size: var(--text-sm);
    line-height: 1.4;
    color: var(--color-text-muted);
    margin-top: 2px;
}
.section-row--danger .section-row-title {
    color: var(--color-primary);
}
.section-row--danger .section-row-desc {
    color: var(--color-text-body);
}
.section-row--static .section-row-title {
    color: var(--color-text-body);
}

.section-row-chevron {
    flex-shrink: 0;
    color: var(--color-text-muted);
}
.section-row-chevron svg {
    display: block;
    width: 9px;
    height: 15px;
}
.section-row--danger .section-row-chevron {
    color: var(--color-primary);
}

/* Modal: variante destrutiva do ícone (coral em vez do warning padrão). */
.modal-icon--danger {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}
/* Modal: variante de sucesso (verde) — confirmação de "senha alterada". */
.modal-icon--success {
    background: var(--color-success-100);
    color: var(--color-success-700);
}

/* =============================================================================
 * Tela "Trocar senha" (/ajustes/seguranca/senha) — sub-página focada.
 * Header "voltar + marca", sem bottom-nav; barra de ação sticky no rodapé.
 * ============================================================================= */
.pwd-scroll {
    padding: var(--space-6) var(--space-5) var(--space-5);
}

/* Campo de senha com botão Mostrar/Ocultar dentro da caixa. */
.pwd-field {
    margin-top: var(--space-5);
}
.pwd-field > label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-display);
    margin-bottom: var(--space-2);
}
.pwd-input {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 52px;
    padding: 0 var(--space-4);
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-md);
    transition: border-color var(--duration-fast) var(--ease-out-soft);
}
.pwd-input--error {
    border-color: var(--color-primary);
}
/* O input interno tem outline:none; sem isto o foco deste campo seria
   sinalizado só pela troca de cor da borda (2.69:1, abaixo do mínimo de
   3:1 para indicadores). O anel do design system vive no invólucro. */
.pwd-input:focus-within {
    border-color: var(--color-focus-ring);
    box-shadow: var(--shadow-focus);
}
.pwd-input input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--color-text-display);
}
.pwd-input input::placeholder {
    color: var(--color-text-muted);
}
/* O invólucro acende por :focus-within, mas o botão não tinha regra própria:
   ao tabular do input para "mostrar senha" o anel não se movia, e dois
   controles dividiam um indicador só. */
.pwd-toggle:focus-visible {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-focus);
    outline: none;
}

.pwd-toggle {
    flex-shrink: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: var(--font-weight-bold);
    font-size: var(--text-sm);
    color: var(--color-info-700);
    padding: var(--space-1) var(--space-2);
}

/* Medidor de força. */
.pwd-strength {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-3);
}
.pwd-strength-bars {
    display: flex;
    gap: 5px;
    flex: 1;
}
.pwd-strength-seg {
    flex: 1;
    height: 5px;
    border-radius: var(--radius-full);
    background: var(--color-divider);
    transition: background-color var(--duration-fast) var(--ease-out-soft);
}
.pwd-strength-seg.is-weak {
    background: var(--color-primary);
}
.pwd-strength-seg.is-medium {
    background: var(--color-strength-medium);
}
.pwd-strength-seg.is-strong {
    background: var(--color-strength-strong);
}
.pwd-strength-label {
    font-size: var(--text-xs);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-muted);
    white-space: nowrap;
}
.pwd-strength-label.is-weak {
    color: var(--color-primary);
}
.pwd-strength-label.is-medium {
    color: var(--color-strength-medium);
}
.pwd-strength-label.is-strong {
    color: var(--color-success-700);
}

/* Checklist de regras. */
.pwd-rules {
    margin-top: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.pwd-rule {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}
.pwd-rule-dot {
    width: 19px;
    height: 19px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
    border: 2px solid var(--color-border-strong);
    background: var(--color-surface);
    display: grid;
    place-items: center;
    color: var(--color-on-primary);
    transition:
        background-color var(--duration-fast) var(--ease-out-soft),
        border-color var(--duration-fast) var(--ease-out-soft);
}
.pwd-rule-dot svg {
    width: 11px;
    height: 11px;
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-out-soft);
}
.pwd-rule.is-ok {
    color: var(--color-text-display);
}
.pwd-rule.is-ok .pwd-rule-dot {
    background: var(--color-strength-strong);
    border-color: var(--color-strength-strong);
}
.pwd-rule.is-ok .pwd-rule-dot svg {
    opacity: 1;
}

/* Dica (igual à atual / conferência). */
.pwd-hint {
    margin-top: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
}
.pwd-hint--good {
    color: var(--color-success-700);
}
.pwd-hint--bad {
    color: var(--color-primary);
}
.pwd-hint svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

/* Barra de ação sticky no rodapé (não é o bottom-nav). */
.pwd-action-bar {
    position: sticky;
    bottom: 0;
    padding: var(--space-3) var(--space-5)
        calc(var(--space-3) + env(safe-area-inset-bottom));
    background: var(--color-bg);
    border-top: 1px solid var(--color-divider);
}

/* btn-outline-danger (botão idle destrutivo) — spec §3.5.
 * Pill (min-height/padding/border-radius) herdado da base .btn. */
.btn-outline-danger {
    width: 100%;
    background: transparent;
    color: var(--color-danger-700);
    border: 1.5px solid var(--color-danger-700);
}

.btn-outline-danger:hover {
    background: var(--color-danger-100);
}

.btn-outline-danger:active {
    background: var(--color-danger-100);
}

.btn-outline-danger:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Checkbox-em-bloco e textos do modal — spec §3.7.
 * .modal-title/.modal-text como aliases das regras por tag .modal h2/.modal p. */
.modal-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-display);
    text-align: center;
    margin-bottom: var(--space-2);
}

.modal-text {
    font-size: var(--text-sm);
    color: var(--color-text-body);
    text-align: center;
    line-height: 1.5;
    margin-bottom: var(--space-5);
}

/* ----- Campo "digite EXCLUIR" do modal de exclusão (US-068) ----- */
.modal-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-body);
    text-align: left;
    margin-bottom: var(--space-2);
}
.modal-input {
    width: 100%;
    height: var(--button-min-height-md);
    padding: 0 var(--space-3);
    border: 1px solid var(--color-danger-500);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    color: var(--color-text-body);
    background: var(--color-danger-100);
    margin-bottom: var(--space-2);
}
.modal-hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-align: left;
    margin-bottom: var(--space-4);
}

/* Lista de consequências "Ao confirmar: …" do modal de exclusão de conta (US-068) —
 * SEM fundo/cartão (pedido do PO): apenas agrupador semântico do lead + <ul>, alinhado
 * à esquerda para não herdar o text-align: center do .modal. */
.modal-consequences {
    margin-bottom: var(--space-5);
    text-align: left;
}

.modal-consequences .modal-consequences-lead {
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-body);
    margin-bottom: var(--space-2);
}

.modal-consequences-list {
    list-style: disc;
    padding-left: var(--space-5);
    margin: 0;
}

.modal-consequences-list li {
    font-size: var(--text-sm);
    color: var(--color-text-body);
    line-height: 1.45;
}

.modal-consequences-list li + li {
    margin-top: var(--space-2);
}

.modal-consequences-list li::marker {
    color: var(--color-text-muted);
}

.modal-check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--color-surface-muted);
    cursor: pointer;
    margin-bottom: var(--space-5);
    text-align: left;
}

.modal-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--color-primary);
    flex-shrink: 0;
}

.modal-check-label {
    font-size: var(--text-sm);
    color: var(--color-text-body);
    line-height: 1.4;
}

.modal-check-hint {
    display: block;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 2px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Action sheet overlay */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(26, 22, 20, 0.4);
    z-index: var(--z-overlay);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.sheet {
    width: 100%;
    max-width: 28rem;
    background-color: var(--color-surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-3);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

/* O componente reutilizável (sheet.css, carregado DEPOIS no layout/app) também
   declara .sheet, porém posicionado `fixed` + `translate(-50%, 100%)` (fora da
   tela) até abrir via `.sheet-backdrop.is-open`. Este action-sheet vive dentro
   de `.sheet-overlay` e é posicionado pelo flex do overlay — então reescrevemos
   com maior especificidade para o painel NÃO herdar o "fora da tela" do
   sheet.css (senão só o overlay cinza aparece). Não casa o componente
   reutilizável, que usa `.sheet-backdrop`. */
.sheet-overlay .sheet {
    position: static;
    inset: auto;
    transform: none;
    z-index: auto;
    width: 100%;
    max-width: 28rem;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-3);
}

.sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: var(--radius-full);
    background-color: var(--color-neutral-200);
    margin: var(--space-1) auto var(--space-3);
}

.sheet-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    min-height: var(--space-12);
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--color-text-body);
    font-size: var(--text-base);
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-out-soft);
}

.sheet-item:hover {
    background-color: var(--color-surface-muted);
}

.sheet-item svg {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.sheet-item--danger {
    color: var(--color-danger-700);
}

.sheet-item--danger svg {
    color: var(--color-danger-700);
}

.sheet-item--cancel {
    justify-content: center;
    color: var(--color-text-muted);
    margin-top: var(--space-2);
}

/* =============================================================================
 * Tela /ajustes/notificacoes — preferências de notificação (US-050)
 * ============================================================================= */

.notif-page {
    margin: 0 auto;
    max-width: 28rem;
    padding: 0 0 var(--space-12);
}

.notif-page .intro {
    margin-bottom: var(--space-6);
}

.notif-page .intro .overline {
    margin-bottom: var(--space-2);
}

.notif-page .intro h1 {
    font-size: var(--text-2xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-display);
    margin-bottom: var(--space-2);
}

.notif-page .intro p:last-child {
    color: var(--color-text-muted);
    font-size: var(--text-base);
    line-height: 1.5;
}

.notif-page .section-row--static {
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
}

.preference-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.preference-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--color-primary);
    flex-shrink: 0;
}

.preference-label {
    font-size: var(--text-base);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-display);
}

.reminder-time-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.reminder-time-label {
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-muted);
    white-space: nowrap;
}

.reminder-time-input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--input-radius);
    color: var(--color-text-body);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    min-height: var(--input-min-height);
    padding: var(--space-2) var(--space-3);
    width: auto;
    transition: border-color var(--duration-fast) var(--ease-out-soft);
}

.reminder-time-input:focus {
    border-color: var(--input-border-focus);
    outline: none;
    box-shadow: var(--shadow-focus);
}

.essentials-note {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-divider);
    margin-top: var(--space-5);
    line-height: 1.5;
}

.unsubscribe-link {
    display: inline-block;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    text-decoration: underline;
    margin-top: var(--space-3);
}

.unsubscribe-link:hover {
    color: var(--color-text-body);
}

.notif-action-bar {
    position: sticky;
    bottom: 0;
    padding: var(--space-3) var(--space-5)
        calc(var(--space-3) + env(safe-area-inset-bottom));
    background: var(--color-bg);
    border-top: 1px solid var(--color-divider);
    margin-top: var(--space-6);
}

/* =============================================================================
 * Tela /hoje — especificação doc/UX/prototypes/trilha.md
 *
 * Header compact (marca + ajustes), cabeçalho da semana, trilha de 7 nós com
 * variações de estado (done / in-progress / today / locked / saturday) e
 * bottom-nav. Mobile-first; sem breakpoints desnecessários.
 *
 * Tokens: reutiliza :root existente — nenhum hex literal aqui.
 * ============================================================================= */

.icon-button {
    align-items: center;
    background: transparent;
    border-radius: var(--radius-md);
    color: var(--color-text-body);
    cursor: pointer;
    display: inline-grid;
    flex-shrink: 0;
    min-height: var(--space-11);
    min-width: var(--space-11);
    place-items: center;
    transition: background-color var(--duration-fast) var(--ease-out-soft);
}

.icon-button:hover {
    background: var(--color-surface-muted);
}

.icon-button svg {
    display: block;
    height: 20px;
    width: 20px;
}

/* ----- Container principal ----- */

.hoje__main {
    margin: 0 auto;
    max-width: 38rem;
    padding: var(--space-6) var(--space-4) var(--space-12);
}

/* ----- Cabeçalho da semana ----- */

.hoje__week-head {
    margin-bottom: var(--space-10);
}

/* US-108 — indicador discreto da trilha atual. Uma única linha em 320px,
   tipografia menor e cor secundária. Tokens existentes apenas. */
.hoje__track {
    align-items: center;
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    min-width: 0;
}

.hoje__track-link {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    overflow: hidden;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hoje__track-link:hover {
    text-decoration: underline;
}

.hoje__track-name {
    color: var(--color-text-body);
    font-weight: var(--font-weight-semibold);
}

/* Slot reservado para o controle de troca (US-105). Dimensão fixa para não
   causar reflow quando o controle real for habilitado. Inerte no MVP. */
.hoje__track-switch--reserved {
    display: inline-block;
    flex: 0 0 auto;
    height: var(--space-6);
    width: var(--space-6);
}

.hoje__eyebrow {
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.12em;
}

.hoje__week-title {
    font-size: 1.6875rem; /* ~27px */
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.03em;
    line-height: 1.08;
    margin: var(--space-2) 0 0;
}

.hoje__week-subtitle {
    color: var(--color-neutral-600); /* ink70 */
    font-size: var(--text-base);
    line-height: 1.45;
    margin: var(--space-2) 0 var(--space-5);
}

/* Chip "Trimestre" — pílula com borda. */
.hoje__chip {
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-full);
    color: var(--color-text-display);
    display: inline-flex;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-bold);
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    transition: background-color var(--duration-fast) var(--ease-out-soft);
}
.hoje__chip:hover {
    background: var(--color-surface-muted);
}
.hoje__chip svg {
    display: block;
    height: 12px;
    width: 12px;
}

/* ----- Trilha — lista de nós ----- */

.hoje__trail {
    display: flex;
    flex-direction: column;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ----- Linha (rail) + card ----- */

.hoje__row {
    align-items: stretch;
    display: flex;
    gap: var(--space-4);
}

/* Coluna do rail: marcador circular + linha conectora descendente. */
.hoje__rail {
    flex-shrink: 0;
    position: relative;
    width: 34px;
}
.hoje__line {
    background: var(--color-divider);
    border-radius: 2px;
    bottom: -18px;
    left: 16px;
    position: absolute;
    top: 30px;
    width: 2.5px;
}
.hoje__row--done .hoje__line {
    background: var(--color-secondary-400); /* trecho concluído = verde */
}
.hoje__row--last .hoje__line {
    display: none;
}

.hoje__marker {
    align-items: center;
    border-radius: var(--radius-full);
    box-shadow: 0 1px 3px rgba(33, 28, 24, 0.12);
    color: var(--color-on-primary);
    display: flex;
    height: 34px;
    justify-content: center;
    position: relative;
    width: 34px;
    z-index: 1;
}
.hoje__marker svg {
    height: 16px;
    width: 16px;
}
.hoje__marker--done {
    background: #6fb23a; /* verde profundo da marca */
}
/* `open` — dia disponível que passou sem ser feito.
 *
 * Era âmbar de alerta (--color-warning-500), a semântica de "atrasado" da
 * geração 1. O v2 desfaz isso: o estado é deliberadamente NEUTRO — nem coral
 * (não é o agora), nem lime (não foi feito), nem cadeado (não está fechado).
 * Só uma porta aberta, sem sinal de atraso (EXPERIENCE.md · State Patterns).
 *
 * A mudança vale nos dois modos de propósito: a etiqueta já passou a dizer
 * "Não iniciado" em ambos, e um ponto âmbar de alerta ao lado dela seria
 * incoerente. O name da classe fica por compatibilidade com DayCard. */
.hoje__marker--late {
    background: var(--color-surface-muted);
    box-shadow: none;
    color: var(--color-text-muted);
}
.hoje__marker--today {
    background: var(--color-primary);
    box-shadow: 0 4px 12px rgba(238, 108, 92, 0.45);
}
.hoje__marker--today svg {
    height: 18px;
    width: 18px;
}
.hoje__marker--locked {
    background: var(--color-neutral-100);
    box-shadow: none;
    /* O cadeado e o unico conteudo do marcador: e grafico informativo, minimo
     * de 3:1. neutral-400 sobre neutral-100 da 2,84:1; text-muted da 4,38:1. */
    color: var(--color-text-muted);
}
.hoje__marker--locked svg {
    height: 14px;
    width: 14px;
}

/* `in_progress` — começado, com checkpoint salvo. Coral, para se distinguir de
 * `done` (lime) e de `open` (neutro); o meio-preenchido do ícone o separa de
 * `today`. A sombra era azul (rgba 81,130,204) sobre fundo lime — resíduo de
 * uma paleta anterior que não bate com nenhum token do sistema. */
.hoje__marker--progress {
    background: var(--color-primary);
    box-shadow: 0 4px 10px rgba(238, 108, 92, 0.35);
    color: var(--color-neutral-0);
}

/* Coluna do card. */
.hoje__cardwrap {
    flex: 1;
    min-width: 0;
    padding-bottom: var(--space-5);
}
.hoje__row--last .hoje__cardwrap {
    padding-bottom: 0;
}

.hoje__card {
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: inherit;
    display: block;
    font-family: var(--font-sans);
    padding: var(--space-4);
    text-align: left;
    width: 100%;
}
button.hoje__card {
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-out-soft);
}
button.hoje__card:active {
    transform: scale(0.99);
}
.hoje__card-head {
    align-items: center;
    display: flex;
    gap: var(--space-2);
    justify-content: space-between;
}
.hoje__card-title {
    color: var(--color-text-body);
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
}
.hoje__card-sub {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin: var(--space-1) 0 0;
}

/* ----- Badge (reutiliza .badge existente) ----- */

.badge {
    align-items: center;
    border-radius: var(--radius-full);
    display: inline-flex;
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    gap: var(--space-1);
    line-height: 1;
    padding: var(--space-1) var(--space-2);
    white-space: nowrap;
}

.badge--neutral {
    background: var(--color-neutral-100);
    color: var(--color-neutral-700);
}

/* O par e soft/700, nao 100/700: primary-100 da 4,40:1 com o primary-700 novo
 * (reprova AA), e no escuro cai para 1,33:1 -- porque primary-700 vira coral
 * CLARO no dark e primary-100 nao tem par escuro, deixando texto claro sobre
 * fundo claro. primary-soft tem par escuro e resolve os dois: 4,63:1 e 7,34:1. */
.badge--primary {
    background: var(--color-primary-soft);
    color: var(--color-primary-700);
    font-family: var(--font-display);
}

.badge--success {
    background: var(--color-success-100);
    color: var(--color-success-700);
}

.badge--info {
    background: var(--color-info-100);
    color: var(--color-info-700);
}

.badge--warning {
    background: var(--color-warning-100);
    color: var(--color-warning-700);
}

/* `in_progress` e coral no cartao e no marcador; a etiqueta seguia lime, que e
 * o par de `done` -- dizia "concluido" ao lado de uma borda que diz "em curso". */
.badge--progress {
    background: var(--color-primary-soft);
    color: var(--color-primary-700);
}

/* ----- Estados dos cards ----- */

/* Concluído — borda verde sutil. */
.hoje__card--done {
    border-color: #e4efc8;
}

/* Não finalizado — barra de progresso. */
.hoje__bar {
    background: var(--color-neutral-100);
    border-radius: var(--radius-full);
    height: 7px;
    margin-top: var(--space-3);
    overflow: hidden;
}
.hoje__bar > span {
    background: var(--color-secondary-400);
    border-radius: var(--radius-full);
    display: block;
    height: 100%;
}
.hoje__bar--late > span {
    background: var(--color-warning-500);
}

/* `open` (dia liberado, nao comecado) NAO tem regra propria -- e isso e
 * intencional, igual ao desktop: nem coral (nao e o agora), nem lime (nao foi
 * feito), nem ambar (nao e alerta). Herda o cartao base.
 *
 * Havia aqui um destaque ambar que apontava para --color-warning-300 e -50,
 * que a rampa nunca definiu: o fundo caia para `transparent` e a borda para
 * `currentColor`, pintando o contorno com a cor do texto. */

/* Hoje — destaque coral. */
.hoje__card--today {
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-xl);
    box-shadow: 0 12px 28px rgba(238, 108, 92, 0.18);
    padding: var(--space-4) var(--space-4) var(--space-5);
    scroll-margin-bottom: 80px;
    scroll-margin-top: 80px;
}
.hoje__card--today .hoje__card-title {
    color: var(--color-text-display);
    font-weight: var(--font-weight-bold);
}

/* Em progresso — destaque azul secundário */
/* `in_progress` — começado, com checkpoint salvo.
 *
 * Era VERDE (secondary-50/300/700), a mesma família de `done`. Isso confunde
 * dois estados que significam o oposto: um terminou, o outro não. No v2 o
 * lime é conquista e só conquista (DESIGN.md · Colors), então este estado
 * passa ao coral — é ação pendente, não realizada.
 *
 * Ganha a borda coral sem o fundo de `today`: precisa se distinguir do dia
 * corrente à primeira vista, porque é o atalho de quem parou no meio. */
.hoje__card--progress {
    border-color: var(--color-primary);
}
.hoje__card--progress .hoje__card-title {
    color: var(--color-text-display);
}

.hoje__hook {
    color: var(--color-neutral-600);
    font-size: var(--text-sm);
    line-height: 1.45;
    margin: var(--space-2) 0 var(--space-4);
}
.hoje__start {
    height: 50px;
}
.hoje__start svg {
    height: 16px;
    width: 16px;
}

/* Bloqueado — tracejado. */
.hoje__card--locked {
    background: var(--color-neutral-50);
    border-style: dashed;
}
.hoje__card--locked .hoje__card-title {
    color: var(--color-text-muted);
}

/* ----- Bottom-nav (footer compartilhado) ----- */

/* Banner de offline no shell de TOQUE (Story 3.4).
 *
 * O offset dele só existia acima de 1100px (`shell-desktop.css:306`, com a
 * altura da topbar do modo grande). Abaixo disso ficava em `top: 0` e cobria o
 * `.app-header` — justo quando a rede cai, que é quando a navegação mais
 * importa. O offset aqui é a altura do CABEÇALHO de toque, 57px (`--app-header-h`),
 * não os 64 da topbar grande: são cromos diferentes.
 *
 * A sessão imersiva continua em 0, e está certo — ela não tem `.app-header`.
 * Por isso o seletor exige `.app-shell`, que só o layout do shell aplica.
 *
 * SEM `@media`, e isso é correção de FAIXA MORTA (gate do Épico 4, rodada 3).
 * A regra vivia num `@media (max-width: 1099px)` e o par dela em
 * `shell-desktop.css` num `min-width: 1100px`. Em 1099,5px — largura que zoom
 * de navegador e escala de tela de 125%/150% produzem — NENHUM dos dois casava,
 * e o banner caía no `inset: 0 0 auto 0` de `offline.css:65`, ou seja, voltava a
 * cobrir o `.app-header`. O defeito exato que este bloco existe para impedir,
 * ressuscitado num intervalo de meio pixel.
 *
 * Como base sem media, ela vale em toda largura e o bloco de 1100 sobrescreve
 * por ORDEM — `shell-desktop.css` é linkado depois de `app.css` em
 * `layout/app.html:55,59`, e as duas pesam (0,2,0). Contra `offline.css`, que
 * vem por último mas pesa (0,1,0), quem manda é a especificidade. */
.app-shell .offline-banner {
    inset-block-start: var(--app-header-h);
}

/* O dock de toque saiu daqui na Story 3.1 e vive em `dock.css`: invariante do
 * projeto — proibido um único CSS gigante — e o dock ganhou chanfro, encaixe e
 * uma altura que a safe-area SOMA em vez de comer por dentro. */

/* O antigo tooltip de bloqueio (.hoje__lock-tooltip) foi substituído pelo
 * bottom-sheet compartilhado (css/sheet.css + js/sheet.js, aberto por js/hoje.js). */

/* ----- Utilitários ----- */

.sr-only {
    clip: rect(0, 0, 0, 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* ---------------------------------------------------------------------------
   Escolha de trilha (pós-verificação de e-mail) — US-100.
   Elevada ao design system (doc/UX/us-100-spec.md §3, §11): tokens coral/lime/
   ink, componentes card/badge. Cards na vertical na ordem da subida; a trilha
   disponível (Travessia) se destaca por ênfase (borda coral + sombra), não por
   posição. Cards "Em breve" são interativos (gancho US-107/#140): subordinados
   por AUSÊNCIA de coral/sombra — nunca por opacidade de "desligado".
   --------------------------------------------------------------------------- */
.escolher-trilha .escolher-trilha__intro {
    margin-bottom: var(--space-6);
}
.escolher-trilha__eyebrow {
    align-items: center;
    color: var(--color-success-700); /* verde — "E-mail confirmado" */
    display: inline-flex;
    font-weight: var(--font-weight-bold);
    gap: var(--space-2);
    letter-spacing: 0.12em;
}
.escolher-trilha__eyebrow svg {
    height: 14px;
    width: 14px;
}
.escolher-trilha h1 {
    font-size: 1.6875rem; /* ~27px */
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.03em;
    margin: var(--space-2) 0 0;
}
.escolher-trilha .lead {
    color: var(--color-neutral-600); /* ink70 */
    font-size: var(--text-base);
    line-height: 1.5;
    margin: var(--space-3) 0 0;
}

.trilha-cards {
    list-style: none;
    margin: var(--space-5) 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.trilha-cards > li {
    margin: 0;
}
.trilha-card__form {
    margin: 0;
}

/* Card = pico + corpo + lado direito. */
.trilha-card__link {
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-xl);
    color: inherit;
    cursor: pointer;
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    text-align: left;
    transition:
        box-shadow var(--duration-base) var(--ease-out-soft),
        transform var(--duration-base) var(--ease-out-soft),
        background-color var(--duration-fast) var(--ease-out-soft),
        border-color var(--duration-fast) var(--ease-out-soft);
    width: 100%;
}
.trilha-card__link:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}
.trilha-card__link:active {
    transform: scale(0.992);
}

/* Tile do "pico" (marca da montanha). */
.trilha-card__peak {
    align-items: center;
    background: var(--color-primary);
    border-radius: var(--radius-lg);
    color: var(--color-on-primary);
    display: flex;
    flex-shrink: 0;
    height: 42px;
    justify-content: center;
    width: 42px;
}
.trilha-card__peak svg {
    height: 20px;
    width: 20px;
}
.trilha-card__peak--soon {
    background: var(--color-neutral-100);
    color: var(--color-neutral-400);
}

.trilha-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}
.trilha-card__age {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-bold);
}
.trilha-card__name {
    color: var(--color-text-display);
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.01em;
}
.trilha-card__start {
    align-items: center;
    color: var(--color-primary);
    display: inline-flex;
    font-weight: var(--font-weight-bold);
    gap: var(--space-1);
    margin-top: var(--space-2);
}
.trilha-card__start svg {
    height: 15px;
    width: 15px;
}
.trilha-card__right {
    align-items: center;
    display: inline-flex;
    flex-shrink: 0;
    gap: var(--space-2);
}
.trilha-card__chev {
    color: var(--color-neutral-400);
    display: block;
}
.trilha-card__chev svg {
    height: 18px;
    width: 18px;
}

/* Variante "Em breve" — hover sutil. */
.trilha-card--soon:hover {
    background: var(--color-surface-muted);
    border-color: var(--color-border-strong);
}

/* Variante "Disponível" (Travessia) — destaque coral. */
.trilha-card--available {
    align-items: flex-start;
    border: 2px solid var(--color-primary);
    box-shadow: 0 12px 28px rgba(238, 108, 92, 0.16);
}
.trilha-card--available:hover {
    box-shadow: var(--shadow-lg);
}

@media (prefers-reduced-motion: no-preference) {
    .trilha-card--available:hover {
        transform: translateY(-1px);
    }
}

/* ----- Nota de rodapé ----- */
.escolher-trilha__foot {
    margin-top: var(--space-8);
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.escolher-trilha__foot svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* =============================================================================
 * Sheet US-107 — aviso "Em breve" + opt-in "me avise" (doc/UX/us-100-spec §4).
 *
 * Bottom sheet (mobile) / modal centrado (desktop ≥ 40rem). Escopado em
 * `.escolher-trilha` para NÃO colidir com o componente global `.sheet`/
 * `.sheet-overlay` (action sheet de menu), que tem layout e comportamento
 * diferentes. Aqui o overlay nasce oculto e só aparece com `.is-open`. Reusa os
 * componentes-base `.btn`/`.btn-primary`/`.btn-ghost` e `.alert--success`.
 * Só tokens — nenhum hex novo (o scrim rgba(26,22,20,…) já é o padrão do arquivo
 * em sombras e no `.modal-overlay`). ============================================ */

.escolher-trilha .sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: rgba(26, 22, 20, 0.6);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity var(--duration-base) var(--ease-out-soft),
        visibility var(--duration-base) var(--ease-out-soft);
}

.escolher-trilha .sheet-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.escolher-trilha .sheet {
    background: var(--color-surface);
    width: 100%;
    max-width: 32rem;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-lg);
    padding: var(--space-5);
    display: block;
    gap: 0;
    transform: translateY(16px);
    transition: transform var(--duration-base) var(--ease-out-soft);
}

.escolher-trilha .sheet-overlay.is-open .sheet {
    transform: none;
}

.escolher-trilha .sheet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.escolher-trilha .sheet-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-display);
    line-height: 1.2;
    margin: 0;
}

.escolher-trilha .sheet-grabber {
    background: var(--color-neutral-200);
    border-radius: var(--radius-full);
    display: block;
    height: 5px;
    margin: 0 auto var(--space-4);
    width: 40px;
}

.escolher-trilha .sheet-close {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: 0;
    background: var(--color-surface-muted);
    cursor: pointer;
    border-radius: var(--radius-full);
    display: inline-grid;
    place-items: center;
    color: var(--color-text-body);
}

.escolher-trilha .sheet-close:hover {
    background: var(--color-neutral-100);
}

.escolher-trilha .sheet-close svg {
    width: 15px;
    height: 15px;
    display: block;
}

.escolher-trilha .sheet-body {
    color: var(--color-text-body);
    font-size: var(--text-base);
    margin-bottom: var(--space-5);
}

.escolher-trilha .sheet-body p + p {
    margin-top: var(--space-2);
}

.escolher-trilha .sheet-body .muted {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

/* Pilha de ações (CTA primário + ação secundária) e seus forms. */
.escolher-trilha .actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.escolher-trilha .actions > form {
    margin: 0;
}

.escolher-trilha .actions .btn {
    width: 100%;
    min-height: var(--space-12);
}

/* Ação secundária "me avisar" — botão contornado com sino. */
.escolher-trilha .btn-notify {
    align-items: center;
    background: var(--color-surface);
    border: 1.5px solid var(--color-divider);
    color: var(--color-text-display);
    display: flex;
    gap: var(--space-2);
    justify-content: center;
    transition:
        border-color var(--duration-fast) var(--ease-out-soft),
        background-color var(--duration-fast) var(--ease-out-soft);
}
.escolher-trilha .btn-notify:hover {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
}
.escolher-trilha .btn-notify svg {
    flex-shrink: 0;
    height: 17px;
    width: 17px;
}

/* Estado "interesse registrado" — centrado, ícone verde + texto. */
.escolher-trilha .sheet-confirmed {
    align-items: center;
    display: flex;
    flex-direction: column;
    padding-top: var(--space-2);
    text-align: center;
}
.escolher-trilha .sheet-confirmed__icon {
    align-items: center;
    background: var(--color-success-100);
    border-radius: var(--radius-full);
    color: var(--color-success-700);
    display: flex;
    height: 62px;
    justify-content: center;
    margin-bottom: var(--space-4);
    width: 62px;
}
.escolher-trilha .sheet-confirmed__icon svg {
    height: 30px;
    width: 30px;
}
.escolher-trilha .sheet-confirmed__title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.01em;
    margin: 0;
}
.escolher-trilha .sheet-confirmed__text {
    color: var(--color-neutral-600);
    font-size: var(--text-base);
    line-height: 1.55;
    margin: var(--space-3) 0 var(--space-5);
}
.escolher-trilha .sheet-confirmed .btn {
    min-height: var(--space-12);
    width: 100%;
}

/* Desktop: o bottom sheet vira modal centrado. */
@media (min-width: 40rem) {
    .escolher-trilha .sheet-overlay {
        align-items: center;
    }

    .escolher-trilha .sheet {
        border-radius: var(--radius-xl);
        transform: translateY(0) scale(0.96);
    }

    .escolher-trilha .sheet-overlay.is-open .sheet {
        transform: none;
    }
}

/* prefers-reduced-motion: entrada por fade simples (sem translate/scale). */
@media (prefers-reduced-motion: reduce) {
    .escolher-trilha .sheet,
    .escolher-trilha .sheet-overlay.is-open .sheet {
        transform: none;
    }
}

/* =============================================================================
 * Onboarding da trilha (app/onboarding/passo-1..3) — stepper + texto + CTA +
 * trilha ilustrada. O CTA mantém .onboarding__cta (contrato de navegação).
 * ============================================================================= */
/* Preenche a altura entre o header e a bottom-nav (coluna centrada). */
.onboarding {
    display: flex;
    flex: 1;
    flex-direction: column;
    margin: 0 auto;
    max-width: 30rem;
    padding: var(--space-6) var(--space-4) var(--space-8);
    width: 100%;
}

/* Stepper — barras ocupam 100% da largura (1 por passo). */
.onboarding__stepper {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}
.onboarding__seg {
    background: var(--color-divider);
    border-radius: var(--radius-full);
    flex: 1;
    height: 4px;
}
.onboarding__seg--on {
    background: var(--color-primary);
}

.onboarding__titulo {
    font-size: 1.6875rem; /* ~27px */
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.03em;
    margin: var(--space-2) 0 0;
}
.onboarding__lead {
    color: var(--color-neutral-600); /* ink70 */
    font-size: var(--text-base);
    line-height: 1.5;
    margin: var(--space-3) 0 var(--space-6);
}
.onboarding__cta svg {
    height: 16px;
    width: 16px;
}

.onboarding__trail {
    display: flex;
    justify-content: center;
    margin-top: auto; /* empurra a ilustração para o fim da coluna */
    padding-top: var(--space-6);
}

/* =============================================================================
 * Utilities (extraídas de inline styles — REF-030-e)
 * ============================================================================= */
.is-hidden {
    display: none !important;
}

.step-title { margin-top: 6px; }
.lockmsg-success { color: var(--color-secondary-700); font-weight: 600; }
.text-center { text-align: center; }
.mt-sm { margin-top: var(--space-2, 0.5rem); }
.reward-primary { background: var(--color-primary-50); border-color: var(--color-primary-300); }
.icon-primary-bg { background: var(--color-primary-500); }
.text-primary-700 { color: var(--color-primary-700); }
.cta-plain { text-decoration: none; }
.selo13 { margin-top: 10px; }

/* Cartão de retentativa do painel da semana (Story 4.5).
 *
 * `.hoje__aviso` não tinha CSS nenhum — era um `<p>` solto herdando o corpo, e
 * o único sinal de que algo falhara. Vira cartão: superfície própria, contorno
 * de aviso e um botão de ação, porque "Tenta de novo?" sem meio de responder é
 * a pergunta certa sem a porta. */
.hoje__aviso {
    align-items: center;
    background: var(--color-warning-100);
    border: 1px solid var(--color-warning-500);
    border-radius: var(--radius-lg);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    justify-content: space-between;
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
}

.hoje__aviso-texto {
    color: var(--color-warning-700);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    margin: 0;
}

.hoje__aviso-acao {
    background: var(--color-warning-700);
    border: 0;
    border-radius: var(--radius-full);
    color: var(--color-neutral-0);
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    min-height: var(--space-11); /* alvo de toque */
    padding: var(--space-2) var(--space-5);
}

/* `forced-colors` descarta o preenchimento; o contorno é o que resta. */
@media (forced-colors: active) {
    .hoje__aviso-acao {
        border: 1px solid ButtonBorder;
    }
}
