:root {
    --bg: #0f172a;
    --card: #111827;
    --border: #1f2937;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --accent: #22c55e;
    --accent2: #3b82f6;
    --warn: #ef4444;
    --yellow: #f59e0b;
}



/* Não interfere no seu CSS atual: só cuida do login */
.hidden { display: none !important; }

.login-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    z-index: 9999;
}
.login-card {
    width: min(420px, 92vw);
    padding: 16px 20px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}
.login-card h1 { margin: 0 0 6px; font-size: 1.4rem; }
.login-card .subtitle { color: #666; margin-bottom: 12px; }
.login-card label { display: block; margin-top: 10px; font-weight: 600; }
.login-card input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    outline: none;
}
.login-card button {
    margin-top: 12px;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: none;
    border-radius: 8px;
    background: #2d7ef7;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}
.login-card button:hover { background: #1f6be0; }
.login-card .error { color: #d63b3b; margin-top: 8px; min-height: 20px; }




* { box-sizing: border-box; }
body {
    margin: 0;
    padding: 2rem;
    background: linear-gradient(180deg, #0b1220, #0f172a);
    color: var(--text);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial;
    line-height: 1.5; /* melhora legibilidade em telas menores */
}

.container { max-width: 1100px; margin: 0 auto; }
h1 { margin: 0 0 1rem 0; font-size: 2rem; }
.subtitle { color: var(--muted); margin-bottom: 1.5rem; }

/* === Mobile-first: 1 coluna por padrão === */
.grid {
    display: grid;
    grid-template-columns: 1fr; /* antes: 1fr 1fr, isso esmagava no celular */
    gap: 1rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.card h2 { margin: 0 0 .75rem 0; font-size: 1.1rem; }

textarea {
    width: 100%;
    min-height: 140px;
    resize: vertical;
    background: #0b1020;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .75rem;
    line-height: 1.4;
}

.actions { display: flex; gap: .75rem; margin-top: 1rem; flex-wrap: wrap; } /* wrap no mobile */
button {
    background: var(--accent2);
    color: white;
    border: none;
    border-radius: 8px;
    padding: .75rem 1rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px; /* alvo de toque */
}
button.secondary { background: #374151; }
button:disabled { opacity: .6; cursor: not-allowed; }

.results { margin-top: 1.5rem; display: grid; gap: 1rem; }

table {
    width: 100%;
    border-collapse: collapse;
    background: #0b1020;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    table-layout: auto;
}
th, td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); text-align: left; }
th { background: #121a2e; color: var(--muted); font-weight: 600; }
tr:hover td { background: rgba(59,130,246,.06); }

.tag { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .85rem; }
.tag.green { background: rgba(34,197,94,.15); color: #34d399; border: 1px solid rgba(34,197,94,.4); }
.tag.blue  { background: rgba(59,130,246,.15); color: #93c5fd; border: 1px solid rgba(59,130,246,.4); }
.tag.yellow{ background: rgba(245,158,11,.15); color: #fcd34d; border: 1px solid rgba(245,158,11,.4); }

.error { color: var(--warn); margin-top: .5rem; white-space: pre-line; }
.pill { background: #1f2937; border: 1px solid var(--border); border-radius: 999px; padding: .25rem .5rem; }
.flex { display: flex; gap: .5rem; flex-wrap: wrap; }

.bar {
    height: 10px;
    background: #0b1020;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* ===================== RESPONSIVIDADE ===================== */

/* Smartphones (até 640px) — padrão universal */
@media (max-width: 640px) {
    /* Padding fluido + safe area (notch/ilhas) */
    body {
        padding: clamp(.75rem, 4vw, 1.25rem);
        padding-left:  max(env(safe-area-inset-left),  clamp(.75rem, 4vw, 1.25rem));
        padding-right: max(env(safe-area-inset-right), clamp(.75rem, 4vw, 1.25rem));
    }

    h1 { font-size: clamp(1.25rem, 6.5vw, 1.6rem); }
    .card { padding: clamp(.75rem, 3.5vw, 1rem); }
    .card h2 { font-size: clamp(.95rem, 4.5vw, 1.1rem); }

    /* Altura do textarea com viewport dinâmico (estável em mobile) */
    textarea { min-height: clamp(160px, 28svh, 220px); }

    /* Botões em coluna e ocupando toda a largura */
    .actions { flex-direction: column; gap: .5rem; }
    .actions button { width: 100%; min-height: 44px; }

    /* Tabelas responsivas: rolagem horizontal + quebra de linha */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* evita formar barra vertical por conta de border-radius */
    }
    th, td {
        white-space: normal;      /* <<< importante: permitir quebra */
        word-break: break-word;   /* quebra tokens longos */
        padding: .5rem .6rem;     /* padding um pouco mais compacto */
    }
}

/* Telefones pequenos (até 480px) — ajustes extras */
@media (max-width: 480px) {
    h1 { font-size: clamp(1.2rem, 7vw, 1.45rem); }
    .subtitle { margin-bottom: 1rem; }
    .pill { padding: .2rem .45rem; } /* chips um pouco menores */

    /* células mais compactas para caber números e rótulos */
    th, td { font-size: .9rem; }
}

/* Telefones muito pequenos (até 375px) — iPhone SE/Android “small” */
@media (max-width: 375px) {
    .card h2 { font-size: .95rem; }
    th, td { font-size: .85rem; }
    textarea { min-height: clamp(150px, 30svh, 200px); }
}

/* Tablets (≥ 768px): 2 colunas */
@media (min-width: 768px) {
    .grid { grid-template-columns: 1fr 1fr; }
    body { padding: 1.5rem 2rem; }
    h1 { font-size: 1.9rem; }
}

/* Notebooks (≥ 1024px): refinamento */
@media (min-width: 1024px) {
    .container { max-width: 1100px; }
    h1 { font-size: 2rem; }
}

