:root {
  color-scheme: dark;
  --bg: #07101d;
  --bg-deep: #040a13;
  --surface: #0d1928;
  --surface-2: #122135;
  --surface-3: #172a42;
  --line: #24364d;
  --line-soft: #1b2b40;
  --text: #edf5ff;
  --muted: #91a2b8;
  --muted-2: #65778f;
  --green: #31d8b5;
  --green-dark: #1eaa91;
  --blue: #5d84ff;
  --amber: #ffbe55;
  --red: #ff657a;
  --radius: 14px;
  --shadow: 0 18px 55px rgb(0 0 0 / 28%);
  --header-h: 64px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg-deep); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 88% -12%, rgb(49 216 181 / 10%), transparent 34rem),
    radial-gradient(circle at -10% 55%, rgb(93 132 255 / 9%), transparent 35rem),
    var(--bg);
}

button, input, select, textarea { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  height: var(--header-h);
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgb(64 88 117 / 44%);
  background: rgb(7 16 29 / 90%);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: max-content;
  text-decoration: none;
  font-size: 17px;
  letter-spacing: -.02em;
}

.brand strong { color: var(--green); }
.brand small {
  display: block;
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.brand-mark {
  width: 35px;
  height: 35px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 7px;
  border: 1px solid rgb(49 216 181 / 32%);
  border-radius: 10px;
  background: linear-gradient(145deg, rgb(49 216 181 / 15%), rgb(93 132 255 / 9%));
  box-shadow: inset 0 1px rgb(255 255 255 / 5%);
}

.brand-mark span {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--green);
}
.brand-mark span:nth-child(2) { width: 72%; }
.brand-mark span:nth-child(3) { width: 45%; }

.top-actions { display: flex; align-items: center; gap: 8px; }
.save-status { margin-right: 5px; color: var(--muted-2); font-size: 11px; white-space: nowrap; }

.workflow {
  position: sticky;
  z-index: 35;
  top: var(--header-h);
  display: flex;
  justify-content: center;
  gap: 0;
  border-bottom: 1px solid var(--line-soft);
  background: rgb(8 18 32 / 93%);
  backdrop-filter: blur(16px);
}

.workflow-step {
  position: relative;
  min-width: 180px;
  padding: 14px 26px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  text-align: left;
}

.workflow-step:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  width: 1px;
  height: 25px;
  background: var(--line-soft);
}

.workflow-step.active { color: var(--text); }
.workflow-step.active::before {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 0;
  left: 18px;
  height: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--green);
  box-shadow: 0 0 16px rgb(49 216 181 / 45%);
}
.workflow-step.done .step-number { background: rgb(49 216 181 / 14%); color: var(--green); border-color: rgb(49 216 181 / 28%); }
.workflow-step:hover { background: rgb(255 255 255 / 2%); color: var(--text); }

.step-number {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.active .step-number { border-color: var(--green); color: #051610; background: var(--green); }
.step-copy strong { display: block; font-size: 11px; letter-spacing: .03em; }
.step-copy small { display: block; margin-top: 1px; color: var(--muted-2); font-size: 9px; }

main { flex: 1; min-height: 610px; }

.workspace {
  min-height: calc(100vh - 164px);
  display: grid;
  grid-template-columns: 265px minmax(500px, 1fr) 330px;
}

.sidebar {
  min-height: 0;
  padding: 18px;
  background: rgb(10 20 34 / 72%);
}
.sidebar.left { border-right: 1px solid var(--line-soft); }
.sidebar.right { border-left: 1px solid var(--line-soft); }

.sidebar-head, .panel-head, .page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(23px, 2.5vw, 34px); letter-spacing: -.035em; }
h2 { margin-bottom: 4px; font-size: 16px; letter-spacing: -.015em; }
h3 { margin-bottom: 7px; font-size: 12px; }
.subtle { margin-bottom: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.search-box { position: relative; margin: 14px 0 12px; }
.search-box::before {
  content: "⌕";
  position: absolute;
  top: 50%;
  left: 11px;
  transform: translateY(-54%);
  color: var(--muted-2);
  font-size: 17px;
}
.search-box input { padding-left: 34px; }

input, select, textarea {
  width: 100%;
  min-height: 37px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a1523;
  color: var(--text);
  box-shadow: inset 0 1px rgb(0 0 0 / 18%);
}
input, select { padding: 0 10px; }
textarea { min-height: 92px; padding: 10px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #56677d; }
input:focus, select:focus, textarea:focus { border-color: rgb(49 216 181 / 65%); outline: none; box-shadow: 0 0 0 3px rgb(49 216 181 / 8%); }

label { display: block; }
.field-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 700; }
.field { margin-bottom: 13px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.help { display: block; margin-top: 5px; color: var(--muted-2); font-size: 9px; line-height: 1.4; }

.catalog-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 12px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #07111e;
}
.catalog-tab {
  padding: 7px 3px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 800;
}
.catalog-tab.active { background: var(--surface-3); color: var(--text); }

.catalog-list { display: grid; gap: 8px; max-height: calc(100vh - 300px); overflow: auto; padding-right: 3px; }
.catalog-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 74px 1fr;
  min-height: 78px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  transition: .16s ease;
}
.catalog-card:hover { transform: translateY(-1px); border-color: rgb(49 216 181 / 42%); background: var(--surface-2); }
.catalog-image { position: relative; display: grid; place-items: center; padding: 9px; background: #dce4e8; }
.catalog-image img { display: block; max-width: 100%; max-height: 55px; object-fit: contain; mix-blend-mode: multiply; }
.catalog-image .image-fallback { display: none; color: #496071; font-size: 9px; font-weight: 900; text-align: center; }
.catalog-copy { padding: 11px 9px; min-width: 0; }
.catalog-copy strong { display: block; overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.catalog-copy span { display: block; margin-top: 4px; color: var(--muted-2); font-size: 8px; line-height: 1.35; }
.vendor-dot { width: 6px; height: 6px; display: inline-block; margin-right: 4px; border-radius: 50%; background: var(--blue); }

.canvas-wrap { min-width: 0; padding: 18px; }
.canvas-toolbar { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.canvas-toolbar h1 { font-size: 19px; margin: 0; }
.toolbar-actions { display: flex; align-items: center; gap: 6px; }

.canvas {
  position: relative;
  min-height: 610px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: #091525;
  background-image:
    linear-gradient(rgb(63 91 120 / 10%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(63 91 120 / 10%) 1px, transparent 1px),
    radial-gradient(circle at 55% 40%, rgb(31 59 84 / 19%), transparent 31rem);
  background-size: 24px 24px, 24px 24px, auto;
  box-shadow: inset 0 0 70px rgb(0 0 0 / 22%);
}

.canvas-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}
.canvas-empty-icon { width: 62px; height: 62px; display: grid; place-items: center; margin-bottom: 16px; border: 1px dashed var(--line); border-radius: 18px; color: var(--green); font-size: 28px; }

.connections { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.connection-shadow { stroke: rgb(0 0 0 / 62%); stroke-width: 6; }
.connection-line { stroke: #5d84ff; stroke-width: 2; stroke-dasharray: 7 4; filter: drop-shadow(0 0 5px rgb(93 132 255 / 50%)); }
.connection-label { fill: #b9c8dd; font-size: 9px; text-anchor: middle; paint-order: stroke; stroke: #091525; stroke-width: 4px; stroke-linejoin: round; }

.device-node {
  position: absolute;
  z-index: 2;
  width: 198px;
  min-height: 92px;
  padding: 10px;
  border: 1px solid #294059;
  border-radius: 11px;
  background: linear-gradient(155deg, #14263b, #0c1928);
  box-shadow: 0 12px 25px rgb(0 0 0 / 30%);
  user-select: none;
  touch-action: none;
  transition: border-color .15s, box-shadow .15s;
}
.device-node:hover { border-color: #3e5873; }
.device-node.selected { border-color: var(--green); box-shadow: 0 0 0 2px rgb(49 216 181 / 12%), 0 18px 30px rgb(0 0 0 / 33%); }
.device-node.dragging { cursor: grabbing; opacity: .95; transition: none; }
.device-top { display: flex; gap: 9px; align-items: center; }
.device-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 8px; background: #dfe7eb; overflow: hidden; }
.device-icon img { max-width: 34px; max-height: 31px; object-fit: contain; mix-blend-mode: multiply; }
.device-icon .image-fallback { display: none; color: #345; font-size: 8px; font-weight: 900; }
.device-title { min-width: 0; }
.device-title strong { display: block; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.device-title span { display: block; margin-top: 3px; color: var(--muted-2); font-size: 8px; }
.node-role { margin-left: auto; align-self: flex-start; padding: 3px 6px; border: 1px solid rgb(49 216 181 / 20%); border-radius: 10px; background: rgb(49 216 181 / 7%); color: var(--green); font-size: 7px; font-weight: 800; text-transform: uppercase; }
.node-stats { display: flex; gap: 5px; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.node-stat { padding: 3px 6px; border-radius: 4px; background: rgb(255 255 255 / 3%); color: var(--muted); font-size: 8px; }
.node-stat b { color: var(--text); }
.node-warning { margin-left: auto; color: var(--amber); }

.canvas-legend {
  position: absolute;
  z-index: 4;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 12px;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgb(6 15 26 / 86%);
  color: var(--muted-2);
  font-size: 8px;
  backdrop-filter: blur(8px);
}
.legend-line { width: 18px; display: inline-block; margin: 0 5px 2px 0; border-top: 2px dashed var(--blue); }

.inspector-empty { min-height: 420px; display: grid; place-content: center; justify-items: center; color: var(--muted-2); text-align: center; }
.inspector-empty span { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 12px; border: 1px dashed var(--line); border-radius: 15px; font-size: 22px; }
.inspector-device { display: flex; gap: 11px; align-items: center; margin: 14px 0; padding: 10px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface); }
.inspector-device img { width: 60px; height: 44px; padding: 4px; border-radius: 6px; background: #dfe5e9; object-fit: contain; }
.inspector-device .device-icon { width: 68px; height: 50px; }
.inspector-device .device-icon img { max-width: 62px; max-height: 44px; }
.inspector-device strong { display: block; font-size: 11px; }
.inspector-device span { display: block; margin-top: 3px; color: var(--muted-2); font-size: 8px; }
.section-divider { height: 1px; margin: 17px 0; background: var(--line-soft); }
.summary-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0 14px; }
.chip { display: inline-flex; align-items: center; gap: 5px; min-height: 25px; padding: 4px 8px; border: 1px solid var(--line-soft); border-radius: 14px; background: rgb(255 255 255 / 2%); color: var(--muted); font-size: 8px; }
.chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }
.chip.green i { background: var(--green); }
.chip.blue i { background: var(--blue); }
.chip.amber i { background: var(--amber); }

.btn {
  min-height: 37px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 10px;
  font-weight: 750;
  transition: .15s ease;
}
.btn:hover { transform: translateY(-1px); border-color: #3b536e; background: var(--surface-3); }
.btn.primary { border-color: var(--green-dark); background: linear-gradient(135deg, #32d8b6, #29bd9f); color: #04130f; box-shadow: 0 8px 22px rgb(49 216 181 / 12%); }
.btn.primary:hover { background: #48e2c1; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgb(255 101 122 / 28%); background: rgb(255 101 122 / 7%); color: #ff8797; }
.btn.warning { border-color: rgb(255 190 85 / 30%); background: rgb(255 190 85 / 8%); color: var(--amber); }
.btn.compact { min-height: 32px; padding: 0 11px; font-size: 9px; }
.btn.icon { width: 34px; padding: 0; font-size: 15px; }
.btn.full { width: 100%; }
.btn:disabled { cursor: not-allowed; opacity: .42; transform: none; }
.link-button { padding: 2px; border: 0; background: none; color: var(--green); font-size: 10px; }
.link-button:hover { text-decoration: underline; }

.page { width: min(1320px, calc(100% - 44px)); margin: 0 auto; padding: 28px 0 42px; }
.page-head { align-items: flex-end; margin-bottom: 20px; }
.page-head-copy { max-width: 710px; }
.page-head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.stats-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.stat-card { padding: 13px 15px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgb(13 25 40 / 75%); }
.stat-card small { display: block; color: var(--muted-2); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.stat-card strong { display: block; margin-top: 5px; font-size: 19px; }
.stat-card strong.green { color: var(--green); }
.stat-card strong.amber { color: var(--amber); }
.stat-card strong.red { color: var(--red); }

.panel { border: 1px solid var(--line-soft); border-radius: var(--radius); background: rgb(13 25 40 / 74%); box-shadow: 0 9px 30px rgb(0 0 0 / 13%); }
.panel-head { padding: 15px 17px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2 { margin: 0; font-size: 13px; }
.panel-body { padding: 17px; }
.panel + .panel { margin-top: 14px; }

.vlan-grid { display: grid; gap: 9px; }
.vlan-row {
  display: grid;
  grid-template-columns: 68px minmax(120px, 1.05fr) minmax(125px, .95fr) minmax(125px, .95fr) minmax(150px, 1.2fr) 76px 38px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #0a1625;
}
.vlan-color { display: flex; align-items: center; gap: 7px; }
.color-input { width: 28px; min-height: 28px; padding: 2px; border-radius: 6px; }
.vlan-id { font-weight: 800; }
.vlan-actions { text-align: right; }
.add-row { align-items: end; }
.vlan-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.vlan-tag { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid var(--line-soft); border-radius: 17px; background: #0a1624; font-size: 9px; }
.vlan-tag i { width: 8px; height: 8px; border-radius: 50%; }

.matrix-wrap { overflow: auto; }
.matrix { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 900px; font-size: 9px; }
.matrix th, .matrix td { padding: 9px 8px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); text-align: center; white-space: nowrap; }
.matrix th { position: sticky; z-index: 2; top: 0; background: #102034; color: var(--muted); font-weight: 800; }
.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; z-index: 3; min-width: 180px; background: #0f1d2f; text-align: left; }
.matrix thead th:first-child { z-index: 4; background: #13243a; }
.matrix tbody tr:hover td { background-color: rgb(49 216 181 / 3%); }
.matrix tbody tr:hover td:first-child { background: #122339; }
.matrix-device-row td { border-top: 7px solid var(--bg); background: #102034; font-weight: 800; }
.matrix-device-row td:first-child { background: #13243a; color: var(--text); }
.matrix-port small { display: block; margin-top: 3px; color: var(--muted-2); font-size: 7px; }
.matrix-cell { min-width: 52px; }
.mode-pill { min-width: 25px; display: inline-block; padding: 3px 6px; border: 0; border-radius: 9px; font-size: 7px; font-weight: 900; }
.mode-pill.tagged { background: rgb(93 132 255 / 14%); color: #91aaff; }
.mode-pill.untagged { background: rgb(49 216 181 / 13%); color: var(--green); }
.mode-pill.native { background: rgb(255 190 85 / 12%); color: var(--amber); }
.mode-pill.none { color: #485970; }

.port-filter { display: flex; gap: 6px; align-items: center; }
.port-filter select { width: auto; min-width: 180px; }
.port-editor { display: grid; gap: 9px; }
.port-row {
  display: grid;
  grid-template-columns: 95px minmax(135px, 1.2fr) 110px 130px minmax(155px, 1.4fr) 76px;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #0a1625;
}
.port-name { display: flex; align-items: center; gap: 7px; font-size: 9px; font-weight: 800; }
.port-led { width: 7px; height: 7px; border-radius: 50%; background: #4f6076; }
.port-led.on { background: var(--green); box-shadow: 0 0 8px rgb(49 216 181 / 50%); }
.port-vlans { display: flex; flex-wrap: wrap; gap: 4px; }
.vlan-toggle { min-width: 29px; padding: 4px 5px; border: 1px solid var(--line); border-radius: 5px; background: transparent; color: var(--muted-2); font-size: 7px; font-weight: 800; }
.vlan-toggle.on { border-color: rgb(93 132 255 / 42%); background: rgb(93 132 255 / 12%); color: #a8b9ff; }
.port-note { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }

.audit-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); gap: 15px; align-items: start; }
.audit-list { display: grid; gap: 8px; }
.audit-item { display: grid; grid-template-columns: 31px 1fr auto; gap: 10px; align-items: start; padding: 11px; border: 1px solid var(--line-soft); border-radius: 9px; background: #0a1625; }
.audit-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; font-size: 14px; font-weight: 900; }
.audit-item.error .audit-icon { background: rgb(255 101 122 / 11%); color: var(--red); }
.audit-item.warning .audit-icon { background: rgb(255 190 85 / 11%); color: var(--amber); }
.audit-item.info .audit-icon { background: rgb(93 132 255 / 11%); color: var(--blue); }
.audit-item.success .audit-icon { background: rgb(49 216 181 / 11%); color: var(--green); }
.audit-copy strong { display: block; margin-bottom: 4px; font-size: 10px; }
.audit-copy span { color: var(--muted); font-size: 8px; line-height: 1.5; }
.severity { padding: 3px 6px; border-radius: 9px; color: var(--muted-2); background: rgb(255 255 255 / 3%); font-size: 7px; font-weight: 800; text-transform: uppercase; }

.config-device-tabs { display: flex; gap: 6px; overflow: auto; margin-bottom: 12px; padding-bottom: 3px; }
.config-tab { min-width: max-content; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 7px; background: transparent; color: var(--muted); font-size: 8px; font-weight: 800; }
.config-tab.active { border-color: rgb(49 216 181 / 36%); background: rgb(49 216 181 / 8%); color: var(--green); }
.config-code { position: relative; min-height: 440px; overflow: auto; margin: 0; padding: 15px; border: 1px solid #1c3047; border-radius: 9px; background: #050c15; color: #b9c9dc; font: 9px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; tab-size: 2; }
.config-actions { display: flex; gap: 7px; margin-top: 10px; }
.notice { padding: 10px 12px; border: 1px solid rgb(255 190 85 / 25%); border-radius: 8px; background: rgb(255 190 85 / 6%); color: #cdb17d; font-size: 8px; line-height: 1.55; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgb(2 7 13 / 78%); backdrop-filter: blur(7px); }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; border: 1px solid #2a4058; border-radius: 15px; background: #0c1929; box-shadow: var(--shadow); }
.modal-head { padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { margin: 0; font-size: 14px; }
.modal-body { padding: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 7px; padding: 13px 18px; border-top: 1px solid var(--line-soft); }
.close-button { width: 31px; height: 31px; border: 0; border-radius: 7px; background: rgb(255 255 255 / 3%); color: var(--muted); }

.toast-region { position: fixed; z-index: 120; right: 18px; bottom: 18px; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 250px; max-width: 390px; padding: 11px 13px; border: 1px solid #29425b; border-radius: 9px; background: #102035; color: var(--text); box-shadow: var(--shadow); font-size: 9px; animation: toast-in .2s ease-out; }
.toast.success { border-color: rgb(49 216 181 / 40%); }
.toast.error { border-color: rgb(255 101 122 / 44%); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.footer { min-height: 43px; padding: 10px 25px; display: flex; justify-content: space-between; align-items: center; gap: 18px; border-top: 1px solid var(--line-soft); color: var(--muted-2); font-size: 9px; }
.noscript { position: fixed; z-index: 200; inset: 0; display: grid; place-items: center; padding: 30px; background: var(--bg); color: var(--text); }
.empty-panel { padding: 40px 20px; color: var(--muted); text-align: center; }
.hidden { display: none !important; }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 230px minmax(470px, 1fr); }
  .sidebar.right { grid-column: 1 / -1; border-top: 1px solid var(--line-soft); border-left: 0; }
  .workflow-step { min-width: 150px; padding-inline: 18px; }
  .port-row { grid-template-columns: 85px 1fr 105px 120px 1.1fr; }
  .port-row .port-actions { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  :root { --header-h: auto; }
  .topbar { position: relative; min-height: 64px; padding: 12px 16px; flex-wrap: wrap; }
  .top-actions { width: 100%; overflow: auto; padding-bottom: 2px; }
  .save-status { display: none; }
  .workflow { position: relative; top: 0; justify-content: flex-start; overflow-x: auto; }
  .workflow-step { min-width: 125px; padding: 11px 13px; }
  .step-copy small { display: none; }
  .workspace { display: block; }
  .sidebar.left { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .catalog-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 330px; }
  .canvas-wrap { padding: 12px; }
  .canvas { min-height: 560px; }
  .page { width: min(100% - 24px, 1320px); padding-top: 20px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head-actions { justify-content: flex-start; }
  .stats-strip { grid-template-columns: 1fr 1fr; }
  .vlan-row { grid-template-columns: 62px 1fr 1fr 75px 36px; }
  .vlan-row > :nth-child(4), .vlan-row > :nth-child(5) { grid-column: span 2; }
  .vlan-row > :nth-child(6) { justify-self: start; }
  .audit-layout { grid-template-columns: 1fr; }
  .footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .top-actions .btn { min-width: max-content; }
  .catalog-list { grid-template-columns: 1fr; }
  .canvas-toolbar { align-items: flex-start; flex-direction: column; }
  .canvas { min-height: 620px; }
  .device-node { width: 172px; }
  .field-row { grid-template-columns: 1fr; }
  .stats-strip { grid-template-columns: 1fr 1fr; }
  .vlan-row { grid-template-columns: 55px 1fr 36px; }
  .vlan-row > :nth-child(2), .vlan-row > :nth-child(3), .vlan-row > :nth-child(4), .vlan-row > :nth-child(5) { grid-column: 1 / -1; }
  .vlan-row > :nth-child(6) { grid-column: 1 / 3; }
  .port-row { grid-template-columns: 72px 1fr; }
  .port-row > *:not(.port-name) { grid-column: 2; }
  .audit-item { grid-template-columns: 31px 1fr; }
  .severity { grid-column: 2; justify-self: start; }
}

@media print {
  :root { color-scheme: light; }
  body { background: white; color: #15202d; }
  .topbar, .workflow, .footer, .page-head-actions, .config-actions, .btn, .link-button { display: none !important; }
  .page { width: 100%; padding: 0; }
  .panel, .stat-card, .audit-item { background: white; border-color: #ccd4dc; box-shadow: none; break-inside: avoid; }
  .config-code { color: #1c2a39; background: #f4f6f8; border-color: #ccd4dc; white-space: pre-wrap; }
  .audit-layout { display: block; }
  .audit-layout > * { margin-bottom: 15px; }
}
