/* NetTop BI — folha de componentes.
   Carregada depois de tokens.css. Só classes: nenhum seletor de elemento global,
   para conviver com o CSS existente dos templates Django.
   Todo valor sai de um token; nada de hex solto. */

/* ---------------------------------------------------------------- base ---- */

.nt-root {
  background: var(--surface-canvas);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
}
.nt-num { font-variant-numeric: tabular-nums; }
.nt-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.nt-overline {
  font-family: var(--font-sans); font-size: 11px; line-height: 14px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3);
}

.nt-focusable:focus-visible,
.nt-btn:focus-visible,
.nt-chip:focus-visible,
.nt-input:focus-visible,
.nt-select:focus-visible,
.nt-nav-item:focus-visible,
.nt-seg-opt:focus-visible {
  outline: var(--border-width-focus) solid var(--focus-ring);
  outline-offset: 2px;
}

/* Gradiente NetTop: as quatro paradas do logo, sempre nesta ordem.
   Só em faixa de marca, cabeçalho de capa e barra de destaque. Nunca atrás de texto. */
.nt-gradient {
  background-image: linear-gradient(90deg,
    var(--brand-magenta) 0%, var(--brand-coral) 42%, var(--brand-amber) 76%, var(--brand-yellow) 100%);
}
.nt-gradient-rule { height: 3px; border-radius: var(--radius-pill); }

/* --------------------------------------------------------------- shell ---- */

.nt-app {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  grid-template-rows: 56px minmax(0, 1fr);
  min-height: 100%;
  background: var(--surface-canvas);
}
.nt-sidebar {
  grid-row: 1 / 3;
  background: var(--surface-1);
  border-right: var(--border-width-hairline) solid var(--border-hairline);
  padding: var(--space-4) var(--space-3);
  display: flex; flex-direction: column; gap: var(--space-5);
  min-width: 0;
}
/* A marca no tema escuro e o substituto no tema claro.
   O PNG fornecido tem o logotipo em branco: no tema claro ele desaparece, entao
   o lugar dele e ocupado pelo nome na face display com a regua de gradiente.
   Troque os dois por uma versao para fundo claro assim que o time de marca enviar. */
.nt-brand { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-2); }
.nt-brand img { display: block; height: 26px; width: auto; }
.nt-brand-type { display: none; flex-direction: column; gap: 3px; }
.nt-brand-type b {
  font-family: var(--font-display); font-size: 20px; line-height: 24px; font-weight: 600;
  letter-spacing: -0.01em; color: var(--ink-1);
}
.nt-brand-type .nt-gradient-rule { width: 100%; }
[data-theme="light"] .nt-brand img { display: none; }
[data-theme="light"] .nt-brand-type { display: flex; }
.nt-nav { display: flex; flex-direction: column; gap: 2px; }
.nt-nav-group { margin-bottom: var(--space-4); }
.nt-nav-group > .nt-overline { padding: 0 var(--space-2); margin-bottom: var(--space-2); }
.nt-nav-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--ink-2); text-decoration: none;
  font-size: 13px; line-height: 18px; font-weight: 500;
  border-left: 2px solid transparent;
}
.nt-nav-item:hover { background: var(--surface-2); color: var(--ink-1); }
.nt-nav-item[aria-current="page"] {
  background: var(--accent-soft); color: var(--ink-1); border-left-color: var(--accent);
}
.nt-nav-item .nt-dot { width: 6px; height: 6px; border-radius: var(--radius-pill); flex: none; }

.nt-topbar {
  grid-column: 2; grid-row: 1;
  display: flex; align-items: center; gap: var(--space-4);
  padding: 0 var(--space-6);
  background: var(--surface-1);
  border-bottom: var(--border-width-hairline) solid var(--border-hairline);
  position: sticky; top: 0; z-index: var(--z-topbar);
}
.nt-topbar-title { font-family: var(--font-display); font-size: 16px; line-height: 22px; font-weight: 600; color: var(--ink-1); }
.nt-topbar-spacer { flex: 1; }
.nt-stamp { font-size: 12px; line-height: 16px; color: var(--ink-3); display: flex; align-items: center; gap: var(--space-1); }

.nt-main { grid-column: 2; grid-row: 2; padding: var(--space-6); min-width: 0; }
.nt-section { margin-bottom: var(--space-8); }
.nt-section-head { display: flex; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-4); }
.nt-section-head h2 {
  margin: 0; font-family: var(--font-display); font-size: 20px; line-height: 26px; font-weight: 600; color: var(--ink-1);
}

/* ---------------------------------------------------------------- grade ---- */

.nt-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.nt-col-3 { grid-column: span 3; } .nt-col-4 { grid-column: span 4; }
.nt-col-6 { grid-column: span 6; } .nt-col-8 { grid-column: span 8; } .nt-col-12 { grid-column: span 12; }
@media (max-width: 900px) {
  .nt-grid > [class*="nt-col-"] { grid-column: span 12; }
  .nt-app { grid-template-columns: minmax(0, 1fr); }
  .nt-sidebar { display: none; }
  .nt-topbar, .nt-main { grid-column: 1; }
}

/* ----------------------------------------------------------------- card ---- */

.nt-card {
  background: var(--surface-1);
  border: var(--border-width-hairline) solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-4);
  min-width: 0;
}
.nt-card--flush { padding: 0; overflow: hidden; }

/* ------------------------------------------------------------------ KPI ---- */

.nt-kpi { display: flex; flex-direction: column; gap: var(--space-2); }
.nt-kpi-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); }
.nt-kpi-value {
  font-family: var(--font-display); font-weight: 600; color: var(--ink-1);
  font-size: 26px; line-height: 30px; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.nt-kpi--lg .nt-kpi-value { font-size: 34px; line-height: 36px; letter-spacing: -0.015em; }
.nt-kpi-unit { font-size: 0.55em; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.nt-kpi-row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.nt-kpi-foot { font-size: 12px; line-height: 16px; color: var(--ink-3); }
.nt-kpi-spark { display: block; width: 100%; height: 34px; overflow: visible; }

/* variação: cor + seta + sinal. Nunca só a cor. */
.nt-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; line-height: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.nt-delta--up { color: var(--delta-up); }
.nt-delta--down { color: var(--delta-down); }
.nt-delta--flat { color: var(--delta-flat); }
.nt-delta i { font-style: normal; font-size: 10px; }

/* ---------------------------------------------------------------- selo ---- */

.nt-badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  font-size: 12px; line-height: 16px; font-weight: 500;
  white-space: nowrap;
}
.nt-badge i { font-style: normal; font-size: 11px; line-height: 1; }
.nt-badge--ok { background: var(--status-ok-soft); color: var(--status-ok); }
.nt-badge--warn { background: var(--status-warn-soft); color: var(--status-warn); }
.nt-badge--danger { background: var(--status-danger-soft); color: var(--status-danger); }
.nt-badge--info { background: var(--status-info-soft); color: var(--status-info); }
.nt-badge--neutral { background: var(--status-neutral-soft); color: var(--status-neutral); }

/* -------------------------------------------------------------- gráfico ---- */

.nt-chart { display: flex; flex-direction: column; gap: var(--space-3); }
.nt-chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.nt-chart-title { font-family: var(--font-display); font-size: 16px; line-height: 22px; font-weight: 600; color: var(--ink-1); margin: 0; }
.nt-chart-sub { font-size: 12px; line-height: 16px; color: var(--ink-3); margin: 2px 0 0; }
.nt-chart-body { position: relative; }
.nt-chart-body svg { display: block; width: 100%; height: auto; overflow: visible; }

.nt-legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.nt-legend-item { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 13px; line-height: 18px; color: var(--ink-3); }
.nt-legend-item b { color: var(--ink-2); font-weight: 500; }
.nt-swatch { width: 10px; height: 10px; border-radius: var(--radius-pill); flex: none; }
.nt-swatch--line { width: 14px; height: 3px; border-radius: var(--radius-xs); }

/* cromo desenhado em SVG */
.nt-grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.nt-axis-line { stroke: var(--chart-axis); stroke-width: 1; }
.nt-axis-text { fill: var(--ink-3); font-family: var(--font-sans); font-size: 12px; font-variant-numeric: tabular-nums; }
.nt-band { fill: var(--chart-band); }
.nt-crosshair { stroke: var(--chart-crosshair); stroke-width: 1; stroke-dasharray: 3 3; }
.nt-series-line { fill: none; stroke-width: var(--border-width-series); stroke-linecap: round; stroke-linejoin: round; }
.nt-series-dot { r: 4; stroke: var(--surface-1); stroke-width: 2; }
.nt-bar { rx: var(--radius-xs); }
.nt-bar-gap { stroke: var(--surface-1); stroke-width: 2; }
.nt-label-direct { fill: var(--ink-2); font-family: var(--font-sans); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* cores de série: uma classe por slot, na ordem fixa */
.nt-s1 { --series: var(--viz-1); } .nt-s2 { --series: var(--viz-2); }
.nt-s3 { --series: var(--viz-3); } .nt-s4 { --series: var(--viz-4); }
.nt-s5 { --series: var(--viz-5); } .nt-s6 { --series: var(--viz-6); }
.nt-s7 { --series: var(--viz-7); } .nt-s8 { --series: var(--viz-8); }
.nt-fill { fill: var(--series); }
.nt-stroke { stroke: var(--series); }
.nt-bg { background: var(--series); }

/* canal de textura: ligado por [data-texture] ou por forced-colors / impressão */
.nt-texture-45 { fill: url(#nt-hatch-45); }
.nt-texture-135 { fill: url(#nt-hatch-135); }

/* --------------------------------------------------------------- tabela ---- */

.nt-table-wrap { overflow-x: auto; }
.nt-table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 19px; }
.nt-table th {
  text-align: left; font-weight: 600; color: var(--ink-3);
  font-size: 11px; line-height: 14px; letter-spacing: 0.09em; text-transform: uppercase;
  background: var(--surface-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--border-width-hairline) solid var(--border-hairline);
  position: sticky; top: 0; z-index: var(--z-sticky);
  white-space: nowrap;
}
.nt-table td {
  padding: var(--space-3);
  border-bottom: var(--border-width-hairline) solid var(--border-hairline);
  color: var(--ink-2);
}
.nt-table tbody tr:hover td { background: var(--surface-2); }
.nt-table .nt-t-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-1); }
.nt-table .nt-t-key { color: var(--ink-1); font-weight: 500; }
.nt-table caption { caption-side: bottom; text-align: left; padding: var(--space-3); font-size: 12px; line-height: 16px; color: var(--ink-3); }

/* barra dentro da célula: magnitude sem gastar o canal de cor */
.nt-cellbar { display: block; height: 4px; border-radius: var(--radius-xs); background: var(--series, var(--viz-1)); }
.nt-cellbar-track { display: block; height: 4px; border-radius: var(--radius-xs); background: var(--surface-inset); margin-top: 4px; }

/* -------------------------------------------------------------- filtros ---- */

.nt-filters {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-1);
  border: var(--border-width-hairline) solid var(--border-default);
  border-radius: var(--radius-lg);
}
.nt-filters-spacer { flex: 1; }
.nt-chip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  border: var(--border-width-hairline) solid var(--border-default);
  background: var(--surface-1); color: var(--ink-2);
  font-size: 13px; line-height: 18px; font-weight: 500;
  cursor: pointer;
}
.nt-chip:hover { background: var(--surface-2); color: var(--ink-1); }
.nt-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink-1); }
.nt-chip-x { color: var(--ink-3); font-size: 14px; line-height: 1; }

.nt-seg {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--surface-inset);
  border-radius: var(--radius-md);
}
.nt-seg-opt {
  padding: var(--space-1) var(--space-3);
  border: 0; background: transparent; cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink-3);
}
.nt-seg-opt:hover { color: var(--ink-1); }
.nt-seg-opt[aria-pressed="true"] { background: var(--surface-1); color: var(--ink-1); box-shadow: var(--shadow-card); }

/* --------------------------------------------------------------- botões ---- */

.nt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 0 var(--space-4); height: 36px;
  border-radius: var(--radius-md);
  border: var(--border-width-hairline) solid transparent;
  font-family: var(--font-sans); font-size: 13px; line-height: 18px; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.nt-btn--primary { background: var(--accent); color: var(--on-accent); }
.nt-btn--primary:hover { background: var(--accent-hover); }
.nt-btn--secondary { background: var(--surface-1); color: var(--ink-1); border-color: var(--border-default); }
.nt-btn--secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }
.nt-btn--quiet { background: transparent; color: var(--ink-2); }
.nt-btn--quiet:hover { background: var(--surface-2); color: var(--ink-1); }
.nt-btn--sm { height: 28px; padding: 0 var(--space-3); border-radius: var(--radius-sm); font-size: 12px; }
.nt-btn[aria-disabled="true"], .nt-btn:disabled { color: var(--ink-4); background: var(--surface-2); border-color: var(--border-hairline); cursor: not-allowed; }

/* --------------------------------------------------------------- campos ---- */

.nt-field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.nt-field > label { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink-2); }
.nt-input, .nt-select {
  height: 36px; padding: 0 var(--space-3);
  background: var(--surface-1); color: var(--ink-1);
  border: var(--border-width-hairline) solid var(--border-default);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 13px; line-height: 18px;
  min-width: 0; width: 100%;
}
.nt-input::placeholder { color: var(--ink-4); }
.nt-input:hover, .nt-select:hover { border-color: var(--border-strong); }
.nt-field-hint { font-size: 12px; line-height: 16px; color: var(--ink-3); }
.nt-field-error { font-size: 12px; line-height: 16px; color: var(--status-danger); display: flex; align-items: center; gap: var(--space-1); }
.nt-field--invalid .nt-input, .nt-field--invalid .nt-select { border-color: var(--status-danger); }

/* -------------------------------------------------------------- medidor ---- */

.nt-gauge { display: flex; align-items: center; gap: var(--space-4); }
.nt-gauge svg { flex: none; }
.nt-gauge-track { fill: none; stroke: var(--surface-inset); }
.nt-gauge-value { fill: none; stroke-linecap: round; }
.nt-gauge-target { stroke: var(--ink-1); stroke-width: 2; stroke-linecap: round; }
.nt-gauge-read { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nt-gauge-read strong {
  font-family: var(--font-display); font-size: 26px; line-height: 30px; font-weight: 600;
  color: var(--ink-1); font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}

/* barra de progresso horizontal, para metas em lista */
.nt-meter { display: block; height: 8px; border-radius: var(--radius-xs); background: var(--surface-inset); overflow: hidden; }
.nt-meter > span { display: block; height: 100%; border-radius: var(--radius-xs); background: var(--series, var(--viz-1)); }

/* --------------------------------------------------------------- avisos ---- */

.nt-alert {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: var(--border-width-hairline) solid transparent;
  font-size: 13px; line-height: 19px;
}
.nt-alert i { font-style: normal; flex: none; line-height: 19px; }
.nt-alert-body { min-width: 0; }
.nt-alert-body strong { display: block; color: var(--ink-1); font-weight: 600; }
.nt-alert-body p { margin: 2px 0 0; color: var(--ink-2); }
.nt-alert--ok { background: var(--status-ok-soft); color: var(--status-ok); }
.nt-alert--warn { background: var(--status-warn-soft); color: var(--status-warn); }
.nt-alert--danger { background: var(--status-danger-soft); color: var(--status-danger); }
.nt-alert--info { background: var(--status-info-soft); color: var(--status-info); }

/* --------------------------------------------------------------- vazios ---- */

.nt-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-2); text-align: center;
  padding: var(--space-8) var(--space-6);
  color: var(--ink-3);
}
.nt-empty-mark { margin-bottom: var(--space-2); }
.nt-empty strong { font-family: var(--font-display); font-size: 16px; line-height: 22px; font-weight: 600; color: var(--ink-1); }
.nt-empty p { margin: 0; max-width: 42ch; font-size: 13px; line-height: 19px; }

/* -------------------------------------------------------------- tooltip ---- */

.nt-tooltip {
  background: var(--surface-3);
  border: var(--border-width-hairline) solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
  padding: var(--space-2) var(--space-3);
  font-size: 12px; line-height: 16px; color: var(--ink-2);
  z-index: var(--z-overlay);
  min-width: 190px;
}
.nt-tooltip-head { color: var(--ink-1); font-weight: 600; margin-bottom: var(--space-1); }
.nt-tooltip-row { display: flex; align-items: center; gap: var(--space-2); }
.nt-tooltip-name { flex: 1; white-space: nowrap; }
.nt-tooltip-row b { color: var(--ink-1); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------- estado de carga ---- */

.nt-skeleton { background: var(--surface-2); border-radius: var(--radius-sm); color: transparent; }

@media print {
  .nt-card { box-shadow: none; }
  .nt-sidebar, .nt-filters { display: none; }
}
