/* Estilo do portal. Serve como arquivo proprio para que a Content-Security-Policy
   possa recusar style inline ('style-src self'), sem 'unsafe-inline'.
 *
 * The portal's two screens -- upload and dashboard -- were two different
 * designs: indigo #1a237e with Segoe UI and a heavy shadow here, teal with
 * tokens and monospaced numerals there. Going from one to the other felt like
 * leaving the product. The tokens below moved here, the file both screens load,
 * and dashboard.css only adds what is its own.
 *
 * No external font on purpose: the CSP only accepts resources from our own
 * domain, so the personality comes from arrangement and weight, not from a
 * downloaded family.
 */

:root {
    --tinta:      #0F1729;   /* azul-noite: texto e superficie de destaque */
    --tinta-2:    #3D4A63;   /* texto secundario */
    --papel:      #F4F6F9;   /* fundo frio de painel */
    --superficie: #FFFFFF;
    --linha:      #E3E8EF;
    --sinal:      #0B7285;   /* teal de rede: a cor de identidade do portal */
    --sinal-fraco:#E6F3F5;
    --sinal-forte:#095C6B;
    --alta:       #1F7A3D;   /* crescimento, sucesso */
    --baixa:      #C0392B;   /* queda, erro */
    --ambar:      #B7791F;   /* atencao */

    --num: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, monospace;
    --texto: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
             "Helvetica Neue", Arial, sans-serif;
    --raio: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--texto);
    background: var(--papel);
    color: var(--tinta);
    -webkit-font-smoothing: antialiased;
}

/* --- cabecalho ----------------------------------------------------------- */

.header {
    background: var(--tinta);
    color: #fff;
    padding: 1.1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.header h1 {
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}
/* The subtitle in small caps, like the dashboard labels: same role in the
   hierarchy, so the same treatment. */
.header p {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #93A3BF;
    margin-top: .3rem;
}
.header-usuario { display: flex; align-items: center; gap: .85rem; }
.usuario-email { font-size: .78rem; color: #A9B8D0; font-family: var(--num); }

/* --- estrutura ----------------------------------------------------------- */

.container { max-width: 960px; margin: 1.75rem auto; padding: 0 1.25rem 3rem; }

.card {
    background: var(--superficie);
    border: 1px solid var(--linha);
    border-radius: var(--raio);
    box-shadow: 0 1px 2px rgba(15, 23, 41, .04);
    padding: 1.25rem 1.35rem 1.4rem;
    margin-bottom: 1.1rem;
}
/* Section title in the dashboard's register: small caps with letter spacing.
   The thick bottom rule is gone -- it split the card in two and competed with
   the card's own border. */
.card h2 {
    font-size: .78rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--tinta-2);
    margin-bottom: 1rem;
}

/* --- formulario ---------------------------------------------------------- */

.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--tinta-2);
    margin-bottom: .35rem;
}
.form-group select,
.form-group input[type="file"] {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--linha);
    border-radius: 6px;
    font: inherit;
    font-size: .88rem;
    background: var(--superficie);
    color: var(--tinta);
}
.form-group select { font-family: var(--num); }
.form-group select:hover,
.form-group input[type="file"]:hover { border-color: #CBD3E0; }
.form-group select:focus-visible,
.form-group input:focus-visible,
.btn:focus-visible,
.dashboard-link:focus-visible {
    outline: 2px solid var(--sinal);
    outline-offset: 2px;
}

.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1 1 220px; }

.btn {
    padding: .6rem 1.15rem;
    border: 1px solid transparent;
    border-radius: 6px;
    font: inherit;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--sinal); color: #fff; }
.btn-primary:hover { background: var(--sinal-forte); }
.btn-primary:disabled { background: #9FB4BA; cursor: not-allowed; }
.btn-sair {
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border-color: rgba(255, 255, 255, .18);
}
.btn-sair:hover { background: rgba(255, 255, 255, .22); }

.help { font-size: .72rem; color: var(--tinta-2); margin-top: .35rem; }

.dashboard-link {
    display: inline-block;
    margin-top: .75rem;
    color: var(--sinal);
    text-decoration: none;
    font-weight: 600;
    font-size: .85rem;
    border-bottom: 1px solid transparent;
}
.dashboard-link:hover { border-bottom-color: var(--sinal); }

/* --- tabelas ------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; margin-top: .75rem; }
th, td {
    padding: .45rem .6rem;
    text-align: left;
    border-bottom: 1px solid #F1F4F8;
    font-size: .8rem;
}
th {
    background: var(--superficie);
    font-size: .68rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--tinta-2);
    border-bottom: 1px solid var(--linha);
    white-space: nowrap;
}
/* Zebra for the dashboard's reason: following a five-column row across to the
   result column is where the eye changes line without noticing. */
tbody tr:nth-child(even) td { background: #FAFBFD; }
tbody tr:hover td { background: var(--sinal-fraco); }
caption.help { text-align: left; margin-bottom: .25rem; }

.tabela-scroll { overflow-x: auto; }

/* --- estados ------------------------------------------------------------- */

.status-ok    { color: var(--alta); }
.status-error { color: var(--baixa); }
.status-andamento { color: var(--sinal); }

.badge-running {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: var(--sinal-fraco);
    color: var(--sinal-forte);
}

.vazio { font-size: .8rem; color: var(--tinta-2); margin-top: .75rem; }

/* --- login --------------------------------------------------------------- */

.card-login { max-width: 420px; margin: 3rem auto; text-align: center; }
.login-texto {
    font-size: .85rem;
    color: var(--tinta-2);
    margin: .75rem 0 1.25rem;
    line-height: 1.55;
}
.login-erro {
    background: #FDECEA;
    color: #8E2A1F;
    border: 1px solid #F5C6C0;
    border-radius: 6px;
    padding: .65rem .75rem;
    font-size: .82rem;
    margin-bottom: 1rem;
    text-align: left;
}

/* --- load progress panel ------------------------------------------------- */
/* Shown only while an import runs. A load takes minutes: with no number
   climbing there is no way to tell work from a wedge without reading the pod
   log. */

.progresso {
    margin: 1rem 0;
    padding: .9rem 1rem;
    border: 1px solid var(--linha);
    border-left: 3px solid var(--sinal);
    border-radius: 6px;
    background: #F7FAFB;
}
.progresso-titulo { margin: 0 0 .3rem; font-size: .9rem; font-weight: 600; }
.progresso-detalhe {
    margin: 0 0 .3rem;
    color: var(--tinta-2);
    font-size: .8rem;
    /* TIM file names are long; wrapping beats stretching the card. */
    overflow-wrap: anywhere;
}
.progresso-numeros {
    margin: 0;
    font-family: var(--num);
    font-variant-numeric: tabular-nums;
    font-size: .85rem;
    color: var(--tinta);
}

@media (max-width: 640px) {
    .header { padding: .9rem 1rem; }
    .container { padding: 0 .85rem 2.5rem; margin-top: 1.25rem; }
    .card { padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .btn { transition: none; }
}

/* The load's current step. Shown once the rows are written and only the backup
   copy is left -- which costs the size of the database, not of the sheet. */
.progresso-etapa {
    margin: .4rem 0 0;
    font-size: .78rem;
    color: var(--sinal-forte);
    font-weight: 600;
}
.progresso-etapa[hidden] { display: none; }
