/* Bytepro — centraal stylesheet */
@import url('site-nav.css');
@import url('home.css');
:root {
  --bg: #eef1f6;
  --card: #ffffff;
  --border: #cdd5e0;
  --text: #1a2332;
  --muted: #5c6b7e;
  --green: #16a34a;
  --amber: #d97706;
  --gray: #94a3b8;
  --font: 'DM Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

body.modal-open { overflow: hidden; }

.app {
  display: grid;
  grid-template-columns: minmax(300px, 320px) 1fr;
  grid-template-rows: auto 1fr;
  height: 100dvh;
  min-height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* Header */
.header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  min-height: 56px;
}

.header.site-topbar { position: relative; z-index: 55; }

.header__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header__logo,
.site-topbar__logo {
  width: 38px; height: 38px;
  background: #1d4ed8; color: #fff;
  border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.header h1, .site-topbar__title { font-size: 1.05rem; font-weight: 700; line-height: 1.2; }
.header__subtitle, .site-topbar__sub { font-size: 0.74rem; color: var(--muted); }

.header__stats { display: flex; gap: 10px; align-items: center; }

.btn--edit-toggle {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.btn--edit-toggle:hover {
  border-color: #1d4ed8;
  color: #1d4ed8;
  background: #f8fafc;
}

.btn--edit-active {
  background: #eff6ff;
  border-color: #1d4ed8;
  color: #1d4ed8;
}

.btn--save-header {
  display: none;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #1d4ed8;
  background: #1d4ed8;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: var(--font);
  color: #fff;
  transition: background 0.12s;
}

.btn--save-header:hover { background: #1e40af; }

body.edit-mode .btn--save-header { display: inline-flex; align-items: center; }

.insert-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.insert-toolbar .btn.is-active {
  border-color: #93b4f5;
  background: #eff6ff;
  color: #1d4ed8;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.sidebar-toggle { display: none; }

/* Sidebar */
.sidebar {
  padding: 14px;
  background: var(--card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  max-height: calc(100dvh - 56px);
}

.panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px;
}

.panel--highlight { border-color: var(--border); background: var(--card); }

.sidebar--diagram .panel {
  border: none;
  background: transparent;
  padding: 0 0 14px;
  box-shadow: none;
}

.sidebar--diagram .panel + .panel {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.filter-group--compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 8px;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mode-badge--view {
  background: #f1f5f9;
  color: #64748b;
}

.mode-badge--edit {
  background: #dbeafe;
  color: #1d4ed8;
}

body.edit-mode .header.site-topbar {
  background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
  border-bottom: 2px solid #3b82f6;
}

body.edit-mode .viewport {
  box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.35);
}

body.edit-mode .sidebar--diagram {
  background: #f8fafc;
}

body.view-mode .edit-only { display: none !important; }

body.view-mode .diagram-io-toolbar { display: none !important; }
.panel__title { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 6px; }
.panel__hint { font-size: 0.76rem; color: var(--muted); margin-bottom: 8px; line-height: 1.4; }

.filter-group { display: flex; flex-direction: column; gap: 5px; }

.chip {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--card);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: all 0.12s;
}

.chip:hover { border-color: #94a3b8; color: var(--text); }
.chip--active { background: #1d4ed8; border-color: #1d4ed8; color: #fff; font-weight: 600; }
.chip--flow-publiek.chip--active { background: #1d4ed8; border-color: #1d4ed8; }
.chip--flow-remote.chip--active { background: #0d9488; border-color: #0d9488; }
.chip--flow-beheer.chip--active { background: #c2410c; border-color: #c2410c; }
.chip--flow-intern.chip--active { background: #4f46e5; border-color: #4f46e5; }

.input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: var(--font);
  font-size: 0.84rem;
  background: var(--card);
}

.toggle { display: flex; gap: 8px; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; cursor: pointer; }
.toggle input { accent-color: #1d4ed8; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px;
  border-radius: 7px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
}
.btn--full { width: 100%; }
.btn--ghost { background: var(--card); border: 1px solid var(--border); color: var(--muted); }
.btn--ghost:hover { color: var(--text); }
.btn--primary { background: #1d4ed8; color: #fff; }
.btn--primary:hover { background: #1e40af; }

.legend__item { display: flex; align-items: center; gap: 8px; font-size: 0.76rem; color: var(--muted); margin-bottom: 4px; }
.legend__stripe { width: 4px; height: 14px; border-radius: 2px; }
.legend__line--dashed { width: 20px; border-top: 2px dashed var(--gray); }

.legend__hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }

/* Viewport — pan & zoom */
.viewport {
  position: relative;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  width: 100%;
  touch-action: none;
  user-select: none;
  background:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  background-color: #e8ecf2;
  cursor: grab;
}

.input--spaced { margin-top: 6px; }
.btn--spaced { margin-top: 8px; margin-bottom: 6px; }
.save-toast { color: var(--green); font-weight: 600; font-size: 0.78rem; margin-top: 8px; }

/* Zones — sleepbaar & resizable */
.diagram-zone {
  position: absolute;
  border-radius: 14px;
  border: 2px dashed;
  pointer-events: none;
  z-index: 0;
  min-width: 120px;
  min-height: 80px;
}

.diagram-zone--remote { border-color: #5eead4; background: rgba(13, 148, 136, 0.06); }
.diagram-zone--publiek { border-color: #93c5fd; background: rgba(29, 78, 216, 0.05); }
.diagram-zone--beheer { border-color: #fdba74; background: rgba(194, 65, 12, 0.05); }
.diagram-zone--intern { border-color: #a5b4fc; background: rgba(79, 70, 229, 0.05); }

.diagram-zone.is-dimmed { opacity: 0.2; }

.diagram-zone__header {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 8px 12px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 12px 12px 0 0;
  user-select: none;
  background: rgba(255,255,255,0.75);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  pointer-events: auto;
}

.diagram-zone__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: grab;
}

.diagram-zone.is-dragging .diagram-zone__title { cursor: grabbing; }

.diagram-zone__gear {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  pointer-events: auto;
}

.diagram-zone__gear svg {
  display: block;
  width: 16px;
  height: 16px;
}

.diagram-zone__gear:hover {
  border-color: #93b4f5;
  color: #1d4ed8;
  background: #f8fafc;
}

.diagram-zone__resize {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  opacity: 0.5;
  pointer-events: auto;
}

.diagram-zone__resize:hover { opacity: 1; }

body.edit-mode .diagram-zone.is-selected {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
  z-index: 1;
}

.diagram-zone__handle {
  position: absolute;
  pointer-events: auto;
  z-index: 2;
}

.diagram-zone__handle--n,
.diagram-zone__handle--s {
  left: 12px;
  right: 12px;
  height: 8px;
  cursor: ns-resize;
}

.diagram-zone__handle--n { top: -4px; }
.diagram-zone__handle--s { bottom: -4px; }

.diagram-zone__handle--e,
.diagram-zone__handle--w {
  top: 12px;
  bottom: 12px;
  width: 8px;
  cursor: ew-resize;
}

.diagram-zone__handle--e { right: -4px; }
.diagram-zone__handle--w { left: -4px; }

.diagram-zone__handle--se {
  right: -4px;
  bottom: -4px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  opacity: 0.6;
}

body.view-mode .diagram-zone__handle,
body.view-mode .diagram-zone__gear { display: none; }

body.edit-mode .diagram-zone__header,
body.edit-mode .diagram-zone__handle,
body.edit-mode .diagram-zone__gear {
  pointer-events: auto;
}

.diagram-popup--zone { width: min(280px, calc(100vw - 48px)); }

.zone-dim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.zone-dim-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.zone-dim-field .input { margin: 0; }

.zone-color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.input--color {
  padding: 2px 4px;
  height: 36px;
  cursor: pointer;
}

.btn--danger-text {
  color: #dc2626;
  border-color: #fecaca;
}

.btn--danger-text:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.diagram-popup .btn--danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.diagram-popup .btn--danger:hover {
  background: #b91c1c;
}

.viewport.is-space-pan { cursor: grab; }
.viewport.is-space-pan.is-panning { cursor: grabbing; }

.viewport__stage {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
  will-change: transform;
  opacity: 0;
  transition: opacity 0.15s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

.viewport__stage.is-ready {
  opacity: 1;
}

.diagram-stage {
  position: relative;
  min-width: 400px;
  min-height: 400px;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.diagram-edges text,
.edge-label {
  text-rendering: geometricPrecision;
}

.diagram-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px 6px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
}

.diagram-toolbar__btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1;
}

.diagram-toolbar__btn:hover {
  background: var(--bg);
}

.diagram-toolbar__btn--icon {
  width: 32px;
  padding: 0;
  font-size: 1.05rem;
  color: var(--muted);
}

.diagram-toolbar__btn--active {
  background: #eff6ff;
  border-color: #93b4f5;
  color: #1d4ed8;
}

.diagram-toolbar__btn--primary {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

.diagram-toolbar__btn--primary:hover { background: #1e40af; }

.diagram-toolbar__btn--accent {
  background: #eff6ff;
  border-color: #93b4f5;
  color: #1d4ed8;
}

.diagram-toolbar__zoom {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted);
  min-width: 40px;
  text-align: center;
}

.diagram-toolbar__sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 2px;
}

.zoom-toolbar,
.diagram-io-toolbar { display: none !important; }

body.edit-mode .diagram-io-toolbar { display: none !important; }

/* Import / Export — knoppenbalk rechtsonder */
.diagram-io-btns {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 25;
  display: flex;
  gap: 6px;
}

.edit-only.diagram-io-btns { display: none; }
body.edit-mode .edit-only.diagram-io-btns { display: flex !important; }

.diagram-io-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  box-shadow: 0 2px 6px rgba(15,23,42,0.07);
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.diagram-io-btn:hover {
  border-color: #93b4f5;
  color: #1d4ed8;
  background: #f0f5ff;
}

.edge-label--muted { fill: #94a3b8; font-weight: 600; }

.diagram-annotation--table,
.diagram-annotation--text,
.diagram-annotation--chart {
  width: fit-content;
  max-width: none;
}

.diagram-annotation--table {
  box-sizing: border-box;
  display: inline-block;
}

.diagram-annotation--table table {
  width: max-content;
  border-collapse: collapse;
  table-layout: fixed;
}

.diagram-annotation--table td {
  min-width: 80px;
  max-width: 200px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  overflow: hidden;
  cursor: text;
  user-select: text;
  outline: none;
}

.diagram-annotation--table td:focus {
  background: #f8fafc;
  box-shadow: inset 0 0 0 2px #3b82f6;
}

.diagram-annotation--table td:empty::before {
  content: 'Klik om te typen…';
  color: #cbd5e1;
  pointer-events: none;
}

.diagram-annotation--text .diagram-annotation__body {
  min-width: 60px;
  width: fit-content;
  display: inline-block;
}

.zoom-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.zoom-btn {
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}

.zoom-btn:hover { background: var(--bg); color: var(--text); }
.zoom-btn--fit { font-size: 0.95rem; }
.zoom-level {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted);
  min-width: 42px;
  text-align: center;
}

/* legacy toolbar removed — now using diagram-io-btns (bottom-right) */

.diagram-edges {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

body.edit-mode .diagram-edges {
  pointer-events: auto;
}

body.edit-mode.edge-selected .diagram-edges {
  z-index: 6;
}

body.edit-mode .diagram-edges path:not(.edge-hit) {
  pointer-events: none;
}

.edge-hit { cursor: pointer; }

.edge-selected {
  filter: drop-shadow(0 0 4px rgba(29, 78, 216, 0.45));
}

.edge-handle {
  fill: #fff;
  stroke: #1d4ed8;
  stroke-width: 2;
  cursor: grab;
  pointer-events: all;
}

.edge-handle--label {
  fill: #ecfdf5;
  stroke: #0d9488;
  cursor: move;
}

.edge-handle--seg-h {
  fill: #fff7ed;
  stroke: #ea580c;
  cursor: ns-resize;
}

.edge-handle--seg-v {
  fill: #f5f3ff;
  stroke: #7c3aed;
  cursor: ew-resize;
}

.edge-seg-hit--seg-h { cursor: ns-resize; }
.edge-seg-hit--seg-v-left,
.edge-seg-hit--seg-v-right { cursor: ew-resize; }

body.edit-mode.line-tool-active .edge-seg-hit {
  pointer-events: none;
}

.edge-handle:active { cursor: grabbing; }

body.edit-mode.line-tool-active .edge-handle,
body.edit-mode.line-tool-active .edge-hit {
  pointer-events: none;
}

.edge-label {
  font-size: 10px;
  fill: var(--text);
  font-family: var(--font);
  font-weight: 600;
}

.edge-label--ghost {
  fill: #94a3b8;
  font-style: italic;
  font-weight: 500;
}

.edge-label-group--ghost rect {
  stroke-dasharray: 4 3;
  stroke: #94a3b8;
  fill: #f8fafc;
}

.edge-seg-hit {
  pointer-events: stroke;
}

.diagram--absolute {
  position: relative;
  z-index: 2;
}

.layout-tag {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  pointer-events: none;
}

.layout-section {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
  padding: 4px 12px;
  background: rgba(255,255,255,0.7);
  border-radius: 4px;
  border: 1px dashed var(--border);
}

.is-dimmed.layout-tag { opacity: 0.25; }

/* Nodes — absoluut gepositioneerd */
.diagram-node {
  --node-accent: #64748b;
  position: absolute;
  width: 200px;
  transform: translateX(-50%);
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card);
  border: 2px solid var(--border);
  border-left: 4px solid var(--node-accent);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  color: var(--text);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  transition: box-shadow 0.12s, opacity 0.2s, border-color 0.12s;
  z-index: 3;
  user-select: none;
  touch-action: none;
}

body.edit-mode .diagram-node { cursor: grab; }
body.view-mode .diagram-node { cursor: pointer; }

.diagram-node.is-dragging {
  cursor: grabbing;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  transition: none;
}

.diagram-node--custom {
  border-style: dashed;
  background: #fffef5;
}

.diagram-node__icon-wrap {
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.diagram-node--firewall {
  border-left-color: #dc2626;
  background: #fffafa;
  min-width: 210px;
}

.diagram-node--firewall[data-id="dmse"] {
  border: 2px solid #fca5a5;
  border-left: 5px solid #dc2626;
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.12);
}

.diagram-node--child {
  width: 175px;
  min-height: 56px;
  padding: 8px 10px;
  border-left-width: 3px;
  background: #fafbff;
  z-index: 4;
}

.diagram-node--child .diagram-node__icon-wrap {
  width: 30px;
  height: 30px;
}

.diagram-node--child .diagram-node__label { font-size: 0.74rem; }
.diagram-node--child .diagram-node__sub { font-size: 0.62rem; }

.diagram-node--proxmox-host {
  border-left-color: #7c3aed;
  cursor: pointer;
}

.diagram-node--proxmox-host.is-expanded {
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
  border-color: #7c3aed;
}

.diagram-node__expand {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 10px;
  background: #f5f3ff;
  border: 1px solid #c4b5fd;
  color: #6d28d9;
  white-space: nowrap;
  z-index: 5;
}

/* Internet — wolkvorm i.p.v. blok */
.diagram-node--shape,
.diagram-node--cloud,
.diagram-node--dns,
.diagram-node--firewall-shape {
  width: auto;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.diagram-node--shape:hover,
.diagram-node--cloud:hover,
.diagram-node--dns:hover,
.diagram-node--firewall-shape:hover {
  box-shadow: none;
  filter: brightness(1.03);
}

.diagram-node--shape .diagram-node__dot,
.diagram-node--cloud .diagram-node__dot,
.diagram-node--dns .diagram-node__dot {
  top: 2px;
  right: calc(50% - 52px);
}

.diagram-node--firewall-shape .diagram-node__dot {
  top: 2px;
  right: calc(50% - 48px);
}

.diagram-node--shape .diagram-node__cloud-text,
.diagram-node--cloud .diagram-node__cloud-text,
.diagram-node--dns .diagram-node__cloud-text,
.diagram-node--firewall-shape .diagram-node__cloud-text {
  text-align: center;
  margin-top: -2px;
}

.diagram-node--shape .diagram-node__label,
.diagram-node--cloud .diagram-node__label,
.diagram-node--dns .diagram-node__label,
.diagram-node--firewall-shape .diagram-node__label {
  font-size: 0.78rem;
  color: var(--text);
}

.diagram-node--shape .diagram-node__sub,
.diagram-node--cloud .diagram-node__sub,
.diagram-node--dns .diagram-node__sub,
.diagram-node--firewall-shape .diagram-node__sub {
  font-size: 0.64rem;
}

.cloud-shape,
.dns-shape,
.firewall-shape { display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08)); }

.diagram-node--firewall .diagram-node__icon-wrap {
  background: #fef2f2;
  border-color: #fecaca;
}

.diagram-node__branch {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--card);
  border: 1.5px solid var(--node-accent);
  color: var(--node-accent);
  white-space: nowrap;
  z-index: 4;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.diagram-node__branch.is-muted { color: var(--gray); border-color: var(--gray); }

.diagram-node:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  border-color: var(--node-accent);
}

.diagram-node--highlight { background: #f8faff; }
.diagram-node--decision {
  border-style: dashed;
  border-radius: 6px;
  min-width: 140px;
  text-align: center;
  justify-content: center;
}

/* Flowchart-vormen */
.diagram-node--flow {
  min-height: 44px;
  padding: 8px 16px;
  justify-content: center;
  text-align: center;
}

.diagram-node--start {
  border-radius: 999px;
  background: #f0fdf4;
  border-color: #16a34a;
  --node-accent: #16a34a;
}

.diagram-node--end {
  border-radius: 999px;
  background: #f8fafc;
  border-color: #64748b;
  --node-accent: #64748b;
}

.diagram-node--branch {
  min-width: 72px;
  width: 88px !important;
  padding: 6px 10px;
  border-radius: 8px;
  transform: translateX(-50%) skewX(-8deg);
}

.diagram-node--branch-yes {
  background: #f0fdfa;
  border-color: #0d9488;
  --node-accent: #0d9488;
}

.diagram-node--branch-no {
  background: #fef2f2;
  border-color: #dc2626;
  --node-accent: #dc2626;
}

.diagram-node--branch .diagram-node__body {
  transform: skewX(8deg);
}

.diagram-node__body--flow {
  flex: 1;
  min-width: 0;
  padding: 0;
}

.modal-box__firewall {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.55;
  color: #991b1b;
  white-space: pre-wrap;
  overflow-x: auto;
}

.input--mono {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
}
.diagram-node.is-dimmed { opacity: 0.15; pointer-events: none; }
.diagram-node.is-active {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--node-accent) 25%, transparent);
}

@keyframes diagram-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(29, 78, 216, 0.5), 0 0 12px rgba(59, 130, 246, 0.35);
    border-color: #1d4ed8;
  }
  50% {
    box-shadow: 0 0 0 6px rgba(29, 78, 216, 0.15), 0 0 24px rgba(59, 130, 246, 0.55);
    border-color: #3b82f6;
  }
}

@keyframes diagram-highlight-blink {
  0%, 100% {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.55), 0 0 22px rgba(59, 130, 246, 0.5);
    border-color: #1d4ed8 !important;
    filter: brightness(1);
  }
  50% {
    outline: 4px solid #f59e0b;
    outline-offset: 6px;
    box-shadow: 0 0 0 12px rgba(245, 158, 11, 0.22), 0 0 40px rgba(59, 130, 246, 0.8);
    border-color: #f59e0b !important;
    filter: brightness(1.14);
  }
}

.diagram-node.is-pulse {
  animation: diagram-highlight-blink 0.5s ease-in-out 10;
  z-index: 30 !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.diagram-node.is-search-hit {
  animation: diagram-pulse 1.1s ease-in-out infinite;
  z-index: 12;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.diagram-node__dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 2px solid var(--card);
}
.diagram-node__dot--online, .diagram-node__dot--running { background: var(--green); }
.diagram-node__dot--stopped { background: var(--amber); }
.diagram-node__dot--planned, .diagram-node__dot--standby { background: var(--gray); }

.diagram-node__body { flex: 1; min-width: 0; padding-right: 10px; }
.diagram-node__label { display: block; font-size: 0.8rem; font-weight: 700; line-height: 1.25; }
.diagram-node__sub { display: block; font-size: 0.66rem; font-family: var(--mono); color: var(--muted); margin-top: 2px; }

.net-icon { display: block; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(26, 35, 50, 0.5);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.is-open { display: flex; }

.modal-box {
  position: relative;
  width: min(440px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

.modal-box__close {
  position: absolute;
  top: 12px; right: 12px;
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 6px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--muted);
}

.modal-box__header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-right: 28px;
}

.modal-box__icon {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  font-size: 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  flex-shrink: 0;
}

.modal-box h2 { font-size: 1.05rem; font-weight: 700; }
.modal-box__sub { font-size: 0.78rem; color: var(--muted); font-family: var(--mono); }

.badge {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}
.badge--online, .badge--running { background: #dcfce7; color: var(--green); }
.badge--stopped { background: #fef3c7; color: var(--amber); }
.badge--planned, .badge--standby { background: #f1f5f9; color: var(--gray); }

.modal-box__summary {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 14px;
}

.modal-box__details { margin-bottom: 16px; }
.modal-box__details dt { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.modal-box__details dd { font-size: 0.84rem; font-family: var(--mono); margin-bottom: 6px; }

.modal-box__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Detail page */
.detail-page { min-height: 100vh; background: var(--bg); }
.detail-page__header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.detail-page__header h1 { font-size: 1.1rem; font-weight: 700; }
.detail-page__body { max-width: 720px; margin: 0 auto; padding: 28px 24px 48px; }

.detail-section { margin-bottom: 24px; }
.detail-section h2 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1d4ed8;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.detail-section p { font-size: 0.9rem; line-height: 1.65; color: var(--muted); }
.detail-section code { font-family: var(--mono); font-size: 0.8rem; background: var(--card); padding: 1px 5px; border-radius: 3px; color: #0d9488; }
.detail-empty { color: var(--muted); margin-bottom: 16px; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: min(300px, 88vw);
    z-index: 90;
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    max-height: none;
    flex-direction: column;
    flex-wrap: nowrap;
    box-shadow: 8px 0 24px rgba(0,0,0,0.1);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-toggle { display: grid; }
  .header__stats .stat { display: none; }
  .panel { min-width: 0; }
}

/* Edit-modus */
.edit-only { display: none !important; }
body.edit-mode .edit-only { display: block !important; }
body.edit-mode .diagram-toolbar .edit-only { display: inline-flex !important; }
body.edit-mode .diagram-toolbar .edit-only.diagram-toolbar__sep { display: block !important; }
body.edit-mode .edit-only.panel { display: flex !important; flex-direction: column; }

.diagram-node.is-selected {
  outline: none;
  z-index: 20;
}

body.view-mode .diagram-node.is-selected {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

body.view-mode .diagram-zone__resize { display: none; }
body.view-mode .diagram-node { cursor: pointer; }
body.edit-mode .diagram-node { cursor: grab; }
body.edit-mode .diagram-node.is-dragging { cursor: grabbing; }

.viewport.line-tool-active { cursor: crosshair; }

/* Drijvende bewerk-popups (draw.io-stijl) */
.diagram-popup {
  position: absolute;
  z-index: 50;
  width: min(300px, calc(100vw - 48px));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(255,255,255,0.6) inset;
  padding: 12px 14px 14px;
  pointer-events: auto;
  user-select: auto;
}

.diagram-popup--edge { width: min(260px, calc(100vw - 48px)); }

.diagram-popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.diagram-popup__header--draggable {
  cursor: grab;
  user-select: none;
  margin: -4px -6px 10px;
  padding: 4px 6px;
  border-radius: 8px;
}

.diagram-popup__header--draggable:active { cursor: grabbing; }

.diagram-popup__header--draggable .diagram-popup__title::before {
  content: '⠿ ';
  opacity: 0.45;
  font-size: 0.85em;
}

.diagram-popup__title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.diagram-popup__close {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg);
  border-radius: 6px;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.diagram-popup__close:hover { color: var(--text); background: #e8ecf2; }

.diagram-popup__hint { margin: 8px 0 4px; }
.diagram-popup__toggle { margin-top: 8px; }

.diagram-popup__actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.edge-route-toolbar {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 10px;
}

.edge-route-btn {
  flex: 1;
  min-width: 44px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.edge-route-btn:hover { background: var(--card); color: var(--text); }

.edge-route-btn.is-active {
  background: var(--card);
  border-color: #93b4f5;
  color: #1d4ed8;
  box-shadow: 0 1px 4px rgba(29, 78, 216, 0.12);
}

/* Node selectiekader (draw.io-stijl) */
.node-chrome {
  position: absolute;
  z-index: 25;
  pointer-events: none;
}

.node-chrome__box {
  position: absolute;
  inset: 0;
  border: 2px dashed #3b82f6;
  border-radius: 8px;
  pointer-events: none;
}

.node-chrome__handle {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  background: #3b82f6;
  border: 2px solid #fff;
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(29, 78, 216, 0.35);
}

.node-chrome__handle--nw { top: 0; left: 0; cursor: nwse-resize; }
.node-chrome__handle--n  { top: 0; left: 50%; cursor: ns-resize; }
.node-chrome__handle--ne { top: 0; left: 100%; cursor: nesw-resize; }
.node-chrome__handle--e  { top: 50%; left: 100%; cursor: ew-resize; }
.node-chrome__handle--se { top: 100%; left: 100%; cursor: nwse-resize; }
.node-chrome__handle--s  { top: 100%; left: 50%; cursor: ns-resize; }
.node-chrome__handle--sw { top: 100%; left: 0; cursor: nesw-resize; }
.node-chrome__handle--w  { top: 50%; left: 0; cursor: ew-resize; }

.node-chrome__arrow {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(147, 197, 253, 0.55);
  color: #1d4ed8;
  font-size: 11px;
  line-height: 22px;
  text-align: center;
  pointer-events: auto;
  cursor: crosshair;
  transition: background 0.12s, transform 0.12s;
}

.node-chrome__arrow:hover {
  background: #3b82f6;
  color: #fff;
  transform: scale(1.12);
}

.node-chrome__arrow--n { top: -30px; left: 50%; }
.node-chrome__arrow--n::before { content: '↑'; }
.node-chrome__arrow--s { top: calc(100% + 30px); left: 50%; }
.node-chrome__arrow--s::before { content: '↓'; }
.node-chrome__arrow--e { top: 50%; left: calc(100% + 30px); }
.node-chrome__arrow--e::before { content: '→'; }
.node-chrome__arrow--w { top: 50%; left: -30px; }
.node-chrome__arrow--w::before { content: '←'; }

.node-chrome__delete {
  position: absolute;
  top: -28px;
  left: -8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid #ef4444;
  border-radius: 50%;
  background: #fff;
  pointer-events: auto;
  cursor: pointer;
  font-size: 11px;
  line-height: 18px;
  color: #ef4444;
}

.node-chrome__delete:hover {
  background: #ef4444;
  color: #fff;
}

.node-chrome__rotate {
  position: absolute;
  top: -28px;
  right: -8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #3b82f6;
  pointer-events: auto;
  cursor: grab;
  font-size: 12px;
  line-height: 18px;
  color: #3b82f6;
}

.node-chrome__rotate::before { content: '↻'; }

.node-chrome__rotate:active { cursor: grabbing; }

.node-chrome__quick {
  position: absolute;
  display: flex;
  gap: 4px;
  padding: 4px 6px;
  background: var(--card);
  border: 1px solid #93b4f5;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.16);
  pointer-events: auto;
  z-index: 40;
  white-space: nowrap;
}

.node-chrome__quick--s { top: calc(100% + 42px); left: 50%; transform: translateX(-50%); }
.node-chrome__quick--n { bottom: calc(100% + 42px); left: 50%; transform: translateX(-50%); }
.node-chrome__quick--e { left: calc(100% + 42px); top: 50%; transform: translateY(-50%); }
.node-chrome__quick--w { right: calc(100% + 42px); top: 50%; transform: translateY(-50%); }

.node-chrome__quick button {
  width: 30px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--card);
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
}

.node-chrome__quick button:hover {
  border-color: #93b4f5;
  background: #f0f5ff;
}

/* Alignment snap-line */
.diagram-snapline {
  position: absolute;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.diagram-snapline--h {
  left: -4000px;
  width: 8000px;
  height: 2px;
  background: #3b82f6;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

.diagram-snapline--v {
  top: -4000px;
  height: 8000px;
  width: 2px;
  background: #3b82f6;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

.diagram-snapline.is-active {
  opacity: 0.85;
  animation: snapline-pulse 1s ease-out forwards;
}

@keyframes snapline-pulse {
  0%   { opacity: 0.95; }
  70%  { opacity: 0.75; }
  100% { opacity: 0; }
}

/* Diagram-annotaties (tekst, lijnen, pijlen) */
.diagram-annotations {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

body.edit-mode .diagram-annotations { pointer-events: none; }

body.view-mode .diagram-annotation--text,
body.view-mode .diagram-annotation--table,
body.view-mode .diagram-annotation--chart {
  pointer-events: none;
}

.diagram-annotations__svg {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.diagram-annotations__text {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.diagram-annotation--text,
.diagram-annotation--table,
.diagram-annotation--chart,
.diagram-annotation-hit {
  position: absolute;
  min-width: 80px;
  min-height: 32px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px dashed #94a3b8;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.35;
  color: #334155;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  pointer-events: auto;
  cursor: default;
  outline: none;
}

.diagram-annotation--text.is-selected {
  border-color: #3b82f6;
  border-style: solid;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.diagram-annotation--text[contenteditable="true"]:focus {
  border-color: #3b82f6;
  border-style: solid;
}

.diagram-annotation__grip {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 3px 6px 3px 8px;
  margin: -8px -10px 6px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  background: #f1f5f9;
  border-radius: 4px 4px 0 0;
  cursor: grab;
  user-select: none;
}

.diagram-annotation__grip-label { flex: 1; }

.diagram-annotation__grip-gear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  border-radius: 4px;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
}

.diagram-annotation__grip-gear:hover { color: #1d4ed8; background: #e0ecff; }

.diagram-popup__gear {
  flex-shrink: 0;
  color: var(--muted);
  display: block;
}

.diagram-annotation__grip:active { cursor: grabbing; }

.diagram-annotation__grip::before {
  content: '⠿';
  opacity: 0.6;
}

.diagram-annotation-hit {
  pointer-events: stroke;
  cursor: pointer;
}

.diagram-annotation-hit.is-selected + .diagram-annotation-line,
.diagram-annotation-line.is-selected {
  stroke: #3b82f6;
  stroke-width: 3;
}

.viewport.ann-tool-active { cursor: crosshair; }

.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 120px;
  overflow-y: auto;
}

.icon-pick {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.icon-pick.is-pick { border-color: #1d4ed8; background: #eff6ff; }

.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.template-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--card);
  font-size: 0.72rem;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
}

.template-btn:hover { border-color: #93b4f5; }

.btn--xs { padding: 5px 10px; font-size: 0.72rem; }

.custom-edge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.custom-edge-row:hover { color: #1d4ed8; }

#lineToolSolid.is-active,
#lineToolDashed.is-active { background: #eff6ff; border-color: #1d4ed8; color: #1d4ed8; }

.dns-table-wrap { overflow-x: auto; margin-top: 6px; }

.dns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.68rem;
}

.dns-table th,
.dns-table td {
  text-align: left;
  padding: 5px 6px;
  border-bottom: 1px solid var(--border);
}

.dns-table th { color: var(--muted); font-size: 0.6rem; text-transform: uppercase; }
.dns-table code { font-family: var(--mono); font-size: 0.65rem; }

.dns-panel__toggle { text-align: center; }

/* Toevoeg-popup */
.insert-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}

.insert-modal[hidden] { display: none !important; }

.insert-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.insert-modal__box {
  position: relative;
  width: min(720px, 100%);
  max-height: min(85vh, 720px);
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.insert-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.insert-modal__header h2 {
  font-size: 1rem;
  font-weight: 700;
}

.insert-modal__close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--bg);
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted);
}

.insert-modal__tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  background: var(--bg);
}

.insert-tab {
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.insert-tab.is-active {
  background: var(--card);
  border-color: var(--border);
  color: #1d4ed8;
}

.insert-modal__body {
  padding: 16px 18px 20px;
  overflow-y: auto;
}

.insert-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.insert-template-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.insert-template-btn:hover {
  border-color: #93b4f5;
  background: #f0f5ff;
}

.insert-template-btn__icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #1d4ed8;
}

.insert-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.insert-shapes-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.insert-shape-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 70px;
  text-align: center;
}

.insert-shape-btn__svg {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
}

.insert-shape-btn__svg .dns-shape,
.insert-shape-btn__svg .cloud-shape,
.insert-shape-btn__svg .firewall-shape {
  display: block;
}

.diagram-annotation--table table {
  border-collapse: collapse;
  font-size: 0.78rem;
  background: #fff;
  min-width: 120px;
  width: max-content;
  table-layout: fixed;
}

.diagram-annotation--table td {
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  min-width: 80px;
  max-width: 200px;
  cursor: text;
  user-select: text;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  overflow: hidden;
}

.diagram-annotation--table td:focus {
  background: #f8fafc;
  box-shadow: inset 0 0 0 2px #3b82f6;
}

.diagram-annotation--table.is-selected {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.diagram-annotation--chart {
  width: 200px;
  padding: 10px;
  background: #fff;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
}

.diagram-annotation--chart.is-selected {
  border-color: #3b82f6;
  border-style: solid;
}

.diagram-annotation__chart-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.diagram-annotation__chart-placeholder {
  height: 80px;
  border-radius: 6px;
  background: linear-gradient(180deg, #e2e8f0 0%, #f1f5f9 100%);
}

.diagram-annotation--chart-bar .diagram-annotation__chart-placeholder {
  background: linear-gradient(90deg, #3b82f6 0%, #3b82f6 30%, #e2e8f0 30%, #e2e8f0 45%, #60a5fa 45%, #60a5fa 65%, #e2e8f0 65%);
}

.diagram-annotation--chart-pie .diagram-annotation__chart-placeholder {
  border-radius: 50%;
  background: conic-gradient(#3b82f6 0 40%, #60a5fa 40% 70%, #93c5fd 70% 100%);
}

/* Bevestigingsdialoog */
.app-confirm {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
}

.app-confirm[hidden] { display: none !important; }

.app-confirm__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

.app-confirm__box {
  position: relative;
  width: min(380px, 100%);
  padding: 22px 22px 18px;
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
  text-align: center;
}

.app-confirm__box[data-variant="danger"] .app-confirm__icon {
  background: #fef2f2;
  color: #dc2626;
}

.app-confirm__icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 1.25rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.app-confirm__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.app-confirm__message {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 18px;
}

.app-confirm__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.btn--danger {
  background: #dc2626;
  border: 1px solid #dc2626;
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: var(--font);
}

.btn--danger:hover { background: #b91c1c; }

/* ── Auth & accountpagina's ── */

.site-topbar__auth {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header.site-topbar .site-topbar__extra {
  margin-left: 10px;
}

.auth-bar {
  display: flex;
  align-items: center;
  gap: 4px;
}

.auth-bar__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.auth-bar__btn:hover {
  border-color: #93b4f5;
  color: #1d4ed8;
  background: #f0f5ff;
}

.auth-bar__btn--login {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #fff;
}

.auth-bar__btn--login:hover {
  background: #1e40af;
  border-color: #1e40af;
  color: #fff;
}

.auth-bar__btn--logout {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.auth-bar__btn--logout:hover {
  border-color: #fca5a5;
  color: #b91c1c;
  background: #fef2f2;
}

.auth-bar__user {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: background 0.12s, border-color 0.12s;
}

.auth-bar__user:hover {
  background: var(--card);
  border-color: #93b4f5;
}

.auth-bar__name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-btn__icon {
  flex-shrink: 0;
  display: block;
}

.site-nav-drawer__auth {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-nav-drawer__auth .site-nav__link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.site-nav-drawer__auth .site-nav__link strong { flex: 1; }

.account-page {
  min-height: 100dvh;
  background: var(--bg);
}

.page-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.page-main--narrow {
  max-width: 640px;
}

.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(29, 78, 216, 0.08), transparent 50%),
    var(--bg);
}

.login-card {
  width: min(400px, 100%);
  padding: 28px 28px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.login-card__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.login-card__logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #1d4ed8;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}

.login-card h1 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.login-card__sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.82rem;
}

.account-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 14px;
}

.account-card__title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 14px;
}

.account-dl {
  display: grid;
  gap: 10px;
}

.account-dl__row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  font-size: 0.88rem;
}

.account-dl__row dt {
  color: var(--muted);
  font-weight: 600;
}

.account-dl__row dd {
  margin: 0;
  font-weight: 500;
}

.account-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.account-nav__link {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.account-nav__link:hover,
.account-nav__link.is-active {
  border-color: #93b4f5;
  color: #1d4ed8;
  background: #eff6ff;
}

/* Credentials (hostpagina) — gedeeld */
.cred-note { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }
.cred-block { margin-top: 12px; }
.cred-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.cred-row input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.82rem;
  font-family: var(--font);
}
.cred-row input.mono { font-family: var(--mono); font-size: 0.78rem; }
.cred-view {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
}
.cred-view__label { font-weight: 600; color: var(--text); }
.cred-view__user { color: var(--muted); }

@media (max-width: 700px) {
  .auth-bar__name { display: none; }
  .auth-bar__btn span { display: none; }
  .auth-bar__btn { padding: 8px 10px; }
  .account-dl__row { grid-template-columns: 1fr; gap: 2px; }
  .cred-row { grid-template-columns: 1fr; }
}
