/* ═══════════════════════════════════════════════════════
   NetSim — Estilo Industrial Oscuro
   ═══════════════════════════════════════════════════════ */

:root {
  --bg0: #0a0c0f;
  --bg1: #0f1318;
  --bg2: #151c24;
  --bg3: #1c2530;
  --bg4: #232e3c;
  --border: #2a3a4a;
  --border-bright: #3d5470;

  --text0: #e8f0f8;
  --text1: #a8bdd0;
  --text2: #6a8aa8;
  --text3: #3d5570;

  --accent: #00d4ff;
  --accent-dim: #0088bb;
  --accent-glow: rgba(0, 212, 255, 0.15);
  --green: #00e89a;
  --green-dim: rgba(0, 232, 154, 0.15);
  --amber: #ffb84d;
  --amber-dim: rgba(255, 184, 77, 0.15);
  --red: #ff4d6a;
  --red-dim: rgba(255, 77, 106, 0.15);
  --purple: #b06dff;

  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --font-ui: 'Syne', sans-serif;

  --radius: 6px;
  --radius-lg: 10px;
  --header-h: 52px;
  --sidebar-w: 200px;
  --sidebar-r: 340px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  background: var(--bg0);
  color: var(--text0);
  font-family: var(--font-ui);
  font-size: 13px;
  display: flex;
  flex-direction: column;
}

/* ── Header siempre oscuro (independiente del tema) ─── */
#app-header {
  height: var(--header-h);
  background: #0f1318;
  border-bottom: 1px solid #2a3a4a;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  flex-shrink: 0;
  color-scheme: dark;
}

/* Sobrescribir colores del header en tema claro */
body.theme-light #app-header { background: #0f1318; border-bottom-color: #2a3a4a; }
body.theme-light #app-header .logo-title { color: #e8f0f8; }
body.theme-light #app-header .ws-status { color: #6a8aa8; }
body.theme-light #app-header .ws-status.connected .status-text { color: #00e89a; }
body.theme-light #app-header .tab-bar { background: #151c24; }
body.theme-light #app-header .tab-btn { color: #6a8aa8; }
body.theme-light #app-header .tab-btn:hover { color: #e8f0f8; background: #1c2530; }
body.theme-light #app-header .tab-btn.active { background: #00d4ff; color: #0a0c0f; }
body.theme-light #app-header .btn-icon { background: #151c24; border-color: #2a3a4a; color: #a8bdd0; }
body.theme-light #app-header .btn-icon:hover { border-color: #00d4ff; color: #00d4ff; }
body.theme-light #app-header .btn-icon.danger:hover { border-color: #ff4d6a; color: #ff4d6a; }
body.theme-light #app-header .user-badge { background: #151c24; border-color: #2a3a4a; }
body.theme-light #app-header #ws-status .status-dot { background: #3d5570; }

.header-left { display: flex; align-items: center; gap: 16px; min-width: 180px; }
.header-center { flex: 1; display: flex; justify-content: center; }
.header-right { display: flex; align-items: center; gap: 8px; min-width: 180px; justify-content: flex-end; }

.logo { display: flex; align-items: center; gap: 10px; }
.logo-text-block { display: flex; flex-direction: column; justify-content: center; }
.logo-title { font-size: 13px; font-weight: 800; letter-spacing: 0.04em; color: var(--text0); line-height: 1.2; }
.logo-sub {
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, #ff9900, #ffb84d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 600;
}

.ws-status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text2); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text3); transition: background .3s; }
.ws-status.connected .status-dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
.ws-status.connected .status-text { color: var(--green); }

/* Tab bar */
.tab-bar { display: flex; gap: 4px; background: var(--bg2); padding: 4px; border-radius: var(--radius-lg); }
.tab-btn {
  padding: 6px 16px;
  background: none;
  border: none;
  color: var(--text2);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .2s;
  letter-spacing: 0.03em;
}
.tab-btn:hover { color: var(--text0); background: var(--bg3); }
.tab-btn.active { background: var(--accent); color: var(--bg0); }

/* Botones icono header */
.btn-icon {
  width: 32px; height: 32px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text1);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon.danger:hover { border-color: var(--red); color: var(--red); }

/* ── Main layout ─────────────────────────────────────── */
#app-main {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-content {
  display: none;
  width: 100%;
  height: 100%;
}
.tab-content.active { display: flex; }

/* ── Tab Topología ───────────────────────────────────── */
#tab-topology { flex-direction: row; }

/* Sidebar izquierdo */
.sidebar-left {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg1);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar-section {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text3);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Paleta de dispositivos */
.device-palette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.device-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: grab;
  transition: all .2s;
  font-size: 11px;
  color: var(--text1);
}
.device-item:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.device-item:active { cursor: grabbing; }

.device-icon {
  font-size: 20px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
}
.device-icon.pc     { color: #00d4ff; }
.device-icon.server { color: #00e89a; }
.device-icon.router { color: #ffb84d; }
.device-icon.switch { color: #b06dff; }
.device-icon.hub    { color: #6a8aa8; }
.device-icon.firewall { color: #ff4d6a; }
.device-icon.ap     { color: #00e89a; }

/* Media selector */
.media-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.media-selector label { font-size: 10px; color: var(--text2); }
.media-selector select, .media-selector input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text0);
  padding: 5px 8px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
}

.link-mode-hint {
  margin-top: 8px;
  padding: 8px;
  background: var(--amber-dim);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  color: var(--amber);
  font-size: 11px;
  line-height: 1.5;
}

.btn-action {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text1);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  margin-bottom: 6px;
  transition: all .2s;
}
.btn-action:hover { border-color: var(--accent); color: var(--accent); }
.btn-action.active { background: var(--accent); color: var(--bg0); border-color: var(--accent); }

/* Canvas */
.canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(0,212,255,0.03) 0%, transparent 60%),
    var(--bg0);
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  background-color: var(--bg0);
}

#topology-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  cursor: default;
}

.canvas-hint {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text3);
  font-size: 13px;
  pointer-events: none;
  text-align: center;
  line-height: 2;
}

/* Sidebar derecho */
.sidebar-right {
  width: var(--sidebar-r);
  flex-shrink: 0;
  background: var(--bg1);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-right .sidebar-section { flex-shrink: 0; }
.console-section { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.console-node-label {
  font-size: 10px;
  font-weight: 400;
  color: var(--accent);
  font-family: var(--font-mono);
}

.console-output {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.7;
  background: var(--bg0);
  border-top: 1px solid var(--border);
}

.console-line { color: var(--text1); white-space: pre-wrap; word-break: break-all; }
.console-line.info  { color: var(--text2); }
.console-line.cmd   { color: var(--accent); }
.console-line.ok    { color: var(--green); }
.console-line.error { color: var(--red); }
.console-line.event { color: var(--amber); }
.console-line .hl   { color: var(--accent); font-weight: 700; }

.console-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg1);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.console-prompt { color: var(--green); font-family: var(--font-mono); font-size: 13px; font-weight: 700; }

#console-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text0);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
}
#console-input::placeholder { color: var(--text3); }

#btn-run {
  background: var(--accent);
  border: none;
  color: var(--bg0);
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
}
#btn-run:hover { filter: brightness(1.15); }

/* Props panel */
.props-content { font-family: var(--font-mono); font-size: 11px; }
.prop-row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid var(--border); }
.prop-label { color: var(--text2); }
.prop-value { color: var(--accent); }
.prop-btn { margin-top: 8px; width: 100%; padding: 5px; background: var(--bg2); border: 1px solid var(--border); color: var(--text1); border-radius: var(--radius); cursor: pointer; font-size: 11px; }
.prop-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Tab OSI ─────────────────────────────────────────── */
#tab-osi { flex-direction: column; overflow-y: auto; }

.osi-container { padding: 24px 32px; max-width: 1100px; margin: 0 auto; width: 100%; }
.osi-header { margin-bottom: 24px; }
.osi-header h2 { font-size: 22px; font-weight: 800; color: var(--text0); margin-bottom: 6px; }
.osi-header p { color: var(--text2); font-size: 13px; }

.osi-layout {
  display: grid;
  grid-template-columns: 120px 1fr 280px;
  gap: 24px;
  align-items: start;
}

.osi-layers { display: flex; flex-direction: column; gap: 6px; }

.osi-layer {
  display: grid;
  grid-template-columns: 28px 1fr 100px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .2s;
  border-left: 3px solid transparent;
}
.osi-layer:hover, .osi-layer.active {
  border-left-color: var(--accent);
  background: var(--bg3);
}
.osi-layer.pulsing { animation: osi-pulse 0.6s ease; }
@keyframes osi-pulse {
  0%, 100% { background: var(--bg2); }
  50% { background: var(--accent-glow); border-left-color: var(--accent); }
}

.layer-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  font-family: var(--font-mono);
}
.layer-name { font-weight: 600; font-size: 13px; }
.layer-pdu {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text2);
  text-align: right;
}

/* Colores por capa */
.layer-7 .layer-num { background: rgba(176,109,255,0.2); color: #b06dff; }
.layer-6 .layer-num { background: rgba(0,212,255,0.15); color: var(--accent); }
.layer-5 .layer-num { background: rgba(0,232,154,0.15); color: var(--green); }
.layer-4 .layer-num { background: rgba(255,184,77,0.2); color: var(--amber); }
.layer-3 .layer-num { background: rgba(255,77,106,0.15); color: var(--red); }
.layer-2 .layer-num { background: rgba(0,212,255,0.2); color: var(--accent); }
.layer-1 .layer-num { background: rgba(106,138,168,0.2); color: var(--text1); }

.osi-detail-col { position: sticky; top: 0; }
.osi-detail-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  min-height: 300px;
}
.osi-detail-placeholder { color: var(--text3); font-size: 12px; padding: 20px; text-align: center; }
.osi-detail-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.osi-detail-subtitle { font-size: 11px; color: var(--text2); margin-bottom: 12px; }
.osi-detail-protocols { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.proto-badge {
  padding: 2px 8px;
  background: var(--bg3);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--accent);
}
.osi-detail-desc { font-size: 12px; color: var(--text1); line-height: 1.7; }

.osi-packet-col { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 10px; font-size: 11px; color: var(--text2); }
.osi-arrow-down, .osi-arrow-up { font-size: 20px; color: var(--accent); }
.osi-packet-label { text-align: center; font-size: 10px; }

/* ── Tab Subnetting ─────────────────────────────────── */
#tab-subnet { flex-direction: row; overflow-y: auto; }
.subnet-container { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 24px; width: 100%; }
.subnet-left, .subnet-right { display: flex; flex-direction: column; gap: 20px; }

.subnet-tool {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.subnet-tool h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--text0); }
.subnet-tool input, .subnet-tool textarea {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text0);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 8px;
  outline: none;
  transition: border-color .2s;
}
.subnet-tool input:focus, .subnet-tool textarea:focus { border-color: var(--accent); }
.subnet-tool textarea { resize: vertical; }
.big-input { font-size: 14px !important; padding: 10px 14px !important; }

.btn-primary {
  width: 100%;
  padding: 9px;
  background: var(--accent);
  border: none;
  color: var(--bg0);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  transition: filter .2s;
}
.btn-primary:hover { filter: brightness(1.1); }

.subnet-result {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  min-height: 80px;
}
.subnet-table { width: 100%; border-collapse: collapse; }
.subnet-table th, .subnet-table td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.subnet-table th { color: var(--text2); font-weight: 400; font-size: 10px; text-transform: uppercase; }
.subnet-table td { color: var(--text0); }
.subnet-table tr:hover td { background: var(--bg2); }
.kv-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--border); }
.kv-key { color: var(--text2); }
.kv-val { color: var(--accent); font-weight: 600; }

/* ── Tab Medios ─────────────────────────────────────── */
#tab-media { overflow-y: auto; }
.media-container { padding: 24px; width: 100%; }
.media-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.media-card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: border-color .2s;
}
.media-card:hover { border-color: var(--accent); }
.media-card-name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.media-card-id { font-size: 10px; color: var(--text2); font-family: var(--font-mono); margin-bottom: 12px; }
.media-stat { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.media-stat:last-child { border: none; }
.media-stat-label { color: var(--text2); }
.media-stat-value { color: var(--green); font-family: var(--font-mono); font-weight: 600; }
.media-visual { height: 4px; border-radius: 2px; margin: 12px 0 8px; background: var(--bg3); }
.media-visual-bar { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--green)); transition: width .5s; }

/* ── Modales ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--bg1);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.modal-sm { width: 380px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
}
.modal-close {
  background: none; border: none;
  color: var(--text2); cursor: pointer; font-size: 16px;
}
.modal-close:hover { color: var(--red); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }

/* Escenarios */
.scenario-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all .2s;
}
.scenario-card:hover { border-color: var(--accent); }
.scenario-name { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.scenario-desc { font-size: 11px; color: var(--text2); margin-bottom: 8px; }
.scenario-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}
.badge-básico    { background: var(--green-dim); color: var(--green); }
.badge-intermedio { background: var(--amber-dim); color: var(--amber); }
.badge-avanzado  { background: var(--red-dim); color: var(--red); }

/* Form */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 11px; color: var(--text2); margin-bottom: 4px; }
.form-group input, .form-group select {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text0);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
}
.form-group input:focus { border-color: var(--accent); }

/* ── OSI Live Panel ──────────────────────────────────── */
.osi-live-panel {
  position: fixed;
  right: var(--sidebar-r);
  bottom: 0;
  width: 220px;
  background: var(--bg1);
  border: 1px solid var(--border-bright);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 500;
  overflow: hidden;
}
.osi-live-title {
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
}
.osi-live-layers { padding: 8px; display: flex; flex-direction: column; gap: 3px; }
.osi-live-layer {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text2);
  background: var(--bg2);
  transition: all .3s;
  display: flex; justify-content: space-between;
}
.osi-live-layer.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-left: 2px solid var(--accent);
}

/* Scrollbars */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg0); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }

/* Tooltip */
.tooltip {
  position: absolute;
  background: var(--bg3);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text0);
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
  display: none;
}
.tooltip.visible { display: block; }


/* ── Tema Claro ─────────────────────────────────────── */
body.theme-light {
  --bg0: #f0f4f8;
  --bg1: #ffffff;
  --bg2: #e8eef5;
  --bg3: #dde5ef;
  --bg4: #cdd8e8;
  --border: #c5d0de;
  --border-bright: #8aaac8;
  --text0: #0f1e2e;
  --text1: #2a3e54;
  --text2: #4a6080;
  --text3: #7a98b8;
  --accent: #0077cc;
  --accent-dim: #0055aa;
  --accent-glow: rgba(0, 119, 204, 0.12);
  --green: #00884d;
  --green-dim: rgba(0, 136, 77, 0.12);
  --amber: #c07000;
  --amber-dim: rgba(192, 112, 0, 0.12);
  --red: #cc2244;
  --red-dim: rgba(204, 34, 68, 0.12);
  --purple: #6633cc;
}

body.theme-light .canvas-container {
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  background-color: var(--bg0);
}

body.theme-light #topology-canvas {
  background: transparent;
}

body.theme-light .console-output {
  background: #f8fafc;
}

/* ── Controles de zoom ───────────────────────────────── */
.zoom-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg1);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  padding: 4px 6px;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.zoom-btn {
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  color: var(--text1);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  line-height: 1;
}
.zoom-btn:hover { background: var(--bg3); color: var(--accent); }

.zoom-label {
  min-width: 46px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text1);
  user-select: none;
}

.zoom-reset {
  font-size: 14px;
  margin-left: 2px;
  border-left: 1px solid var(--border);
  border-radius: 0 50% 50% 0;
  padding-left: 4px;
}

/* ── Tab DHCP/DNS ────────────────────────────────────── */
#tab-dhcp { overflow-y: auto; }
.dhcp-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 24px;
  width: 100%;
  align-items: start;
}
.dhcp-panel {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.dhcp-panel h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.dhcp-panel h4 { font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 8px; }
.dhcp-desc { font-size: 12px; color: var(--text2); margin-bottom: 16px; line-height: 1.6; }
.dhcp-desc code { background: var(--bg3); padding: 1px 5px; border-radius: 4px; color: var(--accent); font-family: var(--font-mono); }
.dhcp-result {
  margin-top: 12px;
  padding: 10px;
  background: var(--bg0);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  min-height: 40px;
  color: var(--text1);
  white-space: pre-wrap;
}
.dhcp-leases {
  margin-top: 8px;
  padding: 10px;
  background: var(--bg2);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text1);
  min-height: 60px;
  max-height: 200px;
  overflow-y: auto;
}
.lease-row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid var(--border); }
.lease-mac { color: var(--text2); }
.lease-ip  { color: var(--green); font-weight: 600; }

/* ── Sidebar compacto colapsable ─────────────────────── */
.collapsible-title {
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.collapsible-title:hover { color: var(--accent); }
.collapse-arrow { font-size: 10px; transition: transform .2s; }
.collapsible-section.collapsed .collapse-arrow { transform: rotate(-90deg); }
.collapsible-section.collapsed .collapsible-body { display: none; }

/* Paleta compacta 3 columnas */
.device-palette-sm {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.device-item-sm {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: grab;
  transition: all .2s;
  font-size: 9px;
  color: var(--text1);
  text-align: center;
}
.device-item-sm:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.device-item-sm:active { cursor: grabbing; }
.device-item-sm span:first-child { font-size: 16px; }
.dev-ico { font-size: 16px; }
.dev-ico.pc     { color: #00d4ff; }
.dev-ico.server { color: #00e89a; }
.dev-ico.router { color: #ffb84d; }
.dev-ico.switch { color: #b06dff; }
.dev-ico.hub    { color: #6a8aa8; }
.dev-ico.firewall { color: #ff4d6a; }
.dev-ico.ap     { color: #00e89a; }

/* ── Modal Diálogo (prompt/confirm/alert) ────────────── */
#modal-dialog .modal { animation: dialog-pop .18s cubic-bezier(.34,1.56,.64,1); }
@keyframes dialog-pop {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
#dialog-input:focus { border-color: var(--accent); }
.dialog-btn {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: filter .15s;
}
.dialog-btn:hover { filter: brightness(1.12); }
.dialog-btn-cancel {
  background: var(--bg3);
  color: var(--text1);
  border: 1px solid var(--border);
}
.dialog-btn-cancel:hover { border-color: var(--text2); color: var(--text0); }
.dialog-btn-ok { background: var(--accent); color: var(--bg0); }
.dialog-btn-danger { background: var(--red); color: #fff; }

/* ── Panel de Configuraciones ───────────────────────── */
#modal-settings .modal { width: 480px; }
.settings-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; margin-bottom: 0; }
.settings-section h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text2);
  margin-bottom: 12px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}
.settings-row label {
  font-size: 12px;
  color: var(--text1);
  flex: 1;
}
.settings-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}
.settings-row input[type="number"] {
  width: 70px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text0);
  padding: 5px 8px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
  outline: none;
}
.settings-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.settings-val {
  min-width: 36px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
}
.settings-row select {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text0);
  padding: 5px 8px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  outline: none;
  cursor: pointer;
}

/* ── Modo conectar: hover "encendido" ───────────────── */
.node-hover-glow {
  pointer-events: none;
}

/* ── Modal Exportar ─────────────────────────────────── */
#modal-export .modal { width: 520px; }
.export-preview {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  max-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.export-preview img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}
.export-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.export-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.export-option-row label {
  font-size: 12px;
  color: var(--text1);
  flex: 1;
}
.export-option-row input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
  width: 14px;
  height: 14px;
}
.export-btn-group {
  display: flex;
  gap: 8px;
}
.export-btn-group .btn-primary {
  flex: 1;
}
.config-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 11px;
}
.config-table th {
  background: var(--bg3);
  color: var(--text2);
  padding: 6px 10px;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
}
.config-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text1);
}
.config-table td:first-child { color: var(--accent); font-weight: 600; }
.config-table tr:hover td { background: var(--bg2); }

/* ── Sidebar colapsable total ───────────────────────── */
/* ── Paneles colapsables (izquierdo y derecho) ───────── */
.sidebar-left.collapsed {
  width: 40px;
  min-width: 40px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-left.collapsed .sidebar-section,
.sidebar-left.collapsed .collapsible-section {
  display: none;
}
.sidebar-left.collapsed #btn-collapse-sidebar {
  writing-mode: vertical-lr;
  flex: 1;
  width: 40px;
  padding: 16px 4px;
  margin: 0;
  border-radius: 0;
  font-size: 10px;
  border: none;
  border-right: 1px solid var(--border);
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}

.sidebar-right.collapsed {
  width: 40px;
  min-width: 40px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-right.collapsed .sidebar-section,
.sidebar-right.collapsed .console-section {
  display: none;
}
.sidebar-right.collapsed #btn-collapse-console {
  writing-mode: vertical-lr;

  flex: 1;
  width: 40px;
  padding: 16px 4px;
  margin: 0;
  border-radius: 0;
  font-size: 10px;
  border: none;
  border-left: 1px solid var(--border);
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}
