*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body, button, input, select, textarea { font-family: 'Inter', sans-serif; }
.fa-solid, .fas { font-family: "Font Awesome 6 Free" !important; font-weight: 900; }
.fa-brands, .fab { font-family: "Font Awesome 6 Brands" !important; font-weight: 400; }
html, body { height: 100%; width: 100%; overflow: hidden; background: transparent; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; -webkit-font-smoothing: antialiased; }

.canvas {
  position: relative;
  width: 100%; height: 100%; min-height: 100%;
  overflow: hidden;
}

    .conn-svg {
      position: absolute; inset: 0;
      width: 100%; height: 100%;
      pointer-events: none; overflow: visible; z-index: 0;
    }

    /* ── HUB — extreme left, partially clipped ── */
    .hub {
      position: absolute;
      left: -2%;
      top: 42%;
      transform: translateY(-50%);
      z-index: 4;
      width: clamp(130px, 13vw, 185px);
      border-radius: clamp(10px, 1vw, 16px);
      padding: clamp(10px, 1.1vh, 18px) clamp(12px, 1.3vw, 22px);
      background: linear-gradient(145deg, #4f6ef7 0%, #1e3a8a 100%);
      box-shadow: 0 8px 32px rgba(79,110,247,0.38), 0 0 0 1px rgba(255,255,255,0.15) inset;
      display: flex; flex-direction: row; align-items: center;
      gap: clamp(8px, 0.8vw, 12px);
    }
    .hub-pulse {
      position: absolute; inset: -5px;
      border-radius: calc(clamp(10px, 1vw, 16px) + 5px);
      border: 1.5px solid rgba(79,110,247,0.28);
      animation: hubRing 2.8s ease-in-out infinite;
      pointer-events: none;
    }
    .hub-pulse::after {
      content: ''; position: absolute; inset: -5px;
      border-radius: calc(clamp(10px, 1vw, 16px) + 10px);
      border: 1px solid rgba(79,110,247,0.12);
      animation: hubRing 2.8s ease-in-out 0.5s infinite;
    }
    @keyframes hubRing {
      0%, 100% { transform: scale(1); opacity: 0.8; }
      50%       { transform: scale(1.18); opacity: 0; }
    }
    .hub-logo { width: clamp(20px, 2.2vmin, 28px); height: auto; object-fit: contain; flex-shrink: 0; }
    .hub-text  { display: flex; flex-direction: column; gap: 2px; }
    .hub-name  { font-size: clamp(12px, 1.2vw, 16px); font-weight: 700; color: #fff; line-height: 1.2; letter-spacing: -0.01em; }
    .hub-sub   { font-size: clamp(8px, 0.5vw, 10px); font-weight: 500; color: rgba(255,255,255,0.5); letter-spacing: 0.1em; text-transform: uppercase; }

    /* ── MAIN CARDS (hub-connected) ── */
    .pcard {
      position: absolute;
      background: rgba(255,255,255,0.78);
      border: 1px solid rgba(100,116,139,0.18);
      border-radius: clamp(8px, 0.8vw, 13px);
      padding: clamp(8px, 0.8vh, 12px) clamp(10px, 1vw, 16px);
      min-width: clamp(100px, 10vw, 150px);
      box-shadow: 0 2px 16px rgba(0,0,0,0.07);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      cursor: grab; z-index: 5;
      opacity: 0; transform: scale(0.92) translateY(4px);
      transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.2s;
    }
    .pcard.shown { opacity: 1; transform: scale(1) translateY(0); }
    .pcard:hover { box-shadow: 0 6px 28px rgba(0,0,0,0.11); }
    .pcard--itsm  { border-left: 2.5px solid rgba(139,92,246,0.5); }
    .pcard--vendor { border-left: 2.5px solid rgba(16,185,129,0.5); }
    .pcard-cat { display: block; font-size: clamp(8px, 0.5vw, 10px); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 2px; opacity: 0.75; }
    .pcard--itsm .pcard-cat  { color: #6d28d9; }
    .pcard--vendor .pcard-cat { color: #059669; }
    .pcard-title { font-size: clamp(12px, 1.2vw, 16px); font-weight: 700; color: #1e2a3a; line-height: 1.2; letter-spacing: -0.01em; }

    /* ── ITSM BADGES ── */
    .pbadge {
      position: absolute;
      display: inline-flex; align-items: center; gap: 5px;
      background: #ffffff;
      border: 1px solid rgba(147, 51, 234, 0.45);
      border-radius: 100px;
      padding: clamp(3px, 0.3vh, 5px) clamp(8px, 0.8vw, 14px);
      font-size: clamp(11px, 0.9vw, 13px); font-weight: 600;
      color: #334155; white-space: nowrap;
      cursor: grab; z-index: 5;
      opacity: 0; transform: scale(0.9);
      transition: opacity 0.35s ease, transform 0.35s ease;
      box-shadow: 0 2px 8px rgba(0,0,0,0.07);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
    }
    .pbadge.shown { opacity: 1; transform: scale(1); }
    .pbadge--itsm { border-color: rgba(147, 51, 234, 0.45); background: #f3e8ff; color: #581c87; }
    .pbadge i { font-size: 0.9em; }

    /* ── CATEGORY GROUP CARDS — two-layer vendor grouping ── */
    .cat-group {
      position: absolute;
      background: rgba(255,255,255,0.78);
      border: 1px solid rgba(100,116,139,0.18);
      border-radius: 12px;
      padding: 8px 10px 10px;
      min-width: clamp(130px, 13vw, 185px);
      box-shadow: 0 2px 16px rgba(0,0,0,0.07);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      cursor: grab; z-index: 5;
      opacity: 0; transform: scale(0.92) translateY(4px);
      transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.2s;
    }
    .cat-group.shown { opacity: 1; transform: scale(1) translateY(0); }
    .cat-group:hover { box-shadow: 0 6px 28px rgba(0,0,0,0.11); }

    /* Layer 1 — category label */
    .cat-label {
      font-size: 9px; font-weight: 700; letter-spacing: 0.1em;
      text-transform: uppercase; color: #475569;
      margin-bottom: 7px;
      padding-bottom: 5px;
      border-bottom: 1px solid rgba(100,116,139,0.14);
    }

    /* Layer 2 — vendor logo tiles row */
    .cat-vendors {
      display: flex; flex-direction: row; flex-wrap: wrap;
      gap: 4px;
      max-width: 170px;
    }
    .vendor-tile {
      display: inline-flex; align-items: center; gap: 4px;
      background: #f8fafc;
      border: 1px solid rgba(100,116,139,0.22);
      border-radius: 6px;
      padding: 3px 7px 3px 3px;
      font-size: clamp(9px, 0.75vw, 11px); font-weight: 600;
      color: #0f172a; white-space: nowrap;
    }
    /* Vendor logo avatar */
    .v-logo {
      width: 20px; height: 20px; border-radius: 5px;
      display: inline-flex; align-items: center; justify-content: center;
      font-size: 8px; font-weight: 900; color: #fff;
      flex-shrink: 0; overflow: hidden;
    }
    .v-logo img { width: 100%; height: 100%; object-fit: contain; padding: 2px; background: #fff; border-radius: 5px; }

    /* dark mode */
    [data-theme="dark"] .pcard,
    [data-theme="dark"] .cat-group {
      background: rgba(15,23,42,0.85);
      border-color: rgba(100,116,139,0.3);
    }
    [data-theme="dark"] .pcard-title { color: #f1f5f9; }
    [data-theme="dark"] .cat-label { color: #cbd5e1; border-bottom-color: rgba(100,116,139,0.25); }
    [data-theme="dark"] .vendor-tile {
      background: rgba(30,41,59,0.9);
      border-color: rgba(148,163,184,0.3);
      color: #f8fafc;
    }
    [data-theme="dark"] .pbadge {
      background: rgba(15,23,42,0.8);
      color: #f8fafc;
    }
    [data-theme="dark"] .pbadge--itsm {
      background: rgba(88,28,135,0.55);
      color: #f3e8ff;
      border-color: rgba(192,132,252,0.45);
    }
    [data-theme="dark"] .pcard--itsm .pcard-cat { color: #c084fc; }
    [data-theme="dark"] .pcard--vendor .pcard-cat { color: #34d399; }

/* ── MOBILE RESPONSIVE STYLES (WITH 2-LINE TEXT WRAPPING) ── */
@media (max-width: 650px) {
  .hub {
    left: 50% !important;
    top: 4% !important;
    transform: translateX(-50%) !important;
    width: 140px;
    padding: 7px 11px;
    border-radius: 9px;
    gap: 9px;
  }
  .hub-name { font-size: 13.5px !important; font-weight: 800 !important; white-space: normal !important; text-align: left !important; }
  .hub-sub { font-size: 9px !important; text-align: left !important; }
  .hub-logo { width: 20px; }

  .pcard {
    padding: 6px 10px;
    min-width: 90px;
    border-radius: 8px;
  }
  .pcard-title { font-size: 12px !important; font-weight: 700 !important; white-space: normal !important; text-align: left !important; line-height: 1.2 !important; }
  .pcard-cat { font-size: 8.5px !important; font-weight: 600 !important; margin-bottom: 2px; text-align: left !important; }

  .pbadge {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    width: fit-content !important;
    max-width: 95px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 3.5px 8px !important;
    border-radius: 9px !important;
    white-space: normal !important;
    text-align: left !important;
    line-height: 1.12 !important;
    word-break: break-word !important;
  }

  .cat-group {
    padding: 7px 9px 9px;
    min-width: 130px;
    max-width: 155px;
    border-radius: 10px;
  }
  .cat-label {
    font-size: 9.5px !important;
    font-weight: 800 !important;
    margin-bottom: 6px;
    padding-bottom: 4px;
    text-align: left !important;
  }
  .cat-vendors {
    gap: 4px;
    max-width: 145px;
  }
  .vendor-tile {
    padding: 3px 6px 3px 3px;
    font-size: 10px !important;
    font-weight: 700 !important;
    gap: 4px;
    white-space: normal !important;
    text-align: left !important;
    line-height: 1.15 !important;
  }
  .v-logo {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    font-size: 7.5px;
  }
}

@media (max-width: 480px) {
  .hub {
    width: 118px;
    padding: 6px 9px;
    top: 3.5% !important;
  }
  .hub-name { font-size: 11.5px; }
  .hub-sub { font-size: 8px; }
  .hub-logo { width: 16px; }

  .pcard {
    padding: 5px 8px;
    min-width: 78px;
  }
  .pcard-title { font-size: 10.5px; }
  .pcard-cat { font-size: 8px; }

  .pbadge {
    font-size: 9px;
    padding: 2.5px 7px;
  }

  .cat-group {
    padding: 6px 8px 8px;
    min-width: 118px;
    max-width: 138px;
  }
  .cat-label { font-size: 8.5px; }
  .vendor-tile {
    font-size: 9px;
    padding: 2px 5px 2px 2px;
  }
  .v-logo {
    width: 16px;
    height: 16px;
    font-size: 7px;
  }
}

/* ── EXTRACTED INLINE STYLES FOR PLATFORM-DIAGRAM.HTML ── */
.js-platform-diagram-style-1 { width:14px;height:14px;object-fit:contain; }
.js-platform-diagram-style-2 { color:#0052cc; }
.js-platform-diagram-style-3 { margin-right:4px; }
.js-platform-diagram-style-4 { background:#6366f1; }
.js-platform-diagram-style-5 { background:#049fd9; }
.js-platform-diagram-style-6 { background:#c71e22; }
.js-platform-diagram-style-7 { background:#cd040b; }
.js-platform-diagram-style-8 { background:#009fdb; }
.js-platform-diagram-style-9 { background:#00938f; }
.js-platform-diagram-style-10 { background:#fff; border:1px solid #eee; }
