/* NanoTech-kw | Network Lab (js/netlab.js) - responsive: phone, tablet, desktop */
#netlab { --nl-bg: #0d1630; --nl-card: var(--card-bg, #131f3b); --nl-line: var(--border, #1e293b); --nl-text: var(--text, #e2e8f0); --nl-muted: var(--muted, #94a3b8); --nl-acc: var(--accent, #38bdf8); --nl-input: var(--dark-bg, #0a1226);
    max-width: 100%; overflow-x: clip; container-type: inline-size; container-name: netlab; }
#netlab, #netlab * { box-sizing: border-box; }
#netlab button { font-family: inherit; }
#netlab button:focus-visible, #netlab select:focus-visible, #netlab input:focus-visible { outline: 2px solid var(--nl-acc); outline-offset: 1px; }

/* Toolbar */
.nl-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.nl-group { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--nl-line); border-radius: 12px; background: var(--nl-card); min-width: 0; }
.nl-toolbar button, .nl-toolbar select { display: inline-flex; align-items: center; gap: 6px; background: transparent; color: var(--nl-text); border: 1px solid var(--nl-line); border-radius: 8px; padding: 7px 10px; font: 600 12.5px/1.1 system-ui, sans-serif; cursor: pointer; min-height: 34px; }
.nl-toolbar select { background: var(--nl-card); max-width: 220px; }
.nl-toolbar button:hover, .nl-toolbar button.active { border-color: var(--nl-acc); color: var(--nl-acc); }
.nl-toolbar button.active { background: rgba(56, 189, 248, .12); }

/* Status bar */
.nl-status { white-space: pre-wrap; font: 12.5px/1.5 'Cascadia Code', Consolas, monospace; color: var(--nl-muted); background: var(--nl-card); border: 1px dashed var(--nl-line); border-radius: 10px; padding: 9px 12px; margin-bottom: 10px; overflow-wrap: anywhere; }
.nl-status[hidden] { display: none; }
.nl-status.ok { color: #34d399; } .nl-status.err { color: #f87171; }
.nl-actions, .nl-ports-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-family: system-ui, sans-serif; }
.nl-actions button { background: var(--nl-input); color: var(--nl-acc); border: 1px solid var(--nl-line); border-radius: 8px; padding: 7px 11px; font: 600 12.5px system-ui, sans-serif; cursor: pointer; min-height: 34px; }
.nl-actions button:hover { border-color: var(--nl-acc); }

/* Layout: palette | canvas | panel */
.nl-main { display: grid; grid-template-columns: 96px minmax(0, 1fr) 360px; gap: 10px; align-items: start; }
.nl-main > * { min-width: 0; }
.nl-palette { background: var(--nl-card); border: 1px solid var(--nl-line); border-radius: 14px; padding: 8px 6px; display: grid; gap: 8px; align-content: start; }
.nl-pgroup { display: grid; gap: 4px; }
.nl-pgroup .nl-ph { font: 700 10px system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--nl-muted); text-align: center; margin: 2px 0; }
.nl-palette button { display: grid; justify-items: center; gap: 2px; background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 6px 2px; color: var(--nl-text); font: 600 11px system-ui, sans-serif; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.nl-palette button:hover { border-color: var(--nl-line); background: rgba(56, 189, 248, .06); }
.nl-palette button:active { cursor: grabbing; }
.nl-ico { overflow: visible; }
.nl-ico .nl-body { fill: rgba(19, 31, 59, .9); stroke: var(--c); stroke-width: 3; }
.nl-ico .nl-glyph { fill: none; stroke: var(--c); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.nl-ico .nl-badge, .nl-dev .nl-badge { fill: var(--c); font: 700 11px system-ui, sans-serif; text-anchor: middle; stroke: none; }
.nl-ghost { position: fixed; z-index: 90; pointer-events: none; transform: translate(-50%, -50%) scale(1.6); opacity: .85; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .5)); }

/* Canvas */
.nl-stage { position: relative; }
.nl-canvas { display: block; width: 100%; height: auto; aspect-ratio: 760 / 470; background: var(--nl-bg); border: 1px solid var(--nl-line); border-radius: 14px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
    background-image: radial-gradient(rgba(148, 163, 184, .18) 1px, transparent 1px); background-size: 20px 20px; cursor: default; }
.nl-zoom { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 4px; }
.nl-zoom button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--nl-line); background: var(--nl-card); color: var(--nl-text); font: 600 15px system-ui, sans-serif; cursor: pointer; opacity: .92; }
.nl-zoom button:hover, .nl-zoom button.active { border-color: var(--nl-acc); color: var(--nl-acc); }
.nl-hud { position: absolute; left: 10px; bottom: 8px; font: 11px system-ui, sans-serif; color: var(--nl-muted); background: color-mix(in srgb, var(--nl-card) 85%, transparent); padding: 3px 8px; border-radius: 999px; pointer-events: none; }

.nl-dev { cursor: grab; }
.nl-dev .nl-hit { fill: transparent; }
.nl-dev .nl-body { fill: #131f3b; stroke: var(--c); stroke-width: 2.5; transition: stroke-width .15s; }
.nl-dev .nl-glyph { fill: none; stroke: var(--c); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.nl-dev.sel .nl-body { stroke-width: 4; filter: drop-shadow(0 0 8px var(--c)); }
.nl-dev.from .nl-body { stroke-dasharray: 5 4; }
.nl-dev.can .nl-body { filter: drop-shadow(0 0 6px #34d399); }
.nl-dev.cant { opacity: .35; }
.nl-dev.hover .nl-body { stroke-width: 5; }
.nl-name { fill: var(--nl-text); font: 700 12px system-ui, sans-serif; text-anchor: middle; paint-order: stroke; stroke: var(--nl-bg); stroke-width: 3px; }
.nl-ip { fill: var(--nl-muted); font: 11px 'Cascadia Code', Consolas, monospace; text-anchor: middle; paint-order: stroke; stroke: var(--nl-bg); stroke-width: 3px; }
.nl-port { fill: var(--nl-muted); font: 10px system-ui, sans-serif; text-anchor: middle; paint-order: stroke; stroke: var(--nl-bg); stroke-width: 3px; pointer-events: none; }
.nl-empty { fill: var(--nl-muted); font: 15px system-ui, sans-serif; text-anchor: middle; }
.nl-issue circle { fill: #f59e0b; stroke: var(--nl-bg); stroke-width: 2; }
.nl-issue.err circle { fill: #ef4444; }
.nl-issue text { fill: #fff; font: 800 11px system-ui, sans-serif; text-anchor: middle; }
.nl-handle { cursor: crosshair; }
.nl-handle circle { fill: var(--nl-acc); stroke: var(--nl-bg); stroke-width: 2; filter: drop-shadow(0 0 6px rgba(56, 189, 248, .7)); }
.nl-handle path { stroke: #062033; stroke-width: 2.6; stroke-linecap: round; }

.nl-wire { stroke-width: 2.6; fill: none; }
.nl-wire.up { stroke: #34d399; } .nl-wire.half { stroke: #f59e0b; } .nl-wire.down { stroke: #64748b; stroke-dasharray: 6 5; }
.nl-wire.t-crossover { stroke-dasharray: 10 3 2 3; }
.nl-wire.t-wireless { stroke-dasharray: 2 6; stroke-linecap: round; stroke-width: 3; }
.nl-wire.t-serial.up { stroke: #f87171; }
.nl-zig { fill: none; stroke: #f87171; stroke-width: 2.2; pointer-events: none; }
.nl-wire-hit { stroke: transparent; stroke-width: 18; cursor: pointer; fill: none; }
.nl-link.sel .nl-wire { stroke-width: 5; filter: drop-shadow(0 0 5px var(--nl-acc)); }
.nl-link.nl-flash .nl-wire { stroke: var(--nl-acc); stroke-width: 6; stroke-dasharray: none; }
.nl-link.nl-flash.bad .nl-wire { stroke: #f87171; }
.nl-led.up { fill: #34d399; } .nl-led.wait { fill: #f59e0b; } .nl-led.down { fill: #f87171; }
.nl-rubber { stroke: var(--nl-acc); stroke-width: 3; stroke-dasharray: 8 6; pointer-events: none; }
.nl-rubber.good { stroke: #34d399; stroke-dasharray: none; } .nl-rubber.bad { stroke: #f87171; }
.nl-rubtxt { fill: #34d399; font: 700 12px system-ui, sans-serif; text-anchor: middle; paint-order: stroke; stroke: var(--nl-bg); stroke-width: 4px; pointer-events: none; }
.nl-rubtxt.bad { fill: #f87171; }
#nlRubber { pointer-events: none; }
.nl-packet rect { fill: #38bdf8; stroke: #fff; stroke-width: 1.6; }
.nl-packet path { fill: none; stroke: #fff; stroke-width: 1.4; }
.nl-packet.reply rect { fill: #a78bfa; }
.nl-dropmark { fill: #f87171; font: 800 26px system-ui, sans-serif; paint-order: stroke; stroke: var(--nl-bg); stroke-width: 4px; }

/* Rack view */
.nl-rack { cursor: pointer; }
.nl-runit { fill: #0b1428; stroke: var(--nl-line); stroke-width: 1.5; }
.nl-rack.sel .nl-runit { stroke: var(--c); stroke-width: 3; }
.nl-rstripe { fill: var(--c); }
.nl-rname { fill: var(--nl-text); font: 700 12px system-ui, sans-serif; }
.nl-rmodel { fill: var(--nl-muted); font: 10px system-ui, sans-serif; }
.nl-rlabel { fill: var(--nl-muted); font: 700 11px system-ui, sans-serif; letter-spacing: .1em; }
.nl-rport { fill: #1e293b; stroke: #475569; stroke-width: 1; }
.nl-rport.up { fill: #065f46; stroke: #34d399; } .nl-rport.wait { fill: #78350f; stroke: #f59e0b; } .nl-rport.off { fill: #3f1d1d; }
.nl-rport.t-serial { rx: 7; } .nl-rport.t-wireless { stroke-dasharray: 2 2; }
.nl-rcable { stroke-width: 2.4; opacity: .9; }

/* Side panel */
.nl-panel { position: relative; background: var(--nl-card); border: 1px solid var(--nl-line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 320px; overflow: hidden; }
.nl-panel h3 { color: var(--nl-text); font-size: 16px; border-inline-start: 4px solid var(--c, var(--nl-acc)); padding-inline-start: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-inline-end: 30px; }
.nl-panel h3 small { color: var(--nl-muted); font-weight: 500; font-size: 12px; }
.nl-panel h3 select, .nl-model { margin-inline-start: auto; font: 500 11.5px system-ui, sans-serif; color: var(--nl-muted); background: var(--nl-input); border: 1px solid var(--nl-line); border-radius: 6px; padding: 3px 6px; max-width: 170px; }
.nl-panel h4 { color: var(--nl-text); font-size: 13px; margin-top: 4px; }
.nl-panel p, .nl-panel li { color: var(--nl-muted); font-size: 13px; line-height: 1.55; }
.nl-panel ol { padding-inline-start: 18px; display: grid; gap: 5px; }
.nl-note { font-size: 12px !important; }
.nl-close { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--nl-line); background: transparent; color: var(--nl-muted); cursor: pointer; }
.nl-dim { opacity: .65; } .nl-down { color: #f87171; } .nl-ok { color: #34d399 !important; }
.nl-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--nl-line); overflow-x: auto; scrollbar-width: none; }
.nl-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--nl-muted); padding: 8px 10px; font: 600 13px system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.nl-tabs button.active { color: var(--nl-acc); border-bottom-color: var(--nl-acc); }
.nl-tabpane[hidden] { display: none; }
.nl-tabpane { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.nl-btnrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nl-btnrow button, .nl-link-btn { background: var(--nl-input); color: var(--nl-acc); border: 1px solid var(--nl-line); border-radius: 8px; padding: 7px 11px; font: 600 12.5px system-ui, sans-serif; cursor: pointer; min-height: 34px; }
.nl-btnrow button[type="submit"] { background: var(--nl-acc); color: #062033; border-color: transparent; }
.nl-btnrow button.danger { color: #f87171; }
.nl-link-btn { justify-self: start; font-size: 12px; min-height: 30px; padding: 4px 9px; }

/* Forms */
.nl-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nl-form2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.nl-span2 { grid-column: 1 / -1; }
.nl-form label { display: grid; gap: 3px; font-size: 11.5px; color: var(--nl-muted); min-width: 0; }
.nl-form input, .nl-form select, .nl-config input, .nl-config select, .nl-gsearch { width: 100%; min-width: 0; background: var(--nl-input); border: 1px solid var(--nl-line); color: var(--nl-text); border-radius: 7px; padding: 7px 8px; font: 12.5px 'Cascadia Code', Consolas, monospace; }
.nl-form input[readonly] { opacity: .65; }
.nl-seg { display: flex; gap: 0; border: 1px solid var(--nl-line); border-radius: 8px; overflow: hidden; }
.nl-seg label { flex: 1; display: flex !important; align-items: center; justify-content: center; gap: 6px; padding: 7px; font: 600 12.5px system-ui, sans-serif !important; color: var(--nl-text) !important; cursor: pointer; }
.nl-seg label:has(input:checked) { background: rgba(56, 189, 248, .14); color: var(--nl-acc) !important; }
.nl-seg input { accent-color: var(--nl-acc); }
.nl-v6 summary, .nl-more summary { cursor: pointer; color: var(--nl-text); font-size: 12.5px; font-weight: 600; }
.nl-more pre { font: 11.5px/1.45 'Cascadia Code', Consolas, monospace; color: var(--nl-muted); white-space: pre-wrap; margin-top: 6px; }
.nl-formmsg { font-size: 12px; } .nl-formmsg.ok { color: #34d399; } .nl-formmsg.err { color: #f87171; }
.nl-config { display: grid; gap: 8px; min-width: 0; }
.nl-host { display: flex; align-items: center; gap: 8px; color: var(--nl-muted); font-size: 12.5px; }
.nl-host input { flex: 1; width: auto; }
.nl-scroll { overflow-x: auto; max-width: 100%; }
.nl-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.nl-tbl th { text-align: start; color: var(--nl-muted); font-weight: 600; font-size: 10.5px; text-transform: uppercase; padding: 4px; white-space: nowrap; }
.nl-tbl td { padding: 4px; border-top: 1px solid var(--nl-line); color: var(--nl-text); vertical-align: middle; }
.nl-tbl .nl-dim { font-size: 10.5px; color: var(--nl-muted); white-space: nowrap; }
.nl-iftbl td:first-child { white-space: nowrap; }
.nl-iftbl select { width: auto; min-width: 78px; }
.nl-iftbl input[data-f="vlan"] { width: 62px; margin-top: 3px; }
.nl-iftbl input[data-f="cidr"] { min-width: 130px; }
.nl-newrow input { min-width: 80px; }
.nl-chk { display: inline-flex; align-items: center; gap: 5px; color: var(--nl-muted); white-space: nowrap; font-size: 12.5px; cursor: pointer; }
.nl-chk input { width: auto; accent-color: var(--nl-acc); }
.nl-chk.nl-big { color: var(--nl-text); font-weight: 600; }
.nl-config button { background: var(--nl-input); color: var(--nl-acc); border: 1px solid var(--nl-line); border-radius: 6px; padding: 4px 8px; cursor: pointer; font-weight: 700; min-height: 28px; }
.nl-vlans, .nl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nl-vlans span, .nl-chips span { background: var(--nl-input); border: 1px solid var(--nl-line); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12px; color: var(--nl-muted); display: inline-flex; align-items: center; gap: 4px; }
.nl-vlans b { color: var(--nl-text); }
.nl-vlans button, .nl-chips button { padding: 0 6px; border: 0; background: none; color: var(--nl-muted); min-height: 0; }
.nl-newvlan { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; }
.nl-portlist { list-style: none; padding: 0; display: grid; gap: 4px; }
.nl-portlist li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nl-dot { width: 9px; height: 9px; border-radius: 50%; background: #475569; flex: 0 0 auto; }
.nl-dot.up { background: #34d399; } .nl-dot.wait { background: #f59e0b; } .nl-dot.off { background: #f87171; }

/* Link panel */
.nl-ends { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.nl-end { background: var(--nl-input); border: 1px solid var(--nl-line); border-radius: 10px; padding: 8px; font-size: 12.5px; color: var(--nl-text); overflow-wrap: anywhere; }
.nl-arrow { color: var(--nl-acc); font-size: 20px; }

/* Check panel */
.nl-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.nl-stats span { background: var(--nl-input); border: 1px solid var(--nl-line); border-radius: 10px; padding: 6px 2px; text-align: center; font-size: 10.5px; color: var(--nl-muted); display: grid; }
.nl-stats b { color: var(--nl-text); font-size: 17px; }
.nl-issues { list-style: none; padding: 0; display: grid; gap: 5px; }
.nl-issues li { background: var(--nl-input); border: 1px solid var(--nl-line); border-inline-start: 3px solid #f59e0b; border-radius: 8px; padding: 6px 9px; font-size: 12.5px; color: var(--nl-text); }
.nl-issues li.err { border-inline-start-color: #ef4444; } .nl-issues li.ok { border-inline-start-color: #34d399; }
.nl-issues li[data-goto] { cursor: pointer; } .nl-issues li[data-goto]:hover { border-color: var(--nl-acc); }
.nl-issues small { display: block; color: var(--nl-muted); font-size: 11px; }
.nl-matrix { border-collapse: collapse; font-size: 12px; }
.nl-matrix th, .nl-matrix td { border: 1px solid var(--nl-line); padding: 5px 7px; text-align: center; color: var(--nl-text); white-space: nowrap; }
.nl-matrix td.ok { color: #34d399; background: rgba(52, 211, 153, .08); }
.nl-matrix td.err { color: #f87171; background: rgba(248, 113, 113, .08); cursor: pointer; }

/* Command guide */
.nl-guide { display: grid; gap: 6px; max-height: 620px; overflow: auto; padding-inline-end: 2px; }
.nl-gcat { border: 1px solid var(--nl-line); border-radius: 10px; background: var(--nl-input); }
.nl-gcat summary { cursor: pointer; padding: 8px 10px; color: var(--nl-text); font: 700 13px system-ui, sans-serif; display: flex; justify-content: space-between; }
.nl-gcat summary span { color: var(--nl-muted); font-weight: 500; }
.nl-gcmd { padding: 8px 10px; border-top: 1px solid var(--nl-line); display: grid; gap: 3px; }
.nl-gcmd > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.nl-gcmd code { color: #7dd3fc; font: 600 12.5px 'Cascadia Code', Consolas, monospace; overflow-wrap: anywhere; }
.nl-gcmd em { font: 10.5px system-ui, sans-serif; font-style: normal; color: var(--nl-muted); border: 1px solid var(--nl-line); border-radius: 999px; padding: 0 6px; }
.nl-gcmd p { margin: 0; font-size: 12px !important; }
.nl-gcmd button { justify-self: start; background: #050a17; color: #b3e0ff; border: 1px solid var(--nl-line); border-radius: 6px; padding: 3px 8px; font: 11.5px 'Cascadia Code', Consolas, monospace; cursor: pointer; overflow-wrap: anywhere; text-align: start; }
.nl-gcmd button:hover { border-color: var(--nl-acc); }

/* Terminal */
.nl-term { background: #050a17; border: 1px solid var(--nl-line); border-radius: 10px; display: flex; flex-direction: column; min-height: 260px; }
.nl-term pre { flex: 1; margin: 0; padding: 10px; height: 300px; overflow: auto; color: #b3e0ff; font: 12px/1.45 'Cascadia Code', Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.nl-term form { display: flex; align-items: center; gap: 6px; border-top: 1px solid #1e293b; padding: 7px 10px; }
.nl-term form span { color: #34d399; font: 12px 'Cascadia Code', Consolas, monospace; white-space: nowrap; }
.nl-term input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: #e2e8f0; font: 12px 'Cascadia Code', Consolas, monospace; }
.nl-keys { display: none; gap: 4px; padding: 0 8px 8px; }
.nl-keys button { flex: 1; background: #0f172a; color: #b3e0ff; border: 1px solid #1e293b; border-radius: 7px; padding: 8px 0; font: 600 13px system-ui, sans-serif; }

/* Event log */
.nl-events { margin-top: 10px; background: var(--nl-card); border: 1px solid var(--nl-line); border-radius: 14px; padding: 10px 12px; }
.nl-evhead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--nl-text); font-size: 13px; }
.nl-evhead .nl-dim { font-size: 12px; color: var(--nl-muted); flex: 1; min-width: 180px; }
.nl-evctl { display: flex; gap: 4px; }
.nl-evctl button, .nl-evctl select { background: var(--nl-input); color: var(--nl-text); border: 1px solid var(--nl-line); border-radius: 7px; padding: 5px 9px; font: 600 12px system-ui, sans-serif; cursor: pointer; min-height: 32px; }
.nl-runs { display: grid; gap: 6px; margin-top: 8px; max-height: 340px; overflow: auto; }
.nl-runs:empty { display: none; }
.nl-run { border: 1px solid var(--nl-line); border-radius: 10px; background: var(--nl-input); }
.nl-run summary { cursor: pointer; padding: 7px 10px; font: 600 12.5px system-ui, sans-serif; color: var(--nl-text); }
.nl-run summary small { color: var(--nl-muted); font-weight: 400; }
.nl-run.ok summary span { color: #34d399; } .nl-run.fail summary span { color: #f87171; }
.nl-run ol { list-style: none; margin: 0; padding: 0 6px 6px; display: grid; gap: 3px; }
.nl-run li { font: 12px/1.45 system-ui, sans-serif; color: var(--nl-text); padding: 5px 7px; border-radius: 7px; cursor: pointer; }
.nl-run li:hover, .nl-run li.cur { background: rgba(56, 189, 248, .1); }
.nl-tag { display: inline-block; min-width: 44px; text-align: center; font: 700 10px system-ui, sans-serif; border-radius: 5px; padding: 1px 4px; margin-inline-end: 4px; background: #334155; color: #e2e8f0; }
.t-ICMP .nl-tag, .t-ICMPv6 .nl-tag { background: #0369a1; } .t-ARP .nl-tag, .t-NDP .nl-tag { background: #a16207; } .t-DHCP .nl-tag { background: #047857; }
.t-DNS .nl-tag { background: #6d28d9; } .t-NAT .nl-tag { background: #be185d; } .t-ACL .nl-tag { background: #4d7c0f; } .t-DROP .nl-tag { background: #b91c1c; }
.t-DROP { color: #fca5a5 !important; }
.nl-pdu { display: none; margin-top: 4px; font: 11px/1.5 'Cascadia Code', Consolas, monospace; color: var(--nl-muted); }
.nl-run li.cur .nl-pdu { display: block; }

/* Context menu */
.nl-menu { position: fixed; z-index: 95; min-width: 220px; max-width: min(320px, calc(100vw - 12px)); max-height: min(70vh, 520px); overflow: auto; background: var(--card-bg, #131f3b); border: 1px solid var(--border, #1e293b); border-radius: 12px; padding: 5px; box-shadow: 0 16px 40px rgba(0, 0, 0, .45); display: grid; }
.nl-menu button { background: none; border: 0; text-align: start; color: var(--text, #e2e8f0); padding: 9px 11px; border-radius: 8px; font: 13px system-ui, sans-serif; cursor: pointer; }
.nl-menu button small, .nl-mhead small { color: var(--muted, #94a3b8); font-size: 11.5px; }
.nl-menu button:hover:not([disabled]), .nl-menu button:focus { background: rgba(56, 189, 248, .12); color: var(--accent, #38bdf8); outline: none; }
.nl-menu button[disabled] { opacity: .4; cursor: not-allowed; }
.nl-menu button.danger { color: #f87171; }
.nl-mhead { padding: 7px 11px 5px; color: var(--text, #e2e8f0); font: 13px system-ui, sans-serif; border-bottom: 1px solid var(--border, #1e293b); margin-bottom: 3px; }
.nl-menu hr { border: 0; border-top: 1px solid var(--border, #1e293b); margin: 4px 0; }

/* Focus mode (full screen) */
#netlab.nl-focus { position: fixed; inset: 0; z-index: 70; background: var(--dark-bg, #0a1226); padding: 10px; overflow: auto; }
#netlab.nl-focus .nl-canvas { aspect-ratio: auto; height: calc(100vh - 150px); }
html.nl-noscroll { overflow: hidden; }

/* Light theme */
html[data-theme="light"] #netlab { --nl-bg: #f8fafc; }
html[data-theme="light"] .nl-dev .nl-body, html[data-theme="light"] .nl-ico .nl-body { fill: #fff; }
html[data-theme="light"] .nl-runit { fill: #f1f5f9; }
html[data-theme="light"] .nl-rport { fill: #e2e8f0; stroke: #94a3b8; }
html[data-theme="light"] .nl-menu { box-shadow: 0 16px 40px rgba(15, 23, 42, .18); }
html[data-theme="light"] .nl-gcmd code { color: #0369a1; }

/* Layout by the lab's own width (the page column can be narrower than the screen). */
@container netlab (max-width: 1099px) {
    .nl-main { grid-template-columns: minmax(0, 1fr) 330px; }
    .nl-palette { grid-column: 1 / -1; display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 6px; scrollbar-width: thin; }
    .nl-pgroup { display: flex; gap: 2px; align-items: center; }
    .nl-pgroup .nl-ph { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 9px; margin: 0 2px; }
    .nl-palette button { min-width: 64px; padding: 4px 2px; }
    .nl-panel { max-height: 720px; overflow-y: auto; }
}
@container netlab (max-width: 759px) {
    .nl-toolbar { gap: 6px; }
    .nl-group { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .nl-toolbar button, .nl-toolbar select { flex: 0 0 auto; min-height: 40px; font-size: 13px; }
    .nl-main { grid-template-columns: 1fr; }
    .nl-panel { max-height: none; overflow: hidden; }
    .nl-canvas { aspect-ratio: 4 / 3; }
    .nl-zoom button { width: 40px; height: 40px; }
    .nl-form, .nl-form2 { grid-template-columns: 1fr; }
    .nl-term pre { height: 240px; }
    .nl-keys { display: flex; }
    .nl-stats { grid-template-columns: repeat(3, 1fr); }
    .nl-ends { grid-template-columns: 1fr; } .nl-arrow { text-align: center; transform: rotate(90deg); }
    .nl-btnrow button, .nl-actions button { min-height: 40px; }
    #netlab.nl-focus .nl-canvas { height: calc(100vh - 230px); }
}
@container netlab (max-width: 480px) { .nl-canvas { aspect-ratio: 4 / 5; } }
/* Touch screens: larger targets, 16px inputs (no iOS zoom), terminal key row. */
@media (hover: none), (max-width: 700px) {
    .nl-keys { display: flex; }
    .nl-form input, .nl-form select, .nl-config input, .nl-config select, .nl-gsearch, .nl-term input, .nl-panel h3 select { font-size: 16px; }
    .nl-menu button { padding: 12px 14px; font-size: 15px; }
    .nl-tabs button { padding: 10px 12px; }
}
#netlab.nl-focus { container-type: normal; }
#netlab.nl-focus .nl-main { grid-template-columns: 96px minmax(0, 1fr) 360px; }
@media (max-width: 1000px) { #netlab.nl-focus .nl-main { grid-template-columns: 1fr; } }
/* Collapsible status, notes/zones, area select, hover card, search */
.nl-stline { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.nl-stline span { flex: 1; min-width: 0; }
.nl-sttog { background: none; border: 1px solid var(--nl-line); color: var(--nl-acc); border-radius: 999px; padding: 2px 10px; font: 600 11.5px system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.nl-sttog:hover { border-color: var(--nl-acc); }
.nl-stbody { white-space: pre-wrap; margin-top: 4px; }
.nl-stbody[hidden], .nl-stline span[hidden] { display: none; }
.nl-toolbar button:disabled { opacity: .35; cursor: default; }
.nl-zone, .nl-note-g { cursor: move; }
.nl-note-g .nl-notetxt { color: var(--nl-text); fill: var(--nl-text); }
.nl-zone.sel rect:first-child, .nl-note-g.sel rect:first-child { stroke-width: 3; }
.nl-resize { fill: var(--nl-acc); stroke: var(--nl-bg); stroke-width: 2; cursor: nwse-resize; }
.nl-box { fill: rgba(56, 189, 248, .1); stroke: var(--nl-acc); stroke-width: 1.5; stroke-dasharray: 5 4; pointer-events: none; }
.nl-tip { position: fixed; z-index: 96; pointer-events: none; max-width: 280px; background: var(--card-bg, #131f3b); border: 1px solid var(--border, #1e293b); border-radius: 10px; padding: 8px 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); font: 12px/1.5 system-ui, sans-serif; color: var(--text, #e2e8f0); display: grid; gap: 1px; }
.nl-tip small { color: var(--muted, #94a3b8); }
.nl-tip div { display: flex; align-items: center; gap: 6px; font-family: 'Cascadia Code', Consolas, monospace; font-size: 11.5px; }
.nl-tipwarn { color: #fbbf24; font-family: system-ui, sans-serif !important; }
.nl-search { position: absolute; top: 8px; left: 8px; width: min(280px, calc(100% - 70px)); z-index: 5; background: var(--nl-card); border: 1px solid var(--nl-acc); border-radius: 10px; padding: 6px; box-shadow: 0 10px 26px rgba(0, 0, 0, .35); }
.nl-search input { width: 100%; background: var(--nl-input); border: 1px solid var(--nl-line); color: var(--nl-text); border-radius: 7px; padding: 7px 9px; font: 13px system-ui, sans-serif; }
.nl-sres { display: grid; margin-top: 4px; }
.nl-sres button { background: none; border: 0; text-align: start; color: var(--nl-text); padding: 7px 8px; border-radius: 7px; cursor: pointer; font: 13px system-ui, sans-serif; }
.nl-sres button:hover { background: rgba(56, 189, 248, .12); }
.nl-sres small { color: var(--nl-muted); }
.nl-sres p { font-size: 12px; padding: 6px 8px; margin: 0; }
.nl-zoom { max-height: calc(100% - 16px); overflow-y: auto; scrollbar-width: none; }
@container netlab (max-width: 759px) { .nl-zoom { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; max-width: 60%; } }

/* Coach (guided steps), explain, quiz */
.nl-coach { background: var(--nl-card); border: 1px solid var(--nl-line); border-inline-start: 4px solid #c084fc; border-radius: 12px; padding: 0 12px 10px; margin-bottom: 10px; overflow: hidden; }
.nl-coach[hidden] { display: none; }
.nl-coachbar { height: 4px; background: var(--nl-input); margin: 0 -12px 8px; }
.nl-coachbar span { display: block; height: 100%; background: linear-gradient(90deg, #c084fc, #38bdf8); transition: width .4s; }
.nl-coachrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--nl-text); font-size: 13.5px; }
.nl-coachrow b { color: #c084fc; white-space: nowrap; }
.nl-coachrow span { flex: 1; min-width: 200px; }
.nl-coachrow button { background: var(--nl-input); color: var(--nl-acc); border: 1px solid var(--nl-line); border-radius: 8px; padding: 6px 10px; font: 600 12px system-ui, sans-serif; cursor: pointer; min-height: 32px; }
.nl-hintbox { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(251, 191, 36, .1); color: #fbbf24; font: 12.5px/1.5 'Cascadia Code', Consolas, monospace; white-space: pre-wrap; }
.nl-hintbox[hidden], .nl-steplist[hidden], .nl-expl[hidden] { display: none; }
.nl-steplist { margin: 8px 0 0; padding-inline-start: 4px; list-style: none; display: grid; gap: 3px; font-size: 12.5px; color: var(--nl-muted); }
.nl-steplist li.ok { color: #34d399; } .nl-steplist li.cur { color: var(--nl-text); font-weight: 600; }
.nl-explain { float: right; background: none; border: 1px solid var(--nl-line); color: #fbbf24; border-radius: 999px; padding: 1px 9px; font: 600 11px system-ui, sans-serif; cursor: pointer; }
.nl-expl { margin: 0 8px 8px; padding: 10px 12px; border-radius: 8px; background: rgba(251, 191, 36, .07); border: 1px solid rgba(251, 191, 36, .25); color: var(--nl-text); font: 13px/1.6 system-ui, sans-serif; white-space: pre-wrap; }
.nl-qq { color: var(--nl-text) !important; font-size: 15px !important; font-weight: 600; }
.nl-quizform { display: flex; gap: 6px; flex-wrap: wrap; }
.nl-quizform input { flex: 1; min-width: 150px; background: var(--nl-input); border: 1px solid var(--nl-line); color: var(--nl-text); border-radius: 8px; padding: 9px 10px; font: 14px 'Cascadia Code', Consolas, monospace; }
.nl-quizform button { background: var(--nl-input); color: var(--nl-acc); border: 1px solid var(--nl-line); border-radius: 8px; padding: 8px 14px; font: 600 13px system-ui, sans-serif; cursor: pointer; }
.nl-quizform button[type="submit"] { background: var(--nl-acc); color: #062033; border-color: transparent; }
.nl-qres.ok { color: #34d399 !important; } .nl-qres.err { color: #f87171 !important; }
@media (hover: none), (max-width: 700px) { .nl-quizform input { font-size: 16px; } }

/* Batch 3: STP / EtherChannel visuals, cloud icon */
.nl-led.blk { fill: #f59e0b; stroke: #78350f; stroke-width: 1.5; }
.nl-wire.stpblk { stroke-dasharray: 3 6; opacity: .65; }
.nl-wire.chan { stroke-width: 5; }

/* Accessibility */
.nl-dev:focus { outline: none; }
.nl-dev:focus-visible .nl-body { stroke-width: 4.5; stroke-dasharray: 4 3; filter: drop-shadow(0 0 6px var(--nl-acc)); }
@media (prefers-reduced-motion: reduce) { .nl-coachbar span, .nl-dev .nl-body { transition: none; } }

/* Keep the terminal a fixed, scrollable size; no nested panel scrolling */
.nl-term { flex: none; min-height: 0; }
.nl-term pre { flex: none; height: 320px; max-height: 55vh; }
@container netlab (max-width: 1099px) { .nl-panel { max-height: none; overflow: hidden; } }
@container netlab (max-width: 759px) { .nl-term pre { height: 240px; } }

/* One continuous console, like a real terminal */
.nl-term pre { padding-bottom: 0; }
.nl-term form { border-top: 0; padding: 0 10px 8px; gap: 0; }
.nl-term form span { white-space: pre; }
.nl-term input { caret-color: #34d399; padding: 0; }
.nl-term input[type="password"] { color: transparent; text-shadow: none; }

/* Focus (full screen) mode */
#netlab.nl-focus { position: fixed; inset: 0; z-index: 9999; margin: 0; max-width: none; width: 100vw; height: 100dvh; overflow: auto; padding: 10px; background: var(--dark-bg, #0a1226); container-type: inline-size; }
#netlab.nl-focus .nl-main { grid-template-columns: 96px minmax(0, 1fr) 360px; }
#netlab.nl-focus .nl-canvas { aspect-ratio: auto; height: calc(100dvh - 190px); min-height: 320px; }
@container netlab (max-width: 1099px) { #netlab.nl-focus .nl-main { grid-template-columns: minmax(0, 1fr) 330px; } }
@container netlab (max-width: 759px) { #netlab.nl-focus .nl-main { grid-template-columns: 1fr; } #netlab.nl-focus .nl-canvas { height: 60dvh; } }
#netlab.nl-focus [data-z="focus"] { border-color: var(--nl-acc); color: var(--nl-acc); }

/* Menus, hover cards and drag ghosts must sit above focus mode (z-index 9999) */
.nl-menu { z-index: 10050; }
.nl-tip { z-index: 10060; }
.nl-ghost { z-index: 10070; }

/* Resizable layout: side panel width, workspace height, console height */
.nl-hsplit, .nl-vsplit { position: absolute; z-index: 4; touch-action: none; }
.nl-hsplit { top: 0; bottom: 0; right: -10px; width: 10px; cursor: col-resize; }
.nl-vsplit { left: 0; right: 0; bottom: -10px; height: 10px; cursor: row-resize; }
.nl-hsplit::after, .nl-vsplit::after { content: ""; position: absolute; border-radius: 3px; background: var(--nl-line); transition: background .15s; }
.nl-hsplit::after { top: 50%; left: 3px; width: 4px; height: 46px; transform: translateY(-50%); }
.nl-vsplit::after { left: 50%; top: 3px; height: 4px; width: 46px; transform: translateX(-50%); }
.nl-hsplit:hover::after, .nl-vsplit:hover::after, .nl-hsplit.on::after, .nl-vsplit.on::after, .nl-hsplit:focus-visible::after, .nl-vsplit:focus-visible::after { background: var(--nl-acc); }
.nl-stage { margin-bottom: 6px; }
html.nl-resizing, html.nl-resizing * { user-select: none !important; cursor: inherit; }
#netlab.nl-pw-set .nl-main { grid-template-columns: 96px minmax(0, 1fr) var(--nl-pw); }
#netlab.nl-ch-set .nl-canvas { aspect-ratio: auto; height: var(--nl-ch); }
.nl-tgrip { height: 9px; cursor: row-resize; touch-action: none; position: relative; flex: none; }
.nl-tgrip::after { content: ""; position: absolute; left: 50%; top: 3px; width: 40px; height: 3px; border-radius: 3px; background: #1e293b; transform: translateX(-50%); }
.nl-tgrip:hover::after, .nl-tgrip.on::after { background: var(--nl-acc); }
#netlab.nl-th-set .nl-term pre { height: var(--nl-th); max-height: none; }
@container netlab (max-width: 1099px) {
    #netlab.nl-pw-set .nl-main { grid-template-columns: minmax(0, 1fr) var(--nl-pw); }
}
@container netlab (max-width: 759px) {
    .nl-hsplit { display: none; }
    #netlab.nl-pw-set .nl-main { grid-template-columns: 1fr; }
}
#netlab.nl-focus.nl-pw-set .nl-main { grid-template-columns: 96px minmax(0, 1fr) var(--nl-pw); }
#netlab.nl-focus.nl-ch-set .nl-canvas { height: var(--nl-ch); }

/* Console input: no box, only the blinking cursor */
#netlab .nl-term input, #netlab .nl-term input:focus, #netlab .nl-term input:focus-visible { outline: none; border: 0; box-shadow: none; background: transparent; }

/* Accessibility: readable dim text */
.nl-dim { opacity: 1; color: var(--nl-muted); }
