* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --bg-main: #0b0f19;
    --sidebar-bg: #0f172a;
    --card-bg: #1e293b;
    --card-border: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-blue: #38bdf8;
    --accent-red: #f43f5e;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
}


.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.brand h2 {
    font-size: 1.25rem;
    color: var(--text-main);
}

.brand small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-item:hover {
    background-color: rgba(56, 189, 248, 0.1);
    color: var(--accent-blue);
}

.nav-item.active {
    background-color: rgba(56, 189, 248, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}


.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 1rem;
}

.value-display {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.value-display .number {
    font-size: 2.5rem;
    font-weight: bold;
}

.value-display .unit {
    font-size: 1rem;
    color: var(--text-muted);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-normal {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}


table th,
table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--card-border);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-blue) !important;
}


.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

/* BIOIOT EXPERIENCE — GEMEO DIGITAL */

.gemeo-coracao-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    gap: 24px;
}

.gemeo-coracao {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
    transform-origin: center;
    animation: pulsarGemeo 1s ease-in-out infinite;
    animation-play-state: paused;
}

.gemeo-coracao svg {
    width: 140px;
    height: 140px;
    stroke-width: 1.5;
    filter: drop-shadow(0 0 20px rgba(239, 68, 68, 0.35));
}

.gemeo-coracao.ativo {
    animation-play-state: running;
}

.gemeo-ritmo {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
}

@keyframes pulsarGemeo {

    0%,
    100% {
        transform: scale(1);
    }

    35% {
        transform: scale(1.17);
    }

    60% {
        transform: scale(1.03);
    }
}

@media (prefers-reduced-motion: reduce) {
    .gemeo-coracao {
        animation: none;
    }
}


/* BIOIOT EXPERIENCE — FLUXO DE DADOS */

.fluxo-bioiot-card {
    margin-top: 24px;
}

.fluxo-cabecalho {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
}

.fluxo-cabecalho p,
.fluxo-observacao {
    color: #94a3b8;
    font-size: 13px;
    margin-top: 6px;
}

.fluxo-status {
    padding: 8px 14px;
    border-radius: 20px;
    background: #334155;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 600;
}

.fluxo-bioiot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 8px;
}

.fluxo-etapa {
    flex: 1;
    min-width: 0;
    min-height: 156px;
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 9px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    transition: border-color 0.3s, background 0.3s;
}

.fluxo-etapa svg {
    width: 28px;
    height: 28px;
    color: #94a3b8;
}

.fluxo-etapa strong {
    font-size: 14px;
    color: #f8fafc;
}

.fluxo-etapa small {
    font-size: 11px;
    color: #94a3b8;
}

.fluxo-etapa-estado {
    font-size: 11px;
    color: #94a3b8;
}

.fluxo-etapa.ativo {
    border-color: #38bdf8;
    background: #10283c;
}

.fluxo-etapa.ativo svg {
    color: #38bdf8;
}

.fluxo-etapa.sucesso {
    border-color: #10b981;
    background: #102b29;
}

.fluxo-etapa.sucesso svg {
    color: #10b981;
}

.fluxo-etapa.inativo {
    opacity: 0.55;
}

.fluxo-conexao {
    width: 25px;
    height: 3px;
    flex-shrink: 0;
    background: #334155;
    border-radius: 3px;
    overflow: hidden;
}

.fluxo-conexao span {
    display: block;
    width: 100%;
    height: 100%;
    background: #38bdf8;
    transform: translateX(-100%);
}

.fluxo-bioiot.transmitindo .fluxo-conexao span {
    animation: fluxoTransmitir 1.8s ease-in-out infinite;
}

@keyframes fluxoTransmitir {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.fluxo-rodape {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #334155;
    color: #cbd5e1;
    font-size: 12px;
}

.fluxo-observacao {
    margin-top: 16px;
}

@media (max-width: 1100px) {
    .fluxo-bioiot {
        flex-wrap: wrap;
        justify-content: center;
    }

    .fluxo-etapa {
        flex: 1 1 140px;
    }

    .fluxo-conexao {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fluxo-conexao span {
        animation: none !important;
    }
}

.gemeo-heart-card {
    min-height: 320px;
}

.gemeo-heart-stage {
    position: relative;
    height: 230px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.heart-wrapper {
    position: relative;
    z-index: 2;
    transition: transform 0.25s ease, filter 0.25s ease;
}

.heart-svg {
    width: 180px;
    height: 180px;
    filter: drop-shadow(0 0 18px rgba(255, 80, 80, 0.18));
}

.heart-body {
    stroke: #ff4d5a;
    stroke-width: 3.2;
    fill: rgba(255, 77, 90, 0.08);
}

.heart-line {
    stroke: #ff4d5a;
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.pulse-ring {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 2px solid rgba(255, 77, 90, 0.15);
    opacity: 0;
    transform: scale(0.7);
}

.pulse-ring-1 {
    animation: ringPulse 2s infinite;
}

.pulse-ring-2 {
    animation: ringPulse 2s infinite 1s;
}

@keyframes ringPulse {
    0% {
        transform: scale(0.7);
        opacity: 0.0;
    }

    20% {
        opacity: 0.35;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.heart-beating {
    animation: heartBeatCustom 1s ease-in-out infinite;
    animation-duration: var(--heart-duration, 1s);
}

@keyframes heartBeatCustom {
    0% {
        transform: scale(1);
    }

    18% {
        transform: scale(1.08);
    }

    36% {
        transform: scale(0.98);
    }

    54% {
        transform: scale(1.1);
    }

    72% {
        transform: scale(1);
    }

    100% {
        transform: scale(1);
    }
}

.heart-idle {
    animation: none;
    opacity: 0.85;
}

.heart-offline {
    animation: none;
    opacity: 0.45;
    filter: grayscale(0.7);
}

@keyframes heartIdle {
    0% {
        transform: scale(1);
        opacity: 0.92;
    }

    50% {
        transform: scale(1.02);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.92;
    }
}

.heart-offline {
    opacity: 0.6;
    filter: grayscale(0.25);
}

.gemeo-heart-bpm {
    text-align: center;
    margin-top: 12px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #8fb8ff;
}

.gemeo-heart-subtitle {
    text-align: center;
    margin-top: 10px;
    opacity: 0.9;
}

.pulse-ring {
    animation: none;
}

.gemeo-heart-stage.medindo .pulse-ring-1 {
    animation: ringPulse var(--heart-duration, 1s) ease-out infinite;
}

.gemeo-heart-stage.medindo .pulse-ring-2 {
    animation: ringPulse var(--heart-duration, 1s) ease-out infinite;
    animation-delay: calc(var(--heart-duration, 1s) / -2);
}

@media (max-width: 600px) {
    .gemeo-metric-grid {
        grid-template-columns: 1fr;
    }

    .gemeo-metric-box-full {
        grid-column: auto;
    }
}

@media (prefers-reduced-motion: reduce) {

    .heart-wrapper,
    .pulse-ring {
        animation: none !important;
    }
}

.gemeo-data-card {
    min-height: 320px;
}

.gemeo-metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
}

.gemeo-metric-box {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 22px;
}

.gemeo-metric-box-full {
    grid-column: 1 / -1;
}

.gemeo-metric-label {
    display: block;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
}

.gemeo-metric-box strong {
    display: block;
    font-size: 24px;
    line-height: 1.35;
}

.gemeo-bpm-valor {
    color: #f43f5e;
}

.gemeo-spo2-valor {
    color: #38bdf8;
}

@media (max-width: 600px) {
    .gemeo-metric-grid {
        grid-template-columns: 1fr;
    }

    .gemeo-metric-box-full {
        grid-column: auto;
    }
}

/* ===== GÊMEO DIGITAL — CORAÇÃO ANATÔMICO ===== */

.gemeo-heart-card {
    min-height: 320px;
}

.gemeo-heart-stage {
    position: relative;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    gap: 10px;
}

.anatomical-heart-shell {
    position: relative;
    width: 230px;
    height: 230px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.anatomical-heart-svg {
    width: 210px;
    height: 210px;
    overflow: visible;
    filter: drop-shadow(0 0 18px rgba(239, 68, 68, 0.18));
}

.heart-shadow {
    fill: rgba(0, 0, 0, 0.18);
}

.heart-main {
    fill: #8f1d2c;
    stroke: #ff6675;
    stroke-width: 2.2;
}

.heart-left {
    fill: #b42335;
    opacity: 0.95;
}

.heart-right {
    fill: #8a1830;
    opacity: 0.95;
}

.heart-aorta,
.heart-artery {
    fill: none;
    stroke: #ff8a94;
    stroke-width: 7;
    stroke-linecap: round;
}

.heart-detail {
    fill: none;
    stroke: rgba(255, 170, 176, 0.45);
    stroke-width: 3;
    stroke-linecap: round;
}

.heart-highlight {
    fill: none;
    stroke: rgba(255, 255, 255, 0.22);
    stroke-width: 3;
    stroke-linecap: round;
}

#anatomicalHeartGroup {
    transform-origin: center;
}

.heart-beating {
    animation-name: heartBeatDynamic;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

.heart-idle {
    animation: heartIdleSoft 2.6s ease-in-out infinite;
}

.heart-offline {
    opacity: 0.45;
    filter: grayscale(0.45);
}

@keyframes heartBeatDynamic {
    0% {
        transform: scale(1);
    }

    18% {
        transform: scale(1.07);
    }

    36% {
        transform: scale(0.98);
    }

    55% {
        transform: scale(1.12);
    }

    75% {
        transform: scale(1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes heartIdleSoft {
    0% {
        transform: scale(1);
        opacity: 0.94;
    }

    50% {
        transform: scale(1.02);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.94;
    }
}

.gemeo-heart-bpm {
    text-align: center;
    margin-top: 6px;
    font-size: 1.6rem;
    font-weight: 800;
    color: #93c5fd;
}

.gemeo-heart-subtitle {
    text-align: center;
    font-size: 1rem;
    color: #cbd5e1;
    font-weight: 600;
}

.gemeo-heart-legend {
    text-align: center;
    margin-top: 10px;
    color: #cbd5e1;
    opacity: 0.95;
}

#anatomicalHeartGroup.heart-beating {
    animation: heartBeatDynamic var(--duracao-batimento, 1s) ease-in-out infinite;
    transform-box: fill-box;
    transform-origin: center;
}

#anatomicalHeartGroup.heart-idle,
#anatomicalHeartGroup.heart-offline {
    animation: none;
}

#anatomicalHeartGroup.heart-offline {
    opacity: 0.45;
    filter: grayscale(0.7);
}

@media (prefers-reduced-motion: reduce) {
    #anatomicalHeartGroup.heart-beating {
        animation: none !important;
    }
}


/* BIOIOT EXPERIENCE — MODO APRESENTAÇÃO */

.gemeo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.gemeo-acoes {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-apresentacao,
.btn-sair-apresentacao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 10px;
    border: 1px solid #38bdf8;
    font-weight: 700;
    cursor: pointer;
    background: #123047;
    color: #e0f2fe;
}

.btn-apresentacao:hover,
.btn-sair-apresentacao:hover {
    background: #164766;
}

.btn-apresentacao svg,
.btn-sair-apresentacao svg {
    width: 18px;
    height: 18px;
}

.btn-apresentacao[hidden],
.btn-sair-apresentacao[hidden] {
    display: none !important;
}

/* Quando o Modo Apresentação estiver ativo */

body.modo-apresentacao .sidebar {
    display: none;
}

body.modo-apresentacao .main-content {
    margin-left: 0;
    width: 100%;
    padding: 24px 36px;
}

body.modo-apresentacao .top-bar {
    display: none !important;
}

body.modo-apresentacao #gemeo-digital {
    max-width: 1800px;
    margin: 0 auto;
}

body.modo-apresentacao #gemeo-digital h1 {
    font-size: 2.5rem;
}

body.modo-apresentacao .gemeo-heart-stage {
    min-height: 380px;
}

body.modo-apresentacao .anatomical-heart-shell {
    width: 300px;
    height: 300px;
}

body.modo-apresentacao .anatomical-heart-svg {
    width: 280px;
    height: 280px;
}

body.modo-apresentacao .gemeo-metric-box strong {
    font-size: 36px;
}

body.modo-apresentacao .fluxo-etapa {
    min-height: 175px;
}

@media (max-width: 700px) {
    body.modo-apresentacao .main-content {
        padding: 16px;
    }

    body.modo-apresentacao #gemeo-digital h1 {
        font-size: 1.8rem;
    }
}


/* BIOIOT — CORAÇÃO ANATÔMICO REFINADO */

.anatomical-heart-shell {
    width: 240px;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.anatomical-heart-svg {
    width: 220px;
    height: 250px;
    overflow: visible;
    filter: drop-shadow(0 0 18px rgba(198, 38, 65, .18));
}

#anatomicalHeartGroup {
    transform-box: fill-box;
    transform-origin: center 48%;
}

#anatomicalHeartGroup.heart-beating {
    animation: batimentoAnatomico var(--duracao-batimento, 1s) ease-in-out infinite;
}

#anatomicalHeartGroup.heart-idle {
    animation: none;
    opacity: .92;
}

#anatomicalHeartGroup.heart-offline {
    animation: none;
    opacity: .40;
    filter: grayscale(.8);
}

@keyframes batimentoAnatomico {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    18% {
        transform: scale(1.065) rotate(-1deg);
    }

    34% {
        transform: scale(.985) rotate(0deg);
    }

    49% {
        transform: scale(1.035) rotate(.5deg);
    }

    70% {
        transform: scale(1) rotate(0deg);
    }
}

/* Aumenta proporcionalmente no Modo Apresentação */

body.modo-apresentacao .anatomical-heart-shell {
    width: 300px;
    height: 310px;
}

body.modo-apresentacao .anatomical-heart-svg {
    width: 270px;
    height: 305px;
}

@media (prefers-reduced-motion: reduce) {
    #anatomicalHeartGroup.heart-beating {
        animation: none !important;
    }
}

/* BIOIOT — AJUSTE FINAL DO CORAÇÃO ANATÔMICO */

.gemeo-heart-card {
    display: flex;
    flex-direction: column;
}

.gemeo-heart-stage {
    height: auto;
    min-height: 315px;
    padding: 16px 0 12px;
    overflow: visible;
}

.anatomical-heart-shell {
    width: 230px;
    height: 240px;
    flex-shrink: 0;
}

.anatomical-heart-svg {
    width: 205px;
    height: 230px;
}

.gemeo-heart-bpm {
    margin-top: 8px;
    line-height: 1.3;
}

.gemeo-heart-subtitle {
    margin-top: 4px;
    line-height: 1.4;
}

/* Ajustes específicos do Modo Apresentação */

body.modo-apresentacao .gemeo-heart-stage {
    min-height: 360px;
    padding: 10px 0 12px;
}

body.modo-apresentacao .anatomical-heart-shell {
    width: 255px;
    height: 255px;
}

body.modo-apresentacao .anatomical-heart-svg {
    width: 230px;
    height: 250px;
}

body.modo-apresentacao .gemeo-heart-bpm {
    margin-top: 8px;
}

body.modo-apresentacao .gemeo-heart-subtitle {
    margin-top: 4px;
}