:root {
    color-scheme: dark;
    --bg: #101215;
    --panel: #181b20;
    --panel-2: #20242b;
    --line: #303640;
    --text: #f4f7fb;
    --muted: #a6b0bf;
    --accent: #e83f5b;
    --accent-2: #15c8a8;
    --warning: #f0b23f;
    --danger: #ff5b5f;
    --blue: #5d9cec;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(16, 18, 21, 0.96);
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent-2);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: 24px;
}

h2 {
    font-size: 20px;
}

.tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.tabs a {
    color: var(--muted);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 6px;
    font-weight: 700;
}

.tabs a.active {
    color: var(--text);
    background: var(--panel-2);
}

main {
    width: min(1440px, calc(100% - 32px));
    margin: 24px auto 48px;
}

.toast {
    width: min(1440px, calc(100% - 32px));
    margin: 18px auto 0;
    padding: 12px 14px;
    border: 1px solid rgba(21, 200, 168, 0.45);
    border-radius: 8px;
    background: rgba(21, 200, 168, 0.12);
    color: #c9fff5;
}

.monitor-layout,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.monitor-layout {
    min-height: calc(100vh - 150px);
    padding: 20px;
}

.monitor-head,
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.status-line {
    display: flex;
    gap: 12px;
    color: var(--muted);
    font-weight: 700;
}

.status-line span,
.pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.hr-card {
    display: grid;
    gap: 14px;
    min-height: 250px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
}

.hr-card.zone-aquecimento {
    border-color: rgba(93, 156, 236, 0.55);
}

.hr-card.zone-leve {
    border-color: rgba(21, 200, 168, 0.55);
}

.hr-card.zone-moderado {
    border-color: rgba(240, 178, 63, 0.58);
}

.hr-card.zone-intenso,
.hr-card.zone-maximo {
    border-color: rgba(232, 63, 91, 0.68);
}

.athlete-line {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.athlete-line strong {
    display: block;
    font-size: 22px;
}

.athlete-line span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.bpm-row {
    display: grid;
    grid-template-columns: 72px 1fr;
    align-items: center;
    gap: 14px;
}

.heart-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    animation: pulse 1s ease-in-out infinite;
}

.bpm-value {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.bpm-value strong {
    font-size: 68px;
    line-height: 0.95;
    letter-spacing: 0;
}

.bpm-value span {
    color: var(--muted);
    font-size: 15px;
    font-weight: 800;
}

.progress {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #111419;
}

.progress span {
    display: block;
    width: var(--value, 0%);
    height: 100%;
    border-radius: inherit;
    background: var(--accent-2);
}

.zone-intenso .progress span,
.zone-maximo .progress span {
    background: var(--accent);
}

.zone-moderado .progress span {
    background: var(--warning);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.metric {
    min-height: 66px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #15181d;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.metric strong {
    display: block;
    margin-top: 4px;
    font-size: 18px;
}

.split-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.panel {
    padding: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

input,
select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 0 11px;
    outline: none;
    background: #111419;
    color: var(--text);
}

input:focus,
select:focus {
    border-color: var(--accent-2);
}

button {
    min-height: 42px;
    border: 0;
    border-radius: 7px;
    padding: 0 14px;
    cursor: pointer;
    font-weight: 900;
}

button.primary {
    align-self: end;
    background: var(--accent);
    color: white;
}

button.ghost {
    min-height: 34px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
}

.download-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 7px;
    padding: 0 14px;
    background: var(--accent);
    color: white;
    font-weight: 900;
    text-decoration: none;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.empty-state {
    display: grid;
    place-items: center;
    align-content: center;
    min-height: 320px;
    grid-column: 1 / -1;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong {
    color: var(--text);
    font-size: 22px;
}

.receiver-log {
    min-height: 360px;
    max-height: 560px;
    overflow: auto;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0d0f12;
    color: #d8ffe9;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.12);
    }
}

@media (max-width: 760px) {
    .topbar,
    .monitor-head,
    .panel-head {
        align-items: stretch;
        flex-direction: column;
    }

    .tabs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .tabs a {
        text-align: center;
    }

    .split-layout,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .metrics {
        grid-template-columns: 1fr;
    }

    .bpm-value strong {
        font-size: 56px;
    }
}
