:root {
    /* Brazilian flag palette — green base, yellow spot, blue + white as neutrals */
    --green: #009739;
    --green-dark: #006a28;
    --green-soft: #e8f5ec;
    --yellow: #ffdf00;
    --yellow-soft: #fff8b3;
    --blue: #002776;
    --blue-dark: #001a52;

    /* Neutrals */
    --bg: #ffffff;
    --bg-soft: #fafaf7;
    --text: #1a1a1a;
    --text-muted: #555;
    --rule: #e6e6e0;

    /* Footer */
    --footer-bg: var(--blue);
    --footer-text: #ffffff;
    --footer-text-muted: #c4cee0;
    --footer-rule: #1a3a8a;

    --max-width: 760px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
                 Arial, "Liberation Sans", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    padding: 2.5rem 1.25rem 4rem;
}

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

a {
    color: var(--green-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

a:hover {
    color: var(--green);
    text-decoration: none;
}

strong {
    font-weight: 600;
}

/* ---------- Header / nav bar ---------- */
.site-header {
    background: var(--bg);
    border-bottom: 3px solid var(--green);
    padding: 0.9rem 1.25rem;
    position: relative;
}

.site-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 3px;
    background: var(--yellow);
}

/* Non-binding-translation banner — shown only on /br/en/ pages (English
   translation of the BR product; legally binding version is the PT one). */
.non-binding-banner {
    background: var(--yellow-soft);
    border-bottom: 1px solid var(--rule);
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text);
    text-align: center;
    margin-top: 9px; /* clears the yellow underline of .site-header */
}

.non-binding-banner a {
    color: var(--green-dark);
    text-decoration: underline;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 0.01em;
    color: var(--green);
    text-decoration: none;
}

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

.lang-switch {
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--bg-soft);
}

.lang-active {
    color: var(--green-dark);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.lang-divider {
    color: var(--rule);
}

.lang-inactive {
    color: var(--text-muted);
    font-style: italic;
    cursor: help;
}

/* ---------- Hero / landing ---------- */
.hero {
    padding-top: 1rem;
}

.hero h1 {
    font-size: 2.6rem;
    font-weight: 800;
    margin: 0.5rem 0 1rem;
    letter-spacing: -0.02em;
    color: var(--text);
    position: relative;
    display: inline-block;
}

.hero h1::after {
    content: "";
    display: block;
    width: 4rem;
    height: 4px;
    background: var(--yellow);
    border-radius: 2px;
    margin-top: 0.5rem;
}

.hero .lede {
    font-size: 1.2rem;
    color: var(--text);
    margin: 1.5rem 0 1.5rem;
    max-width: 64ch;
}

.hero p {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
    max-width: 64ch;
}

.hero p:last-child {
    margin-bottom: 0;
}

/* ---------- Legal pages ---------- */
.legal h1 {
    font-size: 2rem;
    margin: 0.5rem 0 0.5rem;
    letter-spacing: -0.01em;
    color: var(--text);
}

.legal h2 {
    font-size: 1.2rem;
    margin: 2rem 0 0.75rem;
    color: var(--text);
    padding-left: 0.6rem;
    border-left: 4px solid var(--green);
    line-height: 1.3;
}

.legal-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0 0 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--rule);
}

.legal p, .legal li {
    color: var(--text);
}

.legal ul {
    padding-left: 1.25rem;
}

.legal li {
    margin-bottom: 0.5rem;
}

.legal-address {
    background: var(--green-soft);
    border-left: 4px solid var(--green);
    padding: 1rem 1.25rem;
    margin: 0.75rem 0 1rem;
    line-height: 1.7;
    border-radius: 0 4px 4px 0;
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 2.5rem 1.25rem 2rem;
    margin-top: 3rem;
    font-size: 0.92rem;
    border-top: 4px solid var(--yellow);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.75rem;
}

@media (min-width: 720px) {
    .footer-grid {
        grid-template-columns: 1.6fr 1fr;
        align-items: start;
    }
}

.footer-brand-name {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--footer-text);
    margin-bottom: 0.25rem;
    letter-spacing: 0.01em;
}

.footer-tagline {
    color: var(--yellow);
    margin: 0 0 0.9rem;
    font-weight: 500;
}

.footer-company {
    color: var(--footer-text-muted);
    margin: 0;
    line-height: 1.6;
}

.footer-company strong {
    color: var(--footer-text);
    font-weight: 600;
}

.footer-meta {
    text-align: left;
}

@media (min-width: 720px) {
    .footer-meta {
        text-align: right;
    }
}

.footer-copy {
    color: var(--footer-text-muted);
    margin: 0 0 0.9rem;
}

.footer-links a {
    color: var(--footer-text);
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-links a:hover {
    color: var(--yellow);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-divider {
    color: var(--footer-text-muted);
    margin: 0 0.5rem;
}

/* ── Header auth area (right side of header, alongside lang-switch) ──────── */

.header-right {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.auth-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.auth-nav a {
    color: var(--text);
    text-decoration: none;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
}

.auth-nav a:hover {
    background: var(--bg-soft);
    text-decoration: none;
}

.auth-nav a.cta {
    background: var(--green);
    color: #fff;
}

.auth-nav a.cta:hover {
    background: var(--green-dark);
}

.auth-greeting {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0 0.3rem;
}

.auth-logout-form {
    display: inline;
    margin: 0;
}

.auth-logout-form button {
    background: none;
    border: none;
    padding: 0.35rem 0.7rem;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    border-radius: 6px;
}

.auth-logout-form button:hover {
    background: var(--bg-soft);
}

/* ── Form sections (login, signup, settings) ─────────────────────────────── */

.form-section {
    max-width: 480px;
    margin: 0 auto;
}

.form-section h1 {
    margin-bottom: 0.5rem;
}

.form-section h2 {
    margin-top: 2.5rem;
    font-size: 1.15rem;
}

.form-section .lede {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.form-section form label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-section form input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--rule);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
}

.form-section form input:focus {
    outline: 2px solid var(--green);
    outline-offset: 1px;
    border-color: var(--green);
}

.form-section form button[type="submit"] {
    margin-top: 1.5rem;
    width: 100%;
    padding: 0.85rem 1.2rem;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.form-section form button[type="submit"]:hover {
    background: var(--green-dark);
}

.form-error {
    background: #fef0f0;
    border: 1px solid #f7b8b8;
    color: #8a1c1c;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.form-success {
    background: var(--green-soft);
    border: 1px solid var(--green);
    color: var(--green-dark);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.verification-banner {
    background: var(--yellow-soft);
    border: 1px solid var(--yellow);
    padding: 1rem 1.25rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.verification-banner p {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}

.verification-banner form {
    margin: 0;
}

/* ── OTP code inputs (verify-pending dual-OTP form) ────────────────────────── */
.otp-input {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 1.4rem;
    letter-spacing: 0.4em;
    text-align: center;
    padding: 0.7rem 0.5rem;
}

/* ── Phone-input group: country-code <select> + local-number <input> ──────── */
.phone-input-group {
    display: flex;
    align-items: stretch;
    gap: 0;
    width: 100%;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--bg);
    overflow: hidden;
}

.phone-input-group select {
    border: none;
    border-right: 1px solid var(--rule);
    background: var(--bg-soft);
    padding: 0.7rem 0.7rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
}

.phone-input-group input[type="tel"] {
    border: none;
    border-radius: 0;
    flex: 1;
    width: auto;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
}

.phone-input-group:focus-within {
    outline: 2px solid var(--green);
    outline-offset: 1px;
    border-color: var(--green);
}

.phone-input-group select:focus,
.phone-input-group input[type="tel"]:focus {
    outline: none;
}

.field-help {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.4rem 0 0 0;
    line-height: 1.4;
}

/* ── Collapsible details (Wrong email? change-email form) ────────────────── */
.form-details {
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--bg-soft);
}

.form-details summary {
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-details[open] summary {
    margin-bottom: 0.75rem;
}

.field-error {
    color: #8a1c1c;
    font-size: 0.85rem;
    margin: 0.3rem 0 0 0;
}

.form-meta {
    margin-top: 2rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.account-fields {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.5rem 1.5rem;
    margin: 1rem 0 0;
}

.account-fields dt {
    font-weight: 600;
    color: var(--text-muted);
}

.account-fields dd {
    margin: 0;
}

.account-fields dd.muted {
    color: var(--text-muted);
    font-style: italic;
}

.field-action {
    margin-left: 0.6rem;
    font-size: 0.85rem;
    color: var(--green-dark);
}

/* ── Settings portal — sectioned layout ───────────────────────────────────── */

.account-section {
    max-width: 560px;
}

.account-section h2 {
    margin-top: 2.25rem;
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--rule);
    padding-bottom: 0.4rem;
}

.account-actions {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
}

.account-actions li {
    margin: 0.4rem 0;
}

.account-actions a {
    color: var(--green-dark);
}

.danger-zone-heading {
    color: #8a1c1c !important;
    border-bottom-color: #f7b8b8 !important;
}

.danger-zone {
    border: 1px solid #f7b8b8;
    background: #fef0f0;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-top: 0.75rem;
}

.danger-zone p {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    color: #5a1212;
}

.danger-zone p:last-child {
    margin-bottom: 0;
}

.danger-zone .muted {
    color: var(--text-muted);
    font-style: italic;
}

.logout-form {
    margin-top: 0.4rem;
}

.link-button {
    display: inline-block;
    background: none;
    border: 1px solid var(--rule);
    padding: 0.55rem 1rem;
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    text-decoration: none;
}

.link-button:hover {
    background: var(--bg-soft);
}
