* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #1f2937; background: #f3f4f6;
  display: grid; grid-template-columns: 170px minmax(0, 1fr) 370px; grid-template-rows: auto minmax(0, 1fr) 232px;
}
:focus-visible { outline: 3px solid #2563eb; outline-offset: 1px; }
button { font: inherit; padding: 3px 9px; border: 1px solid #9ca3af; border-radius: 4px; background: #fff; cursor: pointer; }
button:hover:not(:disabled) { background: #e5edff; }
button:disabled { color: #9ca3af; cursor: not-allowed; }
input, select { font: inherit; padding: 2px 4px; border: 1px solid #9ca3af; border-radius: 4px; background: #fff; max-width: 100%; }
h1 { font-size: 16px; margin: 0 12px 0 0; }
h2 { font-size: 13px; margin: 8px 0 4px; }
h3 { font-size: 12px; margin: 8px 0 4px; }
h4 { font-size: 12px; margin: 6px 0 2px; color: #4b5563; }
.hint { color: #6b7280; margin: 4px 0; }

#top { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: #1e3a5f; color: #fff; }
#top h1 { color: #fff; }
#top button { padding: 3px 10px; }
#msg { margin-left: 10px; padding: 2px 8px; border-radius: 4px; }
#msg.bad { background: #fee2e2; color: #991b1b; }
#msg.ok { background: #dcfce7; color: #166534; }

#palette { overflow: auto; padding: 4px 8px; background: #fff; border-right: 1px solid #d1d5db; }
#palette h2 { border-bottom: 1px solid #e5e7eb; }
.pal { display: flex; flex-direction: column; gap: 3px; }
.pal button { text-align: left; }
.clouds { display: flex; flex-wrap: wrap; gap: 2px 10px; border: 0; margin: 2px 0 4px; padding: 0; font-size: 12px; }
.clouds legend { float: left; margin-right: 6px; color: #6b7280; padding: 0; }
.clouds label { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
#palsearch { width: 100%; margin: 6px 0 2px; padding: 5px 7px; box-sizing: border-box; }

#canvasWrap { overflow: auto; background: #fafafa; background-image: radial-gradient(#d1d5db 1px, transparent 1px); background-size: 20px 20px; }
#svg { display: block; touch-action: none; user-select: none; }
#svg text { font-size: 11px; fill: #1f2937; pointer-events: none; }
#svg [role=button] { cursor: pointer; }
#svg [role=button]:focus-visible { outline: none; }
#svg [role=button]:focus-visible > :first-child { stroke: #2563eb; stroke-width: 3; }
.ctr { stroke-width: 1.5; fill-opacity: .6; }
.ctr.vnet { fill: #dbeafe; stroke: #2563eb; }
.ctr.onprem { fill: #e5e7eb; stroke: #6b7280; }
.ctr.vwanHub { fill: #ede9fe; stroke: #7c3aed; }
.ctr.vpc { fill: #ffedd5; stroke: #ea580c; }
.hdr { fill: transparent; cursor: move; }
#svg .ctitle { font-weight: 700; font-size: 12px; }
#svg .csub, #svg .ctag { fill: #4b5563; font-size: 10px; }
#svg .ctag { text-anchor: end; }
.snet { fill: #fff; fill-opacity: .65; stroke: #94a3b8; }
.pill { fill: #fef3c7; stroke: #d97706; }
#svg .ptext { font-size: 9px; text-anchor: middle; }
.chip { fill: #fff; stroke: #64748b; }
.chip.nva { fill: #fff7ed; }
#svg .chip2 { fill: #4b5563; font-size: 10px; }
.card { fill: #fffbeb; stroke: #b45309; stroke-width: 1.5; }
.sel { stroke: #e11d48 !important; stroke-width: 3.5 !important; }
.flag { stroke: #fff; stroke-width: 1; pointer-events: none; }
.flag.error { fill: #dc2626; }
.flag.warn { fill: #f59e0b; }
.ln { fill: none; stroke-width: 2.5; pointer-events: none; }
.ln.peering { stroke: #2563eb; stroke-dasharray: 7 4; }
.ln.vpn { stroke: #ea580c; }
.ln.er { stroke: #16a34a; }
.ln.hubc { stroke: #7c3aed; }
.ln.reach { stroke: #0d9488; stroke-dasharray: 2 4; }
.ln.pcx { stroke: #ea580c; stroke-dasharray: 7 4; }
.ln.vpn.aws { stroke: #b45309; }
.ln.tgwa { stroke: #c2410c; stroke-width: 3; }
.ln.dx { stroke: #15803d; stroke-dasharray: 9 3; }
.ln.thin { stroke: #6b7280; stroke-width: 1; }
.hit { fill: none; stroke: #000; stroke-opacity: 0; stroke-width: 12; pointer-events: stroke; }
#dot { fill: #2563eb; stroke: #fff; stroke-width: 2; }
#dot.ok { fill: #16a34a; }
#dot.bad { fill: #dc2626; transform-box: fill-box; transform-origin: center; animation: pulse .8s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.7); opacity: .6; } }

#right { display: flex; flex-direction: column; min-height: 0; background: #fff; border-left: 1px solid #d1d5db; }
#tabs { display: flex; border-bottom: 1px solid #d1d5db; }
#tabs button { flex: 1; border: 0; border-radius: 0; padding: 6px; background: #f3f4f6; }
#tabs button[aria-selected=true] { background: #fff; font-weight: 700; box-shadow: inset 0 -3px #2563eb; }
.panel { flex: 1; overflow: auto; padding: 4px 10px 12px; min-height: 0; }
.panel .id { color: #6b7280; margin: 0; font-size: 11px; }
.panel .info { background: #eff6ff; padding: 4px 6px; border-radius: 4px; }
.row { display: flex; flex-direction: column; margin: 5px 0; gap: 2px; }
.row > label { font-weight: 600; font-size: 12px; }
fieldset { margin: 0; padding: 2px 6px 4px; border: 1px solid #d1d5db; border-radius: 4px; max-height: 140px; overflow: auto; }
legend { font-weight: 600; font-size: 12px; }
.chk { display: flex; gap: 5px; align-items: center; font-weight: 400 !important; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; align-items: center; }
button.danger { border-color: #dc2626; color: #b91c1c; }
.tbl { overflow-x: auto; }
table.grid { border-collapse: collapse; font-size: 11px; }
.grid th, .grid td { border: 1px solid #e5e7eb; padding: 1px 3px; text-align: left; white-space: nowrap; }
.grid th { background: #f3f4f6; }
.grid input[type=text], .grid input:not([type]), .grid input[type=number], .grid select { width: 100%; min-width: 60px; }
.grid input[type=number] { min-width: 52px; }
.grid tr.off td { color: #9ca3af; background: #f9fafb; text-decoration: line-through; }
.ipf { display: flex; flex-wrap: wrap; gap: 6px; align-items: end; }
.ipf label { display: flex; flex-direction: column; font-size: 11px; }
.ok { color: #166534; }
.bad { color: #b91c1c; }
.err { color: #b91c1c; }
.list { list-style: none; margin: 0 0 6px; padding: 0; }
.list button { width: 100%; text-align: left; border: 0; border-bottom: 1px solid #f3f4f6; border-radius: 0; background: none; }
.list button.on { background: #ffe4e6; }
.lvl-error > h3 { color: #b91c1c; }
.lvl-warn > h3 { color: #b45309; }
.lvl-info > h3 { color: #1d4ed8; }

#traffic { grid-column: 1 / -1; display: grid; grid-template-columns: 420px minmax(0, 1fr) 360px; gap: 0 12px; padding: 4px 10px; background: #fff; border-top: 2px solid #9ca3af; min-height: 0; overflow: hidden; }
#tform { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; overflow: auto; align-content: start; }
#tform h2 { margin: 0; grid-column: 1 / -1; }
#tform label { display: flex; flex-direction: column; font-size: 11px; }
#tform label.chk { flex-direction: row; align-items: center; align-self: end; }
#tform input:not([type=checkbox]), #tform select { width: 100%; }
#trace { grid-column: 1 / -1; background: #2563eb; color: #fff; border-color: #1d4ed8; font-weight: 700; padding: 4px; }
#trace:hover { background: #1d4ed8 !important; }
#t-res, #t-side { overflow: auto; min-height: 0; }
.banner { font-weight: 700; padding: 4px 8px; border-radius: 4px; margin: 2px 0; }
.banner.ok { background: #dcfce7; color: #166534; }
.banner.bad { background: #fee2e2; color: #991b1b; }
.alert { background: #fef3c7; color: #92400e; padding: 3px 8px; border-radius: 4px; margin: 2px 0; }
#hops { list-style: none; margin: 4px 0 0; padding: 0; }
#hops li { border-left: 4px solid transparent; }
#hops li.cur { background: #dbeafe; border-left-color: #2563eb; }
#hops button { border: 0; background: none; text-align: left; width: 100%; padding: 1px 4px; }
#hops li.cur button { background: none; }
#hops .mk { display: inline-block; width: 1.2em; font-weight: 700; }
#hops li.ok .mk { color: #16a34a; }
#hops li.bad .mk { color: #dc2626; }
#flows { display: flex; flex-direction: column; gap: 3px; }
#flows button { text-align: left; }
#log { margin: 0; padding-left: 16px; font-size: 12px; }
#log li.blocked { color: #b91c1c; }
#log li.delivered { color: #166534; }

@media (max-width: 1100px) { body { grid-template-columns: 150px minmax(0, 1fr) 320px; } }

/* IaC tab: goose-style builder and import */
.mono { font: 12px/1.35 Consolas, "Cascadia Mono", monospace; width: 100%; border: 1px solid #9ca3af; border-radius: 4px; padding: 3px 5px; }
textarea.code { background: #1f2a30; color: #e8f1ee; white-space: pre; overflow: auto; resize: vertical; }
#p-iac select, #p-iac input[type=text] { width: 100%; }
#p-iac .row .hint { margin: 0; font-size: 11px; }
button.honk { background: #f29d38; border-color: #d9822b; color: #fff; font-weight: 700; margin-left: auto; }
button.honk:hover:not(:disabled) { background: #d9822b !important; }
.codetabs { display: flex; gap: 2px; }
.codetabs button[aria-selected=true] { background: #1f2a30; color: #fff; }
ul.notes { margin: 2px 0 6px; padding-left: 18px; font-size: 12px; }
