/* ==========================================================================
   FiberPlan Design System — v4.0 Corporate
   Base visual compartilhada por Login, Viabilidade (WEB) e Admin.
   Não altera nenhuma chamada de API: apenas a camada de apresentação.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas,
    monospace;

  /* Superfícies */
  --bg: #eef2f7;
  --bg-grad: radial-gradient(1200px 600px at 12% -10%, #e3ecfa 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #eaf1fb 0%, transparent 55%), #eef2f7;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef3f9;
  --surface-inset: #f4f7fb;

  /* Traços */
  --border: #dde5ef;
  --border-strong: #c6d2e2;
  --ring: rgba(11, 87, 201, 0.18);

  /* Texto */
  --text: #10203a;
  --text-2: #44566e;
  --muted: #7b8ba3;

  /* Marca */
  --brand: #0b57c9;
  --brand-600: #0a49aa;
  --brand-700: #083b8b;
  --brand-100: #dbe8ff;
  --brand-50: #eef4ff;
  --accent: #f07d20;

  /* Semântica */
  --ok: #0d8f5b;
  --ok-bg: #e6f6ee;
  --ok-border: #a9e0c6;
  --warn: #b45309;
  --warn-bg: #fdf3e3;
  --warn-border: #f2d3a0;
  --danger: #c92a2a;
  --danger-bg: #fdeceb;
  --danger-border: #f4bfbc;
  --info-bg: #eaf2ff;
  --info-border: #c3d9fb;

  /* Forma */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --sh-xs: 0 1px 2px rgba(16, 32, 58, 0.06);
  --sh-sm: 0 1px 3px rgba(16, 32, 58, 0.08), 0 1px 2px rgba(16, 32, 58, 0.04);
  --sh: 0 4px 14px rgba(16, 32, 58, 0.08), 0 1px 3px rgba(16, 32, 58, 0.05);
  --sh-lg: 0 18px 44px rgba(16, 32, 58, 0.14), 0 2px 8px rgba(16, 32, 58, 0.06);

  --sidew: 400px;
  --topbar-h: 62px;
}

/* Variantes escuras — mantidas para quem já usa um tema dark salvo no Admin.
   O visual corporativo claro continua sendo o padrão. */
body.theme-executive_dark,
body.theme-graphite,
body.theme-fp_blue,
body.theme-neo_fiber,
body.theme-3d_neon,
body.theme-3d_datacenter,
body.theme-3d_graphite {
  --bg: #0c1524;
  --bg-grad: radial-gradient(1100px 560px at 10% -12%, #123056 0%, transparent 60%),
    radial-gradient(900px 480px at 100% 0%, #0f2846 0%, transparent 55%), #0c1524;
  --surface: #10203a;
  --surface-2: #142744;
  --surface-3: #182e50;
  --surface-inset: #0e1c33;
  --border: #223a5e;
  --border-strong: #2d4a76;
  --text: #eaf2ff;
  --text-2: #adc2de;
  --muted: #8199b8;
  --brand: #3d90ff;
  --brand-600: #2a7ff0;
  --brand-700: #1f6ad2;
  --brand-100: #17325a;
  --brand-50: #142a4a;
  --ok: #34d399;
  --ok-bg: #0e3b2c;
  --ok-border: #1c6b50;
  --warn: #fbbf24;
  --warn-bg: #3a2c0c;
  --warn-border: #6b5119;
  --danger: #f87171;
  --danger-bg: #3d1717;
  --danger-border: #6d2a2a;
  --info-bg: #122a4c;
  --info-border: #22436f;
  --ring: rgba(61, 144, 255, 0.28);
  --sh-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --sh: 0 6px 18px rgba(0, 0, 0, 0.4);
  --sh-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* --------------------------------------------------------------------------
   2. Reset / base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-grad);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5 {
  margin: 0 0 0.5rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}
h1 { font-size: 19px; }
h2 { font-size: 16px; }
h3 { font-size: 14.5px; }
h4 { font-size: 13px; }
p { margin: 0 0 0.7rem; color: var(--text-2); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}

pre {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-2);
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  margin: 10px 0 0;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* --------------------------------------------------------------------------
   3. Tipografia utilitária
   -------------------------------------------------------------------------- */
.muted { color: var(--muted); }
.tiny { font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.mini { font-size: 12px; color: var(--text-2); }
.ok { color: var(--ok); font-weight: 650; }
.bad { color: var(--danger); font-weight: 650; }
.yellow { color: var(--warn); font-weight: 650; }
.green { color: var(--ok); font-weight: 650; }

.section-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* --------------------------------------------------------------------------
   4. Formulários
   -------------------------------------------------------------------------- */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin: 12px 0 5px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input:not([type]),
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

textarea { min-height: 76px; resize: vertical; line-height: 1.5; }

input::placeholder,
textarea::placeholder { color: #a6b3c6; }

input:hover:not(:disabled),
select:hover:not(:disabled),
textarea:hover:not(:disabled) { border-color: var(--muted); }

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--ring);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-3);
  color: var(--muted);
  cursor: not-allowed;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237b8ba3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

input[type="file"] {
  padding: 8px;
  font-size: 12.5px;
  background: var(--surface-2);
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  border-radius: 6px;
  padding: 5px 11px;
  margin-right: 10px;
  cursor: pointer;
}

/* Checkbox inline dentro de <label> */
label:has(> input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
label:has(> input[type="checkbox"]):hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: var(--brand);
  cursor: pointer;
  margin: 0;
}

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid2 > div > label:first-child,
.grid3 > div > label:first-child { margin-top: 0; }

@media (max-width: 720px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   5. Botões
   -------------------------------------------------------------------------- */
button,
.av-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 620;
  line-height: 1;
  color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: var(--r-sm);
  padding: 10px 15px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.08s;
  box-shadow: var(--sh-xs);
}
button:hover:not(:disabled),
.av-btn:hover:not(:disabled) { background: var(--brand-600); border-color: var(--brand-600); }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

button.secondary,
.av-btn.secondary {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-strong);
}
button.secondary:hover:not(:disabled) { background: var(--surface-3); border-color: var(--muted); }

button.ghost {
  color: var(--text-2);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
button.ghost:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border); }

button.danger,
.av-btn.danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}
button.danger:hover:not(:disabled) { background: #a81f1f; border-color: #a81f1f; }

button.block { width: 100%; }

/* Botão principal de exportação de KML gerado pelo JS */
button.kml-main {
  width: 100%;
  margin-top: 10px;
  color: #fff;
  background: linear-gradient(180deg, var(--accent), #d96a12);
  border-color: #d96a12;
}
button.kml-main:hover:not(:disabled) { background: #d96a12; }

button.map-btn {
  width: 100%;
  margin-top: 8px;
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-strong);
}
button.map-btn:hover:not(:disabled) { background: var(--surface-3); }

.actions {
  /* Antes era grid de 2 colunas com os botões em width:100%. Um card com uma
     única ação virava um botão da largura inteira do painel, o que lê como
     erro de layout. Em flex, cada botão ocupa o próprio conteúdo e a linha
     quebra sozinha quando são muitos. */
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.actions button { flex: 0 1 auto; min-width: 168px; }

/* --------------------------------------------------------------------------
   6. Cards e superfícies
   -------------------------------------------------------------------------- */
.card,
.av-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  margin: 0 0 14px;
  box-shadow: var(--sh-sm);
}
.card > h2:first-child,
.card > h3:first-child,
.av-card > h2:first-child { margin-top: 0; }

.card h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.av-card-sub {
  margin: -6px 0 14px;
  font-size: 12.5px;
  color: var(--muted);
}

.notice {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-2);
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  margin: 10px 0;
}
.notice b { color: var(--text); }

.rowbox,
.city,
.poprow {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  margin: 8px 0;
  font-size: 13px;
  color: var(--text-2);
}
.city h3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.city .actions { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.poprow { background: var(--surface); }
.pops { display: none; margin-top: 10px; }

/* --------------------------------------------------------------------------
   7. Badges, pills, chips
   -------------------------------------------------------------------------- */
.pill,
.badge,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  margin: 0 5px 5px 0;
  white-space: nowrap;
}
.badge {
  color: var(--brand);
  background: var(--brand-50);
  border-color: var(--brand-100);
}
.pill.green { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.pill.yellow { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.pill.red { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }

/* --------------------------------------------------------------------------
   8. KPIs
   -------------------------------------------------------------------------- */
.kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 9px;
  margin: 14px 0;
}
.kpi > div {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 11px 12px;
  min-width: 0;
}
.kpi small {
  display: block;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.kpi b {
  font-size: 16px;
  font-weight: 680;
  letter-spacing: -0.02em;
  color: var(--text);
  overflow-wrap: break-word;
  hyphens: auto;
}
.kpi br { display: none; }

.cost {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.topline h3, .topline h4 { margin: 0; }

/* --------------------------------------------------------------------------
   9. Status banner (ONNET / OFFNET / CAPEX)
   -------------------------------------------------------------------------- */
.status-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.status-banner::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent);
}
.status-onnet { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.status-offnet { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.status-capex { color: var(--brand); background: var(--brand-50); border-color: var(--brand-100); }
.status-neutral { color: var(--muted); background: var(--surface-3); border-color: var(--border); }

/* --------------------------------------------------------------------------
   10. Bloco de construção / opções comerciais
   -------------------------------------------------------------------------- */
.construction-box {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--r);
  padding: 13px 14px;
  margin: 14px 0;
}
.construction-box .section-title { margin-top: 0; color: var(--warn); }
.construction-box .section-title::after { background: var(--warn-border); }

.option {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 14px;
  margin: 10px 0;
}
.option h4 { margin: 0; font-size: 13.5px; }
.option .kpi { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); margin: 10px 0; }
.option .kpi b { font-size: 14.5px; }
.option .kpi > div { background: var(--surface); }

/* Linha de item LPU gerada pelo JS */
.lpu-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--text-2);
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}

/* --------------------------------------------------------------------------
   11. Tabelas
   -------------------------------------------------------------------------- */
.tablewrap {
  overflow: auto;
  max-height: 520px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}
.tablewrap > table { border: none; }

table.lputable,
table.av-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
table.lputable th,
table.av-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.lputable td,
table.av-table td {
  padding: 9px 12px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.lputable tbody tr:hover td,
table.av-table tbody tr:hover td { background: var(--surface-2); }
table.lputable tbody tr:last-child td { border-bottom: none; }

/* --------------------------------------------------------------------------
   12. Topbar
   -------------------------------------------------------------------------- */
.av-topbar {
  position: sticky;
  top: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--sh-xs);
}
.av-topbar .av-logo {
  display: flex;
  align-items: center;
  height: 34px;
  padding-right: 16px;
  border-right: 1px solid var(--border);
}
.av-topbar .av-logo img { max-height: 30px; max-width: 128px; object-fit: contain; }
/* Nos temas escuros o logotipo perde a parte em azul-marinho contra o fundo.
   A plaquinha branca devolve o contraste sem exigir uma segunda arte. */
[data-theme="3d_neon"] .av-topbar .av-logo,
[data-theme="3d_graphite"] .av-topbar .av-logo,
[data-theme="3d_datacenter"] .av-topbar .av-logo {
  background: #fff; border-radius: 9px; padding: 5px 10px; margin-right: 12px;
  border-right: 0; box-shadow: 0 3px 10px rgba(2, 10, 26, .3);
}
.av-titleblock { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.av-titleblock strong {
  font-size: 14px;
  font-weight: 680;
  letter-spacing: -0.01em;
  color: var(--text);
}
.av-titleblock span {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.av-topbar-spacer { flex: 1; }
.av-topbar-meta { display: flex; align-items: center; gap: 7px; }
.av-topbar-nav { display: flex; align-items: center; gap: 4px; }
.av-navlink {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.av-navlink:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.av-navlink.is-active {
  color: var(--brand);
  background: var(--brand-50);
  border-color: var(--brand-100);
}

.av-status-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ok);
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  border-radius: 999px;
  padding: 5px 11px;
}
.av-status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: av-pulse 2.4s ease-in-out infinite;
}
@keyframes av-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.chip.version-chip { color: var(--brand); background: var(--brand-50); border-color: var(--brand-100); }

/* --------------------------------------------------------------------------
   13. Segmented control (abas Viabilidade / Ponta A-B)
   -------------------------------------------------------------------------- */
.tabs,
.av-segment {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0 0 14px;
}
.tabs .tab,
.av-segment > button {
  flex: 1;
  font-size: 12.5px;
  font-weight: 640;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: none;
}
.tabs .tab:hover:not(.active),
.av-segment > button:hover:not(.active) { background: var(--surface); color: var(--text); }
.tabs .tab.active,
.av-segment > button.active {
  color: var(--brand);
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--sh-xs);
}

.hide { display: none !important; }

/* --------------------------------------------------------------------------
   14. Mapa (tela de viabilidade)
   -------------------------------------------------------------------------- */
.legend {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 550;
  color: var(--text-2);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 11px 13px;
  box-shadow: var(--sh);
}
.legend > div { display: flex; align-items: center; gap: 8px; }
.legend .sw {
  width: 16px;
  height: 4px;
  border-radius: 99px;
  flex: none;
}
.sw.aereo { background: #f59e0b; }
.sw.sub { background: #8b5cf6; }
.sw.prop { background: #0d8f5b; }
.sw.pop { background: var(--brand); height: 9px; width: 9px; border-radius: 50%; }

/* --------------------------------------------------------------------------
   15. Painel I.A Viabilidade
   -------------------------------------------------------------------------- */
.ia-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, var(--brand-700), var(--brand));
  border-radius: var(--r-lg);
  padding: 22px 24px;
  margin-bottom: 16px;
  color: #fff;
  box-shadow: var(--sh);
  overflow: hidden;
  position: relative;
}
.ia-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 220px at 88% 0%, rgba(255, 255, 255, 0.22), transparent 65%);
  pointer-events: none;
}
.ia-title-card { position: relative; z-index: 1; }
.ia-title-card .tiny {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ia-title-card h2 {
  color: #fff;
  font-size: 24px;
  margin: 6px 0 8px;
  border: none;
  padding: 0;
}
.ia-title-card p { color: rgba(255, 255, 255, 0.85); margin: 0; max-width: 70ch; font-size: 13px; }
.ia-brain {
  position: relative;
  z-index: 1;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.25) 45%, rgba(255, 255, 255, 0.06) 70%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.28);
}

.ia-kpi-3d {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.ia-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--brand);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--sh-sm);
}
.ia-tile small {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.ia-tile b {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}
.ia-tile br { display: none; }
.ia-tile .tiny { display: block; margin-top: 2px; }
.ia-glow-green { border-top-color: var(--ok); }
.ia-glow-gold { border-top-color: var(--accent); }
.ia-glow-purple { border-top-color: #8b5cf6; }

.ia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.ia-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--sh-sm);
}
.ia-panel h3 {
  padding-bottom: 9px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.ia-panel canvas { width: 100%; display: block; }

/* --------------------------------------------------------------------------
   16. Toolbar / prévia de menu (Admin)
   -------------------------------------------------------------------------- */
.toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}
.toolbar label:first-child { margin-top: 0; }

.menuPreview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.menuPreview > div {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  padding: 14px 8px;
}

/* --------------------------------------------------------------------------
   17. Utilitários de layout
   -------------------------------------------------------------------------- */
.av-stack { display: flex; flex-direction: column; gap: 12px; }
.av-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.av-scroll { overflow-y: auto; overscroll-behavior: contain; }
.av-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 34px 20px;
}
.av-empty svg { opacity: 0.35; }

.av-footer {
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  padding: 18px;
}

/* ==========================================================================
   FiberPlan Design System — v5.0 Enterprise
   ==========================================================================

   Camada de refinamento. Ela vem depois de tudo de propósito: redefine tokens
   e ajusta componentes pela cascata, sem renomear uma classe sequer. Nada de
   HTML precisou mudar para esta camada entrar, e remover este bloco devolve o
   sistema exatamente ao visual anterior.

   O que mudou, e por quê:

   1. Neutros mais frios e mais claros. O fundo anterior (#eef2f7 com dois
      gradientes radiais grandes) puxava azul e "sujava" o branco dos cards.
      Software corporativo de 2026 é mais plano: o gradiente encolheu e virou
      quase imperceptível, e o contraste passou a vir da borda, não da sombra.

   2. Escala tipográfica em tokens. Antes cada componente tinha o seu tamanho
      em px solto — 13.5px aqui, 12.5px ali. Agora existe uma escala, e o que
      dá a sensação de produto caro é justamente ela ser respeitada.

   3. Densidade de tabela. Dado numérico ganhou fonte tabular (algarismo de
      largura fixa), cabeçalho ficou mais leve e a linha, mais alta. Tabela de
      LPU e de licenciamento são o que o engenheiro olha o dia inteiro.

   4. Foco visível de verdade. Anel de foco consistente em tudo que recebe
      teclado — é acessibilidade, e é também o detalhe que separa um sistema
      interno de um produto.

   5. Movimento com freio. Transições curtas, e `prefers-reduced-motion`
      respeitado: quem configurou o sistema para não animar não vê animação.
   -------------------------------------------------------------------------- */

:root {
  /* --- escala tipográfica ------------------------------------------------ */
  --fs-2xs: 10.5px;
  --fs-xs:  11.5px;
  --fs-sm:  12.5px;
  --fs-md:  13.5px;
  --fs-lg:  15px;
  --fs-xl:  18px;
  --fs-2xl: 22px;
  --fs-3xl: 28px;
  --lh-tight: 1.25;
  --lh: 1.55;
  --tracking-caps: 0.06em;

  /* --- escala de espaçamento (base 4) ------------------------------------ */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  /* --- superfícies -------------------------------------------------------
     Fundo quase plano. O gradiente continua, discreto, só para a página não
     ficar chapada — mas parou de tingir os cards. */
  --bg: #f1f4f9;
  --bg-grad: radial-gradient(1400px 700px at 50% -20%, #e7eef9 0%, transparent 65%), #f1f4f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eff3f9;
  --surface-inset: #f5f8fc;

  /* --- traços ------------------------------------------------------------
     Borda um pouco mais definida: com sombra mais fraca, é ela que separa. */
  --border: #dfe5ee;
  --border-strong: #c8d2e0;
  --ring: rgba(11, 87, 201, 0.22);

  /* --- texto -------------------------------------------------------------
     Texto principal mais escuro (contraste AAA no branco) e o secundário
     legível de verdade — o cinza anterior sumia em tela clara. */
  --text: #0d1a2e;
  --text-2: #45566d;
  --muted: #6b7c93;

  /* --- sombras -----------------------------------------------------------
     Mais rasas e mais frias. Sombra grande em card é a marca visual mais
     datada que um sistema pode ter. */
  --sh-xs: 0 1px 1px rgba(13, 26, 46, 0.04);
  --sh-sm: 0 1px 2px rgba(13, 26, 46, 0.06);
  --sh:    0 2px 6px rgba(13, 26, 46, 0.06), 0 1px 2px rgba(13, 26, 46, 0.04);
  --sh-lg: 0 12px 32px rgba(13, 26, 46, 0.10), 0 2px 6px rgba(13, 26, 46, 0.05);

  /* --- movimento --------------------------------------------------------- */
  --t-rapida: 0.12s cubic-bezier(0.2, 0, 0.2, 1);
  --t: 0.18s cubic-bezier(0.2, 0, 0.2, 1);
}

/* Dark: mesma correção de temperatura e de profundidade. */
body.theme-executive_dark, body.theme-graphite, body.theme-fp_blue,
body.theme-neo_fiber, body.theme-3d_neon, body.theme-3d_datacenter,
body.theme-3d_graphite {
  --bg: #0b1220;
  --bg-grad: radial-gradient(1400px 700px at 50% -20%, #10233f 0%, transparent 65%), #0b1220;
  --surface: #111d31;
  --surface-2: #16243c;
  --surface-3: #1b2b47;
  --surface-inset: #0e1829;
  --border: #22334f;
  --border-strong: #2f4468;
  --text: #edf3fb;
  --text-2: #b3c4da;
  --muted: #8496b0;
  --sh-xs: none;
  --sh-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --sh:    0 4px 12px rgba(0, 0, 0, 0.45);
  --sh-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
}

/* --- base ---------------------------------------------------------------- */
body {
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Anel de foco único para o sistema inteiro. `:focus-visible` só dispara na
   navegação por teclado, então o clique de mouse continua limpo. */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--brand-100); color: var(--text); }

/* Barra de rolagem discreta — aparece em toda tabela longa do sistema. */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 99px;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--muted); background-clip: content-box; }

/* --- formulários --------------------------------------------------------- */
input[type="text"], input[type="password"], input[type="number"],
input[type="email"], input[type="search"], input:not([type]), select, textarea {
  padding: 10px 12px;
  font-size: var(--fs-md);
  line-height: 1.4;
  border-color: var(--border-strong);
  background: var(--surface);
  transition: border-color var(--t-rapida), box-shadow var(--t-rapida);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--ring);
  outline: none;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.72; }

/* Campo numérico com algarismo de largura fixa: coordenada e preço param de
   "dançar" enquanto se digita. */
input[inputmode="numeric"], input[inputmode="decimal"],
input[type="number"], .num, td.num, .tabular { font-variant-numeric: tabular-nums; }

label {
  font-size: var(--fs-xs);
  font-weight: 640;
  letter-spacing: 0.01em;
  color: var(--text-2);
}

/* --- botões -------------------------------------------------------------- */
.av-btn, button {
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0.005em;
  border-radius: var(--r-sm);
  transition: background var(--t-rapida), border-color var(--t-rapida),
              box-shadow var(--t-rapida), color var(--t-rapida);
  box-shadow: none;
}
button:active:not(:disabled), .av-btn:active:not(:disabled) { transform: none; }
button:hover:not(:disabled) { box-shadow: var(--sh-xs); }
button.secondary:hover:not(:disabled), .av-btn.secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

/* --- cards --------------------------------------------------------------- */
.av-card, .card {
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  border: 1px solid var(--border);
  transition: box-shadow var(--t), border-color var(--t);
}
.card > h2, .av-card > h2 {
  font-size: var(--fs-lg);
  font-weight: 640;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* --- tabelas: a superfície que o engenheiro olha o dia inteiro ----------- */
table { font-variant-numeric: tabular-nums; }
table.lputable th, table.av-table th, .tablewrap th {
  font-size: var(--fs-2xs);
  font-weight: 680;
  letter-spacing: var(--tracking-caps);
  color: var(--muted);
  background: var(--surface-2);
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-strong);
}
table.lputable td, table.av-table td, .tablewrap td {
  padding: 11px 12px;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--text-2);
}
table.lputable tbody tr, table.av-table tbody tr { transition: background var(--t-rapida); }
table.lputable tbody tr:hover td, table.av-table tbody tr:hover td {
  background: var(--brand-50);
}
/* Primeira coluna é quase sempre o identificador da linha. */
table.lputable tbody td:first-child, table.av-table tbody td:first-child { color: var(--text); }

/* --- badges e chips ------------------------------------------------------ */
.badge, .chip {
  font-size: var(--fs-xs);
  font-weight: 620;
  letter-spacing: 0.01em;
  border-radius: 999px;
}

/* --- avisos -------------------------------------------------------------- */
.notice {
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  line-height: var(--lh);
}

/* --- estado vazio -------------------------------------------------------- */
/* Componente novo. Existia o mesmo texto solto em várias telas ("Nenhum
   registro."), sempre com aparência diferente. */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
}
.empty strong { color: var(--text-2); font-size: var(--fs-md); font-weight: 620; }
.empty p { margin: 0; font-size: var(--fs-sm); max-width: 46ch; line-height: var(--lh); }

/* --- barra de ferramentas ------------------------------------------------ */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-4);
}
.toolbar .cresce { flex: 1 1 auto; }

/* --- topbar -------------------------------------------------------------- */
.av-topbar {
  box-shadow: var(--sh-xs);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(140%) blur(8px);
}

/* --- KPIs ---------------------------------------------------------------- */
.kpi > div { border-radius: var(--r-sm); box-shadow: none; }
.kpi b { font-size: var(--fs-xl); font-weight: 660; letter-spacing: -0.02em;
         font-variant-numeric: tabular-nums; }
.kpi small { font-size: var(--fs-2xs); letter-spacing: var(--tracking-caps); }

/* --- movimento respeitando a preferência do sistema ---------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- impressão ----------------------------------------------------------- */
/* Toda tela do FiberPlan vira PDF pelo navegador em algum momento. */
@media print {
  body { background: #fff !important; }
  .av-topbar, .side, .actions, .toolbar, button { display: none !important; }
  .av-card, .card { box-shadow: none !important; border-color: #ccc !important;
                    break-inside: avoid; page-break-inside: avoid; }
  table { font-size: 10pt; }
}
