/* =====================================================================
   Tide — folha de estilo base
   =====================================================================
   Secção 6 da especificação: neutros quentes, um acento único em
   azul-petróleo, muita respiração, nada de infantilização. O vermelho
   é reservado para o período no calendário e para erros — nunca é cor
   dominante.

   Modo escuro obrigatório, seguindo o tema do sistema.
   ===================================================================== */

:root {
    color-scheme: light dark;

    /* Neutros quentes: areia e pedra. */
    --fundo:        #f4f1ec;
    --superficie:   #fffdf9;
    --texto:        #2a2825;
    --texto-suave:  #6f6a62;
    --linha:        #ddd6ca;

    /* Acento único. */
    --acento:        #1f6f78;
    --acento-forte:  #17575e;
    --acento-texto:  #ffffff;
    --acento-tenue:  #e4eeef;

    /* Terracota em vez de vermelho vivo: legível sem ser alarmista. */
    --erro:        #9a3d20;
    --erro-fundo:  #f8ebe5;

    --raio:    12px;
    --toque:   48px;   /* mínimo de 44px exigido pela especificação */
    --respiro: 1.5rem;

    --sombra: 0 1px 2px rgb(42 40 37 / .05), 0 4px 16px rgb(42 40 37 / .06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --fundo:        #16181a;
        --superficie:   #1e2124;
        --texto:        #e9e6e1;
        --texto-suave:  #9b958c;
        --linha:        #31363a;

        --acento:        #57b6c0;
        --acento-forte:  #78ccd4;
        --acento-texto:  #10262a;
        --acento-tenue:  #1a2f33;

        --erro:        #e79a83;
        --erro-fundo:  #2e211d;

        --sombra: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25);
    }
}

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

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

body {
    margin: 0;
    min-height: 100dvh;
    background: var(--fundo);
    color: var(--texto);
    font: 400 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    /* Respeita a barra de estado e o entalhe do telemóvel. */
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* --- Estrutura ---------------------------------------------------- */

.folha {
    max-width: 26rem;
    margin-inline: auto;
    padding: var(--respiro);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--respiro);
}

.marca {
    text-align: center;
    display: grid;
    gap: .35rem;
    margin-bottom: .5rem;
}

.marca__nome {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: .06em;
}

.marca__sub {
    margin: 0;
    color: var(--texto-suave);
    font-size: .95rem;
}

/* O ícone: uma linha ondulada de traço grosso, legível a 48px e a
   preto e branco. Sem gradientes, como manda a especificação. */
.onda {
    display: block;
    margin: 0 auto .25rem;
    width: 56px;
    height: 56px;
    color: var(--acento);
}

.cartao {
    background: var(--superficie);
    border: 1px solid var(--linha);
    border-radius: var(--raio);
    padding: var(--respiro);
    box-shadow: var(--sombra);
}

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

form { display: grid; gap: 1.15rem; }

.campo { display: grid; gap: .4rem; }

.campo > label {
    font-size: .9rem;
    font-weight: 600;
    color: var(--texto-suave);
}

.campo__dica {
    font-size: .82rem;
    color: var(--texto-suave);
    line-height: 1.45;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
    width: 100%;
    min-height: var(--toque);
    padding: .7rem .85rem;
    font: inherit;
    color: var(--texto);
    background: var(--fundo);
    border: 1.5px solid var(--linha);
    border-radius: 10px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus-visible,
select:focus-visible,
button:focus-visible {
    outline: none;
    border-color: var(--acento);
    box-shadow: 0 0 0 3px var(--acento-tenue);
}

/* Campo de PIN: algarismos grandes e espaçados, para acertar à
   primeira com o polegar. */
.pin {
    font-size: 1.6rem;
    letter-spacing: .6em;
    text-align: center;
    padding-left: .6em;   /* compensa o espaçamento à direita do último */
}

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

button {
    min-height: var(--toque);
    padding: .75rem 1.25rem;
    font: inherit;
    font-weight: 600;
    border-radius: 10px;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

/* Uma ação principal por ecrã. */
.botao--principal {
    background: var(--acento);
    color: var(--acento-texto);
    width: 100%;
}

.botao--principal:hover { background: var(--acento-forte); }

.botao--discreto {
    background: transparent;
    color: var(--texto-suave);
    border-color: var(--linha);
    width: 100%;
}

.botao--discreto:hover { color: var(--texto); border-color: var(--texto-suave); }

/* --- Mensagens ----------------------------------------------------- */

.aviso {
    margin: 0;
    padding: .85rem 1rem;
    border-radius: 10px;
    font-size: .92rem;
    line-height: 1.5;
    background: var(--erro-fundo);
    color: var(--erro);
    border: 1px solid color-mix(in srgb, var(--erro) 30%, transparent);
}

.aviso ul { margin: .4rem 0 0; padding-left: 1.15rem; }
.aviso li { margin: .2rem 0; }

.nota {
    margin: 0;
    padding: .85rem 1rem;
    border-radius: 10px;
    font-size: .9rem;
    line-height: 1.55;
    background: var(--acento-tenue);
    color: var(--texto);
    border: 1px solid color-mix(in srgb, var(--acento) 25%, transparent);
}

.nota code {
    display: block;
    margin-top: .5rem;
    padding: .55rem .7rem;
    background: var(--superficie);
    border: 1px solid var(--linha);
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .82rem;
    /* Um comando longo não deve alargar a página no telemóvel. */
    overflow-x: auto;
    white-space: pre;
}

/* --- Rodapé -------------------------------------------------------- */

/* Aviso legal permanente exigido pela secção 8. */
.rodape {
    margin: 0;
    text-align: center;
    font-size: .8rem;
    line-height: 1.5;
    color: var(--texto-suave);
}

.separador {
    border: none;
    border-top: 1px solid var(--linha);
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* --- Auxiliares ---------------------------------------------------- */

.sem-margem   { margin: 0; }
.margem-baixo { margin: 0 0 .75rem; }

/* "(opcional)" ao lado de um rótulo, sem o peso do rótulo. */
.rotulo-opcional { font-weight: 400; }
