/* Painel interno Hubros. Tokens do Design System Hubros (knowledge/04): identidade escura e sóbria,
   dourado só como acento e nunca carregando texto no claro (lá o texto de destaque é o amberInk).
   Cores dos gráficos validadas com o validador da skill dataviz (dourado + azul, nos dois modos). */

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
  --bg: #0B0B0C;
  --surface: #151517;
  --surface-2: #1C1C1F;
  --border: #26262A;
  --grid: #222226;
  --text: #F7F7F8;
  --text-2: #B4B4BA;
  --text-3: #8E8E94;
  --accent-text: #D6BB87;     /* gold: rótulos e destaques sobre o escuro */
  --accent-fill: #D6BB87;     /* botão primário (texto escuro por cima) */
  --on-accent: #0B0B0C;
  --series-1: #B8893B;        /* dourado de dados (validado no escuro) */
  --series-2: #3987e5;        /* azul (validado no escuro) */
  --good: #5CC98A;
  --bad: #F07A7A;
  --radius: 14px;
  --shadow: none;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F1F0EE;
  --surface: #FFFFFF;
  --surface-2: #F7F7F8;
  --border: #E3E1DC;
  --grid: #ECEAE6;
  --text: #0B0B0C;
  --text-2: #55555A;
  --text-3: #6E6E73;
  --accent-text: #7D5313;     /* amberInk: único dourado que passa como texto */
  --accent-fill: #0B0B0C;
  --on-accent: #F7F7F8;
  --series-1: #A8781E;
  --series-2: #2a78d6;
  --good: #007329;
  --bad: #B31717;
  --shadow: 0 1px 2px rgba(11, 11, 12, .04), 0 10px 30px rgba(11, 11, 12, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: baseline; gap: 10px; margin-right: auto; min-width: 0; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-sub {
  font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent-text); white-space: nowrap;
}
.user { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 28ch; }

.btn {
  appearance: none; border: 1px solid var(--border); background: transparent; color: var(--text);
  font: 500 13px/1 var(--font); padding: 9px 12px; border-radius: 9px; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent-fill); color: var(--on-accent); border-color: transparent; padding: 12px 18px; font-size: 14px; font-weight: 600; }
.btn-primary:hover { background: var(--accent-fill); filter: brightness(1.06); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* ---------- cabeçalho da página ---------- */
.page-head { padding: 36px 0 20px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 24px; }
.page-head h1 { margin: 0; font-size: 30px; line-height: 1.15; font-weight: 650; letter-spacing: -.02em; }
.page-head p { margin: 6px 0 0; color: var(--text-2); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-2); border: 1px solid var(--border); background: var(--surface);
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
}
.chip strong { color: var(--text); font-weight: 600; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.chip.warn .dot { background: var(--bad); }

.notice {
  margin: 0 0 16px; padding: 12px 16px; border-radius: 10px; font-size: 13px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
}

/* ---------- seções ---------- */
.section { margin: 28px 0; }
.section-title {
  margin: 0 0 12px; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent-text);
}

/* ---------- números de destaque ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px 16px; box-shadow: var(--shadow); min-width: 0;
}
.tile-label { font-size: 13px; color: var(--text-2); margin: 0 0 10px; }
.tile-value { font-size: 38px; line-height: 1; font-weight: 650; letter-spacing: -.03em; margin: 0; }
.tile-value.muted { color: var(--text-3); }
.tile-sub { margin: 10px 0 0; font-size: 13px; color: var(--text-3); }
.tile-sub .delta { color: var(--text-2); font-weight: 600; }
.tile.lead { border-color: color-mix(in srgb, var(--accent-text) 45%, var(--border)); }

/* ---------- cartões e gráficos ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow); min-width: 0;
}
.card h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.card .desc { margin: 4px 0 0; font-size: 13px; color: var(--text-2); }
.card-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.chart .label-strong { fill: var(--text); font-weight: 600; font-size: 12px; }
.chart .label-mid { fill: var(--text-2); font-size: 12px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border); stroke-width: 1; }
.chart .crosshair { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hit { fill: transparent; cursor: default; }

.empty {
  border: 1px dashed var(--border); border-radius: 12px; padding: 28px 20px; text-align: center;
  color: var(--text-2); font-size: 14px;
}
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* funil */
.funnel { display: grid; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 170px 1fr 92px; align-items: center; gap: 12px; font-size: 13px; }
.funnel-row .name { color: var(--text-2); }
.funnel-row .bar-track { height: 26px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.funnel-row .bar { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.funnel-row .val { text-align: right; }
.funnel-row .val strong { font-size: 15px; font-weight: 650; }
.funnel-row .val small { display: block; color: var(--text-3); font-size: 11px; }

/* tabela */
details.table-view { margin-top: 14px; }
details.table-view summary { font-size: 12px; color: var(--text-2); cursor: pointer; width: fit-content; }
.table-scroll { overflow-x: auto; margin-top: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.data .n { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: 0; }
.inline-bar { display: inline-block; height: 8px; border-radius: 0 3px 3px 0; background: var(--series-1); vertical-align: middle; margin-left: 8px; }

/* tooltip */
.tooltip {
  position: fixed; z-index: 30; pointer-events: none; min-width: 140px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 11px; font-size: 12px; color: var(--text); box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.tooltip .t-title { font-weight: 600; margin-bottom: 4px; }
.tooltip .t-row { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.tooltip .t-row b { margin-left: auto; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* glossário */
.glossary { color: var(--text-2); font-size: 13px; }
.glossary summary { cursor: pointer; color: var(--text); font-weight: 600; font-size: 14px; }
.glossary dl { display: grid; grid-template-columns: 220px 1fr; gap: 8px 20px; margin: 14px 0 0; }
.glossary dt { color: var(--text); font-weight: 500; }
.glossary dd { margin: 0; }

footer { padding: 28px 0 48px; color: var(--text-3); font-size: 12px; }

/* tela de entrada / estados */
.state { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 24px; }
.state-card {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 32px 28px; text-align: left; box-shadow: var(--shadow);
}
.state-card .eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-text); }
.state-card h1 { margin: 10px 0 8px; font-size: 26px; line-height: 1.2; letter-spacing: -.02em; font-weight: 650; }
.state-card p { margin: 0 0 22px; color: var(--text-2); font-size: 14px; }

.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; border: 1px solid var(--border); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- responsivo ---------- */
@media (max-width: 980px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .topbar .user { display: none; }
  .brand-sub { display: none; }
  .page-head { padding-top: 24px; }
  .page-head h1 { font-size: 24px; }
  .chips { margin-left: 0; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px 14px 12px; }
  .tile-label { font-size: 12px; margin-bottom: 8px; }
  .tile-value { font-size: 26px; }
  .tile-sub { font-size: 12px; margin-top: 8px; }
  .card { padding: 16px; }
  .funnel-row { grid-template-columns: 110px 1fr 70px; gap: 8px; }
  .glossary dl { grid-template-columns: 1fr; gap: 2px; }
  .glossary dd { margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
