/* VV UI: o desenho do console do VVPost Enterprise (control-plane/console) para os painéis estáticos da família
   VV (VVCloud, painel do prestador e VVBuilder). Mesmo arquivo nos três repositórios: mude em todos juntos.
   Tokens de src/renderer/src/design-system/tokens/tokens.css do VVPost; escuro por padrão, claro como opção. */

@font-face { font-family: "Inter Variable"; font-style: normal; font-display: swap; font-weight: 100 900; src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations"); }
@font-face { font-family: "JetBrains Mono Variable"; font-style: normal; font-display: swap; font-weight: 100 800; src: url("fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations"); }

:root {
  --bg: #0b0c0f; --panel: #11141a; --elevated: #171b23; --line: #282e3a; --line-subtle: #1f232c;
  --text: #e7eaf0; --muted: #929bad; --faint: #7d8498;
  --accent: #8b7cff; --accent-hover: #9d90ff; --accent-pressed: #7565f0; --on-accent: #0b0c0f;
  --ok: #39c69a; --bad: #f07178; --warn: #e8b45b; --info: #6aa9ff; --cyan: #55b8e8; --code: #171b23;
  --font: "Inter Variable", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, "Cascadia Code", Menlo, monospace;
  --radius-control: 6px; --radius-card: 8px;
  --shadow-overlay: 0 12px 32px -8px rgb(0 0 0 / .6), 0 0 0 1px var(--line);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f7f9; --panel: #ffffff; --elevated: #f1f3f5; --line: #e3e6eb; --line-subtle: #eceef2;
  --text: #1b1f24; --muted: #5d6673; --faint: #8a93a0;
  --accent: #6d5dfc; --accent-hover: #5b4bec; --accent-pressed: #5a4ae8; --on-accent: #ffffff;
  --ok: #1f9d76; --bad: #d64550; --warn: #b26b00; --info: #3b7ddd; --cyan: #1f86b8; --code: #f1f3f5;
  --shadow-overlay: 0 12px 32px -8px rgb(15 20 30 / .18), 0 0 0 1px var(--line);
  color-scheme: light;
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.45 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
code { font: 12px var(--mono); }
b, strong { font-weight: 600; }
.muted, .sub { color: var(--muted); } .sub { font-size: 12px; } .faint { color: var(--faint); } .err { color: var(--bad); font-size: 12px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ------------------------------------------------------------------ casca: barra de cima, trilho, rodapé */
.vv-app { display: flex; flex-direction: column; height: 100%; }
.vv-top { display: flex; align-items: center; gap: 4px; height: 44px; flex-shrink: 0; padding: 0 12px 0 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.vv-brand { display: flex; align-items: center; gap: 10px; padding-right: 4px; white-space: nowrap; }
.vv-brand b { font-size: 13px; letter-spacing: -.01em; }
.vv-logo { width: 22px; height: 22px; flex-shrink: 0; }
.vv-crumb { display: flex; align-items: center; gap: 6px; min-width: 0; height: 28px; padding: 0 8px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vv-crumb.muted { color: var(--muted); }
.vv-sep { width: 14px; height: 14px; flex-shrink: 0; color: var(--faint); }
.vv-spacer { flex: 1; }
.vv-top .vv-links { display: flex; gap: 4px; margin-right: 4px; }
.vv-top .vv-links a { display: inline-flex; align-items: center; height: 28px; padding: 0 8px; border-radius: var(--radius-control); font-size: 12px; color: var(--muted); }
.vv-top .vv-links a:hover { background: color-mix(in srgb, var(--line) 50%, transparent); color: var(--text); text-decoration: none; }
.vv-body { display: flex; flex: 1; min-height: 0; }
.vv-rail { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 48px; flex-shrink: 0; padding: 8px 0; border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto; }
.vv-rail a { position: relative; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--radius-control); color: var(--muted); transition: background-color .12s, color .12s; }
.vv-rail a:hover { background: color-mix(in srgb, var(--line) 50%, transparent); color: var(--text); text-decoration: none; }
.vv-rail a.on { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.vv-rail a.on::before { content: ""; position: absolute; top: 8px; left: -6px; width: 2px; height: 20px; border-radius: 2px; background: var(--accent); }
.vv-rail svg { width: 17px; height: 17px; }
/* Contador no canto do ícone (pedidos pendentes, incidentes, alertas). */
.vv-rail a > span:not(:empty) { position: absolute; top: 1px; right: 0; display: flex; pointer-events: none; }
.vv-rail a > span .pill, .vv-rail a > span .badge { height: 15px; min-width: 15px; padding: 0 4px; border-radius: 99px; font-size: 10px; font-weight: 600; justify-content: center; margin: 0; border: 0; color: var(--on-accent); background: var(--accent); }
.vv-rail a > span .pill.warn { background: var(--warn); } .vv-rail a > span .pill.bad, .vv-rail a > span .badge { background: var(--bad); color: #fff; }
.vv-main { flex: 1; min-width: 0; overflow-y: auto; }
.vv-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.vv-head h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.vv-head p { margin: 4px 0 0; max-width: 768px; font-size: 12px; color: var(--muted); }
.vv-content { padding: 24px; }
.vv-status { display: flex; align-items: center; gap: 16px; height: 24px; flex-shrink: 0; padding: 0 12px; border-top: 1px solid var(--line); background: var(--panel); font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.vv-status .dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--faint); vertical-align: 1px; }
.vv-status .dot.ok { background: var(--ok); } .vv-status .dot.bad { background: var(--bad); }
@media (max-width: 720px) { .vv-content { padding: 16px; } .vv-head { padding: 12px 16px; } .vv-crumb.org { display: none; } }

/* Botão só com ícone (tema, fechar) e menu da conta. */
.vv-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--radius-control); background: transparent; color: var(--muted); cursor: pointer; }
.vv-icon:hover { background: color-mix(in srgb, var(--line) 50%, transparent); color: var(--text); }
.vv-icon svg { width: 15px; height: 15px; }
.vv-user { position: relative; margin-left: 4px; }
.vv-avatar { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); font: 600 11px var(--font); cursor: pointer; }
.vv-avatar:hover { border-color: var(--accent); }
.vv-menu { position: absolute; top: 36px; right: 0; z-index: 40; width: 288px; padding: 12px; border-radius: var(--radius-card); background: var(--elevated); box-shadow: var(--shadow-overlay); }
.vv-menu[hidden] { display: none; }
.vv-menu .name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.vv-menu .sub { font-size: 12px; color: var(--muted); }
.vv-menu .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.vv-menu .note { margin-top: 8px; font-size: 11px; color: var(--faint); }
.vv-menu .out { display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%; height: 28px; margin-top: 12px; padding: 0 8px; border: 0; border-radius: var(--radius-control); background: transparent; color: var(--muted); font: 12px var(--font); cursor: pointer; }
.vv-menu .out:hover { background: color-mix(in srgb, var(--line) 50%, transparent); color: var(--text); }
.vv-menu .out svg { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ painéis (Panel do console) */
.card { position: relative; min-width: 0; margin-bottom: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--panel); }
.card > h2, .card > h3 { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }
/* Título no topo do painel vira cabeçalho com linha, como o Panel do console. */
.card > h2:first-child, .card > h3:first-child, .card > .row:first-child:has(> h2), .card > details:first-child > summary {
  display: flex; align-items: center; gap: 8px; min-height: 40px; margin: -16px -16px 16px; padding: 6px 16px; border-bottom: 1px solid var(--line); }
.card > .row:first-child:has(> h2) > :not(h2) { flex: 0 0 auto !important; white-space: nowrap; font-size: 12px; }
.card > .row:first-child:has(> h2) > h2 { flex: 1 1 auto; margin: 0; font-size: 13px; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }
.card > details:first-child:not([open]) > summary { margin-bottom: -16px; border-bottom: 0; }
.card > .row:first-child:has(> h2) + * { margin-top: 0 !important; }
.card .card { background: var(--bg); border-color: var(--line-subtle); }
.card .card > h2:first-child, .card .card > .row:first-child:has(> h2) { margin: 0 0 8px; min-height: 0; padding: 0; border: 0; }
.card.empty, .empty { padding: 32px; text-align: center; color: var(--muted); }
p { margin: 8px 0; }
.card p.muted, .card > p { font-size: 12px; }

/* ------------------------------------------------------------------ controles */
label { display: block; margin: 12px 0 4px; font-size: 11px; font-weight: 500; color: var(--muted); }
input, select, textarea { width: 100%; height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--bg); color: var(--text); font: 12px var(--font); }
select { padding-right: 24px; }
textarea { height: auto; min-height: 90px; padding: 6px 8px; font: 12px/1.5 var(--mono); resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 1px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input:disabled, select:disabled, textarea:disabled { opacity: .5; }
input[type="checkbox"], input[type="radio"] { width: auto; height: auto; accent-color: var(--accent); vertical-align: -2px; margin: 0 4px 0 0; }
label:has(> input[type="checkbox"]) { font-size: 12px; color: var(--text); font-weight: 400; }

/* Botões (Button do console): secundário por padrão; primary, ok e bad. */
button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--elevated); color: var(--text); font: 500 12px var(--font); white-space: nowrap; cursor: pointer; transition: background-color .12s, border-color .12s, color .12s; }
button:hover:not(:disabled) { border-color: var(--faint); background: color-mix(in srgb, var(--line) 60%, var(--elevated)); }
button:disabled { opacity: .5; cursor: default; }
button.primary { border-color: transparent; background: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover:not(:disabled) { border-color: transparent; background: var(--accent-hover); }
button.primary:active:not(:disabled) { background: var(--accent-pressed); }
button.ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); color: var(--ok); }
button.bad { border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); color: var(--bad); }
button.ok:hover:not(:disabled) { border-color: color-mix(in srgb, var(--ok) 60%, transparent); background: color-mix(in srgb, var(--ok) 20%, transparent); }
button.bad:hover:not(:disabled) { border-color: color-mix(in srgb, var(--bad) 60%, transparent); background: color-mix(in srgb, var(--bad) 20%, transparent); }
.linkbtn { height: auto; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; }
.linkbtn:hover:not(:disabled) { background: none; text-decoration: underline; }
details > summary { cursor: pointer; color: var(--muted); font-size: 12px; }
details > summary:hover { color: var(--text); }

/* ------------------------------------------------------------------ selos (Badge do console) */
.pill, .vv-badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--elevated); color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1; white-space: nowrap; vertical-align: middle; text-decoration: none; }
.pill.ok, .vv-badge.ok { border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.pill.bad, .vv-badge.bad { border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.pill.warn, .vv-badge.warn { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); }
.pill.run, .vv-badge.accent { border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
a.pill:hover { text-decoration: none; filter: brightness(1.15); }

/* ------------------------------------------------------------------ tabelas densas (ResultsTable do console) */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { height: 32px; padding: 0 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; font-weight: 500; color: var(--muted); white-space: nowrap; }
td { padding: 6px 12px; border-bottom: 1px solid var(--line-subtle); vertical-align: middle; }
tr:last-child > td { border-bottom: 0; }
tr:has(> td):hover { background: color-mix(in srgb, var(--elevated) 60%, transparent); }
td button + button { margin-left: 4px; }
.card > table, .card > div > table { margin-left: -4px; width: calc(100% + 8px); }
th:first-child, td:first-child { padding-left: 4px; } th:last-child, td:last-child { padding-right: 4px; }

pre { margin: 0; padding: 10px 12px; overflow: auto; border: 1px solid var(--line-subtle); border-radius: var(--radius-control); background: var(--bg); font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }

/* ------------------------------------------------------------------ listas e abas */
.item { display: block; margin-bottom: 4px; padding: 8px 10px; border: 1px solid transparent; border-radius: var(--radius-control); color: inherit; text-decoration: none; }
a.item:hover { background: color-mix(in srgb, var(--line) 40%, transparent); text-decoration: none; }
.item.sel { border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
div.item { border-color: var(--line); background: var(--bg); padding: 12px; margin-bottom: 8px; }
/* Abas de seção (dentro de uma página): sublinhado na ativa. */
.vv-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.vv-tabs a { display: inline-flex; align-items: center; height: 34px; padding: 0 10px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; white-space: nowrap; text-decoration: none; }
.vv-tabs a:hover { color: var(--text); text-decoration: none; }
.vv-tabs a.on { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }
/* Abas segmentadas (ambientes). */
.envtabs { display: inline-flex; gap: 2px; margin-bottom: 16px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--panel); }
.envtabs a { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 4px; color: var(--muted); font-size: 12px; text-decoration: none; }
.envtabs a:hover { color: var(--text); text-decoration: none; }
.envtabs a.on { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); font-weight: 600; }

/* ------------------------------------------------------------------ grades */
.row { display: flex; gap: 8px; align-items: center; } .row > * { flex: 1; }
.row > input[type="checkbox"], .row > input[type="radio"] { flex: 0 0 auto; }
td.row { display: table-cell; white-space: nowrap; } td.row > * { display: inline-block; width: calc(50% - 4px); vertical-align: middle; } td.row > * + * { margin-left: 8px; }
.row > span > label:first-child, .row > div > label:first-child { margin-top: 8px; }
.split { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cards3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.cards3 > .card { margin-bottom: 0; }
@media (max-width: 1200px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }
.scroll { max-height: 360px; overflow: auto; }

/* ------------------------------------------------------------------ números, gráficos e paginação */
.vv-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 16px; }
.vv-stat { min-width: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--panel); }
.vv-stat .label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; color: var(--muted); }
.vv-stat .label svg { width: 13px; height: 13px; }
.vv-stat .value { margin-top: 8px; font: 600 22px/1.1 var(--mono); letter-spacing: -.02em; }
.vv-stat .value small { margin-left: 4px; font: 500 12px var(--font); letter-spacing: 0; color: var(--muted); }
.vv-stat .sub { margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vv-meter { height: 6px; margin-top: 10px; overflow: hidden; border-radius: 3px; background: var(--line-subtle); }
.vv-meter > i { display: block; height: 100%; border-radius: 3px; background: var(--info); }
td .vv-meter { margin-top: 0; } .vv-meter.thin { height: 3px; margin-top: 4px; }
.vv-meter.warn > i { background: var(--warn); } .vv-meter.bad > i { background: var(--bad); }
.vv-stack { display: flex; height: 10px; overflow: hidden; border-radius: 5px; background: var(--line-subtle); }
.vv-stack > i { height: 100%; } .vv-stack > i + i { border-left: 2px solid var(--panel); }
.vv-chart { position: relative; min-width: 0; }
.vv-chart svg { display: block; overflow: visible; }
.vv-chart text { fill: var(--faint); font: 10px var(--font); }
.vv-chart .grid { stroke: var(--line-subtle); }
.vv-chart .cursor { stroke: var(--faint); stroke-dasharray: 2 3; }
.vv-chart-empty { position: absolute; inset: 40% 0 auto; text-align: center; font-size: 12px; color: var(--muted); }
.vv-tip { position: absolute; z-index: 5; padding: 6px 8px; border-radius: var(--radius-control); background: var(--elevated); box-shadow: var(--shadow-overlay); font-size: 11px; white-space: nowrap; pointer-events: none; }
.vv-tip i, .vv-legend i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 2px; }
.vv-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; font-size: 11px; color: var(--muted); }
.vv-legend.big { gap: 6px 18px; font-size: 12px; } .vv-legend b { color: var(--text); font-weight: 500; }
.vv-pager { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.vv-pager:empty { display: none; } .vv-pager > span { margin-right: 6px; }
/* Lista de ocorrências que abre o detalhe (incidentes, alertas, erros). */
.vv-entries { margin: 0 -4px; }
.vv-entry { border-bottom: 1px solid var(--line-subtle); } .vv-entry:last-child { border-bottom: 0; }
.vv-entry > summary { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 4px; color: var(--text); font-size: 12px; list-style: none; }
.vv-entry > summary::-webkit-details-marker { display: none; }
.vv-entry > summary:hover { background: color-mix(in srgb, var(--elevated) 60%, transparent); color: var(--text); }
.vv-entry > summary .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vv-entry > summary .m { flex: 0 0 auto; font-size: 11px; }
.vv-entry > summary .pill { flex: 0 0 auto; }
.vv-entry[open] > summary .t { white-space: normal; }
.vv-entry > .b { padding: 0 4px 12px; }
a.vv-stat:hover { border-color: var(--faint); }
/* Escolha de período e filtros curtos: os mesmos botões das abas segmentadas. */
.vv-seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--panel); }
.vv-seg button { height: 22px; padding: 0 8px; border: 0; border-radius: 4px; background: none; color: var(--muted); font-size: 12px; }
.vv-seg button:hover:not(:disabled) { background: none; color: var(--text); }
.vv-seg button.on { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); font-weight: 600; }

/* ------------------------------------------------------------------ diálogo, avisos */
dialog { width: min(1100px, 94vw); max-height: 88vh; padding: 0; border: 0; border-radius: var(--radius-card); background: var(--panel); color: var(--text); box-shadow: var(--shadow-overlay); }
dialog::backdrop { background: rgb(0 0 0 / .6); }
.toast { padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--elevated); box-shadow: var(--shadow-overlay); font-size: 12px; cursor: pointer; }
.card.muted:not(:has(*)) { padding: 32px; text-align: center; }
