:root {
    --bg-body: #0B0F17;
    --bg-card: #181D26;
    --bg-card-inner: #111827;
    --bg-card-dark: #141923;
    --border-primary: #2D3748;
    --border-subtle: #1F2937;
    --border-dark: #232B3A;
    --text-main: #FFFFFF;
    --text-body: #E2E8F0;
    --text-muted: #9CA3AF;
    --text-dim: #6B7280;
    --accent-cyan: #38BDF8;
    --accent-emerald: #10B981;
    --accent-amber: #F59E0B;
    --accent-red: #EF4444;
    --accent-indigo: #818CF8;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-math: 'Cambria Math', 'Latin Modern Math', Georgia, serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-body);
    color: var(--text-body);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
}

.app-container {
    width: 100%;
    max-width: 1560px;
    margin: 0 auto;
    padding: 16px 24px;
    flex: 1;
}

.header-bloco {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 20px;
}

.header-logo {
    font-size: clamp(34px, 5.5vw, 56px);
    font-weight: 900;
    letter-spacing: 4px;
    color: var(--text-main);
    margin: 0;
    line-height: 1.1;
}

.header-subtitulo {
    font-size: clamp(15px, 2.5vw, 21px);
    font-weight: 600;
    color: #D1D5DB;
    margin-top: 6px;
    letter-spacing: 0.5px;
}

.header-capsula {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    background: var(--bg-card-inner);
    border: 1px solid var(--border-subtle);
    border-radius: 30px;
    padding: 6px 18px;
    margin-top: 12px;
    margin-bottom: 20px;
    max-width: 100%;
}

.header-capsula-item-destaque {
    color: var(--accent-cyan);
    font-weight: 800;
    font-size: 12.5px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.header-capsula-divisor {
    color: #475569;
    font-size: 12px;
}

.header-capsula-item {
    color: #CBD5E1;
    font-size: 12px;
    font-weight: 500;
}

.header-capsula-tag {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(56, 189, 248, 0.3);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
}

.nav-pilulas-wrapper {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    width: 100%;
    padding-bottom: 4px;
}

.nav-btn {
    background-color: var(--bg-card-inner);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    border-radius: 8px;
    font-weight: 700;
    font-size: 13.5px;
    padding: 10px 20px;
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.nav-btn:hover {
    background-color: #1F2937;
    color: #F3F4F6;
    border-color: #374151;
}

.nav-btn.active {
    background-color: #1E293B;
    border: 1.5px solid var(--accent-cyan);
    color: var(--text-main);
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
}

.divisor-horizontal {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 12px 0 20px 0;
    width: 100%;
}

.camada-seletor-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.camada-seletor-capsula {
    display: flex;
    background-color: var(--bg-card-inner);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 3px;
    gap: 4px;
}

.camada-btn {
    background: transparent;
    border: none;
    padding: 6px 20px;
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.camada-btn:hover {
    color: #F3F4F6;
}

.camada-btn.active {
    background-color: #1E293B;
    color: var(--text-main);
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.nivel1-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: stretch;
    margin-bottom: 16px;
}

.status-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 74px;
}

.status-card.verde { border-left: 4px solid var(--accent-emerald); }
.status-card.ambar { border-left: 4px solid var(--accent-amber); }
.status-card.vermelho { border-left: 4px solid var(--accent-red); }

.status-titulo {
    font-size: 14.5px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.status-titulo.verde { color: #34D399; }
.status-titulo.ambar { color: #FBBF24; }
.status-titulo.vermelho { color: #F87171; }

.status-subtexto {
    color: var(--text-body);
    font-size: 13px;
    margin-top: 4px;
    line-height: 1.4;
}

.date-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 74px;
}

.date-info-tit {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.date-info-val {
    color: var(--text-main);
    font-size: 16px;
    font-weight: 900;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.date-info-sub {
    color: var(--text-dim);
    font-size: 10.5px;
    white-space: nowrap;
}

.bivariado-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.bivariado-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    padding: 20px 22px 24px 22px;
    min-height: 235px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.bivariado-topo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.bivariado-tit-interno {
    color: #D1D5DB;
    font-size: 12.5px;
    font-weight: 700;
}

.badge-qualitativo {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.bivariado-num-bloco {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 8px;
}

.bivariado-grande-num {
    color: var(--text-main);
    font-size: clamp(28px, 4vw, 34px);
    font-weight: 900;
    line-height: 1;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.bivariado-unidade {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.bivariado-descricao {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 8px;
    line-height: 1.4;
    font-style: italic;
}

.regua-wrapper {
    height: 44px;
    position: relative;
    width: 100%;
    margin-top: 14px;
}

.regua-pin-label {
    position: absolute;
    transform: translateX(-50%);
    top: 0;
    background: var(--bg-card-inner);
    color: var(--text-main);
    font-size: 11.5px;
    font-weight: 800;
    padding: 1px 7px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 5;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.regua-pin-seta {
    position: absolute;
    transform: translateX(-50%);
    top: 20px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    z-index: 5;
}

.regua-barra-ies {
    position: absolute;
    top: 26px;
    left: 0;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #991B1B 0%, #EA580C 31%, #FBBF24 44%, #10B981 71%, #06B6D4 100%);
}

.regua-barra-iis {
    position: absolute;
    top: 26px;
    left: 0;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #06B6D4 0%, #10B981 33.3%, #F59E0B 66.67%, #EF4444 100%);
}

.regua-limiar-traco {
    position: absolute;
    top: 22px;
    height: 16px;
    border-left: 2px dashed #FFFFFF;
    z-index: 4;
}

.regua-rotulos-base {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--font-mono);
    margin-top: 2px;
    white-space: nowrap;
}

.sasr-painel-box {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    padding: 18px 22px;
    margin-bottom: 24px;
}

.sasr-convergencia-grid {
    display: grid;
    grid-template-columns: 1fr auto 1.3fr auto 1fr;
    align-items: center;
    gap: 10px;
}

.trava-box {
    background: var(--bg-card-inner);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px 14px;
    min-height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.trava-tit {
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
}

.trava-val {
    color: var(--text-main);
    font-size: 17px;
    font-weight: 900;
    margin: 3px 0;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.trava-sub {
    color: var(--text-dim);
    font-size: 10.5px;
    line-height: 1.3;
}

.trava-indicador-barra {
    background: var(--border-primary);
    height: 4px;
    border-radius: 2px;
    width: 100%;
    overflow: hidden;
    margin-top: 6px;
}

.seta-convergente {
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    user-select: none;
}

.no-central-box {
    border-radius: 10px;
    padding: 12px 16px;
    min-height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.no-central-box.inativo {
    background: var(--bg-card-inner);
    border: 1.5px solid var(--accent-emerald);
}

.no-central-box.ativo {
    background: rgba(239, 68, 68, 0.15);
    border: 1.5px solid var(--accent-red);
}

.no-central-tit {
    color: var(--text-muted);
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.no-central-num {
    font-size: 26px;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 6px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.sasr-rodape {
    border-top: 1px solid var(--border-primary);
    margin-top: 12px;
    padding-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.sasr-diagnostico-txt {
    color: #D1D5DB;
    font-size: 12px;
    font-style: italic;
}

.superficie-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.card-superficie {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    padding: 18px 20px;
    min-height: 230px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-sup-topo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.card-sup-tit {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.card-sup-valor-grande {
    color: var(--text-main);
    font-size: clamp(24px, 3.5vw, 28px);
    font-weight: 800;
    line-height: 1.1;
    margin: 6px 0 0 0;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.card-sup-rodape {
    border-top: 1px solid var(--border-primary);
    padding-top: 14px;
    margin-top: 15px;
}

.popover-btn {
    background-color: var(--bg-card-inner);
    border: 1px solid #374151;
    color: #D1D5DB;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: var(--font-sans);
}

.popover-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--text-main);
    background-color: #2D3748;
}

.popover-btn.active {
    background-color: #1E293B;
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    font-weight: 800;
}

.tecnico-tablist {
    display: flex;
    justify-content: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 8px;
    margin-bottom: 18px;
    width: 100%;
}

.tecnico-tab-btn {
    background: var(--bg-card-inner);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: var(--font-sans);
}

.tecnico-tab-btn:hover {
    color: #F3F4F6;
    background-color: #1F2937;
    border-color: #374151;
}

.tecnico-tab-btn.active {
    background-color: #1E293B;
    color: var(--accent-cyan);
    border: 1.5px solid var(--accent-cyan);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.tecnico-tab-content {
    display: none;
}

.tecnico-tab-content.active {
    display: block;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    padding: 24px;
    max-width: 550px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.modal-fechar-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: var(--bg-card-inner);
    border: 1px solid var(--border-primary);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
}

.modal-fechar-btn:hover {
    color: var(--text-main);
    border-color: var(--accent-cyan);
}

.chat-flutuante-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 1.5px solid var(--accent-cyan);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 16px rgba(56, 189, 248, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
}

.chat-flutuante-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 25px rgba(56, 189, 248, 0.5);
}

.chat-btn-sihs {
    font-size: 13px;
    font-weight: 900;
    color: var(--text-main);
    line-height: 1;
    letter-spacing: 0.8px;
}

.chat-btn-ia {
    font-size: 9.5px;
    font-weight: 800;
    color: var(--accent-cyan);
    line-height: 1;
    margin-top: 3px;
    letter-spacing: 0.5px;
}

.chat-status-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent-emerald);
    border: 2px solid var(--bg-body);
}

.chat-janela {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 1000;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background-color: var(--bg-card-dark);
    border: 1.5px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.85), 0 0 20px rgba(56, 189, 248, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-janela.active {
    display: flex;
}

.chat-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-primary);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-tit {
    color: var(--accent-cyan);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.chat-header-sub {
    color: var(--text-muted);
    font-size: 10.5px;
    margin-top: 1px;
}

.chat-fechar-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}

.chat-fechar-btn:hover {
    color: var(--text-main);
    background-color: var(--bg-card-inner);
}

.chat-mensagens {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-mensagens::-webkit-scrollbar {
    width: 5px;
}

.chat-mensagens::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 4px;
}

.chat-msg {
    max-width: 86%;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.55;
    word-break: break-word;
}

.chat-msg.user {
    align-self: flex-end;
    background-color: #1E293B;
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #FFFFFF;
    border-bottom-right-radius: 2px;
}

.chat-msg.bot {
    align-self: flex-start;
    background-color: var(--bg-card-inner);
    border: 1px solid var(--border-subtle);
    color: var(--text-body);
    border-bottom-left-radius: 2px;
}

.chat-chips-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px 10px 14px;
}

.chat-chip-btn {
    background: var(--bg-card-inner);
    border: 1px solid var(--border-primary);
    color: var(--accent-cyan);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
}

.chat-chip-btn:hover {
    background: #1E293B;
    border-color: var(--accent-cyan);
    color: #FFFFFF;
}

.chat-digitando {
    display: none;
    align-self: flex-start;
    background: var(--bg-card-inner);
    border: 1px solid var(--border-subtle);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 11.5px;
    color: var(--text-muted);
    font-style: italic;
}

.chat-input-wrapper {
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-primary);
    padding: 10px 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input-campo {
    flex: 1;
    background: var(--bg-card-inner);
    border: 1px solid #374151;
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    font-family: var(--font-sans);
}

.chat-input-campo:focus {
    border-color: var(--accent-cyan);
}

.chat-enviar-btn {
    background-color: #1E293B;
    border: 1px solid var(--accent-cyan);
    color: var(--text-main);
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
}

.chat-enviar-btn:hover {
    background-color: var(--accent-cyan);
    color: var(--bg-body);
}

.footer-bloco {
    margin-top: 50px;
    border-top: 1px solid var(--border-subtle);
    padding-top: 22px;
    text-align: center;
    margin-bottom: 24px;
}

.footer-tit {
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.footer-sub {
    color: var(--text-dim);
    font-size: 12px;
    margin-top: 5px;
}

@media (max-width: 1024px) {
    .superficie-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .app-container {
        padding: 12px 14px;
    }

    .nivel1-grid {
        grid-template-columns: 1fr;
    }

    .date-card {
        justify-content: space-between;
    }

    .bivariado-grid {
        grid-template-columns: 1fr;
    }

    .sasr-convergencia-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .seta-convergente {
        transform: rotate(90deg) !important;
        margin: 4px 0;
        font-size: 20px;
    }

    .superficie-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .nav-pilulas-wrapper {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .nav-btn {
        width: 100%;
        text-align: center;
        padding: 10px 14px;
        font-size: 13px;
    }

    .tecnico-tablist {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .tecnico-tab-btn {
        width: 100% !important;
        text-align: center !important;
        padding: 10px 8px !important;
        font-size: 12px !important;
    }

    .tecnico-tab-btn:nth-child(5) {
        grid-column: span 2 !important;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 8px 10px;
    }

    .header-logo {
        font-size: 30px;
    }

    .header-subtitulo {
        font-size: 14px;
    }

    .regua-rotulos-base {
        font-size: 9.5px;
    }

    .chat-flutuante-btn {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }

    .chat-janela {
        bottom: 80px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
        height: 75vh;
    }
}