:root {
    --bg: #09090b;
    --panel: #18181b;
    --text: #e4e4e7;
    --muted: #9ca3af;
    --compra-forte: #14532d;
    --compra: #15803d;
    --compra-fraca: #22c55e;
    --venda-forte: #7f1d1d;
    --venda: #b91c1c;
    --venda-fraca: #ef4444;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

main {
    max-width: 720px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

/* Top bar + staleness badge */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin: 0;
}

.actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pip-btn {
    font: inherit;
    font-size: 0.8rem;
    color: var(--text);
    background: transparent;
    border: 1px solid #3f3f46;
    border-radius: 0.4rem;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
}

.pip-btn:hover {
    background: var(--panel);
    border-color: #52525b;
}

/* Once the panel is floating, "Flutuar" is redundant -- the PiP window matches
   display-mode: picture-in-picture, so hide it there (still shown in the tab). */
@media (display-mode: picture-in-picture) {
    .pip-btn {
        display: none;
    }
}

.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    border: 1px solid transparent;
    text-transform: lowercase;
}

.badge::before {
    content: "";
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    margin-right: 0.4rem;
    vertical-align: middle;
    background: currentColor;
}

.badge-live {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.4);
}

.badge-stale {
    color: #f87171;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
}

.badge-connecting {
    color: var(--muted);
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.3);
}

/* Two columns: Índice, Dólar */
.grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 1.5rem;
}

.col-head {
    min-height: 4rem;
}

.col-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.col-sub {
    color: var(--muted);
    font-size: 0.8rem;
}

.items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* A reading (médio / curto): header + price ladder */
.item-head {
    padding: 0.4rem 0.6rem;
    border-radius: 0.4rem 0.4rem 0 0;
}

.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.item-label {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.item-dist {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.item-signal {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    opacity: 0.85;
}

.ladder {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: center;
}

.layer {
    padding: 0.35rem;
    font-variant-numeric: tabular-nums;
}

/* Heatmap cells */
.compra-forte {
    background: var(--compra-forte);
    color: #fff;
    font-weight: 700;
}
.compra {
    background: var(--compra);
    color: #fff;
    font-weight: 700;
}
.compra-fraca {
    background: var(--compra-fraca);
    color: #fff;
    font-weight: 700;
}
.venda-forte {
    background: var(--venda-forte);
    color: #fff;
    font-weight: 700;
}
.venda {
    background: var(--venda);
    color: #fff;
    font-weight: 700;
}
.venda-fraca {
    background: var(--venda-fraca);
    color: #fff;
    font-weight: 700;
}

.middle {
    background: #fff;
    color: #000;
    font-weight: 700;
}

.default {
    background: var(--panel);
    color: var(--muted);
}

.layer.default:hover {
    color: var(--text);
}
