@import url('tokens.css?v=4');

/**
 * ==============================================================================
 * PHM TECH — PHM NETLAB (CSS DEDICADO & DESIGN SYSTEM DE REDES)
 * Arquitetura Isolada: Consome tokens.css
 * Prof. Paulo Henrique Maciel · PHM Tech
 * ==============================================================================
 */

/* ==========================================================================
   1. SEÇÕES E ALTERNÂNCIA DE SUPERFÍCIES DO NETLAB
   ========================================================================== */

/* Seção 1: Hero & Toolbar de Dispositivos e Controles */
.net-section-hero {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 2.75rem 0 2rem 0;
  position: relative;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

/* Seção 2: Prancheta Interativa & Inspetor de Camadas OSI */
.net-section-canvas {
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  padding: 2rem 0 3rem 0;
  position: relative;
  min-height: 650px;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

/* Seção 3: Guia Didático de Redes e Protocolos */
.net-section-guide {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 3.5rem 0;
  position: relative;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

/* ==========================================================================
   2. HERO PRINCIPAL & BANNER
   ========================================================================== */

.net-master-hero {
  max-width: 980px;
  margin: 0 auto;
  text-align: center;
}

.net-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--net-identity-subtle);
  border: 1px solid var(--net-identity);
  color: var(--net-identity-strong);
  margin-bottom: 1.25rem;
  text-transform: uppercase;
}

[data-theme="dark"] .net-hero-badge {
  background: var(--net-identity-subtle);
  border-color: var(--net-identity);
  color: var(--net-identity);
}

.net-hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4.2vw, 3rem);
  font-weight: 800;
  line-height: 1.18;
  color: var(--navy);
  margin: 0 auto 1.15rem auto;
  letter-spacing: -0.02em;
}

.net-hero-highlight {
  color: var(--teal);
  background: none;
  -webkit-text-fill-color: initial;
  display: inline;
}

.net-hero-subtitle {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text-soft);
  max-width: 780px;
  margin: 0 auto 1.5rem auto;
}

/* ==========================================================================
   3. TOOLBAR DE DISPOSITIVOS, CABOS & SIMULAÇÃO
   ========================================================================== */

.netlab-toolbar-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.toolbar-row-top,
.toolbar-row-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tools-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.25rem;
}

.btn-add-node {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--navy);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-add-node:hover {
  background: var(--net-identity-strong);
  border-color: var(--net-identity-strong);
  color: var(--net-on-identity);
  transform: translateY(-1px);
}

.btn-tool-link {
  background: var(--net-identity-subtle);
  border: 1.5px solid var(--net-identity);
  color: var(--net-identity-strong);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-tool-link:hover,
.btn-tool-link.active {
  background: var(--net-identity-strong);
  border-color: var(--net-identity-strong);
  color: var(--net-on-identity);
  box-shadow: 0 0 0 3px var(--net-identity-subtle);
}

.btn-toolbar-guide {
  background: var(--net-identity-subtle);
  border: 1px solid var(--net-identity);
  color: var(--net-identity-strong);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-toolbar-guide:hover {
  background: var(--net-identity-strong);
  color: var(--net-on-identity);
}

.netlab-file-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.simulation-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.preset-box,
.proto-box {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  max-width: 100%;
}

.select-netlab {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
  min-width: 0;
  max-width: 100%;
}

.select-netlab:focus {
  border-color: var(--net-identity-strong);
}

.btn-run-sim {
  background: var(--net-identity-strong);
  border: none;
  color: var(--net-on-identity);
  font-size: 0.84rem;
  font-weight: 800;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-run-sim:hover {
  background: var(--net-identity);
  box-shadow: 0 0 0 3px var(--net-identity-subtle);
  transform: translateY(-1px);
}

.btn-clear-canvas {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-clear-canvas:hover {
  background: var(--net-danger-subtle);
  border-color: var(--net-danger);
  color: var(--net-danger);
}

/* ==========================================================================
   4. ÁREA CENTRAL: PRANCHETA TOPOLÓGICA & INSPETOR
   ========================================================================== */

.netlab-main-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.25rem;
  margin-top: 0.5rem;
  min-width: 0;
}

@media (max-width: 1100px) {
  .netlab-main-layout {
    grid-template-columns: 1fr;
  }
}

/* Prancheta Canvas */
.canvas-wrapper {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 640px) {
  .header-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .header-actions > *,
  .btn-header-action,
  .nav-pref-trigger {
    min-width: 0;
    width: 100%;
  }

  .netlab-toolbar-box {
    padding: 0.85rem;
  }

  .toolbar-row-bottom,
  .simulation-controls,
  .preset-box,
  .proto-box,
  .netlab-file-actions {
    width: 100%;
  }

  .netlab-file-actions .btn-toolbar-guide {
    flex: 1 1 auto;
    justify-content: center;
  }

  .preset-box,
  .proto-box {
    align-items: stretch;
    flex-direction: column;
  }

  .select-netlab,
  .btn-run-sim {
    width: 100%;
  }
}

.netlab-canvas-top-bar {
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.canvas-title-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--navy);
}

.canvas-hud-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
}

.hud-badge {
  background: var(--net-identity-strong);
  color: var(--net-on-identity);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.hud-message {
  color: var(--text-muted);
}

.canvas-board {
  position: relative;
  min-height: 520px;
  height: 520px;
  background-color: var(--bg);
  background-image: radial-gradient(var(--line) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  overflow: hidden;
  user-select: none;
}

.canvas-board.linking-mode {
  cursor: crosshair;
}

/* Camada SVG dos Cabos */
.links-svg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.link-line {
  stroke: var(--line-strong);
  stroke-width: 3px;
  stroke-dasharray: 6 4;
  stroke-linecap: round;
  transition: stroke 0.3s ease, stroke-width 0.3s ease;
}

.link-line.active-traffic {
  stroke: var(--net-success);
  stroke-width: 4px;
  stroke-dasharray: 8 4;
  animation: netTrafficFlow 0.8s linear infinite;
}

@keyframes netTrafficFlow {
  from { stroke-dashoffset: 24; }
  to { stroke-dashoffset: 0; }
}

/* Camada de Nós */
.nodes-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Nó de Rede (Card do Equipamento) */
.net-node {
  position: absolute;
  pointer-events: auto;
  width: 112px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.4rem 0.55rem 0.4rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: grab;
  user-select: none;
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  z-index: 10;
}

.net-node:hover {
  border-color: var(--net-identity);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.net-node:active {
  cursor: grabbing;
}

.net-node.active {
  border-color: var(--net-identity-strong);
  box-shadow: 0 0 0 3px var(--net-identity-subtle);
}

.net-node.link-origin-selected {
  border-color: var(--net-identity-strong);
  box-shadow: 0 0 0 4px var(--net-identity-subtle);
  animation: netPulseGreen 1.2s infinite;
}

.net-node.pulse-active {
  border-color: var(--net-success);
  box-shadow: 0 0 0 4px var(--net-success-subtle);
  transform: scale(1.05);
}

.net-node.pulse-error {
  border-color: var(--net-danger);
  box-shadow: 0 0 0 4px var(--net-danger-subtle);
  animation: netShake 0.4s ease;
}

@keyframes netPulseGreen {
  0%, 100% { box-shadow: 0 0 0 4px var(--net-identity-subtle); }
  50% { box-shadow: 0 0 0 8px transparent; }
}

@keyframes netShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* Botão de Excluir Nó */
.node-btn-del {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--net-danger);
  color: var(--phm-color-on-danger);
  border: 1.5px solid var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 5;
}

.net-node:hover .node-btn-del,
.node-btn-del:focus-visible {
  opacity: 1;
}

@media (hover: none), (pointer: coarse), (max-width: 640px) {
  .node-btn-del {
    opacity: 1;
  }
}

.node-btn-del:hover {
  background: var(--net-danger);
  transform: scale(1.15);
}

/* Ícone do Nó */
.node-icon-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--net-identity-subtle);
  color: var(--net-identity-strong);
  margin-bottom: 0.35rem;
  transition: var(--transition);
}

.net-node:hover .node-icon-box {
  background: var(--net-identity-strong);
  color: var(--net-on-identity);
}

/* Rótulo e IP do Nó */
.node-label {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
  display: block;
  line-height: 1.2;
  margin-bottom: 0.15rem;
}

.node-ip {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  line-height: 1.1;
}

/* Pacote Animado */
.traveling-packet {
  position: absolute;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--net-success);
  color: var(--phm-color-on-success);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 0 0 3px var(--net-success-subtle);
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: top 0.04s linear, left 0.04s linear;
}

/* ==========================================================================
   5. PAINEL LATERAL: INSPETOR, OSI & CIDR
   ========================================================================== */

.netlab-inspector-sidebar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inspector-tabs {
  display: flex;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.inspector-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.7rem 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.inspector-tab:hover {
  color: var(--navy);
}

.inspector-tab.active {
  background: var(--surface);
  color: var(--teal);
  border-bottom: 2px solid var(--teal);
  font-weight: 800;
}

.inspector-content {
  display: none;
  padding: 1rem;
  flex: 1;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
}

.inspector-content.active {
  display: flex;
}

/* Terminal Console */
.terminal-box {
  background: var(--net-terminal-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: inset 0 2px 8px var(--net-terminal-shadow);
}

.terminal-header {
  background: var(--net-terminal-header);
  padding: 0.4rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid var(--net-terminal-divider);
}

.term-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.term-dot.red { background: var(--net-terminal-danger); }
.term-dot.yellow { background: var(--net-terminal-warning); }
.term-dot.green { background: var(--net-terminal-success); }

.term-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--net-terminal-muted);
  margin-left: 0.35rem;
}

.terminal-body {
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--net-terminal-text);
  line-height: 1.5;
  max-height: 180px;
  overflow-y: auto;
}

.term-line { margin-bottom: 0.25rem; }
.term-line.system { color: var(--net-terminal-muted); }
.term-line.success { color: var(--net-terminal-success); font-weight: 700; }
.term-line.error { color: var(--net-terminal-danger); font-weight: 700; }

/* Relatório Didático */
.didactic-report-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.report-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.6rem;
}

.report-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.status-idle { background: var(--surface-muted); color: var(--text-muted); }
.status-success { background: var(--net-success-subtle); color: var(--net-success); }
.status-error { background: var(--net-danger-subtle); color: var(--net-danger); }

.report-explanation {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-soft);
  margin-bottom: 0.6rem;
}

.report-theory-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.report-theory-box strong {
  color: var(--teal);
  display: block;
  margin-bottom: 0.2rem;
}

/* Camadas OSI */
.osi-stack-view {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.osi-layer {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.osi-layer-num {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  color: var(--net-layer-on-color);
}

.osi-layer.layer-7 .osi-layer-num { background: var(--net-layer-application); }
.osi-layer.layer-4 .osi-layer-num { background: var(--net-layer-transport); }
.osi-layer.layer-3 .osi-layer-num { background: var(--net-layer-network); }
.osi-layer.layer-2 .osi-layer-num { background: var(--net-layer-link); }

.osi-layer-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.osi-layer-info strong {
  font-size: 0.78rem;
  color: var(--navy);
}

.osi-layer-info span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Calculadora CIDR */
.cidr-calc-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cidr-calc-card input,
.cidr-calc-card select {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  outline: none;
}

.cidr-calc-card input:focus,
.cidr-calc-card select:focus {
  border-color: var(--teal);
}

.cidr-results {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cidr-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
}

.cidr-row span { color: var(--text-muted); }
.cidr-row strong { font-family: var(--font-mono); color: var(--navy); }

/* ==========================================================================
   6. SEÇÃO DIDÁTICA: GUIA TEÓRICO DE REDES
   ========================================================================== */

.net-guide-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-top: 2rem;
}

@media (max-width: 1000px) {
  .net-guide-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .net-guide-grid {
    grid-template-columns: 1fr;
  }
}

.net-guide-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: var(--transition);
}

.net-guide-card:hover {
  transform: translateY(-3px);
  border-color: var(--net-identity);
  box-shadow: var(--shadow-md);
}

.net-guide-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--net-identity-subtle);
  color: var(--net-identity-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

.net-guide-card h4 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0;
}

.net-guide-card p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-soft);
  margin: 0;
}

/* ==========================================================================
   7. MODAL DIDÁTICO & TOAST
   ========================================================================== */

.guide-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--phm-color-overlay);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
}

.guide-modal-overlay.open {
  display: flex;
}

.guide-modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.guide-modal-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.guide-title-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.guide-header-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--net-identity-subtle);
  color: var(--net-identity-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-modal-header h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0;
}

.guide-modal-header p {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0;
}

.btn-close-guide {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}

.guide-nav-tabs {
  display: flex;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.guide-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.guide-tab-btn:hover { color: var(--navy); }
.guide-tab-btn.active {
  background: var(--surface);
  color: var(--teal);
  border-bottom: 2px solid var(--teal);
}

.guide-modal-content {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.guide-pane {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.guide-pane.active {
  display: flex;
}

.guide-hero-box {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-soft);
}

.guide-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .guide-grid-2 { grid-template-columns: 1fr; }
}

.guide-feature-item {
  display: flex;
  gap: 0.65rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-soft);
}

.guide-device-card,
.proto-detail-card,
.error-case-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-soft);
}

.dev-badge {
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.25rem;
}

.guide-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  display: flex;
  justify-content: flex-end;
}

.btn-guide-close-bottom {
  background: var(--net-identity-strong);
  border: none;
  color: var(--net-on-identity);
  font-weight: 800;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-guide-close-bottom:hover { background: var(--net-identity); }

.app-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--phm-color-surface-raised);
  color: var(--phm-color-text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.1rem;
  box-shadow: var(--shadow-lg);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 2000;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.app-toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Contraste PHM UI v2: identidade do produto e conteúdo textual usam tokens. */
.net-hero-badge,
#btn-toggle-link-mode,
.btn-toolbar-guide,
.inspector-tab.active,
#report-theory-title { color: var(--net-identity-strong); }
#btn-run-sim { background: var(--net-identity-strong); border-color: var(--net-identity-strong); }
#hud-status-badge { background: var(--net-identity-strong); color: var(--net-on-identity); }
#hud-status-msg,
.inspector-tab,
#report-status-text { color: var(--text-muted); }

/* ==========================================================================
   CABEÇALHO CANÔNICO DO ECOSSISTEMA — BOTÕES GHOST 34x34px & RESPONSIVIDADE
   ========================================================================== */
.phm-ecosystem-header .phm-ecosystem-header__inner,
.phm-ecosystem-header .nav-wrap {
  justify-content: flex-start !important;
}

.phm-ecosystem-header .phm-projects-menu > summary,
.phm-ecosystem-header .phm-hub-back {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid transparent !important;
  border-radius: 4px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text-soft, #475569) !important;
  transition: all 0.15s ease;
}

.phm-ecosystem-header .phm-projects-menu > summary::-webkit-details-marker {
  display: none !important;
}

.phm-ecosystem-header .phm-projects-menu > summary span,
.phm-ecosystem-header .phm-projects-menu > summary svg:last-child,
.phm-ecosystem-header .phm-hub-back span {
  display: none !important;
}

.phm-ecosystem-header .phm-projects-menu > summary svg:first-child,
.phm-ecosystem-header .phm-hub-back svg {
  margin: 0 !important;
}

.phm-ecosystem-header .phm-projects-menu > summary:hover,
.phm-ecosystem-header .phm-projects-menu[open] > summary,
.phm-ecosystem-header .phm-hub-back:hover {
  border-color: var(--line, #e2e8f0) !important;
  background: var(--surface-soft, #f1f5f9) !important;
  color: var(--teal, #0d9488) !important;
}

[data-theme="dark"] .phm-ecosystem-header .phm-projects-menu > summary,
[data-theme="dark"] .phm-ecosystem-header .phm-hub-back {
  color: #94a3b8 !important;
}

[data-theme="dark"] .phm-ecosystem-header .phm-projects-menu > summary:hover,
[data-theme="dark"] .phm-ecosystem-header .phm-projects-menu[open] > summary,
[data-theme="dark"] .phm-ecosystem-header .phm-hub-back:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #2dd4bf !important;
}

[data-theme="sepia"] .phm-ecosystem-header .phm-projects-menu > summary,
[data-theme="sepia"] .phm-ecosystem-header .phm-hub-back {
  color: #715842 !important;
}

[data-theme="sepia"] .phm-ecosystem-header .phm-projects-menu > summary:hover,
[data-theme="sepia"] .phm-ecosystem-header .phm-projects-menu[open] > summary,
[data-theme="sepia"] .phm-ecosystem-header .phm-hub-back:hover {
  background: rgba(67, 52, 34, 0.08) !important;
  border-color: rgba(67, 52, 34, 0.15) !important;
  color: #78350f !important;
}

.phm-ecosystem-header .menu-toggle {
  display: none !important;
}

@media (max-width: 900px) {
  .phm-ecosystem-header .menu-toggle {
    display: inline-flex !important;
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid transparent !important;
    border-radius: 4px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--text-soft, #475569) !important;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .phm-ecosystem-header .menu-toggle:hover {
    border-color: var(--line, #e2e8f0) !important;
    background: var(--surface-soft, #f1f5f9) !important;
    color: var(--teal, #0d9488) !important;
  }
  [data-theme="dark"] .phm-ecosystem-header .menu-toggle {
    color: #94a3b8 !important;
  }
  [data-theme="dark"] .phm-ecosystem-header .menu-toggle:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #2dd4bf !important;
  }
  [data-theme="sepia"] .phm-ecosystem-header .menu-toggle {
    color: #715842 !important;
  }
  [data-theme="sepia"] .phm-ecosystem-header .menu-toggle:hover {
    background: rgba(67, 52, 34, 0.08) !important;
    border-color: rgba(67, 52, 34, 0.15) !important;
    color: #78350f !important;
  }
  .phm-ecosystem-header .header-editorial-nav {
    display: none !important;
  }
  .phm-ecosystem-header .header-editorial-nav.open {
    display: flex !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--surface, #0b1329);
    border-bottom: 1px solid var(--line, rgba(255, 255, 255, 0.1));
    padding: 1rem 1.25rem;
    gap: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    z-index: 999;
  }
  [data-theme="light"] .phm-ecosystem-header .header-editorial-nav.open {
    background: #ffffff;
    border-bottom-color: var(--line, #e2e8f0);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  }
}

body.app-body {
  overflow-x: hidden;
}

.phm-ecosystem-header {
  width: 100% !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
}

@media (max-width: 640px) {
  .phm-ecosystem-header .phm-ecosystem-header__inner {
    padding-inline: 0.35rem !important;
    gap: 0.2rem !important;
  }
  .phm-ecosystem-header .nav-left-cluster {
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }
  .phm-ecosystem-header .app-logo-wordmark {
    height: 20px !important;
    max-width: 85px !important;
    width: auto !important;
  }
  .phm-ecosystem-header .nav-cluster-divider {
    display: none !important;
  }
  .phm-ecosystem-header .phm-ecosystem-header__actions {
    gap: 0.15rem !important;
    flex-shrink: 0 !important;
  }
  .phm-ecosystem-header .nav-pref-trigger,
  .phm-ecosystem-header .phm-projects-menu > summary,
  .phm-ecosystem-header .phm-hub-back,
  .phm-ecosystem-header .menu-toggle {
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    border-radius: 4px !important;
    justify-content: center !important;
  }
}

/* Salvaguarda de Acessibilidade: Skip Link fora do fluxo visual quando não focado */
.phm-skip-link {
  position: absolute !important;
  top: -9999px !important;
  left: 1rem !important;
  z-index: 999999 !important;
  padding: 0.5rem 1rem !important;
  background: #0b1329 !important;
  color: #2dd4bf !important;
  border: 1px solid #2dd4bf !important;
  border-radius: 4px !important;
  font-family: var(--font-body, system-ui, sans-serif) !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.phm-skip-link:focus,
.phm-skip-link:focus-visible {
  top: 1rem !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  outline: 2px solid #2dd4bf !important;
}
