/* Tokens do design handoff (docs/ignored/design_handoff_backoffice) — fonte da verdade visual.
   Light é o default; [data-bo-theme="dark"] troca o conjunto. */
:root, [data-bo-theme="light"] {
    --bo-bg: #F2F5F6;
    --bo-surface: #FFFFFF;
    --bo-surface-2: #F7F9FA;
    --bo-border: rgba(155,176,179,0.28);
    --bo-border-strong: rgba(155,176,179,0.45);
    --bo-text: #0F1614;
    --bo-text-2: #4a5d60;
    --bo-text-3: #7c9094;
    --bo-primary: #316568;
    --bo-primary-tint: rgba(49,101,104,0.08);
    --bo-shadow: 0 1px 2px rgba(49,101,104,0.06);
    --bo-shadow-md: 0 8px 24px -10px rgba(49,101,104,0.22);
    --bo-nav: #FFFFFF;
    --bo-nav-text: #4a5d60;
    --bo-nav-text-hi: #0F1614;
    --bo-nav-active: rgba(49,101,104,0.10);
    --bo-grid-line: rgba(49,101,104,0.10);
    --bo-ok: #2e7d32; --bo-ok-bg: rgba(46,125,50,0.10);
    --bo-err: #c62828; --bo-err-bg: rgba(198,40,40,0.10);
    --bo-warn: #b26a00; --bo-warn-bg: rgba(239,108,0,0.12);
}
[data-bo-theme="dark"] {
    --bo-bg: #0A1412;
    --bo-surface: #10201D;
    --bo-surface-2: #0F1E1B;
    --bo-border: rgba(168,213,214,0.14);
    --bo-border-strong: rgba(168,213,214,0.24);
    --bo-text: #EAF1F0;
    --bo-text-2: #a7bcbb;
    --bo-text-3: #6f8886;
    --bo-primary: #7fb7b8;
    --bo-primary-tint: rgba(127,183,184,0.12);
    --bo-shadow: 0 1px 2px rgba(0,0,0,0.3);
    --bo-shadow-md: 0 10px 28px -12px rgba(0,0,0,0.6);
    --bo-nav: #060D0C;
    --bo-nav-text: rgba(234,241,240,0.62);
    --bo-nav-text-hi: #fff;
    --bo-nav-active: rgba(127,183,184,0.14);
    --bo-grid-line: rgba(127,183,184,0.10);
    --bo-ok: #66bb6a; --bo-ok-bg: rgba(102,187,106,0.14);
    --bo-err: #ef5350; --bo-err-bg: rgba(239,83,80,0.14);
    --bo-warn: #ffa726; --bo-warn-bg: rgba(255,167,38,0.14);
}

html, body { margin: 0; height: 100%; font-family: 'Roboto', sans-serif; font-size: 13px;
    background: var(--bo-bg); color: var(--bo-text); }
h1:focus { outline: none; }

/* ── Shell: sidebar fixa escura + conteúdo ── */
/* O fundo é pintado AQUI (o elemento que carrega data-bo-theme), não no body — senão o
   body lê o :root (sempre claro) e só os cards escurecem. */
.bo-shell { display: flex; min-height: 100vh; background: var(--bo-bg); color: var(--bo-text); }
.bo-side { width: 220px; flex-shrink: 0; background: var(--bo-nav); color: var(--bo-nav-text);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
    border-right: 1px solid var(--bo-border); }
.bo-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; }
.bo-brand .lg { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    background: linear-gradient(135deg,#316568,#4d8a8d); display: flex; align-items: center;
    justify-content: center; color: #fff; font-weight: 700; font-family: 'Montserrat', sans-serif; }
.bo-brand b { display: block; color: var(--bo-nav-text-hi); font-family: 'Montserrat', sans-serif;
    font-size: 14px; letter-spacing: -0.01em; }
.bo-brand span { font-size: 11px; color: var(--bo-nav-text); }
.bo-side-label { padding: 14px 16px 6px; font-size: 10px; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--bo-nav-text); opacity: 0.7; }
.bo-nav-item { display: flex; align-items: center; gap: 10px; margin: 2px 8px; padding: 9px 10px;
    border-radius: 9px; color: var(--bo-nav-text); text-decoration: none; font-size: 13px; }
.bo-nav-item:hover { background: var(--bo-nav-active); color: var(--bo-nav-text-hi); }
.bo-nav-item.active { background: var(--bo-nav-active); color: var(--bo-nav-text-hi); }
.bo-nav-item .mud-icon-root { font-size: 18px; width: 18px; height: 18px; }
.bo-nav-badge { margin-left: auto; background: var(--bo-err); color: #fff; border-radius: 99px;
    font-size: 10.5px; min-width: 18px; height: 18px; display: flex; align-items: center;
    justify-content: center; padding: 0 5px; font-variant-numeric: tabular-nums; }
.bo-side-footer { margin-top: auto; padding: 12px; border-top: 1px solid var(--bo-border); }
.bo-user { display: flex; align-items: center; gap: 9px; padding: 6px 4px; }
.bo-user .av { width: 30px; height: 30px; border-radius: 99px; background: var(--bo-nav-active);
    color: var(--bo-nav-text-hi); display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; flex-shrink: 0; }
.bo-user b { display: block; color: var(--bo-nav-text-hi); font-size: 12.5px; font-weight: 500; }
.bo-user span { font-size: 10.5px; color: var(--bo-nav-text); }
.bo-main { flex: 1; padding: 22px 26px 32px; min-width: 0; }

/* ── Cards e tipografia do painel ── */
.bo-card { background: var(--bo-surface); border: 1px solid var(--bo-border); border-radius: 14px;
    box-shadow: var(--bo-shadow); padding: 15px 17px; }
.bo-kicker { font-size: 10px; letter-spacing: 0.11em; text-transform: uppercase;
    color: var(--bo-text-3); font-weight: 600; margin-bottom: 4px; }
.bo-num { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 22px;
    color: var(--bo-text); font-variant-numeric: tabular-nums; line-height: 1.15; }
.bo-sub { font-size: 11.5px; color: var(--bo-text-3); }
.bo-page-title { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 19px;
    letter-spacing: -0.01em; margin: 0; color: var(--bo-text); }
.bo-page-sub { font-size: 12px; color: var(--bo-text-3); }
.bo-status-ic { width: 34px; height: 34px; border-radius: 99px; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0; }
.bo-status-ic.ok { background: var(--bo-ok-bg); color: var(--bo-ok); }
.bo-status-ic.err { background: var(--bo-err-bg); color: var(--bo-err); }
.bo-status-ic.warn { background: var(--bo-warn-bg); color: var(--bo-warn); }
.bo-chart-footer { display: flex; justify-content: space-between; font-size: 10.5px;
    color: var(--bo-text-3); margin-top: 4px; }
.bo-live-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11px;
    color: var(--bo-text-2); background: var(--bo-primary-tint); border-radius: 99px; padding: 4px 10px; }
.bo-live-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--bo-ok);
    animation: bo-pulse 1.6s ease-in-out infinite; }
@keyframes bo-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.bo-mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 11px;
    overflow-x: auto; padding: 12px; border-radius: 10px; background: var(--bo-surface-2);
    border: 1px solid var(--bo-border); }

/* ── Auth (login / 403) ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bo-bg); padding: 20px; }
.auth-box { background: var(--bo-surface); border: 1px solid var(--bo-border); border-radius: 16px;
    box-shadow: var(--bo-shadow-md); padding: 26px; width: 360px; }
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 20px; }
.auth-brand .lg { width: 40px; height: 40px; border-radius: 11px;
    background: linear-gradient(135deg,#316568,#4d8a8d); display: flex; align-items: center;
    justify-content: center; color: #fff; font-weight: 700; font-family: 'Montserrat', sans-serif; }
.auth-brand b { display: block; font-family: 'Montserrat', sans-serif; font-size: 17px;
    letter-spacing: -0.02em; color: var(--bo-text); }
.auth-brand span { font-size: 12px; color: var(--bo-text-3); letter-spacing: 0.03em; }
.auth-field { margin-bottom: 13px; }
.auth-field label { display: block; font-size: 11px; font-weight: 600; color: var(--bo-text-2);
    margin-bottom: 5px; letter-spacing: 0.02em; }
.auth-field input[type="email"], .auth-field input[type="password"] {
    width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: 13px;
    border: 1px solid var(--bo-border-strong); border-radius: 10px;
    background: var(--bo-surface-2); color: var(--bo-text); outline: none;
    font-family: 'Roboto', sans-serif; }
.auth-field input:focus { border-color: var(--bo-primary); box-shadow: 0 0 0 3px var(--bo-primary-tint); }
.auth-check { display: flex; align-items: center; gap: 7px; font-size: 12.5px;
    color: var(--bo-text-2); margin: 4px 0 16px; }
.auth-btn { width: 100%; padding: 11px; border: none; border-radius: 10px; cursor: pointer;
    background: var(--bo-primary); color: #fff; font-size: 13.5px; font-weight: 600;
    font-family: 'Roboto', sans-serif; }
.auth-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.auth-alert { display: flex; align-items: flex-start; gap: 9px; padding: 11px 13px;
    border-radius: 10px; font-size: 12.5px; line-height: 1.45; margin-bottom: 16px; }
.auth-alert.err { background: var(--bo-err-bg); color: var(--bo-err); }
.auth-alert.warn { background: var(--bo-warn-bg); color: var(--bo-warn); }
.auth-foot { font-size: 11px; color: var(--bo-text-3); margin-top: 14px; line-height: 1.5; }

/* ── Gráfico de barras rotulado (VgBarChart) ── */
.vg-bars { display: flex; align-items: stretch; gap: 5px; }
.vg-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; cursor: default; }
.vg-bar-val { font-size: 10px; color: var(--bo-text-2); font-variant-numeric: tabular-nums; line-height: 1.5; height: 15px; }
.vg-bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.vg-bar-fill { width: 100%; max-width: 30px; background: var(--bo-primary); border-radius: 4px 4px 0 0; min-height: 2px; transition: opacity .15s; }
.vg-bar-col:hover .vg-bar-fill { filter: brightness(1.12); }
.vg-bar-lbl { font-size: 9.5px; color: var(--bo-text-3); margin-top: 4px; white-space: nowrap; height: 13px; font-variant-numeric: tabular-nums; }

#blazor-error-ui { color-scheme: light only; background: lightyellow; bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.2); display: none; left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
