:root {
    --simas-red: #b5121b;
    --simas-red-dark: #8f0e15;
    --simas-yellow: #f4c430;
    --qsa-text: #252525;
    --qsa-muted: #606060;
    --qsa-surface: #ffffff;
    --qsa-background: #f6f6f6;
}

html,
body {
    min-height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    margin: 0;
    color: var(--qsa-text);
    background: var(--qsa-background);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.qsa-header {
    color: #fff;
    background: var(--simas-red);
    border-bottom: 5px solid var(--simas-yellow);
}

.simas-brand {
    color: #fff;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-decoration: none;
}

.simas-brand:hover {
    color: #fff;
}

.program-label {
    font-weight: 600;
}

.admin-nav,
.user-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-nav a {
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.admin-nav a:hover {
    text-decoration: underline;
}

.user-area span {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.user-area small {
    color: #ffe69c;
    font-size: .7rem;
}

.page-content {
    display: flex;
    flex: 1;
    align-items: center;
    padding: 4rem 0;
}

.hero-card,
.content-card,
.login-card,
.admin-card {
    max-width: 760px;
    padding: clamp(2rem, 6vw, 4.5rem);
    background: var(--qsa-surface);
    border-radius: 1rem;
    box-shadow: 0 12px 35px rgba(0, 0, 0, .08);
}

.login-card {
    max-width: 480px;
}

.admin-card {
    max-width: 1100px;
}

.form-card {
    max-width: 720px;
}

.page-content-top {
    align-items: flex-start;
}

.simas-login {
    color: var(--simas-red);
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: .1em;
}

.actions-cell {
    white-space: nowrap;
}

.sac-nav { display: flex; flex-wrap: wrap; gap: .5rem; }
.sac-nav a { padding: .55rem .9rem; color: var(--qsa-text); background: #fff; border: 1px solid #ddd; border-radius: .5rem; font-weight: 600; text-decoration: none; }
.sac-nav a:hover { color: var(--simas-red); border-color: var(--simas-red); }
.metric-card { display: flex; min-height: 180px; height: 100%; flex-direction: column; justify-content: center; padding: 1.75rem; background: #fff; border-left: 6px solid var(--simas-red); border-radius: 1rem; box-shadow: 0 10px 28px rgba(0, 0, 0, .07); }
.metric-card > span, .metric-card small { color: var(--qsa-muted); font-weight: 600; }
.metric-card > strong { font-size: clamp(2.6rem, 7vw, 4.5rem); line-height: 1.1; }
.status-card.status-bom { border-color: #198754; background: #eaf7f0; }
.status-card.status-atencao { border-color: #e0a800; background: #fff8dc; }
.status-card.status-acima { border-color: #dc3545; background: #fdecee; }
.status-card.status-acima_da_meta { border-color: #dc3545; background: #fdecee; }
.status-card.status-sem_dados { border-color: #6c757d; background: #f1f3f5; }
.status-card .status-label { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.ranking-card { max-width: none; }
.ranking-list { margin: 0; padding-left: 1.5rem; }
.ranking-list li { padding: .65rem .25rem; border-bottom: 1px solid #eee; }
.ranking-list li:last-child { border-bottom: 0; }
.ranking-list li span { margin-left: .5rem; }
.ranking-list li strong { float: right; color: var(--simas-red); }
.filter-box { padding: 1rem; background: #f8f9fa; border: 1px solid #e5e5e5; border-radius: .75rem; }

.reprocesso-main { text-align:center; padding:2rem; min-height:384px; background:#fff; border-radius:1rem; box-shadow:0 10px 28px rgba(0,0,0,.07); }
.reprocesso-main > span { display:block; color:var(--qsa-muted); font-weight:600; }
.reprocesso-gauge { width:100%; max-width:620px; margin:.25rem auto 0; }
.reprocesso-gauge .reprocesso-gauge__svg { display:block; width:100%; height:auto; }
.reprocesso-gauge .reprocesso-gauge__faixa { stroke:none; }
.reprocesso-gauge .reprocesso-gauge__faixa--boa { fill:#198754; }
.reprocesso-gauge .reprocesso-gauge__faixa--atencao { fill:#e0a800; }
.reprocesso-gauge .reprocesso-gauge__faixa--critica { fill:#dc3545; }
.reprocesso-gauge .reprocesso-gauge__marca { stroke:#687078; stroke-width:2; }
.reprocesso-gauge .reprocesso-gauge__rotulo { fill:#596168; font-size:13px; font-weight:700; text-anchor:middle; dominant-baseline:middle; }
.reprocesso-gauge .reprocesso-gauge__ponteiro { fill:#343a40; }
.reprocesso-gauge .reprocesso-gauge__eixo { fill:#343a40; stroke:#fff; stroke-width:3; }
.reprocesso-gauge .reprocesso-gauge__eixo-centro { fill:#8d969e; }
.reprocesso-gauge-value { display:block; margin-top:-.6rem; font-size:clamp(2.8rem,8vw,5rem); line-height:1; }
.reprocesso-gauge-empty { display:block; margin-top:-.2rem; color:#6c757d; font-size:clamp(1.4rem,4vw,2rem); line-height:1.2; }
.reprocesso-gauge-status { display:block; margin-top:.55rem; font-size:1.05rem; letter-spacing:.08em; }
.reprocesso-gauge-legend { display:flex; flex-wrap:wrap; justify-content:center; gap:.55rem 1.15rem; margin-top:1.35rem; color:#596168; font-size:.82rem; font-weight:600; }
.reprocesso-gauge-legend > span { display:inline-flex; align-items:center; gap:.35rem; }
.reprocesso-gauge-legend i { width:.7rem; height:.7rem; border-radius:50%; flex:none; }
.legend-bom { background:#198754; }.legend-atencao { background:#e0a800; }.legend-acima { background:#dc3545; }
.reprocesso-gauge.is-empty .reprocesso-gauge__faixas { opacity:.28; filter:grayscale(1); }
.reprocesso-bom .reprocesso-gauge-status { color:#198754; }.reprocesso-atencao .reprocesso-gauge-status { color:#a07800; }.reprocesso-acima_da_meta .reprocesso-gauge-status { color:#dc3545; }.reprocesso-sem_dados .reprocesso-gauge-status { color:#6c757d; }
@media (max-width:575.98px) { .reprocesso-main { padding:1.35rem .85rem; }.reprocesso-gauge .reprocesso-gauge__rotulo { font-size:11px; }.reprocesso-gauge-legend { align-items:flex-start; flex-direction:column; text-align:left; width:max-content; max-width:100%; } }
.observacao-resumo { max-width:300px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.texto-conteudo-resumo { max-width:420px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.varredura-summary > strong { display:block; margin:2.5rem 0 1rem; font-size:clamp(3rem,8vw,6rem); line-height:1; }
.varredura-summary > strong.sem-dados { font-size:clamp(1.6rem,4vw,2.7rem); }
.varredura-summary > b { display:block; font-size:1.15rem; letter-spacing:.08em; }
.varredura-bom > b { color:#198754; }.varredura-atencao > b { color:#a07800; }.varredura-acima_da_meta > b { color:#dc3545; }.varredura-sem_dados > b { color:#6c757d; }
.varredura-page { padding-bottom:3rem; }
.varredura-cards { display:grid; grid-template-columns:minmax(0,3fr) minmax(0,2fr); gap:1.5rem; align-items:stretch; }
.varredura-card { min-width:0; padding:clamp(1.5rem,3vw,2.5rem); background:var(--qsa-surface); border-radius:1rem; box-shadow:0 12px 35px rgba(0,0,0,.08); }
.varredura-summary > strong { margin:1.5rem 0 .75rem; font-size:clamp(2.75rem,6vw,5rem); overflow-wrap:anywhere; }
.varredura-details { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; margin:1.5rem 0 1rem; }
.varredura-details div { padding-top:.85rem; border-top:1px solid #ddd; }
.varredura-details dt,.varredura-metric small { color:var(--qsa-muted); font-weight:400; }
.varredura-details dd { margin:0; font-weight:700; }
.varredura-comparison { display:flex; flex-direction:column; gap:1.15rem; }
.varredura-metric { padding-top:1rem; border-top:1px solid #ddd; }
.varredura-metric strong { display:block; font-size:clamp(1.35rem,2.5vw,2rem); overflow-wrap:anywhere; }
.varredura-comparison p { margin:auto 0 0; color:var(--qsa-muted); }
.varredura-message { margin:2rem 0 0; }
@media (max-width:767.98px) { .varredura-cards { grid-template-columns:1fr; }.varredura-details { grid-template-columns:1fr; } }

.simas-display {
    color: var(--simas-red);
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 900;
    letter-spacing: .1em;
}

.section-kicker {
    margin-bottom: .5rem;
    color: var(--simas-red);
    font-size: .85rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 750;
}

.lead {
    color: var(--qsa-muted);
}

.accent-line {
    width: 72px;
    height: 5px;
    margin: 1.5rem 0;
    background: var(--simas-yellow);
    border-radius: 999px;
}

.btn-qsa {
    color: #fff;
    background: var(--simas-red);
    border-color: var(--simas-red);
    font-weight: 600;
}

.btn-qsa:hover,
.btn-qsa:focus {
    color: #fff;
    background: var(--simas-red-dark);
    border-color: var(--simas-red-dark);
}

.qsa-footer {
    color: var(--qsa-muted);
    background: #fff;
    border-top: 1px solid #e5e5e5;
}
.admin-nav a.active { color:#fff; background:var(--simas-red); border-radius:.4rem; }
.content-card { display:flex; flex-direction:column; }
.config-icon { font-size:2rem; color:var(--simas-red); margin-bottom:.75rem; }
.config-time-list { border:1px solid #dee2e6; border-radius:.75rem; overflow:hidden; }
.config-time-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(190px,240px); gap:1rem; align-items:center; padding:1rem; }
.config-time-row + .config-time-row { border-top:1px solid #dee2e6; }
.config-number { max-width:240px; }
@media(max-width:575.98px){.config-time-row{grid-template-columns:1fr}.config-number{max-width:none}}

@media (max-width: 576px) {
    .program-label {
        display: none;
    }

    .page-content {
        padding: 2rem 0;
    }

    .admin-nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .user-area strong {
        max-width: 130px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
.qsa-logo { display:block; width:auto; height:auto; max-height:64px; object-fit:contain; }
.media-preview { display:grid; min-height:130px; margin-bottom:1rem; place-items:center; border:1px dashed #bbb; border-radius:.75rem; background:#f8f9fa; }
.media-preview img,.admin-video-preview { display:block; width:100%; max-width:520px; max-height:300px; margin:auto; object-fit:contain; }
