/* Mobile-first — consulta CNAE/MCC */
:root {
    /* Fundo predominante: #00ae55 · botões: verde escuro */
    --bg: #0e6138;
    --bg-deep: #0e6138;
    --surface: #00ae55;
    --surface-elevated: #ecf8f1;
    --border: #02753b;
    --input-bg: #ffffff;
    --text: #15221a;
    --muted: #000000;
    --text-on-bg: #ffffff;
    --accent: #0d5c35;
    --accent-hover: #0a4528;
    --danger: #dc2626;
    --radius: 14px;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

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

body {
    margin: 0;
    min-height: 100dvh;
    overflow-x: hidden;
    background: radial-gradient(1100px 650px at 50% -20%, #1ed875 0%, var(--bg) 42%, var(--bg-deep) 100%);
    color: var(--text-on-bg);
    line-height: 1.4;
}

.app {
    max-width: 420px;
    margin: 0 auto;
    padding: 0.65rem 0.75rem calc(0.65rem + env(safe-area-inset-bottom, 0));
}

.app__header {
    text-align: center;
    margin-bottom: 0.6rem;
}

.app__title {
    margin: 0 0 0.2rem;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-on-bg);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.app__subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    line-height: 1.3;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    box-shadow: var(--shadow);
    color: var(--text);
}

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

.label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.input {
    width: 100%;
    font-size: 0.95rem;
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 92, 53, 0.2);
}

select.input {
    cursor: pointer;
    appearance: auto;
}

.hint {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--muted);
}

.detect-tipo:empty {
    display: none;
}

.detect-tipo:not(:empty) {
    margin-top: 0.1rem;
    font-size: 0.72rem;
    line-height: 1.25;
    font-weight: 600;
    color: var(--accent);
}

.result-tipo {
    margin: 0 0 0.4rem;
    font-size: 0.72rem;
    line-height: 1.25;
    color: var(--muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    width: 100%;
    margin-top: 0.2rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}

.btn:active {
    transform: scale(0.99);
}

.btn--primary {
    background: linear-gradient(180deg, #0f6b3f 0%, var(--accent) 45%, var(--accent-hover) 100%);
    color: #fff;
}

.btn--primary:hover:not(:disabled) {
    filter: brightness(1.08);
}

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

.btn__loader {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.hidden {
    display: none !important;
}

.alert {
    margin-top: 0.5rem;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    font-size: 0.85rem;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.35);
    color: #b91c1c;
}

.result {
    margin-top: 0.65rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
}

.result__title {
    margin: 0 0 0.4rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-bottom: 0.45rem;
}

.field--descricao {
    margin-bottom: 0;
}

/* CNAE + MCC na mesma linha */
.result-line {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: flex-end;
    margin-bottom: 0.45rem;
}

.result-line .field {
    margin-bottom: 0;
}

.result-line--cpf .field--mcc {
    flex: 1 1 100%;
    max-width: 100%;
}

.cpf-list-wrapper {
    margin-bottom: 0.45rem;
}

.cpf-list {
    margin: 0;
    padding: 0.15rem;
    list-style: none !important;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.16);
    max-height: none;
    overflow: visible;
    -ms-overflow-style: none; /* IE/Edge legacy */
    scrollbar-width: none; /* Firefox */
}

.cpf-list::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.cpf-list__item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.55rem;
    font-size: 0.78rem;
    line-height: 1.3;
    color: var(--text);
    border: 1px solid rgba(2, 117, 59, 0.35);
    border-left: 3px solid rgba(13, 92, 53, 0.35);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    list-style: none !important;
    margin-bottom: 0.3rem;
}

.cpf-list__item:last-child {
    margin-bottom: 0;
}

.cpf-list__mcc {
    flex: 0 0 auto;
    min-width: 4.15rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.7rem;
    line-height: 1.15;
    color: var(--accent);
    background: rgba(13, 92, 53, 0.12);
    border: 1px solid rgba(13, 92, 53, 0.25);
    border-radius: 999px;
    padding: 0.2rem 0.35rem;
}

.cpf-list__ramo {
    flex: 1 1 auto;
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #153123;
}

.field--inline.field--cnae {
    flex: 1 1 0;
    min-width: 0;
}

.field--inline.field--mcc {
    flex: 0 0 6.25rem;
    max-width: 38%;
}

@media (min-width: 360px) {
    .field--inline.field--mcc {
        flex-basis: 6.75rem;
    }
}

.field__label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.field__input {
    width: 100%;
    font-size: 0.88rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
}

/* Descrição: altura ajustada via JS (sem barra de rolagem interna) */
.field__input--area {
    resize: none;
    min-height: 5.5rem;
    line-height: 1.35;
    overflow: hidden;
    box-sizing: border-box;
}

.app__footer {
    margin-top: 0.55rem;
    text-align: center;
}

.link-muted {
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.78rem;
    text-decoration: none;
}

.link-muted:hover {
    color: #fff;
    text-decoration: underline;
}

.footer-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1;
    text-decoration: none;
    padding: 0.5rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    background: rgba(13, 92, 53, 0.28);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.footer-whatsapp:link,
.footer-whatsapp:visited {
    color: #ffffff;
    text-decoration: none;
}

.footer-whatsapp:hover,
.footer-whatsapp:focus-visible {
    background: rgba(13, 92, 53, 0.45);
    border-color: rgba(255, 255, 255, 0.4);
}

.footer-whatsapp__icon {
    width: 1.05rem;
    height: 1.05rem;
    object-fit: contain;
    flex: 0 0 auto;
}

.footer-dev {
    margin: 0.55rem 0 0;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.8rem;
    letter-spacing: 0.01em;
}

@media (min-width: 480px) {
    .app {
        padding: 1rem 1rem 1.25rem;
    }

    .app__title {
        font-size: 1.45rem;
    }

    .app__subtitle {
        font-size: 0.9rem;
    }

    .card {
        padding: 1rem 1.1rem;
    }

    .field__input--area {
        min-height: 6.5rem;
    }
}
