/* =========================================================================
 * MineScope — folha de estilo
 * Tema escuro/claro (segue o sistema; alternável). Marca fictícia.
 * ========================================================================= */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --line: #d9dee4;
  --fg: #1a2230;
  --fg-dim: #5c6775;
  --fg-faint: #8a94a2;
  --accent: #0a7d6b;
  --accent-soft: #0a7d6b22;
  --accent-fg: #eafff8;
  --ok: #138a4a;      --ok-soft: #138a4a1f;
  --warn: #b8730a;    --warn-soft: #b8730a1f;
  --crit: #c13b32;    --crit-soft: #c13b321f;
  --info: #2763c9;    --info-soft: #2763c91f;
  --grid: #e3e7ec;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sans: 'Inter Tight', 'Segoe UI', system-ui, sans-serif;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --surface: #151b24; --surface-2: #1b232e; --line: #28323f;
    --fg: #e6ebf2; --fg-dim: #9aa6b4; --fg-faint: #6b7686;
    --accent: #2bd4b5; --accent-soft: #2bd4b522; --accent-fg: #04221c;
    --ok: #34d174; --ok-soft: #34d17420;
    --warn: #e0a141; --warn-soft: #e0a14120;
    --crit: #f0645a; --crit-soft: #f0645a20;
    --info: #5b9bff; --info-soft: #5b9bff20;
    --grid: #1f2833; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --surface: #151b24; --surface-2: #1b232e; --line: #28323f;
  --fg: #e6ebf2; --fg-dim: #9aa6b4; --fg-faint: #6b7686;
  --accent: #2bd4b5; --accent-soft: #2bd4b522; --accent-fg: #04221c;
  --ok: #34d174; --ok-soft: #34d17420;
  --warn: #e0a141; --warn-soft: #e0a14120;
  --crit: #f0645a; --crit-soft: #f0645a20;
  --info: #5b9bff; --info-soft: #5b9bff20;
  --grid: #1f2833; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; text-wrap: balance; }
a { color: inherit; }
.tnum { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------------- login decorativo ---------------- */
#login {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: var(--bg); padding: 16px;
}
.login-card {
  width: 100%; max-width: 360px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 32px 28px;
  display: flex; flex-direction: column; gap: 18px;
}
.login-sub { color: var(--fg-dim); font-size: 13px; margin-top: -8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--fg-faint); font-weight: 600;
}
.field input {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 12px; color: var(--fg); font-family: var(--sans); font-size: 14px;
}
.field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-note { font-size: 11px; color: var(--fg-faint); text-align: center; line-height: 1.5; }
.login-error { font-size: 13px; color: var(--crit); margin: -4px 0 0; }
.btn:disabled { opacity: .6; cursor: wait; }
.farm-select { width: 100%; margin-top: 10px; padding: 8px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--fg); font: inherit; font-size: 13px; }

/* ---------------- marca ---------------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  flex: none; display: grid; place-items: center;
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-name { font-weight: 650; font-size: 18px; letter-spacing: -.01em; }
.brand-name span { color: var(--accent); }

/* ---------------- botões ---------------- */
.btn {
  background: var(--accent); color: var(--accent-fg); border: none; border-radius: 8px;
  padding: 12px; font-weight: 650; font-size: 14px; font-family: var(--sans); cursor: pointer;
}
.btn:hover { filter: brightness(1.05); }
.ghost-btn {
  background: var(--surface); border: 1px solid var(--line); color: var(--fg);
  border-radius: 7px; padding: 7px 12px; font-family: var(--sans); font-size: 13px;
  font-weight: 500; cursor: pointer;
}
.ghost-btn:hover { background: var(--surface-2); }
.ghost-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- shell ---------------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
.side {
  border-right: 1px solid var(--line); background: var(--surface);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 22px;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 7px;
  color: var(--fg-dim); background: none; border: none; cursor: pointer;
  font-family: var(--sans); font-size: 14px; font-weight: 500; text-align: left; width: 100%;
}
.nav button.active { background: var(--accent-soft); color: var(--accent); }
.nav button:hover:not(.active) { background: var(--surface-2); color: var(--fg); }
.nav svg { width: 17px; height: 17px; flex: none; }
.side-foot { margin-top: auto; font-size: 11px; color: var(--fg-faint); line-height: 1.5; }

.main { min-width: 0; padding: 24px; display: flex; flex-direction: column; gap: 22px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.topbar h1 { font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.topbar .sub { color: var(--fg-dim); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.live {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--fg-dim);
  background: var(--surface); border: 1px solid var(--line); padding: 6px 11px; border-radius: 20px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.dot.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
@media (prefers-reduced-motion: reduce) { .dot.pulse { animation: none; } }

/* ---------------- KPIs ---------------- */
/* ---------- tabela de monitoramento das máquinas ---------- */
.mon-counts { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--fg-dim); }
.mon-count { font: inherit; font-size: 12px; color: var(--fg-dim); background: transparent; cursor: pointer;
  border: 1px solid transparent; border-radius: 999px; padding: 3px 10px; }
.mon-count:hover { border-color: var(--line); }
.mon-count.is-on { border-color: currentColor; background: var(--surface-2); }
.mon-count.ok { color: var(--ok); } .mon-count.warn { color: var(--warn); }
.mon-count.crit { color: var(--crit); } .mon-count.down { color: var(--fg-faint); }
.mon-why { font-size: 11px; margin-top: 3px; max-width: 330px; white-space: normal; line-height: 1.35; }
.mon-why .crit { color: var(--crit); } .mon-why .warn { color: var(--warn); } .mon-why .down { color: var(--fg-faint); }
.mon-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.mon-tools input, .mon-tools select {
  background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font: inherit; font-size: 13px; }
.mon-tools input { flex: 1 1 220px; min-width: 0; }
.mon-tools .meta { margin-left: auto; }
table.mon { min-width: 1080px; }
table.mon td { vertical-align: middle; padding-top: 9px; padding-bottom: 9px; }
.mon-row.is-down td { opacity: .55; }
.mon-name { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.mon-name b { font-family: var(--mono); font-size: 13px; }
.mon-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-faint); flex: none; }
.mon-dot.active { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.mon-dot.warning { background: var(--warn); } .mon-dot.critical { background: var(--crit); }
.mon-badge { font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--fg-dim); }
.mon-sub { font-size: 11px; color: var(--fg-faint); margin-top: 3px; white-space: nowrap; }
.mon-sub.mono, .mono { font-family: var(--mono); }
.mon-na { color: var(--fg-faint); }
.mon-empty { text-align: center; color: var(--fg-faint); padding: 22px !important; }
.mon-hash { min-width: 150px; }
.mon-hash b { font-family: var(--mono); font-size: 14px; }
.mon-pct { font-size: 11px; font-family: var(--mono); }
.mon-pct.ok { color: var(--ok); } .mon-pct.low { color: var(--warn); } .mon-pct.bad { color: var(--crit); }
.mon-avg { font-size: 11px; color: var(--fg-faint); margin-top: 5px; white-space: nowrap; }
.mon-avg b { font-family: var(--mono); color: var(--fg-dim); font-weight: 600; }
.mon-avg b.low { color: var(--warn); } .mon-avg b.bad { color: var(--crit); }
.mon-bar { height: 4px; border-radius: 3px; background: var(--surface-2); margin-top: 5px; overflow: hidden; }
.mon-bar i { display: block; height: 100%; border-radius: 3px; background: var(--ok); }
.mon-bar i.low { background: var(--warn); } .mon-bar i.bad { background: var(--crit); }
.mon-boards { display: grid; gap: 3px; min-width: 150px; }
.hb { display: grid; grid-template-columns: 20px 40px 1fr; align-items: center; gap: 6px; font-size: 11px; }
.hb-k { color: var(--fg-faint); font-family: var(--mono); }
.hb-v { font-family: var(--mono); text-align: right; color: var(--fg); }
.hb-bar { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.hb-bar i { display: block; height: 100%; border-radius: 3px; background: var(--ok); }
.hb.low .hb-v { color: var(--warn); } .hb.low .hb-bar i { background: var(--warn); }
.hb.off .hb-v { color: var(--fg-faint); } .hb.off .hb-bar { background: repeating-linear-gradient(45deg, var(--surface-2) 0 3px, transparent 3px 6px); }
.mon-temp b { font-family: var(--mono); font-size: 16px; }
.t-ok { color: var(--fg); } .t-warm { color: var(--warn); } .t-hot { color: var(--crit); }
.mon-sq { display: flex; align-items: center; gap: 3px; margin-top: 4px; }
.mon-sq i { width: 9px; height: 9px; border-radius: 2px; background: var(--ok); }
.mon-sq i.t-warm { background: var(--warn); } .mon-sq i.t-hot { background: var(--crit); } .mon-sq i.na { background: var(--surface-2); }
.mon-sq small { font-size: 11px; color: var(--fg-faint); margin-left: 5px; white-space: nowrap; }
.mon-pool { display: inline-block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: bottom; font-size: 12px; }

/* ---------- cards de fazenda (tela Fazendas) ---------- */
/* total de todas as fazendas: um card só, com três números lado a lado */
.farms-total { display: grid; grid-template-columns: 1fr 1fr 1fr 1.5fr;
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface);
  border: 1px solid var(--accent); border-radius: 14px; padding: 12px 0; }
.farms-total:empty { display: none; }
.total-item { display: flex; flex-direction: column; gap: 2px; padding: 2px 22px; min-width: 0; }
.total-item + .total-item { border-left: 1px solid var(--line); }
.total-v { font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.total-s { font-size: 12px; color: var(--accent); font-family: var(--mono); }
.total-health { margin-top: 6px; gap: 6px; }
.total-health span { padding: 3px 9px; }
.h1-farm { color: var(--accent); font-weight: 600; }
@media (max-width: 1100px) {
  .farms-total { grid-template-columns: repeat(3, 1fr); }
  .farms-total .total-item:nth-child(4) { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line);
    margin-top: 8px; padding-top: 10px; }
}
@media (max-width: 700px) {
  .farms-total { grid-template-columns: 1fr; padding: 4px 0; }
  .total-item { padding: 10px 18px; }
  .total-item + .total-item { border-left: 0; border-top: 1px solid var(--line); }
}
.farm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 14px; }
.farm-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.farm-card.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.farm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.farm-head h3 { margin: 0; font-size: 18px; }
.farm-sub { font-size: 12px; color: var(--fg-dim); margin-top: 3px; }
.farm-sub b { font-family: var(--mono); color: var(--fg); }
.farm-earn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.farm-earn > div { background: linear-gradient(135deg, var(--accent-soft), transparent 75%), var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.farm-v { font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
.farm-btc { font-size: 12px; color: var(--accent); font-family: var(--mono); }
.farm-health { display: flex; flex-wrap: wrap; gap: 8px; }
.farm-health span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--fg-dim);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; }
.farm-health span b { font-family: var(--mono); font-size: 14px; color: var(--fg); }
.farm-health i { width: 8px; height: 8px; border-radius: 50%; }
.farm-health .ok i { background: var(--ok); } .farm-health .ok b { color: var(--ok); }
.farm-health .warn i { background: var(--warn); } .farm-health .warn b { color: var(--warn); }
.farm-health .crit i { background: var(--crit); } .farm-health .crit b { color: var(--crit); }
.farm-health .down i { background: var(--fg-faint); }
.farm-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: 11.5px; color: var(--fg-faint); border-top: 1px solid var(--line); padding-top: 12px; }
.farm-actions { display: flex; gap: 8px; }
.farm-open { padding: 7px 14px; font-size: 13px; width: auto; }

/* destaque de rendimento (R$/dia e R$/mês) no topo da visão geral */
.earn { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.earn-card {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface);
  border: 1px solid var(--accent); border-radius: 14px;
  padding: 18px 22px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.earn-k { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-dim); }
.earn-v { font-size: 40px; font-weight: 700; line-height: 1.1; color: var(--fg); font-family: var(--mono);
  letter-spacing: -.02em; overflow-wrap: anywhere; }
.earn-s { font-size: 12.5px; color: var(--fg-dim); }
.earn-s b { color: var(--accent); font-weight: 600; }
.earn-foot { grid-column: 1 / -1; font-size: 12px; color: var(--fg-faint); display: flex; flex-wrap: wrap;
  align-items: center; gap: 4px 6px; margin-top: -4px; }
.earn-foot b { color: var(--fg-dim); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  padding: 15px 16px; display: flex; flex-direction: column; gap: 6px;
}
.kpi .label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--fg-faint); font-weight: 600; }
.kpi .val { font-size: 25px; font-weight: 680; letter-spacing: -.02em; }
.kpi .val .unit { font-size: 13px; font-weight: 500; color: var(--fg-dim); margin-left: 3px; }
.kpi .delta { font-size: 12px; font-weight: 600; }
.kpi .delta.up { color: var(--ok); } .kpi .delta.down { color: var(--crit); } .kpi .delta.flat { color: var(--fg-dim); }

/* ---------------- card ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 14px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; font-weight: 620; }
.card-head .meta { font-size: 12px; color: var(--fg-dim); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--fg-dim); flex-wrap: wrap; }
/* seletor de período do gráfico (1 h / 24 h / 7 dias / 30 dias) */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px;
  margin-left: auto; margin-right: 14px; }
.seg button { font: inherit; font-size: 12.5px; color: var(--fg-dim); background: transparent; border: 0; border-radius: 6px;
  padding: 5px 12px; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--fg); }
.seg button.is-on { background: var(--accent); color: var(--accent-fg, #04221c); font-weight: 600; }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 2px; border-radius: 1px; display: inline-block; }

.chart-wrap { width: 100%; overflow-x: auto; }
svg.chart { display: block; width: 100%; height: auto; }

/* ---------------- tabela ---------------- */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 680px; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--fg-faint); font-weight: 600; padding: 0 12px 10px; white-space: nowrap;
}
thead th.num, tbody td.num { text-align: right; }
tbody td { padding: 11px 12px; border-top: 1px solid var(--line); white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rig-name { font-weight: 600; }
.rig-id { color: var(--fg-faint); font-size: 12px; font-family: var(--mono); }
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.temp-hot { color: var(--crit); } .temp-warm { color: var(--warn); }

/* ---------------- pílulas de status ---------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.active, .pill.online { color: var(--ok); background: var(--ok-soft); }
.pill.warning { color: var(--warn); background: var(--warn-soft); }
.pill.critical { color: var(--crit); background: var(--crit-soft); }
.pill.offline { color: var(--crit); background: var(--crit-soft); }
.pill.inactive { color: var(--fg-dim); background: var(--surface-2); }

.mini { height: 26px; width: 92px; }

/* ---------------- grids auxiliares ---------------- */
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
/* itens de grid encolhem até a tela: a tabela larga rola dentro do .table-wrap, não a página */
.two-col > *, .cols-2 > *, .kpis > *, .earn > * { min-width: 0; }
.main { min-width: 0; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cols-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

.pool-row, .stat-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px;
}
.pool-row:first-child, .stat-row:first-child { border-top: none; }
.pname { font-weight: 550; } .psub { font-size: 11.5px; color: var(--fg-faint); font-family: var(--mono); }
.bar { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; width: 70px; }
.bar > i { display: block; height: 100%; background: var(--accent); }

.study-note {
  font-size: 11.5px; color: var(--fg-faint); line-height: 1.5;
  border-top: 1px dashed var(--line); padding-top: 14px;
}

/* ---------------- detalhe de máquina ---------------- */
.back-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-dim);
  background: none; border: none; cursor: pointer; font-family: var(--sans); padding: 0;
}
.back-link:hover { color: var(--fg); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.spec {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.spec .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-faint); font-weight: 600; }
.spec .v { font-size: 20px; font-weight: 660; font-variant-numeric: tabular-nums; }
.spec .v small { font-size: 12px; color: var(--fg-dim); font-weight: 500; }

.board-card { background: var(--surface-2); border-radius: 9px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.board-card .bh { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
.board-card .bd { display: flex; justify-content: space-between; font-size: 12px; color: var(--fg-dim); font-family: var(--mono); }

.cmd-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cmd-row .ghost-btn { display: inline-flex; align-items: center; gap: 6px; }
.cmd-row svg { width: 15px; height: 15px; }

.led-blink { animation: ledblink 1s steps(2) 4; }
@keyframes ledblink { 50% { background: var(--warn); color: var(--warn); } }

/* ---------------- alertas ---------------- */
.alert-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line);
}
.alert-item:first-child { border-top: none; }
.sev {
  flex: none; width: 4px; align-self: stretch; border-radius: 2px; min-height: 36px;
}
.sev.critical { background: var(--crit); } .sev.warning { background: var(--warn); } .sev.info { background: var(--info); }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 600; font-size: 14px; }
.alert-desc { font-size: 12.5px; color: var(--fg-dim); margin-top: 2px; }
.alert-time { font-size: 11.5px; color: var(--fg-faint); font-family: var(--mono); white-space: nowrap; }
.rule-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 0; border-top: 1px solid var(--line); font-size: 13.5px;
}
.rule-row:first-child { border-top: none; }
.rule-cond { font-size: 12px; color: var(--fg-dim); font-family: var(--mono); }
.toggle {
  width: 36px; height: 20px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line);
  position: relative; cursor: pointer; flex: none; transition: background .15s;
}
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--fg-faint); transition: transform .15s, background .15s; }
.toggle.on { background: var(--accent-soft); border-color: var(--accent); }
.toggle.on::after { transform: translateX(16px); background: var(--accent); }

/* ---------------- toast ---------------- */
#toasts { position: fixed; bottom: 18px; right: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 11px 14px; font-size: 13px; box-shadow: 0 8px 24px #0003;
  max-width: 300px; animation: slidein .2s ease;
}
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- responsivo ---------------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; align-items: center; overflow-x: auto; padding: 12px; gap: 14px;
          border-right: none; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; } .side-foot { display: none; }
  .brand { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .two-col, .cols-3, .cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .earn { grid-template-columns: 1fr; }
  .earn-v { font-size: 32px; }
}
@media (max-width: 480px) {
  .main { padding: 16px; }
  .kpi .val { font-size: 22px; }
}
